Plugin Directory

Changeset 496513


Ignore:
Timestamp:
01/28/2012 03:28:26 PM (14 years ago)
Author:
SpeakFeel
Message:

update to tabs properties.

Location:
joemobi/branches/pages
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • joemobi/branches/pages

    • Property svn:ignore
      •  

        old new  
        11joemobi.esproj
         2img
         3Project.espressostorage
         4user.jsambells.espressostorage
  • joemobi/branches/pages/singletons/api.php

    r491146 r496513  
    107107  }
    108108 
     109  function get_available_tabs() {
     110 
     111      // Define Available tabs
     112      $tabs = array();
     113     
     114      $obj = new StdClass();
     115      $obj->ID = "latest_posts";
     116      $obj->post_title = "Latest";
     117      $obj->JoeMobiType = "Feed";
     118      $obj->JoeMobiTypeTabID = "latest_posts";
     119      $obj->post_content = "This is a list of the later posts from all categories and tags. Generally this would be the same as the blog page on your site.";
     120      $tabs[] = $obj;
     121     
     122      $obj = new StdClass();
     123      $obj->ID = "categories";
     124      $obj->post_title = "Categories";
     125      $obj->JoeMobiType = "List";
     126      $obj->JoeMobiTypeTabID = "categories";
     127      $obj->post_content = "A list of all the categories used on your site.";
     128      $tabs[] = $obj;
     129     
     130        $obj = new StdClass();
     131        $obj->ID = "tags";
     132        $obj->post_title = "Tags";
     133        $obj->JoeMobiType = "List";
     134        $obj->JoeMobiTypeTabID = "tags";
     135        $obj->post_content = "A list of all the tags used on your site.";
     136        $tabs[] = $obj;
     137       
     138        $obj = new StdClass();
     139        $obj->ID = "pages";
     140        $obj->post_title = "Pages";
     141        $obj->JoeMobiType = "List";
     142        $obj->JoeMobiTypeTabID = "pages";
     143        $obj->post_content = "A list of all the tags used on your site.";
     144        $tabs[] = $obj;
     145
     146        $obj = new StdClass();
     147        $obj->ID = "search";
     148        $obj->post_title = "Search";
     149        $obj->JoeMobiType = "Search";
     150        $obj->JoeMobiTypeTabID = "search";
     151        $obj->post_content = "A list of all the tags used on your site.";
     152        $tabs[] = $obj;
     153     
     154      $pages = get_pages();
     155      while(list($k,$v) = each($pages)) {
     156        $pages[$k]->JoeMobiType = 'Page';
     157        $pages[$k]->JoeMobiTypeTabID = "page-" . $v->ID;
     158      }
     159       
     160      return array_merge( $tabs, get_pages());
     161     
     162  }
     163 
    109164  function admin_options() {
    110165
     
    118173       
    119174       
    120         // Define Available tabs
    121         $tabs = array();
    122        
    123                 $obj = new StdClass();
    124                 $obj->ID = "latest_posts";
    125                 $obj->post_title = "Latest";
    126                 $obj->JoeMobiType = "Feed";
    127                 $obj->JoeMobiTypeTabID = "latest_posts";
    128                 $obj->post_content = "This is a list of the later posts from all categories and tags. Generally this would be the same as the blog page on your site.";
    129                 $tabs[] = $obj;
    130                
    131                 $obj = new StdClass();
    132                 $obj->ID = "categories";
    133                 $obj->post_title = "Categories";
    134                 $obj->JoeMobiType = "List";
    135                 $obj->JoeMobiTypeTabID = "categories";
    136                 $obj->post_content = "A list of all the categories used on your site.";
    137                 $tabs[] = $obj;
    138                
    139                 $obj = new StdClass();
    140                 $obj->ID = "tags";
    141                 $obj->post_title = "Tags";
    142                 $obj->JoeMobiType = "List";
    143                 $obj->JoeMobiTypeTabID = "tags";
    144                 $obj->post_content = "A list of all the tags used on your site.";
    145                 $tabs[] = $obj;
    146        
    147         $pages = get_pages();
    148         while(list($k,$v) = each($pages)) {
    149             $pages[$k]->JoeMobiType = 'Page';
    150             $pages[$k]->JoeMobiTypeTabID = "page-" . $v->ID;
    151         }
    152            
    153         $available_tabs = array_merge( $tabs, get_pages());
     175        $available_tabs = $this->get_available_tabs();
     176       
    154177        $available_tabs_keys = array();
    155178        while(list($k,$v) = each($available_tabs)) {
     
    160183        //
    161184       
    162         $active_tabs = explode(',', get_option('joemobi_api_tabs', 'latest,categories,tags'));
     185        $active_tabs = explode(',', get_option('joemobi_api_tabs', 'latest,categories,tags,search'));
    163186        if (count($active_tabs) == 1 && empty($active_tabs[0])) {
    164187          $active_tabs = array();
     
    460483 
    461484    function get_tabs() {
    462         $tabs = explode(',',get_option('joemobi_api_tabs', 'latest,categories,posts'));
     485        $available_tabs = $this->get_available_tabs();
     486        //var_dump($available_tabs); die();
     487       
     488        $tabs = explode(',',get_option('joemobi_api_tabs', 'latest,categories,posts,search'));
    463489        while(list($k,$v) = each($tabs)) {
    464490            list($slug,$id) = explode('-',$v);
     491       
     492            // Find title
     493            $title = 'Tab';
     494            foreach($available_tabs as $at) {
     495                if ($at->JoeMobiTypeTabID == $v) {
     496                    $title = $at->post_title;
     497                    break;             
     498                }
     499            }   
     500           
    465501            $tabs[$k] = array(
    466502                'type' => $slug,
    467503                'callback' => 'get_' . $slug,
    468504                'id' => (int)$id,
    469                
     505                'title' => $title,
     506                'position' => $k,
     507                'icon' => 'default',
    470508            );
    471509        }
Note: See TracChangeset for help on using the changeset viewer.