/** * Register the plugin shortcodes * * Stores the shortcode list in an array and then loops through, adding the shortcode to WP for use. * In the event the user has enabled compatibility mode, we have to remove the prefix so it doesn't * foul up the callback function. * * @since 0.9 * @version 2.0.0 * * @link Codex reference: add_shortcode() * @link PHP reference: substr() * @link PHP reference: str_replace() * * @uses get_arconix_shortcode_list() Defined in this file * @uses get_compatibility_prefix() Defined in this file * */ function acs_register_shortcodes() { $shortcodes = get_arconix_shortcode_list(); foreach ((array) $shortcodes as $shortcode) { // If compatibility mode is enabled, remove the prefix for the function call, otherwise the function call is the shortcode name $len = strlen(get_compatibility_prefix()); $shortcode_func = substr($shortcode, $len); add_shortcode($shortcode, str_replace('-', '_', $shortcode_func) . '_arconix_shortcode'); } }
/** * Callback to display the meta box content * * @uses get_arconix_shortcode_list() Defined in /includes/shortcodes.php * * @see ACS_ADMIN_IMAGES_URL Defined in this file * * @since 1.1.0 */ function shortcodes_box() { $shortcodes = get_arconix_shortcode_list(); if (!$shortcodes or !is_array($shortcodes)) { return; } $return = '<p><a href="http://arcnx.co/aswiki"><img src="' . ACS_ADMIN_IMAGES_URL . 'page-16x16.png">Documentation</a></p><ul>'; foreach ((array) $shortcodes as $shortcode) { $return .= '<li>[' . $shortcode . ']</li>'; } $return .= '</ul>'; echo $return; }