$method(); } else { return new WP_error( 'template_error', printf( '

Template Error

Template %s does not exists in %s', $type, get_class( $this ) ) ); } } /** * * Return an array with all available templates from the template-class */ public function get_available_templates(){ // get all methods from the abstract class (__CLASS__) and the extended class ($this) $self_methods = get_class_methods( __CLASS__ ); $extended_methods = get_class_methods( $this ); // remove the '_template' extension and return the array with template-names $templates = array(); foreach( array_diff( $extended_methods, $self_methods ) as $template ) array_push( $templates, str_replace( '_template', '', $template ) ); return $templates; } } /** * * Concrete class WP Simple HTML Templates defines the templates * @author Ralf Albert * */ class WP_Simple_HTML_Templates extends WP_Simple_Templates { /** * Returns an array with list templates */ public function list_template(){ return array( 'ol' => array( 'outer' => "
    \n%inner%
\n", 'inner' => "
  • %item%
  • \n" ), 'ul' => array( 'outer' => "\n", 'inner' => "
  • %item%
  • \n" ), 'div' => array( 'outer' => "
    \n%inner%
    \n", 'inner' => "

    %item%

    \n" ), ); } /** * Returns a headline template with h1-tags */ public function hone_template(){ return '

    %headline%

    '; } /** * Returns a paragraph-template with p-tags */ public function paragraph_template(){ return '

    %text%

    '; } }