Version Description
- The subscription API forwards blog URLs
- Responsive themes bugfix
Download this release
Release Info
Developer | sparkica |
Plugin | WordPress Related Posts |
Version | 3.5.1 |
Comparing to | |
See all releases |
Code changes from version 3.4.3 to 3.5.1
- admin_notices.php +0 -22
- config.php +45 -10
- dashboard_widget.php +0 -45
- init.php +22 -80
- notifications.php +0 -129
- readme.txt +21 -11
- settings.php +73 -113
- static/css/dashboard.css +3 -1
- static/img/themes/modern.jpg +0 -0
- static/img/themes/vertical-m.jpg +0 -0
- static/img/themes/vertical-s.jpg +0 -0
- static/img/themes/vertical.jpg +0 -0
- static/img/turnonscreen.jpg +0 -0
- static/js/connect.js +0 -1
- static/js/dashboard.js +4 -11
- static/js/edit_related_posts.js +23 -24
- static/js/pinterest.js +1 -1
- static/themes/momma.css +0 -2
- static/themes/twocolumns.css +3 -3
- static/themes/vertical-m.css +1 -1
- static/themes/vertical-s.css +1 -1
- static/themes/vertical.css +1 -1
- views/settings.php +13 -60
- wp_related_posts.php +1 -1
admin_notices.php
CHANGED
@@ -2,10 +2,6 @@
|
|
2 |
|
3 |
add_action('wp_rp_admin_notices', 'wp_rp_display_admin_notices');
|
4 |
|
5 |
-
// Show connect notice on dashboard and plugins pages
|
6 |
-
add_action( 'load-index.php', 'wp_rp_prepare_admin_connect_notice' );
|
7 |
-
add_action( 'load-plugins.php', 'wp_rp_prepare_admin_connect_notice' );
|
8 |
-
|
9 |
function wp_rp_display_admin_notices() {
|
10 |
global $wp_rp_admin_notices;
|
11 |
|
@@ -14,24 +10,6 @@ function wp_rp_display_admin_notices() {
|
|
14 |
}
|
15 |
}
|
16 |
|
17 |
-
function wp_rp_prepare_admin_connect_notice() {
|
18 |
-
$meta = wp_rp_get_meta();
|
19 |
-
if ($meta['show_turn_on_button'] && !$meta['turn_on_button_pressed'] && !$meta['blog_id'] && $meta['new_user']) {
|
20 |
-
wp_register_style( 'wp_rp_connect_style', plugins_url('static/css/connect.css', __FILE__) );
|
21 |
-
wp_register_script( 'wp_rp_connect_js', plugins_url('static/js/connect.js', __FILE__) );
|
22 |
-
add_action( 'admin_notices', 'wp_rp_admin_connect_notice' );
|
23 |
-
}
|
24 |
-
}
|
25 |
-
|
26 |
-
function wp_rp_admin_connect_notice() {
|
27 |
-
if (!current_user_can('delete_users')) {
|
28 |
-
return;
|
29 |
-
}
|
30 |
-
wp_enqueue_style( 'wp_rp_connect_style' );
|
31 |
-
wp_enqueue_script( 'wp_rp_connect_js' );
|
32 |
-
include(wp_rp_get_template('connect_notice'));
|
33 |
-
}
|
34 |
-
|
35 |
function wp_rp_add_admin_notice($type = 'updated', $message = '') {
|
36 |
global $wp_rp_admin_notices;
|
37 |
|
2 |
|
3 |
add_action('wp_rp_admin_notices', 'wp_rp_display_admin_notices');
|
4 |
|
|
|
|
|
|
|
|
|
5 |
function wp_rp_display_admin_notices() {
|
6 |
global $wp_rp_admin_notices;
|
7 |
|
10 |
}
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
function wp_rp_add_admin_notice($type = 'updated', $message = '') {
|
14 |
global $wp_rp_admin_notices;
|
15 |
|
config.php
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
<?php
|
2 |
define('WP_RP_STATIC_BASE_URL', 'https://wprp.zemanta.com/static/');
|
3 |
define("WP_RP_ZEMANTA_API_URL", "http://api.zemanta.com/services/rest/0.0/");
|
|
|
4 |
define('WP_RP_STATIC_THEMES_PATH', 'static/themes/');
|
5 |
define('WP_RP_STATIC_JSON_PATH', 'json/');
|
6 |
define('WP_RP_CONTENT_BASE_URL', 'https://wprp.zemanta.com/static/');
|
@@ -190,8 +191,6 @@ function wp_rp_related_posts_db_table_install() {
|
|
190 |
|
191 |
function wp_rp_install() {
|
192 |
$wp_rp_meta = array(
|
193 |
-
'blog_id' => false,
|
194 |
-
'auth_key' => false,
|
195 |
'version' => WP_RP_VERSION,
|
196 |
'first_version' => WP_RP_VERSION,
|
197 |
'new_user' => true,
|
@@ -203,11 +202,8 @@ function wp_rp_install() {
|
|
203 |
'subscribed' => false,
|
204 |
'registered' => false,
|
205 |
'zemanta_api_key' => false,
|
206 |
-
'remote_notifications' => array(),
|
207 |
'global_notice' => null,
|
208 |
'turn_on_button_pressed' => false,
|
209 |
-
'show_statistics' => false,
|
210 |
-
'show_traffic_exchange' => false,
|
211 |
'show_zemanta_linky_option' => true,
|
212 |
'classic_user' => strpos(get_bloginfo('language'), 'en') === 0 // Enable only if "any" english is the default language
|
213 |
);
|
@@ -220,10 +216,8 @@ function wp_rp_install() {
|
|
220 |
'on_rss' => false,
|
221 |
'max_related_post_age_in_days' => 0,
|
222 |
'default_thumbnail_path' => false,
|
223 |
-
'
|
224 |
-
'
|
225 |
-
'enable_themes' => false,
|
226 |
-
'traffic_exchange_enabled' => false,
|
227 |
'custom_size_thumbnail_enabled' => false,
|
228 |
'custom_thumbnail_width' => WP_RP_CUSTOM_THUMBNAILS_WIDTH,
|
229 |
'custom_thumbnail_height' => WP_RP_CUSTOM_THUMBNAILS_HEIGHT,
|
@@ -231,10 +225,11 @@ function wp_rp_install() {
|
|
231 |
'thumbnail_custom_field' => false,
|
232 |
'display_zemanta_linky' => false,
|
233 |
'only_admins_can_edit_related_posts' => false,
|
|
|
234 |
'desktop' => array(
|
235 |
'display_comment_count' => false,
|
236 |
'display_publish_date' => false,
|
237 |
-
'display_thumbnail' =>
|
238 |
'display_excerpt' => false,
|
239 |
'excerpt_max_length' => 200,
|
240 |
'theme_name' => 'vertical-m.css',
|
@@ -257,6 +252,46 @@ function wp_rp_is_classic() {
|
|
257 |
return false;
|
258 |
}
|
259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
function wp_rp_migrate_3_4_2() {
|
261 |
$wp_rp_meta = get_option('wp_rp_meta');
|
262 |
$wp_rp_meta['version'] = '3.4.3';
|
1 |
<?php
|
2 |
define('WP_RP_STATIC_BASE_URL', 'https://wprp.zemanta.com/static/');
|
3 |
define("WP_RP_ZEMANTA_API_URL", "http://api.zemanta.com/services/rest/0.0/");
|
4 |
+
define("WP_RP_ZEMANTA_SUBSCRIPTION_URL", "http://prefs.zemanta.com/api/");
|
5 |
define('WP_RP_STATIC_THEMES_PATH', 'static/themes/');
|
6 |
define('WP_RP_STATIC_JSON_PATH', 'json/');
|
7 |
define('WP_RP_CONTENT_BASE_URL', 'https://wprp.zemanta.com/static/');
|
191 |
|
192 |
function wp_rp_install() {
|
193 |
$wp_rp_meta = array(
|
|
|
|
|
194 |
'version' => WP_RP_VERSION,
|
195 |
'first_version' => WP_RP_VERSION,
|
196 |
'new_user' => true,
|
202 |
'subscribed' => false,
|
203 |
'registered' => false,
|
204 |
'zemanta_api_key' => false,
|
|
|
205 |
'global_notice' => null,
|
206 |
'turn_on_button_pressed' => false,
|
|
|
|
|
207 |
'show_zemanta_linky_option' => true,
|
208 |
'classic_user' => strpos(get_bloginfo('language'), 'en') === 0 // Enable only if "any" english is the default language
|
209 |
);
|
216 |
'on_rss' => false,
|
217 |
'max_related_post_age_in_days' => 0,
|
218 |
'default_thumbnail_path' => false,
|
219 |
+
'promoted_content_enabled' => true,
|
220 |
+
'enable_themes' => true,
|
|
|
|
|
221 |
'custom_size_thumbnail_enabled' => false,
|
222 |
'custom_thumbnail_width' => WP_RP_CUSTOM_THUMBNAILS_WIDTH,
|
223 |
'custom_thumbnail_height' => WP_RP_CUSTOM_THUMBNAILS_HEIGHT,
|
225 |
'thumbnail_custom_field' => false,
|
226 |
'display_zemanta_linky' => false,
|
227 |
'only_admins_can_edit_related_posts' => false,
|
228 |
+
'subscription_types' => false,
|
229 |
'desktop' => array(
|
230 |
'display_comment_count' => false,
|
231 |
'display_publish_date' => false,
|
232 |
+
'display_thumbnail' => true,
|
233 |
'display_excerpt' => false,
|
234 |
'excerpt_max_length' => 200,
|
235 |
'theme_name' => 'vertical-m.css',
|
252 |
return false;
|
253 |
}
|
254 |
|
255 |
+
function wp_rp_migrate_3_5() {
|
256 |
+
$meta = get_option('wp_rp_meta');
|
257 |
+
$meta['version'] = '3.5.1';
|
258 |
+
$meta['new_user'] = false;
|
259 |
+
update_option('wp_rp_meta', $meta);
|
260 |
+
}
|
261 |
+
|
262 |
+
function wp_rp_migrate_3_4_3() {
|
263 |
+
$meta = get_option('wp_rp_meta');
|
264 |
+
$meta['version'] = '3.5';
|
265 |
+
$meta['new_user'] = false;
|
266 |
+
|
267 |
+
$remove_from_meta = array(
|
268 |
+
'show_traffic_exchange', 'show_statistics',
|
269 |
+
'remote_notifications', 'blog_id', 'auth_key'
|
270 |
+
);
|
271 |
+
foreach($remove_from_meta as $setting) {
|
272 |
+
if (isset($meta[$setting])) {
|
273 |
+
unset($meta[$setting]);
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
|
278 |
+
$meta['subscribed'] = false;
|
279 |
+
update_option('wp_rp_meta', $meta);
|
280 |
+
|
281 |
+
$options = get_option('wp_rp_options');
|
282 |
+
$options['subscription_types'] = 'newsletter,activityreport';
|
283 |
+
$remove_from_options = array(
|
284 |
+
'ctr_dashboard_enabled', 'traffic_exchange_enabled'
|
285 |
+
);
|
286 |
+
foreach($remove_from_options as $setting) {
|
287 |
+
if (isset($options[$setting])) {
|
288 |
+
unset($options[$setting]);
|
289 |
+
}
|
290 |
+
}
|
291 |
+
update_option('wp_rp_options', $options);
|
292 |
+
}
|
293 |
+
|
294 |
+
|
295 |
function wp_rp_migrate_3_4_2() {
|
296 |
$wp_rp_meta = get_option('wp_rp_meta');
|
297 |
$wp_rp_meta['version'] = '3.4.3';
|
dashboard_widget.php
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
//
|
3 |
-
// Dashboard widget
|
4 |
-
//
|
5 |
-
|
6 |
-
add_action('wp_dashboard_setup', 'wp_rp_dashboard_setup');
|
7 |
-
|
8 |
-
function wp_rp_dashboard_setup() {
|
9 |
-
if (!current_user_can('delete_users')) {
|
10 |
-
return;
|
11 |
-
}
|
12 |
-
|
13 |
-
$options = wp_rp_get_options();
|
14 |
-
$meta = wp_rp_get_meta();
|
15 |
-
|
16 |
-
if ($options['ctr_dashboard_enabled'] && $meta['blog_id'] && $meta['auth_key']) {
|
17 |
-
wp_add_dashboard_widget('wp_rp_dashboard_widget', 'Related Posts', 'wp_rp_display_dashboard_widget');
|
18 |
-
add_action('admin_enqueue_scripts', 'wp_rp_dashboard_scripts');}
|
19 |
-
}
|
20 |
-
|
21 |
-
function wp_rp_display_dashboard_widget() {
|
22 |
-
$options = wp_rp_get_options();
|
23 |
-
$meta = wp_rp_get_meta();
|
24 |
-
?>
|
25 |
-
<input type="hidden" id="wp_rp_dashboard_url" value="<?php esc_attr_e(WP_RP_CTR_DASHBOARD_URL); ?>" />
|
26 |
-
<input type="hidden" id="wp_rp_static_base_url" value="<?php esc_attr_e(WP_RP_STATIC_BASE_URL); ?>" />
|
27 |
-
<input type="hidden" id="wp_rp_blog_id" value="<?php esc_attr_e($meta['blog_id']); ?>" />
|
28 |
-
<input type="hidden" id="wp_rp_auth_key" value="<?php esc_attr_e($meta['auth_key']); ?>" />
|
29 |
-
<?php if($meta['show_traffic_exchange'] && $options['traffic_exchange_enabled']): ?>
|
30 |
-
<input type="hidden" id="wp_rp_show_traffic_exchange_statistics" value="1" />
|
31 |
-
<?php endif; ?>
|
32 |
-
|
33 |
-
<div id="wp_rp_wrap" class="wp_rp_dashboard">
|
34 |
-
<?php wp_rp_print_notifications(); ?>
|
35 |
-
<div id="wp_rp_statistics_wrap"></div>
|
36 |
-
</div>
|
37 |
-
<?php
|
38 |
-
}
|
39 |
-
|
40 |
-
function wp_rp_dashboard_scripts($hook) {
|
41 |
-
if($hook === 'index.php') {
|
42 |
-
wp_enqueue_script('wp_rp_dashboard_script', plugins_url('static/js/dashboard.js', __FILE__), array('jquery'));
|
43 |
-
//wp_enqueue_style('wp_rp_dashaboard_style', plugins_url('static/css/dashboard.css', __FILE__));
|
44 |
-
}
|
45 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
define('WP_RP_VERSION', '3.
|
3 |
|
4 |
define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
|
5 |
|
@@ -8,12 +8,10 @@ include_once(dirname(__FILE__) . '/lib/stemmer.php');
|
|
8 |
include_once(dirname(__FILE__) . '/lib/mobile_detect.php');
|
9 |
|
10 |
include_once(dirname(__FILE__) . '/admin_notices.php');
|
11 |
-
include_once(dirname(__FILE__) . '/notifications.php');
|
12 |
include_once(dirname(__FILE__) . '/widget.php');
|
13 |
include_once(dirname(__FILE__) . '/thumbnailer.php');
|
14 |
include_once(dirname(__FILE__) . '/settings.php');
|
15 |
include_once(dirname(__FILE__) . '/recommendations.php');
|
16 |
-
//include_once(dirname(__FILE__) . '/dashboard_widget.php');
|
17 |
include_once(dirname(__FILE__) . '/edit_related_posts.php');
|
18 |
include_once(dirname(__FILE__) . '/compatibility.php');
|
19 |
|
@@ -271,8 +269,6 @@ function wp_rp_generate_related_posts_list_items($related_posts, $selected_relat
|
|
271 |
$platform_options = wp_rp_get_platform_options();
|
272 |
$output = "";
|
273 |
|
274 |
-
$statistics_enabled = $options['ctr_dashboard_enabled'];
|
275 |
-
|
276 |
$limit = $options['max_related_posts'];
|
277 |
|
278 |
$inserted_urls = array(); // Used to prevent duplicates
|
@@ -307,10 +303,7 @@ function wp_rp_generate_related_posts_list_items($related_posts, $selected_relat
|
|
307 |
$post_id = 'ex-' . $related_post->ID;
|
308 |
}
|
309 |
|
310 |
-
$data_attrs = '';
|
311 |
-
if ($statistics_enabled) {
|
312 |
-
$data_attrs .= 'data-position="' . $i . '" data-poid="' . $post_id . '" data-post-type="' . $post_type . '" ';
|
313 |
-
}
|
314 |
|
315 |
$output .= '<li ' . $data_attrs . '>';
|
316 |
|
@@ -377,39 +370,6 @@ function wp_rp_should_exclude() {
|
|
377 |
return $count > 0;
|
378 |
}
|
379 |
|
380 |
-
function wp_rp_ajax_blogger_network_blacklist_callback() {
|
381 |
-
check_ajax_referer('wp_rp_ajax_nonce');
|
382 |
-
if (!current_user_can('delete_users')) {
|
383 |
-
die();
|
384 |
-
}
|
385 |
-
|
386 |
-
$sourcefeed = (int) $_GET['sourcefeed'];
|
387 |
-
|
388 |
-
$meta = wp_rp_get_meta();
|
389 |
-
|
390 |
-
$blog_id = $meta['blog_id'];
|
391 |
-
$auth_key = $meta['auth_key'];
|
392 |
-
$req_options = array(
|
393 |
-
'timeout' => 5
|
394 |
-
);
|
395 |
-
$url = WP_RP_CTR_DASHBOARD_URL . "blacklist/?blog_id=$blog_id&auth_key=$auth_key&sfid=$sourcefeed";
|
396 |
-
$response = wp_remote_get($url, $req_options);
|
397 |
-
|
398 |
-
if (wp_remote_retrieve_response_code($response) == 200) {
|
399 |
-
$body = wp_remote_retrieve_body($response);
|
400 |
-
if ($body) {
|
401 |
-
$doc = json_decode($body);
|
402 |
-
if ($doc && $doc->status === 'ok') {
|
403 |
-
header('Content-Type: text/javascript');
|
404 |
-
echo "if(window['_wp_rp_blacklist_callback$sourcefeed']) window._wp_rp_blacklist_callback$sourcefeed();";
|
405 |
-
}
|
406 |
-
}
|
407 |
-
}
|
408 |
-
die();
|
409 |
-
}
|
410 |
-
|
411 |
-
add_action('wp_ajax_rp_blogger_network_blacklist', 'wp_rp_ajax_blogger_network_blacklist_callback');
|
412 |
-
|
413 |
function wp_rp_head_resources() {
|
414 |
global $post, $wpdb;
|
415 |
|
@@ -423,15 +383,8 @@ function wp_rp_head_resources() {
|
|
423 |
$options = wp_rp_get_options();
|
424 |
$platform_options = wp_rp_get_platform_options();
|
425 |
//error_log('theme name 1: ' . $platform_options['theme_name']);
|
426 |
-
$statistics_enabled = false;
|
427 |
-
$remote_recommendations = false;
|
428 |
$output = '';
|
429 |
|
430 |
-
if (is_single()) {
|
431 |
-
$statistics_enabled = $options['ctr_dashboard_enabled'] && $meta['blog_id'] && $meta['auth_key'];
|
432 |
-
$remote_recommendations = $meta['remote_recommendations'] && $statistics_enabled;
|
433 |
-
}
|
434 |
-
|
435 |
$output_vars = "\twindow._wp_rp_static_base_url = '" . esc_js(WP_RP_STATIC_BASE_URL) . "';\n" .
|
436 |
"\twindow._wp_rp_wp_ajax_url = \"" . admin_url('admin-ajax.php') . "\";\n" .
|
437 |
"\twindow._wp_rp_plugin_version = '" . WP_RP_VERSION . "';\n" .
|
@@ -439,34 +392,27 @@ function wp_rp_head_resources() {
|
|
439 |
"\twindow._wp_rp_num_rel_posts = '" . $options['max_related_posts'] . "';\n";
|
440 |
|
441 |
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
$post_tags = '[]';
|
448 |
-
}
|
449 |
-
|
450 |
-
$output_vars .= "\twindow._wp_rp_blog_id = '" . esc_js($meta['blog_id']) . "';\n" .
|
451 |
-
"\twindow._wp_rp_thumbnails = " . ($platform_options['display_thumbnail'] ? 'true' : 'false') . ";\n" .
|
452 |
-
"\twindow._wp_rp_post_title = '" . urlencode($post->post_title) . "';\n" .
|
453 |
-
"\twindow._wp_rp_post_tags = {$post_tags};\n" .
|
454 |
-
"\twindow._wp_rp_remote_recommendations = " . ($remote_recommendations ? 'true' : 'false') . ";\n" .
|
455 |
-
"\twindow._wp_rp_promoted_content = " . ($options['promoted_content_enabled'] ? 'true' : 'false') . ";\n" .
|
456 |
-
"\twindow._wp_rp_traffic_exchange = " . ($options['traffic_exchange_enabled'] ? 'true' : 'false') . ";\n" .
|
457 |
-
(current_user_can('edit_posts') ?
|
458 |
-
"\twindow._wp_rp_admin_ajax_url = '" . admin_url('admin-ajax.php') . "';\n" .
|
459 |
-
"\twindow._wp_rp_plugin_static_base_url = '" . esc_js(plugins_url('static/' , __FILE__)) . "';\n" .
|
460 |
-
"\twindow._wp_rp_ajax_nonce = '" . wp_create_nonce("wp_rp_ajax_nonce") . "';\n" .
|
461 |
-
"\twindow._wp_rp_erp_search = true;\n"
|
462 |
-
: '');
|
463 |
}
|
464 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
$output .= "<script type=\"text/javascript\">\n" . $output_vars . "</script>\n";
|
466 |
|
467 |
-
|
468 |
-
$output .= '<script type="text/javascript" src="' . WP_RP_STATIC_BASE_URL . WP_RP_STATIC_LOADER_FILE . '?version=' . WP_RP_VERSION . '" async></script>' . "\n";
|
469 |
-
}
|
470 |
|
471 |
$static_url = plugins_url('static/', __FILE__);
|
472 |
$theme_url = plugins_url(WP_RP_STATIC_THEMES_PATH, __FILE__);
|
@@ -489,7 +435,7 @@ function wp_rp_head_resources() {
|
|
489 |
$output .= '<style type="text/css">' . "\n" . $platform_options['theme_custom_css'] . "</style>\n";
|
490 |
}
|
491 |
|
492 |
-
if (current_user_can('edit_posts')
|
493 |
wp_enqueue_style('wp_rp_edit_related_posts_css', $theme_url . 'edit_related_posts.css', array(), WP_RP_VERSION);
|
494 |
wp_enqueue_script('wp_rp_edit_related_posts_js', $static_url . 'js/edit_related_posts.js', array('jquery'), WP_RP_VERSION);
|
495 |
}
|
@@ -530,9 +476,6 @@ function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
|
530 |
$platform_options = wp_rp_get_platform_options();
|
531 |
$meta = wp_rp_get_meta();
|
532 |
|
533 |
-
$statistics_enabled = $options['ctr_dashboard_enabled'] && $meta['blog_id'] && $meta['auth_key'];
|
534 |
-
$remote_recommendations = is_single() && $meta['remote_recommendations'] && $statistics_enabled;
|
535 |
-
|
536 |
$posts_and_title = wp_rp_fetch_posts_and_title();
|
537 |
$related_posts = $posts_and_title['posts'];
|
538 |
$title = $posts_and_title['title'];
|
@@ -546,7 +489,7 @@ function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
|
546 |
}
|
547 |
|
548 |
$posts_footer = '';
|
549 |
-
if (current_user_can($options['only_admins_can_edit_related_posts'] ? 'manage_options' : 'edit_posts')
|
550 |
$posts_footer .= '<div class="wp_rp_footer"><a class="wp_rp_edit" href="#" id="wp_rp_edit_related_posts">Edit Related Posts</a></div>';
|
551 |
}
|
552 |
if ($options['display_zemanta_linky']) {
|
@@ -557,7 +500,7 @@ function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
|
557 |
$css_classes_wrap = ' ' . str_replace(array('.css', '-'), array('', '_'), esc_attr('wp_rp_' . $platform_options['theme_name']));
|
558 |
|
559 |
$related_posts_lis = wp_rp_generate_related_posts_list_items($related_posts, $selected_related_posts);
|
560 |
-
$related_posts_ul = '<ul class="' . $css_classes . '"
|
561 |
|
562 |
$related_posts_title = $title ? ($before_title ? $before_title . $title . $after_title : '<h3 class="related_post_title">' . $title . '</h3>') : '';
|
563 |
|
@@ -579,7 +522,6 @@ function wp_rp_get_related_posts($before_title = '', $after_title = '') {
|
|
579 |
$related_posts_ul .
|
580 |
$posts_footer .
|
581 |
'</div>' .
|
582 |
-
($remote_recommendations ? '<script type="text/javascript">window._wp_rp_callback_widget_exists ? window._wp_rp_callback_widget_exists() : false;</script>' : '') .
|
583 |
'</div>';
|
584 |
|
585 |
return "\n" . $output . "\n";
|
1 |
<?php
|
2 |
+
define('WP_RP_VERSION', '3.5.1');
|
3 |
|
4 |
define('WP_RP_PLUGIN_FILE', plugin_basename(__FILE__));
|
5 |
|
8 |
include_once(dirname(__FILE__) . '/lib/mobile_detect.php');
|
9 |
|
10 |
include_once(dirname(__FILE__) . '/admin_notices.php');
|
|
|
11 |
include_once(dirname(__FILE__) . '/widget.php');
|
12 |
include_once(dirname(__FILE__) . '/thumbnailer.php');
|
13 |
include_once(dirname(__FILE__) . '/settings.php');
|
14 |
include_once(dirname(__FILE__) . '/recommendations.php');
|
|
|
15 |
include_once(dirname(__FILE__) . '/edit_related_posts.php');
|
16 |
include_once(dirname(__FILE__) . '/compatibility.php');
|
17 |
|
269 |
$platform_options = wp_rp_get_platform_options();
|
270 |
$output = "";
|
271 |
|
|
|
|
|
272 |
$limit = $options['max_related_posts'];
|
273 |
|
274 |
$inserted_urls = array(); // Used to prevent duplicates
|
303 |
$post_id = 'ex-' . $related_post->ID;
|
304 |
}
|
305 |
|
306 |
+
$data_attrs = 'data-position="' . $i . '" data-poid="' . $post_id . '" data-post-type="' . $post_type . '" ';
|
|
|
|
|
|
|
307 |
|
308 |
$output .= '<li ' . $data_attrs . '>';
|
309 |
|
370 |
return $count > 0;
|
371 |
}
|
372 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
function wp_rp_head_resources() {
|
374 |
global $post, $wpdb;
|
375 |
|
383 |
$options = wp_rp_get_options();
|
384 |
$platform_options = wp_rp_get_platform_options();
|
385 |
//error_log('theme name 1: ' . $platform_options['theme_name']);
|
|
|
|
|
386 |
$output = '';
|
387 |
|
|
|
|
|
|
|
|
|
|
|
388 |
$output_vars = "\twindow._wp_rp_static_base_url = '" . esc_js(WP_RP_STATIC_BASE_URL) . "';\n" .
|
389 |
"\twindow._wp_rp_wp_ajax_url = \"" . admin_url('admin-ajax.php') . "\";\n" .
|
390 |
"\twindow._wp_rp_plugin_version = '" . WP_RP_VERSION . "';\n" .
|
392 |
"\twindow._wp_rp_num_rel_posts = '" . $options['max_related_posts'] . "';\n";
|
393 |
|
394 |
|
395 |
+
$tags = $wpdb->get_col("SELECT DISTINCT(label) FROM " . $wpdb->prefix . "wp_rp_tags WHERE post_id=$post->ID ORDER BY weight desc;", 0);
|
396 |
+
if (!empty($tags)) {
|
397 |
+
$post_tags = '[' . implode(', ', array_map(create_function('$v', 'return "\'" . urlencode(substr($v, strpos($v, \'_\') + 1)) . "\'";'), $tags)) . ']';
|
398 |
+
} else {
|
399 |
+
$post_tags = '[]';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
400 |
}
|
401 |
|
402 |
+
$output_vars .= "\twindow._wp_rp_thumbnails = " . ($platform_options['display_thumbnail'] ? 'true' : 'false') . ";\n" .
|
403 |
+
"\twindow._wp_rp_post_title = '" . urlencode($post->post_title) . "';\n" .
|
404 |
+
"\twindow._wp_rp_post_tags = {$post_tags};\n" .
|
405 |
+
"\twindow._wp_rp_promoted_content = " . ($options['promoted_content_enabled'] ? 'true' : 'false') . ";\n" .
|
406 |
+
(current_user_can('edit_posts') ?
|
407 |
+
"\twindow._wp_rp_admin_ajax_url = '" . admin_url('admin-ajax.php') . "';\n" .
|
408 |
+
"\twindow._wp_rp_plugin_static_base_url = '" . esc_js(plugins_url('static/' , __FILE__)) . "';\n" .
|
409 |
+
"\twindow._wp_rp_ajax_nonce = '" . wp_create_nonce("wp_rp_ajax_nonce") . "';\n" .
|
410 |
+
"\twindow._wp_rp_erp_search = true;\n"
|
411 |
+
: '');
|
412 |
+
|
413 |
$output .= "<script type=\"text/javascript\">\n" . $output_vars . "</script>\n";
|
414 |
|
415 |
+
$output .= '<script type="text/javascript" src="' . WP_RP_STATIC_BASE_URL . WP_RP_STATIC_LOADER_FILE . '?version=' . WP_RP_VERSION . '" async></script>' . "\n";
|
|
|
|
|
416 |
|
417 |
$static_url = plugins_url('static/', __FILE__);
|
418 |
$theme_url = plugins_url(WP_RP_STATIC_THEMES_PATH, __FILE__);
|
435 |
$output .= '<style type="text/css">' . "\n" . $platform_options['theme_custom_css'] . "</style>\n";
|
436 |
}
|
437 |
|
438 |
+
if (current_user_can('edit_posts')) {
|
439 |
wp_enqueue_style('wp_rp_edit_related_posts_css', $theme_url . 'edit_related_posts.css', array(), WP_RP_VERSION);
|
440 |
wp_enqueue_script('wp_rp_edit_related_posts_js', $static_url . 'js/edit_related_posts.js', array('jquery'), WP_RP_VERSION);
|
441 |
}
|
476 |
$platform_options = wp_rp_get_platform_options();
|
477 |
$meta = wp_rp_get_meta();
|
478 |
|
|
|
|
|
|
|
479 |
$posts_and_title = wp_rp_fetch_posts_and_title();
|
480 |
$related_posts = $posts_and_title['posts'];
|
481 |
$title = $posts_and_title['title'];
|
489 |
}
|
490 |
|
491 |
$posts_footer = '';
|
492 |
+
if (current_user_can($options['only_admins_can_edit_related_posts'] ? 'manage_options' : 'edit_posts')) {
|
493 |
$posts_footer .= '<div class="wp_rp_footer"><a class="wp_rp_edit" href="#" id="wp_rp_edit_related_posts">Edit Related Posts</a></div>';
|
494 |
}
|
495 |
if ($options['display_zemanta_linky']) {
|
500 |
$css_classes_wrap = ' ' . str_replace(array('.css', '-'), array('', '_'), esc_attr('wp_rp_' . $platform_options['theme_name']));
|
501 |
|
502 |
$related_posts_lis = wp_rp_generate_related_posts_list_items($related_posts, $selected_related_posts);
|
503 |
+
$related_posts_ul = '<ul class="' . $css_classes . '">' . $related_posts_lis . '</ul>';
|
504 |
|
505 |
$related_posts_title = $title ? ($before_title ? $before_title . $title . $after_title : '<h3 class="related_post_title">' . $title . '</h3>') : '';
|
506 |
|
522 |
$related_posts_ul .
|
523 |
$posts_footer .
|
524 |
'</div>' .
|
|
|
525 |
'</div>';
|
526 |
|
527 |
return "\n" . $output . "\n";
|
notifications.php
DELETED
@@ -1,129 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
//
|
3 |
-
// Notifications system
|
4 |
-
//
|
5 |
-
|
6 |
-
add_action('wp_rp_load_notifications', 'wp_rp_load_remote_notifications');
|
7 |
-
|
8 |
-
function wp_rp_dismiss_notification($id) {
|
9 |
-
$meta = wp_rp_get_meta();
|
10 |
-
$messages_ref =& $meta['remote_notifications'];
|
11 |
-
|
12 |
-
if(array_key_exists($id, $messages_ref)) {
|
13 |
-
unset($messages_ref[$id]);
|
14 |
-
wp_rp_update_meta($meta);
|
15 |
-
|
16 |
-
$blog_id = $meta['blog_id'];
|
17 |
-
$auth_key = $meta['auth_key'];
|
18 |
-
$req_options = array(
|
19 |
-
'timeout' => 5
|
20 |
-
);
|
21 |
-
$url = WP_RP_CTR_DASHBOARD_URL . "notifications/dismiss/?blog_id=$blog_id&auth_key=$auth_key&msg_id=$id";
|
22 |
-
$response = wp_remote_get($url, $req_options);
|
23 |
-
|
24 |
-
return true;
|
25 |
-
}
|
26 |
-
return false;
|
27 |
-
}
|
28 |
-
|
29 |
-
function wp_rp_number_of_available_notifications() {
|
30 |
-
$meta = wp_rp_get_meta();
|
31 |
-
|
32 |
-
return sizeof($meta['remote_notifications']);
|
33 |
-
}
|
34 |
-
|
35 |
-
function wp_rp_print_notifications() {
|
36 |
-
$meta = wp_rp_get_meta();
|
37 |
-
$messages = $meta['remote_notifications'];
|
38 |
-
|
39 |
-
foreach($messages as $id => $text) {
|
40 |
-
echo '<div class="wp_rp_notification">
|
41 |
-
<a href="' . admin_url('admin-ajax.php?action=rp_dismiss_notification&id=' . $id . '&_wpnonce=' . wp_create_nonce("wp_rp_ajax_nonce")) . '" class="close">x</a>
|
42 |
-
<p>' . $text . '</p>
|
43 |
-
</div>';
|
44 |
-
}
|
45 |
-
}
|
46 |
-
|
47 |
-
function wp_rp_schedule_notifications_cron() {
|
48 |
-
if(!wp_next_scheduled('wp_rp_load_notifications')) {
|
49 |
-
wp_schedule_event(time(), 'hourly', 'wp_rp_load_notifications');
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
function wp_rp_unschedule_notifications_cron() {
|
54 |
-
wp_clear_scheduled_hook('wp_rp_load_notifications');
|
55 |
-
}
|
56 |
-
|
57 |
-
// Notifications cron job hourly callback
|
58 |
-
function wp_rp_load_remote_notifications() {
|
59 |
-
$meta = wp_rp_get_meta();
|
60 |
-
$options = wp_rp_get_options();
|
61 |
-
|
62 |
-
$blog_id = $meta['blog_id'];
|
63 |
-
$auth_key = $meta['auth_key'];
|
64 |
-
|
65 |
-
$req_options = array(
|
66 |
-
'timeout' => 5
|
67 |
-
);
|
68 |
-
|
69 |
-
if(!$blog_id || !$auth_key || !$options['ctr_dashboard_enabled']) return;
|
70 |
-
|
71 |
-
// receive remote recommendations
|
72 |
-
$url = WP_RP_CTR_DASHBOARD_URL . "notifications/?blog_id=$blog_id&auth_key=$auth_key";
|
73 |
-
$response = wp_remote_get($url, $req_options);
|
74 |
-
|
75 |
-
if (wp_remote_retrieve_response_code($response) == 200) {
|
76 |
-
$body = wp_remote_retrieve_body($response);
|
77 |
-
|
78 |
-
if ($body) {
|
79 |
-
$json = json_decode($body);
|
80 |
-
|
81 |
-
if ($json && isset($json->status) && $json->status === 'ok' && isset($json->data) && is_object($json->data))
|
82 |
-
{
|
83 |
-
$messages_ref =& $meta['remote_notifications'];
|
84 |
-
$data = $json->data;
|
85 |
-
|
86 |
-
if(isset($data->msgs) && is_array($data->msgs)) {
|
87 |
-
// add new messages from server and update old ones
|
88 |
-
foreach($data->msgs as $msg) {
|
89 |
-
$messages_ref[$msg->msg_id] = $msg->text;
|
90 |
-
}
|
91 |
-
|
92 |
-
// sort messages by identifier
|
93 |
-
ksort($messages_ref);
|
94 |
-
}
|
95 |
-
|
96 |
-
if(isset($data->delete_msgs) && is_array($data->delete_msgs)) {
|
97 |
-
foreach($data->delete_msgs as $msg_id) {
|
98 |
-
if(array_key_exists($msg_id, $messages_ref)) {
|
99 |
-
unset($messages_ref[$msg_id]);
|
100 |
-
}
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
if(isset($data->turn_on_remote_recommendations) && $data->turn_on_remote_recommendations) {
|
105 |
-
$meta['remote_recommendations'] = true;
|
106 |
-
} else if(isset($data->turn_off_remote_recommendations) && $data->turn_off_remote_recommendations) {
|
107 |
-
$meta['remote_recommendations'] = false;
|
108 |
-
}
|
109 |
-
|
110 |
-
if(isset($data->show_blogger_network_form) && $data->show_blogger_network_form) {
|
111 |
-
$meta['show_blogger_network_form'] = true;
|
112 |
-
} else if(isset($data->hide_blogger_network_form) && $data->hide_blogger_network_form) {
|
113 |
-
$meta['show_blogger_network_form'] = false;
|
114 |
-
}
|
115 |
-
|
116 |
-
if(isset($data->show_traffic_exchange) && $data->show_traffic_exchange) {
|
117 |
-
$meta['show_traffic_exchange'] = true;
|
118 |
-
$options['traffic_exchange_enabled'] = true;
|
119 |
-
} else if(isset($data->hide_traffic_exchange) && $data->hide_traffic_exchange) {
|
120 |
-
$meta['show_traffic_exchange'] = false;
|
121 |
-
$options['traffic_exchange_enabled'] = false;
|
122 |
-
}
|
123 |
-
|
124 |
-
wp_rp_update_meta($meta);
|
125 |
-
wp_rp_update_options($options);
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
129 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -2,16 +2,15 @@
|
|
2 |
Contributors: zemanta
|
3 |
Tags: related,posts,post,related posts,plugin,seo
|
4 |
License: GPLv2
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to:
|
7 |
-
Stable tag: 3.
|
8 |
|
9 |
-
WordPress Related Posts
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Automatically added Related Posts can increase your internal traffic up to 10%. Just install and activate. To attract attention and improve SEO, link out to Related Posts across the web from your compose screen. Search for posts and hand-pick them with ease. Recommendations are provided by Zemanta's world-class semantic service,
|
14 |
-
The plugin also delivers statistics about Pageviews and Clicks*. It supports different styles, thumbnails and is fully customizable.
|
15 |
|
16 |
After installation, go to Settings -> Related Posts in your plugins list and Turn on Advanced Features!
|
17 |
|
@@ -23,8 +22,6 @@ After installation, go to Settings -> Related Posts in your plugins list and Tur
|
|
23 |
|
24 |
[vimeo http://vimeo.com/91619827]
|
25 |
|
26 |
-
* Note: Real time traffic analytics are provided via third party service.
|
27 |
-
|
28 |
|
29 |
== Frequently Asked Questions ==
|
30 |
|
@@ -57,6 +54,10 @@ Yes, Zemanta is offered in different themes which you can also customize with si
|
|
57 |
|
58 |
No, Zemanta does not use redirects and is juice friendly. :)
|
59 |
|
|
|
|
|
|
|
|
|
60 |
== Installation ==
|
61 |
|
62 |
= Via admin: =
|
@@ -71,14 +72,16 @@ No, Zemanta does not use redirects and is juice friendly. :)
|
|
71 |
1. Download the plugin .zip file
|
72 |
2. Log in to yourdomain.com/wp-admin
|
73 |
3. Click Plugins -> Add New -> Upload
|
74 |
-
4. After installation activate the plugin and
|
75 |
5. If you use any caching plugin please clear the cache
|
76 |
6. You're finished!
|
77 |
|
78 |
== Screenshots ==
|
79 |
1. WordPress Related Posts Default Theme.
|
80 |
-
2. WordPress Related Posts
|
81 |
-
|
|
|
|
|
82 |
|
83 |
== Upgrade Notice ==
|
84 |
|
@@ -90,6 +93,13 @@ Fix for security vulnerability. Upgrade immediately.
|
|
90 |
|
91 |
== Changelog ==
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
= 3.4.3 =
|
94 |
* Updated HTTPS urls
|
95 |
* Changed registration process
|
2 |
Contributors: zemanta
|
3 |
Tags: related,posts,post,related posts,plugin,seo
|
4 |
License: GPLv2
|
5 |
+
Requires at least: 3.6
|
6 |
+
Tested up to: 4.0
|
7 |
+
Stable tag: 3.5.1
|
8 |
|
9 |
+
WordPress Related Posts - the plugin for related posts with thumbnails. Caching included.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Automatically added Related Posts can increase your internal traffic up to 10%. Just install and activate. To attract attention and improve SEO, link out to Related Posts across the web from your compose screen. Search for posts and hand-pick them with ease. Recommendations are provided by Zemanta's world-class semantic service. Plugin supports different styles, thumbnails, is fully customizable and includes caching for improved performance.
|
|
|
14 |
|
15 |
After installation, go to Settings -> Related Posts in your plugins list and Turn on Advanced Features!
|
16 |
|
22 |
|
23 |
[vimeo http://vimeo.com/91619827]
|
24 |
|
|
|
|
|
25 |
|
26 |
== Frequently Asked Questions ==
|
27 |
|
54 |
|
55 |
No, Zemanta does not use redirects and is juice friendly. :)
|
56 |
|
57 |
+
= What about Terms of Service and Privacy Policy? =
|
58 |
+
|
59 |
+
Before using the plugin please read the full version of [Zemanta Terms of Service](http://www.zemanta.com/legal/terms-of-service/) and [Zemanta Privacy Policy](http://www.zemanta.com/legal/privacy/).
|
60 |
+
|
61 |
== Installation ==
|
62 |
|
63 |
= Via admin: =
|
72 |
1. Download the plugin .zip file
|
73 |
2. Log in to yourdomain.com/wp-admin
|
74 |
3. Click Plugins -> Add New -> Upload
|
75 |
+
4. After installation activate the plugin and check advanced features
|
76 |
5. If you use any caching plugin please clear the cache
|
77 |
6. You're finished!
|
78 |
|
79 |
== Screenshots ==
|
80 |
1. WordPress Related Posts Default Theme.
|
81 |
+
2. WordPress Related Posts responsive theme on a Galaxy Nexus and iPhone 4s.
|
82 |
+
|
83 |
+
== Terms of service ==
|
84 |
+
The plugin source code is released under GPLv2. Usage of plugin is governed by [Zemanta Terms of Service](http://www.zemanta.com/legal/terms-of-service/) and [Zemanta Privacy Policy](http://www.zemanta.com/legal/privacy/).
|
85 |
|
86 |
== Upgrade Notice ==
|
87 |
|
93 |
|
94 |
== Changelog ==
|
95 |
|
96 |
+
= 3.5.1 =
|
97 |
+
* The subscription API forwards blog URLs
|
98 |
+
* Responsive themes bugfix
|
99 |
+
|
100 |
+
= 3.5 =
|
101 |
+
* Removed statistics
|
102 |
+
|
103 |
= 3.4.3 =
|
104 |
* Updated HTTPS urls
|
105 |
* Changed registration process
|
settings.php
CHANGED
@@ -20,33 +20,66 @@ function wp_rp_add_link_to_settings($links) {
|
|
20 |
}
|
21 |
add_filter('plugin_action_links_' . WP_RP_PLUGIN_FILE, 'wp_rp_add_link_to_settings', 10, 2);
|
22 |
|
23 |
-
function wp_rp_subscription($email_or_unsubscribe) {
|
24 |
$meta = wp_rp_get_meta();
|
25 |
-
|
26 |
-
|
27 |
-
$
|
28 |
-
|
29 |
-
|
30 |
-
);
|
31 |
-
if ($email_or_unsubscribe) {
|
32 |
-
$post['email'] = $email_or_unsubscribe;
|
33 |
}
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
$response_json = json_decode($body);
|
42 |
-
if ($response_json->status !== 'ok') return false;
|
43 |
-
|
44 |
-
$meta['subscribed'] = (int) !!$email_or_unsubscribe;
|
45 |
-
$meta['email'] = $email_or_unsubscribe;
|
46 |
-
wp_rp_update_meta($meta);
|
47 |
-
}
|
48 |
return true;
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
return false;
|
51 |
}
|
52 |
|
@@ -54,7 +87,15 @@ function wp_rp_ajax_subscribe_callback () {
|
|
54 |
check_ajax_referer('wp_rp_ajax_nonce');
|
55 |
|
56 |
$email = (!empty($_POST['email']) && $_POST['email'] !== '0') ? $_POST['email'] : false;
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
print "1";
|
59 |
}
|
60 |
else {
|
@@ -78,11 +119,6 @@ function wp_rp_settings_admin_menu() {
|
|
78 |
}
|
79 |
|
80 |
$title = __('Wordpress Related Posts', 'wp_related_posts');
|
81 |
-
$count = wp_rp_number_of_available_notifications();
|
82 |
-
|
83 |
-
if($count) {
|
84 |
-
$title .= ' <span class="update-plugins count-' . $count . '"><span class="plugin-count">' . $count . '</span></span>';
|
85 |
-
}
|
86 |
|
87 |
$page = add_options_page(__('Wordpress Related Posts', 'wp_related_posts'), $title,
|
88 |
'manage_options', 'wordpress-related-posts', 'wp_rp_settings_page');
|
@@ -98,39 +134,6 @@ function wp_rp_settings_styles() {
|
|
98 |
wp_enqueue_style("wp_rp_dashboard_style", plugins_url("static/css/dashboard.css", __FILE__), array(), WP_RP_VERSION);
|
99 |
}
|
100 |
|
101 |
-
function wp_rp_register_blog($button_type='other') {
|
102 |
-
$meta = wp_rp_get_meta();
|
103 |
-
|
104 |
-
if($meta['blog_id']) return true;
|
105 |
-
$req_options = array(
|
106 |
-
'timeout' => 30
|
107 |
-
);
|
108 |
-
|
109 |
-
$response = wp_remote_get(WP_RP_CTR_DASHBOARD_URL . 'register/?blog_url=' . get_bloginfo('wpurl') .
|
110 |
-
'&button_type=' . $button_type .
|
111 |
-
'&blogtg=' . $meta['blog_tg'] .
|
112 |
-
($meta['new_user'] ? '&new' : ''),
|
113 |
-
$req_options);
|
114 |
-
|
115 |
-
if (wp_remote_retrieve_response_code($response) == 200) {
|
116 |
-
$body = wp_remote_retrieve_body($response);
|
117 |
-
if ($body) {
|
118 |
-
$doc = json_decode($body);
|
119 |
-
|
120 |
-
if ($doc && $doc->status === 'ok') {
|
121 |
-
$meta['blog_id'] = $doc->data->blog_id;
|
122 |
-
$meta['auth_key'] = $doc->data->auth_key;
|
123 |
-
$meta['new_user'] = false;
|
124 |
-
wp_rp_update_meta($meta);
|
125 |
-
|
126 |
-
return true;
|
127 |
-
}
|
128 |
-
}
|
129 |
-
}
|
130 |
-
|
131 |
-
return false;
|
132 |
-
}
|
133 |
-
|
134 |
function wp_rp_ajax_dismiss_notification_callback() {
|
135 |
check_ajax_referer('wp_rp_ajax_nonce');
|
136 |
|
@@ -145,26 +148,6 @@ function wp_rp_ajax_dismiss_notification_callback() {
|
|
145 |
|
146 |
add_action('wp_ajax_rp_dismiss_notification', 'wp_rp_ajax_dismiss_notification_callback');
|
147 |
|
148 |
-
function wp_rp_ajax_hide_show_statistics() {
|
149 |
-
check_ajax_referer('wp_rp_ajax_nonce');
|
150 |
-
|
151 |
-
$meta = wp_rp_get_meta();
|
152 |
-
$postdata = stripslashes_deep($_POST);
|
153 |
-
|
154 |
-
if(isset($postdata['show'])) {
|
155 |
-
$meta['show_statistics'] = true;
|
156 |
-
}
|
157 |
-
if(isset($postdata['hide'])) {
|
158 |
-
$meta['show_statistics'] = false;
|
159 |
-
}
|
160 |
-
|
161 |
-
wp_rp_update_meta($meta);
|
162 |
-
|
163 |
-
die('ok');
|
164 |
-
}
|
165 |
-
|
166 |
-
add_action('wp_ajax_rp_show_hide_statistics', 'wp_rp_ajax_hide_show_statistics');
|
167 |
-
|
168 |
function wp_rp_get_api_key() {
|
169 |
$meta = wp_rp_get_meta();
|
170 |
if($meta['zemanta_api_key']) return $meta['zemanta_api_key'];
|
@@ -232,6 +215,11 @@ function wp_rp_settings_page() {
|
|
232 |
$options = wp_rp_get_options();
|
233 |
$meta = wp_rp_get_meta();
|
234 |
|
|
|
|
|
|
|
|
|
|
|
235 |
if ( isset( $_GET['wprp_global_notice'] ) && $_GET['wprp_global_notice'] === '0') {
|
236 |
$meta['global_notice'] = null;
|
237 |
wp_rp_update_meta($meta);
|
@@ -239,9 +227,6 @@ function wp_rp_settings_page() {
|
|
239 |
|
240 |
$postdata = stripslashes_deep($_POST);
|
241 |
|
242 |
-
// load notifications every time user goes to settings page
|
243 |
-
wp_rp_load_remote_notifications();
|
244 |
-
|
245 |
if(sizeof($_POST)) {
|
246 |
if (!isset($_POST['_wp_rp_nonce']) || !wp_verify_nonce($_POST['_wp_rp_nonce'], 'wp_rp_settings') ) {
|
247 |
die('Sorry, your nonce did not verify.');
|
@@ -253,10 +238,8 @@ function wp_rp_settings_page() {
|
|
253 |
'max_related_posts' => (isset($postdata['wp_rp_max_related_posts']) && is_numeric(trim($postdata['wp_rp_max_related_posts']))) ? intval(trim($postdata['wp_rp_max_related_posts'])) : 5,
|
254 |
'on_rss' => isset($postdata['wp_rp_on_rss']),
|
255 |
'related_posts_title' => isset($postdata['wp_rp_related_posts_title']) ? trim($postdata['wp_rp_related_posts_title']) : '',
|
256 |
-
'ctr_dashboard_enabled' => isset($postdata['wp_rp_ctr_dashboard_enabled']),
|
257 |
'promoted_content_enabled' => isset($postdata['wp_rp_promoted_content_enabled']),
|
258 |
'enable_themes' => isset($postdata['wp_rp_enable_themes']),
|
259 |
-
'traffic_exchange_enabled' => isset($postdata['wp_rp_traffic_exchange_enabled']),
|
260 |
'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,
|
261 |
|
262 |
'custom_size_thumbnail_enabled' => isset($postdata['wp_rp_custom_size_thumbnail_enabled']) && $postdata['wp_rp_custom_size_thumbnail_enabled'] === 'yes',
|
@@ -333,16 +316,6 @@ function wp_rp_settings_page() {
|
|
333 |
}
|
334 |
|
335 |
if (((array) $old_options) != $new_options) {
|
336 |
-
if($new_options['ctr_dashboard_enabled'] && !$old_options['ctr_dashboard_enabled']) {
|
337 |
-
$meta['show_statistics'] = true;
|
338 |
-
|
339 |
-
if($new_options['desktop']['display_thumbnail']) {
|
340 |
-
$meta['show_turn_on_button'] = false;
|
341 |
-
}
|
342 |
-
|
343 |
-
wp_rp_update_meta($meta);
|
344 |
-
}
|
345 |
-
|
346 |
if(!wp_rp_update_options($new_options)) {
|
347 |
wp_rp_add_admin_notice('error', __('Failed to save settings.', 'wp_related_posts'));
|
348 |
} else {
|
@@ -358,11 +331,6 @@ function wp_rp_settings_page() {
|
|
358 |
}
|
359 |
}
|
360 |
|
361 |
-
if($options['ctr_dashboard_enabled'] && (!$meta['blog_id'] || !$meta['auth_key'])) {
|
362 |
-
$button_type = isset($postdata['wp_rp_button_type']) ? $postdata['wp_rp_button_type'] : 'other';
|
363 |
-
wp_rp_register_blog($button_type);
|
364 |
-
}
|
365 |
-
|
366 |
$input_hidden = array(
|
367 |
'wp_rp_ajax_nonce' => wp_create_nonce("wp_rp_ajax_nonce"),
|
368 |
'wp_rp_json_url' => esc_attr(WP_RP_CONTENT_BASE_URL . WP_RP_STATIC_JSON_PATH),
|
@@ -371,21 +339,11 @@ function wp_rp_settings_page() {
|
|
371 |
'wp_rp_static_base_url' => esc_attr(WP_RP_STATIC_BASE_URL),
|
372 |
'wp_rp_plugin_static_base_url' => esc_attr(plugins_url("static/", __FILE__)),
|
373 |
);
|
374 |
-
if ($options['ctr_dashboard_enabled']) {
|
375 |
-
$input_hidden['wp_rp_blog_id'] = esc_attr($meta['blog_id']);
|
376 |
-
$input_hidden['wp_rp_auth_key'] = esc_attr($meta['auth_key']);
|
377 |
-
}
|
378 |
-
if ($meta['show_traffic_exchange'] && $options['traffic_exchange_enabled']) {
|
379 |
-
$input_hidden['wp_rp_show_traffic_exchange_statistics'] = '1';
|
380 |
-
}
|
381 |
-
if ($meta['remote_recommendations'] && $options['promoted_content_enabled']) {
|
382 |
-
$input_hidden['wp_rp_show_promoted_content_statistics'] = '1';
|
383 |
-
}
|
384 |
|
385 |
$settings_file = __FILE__;
|
386 |
|
387 |
$form_url = admin_url('admin.php?page=wordpress-related-posts');
|
388 |
-
$form_display = ($meta['show_turn_on_button'] && !$meta['turn_on_button_pressed']
|
389 |
|
390 |
global $wpdb;
|
391 |
$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)" );
|
@@ -396,6 +354,8 @@ function wp_rp_settings_page() {
|
|
396 |
'order' => 'ASC',
|
397 |
'hide_empty' => false
|
398 |
));
|
|
|
|
|
399 |
|
400 |
include wp_rp_get_template('settings');
|
401 |
}
|
20 |
}
|
21 |
add_filter('plugin_action_links_' . WP_RP_PLUGIN_FILE, 'wp_rp_add_link_to_settings', 10, 2);
|
22 |
|
23 |
+
function wp_rp_subscription($email_or_unsubscribe, $subscription_types) {
|
24 |
$meta = wp_rp_get_meta();
|
25 |
+
$options = wp_rp_get_options();
|
26 |
+
|
27 |
+
if (! $subscription_types) {
|
28 |
+
if ($email_or_unsubscribe) { return false; }
|
29 |
+
$subscription_types = "activityreport,newsletter";
|
|
|
|
|
|
|
30 |
}
|
31 |
+
|
32 |
+
if (! $meta['subscribed'] && $meta['email'] && !$email_or_unsubscribe) {
|
33 |
+
// Not processed yet
|
34 |
+
$meta['email'] = false;
|
35 |
+
$options['subscription_types'] = false;
|
36 |
+
wp_rp_update_meta($meta);
|
37 |
+
wp_rp_update_options($options);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
return true;
|
39 |
}
|
40 |
+
|
41 |
+
if($meta['zemanta_api_key']) {
|
42 |
+
$post = array(
|
43 |
+
'api_key' => $meta['zemanta_api_key'],
|
44 |
+
'platform' => 'wordpress-wprp',
|
45 |
+
'url' => get_site_url(),
|
46 |
+
'subscriptions' => $subscription_types
|
47 |
+
);
|
48 |
+
|
49 |
+
if ($email_or_unsubscribe) {
|
50 |
+
$post['email'] = $email_or_unsubscribe;
|
51 |
+
}
|
52 |
+
$response = wp_remote_post(WP_RP_ZEMANTA_SUBSCRIPTION_URL . 'subscribe/', array(
|
53 |
+
'body' => $post,
|
54 |
+
'timeout' => 30
|
55 |
+
));
|
56 |
+
if (wp_remote_retrieve_response_code($response) == 200) {
|
57 |
+
$body = wp_remote_retrieve_body($response);
|
58 |
+
if ($body) {
|
59 |
+
$response_json = json_decode($body);
|
60 |
+
|
61 |
+
if ($response_json->status !== 'ok') {
|
62 |
+
$waiting = $response_json->reason == 'user-missing';
|
63 |
+
if ($email_or_unsubscribe && $waiting) {
|
64 |
+
$meta['email'] = $email_or_unsubscribe;
|
65 |
+
$meta['subscribed'] = false;
|
66 |
+
$options['subscription_types'] = $subscription_types;
|
67 |
+
wp_rp_update_meta($meta);
|
68 |
+
wp_rp_update_options($options);
|
69 |
+
return true;
|
70 |
+
// We will try again when
|
71 |
+
}
|
72 |
+
return false;
|
73 |
+
}
|
74 |
+
$meta['email'] = $email_or_unsubscribe;
|
75 |
+
$meta['subscribed'] = (int) !!$email_or_unsubscribe;
|
76 |
+
$options['subscription_types'] = $subscription_types;
|
77 |
+
wp_rp_update_meta($meta);
|
78 |
+
wp_rp_update_options($options);
|
79 |
+
return true; // don't subscribe to bf if zem succeeds
|
80 |
+
}
|
81 |
+
}
|
82 |
+
}
|
83 |
return false;
|
84 |
}
|
85 |
|
87 |
check_ajax_referer('wp_rp_ajax_nonce');
|
88 |
|
89 |
$email = (!empty($_POST['email']) && $_POST['email'] !== '0') ? $_POST['email'] : false;
|
90 |
+
$types = empty($_POST['subscription']) ? array() : explode(",", $_POST['subscription']);
|
91 |
+
$valid_types = array();
|
92 |
+
foreach($types as $tp) {
|
93 |
+
if ($tp && in_array($tp, array('activityreport', 'newsletter'))) {
|
94 |
+
$valid_types[] = $tp;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
$valid_types = $valid_types ? implode(',', $valid_types) : false;
|
98 |
+
if (wp_rp_subscription($email, $valid_types)) {
|
99 |
print "1";
|
100 |
}
|
101 |
else {
|
119 |
}
|
120 |
|
121 |
$title = __('Wordpress Related Posts', 'wp_related_posts');
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
$page = add_options_page(__('Wordpress Related Posts', 'wp_related_posts'), $title,
|
124 |
'manage_options', 'wordpress-related-posts', 'wp_rp_settings_page');
|
134 |
wp_enqueue_style("wp_rp_dashboard_style", plugins_url("static/css/dashboard.css", __FILE__), array(), WP_RP_VERSION);
|
135 |
}
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
function wp_rp_ajax_dismiss_notification_callback() {
|
138 |
check_ajax_referer('wp_rp_ajax_nonce');
|
139 |
|
148 |
|
149 |
add_action('wp_ajax_rp_dismiss_notification', 'wp_rp_ajax_dismiss_notification_callback');
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
function wp_rp_get_api_key() {
|
152 |
$meta = wp_rp_get_meta();
|
153 |
if($meta['zemanta_api_key']) return $meta['zemanta_api_key'];
|
215 |
$options = wp_rp_get_options();
|
216 |
$meta = wp_rp_get_meta();
|
217 |
|
218 |
+
// Update already subscribed but in the old pipeline
|
219 |
+
if (!empty($meta["email"]) && empty($meta["subscribed"])) {
|
220 |
+
wp_rp_subscription($meta["email"], $options["subscription_types"]);
|
221 |
+
}
|
222 |
+
|
223 |
if ( isset( $_GET['wprp_global_notice'] ) && $_GET['wprp_global_notice'] === '0') {
|
224 |
$meta['global_notice'] = null;
|
225 |
wp_rp_update_meta($meta);
|
227 |
|
228 |
$postdata = stripslashes_deep($_POST);
|
229 |
|
|
|
|
|
|
|
230 |
if(sizeof($_POST)) {
|
231 |
if (!isset($_POST['_wp_rp_nonce']) || !wp_verify_nonce($_POST['_wp_rp_nonce'], 'wp_rp_settings') ) {
|
232 |
die('Sorry, your nonce did not verify.');
|
238 |
'max_related_posts' => (isset($postdata['wp_rp_max_related_posts']) && is_numeric(trim($postdata['wp_rp_max_related_posts']))) ? intval(trim($postdata['wp_rp_max_related_posts'])) : 5,
|
239 |
'on_rss' => isset($postdata['wp_rp_on_rss']),
|
240 |
'related_posts_title' => isset($postdata['wp_rp_related_posts_title']) ? trim($postdata['wp_rp_related_posts_title']) : '',
|
|
|
241 |
'promoted_content_enabled' => isset($postdata['wp_rp_promoted_content_enabled']),
|
242 |
'enable_themes' => isset($postdata['wp_rp_enable_themes']),
|
|
|
243 |
'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,
|
244 |
|
245 |
'custom_size_thumbnail_enabled' => isset($postdata['wp_rp_custom_size_thumbnail_enabled']) && $postdata['wp_rp_custom_size_thumbnail_enabled'] === 'yes',
|
316 |
}
|
317 |
|
318 |
if (((array) $old_options) != $new_options) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
if(!wp_rp_update_options($new_options)) {
|
320 |
wp_rp_add_admin_notice('error', __('Failed to save settings.', 'wp_related_posts'));
|
321 |
} else {
|
331 |
}
|
332 |
}
|
333 |
|
|
|
|
|
|
|
|
|
|
|
334 |
$input_hidden = array(
|
335 |
'wp_rp_ajax_nonce' => wp_create_nonce("wp_rp_ajax_nonce"),
|
336 |
'wp_rp_json_url' => esc_attr(WP_RP_CONTENT_BASE_URL . WP_RP_STATIC_JSON_PATH),
|
339 |
'wp_rp_static_base_url' => esc_attr(WP_RP_STATIC_BASE_URL),
|
340 |
'wp_rp_plugin_static_base_url' => esc_attr(plugins_url("static/", __FILE__)),
|
341 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
|
343 |
$settings_file = __FILE__;
|
344 |
|
345 |
$form_url = admin_url('admin.php?page=wordpress-related-posts');
|
346 |
+
$form_display = 'block'; //($meta['show_turn_on_button'] && !$meta['turn_on_button_pressed'] ? 'none' : 'block');
|
347 |
|
348 |
global $wpdb;
|
349 |
$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)" );
|
354 |
'order' => 'ASC',
|
355 |
'hide_empty' => false
|
356 |
));
|
357 |
+
|
358 |
+
$blog_url = get_site_url();
|
359 |
|
360 |
include wp_rp_get_template('settings');
|
361 |
}
|
static/css/dashboard.css
CHANGED
@@ -153,4 +153,6 @@ form.wp_rp_message_form a.dismiss {float: right;}
|
|
153 |
#wpwrap #wpcontent .wp_rp-updated .wp_rp-dismiss {position: absolute;top: 15px;right: 14px;}
|
154 |
#wpwrap #wpcontent .wp_rp-updated .wp_rp-logo img {width: 90px;}
|
155 |
#wpwrap #wpcontent .wp_rp-updated .wp_rp-dismiss a:before {content: '\f153'; display: inline-block; font: 400 16px/1 dashicons; speak: none; height: 20px; margin: 2px 0; text-align: center; vertical-align: middle; width: 20px; -webkit-font-smoothing: antialiased!important;}
|
156 |
-
#wpwrap h2.title span {font-size:0.5em;}
|
|
|
|
153 |
#wpwrap #wpcontent .wp_rp-updated .wp_rp-dismiss {position: absolute;top: 15px;right: 14px;}
|
154 |
#wpwrap #wpcontent .wp_rp-updated .wp_rp-logo img {width: 90px;}
|
155 |
#wpwrap #wpcontent .wp_rp-updated .wp_rp-dismiss a:before {content: '\f153'; display: inline-block; font: 400 16px/1 dashicons; speak: none; height: 20px; margin: 2px 0; text-align: center; vertical-align: middle; width: 20px; -webkit-font-smoothing: antialiased!important;}
|
156 |
+
#wpwrap h2.title span {font-size:0.5em;}
|
157 |
+
|
158 |
+
#wpwrap .subscription-container { width: 700px; padding: 5px 5px 5px 5px; background-color: #eee; margin-bottom: 20px;}
|
static/img/themes/modern.jpg
CHANGED
Binary file
|
static/img/themes/vertical-m.jpg
CHANGED
Binary file
|
static/img/themes/vertical-s.jpg
CHANGED
Binary file
|
static/img/themes/vertical.jpg
CHANGED
Binary file
|
static/img/turnonscreen.jpg
CHANGED
Binary file
|
static/js/connect.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
|
|
static/js/dashboard.js
CHANGED
@@ -1,11 +1,4 @@
|
|
1 |
-
(function(a){var
|
2 |
-
|
3 |
-
|
4 |
-
{
|
5 |
-
q||0);var E=0<k&&(100*(q/k)).toFixed(1)||0;if(D&&e.promoted_content_money_earned){r=Math.max(e.promoted_content_money_earned,r||0);var g=(r/100).toFixed(2),F=(e.meta.min_payout/100).toFixed(2);f.find(".num").html("$"+g);f.find(".payout").html("$"+F);r>=e.meta.min_payout&&f.find(".claim").hasClass("disabled")&&(f.find(".claim").removeClass("disabled"),f.find(".claim").attr("href","mailto:support+claim@zemanta.com?subject="+encodeURIComponent("I earned over $50!")+"&body="+encodeURIComponent("I would like to claim my money.\nMy reference code is: "+
|
6 |
-
m+" \nMy PayPal account is:\n")));B.show()}d.find(".ctr .num.all").html(E+"%");d.find(".pageviews .num.all").html(k);d.find(".clicks .num.all").html(q);d.find(".ctr .num.mobile").html(b+"%");d.find(".pageviews .num.mobile").html(i);d.find(".clicks .num.mobile").html(j);p=!1}}))},A=function(c){a("#wp_rp_static_base_url").val();a("#wp_rp_ctr_dashboard_enabled, #wp_rp_enable_themes, #wp_rp_promoted_content_enabled, #wp_rp_traffic_exchange_enabled").prop("checked",!0);a("#wp_rp_settings_form").append('<input type="hidden" value="statistics+thumbnails+promoted" name="wp_rp_turn_on_button_pressed" id="wp_rp_turn_on_button_pressed">');
|
7 |
-
a("#wp_rp_settings_form").append('<input type="hidden" value="'+c+'" name="wp_rp_button_type" id="wp_rp_button_type">');a("#wp_rp_settings_form").submit()};y();a("#wp_rp_desktop_custom_theme_enabled").click(y);m&&u&&(t(!0),s=setInterval(t,2E3));!m&&document.location.search.match(/ref=turn-on-rp/)&&A("turn-on-banner");a("#wp_rp_turn_on_statistics a.turn-on").click(function(c){c.preventDefault();c=a(this).data("type");A(c)});a("#wp_rp_subscribe_email").length&&(a("#wp_rp_subscribe_email").val().length?
|
8 |
-
a("#wp_rp_subscribe_button").hide():a("#wp_rp_unsubscribe_button").hide());a("#wp_rp_subscribe_button").on("click",function(c){var b=a("#wp_rp_subscribe_email").val();c.preventDefault();b&&(a("#wp_rp_subscribe_button").prop("disabled",!0),x(b,function(b){parseInt(b)&&(a("#wp_rp_subscribe_button").prop("disabled",!1),a("#wp_rp_subscribe_button").hide(),a("#wp_rp_unsubscribe_button").show(),alert("Subscription successful!"))}))});a("#wp_rp_unsubscribe_button").on("click",function(c){c.preventDefault();
|
9 |
-
a("#wp_rp_unsubscribe_button").prop("disabled",!0);x(!1,function(b){parseInt(b)&&(a("#wp_rp_subscribe_email").val(""),a("#wp_rp_unsubscribe_button").prop("disabled",!1),a("#wp_rp_unsubscribe_button").hide(),a("#wp_rp_subscribe_button").show())})});a(".wp_rp_notification .close").on("click",function(c){a.ajax({url:a(this).attr("href"),data:{noredirect:!0},_wpnonce:n});a(this).parent().slideUp(function(){a(this).remove()});c.preventDefault()});a("#wp_rp_wrap .collapsible .collapse-handle").on("click",
|
10 |
-
function(c){var b=a(this).closest(".collapsible"),e=b.find(".container"),d=b.hasClass("collapsed"),g=b.attr("block");d?(e.slideDown(),a.post(ajaxurl,{action:"rp_show_hide_"+g,show:!0,_wpnonce:n})):(e.slideUp(),a.post(ajaxurl,{action:"rp_show_hide_"+g,hide:!0,_wpnonce:n}));b.toggleClass("collapsed");if("statistics"===g){var g="statistics_"+(d?"on":"off"),e=void 0,b=new Image,d="https:"===location.protocol?"https://":"http://",g={"zem-habit-platform":"wordpress-wprp","zem-habit-action":g,"zem-habit-timestamp":(new Date).getTime()},
|
11 |
-
e=e||{},g=a.extend(e,g),e=d+"eyepatch.zemanta.com/log/?",f="";a.each(g,function(a,b){f+=a+"="+encodeURIComponent(b)+"&"});d=f.slice(0,f.length-1);b.src=e+d}c.preventDefault()})})})(jQuery);
|
1 |
+
(function(a){a(function(){var g=a("#wp_rp_ajax_nonce").val(),h=function(c,b,e){a.ajax({url:ajaxurl,data:{action:"wprp_subscribe",subscription:b,_wpnonce:g,email:c||"0"},success:e,type:"POST"})},i=function(){var c=1!==a("#wp_rp_desktop_custom_theme_enabled:checked").length;a("#wp_rp_desktop_theme_custom_css").prop("readonly",c)};i();a("#wp_rp_desktop_custom_theme_enabled").click(i);a("#wp_rp_subscribe_email").length&&(a("#wp_rp_subscribe_email").val().length?a("#wp_rp_subscribe_button").hide():a("#wp_rp_unsubscribe_button").hide());
|
2 |
+
a("#wp_rp_subscribe_button").on("click",function(c){var b=a("#wp_rp_subscribe_email").val();c.preventDefault();b&&(a("#wp_rp_subscribe_button").attr("disabled",!0),h(b,"activityreport,newsletter",function(b){a("#wp_rp_subscribe_button").attr("disabled",!1);parseInt(b)&&(a("#wp_rp_subscribe_button").prop("disabled",!1),a("#wp_rp_subscribe_button").hide(),a("#wp_rp_unsubscribe_button").show(),alert("Subscription successful!"))}))});a("#wp_rp_unsubscribe_button").on("click",function(c){c.preventDefault();
|
3 |
+
a("#wp_rp_unsubscribe_button").attr("disabled",!0);h(!1,!1,function(b){a("#wp_rp_unsubscribe_button").attr("disabled",!1);parseInt(b)&&(a("#wp_rp_subscribe_email").val(""),a("#wp_rp_unsubscribe_button").hide(),a("#wp_rp_subscribe_button").show())})});a("#wp_rp_wrap .collapsible .collapse-handle").on("click",function(c){var b=a(this).closest(".collapsible"),e=b.find(".container"),f=b.hasClass("collapsed"),d=b.attr("block");f?(e.slideDown(),a.post(ajaxurl,{action:"rp_show_hide_"+d,show:!0,_wpnonce:g})):
|
4 |
+
(e.slideUp(),a.post(ajaxurl,{action:"rp_show_hide_"+d,hide:!0,_wpnonce:g}));b.toggleClass("collapsed");"statistics"===d&&(d="statistics_"+(f?"on":"off"),b=void 0,e=new Image,f="https:"===location.protocol?"https://":"http://",d={"zem-habit-platform":"wordpress-wprp","zem-habit-action":d,"zem-habit-timestamp":(new Date).getTime()},b=b||{},d=a.extend(b,d),e.src=f+"eyepatch.zemanta.com/log/?"+object_to_query(d));c.preventDefault()})})})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static/js/edit_related_posts.js
CHANGED
@@ -1,24 +1,23 @@
|
|
1 |
-
(function(d){d.event.props.push("dataTransfer");var
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
d('<a class="open-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
"
|
19 |
-
|
20 |
-
d('<div
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
142,Math.max(680,110*k+130))+"px");return!1})};(function l(m,i){i||(i=10,m=0);d("#wp_rp_edit_related_posts").length?z():3E4>m?setTimeout(function(){l(m+i,1.5*i)},i):d(function(){z()})})()})(jQuery);
|
1 |
+
(function(d){d.event.props.push("dataTransfer");var r=function(){d("#wp_rp_edit_related_posts").click(function(){var h={num_articles:30,num_articles_to_insert:window._wp_rp_num_rel_posts,post_id:window._wp_rp_post_id,admin_ajax_url:window._wp_rp_admin_ajax_url,admin_ajax_action:"rp_update_related_posts",plugin_static_url:window._wp_rp_plugin_static_base_url,zemanta_thumbnail_url:"http://i.zemanta.com/{aid}_150_150.jpg",num_default_thumbnails:30,search_support:!!window._wp_rp_erp_search,promoted:!1!==
|
2 |
+
window._wp_rp_promoted_content,tx:!1!==window._wp_rp_traffic_exchange,num_external_slots:0},a={holder:null,wrapper:null,search_form:null,search_input:null,selected_articles_wrap:null,replace_articles_wrap:null,replace_articles_list:null,article_loader:null,article_list:{},articles_to_insert:null,footer:null,save:null},i={},j=[],k={},r=[],u=function(b){b.preventDefault();a.holder.remove();d("html").css("overflow","visible")},s=function(b){var c=[];d.each(i,function(){});for(var a=0;a<h.num_articles_to_insert;a+=
|
3 |
+
1){var f=i[a];f?"own_sourcefeed"===f.type?c.push({ID:f.aid,post_url:f.url,thumbnail:f.thumbnail,post_title:f.title,post_excerpt:f.excerpt||"",post_content:"",post_date:f.date||"",comment_count:f.comments||0,picked:!!f.picked,type:f.type,pos:a}):c.push({ID:!1,pos:a,type:f.type}):c.push({ID:!1,pos:a,type:"empty"})}d.post(h.admin_ajax_url,{action:h.admin_ajax_action,post_id:h.post_id,related_posts:JSON.stringify(c),_wpnonce:window._wp_rp_ajax_nonce},b)},v;v=function(b,c,a,f){var c=window._wp_rp_post_tags&&
|
4 |
+
window._wp_rp_post_tags.join(",")||"",e=window._wp_rp_post_title||"",b=b||!1;if(!c&&!e&&!1===b)a(!1);else{var g={},i=1,j=function(){i-=1;if(0>=i){var b=[],c={};d.each(["external","internal"],function(a,f){g[f]&&("ok"===g[f].status&&g[f].data)&&d.each(g[f].data.results,function(a,f){if(c[f.url])return!0;c[f.url]=!0;b.push(f)})});g.external&&"ok"===g.external.status&&(h.num_external_slots=g.external.data.settings.num_external_slots);b?a&&b&&a(b):f&&f()}},k=function(b){g["internal"===b.source?"internal":
|
5 |
+
"external"]=b;j()};d.ajax({url:window._wp_rp_wp_ajax_url,dataType:"json",data:{post_id:h.post_id,search:b||"",action:"wp_rp_load_articles",count:h.num_articles},success:function(b){var c=[];d.each(b,function(b,a){c.push({type:"own_sourcefeed",aid:"in_"+a.id,thumbnail:d(a.img).attr("src"),title:a.title,excerpt:a.excerpt,date:a.date,comments:a.comments,url:a.url,target_url:a.url})});k({status:"ok",source:"internal",data:{results:c}})},error:j});h.remote_recommendations&&get_sre_articles(b,c,e,k,j)}};
|
6 |
+
var n,w=function(b,c,x){a.replace_articles_list.html("");g.render_selector_shadows();j=[];a.article_loader.find(".zem-no-articles").hide();a.article_loader.find(".zem-loader").show();a.article_loader.show();var f=h.num_external_slots;v(c,x,function(c){c&&c.length?(a.article_loader.hide(),j=d.grep(c,function(b){return 0>window.location.href.indexOf(b.url)}),d.each(j,function(b,c){k[c.aid]?(c=k[c.aid],j[b]=c):k[c.aid]=c}),g.article_selector(),f!==h.num_external_slots&&g.articles()):(a.article_loader.find(".zem-no-articles").show(),
|
7 |
+
a.article_loader.find(".zem-loader").hide());g.render_selector_shadows();b&&b(!0)},function(){a.article_loader.find(".zem-no-articles").show();a.article_loader.find(".zem-loader").hide();g.render_selector_shadows();b&&b(!1)})},p=function(b,c,a){b.picked=!0;b.pos=c;i[c]=b;k[b.aid]=b;g.article_li_selected(b);a&&(s(),g.article_selector())},l=function(b,c){delete i[b.pos];b.picked=!1;b.pos=-1;b.elm&&b.elm.html('<div class="droppable" /><span class="notice">Drag post here</span>').attr("draggable",!1).removeClass("external").data("aid",
|
8 |
+
!1);c&&(s(),g.article_selector())},g={article_li:function(b,c){b.html('<div class="droppable" />');b.data("aid",c);b.attr("draggable",!0);b.unbind("dragstart").bind("dragstart",function(a){e.drag(a,c,b)});var a=d('<img draggable="false" />');a.error(function(){a.unbind("error");var b=parseInt(c.aid.replace("in_"))||parseInt(Math.random()*h.num_default_thumbnails),b=h.plugin_static_url+"thumbs/"+b%h.num_default_thumbnails+".jpg";c.thumbnail=b;a.attr("src",b)});c.thumbnail=c.thumbnail||c.thumbnail_url;
|
9 |
+
a.attr("src",c.thumbnail);b.append(a);b.append('<span unselectable="on" class="title">'+c.title+"</span>");var f=d('<a class="open-article" draggable="false" target="_blank" href="'+c.target_url+'">link out</a>');f.bind("click",function(b){b.stopPropagation()});b.append(f)},article_li_selector:function(b,c){c.elm=b;g.article_li(b,c);var a=d('<a draggable="false" class="insert overlay" href="#"><div class="txt">insert</div></a>');a.bind("click",function(b){b.preventDefault();for(b=b=0;b<h.num_articles_to_insert-
|
10 |
+
1&&i[b];b+=1);i[b]||p(c,b,!0)});b.append(a)},article_li_selected:function(b){var c=a.article_list[b.pos];b.elm=c;g.article_li(c,b);if(!b.external){var e=d('<a draggable="false" class="remove overlay" href="#"><span class="icon"></span><span class="txt">remove</span></a>');e.bind("click",function(a){a.preventDefault();l(b,!0)});c.append(e)}},article_selector:function(){a.replace_articles_list.html("");var b={};d.each(i,function(a,c){b[c.aid]=!0});var c=0;d.each(j,function(e,f){if(!b[f.aid]){var i=
|
11 |
+
d("<li />");g.article_li_selector(i,f);a.replace_articles_list.append(i);c+=1}if(c>=h.num_articles)return!1});g.render_selector_shadows()},render_selector_shadows:function(){var b=a.replace_articles_list.scrollLeft(),c=a.replace_articles_list[0].scrollWidth-a.replace_articles_list.width();0<b?a.replace_articles_list.addClass("scroll-left"):a.replace_articles_list.removeClass("scroll-left");b<c?a.replace_articles_list.addClass("scroll-right"):a.replace_articles_list.removeClass("scroll-right")},articles:function(){d.each(i,
|
12 |
+
function(b,a){a&&(a.aid&&a.picked)&&(b<h.num_articles_to_insert?p(a,b,!1):l(a,!1))})},all:function(){g.articles();g.article_selector()}},e={hint_timeout:null,dragged_article:null,ie9_drag_start:function(b){1!==b.which||(b.ctrlKey||b.metaKey)||d(this).get(0).dragDrop&&d(this).get(0).dragDrop()},drag_hint:function(b){if(!(1!==b.which||b.ctrlKey||b.metaKey)){var b=d(this),c=e.dragged_article||b.data("aid");c&&(e.hint_timeout=setTimeout(function(){!c.picked||c.external?a.wrapper.find("ul.selected li:not(.external)").addClass("drop-hint"):
|
13 |
+
a.wrapper.find("ul.selected li").addClass("drop-hint");c.picked&&!c.external&&a.remove_article_sign.show()},100))}},drag:function(b,c,d){b.dataTransfer.setData("text","wprp_article_"+c.aid);b.dataTransfer.setDragImage?b.dataTransfer.setDragImage(d.get(0),d.outerWidth()/2,d.outerHeight()/2):b.dataTransfer.addElement&&b.dataTransfer.addElement(d.get(0));e.dragged_article=c;setTimeout(function(){a.wrapper.find("li .droppable").css("z-index",2)},1);e.drag_hint(b)},drop_remove:function(b){b.preventDefault();
|
14 |
+
var a=e.dragged_article;e.dragged_article&&!a.external&&(l(a,!0),e.dragend(b))},drop:function(b){d(this).removeClass("drop");b.preventDefault();var a=e.dragged_article;if(!a)return!1;var g=a.pos,f=1*d(this).data("pos");if(g===f)return!1;var h=i[f];if(!h||!(h.external&&!a.picked||h.external&&a.external)){var j=a.picked;j&&l(a,!1);h&&(l(h,!1),j&&p(h,g,!1));p(a,f,!0);e.dragend(b)}},dragover:function(b){b.preventDefault();var b=e.dragged_article,a=d(this).data("aid");(!a||!(a.external&&!b.picked||a.external&&
|
15 |
+
b.external))&&d(this).addClass("drop")},dragleave:function(b){b.preventDefault();d(this).removeClass("drop")},dragend:function(){clearTimeout(e.hint_timeout);e.dragged_article=null;a.remove_article_sign.hide();a.wrapper.find("li .droppable").css("z-index",-1);a.wrapper.find("ul.selected li").removeClass("drop-hint")},init:function(){a.selected_articles_wrap.delegate("li","dragover",e.dragover).delegate("li","dragleave",e.dragleave).delegate("li","drop",e.drop);a.replace_articles_wrap.bind("dragover",
|
16 |
+
e.dragover).bind("dragleave",e.dragleave).bind("drop",e.drop_remove);a.wrapper.delegate("li[draggable=true]","dragstart",e.drag_hint).delegate("li[draggable=true]","dragend",e.dragend).delegate("li[draggable=true]","mousedown",e.drag_hint).delegate("li[draggable=true]","mouseup",e.dragend).delegate("li[draggable=true]","mousemove",e.ie9_drag_start)}};n={update:w,render:g.all,init:function(){e.init();a.search_form.bind("submit",function(b){b.preventDefault();b=a.search_input.val();w(null,b,!0)});a.replace_articles_list.bind("scroll",
|
17 |
+
g.render_selector_shadows)}};a.holder=d('<div id="wp_rp_zem_related_posts_holder"></div>');a.wrapper=d('<div id="wp_rp_zem_related_posts_wrap"><div class="selected-header"><h4 class="selected-title">Selected posts</h4><a href="#" class="save button">Save and Close</a></div><div class="selected-content"></div></div>');a.holder.append(a.wrapper);a.wrapper.bind("click",function(b){b.stopPropagation()});a.save=a.wrapper.find(".save");a.save.bind("click",function(){s(function(){window.location.reload()});
|
18 |
+
return!1});a.selected_articles_wrap=a.wrapper.find(".selected-content");for(var q=d('<ul class="selected" />'),m=0;m<h.num_articles_to_insert;m+=1){var t=d('<li><div class="droppable" /><span class="notice">Drag post here</span></li>');t.data("pos",m);a.article_list[m]=t;q.append(t)}a.selected_articles_wrap.append(q);a.replace_articles_wrap=d('<div id="wp_rp_replace_article_wrap"><div class="remove-article-sign">Drop article here to remove it</div><div class="recommendations-header"><h4 class="recommendations-title">Recommended posts</h4>'+
|
19 |
+
(h.search_support?'<form class="search" action="#"><input placeholder="search" class="search" type="text" /><input class="go button" type="submit" value="go" /></form>':'<div class="search notice">Please upgrade the plugin to use search.</div>')+'</div><div class="content"><ul></ul></div><div class="footer"><a href="http://www.zemanta.com/?ref=edit-rp" target="_blank">zemanta.com</a></div></div>');a.wrapper.append(a.replace_articles_wrap);a.replace_articles_list=a.replace_articles_wrap.find(".content ul");
|
20 |
+
a.article_loader=d('<div class="zem-loader-wrap"><div class="zem-no-articles">No results.</div><div class="zem-loader"><div class="zem-loader-step zem-loader-step-1"></div><div class="zem-loader-step zem-loader-step-2"></div><div class="zem-loader-step zem-loader-step-3"></div></div></div>');a.replace_articles_wrap.append(a.article_loader);a.remove_article_sign=a.replace_articles_wrap.find(".remove-article-sign");a.search_form=a.replace_articles_wrap.find("form.search");a.search_input=a.replace_articles_wrap.find("input.search");
|
21 |
+
a.footer=a.replace_articles_wrap.find(".footer");a.holder.bind("click",u);d(document).keydown(function(b){27==b.keyCode&&u(b)});d("html").css("overflow","hidden");n.init();(q=d(".wp_rp:first li:not(.wp_rp_special)"))&&q.each(function(b,a){a=d(a);if("own_sourcefeed"==a.data("post-type")){var e={aid:a.data("poid").split("-")[1],url:a.find("a:first").attr("href"),title:a.find("a.wp_rp_title").text(),excerpt:a.find(".wp_rp_excerpt").text(),comments:parseInt(a.find(".wp_rp_comments_count").text().replace("(",
|
22 |
+
"").replace(")",""),10),date:a.find(".wp_rp_publish_date").text(),text_preview:"",published_datetime:"",thumbnail:a.find("img").attr("src"),picked:!0,type:a.data("post-type"),pos:a.data("position")};j.push(e);k[e.aid]=e;i[b]=e}else({promoted:!0,network:!0,external:!0})[a.data("post-type")]&&r.push(b)});n.update();n.render();d("body").append(a.holder);a.replace_articles_wrap.css("width",Math.min(a.holder.width()-142,Math.max(680,110*h.num_articles_to_insert+130))+"px");return!1})};(function a(i,j){j||
|
23 |
+
(j=10,i=0);d("#wp_rp_edit_related_posts").length?r():3E4>i?setTimeout(function(){a(i+j,1.5*j)},j):d(function(){r()})})()})(jQuery);
|
|
static/js/pinterest.js
CHANGED
@@ -4,4 +4,4 @@ q=function(b){m&&0>=g.length&&c("#wp_rp_related_load_more").parent().remove();!l
|
|
4 |
b.title+"</a></li>");f.data("position",d);f.data("poid",b.id);f.find(".wp_rp_thumbnail").append(e);d+=1;var i=g;setTimeout(function(){!i||!i.length||i.data("zloaded")?h(f,e):i.load(function(){h(f,e)}).error(function(){h(f,e)})},75*a);g=e})};0>=g.length?q(function(){b(p())}):g.length<=2*u?(b(p()),q()):b(p())},w=function(){h&&clearTimeout(h);h=setTimeout(function(){var b=c(".related_post.wp_rp");b.offset().top+b.outerHeight(!0)-t.scrollTop()-t.height()+100<z&&v()},150)},y=-1,r=[],s=0;f.find("li").each(function(b,
|
5 |
a){a=c(a);a.children().find("img").data("zloaded",!0);var e=a.data("poid"),d=a.data("position"),f=a.data("post-type"),g=a.attr("class"),e=c('<li class="'+g+'" data-post-type="'+f+'" data-position="'+d+'" data-poid="'+e+'"></li>'),d=a.offset().left;d>y&&(y=d,s+=1);d=b%s;e.append(a.children());r[d]?(r[d].find("ul").append(e),a.remove()):(a.empty(),a.attr("data-position",null),a.attr("data-poid",null),a.attr("data-post-type",null),a.addClass("wp_rp_related_post_column"),a.addClass("wp_rp_special"),a.append("<ul></ul>"),
|
6 |
a.find("ul").append(e),r[d]=a)});w();c(window).bind("scroll.zloader",function(){k?w():c(window).unbind("scroll.zloader")});q();f.append(c('<li class="wp_rp_related_post_load_more wp_rp_special"><a id="wp_rp_related_load_more" href="#"><span>Load more posts</span><img src="'+window._wp_rp_static_base_url+'img/loading.gif" class="zloader" /></a></li>'));f.find("#wp_rp_related_load_more").click(function(b){c("span",this).hide();c(".zloader",this).show();b.preventDefault();v();var b=document.createElement("img"),
|
7 |
-
a={action:"pinterest-load-more",
|
4 |
b.title+"</a></li>");f.data("position",d);f.data("poid",b.id);f.find(".wp_rp_thumbnail").append(e);d+=1;var i=g;setTimeout(function(){!i||!i.length||i.data("zloaded")?h(f,e):i.load(function(){h(f,e)}).error(function(){h(f,e)})},75*a);g=e})};0>=g.length?q(function(){b(p())}):g.length<=2*u?(b(p()),q()):b(p())},w=function(){h&&clearTimeout(h);h=setTimeout(function(){var b=c(".related_post.wp_rp");b.offset().top+b.outerHeight(!0)-t.scrollTop()-t.height()+100<z&&v()},150)},y=-1,r=[],s=0;f.find("li").each(function(b,
|
5 |
a){a=c(a);a.children().find("img").data("zloaded",!0);var e=a.data("poid"),d=a.data("position"),f=a.data("post-type"),g=a.attr("class"),e=c('<li class="'+g+'" data-post-type="'+f+'" data-position="'+d+'" data-poid="'+e+'"></li>'),d=a.offset().left;d>y&&(y=d,s+=1);d=b%s;e.append(a.children());r[d]?(r[d].find("ul").append(e),a.remove()):(a.empty(),a.attr("data-position",null),a.attr("data-poid",null),a.attr("data-post-type",null),a.addClass("wp_rp_related_post_column"),a.addClass("wp_rp_special"),a.append("<ul></ul>"),
|
6 |
a.find("ul").append(e),r[d]=a)});w();c(window).bind("scroll.zloader",function(){k?w():c(window).unbind("scroll.zloader")});q();f.append(c('<li class="wp_rp_related_post_load_more wp_rp_special"><a id="wp_rp_related_load_more" href="#"><span>Load more posts</span><img src="'+window._wp_rp_static_base_url+'img/loading.gif" class="zloader" /></a></li>'));f.find("#wp_rp_related_load_more").click(function(b){c("span",this).hide();c(".zloader",this).show();b.preventDefault();v();var b=document.createElement("img"),
|
7 |
+
a={action:"pinterest-load-more",post_id:window._wp_rp_post_id,request_id:window._wp_rp_request_id,_:+new Date},e=[],d=window._wp_rp_static_base_url+"stats.gif?";for(x in a)a.hasOwnProperty(x)&&e.push(x+"="+a[x]);d+=e.join("&");b.src=d})})})();
|
static/themes/momma.css
CHANGED
@@ -117,8 +117,6 @@ ul.related_post li small {
|
|
117 |
@media screen and (max-width: 480px) {
|
118 |
ul.related_post li {
|
119 |
display: inline-block !important;
|
120 |
-
width: auto !important;
|
121 |
-
min-height: auto !important;
|
122 |
clear: both !important;
|
123 |
border:none !important;
|
124 |
}
|
117 |
@media screen and (max-width: 480px) {
|
118 |
ul.related_post li {
|
119 |
display: inline-block !important;
|
|
|
|
|
120 |
clear: both !important;
|
121 |
border:none !important;
|
122 |
}
|
static/themes/twocolumns.css
CHANGED
@@ -66,13 +66,13 @@ div.wp_rp_footer a.wp_rp_edit {
|
|
66 |
}
|
67 |
@media screen and (max-width: 480px) {
|
68 |
ul.related_post {
|
69 |
-
-moz-column-count:
|
70 |
-moz-column-gap: normal !important;
|
71 |
-moz-column-rule: none !important;
|
72 |
-
-webkit-column-count:
|
73 |
-webkit-column-gap: normal !important;
|
74 |
-webkit-column-rule: none !important;
|
75 |
-
column-count:
|
76 |
column-gap: normal !important;
|
77 |
column-rule: none !important;
|
78 |
}
|
66 |
}
|
67 |
@media screen and (max-width: 480px) {
|
68 |
ul.related_post {
|
69 |
+
-moz-column-count: auto !important;
|
70 |
-moz-column-gap: normal !important;
|
71 |
-moz-column-rule: none !important;
|
72 |
+
-webkit-column-count:auto !important;
|
73 |
-webkit-column-gap: normal !important;
|
74 |
-webkit-column-rule: none !important;
|
75 |
+
column-count: auto !important;
|
76 |
column-gap: normal !important;
|
77 |
column-rule: none !important;
|
78 |
}
|
static/themes/vertical-m.css
CHANGED
@@ -77,7 +77,7 @@ ul.related_post li small {
|
|
77 |
@media screen and (max-width: 480px) {
|
78 |
ul.related_post li {
|
79 |
display: inline-block !important;
|
80 |
-
width:
|
81 |
clear: both !important;
|
82 |
}
|
83 |
ul.related_post li a:nth-child(1) {
|
77 |
@media screen and (max-width: 480px) {
|
78 |
ul.related_post li {
|
79 |
display: inline-block !important;
|
80 |
+
width: 100px !important;
|
81 |
clear: both !important;
|
82 |
}
|
83 |
ul.related_post li a:nth-child(1) {
|
static/themes/vertical-s.css
CHANGED
@@ -77,7 +77,7 @@ ul.related_post li small {
|
|
77 |
@media screen and (max-width: 480px) {
|
78 |
ul.related_post li {
|
79 |
display: inline-block !important;
|
80 |
-
width:
|
81 |
clear: both !important;
|
82 |
}
|
83 |
ul.related_post li a:nth-child(1) {
|
77 |
@media screen and (max-width: 480px) {
|
78 |
ul.related_post li {
|
79 |
display: inline-block !important;
|
80 |
+
width: 75px !important;
|
81 |
clear: both !important;
|
82 |
}
|
83 |
ul.related_post li a:nth-child(1) {
|
static/themes/vertical.css
CHANGED
@@ -77,7 +77,7 @@ ul.related_post li small {
|
|
77 |
@media screen and (max-width: 480px) {
|
78 |
ul.related_post li {
|
79 |
display: inline-block !important;
|
80 |
-
width:
|
81 |
clear: both !important;
|
82 |
}
|
83 |
ul.related_post li a:nth-child(1) {
|
77 |
@media screen and (max-width: 480px) {
|
78 |
ul.related_post li {
|
79 |
display: inline-block !important;
|
80 |
+
width: 150px !important;
|
81 |
clear: both !important;
|
82 |
}
|
83 |
ul.related_post li a:nth-child(1) {
|
views/settings.php
CHANGED
@@ -19,26 +19,9 @@
|
|
19 |
</span>
|
20 |
</h2>
|
21 |
</div>
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
<?php if($meta['show_turn_on_button']): ?>
|
26 |
-
<!-- TURN ON STATISTICS PROMO -->
|
27 |
-
<div id="wp_rp_turn_on_statistics">
|
28 |
-
<div class="turn_on_wrap">
|
29 |
-
<h4>Turn on Related Posts and start using awesome features.</h4>
|
30 |
-
<div class="button_wrap">
|
31 |
-
<a data-type="singlebutton" href="#" class="zemanta-button turn-on">Turn on Related Posts</a>
|
32 |
-
</div>
|
33 |
-
<p>By turning on Related Posts you agree to <a href="http://www.zemanta.com/rp-tos" target="_blank">terms of service.</a></p>
|
34 |
-
<p>You'll get Advanced Settings, Themes, Thumbnails and Analytics Dashboard. These features are provided by <a target="_blank" href="http://www.zemanta.com">Zemanta</a> as a service.</p>
|
35 |
-
</div>
|
36 |
-
<img class="screendesc" src="<?php echo plugins_url("static/img/turnonscreen.jpg", $settings_file); ?>" />
|
37 |
-
</div>
|
38 |
-
<?php endif; ?>
|
39 |
-
|
40 |
-
<h2><?php _e('Subscribe to plugin updates and newsletter', 'wp_related_posts'); ?></h2>
|
41 |
-
<div class="container">
|
42 |
<table class="form-table subscription-block">
|
43 |
<tr valign="top">
|
44 |
<th scope="row">
|
@@ -50,38 +33,19 @@
|
|
50 |
<a id="wp_rp_unsubscribe_button" href="#" class="button-primary"><?php _e('Unsubscribe', 'wp_related_posts'); ?></a>
|
51 |
</td>
|
52 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
</table>
|
54 |
</div>
|
|
|
55 |
|
56 |
<!-- MAIN FORM -->
|
57 |
<form method="post" enctype="multipart/form-data" action="<?php echo $form_url; ?>" id="wp_rp_settings_form" style="display: <?php echo $form_display; ?>;">
|
58 |
-
<?php wp_nonce_field('wp_rp_settings', '_wp_rp_nonce') ?>
|
59 |
-
|
60 |
-
<?php if ($options['ctr_dashboard_enabled']): ?>
|
61 |
-
<div id="wp_rp_earnings_holder" style="display:none;">
|
62 |
-
<h2><?php _e('Earnings', 'wp_related_posts'); ?></h2>
|
63 |
-
<div class="container">
|
64 |
-
<p>By displaying promoted posts on your site you've already earned:</p>
|
65 |
-
<div id="wp_rp_earnings_wrap">
|
66 |
-
<span class="num"></span>
|
67 |
-
<a href="#" class="claim disabled">claim
|
68 |
-
<span class="payout-explain">You can claim the money when it reaches <span class="payout"></span>.</span>
|
69 |
-
</a>
|
70 |
-
</div>
|
71 |
-
</div>
|
72 |
-
</div>
|
73 |
-
<div id="wp_rp_statistics_holder">
|
74 |
-
<div id="wp_rp_statistics_collapsible" block="statistics" class="settings_block collapsible collapsed">
|
75 |
-
<a href="#" class="collapse-handle">Collapse</a>
|
76 |
-
<h2><?php _e('Statistics', 'wp_related_posts'); ?></h2>
|
77 |
-
<div class="container" <?php echo !$meta['show_statistics'] ? 'style="display: none;" ' : ''; ?>>
|
78 |
-
<div id="wp_rp_statistics_wrap">
|
79 |
-
<div class="message unavailable"><?php _e("Statistics currently unavailable",'wp_related_posts'); ?></div>
|
80 |
-
</div>
|
81 |
-
</div>
|
82 |
-
</div>
|
83 |
-
</div>
|
84 |
-
<?php endif; ?>
|
85 |
<div id="wp_rp_basic_settings_collapsible" block="basic_settings" class="settings_block collapsible">
|
86 |
<a href="#" class="collapse-handle">Collapse</a>
|
87 |
<h2><?php _e("Basic settings",'wp_related_posts');?></h2>
|
@@ -241,17 +205,6 @@
|
|
241 |
<?php _e("Display Related Posts in Feed",'wp_related_posts');?>
|
242 |
</label>
|
243 |
<br />
|
244 |
-
<label>
|
245 |
-
<input name="wp_rp_ctr_dashboard_enabled" type="checkbox" id="wp_rp_ctr_dashboard_enabled" value="yes" <?php checked($options['ctr_dashboard_enabled']); ?> />
|
246 |
-
<?php _e("Turn statistics on",'wp_related_posts');?>*
|
247 |
-
</label>
|
248 |
-
<br />
|
249 |
-
<div style="display:<?php echo $meta['show_traffic_exchange'] ? 'block' : 'none' ?>;">
|
250 |
-
<label>
|
251 |
-
<input name="wp_rp_traffic_exchange_enabled" type="checkbox" id="wp_rp_traffic_exchange_enabled" value="yes"<?php checked($options['traffic_exchange_enabled']); ?>>
|
252 |
-
<?php _e("Enable traffic exchange with blogger networks",'wp_related_posts');?>
|
253 |
-
</label>
|
254 |
-
</div>
|
255 |
<div style="display:<?php echo $meta['remote_recommendations'] ? 'block' : 'none' ?>;">
|
256 |
<label>
|
257 |
<input name="wp_rp_promoted_content_enabled" type="checkbox" id="wp_rp_promoted_content_enabled" value="yes" <?php checked($options['promoted_content_enabled']); ?> />
|
@@ -280,8 +233,8 @@
|
|
280 |
|
281 |
<p>But you <a href="http://zem.si/1eolNqf" target="_blank">can do more</a>. You can attract attention from other bloggers and improve your credibility by inserting recommendations that show up below your editor, while you write. This way everybody wins.</p>
|
282 |
|
283 |
-
<p>Also - you can now use our related articles widget while composing your posts in the <strong>Text mode</strong> of your editor. This way your workflow won't be interrupted by switching back and forth between <em>Visual</em> and <em>Text</em> mode.</p>
|
284 |
-
|
285 |
<h3>FAQ</h3>
|
286 |
<p><strong>Are manually added related posts available only for bloggers who write in English?</strong> <br />Yes.</p>
|
287 |
<p><strong>Will my posts be recommended to others?</strong> <br />Depends, check our <a href="http://zem.si/PLAzS1" target="_blank">guidelines</a> if you fit in.
|
19 |
</span>
|
20 |
</h2>
|
21 |
</div>
|
22 |
+
<?php if ($form_display == 'block'): ?>
|
23 |
+
<h2><?php _e('Subscribe to news and activity reports', 'wp_related_posts'); ?></h2>
|
24 |
+
<div class="container subscription-container">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
<table class="form-table subscription-block">
|
26 |
<tr valign="top">
|
27 |
<th scope="row">
|
33 |
<a id="wp_rp_unsubscribe_button" href="#" class="button-primary"><?php _e('Unsubscribe', 'wp_related_posts'); ?></a>
|
34 |
</td>
|
35 |
</tr>
|
36 |
+
<tr valign="top">
|
37 |
+
<th scope="row"></th>
|
38 |
+
<td>
|
39 |
+
<?php _e("Subscribe and we'll start monitoring our network for your <a href=\"$blog_url\" target=\"_blank\">blog</a>. <br />We'll <strong>let you know</strong> when somebody links to you.", 'wp_related_posts'); ?>
|
40 |
+
</td>
|
41 |
+
</tr>
|
42 |
</table>
|
43 |
</div>
|
44 |
+
<?php endif; ?>
|
45 |
|
46 |
<!-- MAIN FORM -->
|
47 |
<form method="post" enctype="multipart/form-data" action="<?php echo $form_url; ?>" id="wp_rp_settings_form" style="display: <?php echo $form_display; ?>;">
|
48 |
+
<?php wp_nonce_field('wp_rp_settings', '_wp_rp_nonce') ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
<div id="wp_rp_basic_settings_collapsible" block="basic_settings" class="settings_block collapsible">
|
50 |
<a href="#" class="collapse-handle">Collapse</a>
|
51 |
<h2><?php _e("Basic settings",'wp_related_posts');?></h2>
|
205 |
<?php _e("Display Related Posts in Feed",'wp_related_posts');?>
|
206 |
</label>
|
207 |
<br />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
<div style="display:<?php echo $meta['remote_recommendations'] ? 'block' : 'none' ?>;">
|
209 |
<label>
|
210 |
<input name="wp_rp_promoted_content_enabled" type="checkbox" id="wp_rp_promoted_content_enabled" value="yes" <?php checked($options['promoted_content_enabled']); ?> />
|
233 |
|
234 |
<p>But you <a href="http://zem.si/1eolNqf" target="_blank">can do more</a>. You can attract attention from other bloggers and improve your credibility by inserting recommendations that show up below your editor, while you write. This way everybody wins.</p>
|
235 |
|
236 |
+
<p>Also - you can now use our related articles widget while composing your posts in the <strong>Text mode</strong> of your editor. This way your workflow won't be interrupted by switching back and forth between <em>Visual</em> and <em>Text</em> mode.</p>
|
237 |
+
<iframe src="//player.vimeo.com/video/98542850" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
|
238 |
<h3>FAQ</h3>
|
239 |
<p><strong>Are manually added related posts available only for bloggers who write in English?</strong> <br />Yes.</p>
|
240 |
<p><strong>Will my posts be recommended to others?</strong> <br />Depends, check our <a href="http://zem.si/PLAzS1" target="_blank">guidelines</a> if you fit in.
|
wp_related_posts.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WordPress Related Posts
|
4 |
-
Version: 3.
|
5 |
Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
|
6 |
Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Click on <a href="admin.php?page=wordpress-related-posts">Related Posts tab</a> to configure your settings.
|
7 |
Author: Zemanta Ltd.
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WordPress Related Posts
|
4 |
+
Version: 3.5.1
|
5 |
Plugin URI: http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/
|
6 |
Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. Click on <a href="admin.php?page=wordpress-related-posts">Related Posts tab</a> to configure your settings.
|
7 |
Author: Zemanta Ltd.
|