Admin Page Framework Documentation

Packages

  • AdminPageFramework
    • Common
      • Factory
      • Form
        • FieldType
      • Utility
    • Factory
      • AdminPage
      • MetaBox
      • NetworkAdmin
      • PageMetaBox
      • PostType
      • TaxonomyField
      • TermMeta
      • UserMeta
      • Widget
    • Utility

Classes

  • AdminPageFramework_ClassTester
  • AdminPageFramework_PluginBootstrap
  • AdminPageFramework_PointerToolTip
  • AdminPageFramework_Requirement
  • AdminPageFramework_TableOfContents
  • AdminPageFramework_WPReadmeParser
  • AdminPageFramework_WPUtility_Time
  • AdminPageFramework_Zip

Resources

  • Tutorials
  • Support
  • Reporting Issues

Class AdminPageFramework_WPReadmeParser

Parses WordPress readme files and generates HTML outputs.

This helps when creating a help page with some readme file contents.

Usage

Set a file path or a text content of WordPress formatted readme and instantiate the class. Then perform the get() method by passing a section name. If a section name is omitted, the entire contents will be returned.

Example

$_sText   = '...';
$_oParser = new AdminPageFramework_WPReadmeParser;
$_oParser->setText( $_sText );
$_sText   = $_oParser->get();
$_sFilePath  = dirname( __FILE__ ) . '/aa/bbb/readme.txt';
$_oParser    = new AdminPageFramework_WPReadmeParser( $_sFilePath );
$_sFAQ       = $_oParser->get( 'Frequently asked questions' ); // passing the section name
Package: AdminPageFramework\Utility
Copyright: Copyright (c) 2013-2022, Michael Uno
Author: Michael Uno
Since: 3.5.0
Uses: AdminPageFramework_Parsedown
Located at utility/readme_parser/AdminPageFramework_WPReadmeParser.php

Methods summary

public
# __construct( string $sFilePathOrContent = '', array $aReplacements = array(), array $aCallbacks = array() )

Sets up properties.

If you don't have a file path but a text string, then omit the first parameter and use the setText() method.

Parameters

$sFilePathOrContent
string
$sFilePathOrContent The WordPress readme text file path or the text string.
$aReplacements
array
$aReplacements An array holding replacements. array( '%PLUGIN_DIR_URL%' => plugin_directory_path, '%WP_ADMIN_URL%' => admin_url() )
$aCallbacks
array
$aCallbacks Callbacks. The supported items are the followings: array( 'code_block' => ..., )

Since

3.5.0
3.6.0 Made it accept string content to be passed to the first parameter.
public
# setText( mixed $sText )

Sets the text to parse.

Since

3.5.0
public string
# get( mixed $sSectionName = '' )

Returns the parsed text.

Returns

string

Since

3.5.0

Magic methods summary

Related

If you find undocumented functionality, please report it here.

Admin Page Framework