function tfuse_img_content() { $content = $link = ''; $args = array('numberposts' => -1); $posts_array = get_posts($args); $option_name = 'thumbnail_image'; foreach ($posts_array as $post) { $featured = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID)); if (tfuse_page_options('thumbnail_image', false, $post->ID)) { continue; } if (!empty($featured)) { $value = $featured[0]; tfuse_set_page_option($option_name, $value, $post->ID); tfuse_set_page_option('disable_image', true, $post->ID); } else { $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_parent' => $post->ID); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { $value = $attachment->guid; tfuse_set_page_option($option_name, $value, $post->ID); tfuse_set_page_option('disable_image', true, $post->ID); } } else { $content = $post->post_content; if (!empty($content)) { preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $content, $matches); if (!empty($matches)) { $link = $matches[1]; tfuse_set_page_option($option_name, $link, $post->ID); tfuse_set_page_option('disable_image', true, $post->ID); } } } } } tfuse_set_option('enable_content_img', false, $cat_id = NULL); }
function tfuse_find_hour($post_id) { global $TFUSE; if (!tf_is_real_post_save($post_id)) { return; } $time = array('hour' => $TFUSE->request->post(TF_THEME_PREFIX . '_event_hour'), 'minute' => $TFUSE->request->post(TF_THEME_PREFIX . '_event_minute'), 'time' => $TFUSE->request->post(TF_THEME_PREFIX . '_event_time')); tfuse_set_page_option('event_hour_min', $time, $post_id); $endtime = array('hour' => $TFUSE->request->post(TF_THEME_PREFIX . '_event_hour_end'), 'minute' => $TFUSE->request->post(TF_THEME_PREFIX . '_event_minute_end'), 'time' => $TFUSE->request->post(TF_THEME_PREFIX . '_event_time_end')); tfuse_set_page_option('end_hour_min', $endtime, $post_id); }