From 760314eb1cda1bc8bc0fc3d449dd94131d1633ef Mon Sep 17 00:00:00 2001 From: Matt Richmond Date: Tue, 14 Jan 2014 20:04:18 -0700 Subject: [PATCH] ver 3.3.1 --- config.php | 1300 +++++++++++++++++--------------- readme.txt | 22 +- settings.php | 45 +- static/css/dashboard.css | 4 +- static/img/down.png | Bin 0 -> 1146 bytes static/img/turnonscreen.jpg | Bin 130704 -> 115709 bytes static/img/up.png | Bin 0 -> 1132 bytes static/js/extras.js | 1 + thumbnailer.php | 49 +- wp_related_posts.php | 1099 +++++++++++++-------------- zemanta/zemanta.php | 1419 ++++++++++++++++++----------------- 11 files changed, 2064 insertions(+), 1875 deletions(-) create mode 100644 static/img/down.png create mode 100644 static/img/up.png create mode 100644 static/js/extras.js diff --git a/config.php b/config.php index 3257eb7..374e740 100644 --- a/config.php +++ b/config.php @@ -1,607 +1,693 @@ -exchangeArray($new_meta); - } - - return $r; -} - -function wp_rp_update_options($new_options) { - global $wp_rp_options; - - $new_options = (array) $new_options; - - $r = update_option('wp_rp_options', $new_options); - - if($r && $wp_rp_options !== false) { - $wp_rp_options->exchangeArray($new_options); - } - - return $r; -} - -function wp_rp_activate_hook() { - wp_rp_get_options(); - wp_rp_schedule_notifications_cron(); -} - -function wp_rp_deactivate_hook() { - wp_rp_unschedule_notifications_cron(); -} - -function wp_rp_upgrade() { - $wp_rp_meta = get_option('wp_rp_meta', false); - $version = false; - - if($wp_rp_meta) { - $version = $wp_rp_meta['version']; - } else { - $wp_rp_old_options = get_option('wp_rp', false); - if($wp_rp_old_options) { - $version = '1.4'; - } - } - - if($version) { - if(version_compare($version, WP_RP_VERSION, '<')) { - call_user_func('wp_rp_migrate_' . str_replace('.', '_', $version)); - wp_rp_upgrade(); - } - } else { - wp_rp_install(); - } -} - -function wp_rp_related_posts_db_table_uninstall() { - global $wpdb; - - $tags_table_name = $wpdb->prefix . "wp_rp_tags"; - - $sql = "DROP TABLE " . $tags_table_name; - - $wpdb->query($sql); -} - -function wp_rp_related_posts_db_table_install() { - global $wpdb; - - $tags_table_name = $wpdb->prefix . "wp_rp_tags"; - $sql_tags = "CREATE TABLE $tags_table_name ( - post_id mediumint(9), - post_date datetime NOT NULL, - label VARCHAR(" . WP_RP_MAX_LABEL_LENGTH . ") NOT NULL, - weight float, - INDEX post_id (post_id), - INDEX label (label) - );"; - - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); - dbDelta($sql_tags); - - $latest_posts = get_posts(array('numberposts' => WP_RP_RECOMMENDATIONS_NUM_PREGENERATED_POSTS)); - foreach ($latest_posts as $post) { - wp_rp_generate_tags($post); - } -} - -function wp_rp_install() { - $wp_rp_meta = array( - 'blog_id' => false, - 'auth_key' => false, - 'version' => WP_RP_VERSION, - 'first_version' => WP_RP_VERSION, - 'new_user' => true, - 'blog_tg' => rand(0, 1), - 'remote_recommendations' => false, - 'show_turn_on_button' => true, - 'name' => '', - 'email' => '', - 'remote_notifications' => array(), - 'turn_on_button_pressed' => false, - 'show_statistics' => false, - 'show_traffic_exchange' => false, - 'show_zemanta_linky_option' => true, - 'classic_user' => strpos(get_bloginfo('language'), 'en') === 0 // Enable only if "any" english is the default language - ); - - $wp_rp_options = array( - 'related_posts_title' => __('More from my site', 'wp_related_posts'), - 'max_related_posts' => 6, - 'exclude_categories' => '', - 'on_single_post' => true, - 'on_rss' => false, - 'max_related_post_age_in_days' => 0, - 'default_thumbnail_path' => false, - 'ctr_dashboard_enabled' => false, - 'promoted_content_enabled' => false, - 'enable_themes' => false, - 'traffic_exchange_enabled' => false, - 'thumbnail_use_custom' => false, - 'thumbnail_custom_field' => false, - 'display_zemanta_linky' => false, - - 'mobile' => array( - 'display_comment_count' => false, - 'display_publish_date' => false, - 'display_excerpt' => false, - 'display_thumbnail' => false, - 'excerpt_max_length' => 200, - 'theme_name' => 'm-modern.css', - 'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS, - ), - 'desktop' => array( - 'display_comment_count' => false, - 'display_publish_date' => false, - 'display_thumbnail' => false, - 'display_excerpt' => false, - 'excerpt_max_length' => 200, - 'theme_name' => 'vertical-m.css', - 'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS, - 'custom_theme_enabled' => false, - ) - ); - - update_option('wp_rp_meta', $wp_rp_meta); - update_option('wp_rp_options', $wp_rp_options); - - wp_rp_related_posts_db_table_install(); -} - -function wp_rp_is_classic() { - $meta = wp_rp_get_meta(); - if (isset($meta['classic_user']) && $meta['classic_user']) { - return true; - } - return false; -} - -function wp_rp_migrate_2_9() { - global $wpdb; - - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_meta['version'] = '3.0'; - $wp_rp_meta['new_user'] = false; - - update_option('wp_rp_meta', $wp_rp_meta); -} - -function wp_rp_migrate_2_8() { - global $wpdb; - - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_meta['version'] = '2.9'; - $wp_rp_meta['new_user'] = false; - - update_option('wp_rp_meta', $wp_rp_meta); -} - -function wp_rp_migrate_2_7() { - global $wpdb; - - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_meta['version'] = '2.8'; - $wp_rp_meta['new_user'] = false; - $wp_rp_meta['classic_user'] = false; - - $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key IN ('_wp_rp_extracted_image_url', '_wp_rp_extracted_image_url_full')"); - - update_option('wp_rp_meta', $wp_rp_meta); -} - -function wp_rp_migrate_2_6() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_meta['version'] = '2.7'; - $wp_rp_meta['new_user'] = false; - update_option('wp_rp_meta', $wp_rp_meta); -} - -function wp_rp_migrate_2_5() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '2.6'; - - if (!isset($wp_rp_meta['blog_tg'])) { - $wp_rp_meta['blog_tg'] = rand(0, 1); - } - - $wp_rp_meta['new_user'] = false; - - update_option('wp_rp_meta', $wp_rp_meta); - update_option('wp_rp_options', $wp_rp_options); -} - -function wp_rp_migrate_2_4_1() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '2.5'; - - $wp_rp_meta['blog_tg'] = rand(0, 1); - - $display_options = array( - 'display_comment_count' => $wp_rp_options['display_comment_count'], - 'display_publish_date' => $wp_rp_options['display_publish_date'], - 'display_thumbnail' => $wp_rp_options['display_thumbnail'], - 'display_excerpt' => $wp_rp_options['display_excerpt'], - 'excerpt_max_length' => $wp_rp_options['excerpt_max_length'], - 'theme_name' => $wp_rp_options['theme_name'], - 'theme_custom_css' => $wp_rp_options['theme_custom_css'], - 'custom_theme_enabled' => $wp_rp_options['custom_theme_enabled'] - ); - - $wp_rp_options['desktop'] = $display_options; - $wp_rp_options['mobile'] = $display_options; - - if($wp_rp_options['mobile']['theme_name'] !== 'plain.css') { - $wp_rp_options['mobile']['theme_name'] = 'm-modern.css'; - } - - unset($wp_rp_options['related_posts_title_tag']); - unset($wp_rp_options['thumbnail_display_title']); - unset($wp_rp_options['thumbnail_use_attached']); - unset($wp_rp_options['display_comment_count']); - unset($wp_rp_options['display_publish_date']); - unset($wp_rp_options['display_thumbnail']); - unset($wp_rp_options['display_excerpt']); - unset($wp_rp_options['excerpt_max_length']); - unset($wp_rp_options['theme_name']); - unset($wp_rp_options['theme_custom_css']); - unset($wp_rp_options['custom_theme_enabled']); - - $wp_rp_options['display_zemanta_linky'] = false; - $wp_rp_meta['show_zemanta_linky_option'] = true; - - update_option('wp_rp_meta', $wp_rp_meta); - update_option('wp_rp_options', $wp_rp_options); -} - -function wp_rp_migrate_2_4() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '2.4.1'; - - update_option('wp_rp_meta', $wp_rp_meta); - update_option('wp_rp_options', $wp_rp_options); -} -function wp_rp_migrate_2_3() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '2.4'; - - $wp_rp_options['max_related_post_age_in_days'] = 0; - - wp_rp_related_posts_db_table_uninstall(); - wp_rp_related_posts_db_table_install(); - - update_option('wp_rp_meta', $wp_rp_meta); - update_option('wp_rp_options', $wp_rp_options); -} - -function wp_rp_migrate_2_2() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '2.3'; - - if(isset($wp_rp_options['show_santa_hat'])) { - unset($wp_rp_options['show_santa_hat']); - } - if(isset($wp_rp_options['show_RP_in_posts'])) { - unset($wp_rp_options['show_RP_in_posts']); - } - - update_option('wp_rp_meta', $wp_rp_meta); - update_option('wp_rp_options', $wp_rp_options); -} - -function wp_rp_migrate_2_1() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '2.2'; - - $wp_rp_options['custom_theme_enabled'] = $wp_rp_options['theme_name'] == 'custom.css'; - if ($wp_rp_options['custom_theme_enabled']) { - $wp_rp_options['theme_name'] = 'plain.css'; - } - - $wp_rp_options['show_RP_in_posts'] = false; - - $wp_rp_options['traffic_exchange_enabled'] = false; - $wp_rp_meta['show_traffic_exchange'] = false; - - update_option('wp_rp_options', $wp_rp_options); - update_option('wp_rp_meta', $wp_rp_meta); -} - -function wp_rp_migrate_2_0() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '2.1'; - - if ($wp_rp_options['default_thumbnail_path']) { - $upload_dir = wp_upload_dir(); - $wp_rp_options['default_thumbnail_path'] = $upload_dir['baseurl'] . $wp_rp_options['default_thumbnail_path']; - } - - update_option('wp_rp_options', $wp_rp_options); - update_option('wp_rp_meta', $wp_rp_meta); - - if($wp_rp_options['display_thumbnail'] && $wp_rp_options['thumbnail_use_attached']) { - wp_rp_process_latest_post_thumbnails(); - } -} - -function wp_rp_migrate_1_7() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '2.0'; - - $wp_rp_options['promoted_content_enabled'] = $wp_rp_options['ctr_dashboard_enabled']; - $wp_rp_options['exclude_categories'] = $wp_rp_options['not_on_categories']; - - $wp_rp_meta['show_statistics'] = $wp_rp_options['ctr_dashboard_enabled']; - - // Commented out since we don't want to lose this info for users that will downgrade the plugin because of the change - //unset($wp_rp_options['missing_rp_algorithm']); - //unset($wp_rp_options['missing_rp_title']); - //unset($wp_rp_options['not_on_categories']); - - // Forgot to unset this the last time. - unset($wp_rp_meta['show_invite_friends_form']); - - update_option('wp_rp_options', $wp_rp_options); - update_option('wp_rp_meta', $wp_rp_meta); - - wp_rp_schedule_notifications_cron(); - wp_rp_related_posts_db_table_install(); -} - -function wp_rp_migrate_1_6() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '1.7'; - - unset($wp_rp_options['scroll_up_related_posts']); - unset($wp_rp_options['include_promotionail_link']); - unset($wp_rp_options['show_invite_friends_form']); - - $wp_rp_meta['show_blogger_network_form'] = false; - $wp_rp_meta['remote_notifications'] = array(); - - $wp_rp_meta['turn_on_button_pressed'] = false; - - update_option('wp_rp_options', $wp_rp_options); - update_option('wp_rp_meta', $wp_rp_meta); -} - -function wp_rp_migrate_1_5_2_1() { # This was a silent release, but WP_RP_VERSION was not properly updated, so we don't know exactly what happened... - $wp_rp_meta = get_option('wp_rp_meta'); - - $wp_rp_meta['version'] = '1.5.2'; - - update_option('wp_rp_meta', $wp_rp_meta); -} - -function wp_rp_migrate_1_5_2() { - $wp_rp_meta = get_option('wp_rp_meta'); - $wp_rp_options = get_option('wp_rp_options'); - - $wp_rp_meta['version'] = '1.6'; - - $wp_rp_meta['show_install_tooltip'] = false; - $wp_rp_meta['remote_recommendations'] = false; - $wp_rp_meta['show_turn_on_button'] = !($wp_rp_options['ctr_dashboard_enabled'] && $wp_rp_options['display_thumbnail']); - $wp_rp_meta['name'] = ''; - $wp_rp_meta['email'] = ''; - $wp_rp_meta['show_invite_friends_form'] = false; - - unset($wp_rp_meta['show_ctr_banner']); - unset($wp_rp_meta['show_blogger_network']); - - $wp_rp_options['scroll_up_related_posts'] = false; - - update_option('wp_rp_meta', $wp_rp_meta); - update_option('wp_rp_options', $wp_rp_options); -} -function wp_rp_migrate_1_5_1() { - $wp_rp_options = get_option('wp_rp_options'); - $wp_rp_meta = get_option('wp_rp_meta'); - - $wp_rp_options['enable_themes'] = true; - $wp_rp_meta['version'] = '1.5.2'; - - update_option('wp_rp_options', $wp_rp_options); - update_option('wp_rp_meta', $wp_rp_meta); -} -function wp_rp_migrate_1_5() { - $wp_rp_options = get_option('wp_rp_options'); - $wp_rp_meta = get_option('wp_rp_meta'); - - $wp_rp_meta['show_blogger_network'] = false; - $wp_rp_meta['version'] = '1.5.1'; - - $wp_rp_options['include_promotionail_link'] = false; - $wp_rp_options['ctr_dashboard_enabled'] = !!$wp_rp_options['ctr_dashboard_enabled']; - - update_option('wp_rp_options', $wp_rp_options); - update_option('wp_rp_meta', $wp_rp_meta); -} - -function wp_rp_migrate_1_4() { - global $wpdb; - - $wp_rp = get_option('wp_rp'); - - $wp_rp_options = array(); - - //////////////////////////////// - - $wp_rp_options['missing_rp_algorithm'] = (isset($wp_rp['wp_no_rp']) && in_array($wp_rp['wp_no_rp'], array('text', 'random', 'commented', 'popularity'))) ? $wp_rp['wp_no_rp'] : 'random'; - - if(isset($wp_rp['wp_no_rp_text']) && $wp_rp['wp_no_rp_text']) { - $wp_rp_options['missing_rp_title'] = $wp_rp['wp_no_rp_text']; - } else { - if($wp_rp_options['missing_rp_algorithm'] === 'text') { - $wp_rp_options['missing_rp_title'] = __('No Related Posts', 'wp_related_posts'); - } else { - $wp_rp_options['missing_rp_title'] = __('Random Posts', 'wp_related_posts'); - } - } - - $wp_rp_options['on_single_post'] = isset($wp_rp['wp_rp_auto']) ? !!$wp_rp['wp_rp_auto'] : true; - - $wp_rp_options['display_comment_count'] = isset($wp_rp['wp_rp_comments']) ? !!$wp_rp['wp_rp_comments'] : false; - - $wp_rp_options['display_publish_date'] = isset($wp_rp['wp_rp_date']) ? !!$wp_rp['wp_rp_date'] : false; - - $wp_rp_options['display_excerpt'] = isset($wp_rp['wp_rp_except']) ? !!$wp_rp['wp_rp_except'] : false; - - if(isset($wp_rp['wp_rp_except_number']) && is_numeric(trim($wp_rp['wp_rp_except_number']))) { - $wp_rp_options['excerpt_max_length'] = intval(trim($wp_rp['wp_rp_except_number'])); - } else { - $wp_rp_options['excerpt_max_length'] = 200; - } - - $wp_rp_options['not_on_categories'] = isset($wp_rp['wp_rp_exclude']) ? $wp_rp['wp_rp_exclude'] : ''; - - if(isset($wp_rp['wp_rp_limit']) && is_numeric(trim($wp_rp['wp_rp_limit']))) { - $wp_rp_options['max_related_posts'] = intval(trim($wp_rp['wp_rp_limit'])); - } else { - $wp_rp_options['max_related_posts'] = 5; - } - - $wp_rp_options['on_rss'] = isset($wp_rp['wp_rp_rss']) ? !!$wp_rp['wp_rp_rss'] : false; - - $wp_rp_options['theme_name'] = isset($wp_rp['wp_rp_theme']) ? $wp_rp['wp_rp_theme'] : 'plain.css'; - - $wp_rp_options['display_thumbnail'] = isset($wp_rp['wp_rp_thumbnail']) ? !!$wp_rp['wp_rp_thumbnail'] : false; - - $custom_fields = $wpdb->get_col("SELECT meta_key FROM $wpdb->postmeta GROUP BY meta_key HAVING meta_key NOT LIKE '\_%' ORDER BY LOWER(meta_key)"); - if(isset($wp_rp['wp_rp_thumbnail_post_meta']) && in_array($wp_rp['wp_rp_thumbnail_post_meta'], $custom_fields)) { - $wp_rp_options['thumbnail_custom_field'] = $wp_rp['wp_rp_thumbnail_post_meta']; - } else { - $wp_rp_options['thumbnail_custom_field'] = false; - } - - $wp_rp_options['thumbnail_display_title'] = isset($wp_rp['wp_rp_thumbnail_text']) ? !!$wp_rp['wp_rp_thumbnail_text'] : false; - - $wp_rp_options['related_posts_title'] = isset($wp_rp['wp_rp_title']) ? $wp_rp['wp_rp_title'] : ''; - - $wp_rp_options['related_posts_title_tag'] = isset($wp_rp['wp_rp_title_tag']) ? $wp_rp['wp_rp_title_tag'] : 'h3'; - - $wp_rp_options['default_thumbnail_path'] = (isset($wp_rp['wp_rp_default_thumbnail_path']) && $wp_rp['wp_rp_default_thumbnail_path']) ? $wp_rp['wp_rp_default_thumbnail_path'] : false; - - $wp_rp_options['thumbnail_use_attached'] = isset($wp_rp["wp_rp_thumbnail_extract"]) && ($wp_rp["wp_rp_thumbnail_extract"] === 'yes'); - - $wp_rp_options['thumbnail_use_custom'] = $wp_rp_options['thumbnail_custom_field'] && !(isset($wp_rp['wp_rp_thumbnail_featured']) && $wp_rp['wp_rp_thumbnail_featured'] === 'yes'); - - $wp_rp_options['theme_custom_css'] = WP_RP_DEFAULT_CUSTOM_CSS; - - $wp_rp_options['ctr_dashboard_enabled'] = false; - - //////////////////////////////// - - $wp_rp_meta = array( - 'blog_id' => false, - 'auth_key' => false, - 'version' => '1.5', - 'first_version' => '1.4', - 'new_user' => false, - 'show_upgrade_tooltip' => true, - 'show_ctr_banner' => true - ); - - update_option('wp_rp_meta', $wp_rp_meta); - update_option('wp_rp_options', $wp_rp_options); -} +exchangeArray($new_meta); + } + + return $r; +} + +function wp_rp_update_options($new_options) { + global $wp_rp_options; + + $new_options = (array) $new_options; + $r = update_option('wp_rp_options', $new_options); + if($r && $wp_rp_options !== false) { + $wp_rp_options->exchangeArray($new_options); + } + + return $r; +} + +function wp_rp_activate_hook() { + wp_rp_get_options(); + wp_rp_schedule_notifications_cron(); +} + +function wp_rp_deactivate_hook() { + wp_rp_unschedule_notifications_cron(); +} + +function wp_rp_upgrade() { + $wp_rp_meta = get_option('wp_rp_meta', false); + $version = false; + + if($wp_rp_meta) { + $version = $wp_rp_meta['version']; + } else { + $wp_rp_old_options = get_option('wp_rp', false); + if($wp_rp_old_options) { + $version = '1.4'; + } + } + + if($version) { + if(version_compare($version, WP_RP_VERSION, '<')) { + call_user_func('wp_rp_migrate_' . str_replace('.', '_', $version)); + wp_rp_upgrade(); + } + } else { + wp_rp_install(); + } +} + +function wp_rp_related_posts_db_table_uninstall() { + global $wpdb; + + $tags_table_name = $wpdb->prefix . "wp_rp_tags"; + + $sql = "DROP TABLE " . $tags_table_name; + + $wpdb->query($sql); +} + +function wp_rp_related_posts_db_table_install() { + global $wpdb; + + $tags_table_name = $wpdb->prefix . "wp_rp_tags"; + $sql_tags = "CREATE TABLE $tags_table_name ( + post_id mediumint(9), + post_date datetime NOT NULL, + label VARCHAR(" . WP_RP_MAX_LABEL_LENGTH . ") NOT NULL, + weight float, + INDEX post_id (post_id), + INDEX label (label) + );"; + + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); + dbDelta($sql_tags); + + $latest_posts = get_posts(array('numberposts' => WP_RP_RECOMMENDATIONS_NUM_PREGENERATED_POSTS)); + foreach ($latest_posts as $post) { + wp_rp_generate_tags($post); + } +} + +function wp_rp_install() { + $wp_rp_meta = array( + 'blog_id' => false, + 'auth_key' => false, + 'version' => WP_RP_VERSION, + 'first_version' => WP_RP_VERSION, + 'new_user' => true, + 'blog_tg' => rand(0, 1), + 'remote_recommendations' => false, + 'show_turn_on_button' => true, + 'name' => '', + 'email' => '', + 'remote_notifications' => array(), + 'turn_on_button_pressed' => false, + 'show_statistics' => false, + 'show_traffic_exchange' => false, + 'show_zemanta_linky_option' => true, + 'classic_user' => strpos(get_bloginfo('language'), 'en') === 0 // Enable only if "any" english is the default language + ); + + $wp_rp_options = array( + 'related_posts_title' => __('More from my site', 'wp_related_posts'), + 'max_related_posts' => 6, + 'exclude_categories' => '', + 'on_single_post' => true, + 'on_rss' => false, + 'max_related_post_age_in_days' => 0, + 'default_thumbnail_path' => false, + 'ctr_dashboard_enabled' => false, + 'promoted_content_enabled' => false, + 'enable_themes' => false, + 'traffic_exchange_enabled' => false, + 'custom_size_thumbnail_enabled' => false, + 'custom_thumbnail_width' => WP_RP_CUSTOM_THUMBNAILS_WIDTH, + 'custom_thumbnail_height' => WP_RP_CUSTOM_THUMBNAILS_HEIGHT, + 'thumbnail_use_custom' => false, + 'thumbnail_custom_field' => false, + 'display_zemanta_linky' => false, + 'only_admins_can_edit_related_posts' => false, + + 'mobile' => array( + 'display_comment_count' => false, + 'display_publish_date' => false, + 'display_excerpt' => false, + 'display_thumbnail' => false, + 'excerpt_max_length' => 200, + 'theme_name' => 'm-modern.css', + 'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS, + ), + 'desktop' => array( + 'display_comment_count' => false, + 'display_publish_date' => false, + 'display_thumbnail' => false, + 'display_excerpt' => false, + 'excerpt_max_length' => 200, + 'theme_name' => 'vertical-m.css', + 'theme_custom_css' => WP_RP_DEFAULT_CUSTOM_CSS, + 'custom_theme_enabled' => false, + ) + ); + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); + + wp_rp_related_posts_db_table_install(); +} + +function wp_rp_is_classic() { + $meta = wp_rp_get_meta(); + if (isset($meta['classic_user']) && $meta['classic_user']) { + return true; + } + return false; +} + +function wp_rp_migrate_3_3() { + global $wpdb; + + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_meta['version'] = '3.3.1'; + $wp_rp_meta['new_user'] = false; + if (floatval($wp_rp_meta['first_version']) < 2.8 && strpos(get_bloginfo('language'), 'en') === 0) { // Enable widget to all "old" users out there (old = users that started with plugin version 2.7 or below), that have their interface in english. + $wp_rp_meta['classic_user'] = true; + } + $wp_rp_options = get_option('wp_rp_options'); + $wp_rp_options['only_admins_can_edit_related_posts'] = false; + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_3_2() { + global $wpdb; + + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_meta['version'] = '3.3'; + $wp_rp_meta['new_user'] = false; + if (floatval($wp_rp_meta['first_version']) < 2.8 && strpos(get_bloginfo('language'), 'en') === 0) { // Enable widget to all "old" users out there (old = users that started with plugin version 2.7 or below), that have their interface in english. + $wp_rp_meta['classic_user'] = true; + } + update_option('wp_rp_meta', $wp_rp_meta); + +} + +function wp_rp_migrate_3_1() { + global $wpdb; + + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_meta['version'] = '3.2'; + $wp_rp_meta['new_user'] = false; + if (floatval($wp_rp_meta['first_version']) < 2.8 && strpos(get_bloginfo('language'), 'en') === 0) { // Enable widget to all "old" users out there (old = users that started with plugin version 2.7 or below), that have their interface in english. + $wp_rp_meta['classic_user'] = true; + } + $wp_rp_options = get_option('wp_rp_options'); + $wp_rp_options['custom_size_thumbnail_enabled'] = false; + $wp_rp_options['custom_thumbnail_width'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + $wp_rp_options['custom_thumbnail_height'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); + +} + + +function wp_rp_migrate_3_0() { + global $wpdb; + + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_meta['version'] = '3.1'; + $wp_rp_meta['new_user'] = false; + if (floatval($wp_rp_meta['first_version']) < 2.8 && strpos(get_bloginfo('language'), 'en') === 0) { // Enable widget to all "old" users out there (old = users that started with plugin version 2.7 or below), that have their interface in english. + $wp_rp_meta['classic_user'] = true; + } + $wp_rp_options = get_option('wp_rp_options'); + $wp_rp_options['custom_size_thumbnail_enabled'] = false; + $wp_rp_options['custom_thumbnail_width'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + $wp_rp_options['custom_thumbnail_height'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_2_9() { + global $wpdb; + + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_meta['version'] = '3.0'; + $wp_rp_meta['new_user'] = false; + $wp_rp_options = get_option('wp_rp_options'); + $wp_rp_options['custom_size_thumbnail_enabled'] = false; + $wp_rp_options['custom_thumbnail_width'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + $wp_rp_options['custom_thumbnail_height'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_2_8() { + global $wpdb; + + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_meta['version'] = '2.9'; + $wp_rp_meta['new_user'] = false; + $wp_rp_options = get_option('wp_rp_options'); + $wp_rp_options['custom_size_thumbnail_enabled'] = false; + $wp_rp_options['custom_thumbnail_width'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + $wp_rp_options['custom_thumbnail_height'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_2_7() { + global $wpdb; + + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_meta['version'] = '2.8'; + $wp_rp_meta['new_user'] = false; + $wp_rp_meta['classic_user'] = false; + $wp_rp_options = get_option('wp_rp_options'); + $wp_rp_options['custom_size_thumbnail_enabled'] = false; + $wp_rp_options['custom_thumbnail_width'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + $wp_rp_options['custom_thumbnail_height'] = WP_RP_CUSTOM_THUMBNAILS_WIDTH; + + $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key IN ('_wp_rp_extracted_image_url', '_wp_rp_extracted_image_url_full')"); + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_2_6() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_meta['version'] = '2.7'; + $wp_rp_meta['new_user'] = false; + update_option('wp_rp_meta', $wp_rp_meta); +} + +function wp_rp_migrate_2_5() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '2.6'; + + if (!isset($wp_rp_meta['blog_tg'])) { + $wp_rp_meta['blog_tg'] = rand(0, 1); + } + + $wp_rp_meta['new_user'] = false; + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_2_4_1() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '2.5'; + + $wp_rp_meta['blog_tg'] = rand(0, 1); + + $display_options = array( + 'display_comment_count' => $wp_rp_options['display_comment_count'], + 'display_publish_date' => $wp_rp_options['display_publish_date'], + 'display_thumbnail' => $wp_rp_options['display_thumbnail'], + 'display_excerpt' => $wp_rp_options['display_excerpt'], + 'excerpt_max_length' => $wp_rp_options['excerpt_max_length'], + 'theme_name' => $wp_rp_options['theme_name'], + 'theme_custom_css' => $wp_rp_options['theme_custom_css'], + 'custom_theme_enabled' => $wp_rp_options['custom_theme_enabled'] + ); + + $wp_rp_options['desktop'] = $display_options; + $wp_rp_options['mobile'] = $display_options; + + if($wp_rp_options['mobile']['theme_name'] !== 'plain.css') { + $wp_rp_options['mobile']['theme_name'] = 'm-modern.css'; + } + + unset($wp_rp_options['related_posts_title_tag']); + unset($wp_rp_options['thumbnail_display_title']); + unset($wp_rp_options['thumbnail_use_attached']); + unset($wp_rp_options['display_comment_count']); + unset($wp_rp_options['display_publish_date']); + unset($wp_rp_options['display_thumbnail']); + unset($wp_rp_options['display_excerpt']); + unset($wp_rp_options['excerpt_max_length']); + unset($wp_rp_options['theme_name']); + unset($wp_rp_options['theme_custom_css']); + unset($wp_rp_options['custom_theme_enabled']); + + $wp_rp_options['display_zemanta_linky'] = false; + $wp_rp_meta['show_zemanta_linky_option'] = true; + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_2_4() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '2.4.1'; + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} +function wp_rp_migrate_2_3() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '2.4'; + + $wp_rp_options['max_related_post_age_in_days'] = 0; + + wp_rp_related_posts_db_table_uninstall(); + wp_rp_related_posts_db_table_install(); + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_2_2() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '2.3'; + + if(isset($wp_rp_options['show_santa_hat'])) { + unset($wp_rp_options['show_santa_hat']); + } + if(isset($wp_rp_options['show_RP_in_posts'])) { + unset($wp_rp_options['show_RP_in_posts']); + } + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} + +function wp_rp_migrate_2_1() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '2.2'; + + $wp_rp_options['custom_theme_enabled'] = $wp_rp_options['theme_name'] == 'custom.css'; + if ($wp_rp_options['custom_theme_enabled']) { + $wp_rp_options['theme_name'] = 'plain.css'; + } + + $wp_rp_options['show_RP_in_posts'] = false; + + $wp_rp_options['traffic_exchange_enabled'] = false; + $wp_rp_meta['show_traffic_exchange'] = false; + + update_option('wp_rp_options', $wp_rp_options); + update_option('wp_rp_meta', $wp_rp_meta); +} + +function wp_rp_migrate_2_0() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '2.1'; + + if ($wp_rp_options['default_thumbnail_path']) { + $upload_dir = wp_upload_dir(); + $wp_rp_options['default_thumbnail_path'] = $upload_dir['baseurl'] . $wp_rp_options['default_thumbnail_path']; + } + + update_option('wp_rp_options', $wp_rp_options); + update_option('wp_rp_meta', $wp_rp_meta); + + if($wp_rp_options['display_thumbnail'] && $wp_rp_options['thumbnail_use_attached']) { + wp_rp_process_latest_post_thumbnails(); + } +} + +function wp_rp_migrate_1_7() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '2.0'; + + $wp_rp_options['promoted_content_enabled'] = $wp_rp_options['ctr_dashboard_enabled']; + $wp_rp_options['exclude_categories'] = $wp_rp_options['not_on_categories']; + + $wp_rp_meta['show_statistics'] = $wp_rp_options['ctr_dashboard_enabled']; + + // Commented out since we don't want to lose this info for users that will downgrade the plugin because of the change + //unset($wp_rp_options['missing_rp_algorithm']); + //unset($wp_rp_options['missing_rp_title']); + //unset($wp_rp_options['not_on_categories']); + + // Forgot to unset this the last time. + unset($wp_rp_meta['show_invite_friends_form']); + + update_option('wp_rp_options', $wp_rp_options); + update_option('wp_rp_meta', $wp_rp_meta); + + wp_rp_schedule_notifications_cron(); + wp_rp_related_posts_db_table_install(); +} + +function wp_rp_migrate_1_6() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '1.7'; + + unset($wp_rp_options['scroll_up_related_posts']); + unset($wp_rp_options['include_promotionail_link']); + unset($wp_rp_options['show_invite_friends_form']); + + $wp_rp_meta['show_blogger_network_form'] = false; + $wp_rp_meta['remote_notifications'] = array(); + + $wp_rp_meta['turn_on_button_pressed'] = false; + + update_option('wp_rp_options', $wp_rp_options); + update_option('wp_rp_meta', $wp_rp_meta); +} + +function wp_rp_migrate_1_5_2_1() { # This was a silent release, but WP_RP_VERSION was not properly updated, so we don't know exactly what happened... + $wp_rp_meta = get_option('wp_rp_meta'); + + $wp_rp_meta['version'] = '1.5.2'; + + update_option('wp_rp_meta', $wp_rp_meta); +} + +function wp_rp_migrate_1_5_2() { + $wp_rp_meta = get_option('wp_rp_meta'); + $wp_rp_options = get_option('wp_rp_options'); + + $wp_rp_meta['version'] = '1.6'; + + $wp_rp_meta['show_install_tooltip'] = false; + $wp_rp_meta['remote_recommendations'] = false; + $wp_rp_meta['show_turn_on_button'] = !($wp_rp_options['ctr_dashboard_enabled'] && $wp_rp_options['display_thumbnail']); + $wp_rp_meta['name'] = ''; + $wp_rp_meta['email'] = ''; + $wp_rp_meta['show_invite_friends_form'] = false; + + unset($wp_rp_meta['show_ctr_banner']); + unset($wp_rp_meta['show_blogger_network']); + + $wp_rp_options['scroll_up_related_posts'] = false; + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} +function wp_rp_migrate_1_5_1() { + $wp_rp_options = get_option('wp_rp_options'); + $wp_rp_meta = get_option('wp_rp_meta'); + + $wp_rp_options['enable_themes'] = true; + $wp_rp_meta['version'] = '1.5.2'; + + update_option('wp_rp_options', $wp_rp_options); + update_option('wp_rp_meta', $wp_rp_meta); +} +function wp_rp_migrate_1_5() { + $wp_rp_options = get_option('wp_rp_options'); + $wp_rp_meta = get_option('wp_rp_meta'); + + $wp_rp_meta['show_blogger_network'] = false; + $wp_rp_meta['version'] = '1.5.1'; + + $wp_rp_options['include_promotionail_link'] = false; + $wp_rp_options['ctr_dashboard_enabled'] = !!$wp_rp_options['ctr_dashboard_enabled']; + + update_option('wp_rp_options', $wp_rp_options); + update_option('wp_rp_meta', $wp_rp_meta); +} + +function wp_rp_migrate_1_4() { + global $wpdb; + + $wp_rp = get_option('wp_rp'); + + $wp_rp_options = array(); + + //////////////////////////////// + + $wp_rp_options['missing_rp_algorithm'] = (isset($wp_rp['wp_no_rp']) && in_array($wp_rp['wp_no_rp'], array('text', 'random', 'commented', 'popularity'))) ? $wp_rp['wp_no_rp'] : 'random'; + + if(isset($wp_rp['wp_no_rp_text']) && $wp_rp['wp_no_rp_text']) { + $wp_rp_options['missing_rp_title'] = $wp_rp['wp_no_rp_text']; + } else { + if($wp_rp_options['missing_rp_algorithm'] === 'text') { + $wp_rp_options['missing_rp_title'] = __('No Related Posts', 'wp_related_posts'); + } else { + $wp_rp_options['missing_rp_title'] = __('Random Posts', 'wp_related_posts'); + } + } + + $wp_rp_options['on_single_post'] = isset($wp_rp['wp_rp_auto']) ? !!$wp_rp['wp_rp_auto'] : true; + + $wp_rp_options['display_comment_count'] = isset($wp_rp['wp_rp_comments']) ? !!$wp_rp['wp_rp_comments'] : false; + + $wp_rp_options['display_publish_date'] = isset($wp_rp['wp_rp_date']) ? !!$wp_rp['wp_rp_date'] : false; + + $wp_rp_options['display_excerpt'] = isset($wp_rp['wp_rp_except']) ? !!$wp_rp['wp_rp_except'] : false; + + if(isset($wp_rp['wp_rp_except_number']) && is_numeric(trim($wp_rp['wp_rp_except_number']))) { + $wp_rp_options['excerpt_max_length'] = intval(trim($wp_rp['wp_rp_except_number'])); + } else { + $wp_rp_options['excerpt_max_length'] = 200; + } + + $wp_rp_options['not_on_categories'] = isset($wp_rp['wp_rp_exclude']) ? $wp_rp['wp_rp_exclude'] : ''; + + if(isset($wp_rp['wp_rp_limit']) && is_numeric(trim($wp_rp['wp_rp_limit']))) { + $wp_rp_options['max_related_posts'] = intval(trim($wp_rp['wp_rp_limit'])); + } else { + $wp_rp_options['max_related_posts'] = 5; + } + + $wp_rp_options['on_rss'] = isset($wp_rp['wp_rp_rss']) ? !!$wp_rp['wp_rp_rss'] : false; + + $wp_rp_options['theme_name'] = isset($wp_rp['wp_rp_theme']) ? $wp_rp['wp_rp_theme'] : 'plain.css'; + + $wp_rp_options['display_thumbnail'] = isset($wp_rp['wp_rp_thumbnail']) ? !!$wp_rp['wp_rp_thumbnail'] : false; + + $custom_fields = $wpdb->get_col("SELECT meta_key FROM $wpdb->postmeta GROUP BY meta_key HAVING meta_key NOT LIKE '\_%' ORDER BY LOWER(meta_key)"); + if(isset($wp_rp['wp_rp_thumbnail_post_meta']) && in_array($wp_rp['wp_rp_thumbnail_post_meta'], $custom_fields)) { + $wp_rp_options['thumbnail_custom_field'] = $wp_rp['wp_rp_thumbnail_post_meta']; + } else { + $wp_rp_options['thumbnail_custom_field'] = false; + } + + $wp_rp_options['thumbnail_display_title'] = isset($wp_rp['wp_rp_thumbnail_text']) ? !!$wp_rp['wp_rp_thumbnail_text'] : false; + + $wp_rp_options['related_posts_title'] = isset($wp_rp['wp_rp_title']) ? $wp_rp['wp_rp_title'] : ''; + + $wp_rp_options['related_posts_title_tag'] = isset($wp_rp['wp_rp_title_tag']) ? $wp_rp['wp_rp_title_tag'] : 'h3'; + + $wp_rp_options['default_thumbnail_path'] = (isset($wp_rp['wp_rp_default_thumbnail_path']) && $wp_rp['wp_rp_default_thumbnail_path']) ? $wp_rp['wp_rp_default_thumbnail_path'] : false; + + $wp_rp_options['thumbnail_use_attached'] = isset($wp_rp["wp_rp_thumbnail_extract"]) && ($wp_rp["wp_rp_thumbnail_extract"] === 'yes'); + + $wp_rp_options['thumbnail_use_custom'] = $wp_rp_options['thumbnail_custom_field'] && !(isset($wp_rp['wp_rp_thumbnail_featured']) && $wp_rp['wp_rp_thumbnail_featured'] === 'yes'); + + $wp_rp_options['theme_custom_css'] = WP_RP_DEFAULT_CUSTOM_CSS; + + $wp_rp_options['ctr_dashboard_enabled'] = false; + + //////////////////////////////// + + $wp_rp_meta = array( + 'blog_id' => false, + 'auth_key' => false, + 'version' => '1.5', + 'first_version' => '1.4', + 'new_user' => false, + 'show_upgrade_tooltip' => true, + 'show_ctr_banner' => true + ); + + update_option('wp_rp_meta', $wp_rp_meta); + update_option('wp_rp_options', $wp_rp_options); +} diff --git a/readme.txt b/readme.txt index 015882a..e075f9a 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: zemanta Tags: related,posts,post,related posts,plugin License: GPLv2 Requires at least: 3.3 -Tested up to: 3.6 -Stable tag: 3.0 +Tested up to: 3.8 +Stable tag: 3.3.1 WordPress Related Posts generates a list of related posts with thumbnails and gives you click-through statistics. @@ -30,6 +30,7 @@ WordPress Related Posts is constantly improved to bring you the highest rates of = Are there any settings? Plenty! = +* responsive themes * thumbnail size, style * number of posts * display post excerpt, publish date, number of comments @@ -81,6 +82,23 @@ Fix for security vulnerability. Upgrade immediately. == Changelog == += 3.3.1 = +* Added setting for admins to restrict the ability to edit automatically added Related posts to admins only +* Getting ready to reorganize settings page + += 3.3 = +* Fixed compatibility issues with Zemanta Editorial Assistant +* Fixed transparency for images on settings page + += 3.2 = +* Bug fixes for "Edit related posts" feature +* Changed URL for static content +* Added settings to fix custom size thumbnails issues (re-generating thumbnails might take a few minutes) + += 3.1 = +* Related content (articles) on compose screen for all users with English WordPress interface +* Language detection for WordPressP interface: non-English users don't get the widget, existing ones get opt-out + = 3.0 = * Opt-out for Related recommendations (articles) * Improved caching diff --git a/settings.php b/settings.php index 7d04999..2ae2e02 100644 --- a/settings.php +++ b/settings.php @@ -60,6 +60,7 @@ function wp_rp_settings_admin_menu() { function wp_rp_settings_scripts() { wp_enqueue_script('wp_rp_themes_script', plugins_url('static/js/themes.js', __FILE__), array('jquery'), WP_RP_VERSION); wp_enqueue_script("wp_rp_dashboard_script", plugins_url('static/js/dashboard.js', __FILE__), array('jquery'), WP_RP_VERSION); + wp_enqueue_script("wp_rp_extras_script", plugins_url('static/js/extras.js', __FILE__), array('jquery'), WP_RP_VERSION); } function wp_rp_settings_styles() { wp_enqueue_style("wp_rp_dashboard_style", plugins_url("static/css/dashboard.css", __FILE__), array(), WP_RP_VERSION); @@ -162,9 +163,14 @@ function wp_rp_settings_page() { 'traffic_exchange_enabled' => isset($postdata['wp_rp_traffic_exchange_enabled']), 'max_related_post_age_in_days' => (isset($postdata['wp_rp_max_related_post_age_in_days']) && is_numeric(trim($postdata['wp_rp_max_related_post_age_in_days']))) ? intval(trim($postdata['wp_rp_max_related_post_age_in_days'])) : 0, + 'custom_size_thumbnail_enabled' => isset($postdata['wp_rp_custom_size_thumbnail_enabled']) && $postdata['wp_rp_custom_size_thumbnail_enabled'] === 'yes', + 'custom_thumbnail_width' => isset($postdata['wp_rp_custom_thumbnail_width']) ? intval(trim($postdata['wp_rp_custom_thumbnail_width'])) : WP_RP_CUSTOM_THUMBNAILS_WIDTH , + 'custom_thumbnail_height' => isset($postdata['wp_rp_custom_thumbnail_height']) ? intval(trim($postdata['wp_rp_custom_thumbnail_height'])) : WP_RP_CUSTOM_THUMBNAILS_HEIGHT, + 'thumbnail_use_custom' => isset($postdata['wp_rp_thumbnail_use_custom']) && $postdata['wp_rp_thumbnail_use_custom'] === 'yes', 'thumbnail_custom_field' => isset($postdata['wp_rp_thumbnail_custom_field']) ? trim($postdata['wp_rp_thumbnail_custom_field']) : '', 'display_zemanta_linky' => $meta['show_zemanta_linky_option'] ? isset($postdata['wp_rp_display_zemanta_linky']) : true, + 'only_admins_can_edit_related_posts' => !empty($postdata['wp_rp_only_admins_can_edit_related_posts']), 'mobile' => array( 'display_comment_count' => isset($postdata['wp_rp_mobile_display_comment_count']), @@ -415,7 +421,7 @@ function wp_rp_settings_page() {