The shortcode currently outputs at the top of the page or post rather than in the place that it is called. Shortcode functions should return a string with the HTML that should be placed in the page rather than outputting immediately. This should either be corrected by constructing a string variable or by using an output buffer as with the patched function example given here:
/* print_glossary_list ()
*
* create a table, load with acronym output, and return html code
*/
function print_glossary_list() {
$domain = Acronym_Manager::get_textdomain();
// Sort the acronyms appropriately
$acronyms = get_option('acronym_acronyms');
uksort($acronyms, "strnatcasecmp");
// Start the output buffer
ob_start();
// Output the acronyms table
?> <table border="0"> <?php
foreach ($acronyms as $acronym => $fulltext) {
?> <tr><td><strong> <?php
echo $acronym;
?> </strong></td><td> <?php
echo $fulltext;
?> </td></tr> <?php
}
?> </table> <?php
// Return the contents of the output buffer
return ob_get_clean();
}
Output buffering might not be the best way to do this as it can have problems, but for me was quick and easy to get the plugin working the way it should.
]]>Most of these are probably fairly easy to work through but here’s a list of warnings WP/PHP through after installing this on WP 4.3.1
PHP Strict Standards: Non-static method Acronym_Manager::theme_html5_check() should not be called statically in /path/to/plugins/acronym-manager/acronym-manager.php on line 85
PHP Warning: file_get_contents(/path/to/themes/odfw-ocs-sage/header.php): failed to open stream: No such file or directory in /path/to/app/plugins/acronym-manager/php/acronym-manager-class.php on line 320
PHP Notice: The called constructor method for WP_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /path/to/wordpress/wp-includes/functions.php on line 3457
PHP Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method Acronym_Manager::add_pages() should not be called statically in /path/to/wordpress/wp-includes/plugin.php on line 503
PHP Strict Standards: Non-static method Acronym_Manager::get_textdomain() should not be called statically in /path/to/plugins/acronym-manager/php/acronym-manager-class.php on line 20
PHP Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method Acronym_Manager::management_handler() should not be called statically in /path/to/wordpress/wp-includes/plugin.php on line 503
PHP Strict Standards: Non-static method Acronym_Manager::get_textdomain() should not be called statically in /path/to/plugins/acronym-manager/php/acronym-manager-class.php on line 33
PHP Notice: load_plugin_textdomain was called with an argument that is <strong>deprecated</strong> since version 2.7 with no alternative available. in /path/to/wordpress/wp-includes/functions.php on line 3572
PHP Strict Standards: Non-static method Acronym_Manager::get_parent_url() should not be called statically in /path/to/plugins/acronym-manager/php/acronym-manager-class.php on line 37
PHP Notice: Undefined index: page in /path/to/plugins/acronym-manager/php/acronym-manager-class.php on line 607
PHP Warning: substr() expects parameter 2 to be long, string given in /path/to/plugins/acronym-manager/php/acronym-manager-class.php on line 39
]]>
I’ve tried installing this plugin on WordPress 4.3, and while there aren’t any errors, I can’t delete the predefined definition, nor add new definitions. No error messages, just no actions are executed.
]]>When I activate the plugin I get this PHP warning:
Warning: substr() expects parameter 2 to be long, string given in /html/wp-content/plugins/acronym-manager/php/acronym-manager-class.php on line 39
]]>