Changeset 1007594
- Timestamp:
- 10/15/2014 12:13:26 AM (11 years ago)
- Location:
- social-metrics-tracker
- Files:
-
- 68 added
- 6 edited
-
tags/1.2.3 (added)
-
tags/1.2.3/LICENSE.md (added)
-
tags/1.2.3/MetricsUpdater.class.php (added)
-
tags/1.2.3/README.md (added)
-
tags/1.2.3/SocialMetricsSettings.class.php (added)
-
tags/1.2.3/SocialMetricsTrackerWidget.class.php (added)
-
tags/1.2.3/css (added)
-
tags/1.2.3/css/social_metrics.css (added)
-
tags/1.2.3/data-sources (added)
-
tags/1.2.3/data-sources/google_analytics.php (added)
-
tags/1.2.3/data-sources/sharedcount.com.php (added)
-
tags/1.2.3/lib (added)
-
tags/1.2.3/lib/Google (added)
-
tags/1.2.3/lib/Google/Auth (added)
-
tags/1.2.3/lib/Google/Auth/Abstract.php (added)
-
tags/1.2.3/lib/Google/Auth/AssertionCredentials.php (added)
-
tags/1.2.3/lib/Google/Auth/Exception.php (added)
-
tags/1.2.3/lib/Google/Auth/LoginTicket.php (added)
-
tags/1.2.3/lib/Google/Auth/OAuth2.php (added)
-
tags/1.2.3/lib/Google/Auth/Simple.php (added)
-
tags/1.2.3/lib/Google/Cache (added)
-
tags/1.2.3/lib/Google/Cache/Abstract.php (added)
-
tags/1.2.3/lib/Google/Cache/Apc.php (added)
-
tags/1.2.3/lib/Google/Cache/Exception.php (added)
-
tags/1.2.3/lib/Google/Cache/File.php (added)
-
tags/1.2.3/lib/Google/Cache/Memcache.php (added)
-
tags/1.2.3/lib/Google/Cache/Null.php (added)
-
tags/1.2.3/lib/Google/Client.php (added)
-
tags/1.2.3/lib/Google/Collection.php (added)
-
tags/1.2.3/lib/Google/Config.php (added)
-
tags/1.2.3/lib/Google/Exception.php (added)
-
tags/1.2.3/lib/Google/Http (added)
-
tags/1.2.3/lib/Google/Http/Batch.php (added)
-
tags/1.2.3/lib/Google/Http/CacheParser.php (added)
-
tags/1.2.3/lib/Google/Http/MediaFileUpload.php (added)
-
tags/1.2.3/lib/Google/Http/REST.php (added)
-
tags/1.2.3/lib/Google/Http/Request.php (added)
-
tags/1.2.3/lib/Google/IO (added)
-
tags/1.2.3/lib/Google/IO/Abstract.php (added)
-
tags/1.2.3/lib/Google/IO/Curl.php (added)
-
tags/1.2.3/lib/Google/IO/Exception.php (added)
-
tags/1.2.3/lib/Google/IO/Stream.php (added)
-
tags/1.2.3/lib/Google/IO/cacerts.pem (added)
-
tags/1.2.3/lib/Google/Model.php (added)
-
tags/1.2.3/lib/Google/Service (added)
-
tags/1.2.3/lib/Google/Service.php (added)
-
tags/1.2.3/lib/Google/Service/Analytics.php (added)
-
tags/1.2.3/lib/Google/Service/Exception.php (added)
-
tags/1.2.3/lib/Google/Service/Resource.php (added)
-
tags/1.2.3/lib/Google/Signer (added)
-
tags/1.2.3/lib/Google/Signer/Abstract.php (added)
-
tags/1.2.3/lib/Google/Signer/P12.php (added)
-
tags/1.2.3/lib/Google/Utils (added)
-
tags/1.2.3/lib/Google/Utils.php (added)
-
tags/1.2.3/lib/Google/Utils/URITemplate.php (added)
-
tags/1.2.3/lib/Google/Verifier (added)
-
tags/1.2.3/lib/Google/Verifier/Abstract.php (added)
-
tags/1.2.3/lib/Google/Verifier/Pem.php (added)
-
tags/1.2.3/lib/class-wp-list-table.php (added)
-
tags/1.2.3/lib/wp-settings-framework.php (added)
-
tags/1.2.3/readme.txt (added)
-
tags/1.2.3/settings (added)
-
tags/1.2.3/settings/smt-gapi.php (added)
-
tags/1.2.3/settings/smt-general.php (added)
-
tags/1.2.3/smt-dashboard-debug.php (added)
-
tags/1.2.3/smt-dashboard.php (added)
-
tags/1.2.3/smt-export.php (added)
-
tags/1.2.3/social-metrics-tracker.php (added)
-
trunk/MetricsUpdater.class.php (modified) (6 diffs)
-
trunk/README.md (modified) (3 diffs)
-
trunk/SocialMetricsTrackerWidget.class.php (modified) (1 diff)
-
trunk/data-sources/sharedcount.com.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (9 diffs)
-
trunk/social-metrics-tracker.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
social-metrics-tracker/trunk/MetricsUpdater.class.php
r957650 r1007594 51 51 52 52 // If no post ID specified, use current page 53 if ($post_id <= 0 ) $post_id = $post->ID;53 if ($post_id <= 0 && $post) $post_id = $post->ID; 54 54 55 55 // Get post types to track … … 57 57 58 58 // Validation 59 if (is_admin()) return false;60 if ( $post_id <= 0)return false;61 if ( $post->post_status != 'publish')return false; // Allow only published posts59 if (is_admin()) return false; 60 if (is_int($post_id) && $post_id <= 0) return false; 61 if (!$post || $post->post_status != 'publish') return false; // Allow only published posts 62 62 if ((count($types) > 0) && !is_singular($types)) return false; // Allow singular view of enabled post types 63 63 … … 75 75 } 76 76 77 return ;77 return true; 78 78 } // end checkThisPost() 79 79 … … 83 83 $types_to_track = array(); 84 84 85 $smt_post_types = get_post_types( array( 'public'=>true), 'names' );85 $smt_post_types = get_post_types( array( 'public' => true ), 'names' ); 86 86 unset($smt_post_types['attachment']); 87 87 88 88 foreach ($smt_post_types as $type) { 89 if ($this->options['smt_options_post_types_'.$type] == $type) $types_to_track[] = $type; 90 } 91 92 return $types_to_track; 89 if (isset($this->options['smt_options_post_types_'.$type]) && $this->options['smt_options_post_types_'.$type] == $type) $types_to_track[] = $type; 90 } 91 92 // If none selected, default post types 93 return ($types_to_track) ? $types_to_track : array_values($smt_post_types); 93 94 94 95 } … … 148 149 */ 149 150 public function calculateScoreAggregate($social_num = 0, $views_num = 0, $comment_num = 0) { 151 152 // Validate input 153 if (!is_int($social_num) || !is_int($views_num) || !is_int($comment_num)) return false; 150 154 151 155 // Configuration … … 335 339 } 336 340 337 return ;341 return true; 338 342 } // end scheduleFullDataSync() 339 343 -
social-metrics-tracker/trunk/README.md
r957650 r1007594 1 # [Social Metrics Tracker](https://github.com/chapmanu/wp-social-metrics-tracker) 1 [](https://travis-ci.org/chapmanu/wp-social-metrics-tracker) 2 3 # Social Metrics Tracker 2 4 3 5  … … 46 48 Last Updated Timestamp | socialcount_LAST_UPDATED 47 49 48 ### Extending the plugin50 ### Action Hooks 49 51 50 52 There are some Wordpress action hooks which can be used to extend the functionality of this plugin. 51 53 52 **social_metrics_post_sync** is called when an individual post is being updated, before new data is downloaded. 53 **social_metrics_post_sync_complete** is called when an individual post is done being updated. 54 **social_metrics_post_sync** is called just before an individual post is updated. 55 **social_metrics_post_sync_complete** is called when an individual post update completes. 56 57 ### Contributing to development 58 59 There are some *really super awesome* PHPUnit tests written to help make sure that code changes don't break any existing functionality. If you plan on submitting pull requests, please make sure to [read over the wiki page](https://github.com/chapmanu/wp-social-metrics-tracker/wiki/Plugin-testing-with-PHPUnit) which explains how to get PHPUnit up and running in your development environment. 54 60 55 61 # FAQ … … 61 67 ### Q: What social networks are measured? 62 68 63 A: Facebook, Twitter, Reddit, LinkedIn, Digg, Delicious, StumbleUpon, Pinterest, and Google+.69 A: Facebook, Twitter, LinkedIn, StumbleUpon, Pinterest, and Google+. 64 70 65 71 ### Q: When is the data updated? -
social-metrics-tracker/trunk/SocialMetricsTrackerWidget.class.php
r988416 r1007594 17 17 18 18 $this->options = get_option('smt_settings'); 19 20 $this->data_max = array(); 19 21 20 22 // Do not run if current user not allowed to see this -
social-metrics-tracker/trunk/data-sources/sharedcount.com.php
r957650 r1007594 18 18 19 19 // get social data from api.sharedcount.com 20 $ curl_handle = curl_init();20 $shared_count_service_data = $this->getData($post_url); 21 21 22 curl_setopt($curl_handle, CURLOPT_URL, 'http://api.sharedcount.com/?url='.rawurlencode($post_url)); 23 curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3); 24 curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 25 26 $json = curl_exec($curl_handle); 27 28 curl_close($curl_handle); 29 30 // reject if no response 31 if (!strlen($json)) return; 32 33 // decode social data from JSON 34 $shared_count_service_data = json_decode($json, true); 22 if ($shared_count_service_data === false) return false; 35 23 36 24 // prepare stats array … … 60 48 61 49 } 50 51 // Retrieve and return the data from the remote resource 52 public function getData($url) { 53 54 $curl_handle = curl_init(); 55 curl_setopt($curl_handle, CURLOPT_URL, 'http://api.sharedcount.com/?url='.rawurlencode($url)); 56 curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 3); 57 curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); 58 $data = curl_exec($curl_handle); 59 curl_close($curl_handle); 60 61 // reject if no response 62 if (!strlen($data)) return false; 63 64 // decode social data from JSON 65 $shared_count_service_data = json_decode($data, true); 66 } 67 62 68 } -
social-metrics-tracker/trunk/readme.txt
r1001546 r1007594 3 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K2Z4QFWKJ5DM4 4 4 Tags: admin, dashboard, social, social media, facebook, twitter, metrics, analytics, tracking, engagement, share, sharing, shares 5 Requires at least: 3. 8.15 Requires at least: 3.5 6 6 Tested up to: 4.0 7 Stable tag: 1.2. 27 Stable tag: 1.2.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 24 24 = Focus your writing topics: = 25 25 26 Understand what posts your readers are sharing on social networks so that you can write more of what works well. 26 Understand what posts your readers are sharing on social networks so that you can write more of what works well. 27 27 28 28 = Do more with the data: = 29 29 30 Export collected data to a spreadsheet for analysis. 30 Export collected data to a spreadsheet for analysis. 31 31 32 For web developers, this plugin collects and stores social metrics data in a way that can be accessed by other WP plugins or themes. For example, the social metrics could be used to display a feed of the most popular posts. Metrics are stored as custom post meta fields on each individual post. This is an advanced feature which requires writing custom code. 32 For web developers, this plugin collects and stores social metrics data in a way that can be accessed by other WP plugins or themes. For example, the social metrics could be used to display a feed of the most popular posts. Metrics are stored as custom post meta fields on each individual post. This is an advanced feature which requires writing custom code. 33 33 34 34 … … 39 39 3. Review the plugin settings under Settings > Social Metrics 40 40 41 If you do not see any statistics on the Social Metrics dashboard, make sure that you have some posts published and that wp-cron.php is working correctly. This plugin relies on the WordPress Cron system to fetch data updates. This plugin will not work on local or development servers where URLs are not publicly accessible. 41 If you do not see any statistics on the Social Metrics dashboard, make sure that you have some posts published and that wp-cron.php is working correctly. This plugin relies on the WordPress Cron system to fetch data updates. This plugin will not work on local or development servers where URLs are not publicly accessible. 42 42 43 43 … … 62 62 = Will this work with WordPress Multisite? = 63 63 64 Absolutely! This plugin was created with large-scale Multisite blog networks in mind. 64 Absolutely! This plugin was created with large-scale Multisite blog networks in mind. 65 65 66 66 = What about pageviews? = 67 67 68 You can link with your Google Analytics account to import pageview data for posts. This requires a free Google API Developer Key. 68 You can link with your Google Analytics account to import pageview data for posts. This requires a free Google API Developer Key. 69 69 70 70 = Who created this? = … … 81 81 == Changelog == 82 82 83 = 1.2.2 = 83 = 1.2.3 = 84 * Fixed bar width when displaying a widget on the admin Dashboard. 85 86 = 1.2.2 = 84 87 * Plugin activation hotfix 85 88 86 = 1.2.1 = 89 = 1.2.1 = 87 90 * Update Google Analytics setup wizard steps 88 91 * Fix various bugs … … 107 110 = 1.0.1 = 108 111 * Added colors and labels to the graph for each of the nine social networks. 109 * Bar graph expands on hover to show detail of the breakdown. 112 * Bar graph expands on hover to show detail of the breakdown. 110 113 111 114 = 1.0 = 112 * Plugin created, wohoo! 115 * Plugin created, wohoo! 113 116 114 117 115 118 == Upgrade Notice == 119 120 = 1.2.3 = 121 Squished more bugs! 116 122 117 123 = 1.2.2 = … … 122 128 123 129 = 1.2.0 = 124 Added data export tool, and fixed bugs. 130 Added data export tool, and fixed bugs. 125 131 126 132 = 1.1.1 = … … 128 134 129 135 = 1.1.0 = 130 Added some new features including custom post types, Google Analytics, and more. 136 Added some new features including custom post types, Google Analytics, and more. 131 137 132 138 = 1.0.1 = … … 134 140 135 141 = 1.0.1 = 136 Added colors and labels for all nine social networks. 142 Added colors and labels for all nine social networks. 137 143 138 144 -
social-metrics-tracker/trunk/social-metrics-tracker.php
r1001546 r1007594 4 4 Plugin URI: https://github.com/ChapmanU/wp-social-metrics-tracker 5 5 Description: Collect and display social network shares, likes, tweets, and view counts of posts. 6 Version: 1.2. 26 Version: 1.2.3 7 7 Author: Ben Cole, Chapman University 8 8 Author URI: http://www.bencole.net … … 33 33 class SocialMetricsTracker { 34 34 35 private $version = '1.2. 2'; // for db upgrade comparison35 private $version = '1.2.3'; // for db upgrade comparison 36 36 public $updater; 37 37 public $options; … … 86 86 // Determines if we are on a development or staging environment 87 87 public function is_development_server() { 88 return ( defined('WP_ENV') && strtolower(WP_ENV) != 'production' || $_SERVER['REMOTE_ADDR'] == '127.0.0.1');88 return ((defined('WP_ENV') && strtolower(WP_ENV) != 'production') || (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] == '127.0.0.1')); 89 89 } 90 90 … … 190 190 $types_to_track = array(); 191 191 192 $smt_post_types = get_post_types( array( 'public' => true ), 'names' ); 192 $smt_post_types = get_post_types( array( 'public' => true ), 'names' ); 193 193 unset($smt_post_types['attachment']); 194 194 … … 202 202 203 203 /*************************************************** 204 * Check the version of the plugin and perform upgrade tasks if necessary 204 * Check the version of the plugin and perform upgrade tasks if necessary 205 205 ***************************************************/ 206 206 public function version_check() { … … 211 211 212 212 // Do upgrade tasks 213 213 214 214 } 215 215 }
Note: See TracChangeset
for help on using the changeset viewer.