getInstance() static public method

Adds shortcodes based on $self->generics.
static public getInstance ( )
コード例 #1
0
ファイル: hooks.php プロジェクト: cumi/pressbooks
add_filter('init', '\\PressBooks\\Redirect\\rewrite_rules_for_catalog', 1);
add_filter('init', '\\PressBooks\\Redirect\\rewrite_rules_for_api', 1);
add_filter('login_redirect', '\\PressBooks\\Redirect\\login', 10, 3);
// -------------------------------------------------------------------------------------------------------------------
// Sitemap
// -------------------------------------------------------------------------------------------------------------------
add_filter('init', '\\PressBooks\\Redirect\\rewrite_rules_for_sitemap', 1);
add_action('do_robotstxt', '\\PressBooks\\Utility\\add_sitemap_to_robots_txt');
// -------------------------------------------------------------------------------------------------------------------
// Shortcodes
// -------------------------------------------------------------------------------------------------------------------
remove_filter('the_content', 'wpautop');
add_filter('the_content', 'wpautop', 12);
// execute wpautop after shortcode processing
$_ = \PressBooks\Shortcodes\Footnotes\Footnotes::getInstance();
$_ = \PressBooks\Shortcodes\Generics\Generics::getInstance();
$_ = \PressBooks\Shortcodes\WikiPublisher\Glyphs::getInstance();
// -------------------------------------------------------------------------------------------------------------------
// Upgrade Book Metadata
// -------------------------------------------------------------------------------------------------------------------
if (\PressBooks\Book::isBook()) {
    add_action('init', function () {
        $meta_version = get_option('pressbooks_metadata_version', 0);
        if ($meta_version < \PressBooks\Metadata::$currentVersion) {
            $metadata = new \PressBooks\Metadata();
            $metadata->upgrade($meta_version);
            update_option('pressbooks_metadata_version', \PressBooks\Metadata::$currentVersion);
        }
    }, 1000);
}
// -------------------------------------------------------------------------------------------------------------------
コード例 #2
0
 /**
  * @covers \Pressbooks\Shortcodes\Generics\Generics::getInstance()
  */
 public function test_getInstance()
 {
     $val = $this->generics->getInstance();
     $this->assertTrue($val instanceof \Pressbooks\Shortcodes\Generics\Generics);
 }