sh = $sh; add_action("simple_history/enqueue_admin_scripts", array($this, "enqueue_admin_scripts")); add_action("simple_history/history_page/after_gui", array($this, "output_sidebar_html")); // add_action("simple_history/dropin/sidebar/sidebar_html", array($this, "example_output")); add_action("simple_history/dropin/sidebar/sidebar_html", array($this, "default_sidebar_contents")); } public function default_sidebar_contents() { // Boxes that will appear randomly // Box about GitHub $headline = _x("Simple History is on GitHub", 'Sidebar box', 'simple-history'); $body = sprintf( _x('You can star, fork, or report issues with this plugin over at the GitHub page.', 'Sidebar box', 'simple-history'), 'https://github.com/bonny/WordPress-Simple-History' ); $boxGithub = '

'.$headline.'

'.$body.'

'; // Box about donation $headline = _x('Donate to support development', 'Sidebar box', 'simple-history'); $body = sprintf( _x('If you like and use Simple History you should donate to keep this plugin free.', 'Sidebar box', 'simple-history'), 'http://eskapism.se/sida/donate/' ); $boxDonate = '

'.$headline.'

'.$body.'

'; // Box about review $headline = _x('Review this plugin if you like it', 'Sidebar box', 'simple-history'); $body1 = sprintf( _x('If you like Simple History then please give it a nice review over at wordpress.org.', 'Sidebar box', 'simple-history'), 'https://wordpress.org/support/view/plugin-reviews/simple-history' ); $body2 = _x('A good review will help new users find this plugin. And it will make the plugin author very happy :)', 'Sidebar box', 'simple-history'); $boxReview = '

'.$headline.'

'.$body1.'

'.$body2.'

'; // Box about tweeting and blogging /* $boxSocial = '

Blog or tweet

Yeah, how about that yo.

'; */ // Box about possible events missing $boxMissingEvents = sprintf( '

%1$s

%2$s

hello@simple-history.com

', _x("Add more to the log", "Sidebar box", "simple-history"), // 1 _x("Are there things you miss in the history log?", "Sidebar box", "simple-history") // 2 ); // Box about support $boxSupport = sprintf( '

%1$s

%2$s

', _x("Support", "Sidebar box", "simple-history"), // 1 sprintf( _x('Visit the support forum if you need help or have questions.', "Sidebar box", "simple-history"), 'https://wordpress.org/support/plugin/simple-history' ) // 2 ); $arrBoxes = array( "boxReview" => $boxReview, "boxSupport" => $boxSupport, // "boxMissingEvents" => $boxMissingEvents, "boxDonate" => $boxDonate, // "boxGithub" => $boxGithub, ); /** * Filter the default boxes to output in the sidebar * * @since 2.0.17 * * @param array $arrBoxes array with boxes to output. Check the key to determine which box is which. */ $arrBoxes = apply_filters("simple_history/SidebarDropin/default_sidebar_boxes", $arrBoxes); //echo $arrBoxes[array_rand($arrBoxes)]; echo implode("", $arrBoxes); // show all // Box to encourage people translate plugin $current_locale = get_locale(); /** WordPress Translation Install API. This file exists only since 4.0. */ $translation_install_file = ABSPATH . 'wp-admin/includes/translation-install.php'; // Show only the translation box if current language is not an english language if ( in_array( $current_locale, array("en_US", "en_GB", "en_CA", "en_NZ", "en_AU") ) != $current_locale && file_exists( $translation_install_file ) ) { require_once $translation_install_file; $translations = wp_get_available_translations(); // This text does not need translation since is's only shown in English $boxTranslationTmpl = '

Translate Simple History to %1$s

It looks like Simple History is not yet translated to your language.

If you\'re interested in translating it please check out the localization part of the Plugin Handbook for info on how to translate plugins.

When you\'re done with your translation email it to me at par.thernstrom@gmail.com or add a pull request.

'; if (isset($translations[$current_locale])) { // Check if an existing text string returns something else, and that current lang is not en $teststring_translated = __("Just now", "simple-history"); $teststring_untranslated = "Just now"; if ($teststring_untranslated == $teststring_translated) { // strings are the same, so plugin probably not translated printf($boxTranslationTmpl, $translations[$current_locale]["english_name"]); } } } // if not en_US + translation install file exists } public function example_output() { ?>

Example title

Example content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Inquit, dasne adolescenti veniam? Non laboro, inquit, de nomine. In quibus doctissimi illi veteres inesse quiddam caeleste et divinum putaverunt. Duo Reges: constructio interrete. Indicant pueri, in quibus ut in speculis natura cernitur. Quod ea non occurrentia fingunt, vincunt Aristonem; Quod quidem iam fit etiam in Academia. Aliter enim nosmet ipsos nosse non possumus.

*

Title

*
*

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Inquit, dasne adolescenti veniam? Non laboro, inquit, de nomine. In quibus doctissimi illi veteres inesse quiddam caeleste et divinum putaverunt. Duo Reges: constructio interrete. Indicant pueri, in quibus ut in speculis natura cernitur. Quod ea non occurrentia fingunt, vincunt Aristonem; Quod quidem iam fit etiam in Academia. Aliter enim nosmet ipsos nosse non possumus.

*
* * */ public function output_sidebar_html() { ?>