public static function register() { // Compatibility information -> describe which shortcode should be used to insert FEN diagrams, // which one to insert PGN games, etc... $compatibility = RPBChessboardHelperLoader::loadTrait('Compatibility'); $fenShortcode = $compatibility->getFENShortcode(); $pgnShortcode = $compatibility->getPGNShortcode(); self::$noTexturizeShortcodes = array($fenShortcode, $pgnShortcode); self::$lowLevelShortcodes = array($pgnShortcode); // Register the shortcodes add_shortcode($fenShortcode, array(__CLASS__, 'callbackShortcodeFEN')); add_shortcode($pgnShortcode, array(__CLASS__, 'callbackShortcodePGN')); add_shortcode('pgndiagram', array(__CLASS__, 'callbackShortcodePGNDiagram')); // Register the no-texturize shortcodes add_filter('no_texturize_shortcodes', array(__CLASS__, 'registerNoTexturizeShortcodes')); // A high-priority filter is required to prevent the WP engine to perform some nasty operations // (e.g. wptexturize, wpautop, etc...) on the text enclosed by the shortcodes. // // The priority level 8 what is used by the WP engine to process the special [embed] shortcode. // As the same type of low-level operation is performed here, using this priority level seems to be a good choice. // However, having "official" guidelines or core methods to achieve this would be desirable. // add_filter('the_content', array(__CLASS__, 'preprocessLowLevelShortcodes'), 8); add_filter('comment_text', array(__CLASS__, 'preprocessLowLevelShortcodes'), 8); }