'https://www.heypublisher.com', 'home' => 'https://wordpress.org/plugins/', 'support' => 'https://wordpress.org/support/', 'contact' => 'mailto:wordpress@heypublisher.com', 'more' => 'https://profiles.wordpress.org/heypublisher#content-plugins' ); var $slug = ''; // should be defined in constructor of any class that extends this class. public function __construct() { } public function __destruct() { } // Style the header of the content box in a consistent way public function box_header($id, $title) { $handle = ''; if ($title) { $handle = <<{$title} EOF; } $text = << {$handle}
EOF; return $text; } /** * Style the header of the content box in a consistent way */ public function box_footer() { $text = <<
EOF; return $text; } /** * Style the side-bar link appropriately */ public function sidebar_link($key,$link,$text) { $text = sprintf('%s',$link,$key,__($text,$this->i18n)); return $text; } // TODO: move styles to included stylesheet public function standard_sidenav_info_block($id,$title,$additional='') { $html = ''; if ($id && $title) { $html .= <<box_header($id,$title)}
  • {$this->sidebar_link('admin-home',$this->plugin['home'],'Plugin Homepage')}
  • {$this->sidebar_link('testimonial',$this->plugin['support'],'Support')}
  • {$this->sidebar_link('email',$this->plugin['contact'],'Contact Us')}
  • {$this->sidebar_link('search',$this->plugin['more'],'More Plugins by Us')}
{$additional} {$this->box_footer()} EOF; } return $html; } // Page wrapper protected function page($title, $subtitle, callable $content, $args=null) { $body = $content($args); // this way side-nav var can be set echo $this->page_header($title); echo $this->two_column_header(); echo $this->two_column_right_block(); echo $this->two_column_left_block($subtitle,$body); echo $this->two_column_footer(); echo $this->page_footer(); } protected function form_action() { $action = sprintf('admin.php?page=%s',$this->slug); return $action; } // display sidenav in consistent way public function sidenav_block() { $url = plugins_url($this->slug); $header =<<< EOF EOF; return $this->standard_sidenav_info_block('about',$header,$this->additional_side_nav); } // Consistent wrapper for classes that extend Page protected function page_header($title) { $html = <<

{$title}

EOF; return $html; } protected function page_footer() { $html = ""; return $html; } protected function two_column_header() { $html = '
'; return $html; } protected function two_column_footer() { $html = '
'; return $html; } protected function two_column_right_block() { $html = <<
{$this->sidenav_block()}
EOF; return $html; } protected function two_column_left_block($title,$content) { $id = sprintf("%s-left",$this->slug); $html = <<
{$this->box_header($id,__($title,$this->i18n))} {$content} {$this->box_footer()}
EOF; return $html; } } ?>