AdminPageFrameworkLoader_Registry::getPluginURL(), '%WP_ADMIN_URL%' => admin_url(), ), array( // callbacks 'content_before_parsing' => array( $this, '_replyToProcessShortcodes' ), ) ); $_sContent = ''; foreach( ( array ) $asSections as $_sSection ) { $_sContent .= $_oWPReadmeParser->getSection( $_sSection ); } if ( $sTOCTitle ) { $_oTOC = new AdminPageFramework_TableOfContents( $_sContent, 4, $sTOCTitle ); return $_oTOC->get(); } return '' . $_sContent; } /** * @return string * @return 3.6.1 */ public function _replyToProcessShortcodes( $sContent ) { // Register the 'embed' shortcode. add_shortcode( 'embed', array( $this, '_replyToProcessShortcode_embed' ) ); return do_shortcode( $sContent ); } /** * @since 3.6.1 * @return string The generate HTML output. */ public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode='' ) { $sURL = isset( $aAttributes[ 'src' ] ) ? $aAttributes[ 'src' ] : $sURL; $_sHTML = wp_oembed_get( $sURL ); // If there was a result, return it if ( $_sHTML ) { // This filter is documented in wp-includes/class-wp-embed.php return "
" . apply_filters( 'embed_oembed_html', $_sHTML, $sURL, $aAttributes, 0 ) . "
"; } // If not found, return the link. $_oWPEmbed = new WP_Embed; return "
" . $_oWPEmbed->maybe_make_link( $sURL ) . "
"; } /** * Returns HTML contents divided by heading. * * For example, *

First Heading

* Some text. *

Second Heading

* Another text. * * Will be * array( * array( 'First Heading' => 'Some text', ), * array( 'Second Heading' => 'Another text', ), * ) */ public function getContentsByHeader( $sContents, $iHeaderNumber=2 ) { $_aContents = array(); $_aSplitContents = preg_split( // '/^[\s]*==[\s]*(.+?)[\s]*==/m', '/(]*>.*?<\/h[' . $iHeaderNumber . ']>)/i', $sContents, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY ); foreach( $_aSplitContents as $_iIndex => $_sSplitContent ) { if ( ! preg_match( '/]*>(.*?)<\/h[' . $iHeaderNumber . ']>/i', $_sSplitContent , $_aMatches ) ) { continue; } if ( ! isset( $_aMatches[ 1 ] ) ) { continue; } if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { $_aContents[] = array( $_aMatches[ 1 ], $_aSplitContents[ $_iIndex + 1 ] ); } } return empty( $_aContents ) ? array( array( '', $sContents ) ) : $_aContents; } }