From 9f7e465fcb5c48c5e5676cd05ea3b7d728c51cc0 Mon Sep 17 00:00:00 2001 From: Andre Malan Date: Mon, 17 Mar 2014 13:55:28 -0400 Subject: [PATCH 1/3] give force http option to publishers --- readme.txt | 5 ++++- sranalytics.php | 11 ++++++++++- sranalytics_admin.php | 14 +++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/readme.txt b/readme.txt index 755edfa..df216fa 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Plugin Name: SimpleReach Analytics Plugin URI: https://github.com/simplereach/sranalytics_wordpress Requires at least: 2.7 Tested up to: 3.8.1 -Stable tag: 0.0.6 +Stable tag: 0.0.7 SimpleReach Analytics finds trending articles and gives publishers deep insights into their social traffic. @@ -20,6 +20,9 @@ SimpleReach Analytics finds trending articles and gives publishers deep insights == Changelog == += 0.0.7 = +* Added ability for all https urls to be sent as http + = 0.0.6 = * Fixed bug that caused authors not to be tracked in older versions of WordPress * Updated copy and layout for settings screen diff --git a/sranalytics.php b/sranalytics.php index 134f02a..acc86e9 100644 --- a/sranalytics.php +++ b/sranalytics.php @@ -8,7 +8,7 @@ Author URI: https://www.simplereach.com */ -define('SRANALYTICS_PLUGIN_VERSION', '0.0.6'); +define('SRANALYTICS_PLUGIN_VERSION', '0.0.7'); define('SRANALYTICS_PLUGIN_URL', PLugin_dir_url(__FILE__)); define('SRANALYTICS_PLUGIN_SUPPORT_EMAIL', 'support@simplereach.com'); @@ -36,6 +36,9 @@ function sranalytics_insert_js() $sranalytics_show_everywhere_string = get_option('sranalytics_show_everywhere'); $sranalytics_show_everywhere = ($sranalytics_show_everywhere_string === 'true'); + $sranalytics_force_http_string = get_option('sranalytics_force_http'); + $sranalytics_force_http = ($sranalytics_force_http_string === 'true'); + $sranalytics_disable_iframe_loading_string = get_option('sranalytics_disable_iframe_loading'); $sranalytics_disable_iframe_loading = ($sranalytics_disable_iframe_loading_string === 'true'); @@ -82,6 +85,12 @@ function sranalytics_insert_js() $published_date = $post->post_date_gmt; $canonical_url = addslashes(get_permalink($post->ID)); + //force https to http if option is checked + if($sranalytics_force_http){ + $pattern = '/https:\/\//'; + $canonical_url = preg_replace( $pattern , "http://" , $canonical_url); + } + // Show the tags if we are on a tag/author/category page and we are supposed to if ((is_category() or is_author() or is_tag()) and ($sranalytics_show_on_tac_pages or $sranalytics_show_everywhere)) { $sranalytics_show_beacon = true; diff --git a/sranalytics_admin.php b/sranalytics_admin.php index 802e74e..75aad64 100644 --- a/sranalytics_admin.php +++ b/sranalytics_admin.php @@ -23,7 +23,10 @@ if (update_option('sranalytics_show_everywhere', $sranalytics_show_everywhere)) { $message = 'Settings updated'; } - + $sranalytics_force_http = (!empty($_POST['sranalytics_force_http'])) ? $_POST['sranalytics_force_http'] : ''; + if (update_option('sranalytics_force_http', $sranalytics_force_http)) { + $message = 'Settings updated'; + } $sranalytics_disable_iframe_loading = (!empty($_POST['sranalytics_disable_iframe_loading'])) ? $_POST['sranalytics_disable_iframe_loading'] : ''; if (update_option('sranalytics_disable_iframe_loading', $sranalytics_disable_iframe_loading)) { $message = 'Settings updated'; @@ -55,6 +58,11 @@ $sranalytics_show_on_wp_pages = false; } + $sranalytics_force_http_string = get_option('sranalytics_force_http'); + $sranalytics_force_http = ($sranalytics_force_http_string == "true"); + if (empty($sranalytics_force_http)) { + $sranalytics_force_http = false; + } $sranalytics_disable_iframe_loading_string = get_option('sranalytics_disable_iframe_loading'); $sranalytics_disable_iframe_loading = ($sranalytics_disable_iframe_loading_string === 'true'); if (empty($sranalytics_show_on_wp_pages)) { @@ -125,6 +133,10 @@ /> +
  • + /> + +
  • From 5e00522110c51ed38c67f2afa56a828578c3efdc Mon Sep 17 00:00:00 2001 From: pnts Date: Mon, 17 Mar 2014 14:27:11 -0400 Subject: [PATCH 2/3] updates to http/https option copy --- sranalytics_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sranalytics_admin.php b/sranalytics_admin.php index 75aad64..132f5b7 100644 --- a/sranalytics_admin.php +++ b/sranalytics_admin.php @@ -135,7 +135,7 @@
  • /> - +
  • From 364839d97a926ab7022994b88242430ea01301c2 Mon Sep 17 00:00:00 2001 From: Andre Malan Date: Mon, 17 Mar 2014 14:37:02 -0400 Subject: [PATCH 3/3] from the beginning --- sranalytics.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sranalytics.php b/sranalytics.php index acc86e9..69de610 100644 --- a/sranalytics.php +++ b/sranalytics.php @@ -87,7 +87,7 @@ function sranalytics_insert_js() //force https to http if option is checked if($sranalytics_force_http){ - $pattern = '/https:\/\//'; + $pattern = '/^https:\/\//'; $canonical_url = preg_replace( $pattern , "http://" , $canonical_url); }