Changeset 731070
- Timestamp:
- 06/24/2013 07:10:18 PM (13 years ago)
- Location:
- github-gist-files-shortcode/trunk
- Files:
-
- 2 edited
-
gist-file-shortcode.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
github-gist-files-shortcode/trunk/gist-file-shortcode.php
r730938 r731070 4 4 Plugin URI: http://www.ajtroxell.com/github-gist-files-shortcode-plugin 5 5 Description: Easily insert specific GitHub Gist files with this shortcode [gist id="xxxxxx" file="name"] 6 Version: 1. 06 Version: 1.1 7 7 Author: AJ Troxell 8 8 Author URI: http://www.ajtroxell.com/ … … 24 24 * Released under the GPLv2 or later. 25 25 */ 26 27 /** 28 * PressTrends Plugin API 29 */ 30 function presstrends_GitHubGistFilesShortcode_plugin() { 31 32 // PressTrends Account API Key 33 $api_key = '1uv0ak16ziqw785pmqxn0eykq5pmhic3kvqv'; 34 $auth = 'm2nqqjvut0yjapaxwwpqb35z9yf60pf33'; 35 36 // Start of Metrics 37 global $wpdb; 38 $data = get_transient( 'presstrends_cache_data' ); 39 if ( !$data || $data == '' ) { 40 $api_base = 'http://api.presstrends.io/index.php/api/pluginsites/update/auth/'; 41 $url = $api_base . $auth . '/api/' . $api_key . '/'; 42 43 $count_posts = wp_count_posts(); 44 $count_pages = wp_count_posts( 'page' ); 45 $comments_count = wp_count_comments(); 46 47 // wp_get_theme was introduced in 3.4, for compatibility with older versions, let's do a workaround for now. 48 if ( function_exists( 'wp_get_theme' ) ) { 49 $theme_data = wp_get_theme(); 50 $theme_name = urlencode( $theme_data->Name ); 51 } else { 52 $theme_data = get_theme_data( get_stylesheet_directory() . '/style.css' ); 53 $theme_name = $theme_data['Name']; 54 } 55 56 $plugin_name = '&'; 57 foreach ( get_plugins() as $plugin_info ) { 58 $plugin_name .= $plugin_info['Name'] . '&'; 59 } 60 // CHANGE __FILE__ PATH IF LOCATED OUTSIDE MAIN PLUGIN FILE 61 $plugin_data = get_plugin_data( __FILE__ ); 62 $posts_with_comments = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='post' AND comment_count > 0" ); 63 $data = array( 64 'url' => stripslashes( str_replace( array( 'http://', '/', ':' ), '', site_url() ) ), 65 'posts' => $count_posts->publish, 66 'pages' => $count_pages->publish, 67 'comments' => $comments_count->total_comments, 68 'approved' => $comments_count->approved, 69 'spam' => $comments_count->spam, 70 'pingbacks' => $wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_type = 'pingback'" ), 71 'post_conversion' => ( $count_posts->publish > 0 && $posts_with_comments > 0 ) ? number_format( ( $posts_with_comments / $count_posts->publish ) * 100, 0, '.', '' ) : 0, 72 'theme_version' => $plugin_data['Version'], 73 'theme_name' => $theme_name, 74 'site_name' => str_replace( ' ', '', get_bloginfo( 'name' ) ), 75 'plugins' => count( get_option( 'active_plugins' ) ), 76 'plugin' => urlencode( $plugin_name ), 77 'wpversion' => get_bloginfo( 'version' ), 78 ); 79 80 foreach ( $data as $k => $v ) { 81 $url .= $k . '/' . $v . '/'; 82 } 83 wp_remote_get( $url ); 84 set_transient( 'presstrends_cache_data', $data, 60 * 60 * 24 ); 85 } 86 } 87 88 // PressTrends WordPress Action 89 add_action('admin_init', 'presstrends_GitHubGistFilesShortcode_plugin'); 26 90 27 91 // Main Function -
github-gist-files-shortcode/trunk/readme.txt
r730953 r731070 5 5 Requires at least: 3.0.1 6 6 Tested up to: 3.5.2 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 24 24 1. Unzip github-gist-files-shortcode.zip and upload github-gist-files-shortcode folder to wp-content/plugins. 25 25 2. On Wordpress admin panel, activate plugin. 26 27 == Changelog == 28 29 = 1.1 = 30 * Added PressTrends plugin usage tracking to provide statistics which will increase potential for better functionality and stability in future major releases.
Note: See TracChangeset
for help on using the changeset viewer.