Changeset 1344759
- Timestamp:
- 02/06/2016 05:25:41 PM (10 years ago)
- Location:
- social-metrics-tracker
- Files:
-
- 107 added
- 5 edited
-
tags/1.6.5 (added)
-
tags/1.6.5/MetricsUpdater.class.php (added)
-
tags/1.6.5/SocialMetricsDebugger.class.php (added)
-
tags/1.6.5/SocialMetricsSettings.class.php (added)
-
tags/1.6.5/SocialMetricsTrackerWidget.class.php (added)
-
tags/1.6.5/css (added)
-
tags/1.6.5/css/social-metrics-tracker.min.css (added)
-
tags/1.6.5/css/social-metrics-tracker.min.css.map (added)
-
tags/1.6.5/css/social-metrics-tracker.scss (added)
-
tags/1.6.5/data-sources (added)
-
tags/1.6.5/data-sources/FacebookGraphUpdater.class.php (added)
-
tags/1.6.5/data-sources/FacebookPublicUpdater.class.php (added)
-
tags/1.6.5/data-sources/FlattrUpdater.class.php (added)
-
tags/1.6.5/data-sources/GooglePlusUpdater.class.php (added)
-
tags/1.6.5/data-sources/HTTPResourceUpdater.class.php (added)
-
tags/1.6.5/data-sources/LinkedInUpdater.class.php (added)
-
tags/1.6.5/data-sources/PinterestUpdater.class.php (added)
-
tags/1.6.5/data-sources/RedditUpdater.class.php (added)
-
tags/1.6.5/data-sources/StumbleUponUpdater.class.php (added)
-
tags/1.6.5/data-sources/WordPressCircuitBreaker.class.php (added)
-
tags/1.6.5/data-sources/XingUpdater.class.php (added)
-
tags/1.6.5/data-sources/google_analytics.php (added)
-
tags/1.6.5/js (added)
-
tags/1.6.5/js/social-metrics-tracker.js (added)
-
tags/1.6.5/js/social-metrics-tracker.min.js (added)
-
tags/1.6.5/lib (added)
-
tags/1.6.5/lib/Google (added)
-
tags/1.6.5/lib/Google/Auth (added)
-
tags/1.6.5/lib/Google/Auth/Abstract.php (added)
-
tags/1.6.5/lib/Google/Auth/AssertionCredentials.php (added)
-
tags/1.6.5/lib/Google/Auth/Exception.php (added)
-
tags/1.6.5/lib/Google/Auth/LoginTicket.php (added)
-
tags/1.6.5/lib/Google/Auth/OAuth2.php (added)
-
tags/1.6.5/lib/Google/Auth/Simple.php (added)
-
tags/1.6.5/lib/Google/Cache (added)
-
tags/1.6.5/lib/Google/Cache/Abstract.php (added)
-
tags/1.6.5/lib/Google/Cache/Apc.php (added)
-
tags/1.6.5/lib/Google/Cache/Exception.php (added)
-
tags/1.6.5/lib/Google/Cache/File.php (added)
-
tags/1.6.5/lib/Google/Cache/Memcache.php (added)
-
tags/1.6.5/lib/Google/Cache/Null.php (added)
-
tags/1.6.5/lib/Google/Client.php (added)
-
tags/1.6.5/lib/Google/Collection.php (added)
-
tags/1.6.5/lib/Google/Config.php (added)
-
tags/1.6.5/lib/Google/Exception.php (added)
-
tags/1.6.5/lib/Google/Http (added)
-
tags/1.6.5/lib/Google/Http/Batch.php (added)
-
tags/1.6.5/lib/Google/Http/CacheParser.php (added)
-
tags/1.6.5/lib/Google/Http/MediaFileUpload.php (added)
-
tags/1.6.5/lib/Google/Http/REST.php (added)
-
tags/1.6.5/lib/Google/Http/Request.php (added)
-
tags/1.6.5/lib/Google/IO (added)
-
tags/1.6.5/lib/Google/IO/Abstract.php (added)
-
tags/1.6.5/lib/Google/IO/Curl.php (added)
-
tags/1.6.5/lib/Google/IO/Exception.php (added)
-
tags/1.6.5/lib/Google/IO/Stream.php (added)
-
tags/1.6.5/lib/Google/IO/cacerts.pem (added)
-
tags/1.6.5/lib/Google/Model.php (added)
-
tags/1.6.5/lib/Google/Service (added)
-
tags/1.6.5/lib/Google/Service.php (added)
-
tags/1.6.5/lib/Google/Service/Analytics.php (added)
-
tags/1.6.5/lib/Google/Service/Exception.php (added)
-
tags/1.6.5/lib/Google/Service/Resource.php (added)
-
tags/1.6.5/lib/Google/Signer (added)
-
tags/1.6.5/lib/Google/Signer/Abstract.php (added)
-
tags/1.6.5/lib/Google/Signer/P12.php (added)
-
tags/1.6.5/lib/Google/Utils (added)
-
tags/1.6.5/lib/Google/Utils.php (added)
-
tags/1.6.5/lib/Google/Utils/URITemplate.php (added)
-
tags/1.6.5/lib/Google/Verifier (added)
-
tags/1.6.5/lib/Google/Verifier/Abstract.php (added)
-
tags/1.6.5/lib/Google/Verifier/Pem.php (added)
-
tags/1.6.5/lib/Handlebars (added)
-
tags/1.6.5/lib/Handlebars/Autoloader.php (added)
-
tags/1.6.5/lib/Handlebars/Cache (added)
-
tags/1.6.5/lib/Handlebars/Cache.php (added)
-
tags/1.6.5/lib/Handlebars/Cache/APC.php (added)
-
tags/1.6.5/lib/Handlebars/Cache/Disk.php (added)
-
tags/1.6.5/lib/Handlebars/Cache/Dummy.php (added)
-
tags/1.6.5/lib/Handlebars/Context.php (added)
-
tags/1.6.5/lib/Handlebars/Engine.php (added)
-
tags/1.6.5/lib/Handlebars/Helpers.php (added)
-
tags/1.6.5/lib/Handlebars/Loader (added)
-
tags/1.6.5/lib/Handlebars/Loader.php (added)
-
tags/1.6.5/lib/Handlebars/Loader/FilesystemLoader.php (added)
-
tags/1.6.5/lib/Handlebars/Loader/StringLoader.php (added)
-
tags/1.6.5/lib/Handlebars/Parser.php (added)
-
tags/1.6.5/lib/Handlebars/String.php (added)
-
tags/1.6.5/lib/Handlebars/Template.php (added)
-
tags/1.6.5/lib/Handlebars/Tokenizer.php (added)
-
tags/1.6.5/lib/class-wp-list-table.php (added)
-
tags/1.6.5/lib/wp-settings-framework.php (added)
-
tags/1.6.5/readme.txt (added)
-
tags/1.6.5/settings (added)
-
tags/1.6.5/settings/smt-gapi.php (added)
-
tags/1.6.5/settings/smt-general.php (added)
-
tags/1.6.5/smt-dashboard-debug.php (added)
-
tags/1.6.5/smt-dashboard.php (added)
-
tags/1.6.5/smt-export.php (added)
-
tags/1.6.5/social-metrics-tracker.php (added)
-
tags/1.6.5/templates (added)
-
tags/1.6.5/templates/settings-connections.handlebars (added)
-
tags/1.6.5/templates/settings-nav.handlebars (added)
-
tags/1.6.5/templates/settings-test.handlebars (added)
-
tags/1.6.5/templates/settings-urls.handlebars (added)
-
tags/1.6.5/templates/stat-details.handlebars (added)
-
tags/1.6.5/uninstall.php (added)
-
trunk/MetricsUpdater.class.php (modified) (1 diff)
-
trunk/SocialMetricsSettings.class.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/settings/smt-general.php (modified) (4 diffs)
-
trunk/social-metrics-tracker.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
social-metrics-tracker/trunk/MetricsUpdater.class.php
r1335247 r1344759 190 190 if ((count($types) > 0) && !is_singular($types)) return false; // Allow singular view of enabled post types 191 191 192 // If TTL has elapsed 193 if ($this->isPostReadyForNextUpdate($post_id)) { 194 195 // Schedule an update 196 wp_schedule_single_event( $this->getLocalTime(), 'social_metrics_update_single_post', array( $post_id ) ); 197 192 // Block if TTL has not elapsed 193 if ( !$this->isPostReadyForNextUpdate($post_id) ) { 194 return false; 195 } 196 197 // Block if restricted by date range 198 if ( !$this->isPostWithinAllowedRange($post) ) { 199 return false; 200 } 201 202 // Schedule the update! 203 switch($this->smt->get_smt_option('update_mode')) { 204 205 case 'pageload' : 206 add_action('wp_footer', array($this, 'updateCurrentPostNow'), 100); 207 break; 208 209 case 'cron' : 210 // use default for case 'cron' 211 default : 212 213 // Schedule an update for cron 214 wp_schedule_single_event( $this->getLocalTime(), 'social_metrics_update_single_post', array( $post_id ) ); 215 216 break; 198 217 } 199 218 200 219 return true; 201 220 } // end checkThisPost() 221 222 public function updateCurrentPostNow() { 223 global $post; 224 wp_reset_postdata(); 225 $this->updatePostStats($post->ID); 226 } 227 228 229 /** 230 * Checks if the post was published with the date range for auto-updates 231 * 232 * @param $post 233 * @return bool 234 */ 235 private function isPostWithinAllowedRange($post) { 236 237 // See what date range we want to allow auto-updates for 238 $range = $this->smt->get_smt_option('update_range'); 239 240 if ($range == 'none') { 241 return false; 242 } 243 244 if ($range == 'all') { 245 return true; 246 } 247 248 $cutoff = current_time('timestamp') - ( $range * DAY_IN_SECONDS ); 249 250 if (strtotime($post->post_date) > $cutoff) { 251 return true; 252 } else { 253 return false; 254 } 255 256 } 202 257 203 258 -
social-metrics-tracker/trunk/SocialMetricsSettings.class.php
r1335247 r1344759 26 26 27 27 if (isset($_REQUEST['page']) && in_array($_REQUEST['page'], $pages)) { 28 $this->section = (isset($_REQUEST['section'])) ? $_REQUEST['section'] : 'general'; 29 $this->wpsf = new WordPressSettingsFramework( plugin_dir_path( __FILE__ ) .'settings/smt-'.$this->section.'.php', 'smt' ); 28 add_action( 'init', array($this, 'setup') ); 30 29 } 31 30 32 31 // $this->smt->use_network_settings = get_site_option('smt_use_network_settings_everywhere'); 33 32 33 } 34 35 function setup() { 36 $this->section = (isset($_REQUEST['section'])) ? $_REQUEST['section'] : 'general'; 37 $this->wpsf = new WordPressSettingsFramework( plugin_dir_path( __FILE__ ) .'settings/smt-'.$this->section.'.php', 'smt' ); 34 38 } 35 39 … … 223 227 function process_general_form() { 224 228 if (!isset($_POST) || count($_POST) == 0) return; 229 if (!isset($_POST['smt_settings'])) return; 225 230 $this->smt->merge_smt_options($_POST['smt_settings']); 226 231 } … … 428 433 $posts_array = get_posts( $args ); 429 434 430 return $posts_array[0]->ID; 435 if ($posts_array) 436 return $posts_array[0]->ID; 431 437 432 438 } -
social-metrics-tracker/trunk/readme.txt
r1335247 r1344759 5 5 Requires at least: 3.5 6 6 Tested up to: 4.4.1 7 Stable tag: 1.6. 47 Stable tag: 1.6.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 108 108 109 109 == Changelog == 110 111 = 1.6.5 = 112 * Added option to run updates in the page footer instead of the cron 113 * Added option to set an update range to disable updating of older posts 114 * Change wording of some options to make them easier to understand 115 * Fixed some PHP errors with WP Multisite 110 116 111 117 = 1.6.4 = … … 244 250 == Upgrade Notice == 245 251 252 = 1.6.5 = 253 Added options to help control how and when updates occur 254 246 255 = 1.6.4 = 247 256 Minor bug fixes -
social-metrics-tracker/trunk/settings/smt-general.php
r1202486 r1344759 34 34 ), 35 35 array( 36 'id' => 'update_mode', 37 'title' => 'Update Mode', 38 'desc' => 'By default, the plugin will connect to social network APIs during the WP Cron (as a background task). This will keep your posts loading fast! If for some reason this is a problem, you can change the it to perform updates during regular page loads instead.', 39 'type' => 'select', 40 'std' => 'all', 41 'choices' => array( 42 'cron' => 'WP Cron (Default - Runs in the background)', 43 'pageload' => 'Page Footer (Can make posts load more slowly)', 44 ), 45 ), 46 array( 47 'id' => 'update_range', 48 'title' => 'Update Range', 49 'desc' => 'What posts should be automatically kept in sync? You can use this to limit the number of updates that run in case your site has a lot of older posts. It is recommended to track all posts unless you have too many.', 50 'type' => 'select', 51 'std' => 'all', 52 'choices' => array( 53 'all' => 'All posts', 54 'none' => 'No posts (Disables automatic updates)', 55 '7' => 'Only posts published within 1 week', 56 '14' => 'Only posts published within 2 weeks', 57 '30' => 'Only posts published within 1 month', 58 '60' => 'Only posts published within 2 months', 59 '90' => 'Only posts published within 3 months', 60 '180' => 'Only posts published within 6 months', 61 '365' => 'Only posts published within 1 year', 62 '730' => 'Only posts published within 2 years', 63 '1460' => 'Only posts published within 4 years', 64 ) 65 ), 66 array( 67 'id' => 'ttl_hours', 68 'title' => 'Data TTL', 69 'desc' => 'Length of time to wait in between checking for new stats on each post. A shorter time will use more server resources. Longer times are recommended for sites with over 500 posts.', 70 'type' => 'select', 71 'std' => '12', 72 'choices' => array( 73 '1' => '1 Hour', 74 '2' => '2 Hours', 75 '4' => '4 Hours', 76 '6' => '6 Hours', 77 '8' => '8 Hours', 78 '12' => '12 Hours', 79 '24' => '24 Hours', 80 '36' => '36 Hours', 81 '48' => '2 Days', 82 '72' => '3 Days', 83 '168' => '1 Week', 84 '720' => '1 Month', 85 ) 86 ), 87 array( 36 88 'id' => 'report_visibility', 37 89 'title' => 'Report Visibility', … … 49 101 ), 50 102 array( 51 'id' => 'ttl_hours',52 'title' => 'Data TTL',53 'desc' => 'Length of time to store the statistics locally before downloading new data. A lower value will use more server resources. High values are recommended for blogs with over 500 posts.',54 'type' => 'select',55 'std' => '12',56 'choices' => array(57 '1' => '1 Hour',58 '2' => '2 Hours',59 '4' => '4 Hours',60 '6' => '6 Hours',61 '8' => '8 Hours',62 '12' => '12 Hours',63 '24' => '24 Hours',64 '36' => '36 Hours',65 '48' => '2 Days',66 '72' => '3 Days',67 '168' => '1 Week',68 )69 ),70 array(71 103 'id' => 'default_sort_column', 72 'title' => ' Default Sort Order',104 'title' => 'Report Sort Order', 73 105 'desc' => 'Which column should be sorted by default?', 74 106 'type' => 'select', … … 83 115 array( 84 116 'id' => 'default_date_range_months', 85 'title' => ' Default Date Range',117 'title' => 'Report Date Range', 86 118 'desc' => 'Reports should display posts published within this date range.', 87 119 'type' => 'select', … … 97 129 array( 98 130 'id' => 'default_posts_per_page', 99 'title' => ' Default Posts per Page',131 'title' => 'Report Posts per Page', 100 132 'desc' => 'Number of posts per page to display in reports', 101 133 'type' => 'select', -
social-metrics-tracker/trunk/social-metrics-tracker.php
r1339736 r1344759 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.6. 46 Version: 1.6.5 7 7 Author: Ben Cole 8 8 Author URI: http://www.bencole.net … … 39 39 class SocialMetricsTracker { 40 40 41 public $version = '1.6. 4'; // for db upgrade comparison41 public $version = '1.6.5'; // for db upgrade comparison 42 42 public $updater; 43 43 public $options; … … 54 54 if (is_admin()) { 55 55 add_action('admin_menu', array($this,'adminMenuSetup')); 56 add_action('network_admin_menu', array($this,'networkAdminMenuSetup'));57 56 add_action('admin_enqueue_scripts', array($this, 'adminHeaderScripts')); 58 57 add_action('plugins_loaded', array($this, 'version_check'));
Note: See TracChangeset
for help on using the changeset viewer.