X-Git-Url: https://git.danix.xyz/?p=danixland-wporg-stats.git;a=blobdiff_plain;f=danixland-wporg-stats.php;h=f904dff18719feb37d899770b15876515c62deb6;hp=e22aeb13aa85b42e9d3dd2e64cdb2035d9be7e4d;hb=HEAD;hpb=557c38177150d5aa0378fba6faf1588f2c8c7856 diff --git a/danixland-wporg-stats.php b/danixland-wporg-stats.php index e22aeb1..f904dff 100644 --- a/danixland-wporg-stats.php +++ b/danixland-wporg-stats.php @@ -5,7 +5,7 @@ Plugin URI: https://danix.xyz/?p=3745 Description: A simple plugin that shows useful stats about your plugins hosted on WordPress.org Version: 0.1 Author: Danilo 'danix' Macri -Author URI: https://danix.xyz +Author URI: https://danix.xyz/author/danix Text Domain: dnxwporg This program is distributed in the hope that it will be useful, @@ -18,7 +18,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * Add plugin i18n domain: dnxwporg * @since 0.1 */ -load_plugin_textdomain('dnxwporg', plugins_url() . '/danixland-wporg-stats/i18n/', 'danixland-wporg-stats/i18n/'); +load_plugin_textdomain('dnxwporg', false, basename( dirname( __FILE__ ) ) . '/i18n'); /** * Function that installs our widget options @@ -324,4 +324,122 @@ class dnx_WPOrg extends WP_Widget { } } +// Add Shortcode +function dnxwporg_stats_shortcode() { + + $author = sanitize_user(get_option('dnxwporg_author'), true); + $description = get_option('dnxwporg_description'); + $desc_content = get_option('dnxwporg_desc_content'); + $linkto = get_option('dnxwporg_linkto'); + $use_icons = get_option('dnxwporg_use_icons'); + + /* we recover the data from the option if it is set, otherwhise we call the retrieve function directly */ + $option_stats = get_option('dnxwporg_plugins_stats'); + $plugins = ( false === $option_stats ? dnxwporg_get_plugins_stats() : $option_stats ); + + ob_start(); ?> + +
%s plugin with %s total downloads and an average rating of ', '%s contributed %s plugins with %s total downloads and an average rating of ', $plugins['total_plugins'], 'dnxwporg' ), $author, $plugins['total_plugins'], $plugins['total_downloads'], $plugins['average_rating'] ); ?>
+ + + ++ + +
+