/**
  * Get (and instantiate, if necessary) the instance of the class
  * @static
  * @return BuggyPress_NewIssuePage
  */
 public static function get_instance()
 {
     if (!is_a(self::$instance, __CLASS__)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Exemplo n.º 2
0
 /**
  * Get the URL for a dynamic menu item
  *
  * @param string $item_slug
  * @return string
  */
 private function get_menu_item_url($item_slug)
 {
     switch ($item_slug) {
         case 'project':
             return get_post_type_archive_link('project');
         case 'newissue':
             $project = '';
             if (!is_admin()) {
                 global $wp_query;
                 if (is_singular('issue')) {
                     $issue = new BuggyPress_Issue(get_queried_object_id());
                     $project_id = $issue->get_project_id();
                     $project_post = get_post($project_id);
                     $project = $project_post->post_name;
                 } elseif ($project_query_var = get_query_var('project')) {
                     $project = $project_query_var;
                 }
             }
             return home_url(BuggyPress_NewIssuePage::get_path($project));
     }
     return '';
 }