Changeset 668069
- Timestamp:
- 02/14/2013 08:08:01 PM (13 years ago)
- Location:
- related-posts
- Files:
-
- 4 deleted
- 2 edited
- 22 copied
-
tags/2.5.1 (copied) (copied from related-posts/trunk)
-
tags/2.5.1/admin_notices.php (copied) (copied from related-posts/trunk/admin_notices.php)
-
tags/2.5.1/compatibility.php (copied) (copied from related-posts/trunk/compatibility.php)
-
tags/2.5.1/config.php (copied) (copied from related-posts/trunk/config.php)
-
tags/2.5.1/dashboard_widget.php (copied) (copied from related-posts/trunk/dashboard_widget.php)
-
tags/2.5.1/edit_related_posts.php (copied) (copied from related-posts/trunk/edit_related_posts.php)
-
tags/2.5.1/forwarder.php (deleted)
-
tags/2.5.1/lib (copied) (copied from related-posts/trunk/lib)
-
tags/2.5.1/lib/mobile_detect.php (copied) (copied from related-posts/trunk/lib/mobile_detect.php)
-
tags/2.5.1/notifications.php (copied) (copied from related-posts/trunk/notifications.php)
-
tags/2.5.1/readme.txt (copied) (copied from related-posts/trunk/readme.txt) (2 diffs)
-
tags/2.5.1/recommendations.php (copied) (copied from related-posts/trunk/recommendations.php)
-
tags/2.5.1/related-posts (deleted)
-
tags/2.5.1/related-posts_install_de.jpg (deleted)
-
tags/2.5.1/settings.php (copied) (copied from related-posts/trunk/settings.php)
-
tags/2.5.1/static (copied) (copied from related-posts/trunk/static)
-
tags/2.5.1/static/css/dashboard.css (copied) (copied from related-posts/trunk/static/css/dashboard.css)
-
tags/2.5.1/static/img/arrow_down.png (copied) (copied from related-posts/trunk/static/img/arrow_down.png)
-
tags/2.5.1/static/img/arrow_right.png (copied) (copied from related-posts/trunk/static/img/arrow_right.png)
-
tags/2.5.1/static/js/dashboard.js (copied) (copied from related-posts/trunk/static/js/dashboard.js)
-
tags/2.5.1/static/js/themes.js (copied) (copied from related-posts/trunk/static/js/themes.js)
-
tags/2.5.1/static/settings.js.php (deleted)
-
tags/2.5.1/thumbnailer.php (copied) (copied from related-posts/trunk/thumbnailer.php)
-
tags/2.5.1/versions.php (copied) (copied from related-posts/trunk/versions.php)
-
tags/2.5.1/widget.php (copied) (copied from related-posts/trunk/widget.php)
-
tags/2.5.1/wp_related_posts.php (copied) (copied from related-posts/trunk/wp_related_posts.php) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/wp_related_posts.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
related-posts/tags/2.5.1/readme.txt
r667144 r668069 5 5 Requires at least: 3.3 6 6 Tested up to: 3.5 7 Stable tag: 2.5 7 Stable tag: 2.5.1 8 8 9 9 This WordPress plugin provides multiple options to show the via tags related posts of a post (for example via a sidebar widget). … … 46 46 == Changelog == 47 47 48 = 2.5.1 = 49 * Fixed bug with invalid output html 50 * Improved Infinite Stream theme 51 48 52 = 2.5 = 49 53 * Mobile themes settings -
related-posts/tags/2.5.1/wp_related_posts.php
r667706 r668069 2 2 /* 3 3 Plugin Name: Related Posts 4 Version: 2.5 4 Version: 2.5.1 5 5 Plugin URI: http://wordpress.org/extend/plugins/related-posts/ 6 6 Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. … … 330 330 function wp_rp_head_resources() { 331 331 global $post, $wpdb; 332 global $wp_rp_session_id, $wp_rp_test_group; // used for AB test 333 334 //error_log("call to wp_rp_head_resources"); 332 335 333 336 if (wp_rp_should_exclude()) { … … 372 375 "\twindow._wp_rp_admin_ajax_url = '" . admin_url('admin-ajax.php') . "';\n" . 373 376 "\twindow._wp_rp_plugin_static_base_url = '" . esc_js(plugins_url('static/' , __FILE__)) . "';\n" 374 : ''); 377 : '') . 378 wp_rp_render_head_script_variables(); 375 379 } 376 380 … … 497 501 return "\n" . $output . "\n"; 498 502 } 503 504 505 506 // --------- mobile AB testing ----------- 507 508 define('WP_RP_AB_TEST_PARAM', 'wprptest'); 509 define('WP_RP_AB_TEST_COOKIE', 'wprptest'); 510 511 global $wp_rp_session_id, $wp_rp_test_group; 512 $wp_rp_session_id = false; $wp_rp_test_group = 0; 513 514 function wp_rp_render_head_script_variables() { 515 // used when rendering <head> 516 global $wp_rp_session_id, $wp_rp_test_group; 517 518 $output = ''; 519 if (wp_is_mobile()){ 520 //error_log("AB data appended in head <script>"); 521 $output = "\twindow._wp_rp_test_group = " . $wp_rp_test_group . ";\n" . 522 "\twindow._wp_rp_sid = \"" . $wp_rp_session_id . "\";\n"; 523 } 524 return $output; 525 } 526 527 function wp_rp_set_test_cookie() { 528 global $wp_rp_session_id; 529 530 //error_log("wp_rp_set_test_cookie"); 531 //error_log("session_id: " .$_COOKIE[WP_RP_AB_TEST_COOKIE]); 532 533 $wp_rp_session_id = isset($_COOKIE[WP_RP_AB_TEST_COOKIE]) ? $_COOKIE[WP_RP_AB_TEST_COOKIE] : false; 534 if ($wp_rp_session_id) { 535 //error_log("cookie is set - type: " . gettype($wp_rp_session_id)); 536 return; 537 } 538 539 $wp_rp_session_id = (string)rand(); 540 //error_log("cookie is NOT set"); 541 setcookie(WP_RP_AB_TEST_COOKIE, $wp_rp_session_id, time() + 60 * 30); 542 } 543 544 function wp_rp_is_suitable_for_test() { 545 $options = wp_rp_get_options(); 546 return $options['ctr_dashboard_enabled'] && wp_is_mobile(); 547 } 548 549 function wp_rp_get_post_url($post_id) { 550 global $wp_rp_test_group; 551 552 //error_log("wp_rp_get_post_url"); 553 554 $post_url = get_permalink($post_id); 555 556 if (!wp_rp_is_suitable_for_test()) { 557 return $post_url; 558 } 559 560 if (strpos($post_url, '?') === false) { 561 $post_url .= '?' .WP_RP_AB_TEST_PARAM. '=' . $wp_rp_test_group; 562 } else { 563 $post_url .= '&' .WP_RP_AB_TEST_PARAM. '=' . $wp_rp_test_group; 564 } 565 return $post_url; 566 } 567 568 569 function wp_rp_init_test() { 570 $platform_options = wp_rp_get_platform_options(); 571 if ($platform_options['theme_name'] !== 'm-stream.css') { 572 return; 573 } 574 575 global $wp_rp_session_id, $wp_rp_test_group, $post; 576 577 //error_log("wp_rp_init_test"); 578 579 if ($wp_rp_session_id) { 580 //error_log("session id set"); 581 return; 582 } 583 584 if (!wp_rp_is_suitable_for_test()) { 585 //error_log("not suitable for test"); 586 return; 587 } 588 589 wp_rp_set_test_cookie(); 590 591 if (isset($_GET[WP_RP_AB_TEST_PARAM])) { 592 $wp_rp_test_group = intval($_GET[WP_RP_AB_TEST_PARAM]); 593 //error_log("wp rep test param is set: " . $wp_rp_test_group); 594 return; 595 } 596 597 $wp_rp_test_group = abs(crc32($wp_rp_session_id) % 2); 598 599 $options = wp_rp_get_options(); 600 if ($post && $post->post_type === 'post' && (($options["on_single_post"] && is_single()))) { 601 wp_redirect(wp_rp_get_post_url($post->ID), 301); 602 //error_log("redirect done"); 603 exit; 604 } 605 //error_log("skipped redirect"); 606 } 607 add_action('template_redirect', 'wp_rp_init_test'); 608 -
related-posts/trunk/readme.txt
r667144 r668069 5 5 Requires at least: 3.3 6 6 Tested up to: 3.5 7 Stable tag: 2.5 7 Stable tag: 2.5.1 8 8 9 9 This WordPress plugin provides multiple options to show the via tags related posts of a post (for example via a sidebar widget). … … 46 46 == Changelog == 47 47 48 = 2.5.1 = 49 * Fixed bug with invalid output html 50 * Improved Infinite Stream theme 51 48 52 = 2.5 = 49 53 * Mobile themes settings -
related-posts/trunk/wp_related_posts.php
r667706 r668069 2 2 /* 3 3 Plugin Name: Related Posts 4 Version: 2.5 4 Version: 2.5.1 5 5 Plugin URI: http://wordpress.org/extend/plugins/related-posts/ 6 6 Description: Quickly increase your readers' engagement with your posts by adding Related Posts in the footer of your content. … … 330 330 function wp_rp_head_resources() { 331 331 global $post, $wpdb; 332 global $wp_rp_session_id, $wp_rp_test_group; // used for AB test 333 334 //error_log("call to wp_rp_head_resources"); 332 335 333 336 if (wp_rp_should_exclude()) { … … 372 375 "\twindow._wp_rp_admin_ajax_url = '" . admin_url('admin-ajax.php') . "';\n" . 373 376 "\twindow._wp_rp_plugin_static_base_url = '" . esc_js(plugins_url('static/' , __FILE__)) . "';\n" 374 : ''); 377 : '') . 378 wp_rp_render_head_script_variables(); 375 379 } 376 380 … … 497 501 return "\n" . $output . "\n"; 498 502 } 503 504 505 506 // --------- mobile AB testing ----------- 507 508 define('WP_RP_AB_TEST_PARAM', 'wprptest'); 509 define('WP_RP_AB_TEST_COOKIE', 'wprptest'); 510 511 global $wp_rp_session_id, $wp_rp_test_group; 512 $wp_rp_session_id = false; $wp_rp_test_group = 0; 513 514 function wp_rp_render_head_script_variables() { 515 // used when rendering <head> 516 global $wp_rp_session_id, $wp_rp_test_group; 517 518 $output = ''; 519 if (wp_is_mobile()){ 520 //error_log("AB data appended in head <script>"); 521 $output = "\twindow._wp_rp_test_group = " . $wp_rp_test_group . ";\n" . 522 "\twindow._wp_rp_sid = \"" . $wp_rp_session_id . "\";\n"; 523 } 524 return $output; 525 } 526 527 function wp_rp_set_test_cookie() { 528 global $wp_rp_session_id; 529 530 //error_log("wp_rp_set_test_cookie"); 531 //error_log("session_id: " .$_COOKIE[WP_RP_AB_TEST_COOKIE]); 532 533 $wp_rp_session_id = isset($_COOKIE[WP_RP_AB_TEST_COOKIE]) ? $_COOKIE[WP_RP_AB_TEST_COOKIE] : false; 534 if ($wp_rp_session_id) { 535 //error_log("cookie is set - type: " . gettype($wp_rp_session_id)); 536 return; 537 } 538 539 $wp_rp_session_id = (string)rand(); 540 //error_log("cookie is NOT set"); 541 setcookie(WP_RP_AB_TEST_COOKIE, $wp_rp_session_id, time() + 60 * 30); 542 } 543 544 function wp_rp_is_suitable_for_test() { 545 $options = wp_rp_get_options(); 546 return $options['ctr_dashboard_enabled'] && wp_is_mobile(); 547 } 548 549 function wp_rp_get_post_url($post_id) { 550 global $wp_rp_test_group; 551 552 //error_log("wp_rp_get_post_url"); 553 554 $post_url = get_permalink($post_id); 555 556 if (!wp_rp_is_suitable_for_test()) { 557 return $post_url; 558 } 559 560 if (strpos($post_url, '?') === false) { 561 $post_url .= '?' .WP_RP_AB_TEST_PARAM. '=' . $wp_rp_test_group; 562 } else { 563 $post_url .= '&' .WP_RP_AB_TEST_PARAM. '=' . $wp_rp_test_group; 564 } 565 return $post_url; 566 } 567 568 569 function wp_rp_init_test() { 570 $platform_options = wp_rp_get_platform_options(); 571 if ($platform_options['theme_name'] !== 'm-stream.css') { 572 return; 573 } 574 575 global $wp_rp_session_id, $wp_rp_test_group, $post; 576 577 //error_log("wp_rp_init_test"); 578 579 if ($wp_rp_session_id) { 580 //error_log("session id set"); 581 return; 582 } 583 584 if (!wp_rp_is_suitable_for_test()) { 585 //error_log("not suitable for test"); 586 return; 587 } 588 589 wp_rp_set_test_cookie(); 590 591 if (isset($_GET[WP_RP_AB_TEST_PARAM])) { 592 $wp_rp_test_group = intval($_GET[WP_RP_AB_TEST_PARAM]); 593 //error_log("wp rep test param is set: " . $wp_rp_test_group); 594 return; 595 } 596 597 $wp_rp_test_group = abs(crc32($wp_rp_session_id) % 2); 598 599 $options = wp_rp_get_options(); 600 if ($post && $post->post_type === 'post' && (($options["on_single_post"] && is_single()))) { 601 wp_redirect(wp_rp_get_post_url($post->ID), 301); 602 //error_log("redirect done"); 603 exit; 604 } 605 //error_log("skipped redirect"); 606 } 607 add_action('template_redirect', 'wp_rp_init_test'); 608
Note: See TracChangeset
for help on using the changeset viewer.