WordPress.org

Plugin Directory

Changeset 227602


Ignore:
Timestamp:
04/11/10 11:50:49 (8 years ago)
Author:
lonewolfonline
Message:
 
Location:
folding-category-widget/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • folding-category-widget/trunk/focal_wp28.php

    r191109 r227602  
    77  var $wdCache = 'widget_focalCache_';    // Append widget instance no to end 
    88  var $pageCatCF = 'category'; 
    9   var $cacheVersion = '1.0.0';            // This does not change unless cache format changes 
     9  var $cacheVersion = '1.1.0';            // This does not change unless cache format changes 
    1010  var $defaultOptions; 
    1111  var $widgetOptions; 
     
    2222  function FoldingCategoryList()  
    2323  { 
    24         $widget_ops = array('classname' => 'widget_focal', 'description' => 'Enhanced Folding Category List for Wordpress 2.8+' ); 
     24        $widget_ops = array('classname' => 'widget_focal', 'description' => __('Enhanced Folding Category List for Wordpress 2.8+', 'focal') ); 
    2525        $this->WP_Widget('focal', 'FoCaL', $widget_ops); 
    26          
    27     // Process any submit forms if logged in as admin                                           
    28     if (is_admin()) 
    29     { 
    30       // Has any options been updated? 
    31       $this->ProcessPostSubmit(); 
    32       $this->GetOptions($number); 
    33        
    34       /* setup actions to rebuild the cache */ 
    35       if ($this->defaultOptions['AutoBuildCache'] === true) 
    36       { 
    37         /* only admin can do these so only subscribe to the event if is_admin */ 
    38         add_action('publish_post', array(&$this, 'RebuildCache')); 
    39         add_action('edit_post', array(&$this, 'RebuildCache')); 
    40         add_action('delete_post', array(&$this, 'RebuildCache')); 
    41         add_action('create_taxonomy', array(&$this, 'RebuildCache')); 
    42         add_action('edit_taxonomy', array(&$this, 'RebuildCache')); 
    43         add_action('delete_taxonomy', array(&$this, 'RebuildCache')); 
    44       } 
    45  
    46       /* put the focal menu item on the settings menu */      
    47       add_action('admin_menu', array(&$this, 'widget_FocalAdminMenu')); 
    48     } 
     26              
     27    /* setup actions to rebuild the cache */ 
     28    if ($this->defaultOptions['AutoBuildCache'] === true) 
     29    { 
     30      add_action('publish_post', array(&$this, 'RebuildCache')); 
     31      add_action('edit_post', array(&$this, 'RebuildCache')); 
     32      add_action('delete_post', array(&$this, 'RebuildCache')); 
     33      add_action('create_taxonomy', array(&$this, 'RebuildCache')); 
     34      add_action('edit_taxonomy', array(&$this, 'RebuildCache')); 
     35      add_action('delete_taxonomy', array(&$this, 'RebuildCache')); 
     36    } 
     37 
     38    /* put the focal menu item on the settings menu */      
     39    add_action('admin_menu', array(&$this, 'widget_FocalAdminMenu')); 
    4940  } 
    5041  
     
    5546 
    5647    $title = $instance['title']; 
    57     $number = $instance['number']; 
    58     $this->GetOptions($number); 
     48    $setting_number = $instance['number']; 
     49    $this->GetOptions($setting_number); 
    5950     
    6051    echo $before_widget; 
     
    6354      echo $before_title . $title . $after_title;  
    6455 
    65     echo $this->DrawTheTree($number); 
     56    echo $this->DrawTheTree(); 
    6657    echo $after_widget; 
    6758    } 
     
    7263        $instance = $old_instance; 
    7364        $instance['title'] = strip_tags($new_instance['title']); 
    74         $number = strip_tags($new_instance['number']); 
    75         $number = preg_replace('/[^a-zA-Z0-9\s]/', '', $number); 
    76     $number = str_replace(" ", "", $number); 
    77     $instance['number'] = $number; 
     65        $setting_number = strip_tags($new_instance['number']); 
     66        $setting_number = preg_replace('/[^a-zA-Z0-9\s]/', '', $setting_number); 
     67    $setting_number = str_replace(" ", "", $setting_number); 
     68    $instance['number'] = $setting_number; 
    7869  
    7970        return $instance; 
     
    8374  function form($instance)  
    8475  { 
    85         $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'number' => 1 ) ); 
     76        $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'number' => 'default' ) ); 
    8677        $title = strip_tags($instance['title']); 
    87         $number = strip_tags($instance['number']); 
     78        $setting_number = strip_tags($instance['number']); 
    8879?> 
    89             <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p> 
    90             <p><label for="<?php echo $this->get_field_id('number'); ?>">Setting ID: <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo attribute_escape($number); ?>" /></label></p> 
     80            <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'focal'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p> 
     81            <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Setting ID:', 'focal'); ?> <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo esc_attr($setting_number); ?>" /></label></p> 
    9182<?php 
    9283    } 
    9384     
    9485     
     86/************** Shared Code Start ***************/ 
    9587 
    9688  /****** Options ******/ 
    9789  /* These following methods will perform actions on the options - Get, Set, Update, Defaults */ 
     90   
    9891  function GetOptions($instanceNo) 
    9992  { 
     
    10194     
    10295    $optionsFromTable = get_option($this->dbOptions); 
    103     if (($optionsFromTable != false) && (is_null($optionsFromTable['version']))) 
     96     
     97    $ver = ''; 
     98    if (!empty($optionsFromTable['version'])) 
     99      $ver = $optionsFromTable['version']; 
     100     
     101    if (($optionsFromTable != false) && ($ver != '')) 
    104102      $this->defaultOptions = array_merge((array)$this->defaultOptions,(array)$optionsFromTable); 
    105103 
     
    154152    $widget['NoFollowAllLinks'] = false; 
    155153    $widget['NoFollowParents'] = false; 
    156       
     154    $widget['IncOrEx'] = 'ex'; 
     155    $widget['MultiLingual'] = false; 
     156     
    157157    return $widget; 
    158158  } 
     
    174174  { 
    175175    $option = $this->wdOptions.$instanceNo; 
    176  
    177176    if (get_option($option))  
    178177    { 
     
    181180    else  
    182181    { 
    183       $deprecated=' '; 
    184       $autoload='no'; 
    185       add_option($option, $this->widgetOptions, $deprecated, $autoload); 
     182      add_option($option, $this->widgetOptions, ' ', 'no'); 
    186183    }   
    187184  }  
    188    
    189    
    190    
    191    
    192   /***** get cache ******/ 
    193     /* Cache */  
     185  function RemoveWidgetOptions($instanceNo) 
     186  { 
     187    $option = $this->wdOptions.$instanceNo; 
     188    delete_option($option);  
     189  }   
     190   
     191   
     192   
     193  /****** Options ******/ 
    194194  /* These functions deal with the main tree cache */ 
    195   function GetATree($number) 
    196   { 
    197     // We have the ability to store a different cache on a per widget basis 
    198     // but is it really necessary? This line forces use of 1 cache object. 
    199     $number = 1; 
     195 
     196  function TreeID() 
     197  { 
     198    return "1"; 
     199  } 
     200   
     201  function GetATree() 
     202  { 
     203    $tree_id = $this->TreeID(); 
    200204    if ($this->defaultOptions['UseCache'] == true) 
    201205    { 
    202       $option = $this->wdCache.$number; 
     206      $option = $this->wdCache.$tree_id; 
    203207      $cache = get_option($option); 
    204208   
     
    211215        else   
    212216        { 
    213           $themenu = $this->BuildTheTree($number); 
     217          $themenu = $this->BuildTheTree(); 
    214218        } 
    215219      }   
    216220      else 
    217221      { 
    218         $themenu = $this->BuildTheTree($number); 
     222        $themenu = $this->BuildTheTree(); 
    219223      } 
    220224    } 
    221225    else 
    222226    {    
    223       $themenu = $this->BuildTheTree($number); 
     227      $themenu = $this->BuildTheTree(); 
    224228    } 
    225229   
     
    227231  } 
    228232   
    229   function SaveATree($tree, $number) 
    230   { 
    231     // We have the ability to store a different cache on a per widget basis 
    232     // but is it really necessary? This line forces use of 1 cache object. 
    233     $number = 1; 
     233  function SaveATree($tree) 
     234  { 
     235    $tree_id = $this->TreeID(); 
    234236    if ($this->defaultOptions['UseCache'] == true) 
    235237    { 
    236238      $cache['cache'] = $tree;       
    237239      $cache['version'] = $this->cacheVersion; 
    238       $option = $this->wdCache.$number; 
     240      $option = $this->wdCache.$tree_id; 
    239241       
    240242      if (get_option($option))  
     
    250252    }   
    251253  } 
    252   function DeleteATree($number) 
    253   { 
    254     // We have the ability to store a different cache on a per widget basis 
    255     // but is it really necessary? This line forces use of 1 cache object. 
    256     $number = 1; 
    257     $option = $this->wdCache.$number; 
     254  function DeleteATree() 
     255  { 
     256    $tree_id = $this->TreeID(); 
     257    $option = $this->wdCache.$tree_id; 
    258258    delete_option($option); 
    259259  } 
    260260  
    261261   
    262   function BuildTheTree($number) 
     262  function BuildTheTree() 
    263263  {   
    264264    global $wpdb, $wp_query; 
     
    295295        $description = "";        
    296296       
    297       $result[] = $item['term_id'] . '#|#' . get_cat_name($item['term_id']) . '#|#' . $description . '#|#' . $item['parent'] . '#|#' . $counta . '#|#' . $countu . '#|#' . $item['slug'] . '#|#' . $haschildren;  
     297      $result[] = $item['term_id'] . '#|#' . get_cat_name($item['term_id']) . '#|#' . $description . '#|#' . $item['parent'] . '#|#' . $counta . '#|#' . $countu . '#|#' . $item['slug'] . '#|#' . get_category_link($item['term_id']) . '#|#' . $haschildren;  
    298298    }           
    299299     
    300     $this->SaveATree($result, $number); 
     300    $this->SaveATree($result); 
    301301    return $result;   
    302302  } 
    303303 
     304 
     305  /****** Build & Render ******/ 
     306 
    304307  /* Draw the actucal folding category list */ 
    305   function DrawTheTree($number) 
     308  function DrawTheTree() 
    306309  { 
    307310    $this->theTreeParantal = null; 
    308     $this->currentCategory = $this->GetCurrentCategory($number); 
     311    $this->currentCategory = $this->GetCurrentCategory(); 
    309312    $this->BuildParentalList(); 
    310     $this->GetATree($number); 
     313    $this->GetATree(); 
    311314 
    312315    if ($this->widgetOptions['RootCategory'] == -1) 
     
    358361    } 
    359362     
    360     return $this->OutputTheTree($number,$this->widgetOptions['RootCategory'],0); 
     363    $tree_id = $this->TreeID(); 
     364    return $this->OutputTheTree($tree_id,$this->widgetOptions['RootCategory'],0); 
    361365    $this->theTreeParantal = null; 
    362366  } 
    363367   
    364   function OutputTheTree($number, $parent, $level) 
     368  function OutputTheTree($tree_id, $parent, $level) 
    365369  { 
    366370    $haveDoneItems = false; 
    367371    if ($level == 0) 
    368372    { 
    369       $result = '<!-- Folding Category List (FoCaL) for Wordpress by Tim Trott --><ul class="FoldingCategoryList nodeLevel0" id="focalist_'.$number.'">'; 
     373      $result = '<!-- Folding Category List (FoCaL) for Wordpress by Tim Trott --><ul class="FoldingCategoryList nodeLevel0" id="focalist_'.$tree_id.'">'; 
    370374      $result .= $this->DoExtraLinks($this->widgetOptions['LinksBefore']); 
    371375    } 
     
    377381      foreach ($this->theTree as $element)  
    378382      { 
    379         list($term_id, $Ename, $Edescription, $catparent, $Etotalcount, $Euniquecount, $Eslug, $haschildren) = explode("#|#", $element); 
     383        list($term_id, $Ename, $Edescription, $catparent, $Etotalcount, $Euniquecount, $Eslug, $url, $haschildren) = explode("#|#", $element); 
    380384         
    381385        // Dont show item or children if excluded 
     
    383387          $this->widgetOptions['ExcludeCats'] = array(); 
    384388         
    385         if (!in_array($term_id, $this->widgetOptions['ExcludeCats'])) 
     389        $processThis = true; 
     390         
     391        if ($this->widgetOptions['IncOrEx'] == 'ex') 
     392        { 
     393          $processThis = !in_array($term_id, $this->widgetOptions['ExcludeCats']); 
     394        } 
     395        else 
     396        { 
     397          $processThis = in_array($term_id, $this->widgetOptions['ExcludeCats']); 
     398        } 
     399                 
     400         
     401        if ($processThis) 
    386402        { 
    387403          $itemClass = array(); 
     
    398414              $title = htmlspecialchars($Ename); 
    399415             
    400             $description = htmlspecialchars($Edescription); 
     416            if ($this->widgetOptions['MultiLingual']) 
     417            { 
     418              $description = strip_tags(category_description($term_id)); 
     419            } 
     420            else 
     421            { 
     422              $description = htmlspecialchars($Edescription); 
     423            } 
     424             
    401425            $slug = $Eslug; 
    402426             
     
    513537              else 
    514538              { 
    515                 $result .= '<a ' . $linkSelected . $rel . ' href="' . get_category_link($term_id) . '"' . $linktitle; 
     539                 
     540                if ($this->widgetOptions['MultiLingual']) 
     541                { 
     542                  $title = get_cat_name($term_id); 
     543                  $url = get_category_link($term_id); 
     544                } 
     545                 
     546                $result .= '<a ' . $linkSelected . $rel . ' href="' . $url . '"' . $linktitle; 
    516547                if ($this->widgetOptions['ApplyCSSTo'] == 'a') 
    517548                { 
     
    525556                } 
    526557                 
     558 
     559                    
    527560                $result .= '>' . $title . '</a>'; 
    528561              } 
     
    539572                 
    540573                if ((in_array($slug, $this->theTreeParantal)) || ($this->widgetOptions['ExpandAllCats'] == true))   
    541                   $result .= $this->OutputTheTree($number, $term_id, $level+1); 
     574                  $result .= $this->OutputTheTree($tree_id, $term_id, $level+1); 
    542575              } 
    543576 
     
    567600  function DoExtraLinks($links) 
    568601  { 
     602    $result = ''; 
    569603    if ($links != "") 
    570604    { 
     
    621655        $par = get_category_parents($cat,FALSE,'|',TRUE); 
    622656   
    623         if (!is_a($par,WP_Error)) 
     657        if (!is_a($par,'WP_Error')) 
    624658          $parentlist .= $par; 
    625659      } 
     
    628662  } 
    629663 
    630   function GetCurrentCategory($number) 
     664  function GetCurrentCategory() 
    631665  { 
    632666    global $wp_query,$post; 
     
    647681    else if (is_single()) 
    648682    { 
    649       $cats = get_the_category($post->ID); 
    650    
    651       // Only one, so this is easy... 
    652       // A post is always in a category, even if its uncategorized. 
    653       if (count($cats) == 1) 
    654       { 
    655         $curcat[0] = $cats[0]->term_id; 
     683      $postCat = get_post_meta($wp_query->post->ID, $this->pageCatCF, true); 
     684      if ($postCat) 
     685      { 
     686        $curcat[0] = $postCat; 
    656687        $found = true; 
    657688      } 
    658       else if ($this->widgetOptions['ExpandAllMember'] == true) 
    659       { 
    660         // Expand all categories, this is also easy... 
    661         foreach ($cats as $cat) 
     689       
     690      if (!found) 
     691      { 
     692        $cats = get_the_category($post->ID); 
     693     
     694        // Only one, so this is easy... 
     695        // A post is always in a category, even if its uncategorized. 
     696        if (count($cats) == 1) 
    662697        { 
    663           $curcat[] = $cat->term_id; 
     698          $curcat[0] = $cats[0]->term_id; 
    664699          $found = true; 
    665700        } 
    666       } 
    667       else 
    668       { 
    669         $priority = explode(",",$this->widgetOptions['HightlightPriority']); 
    670         if (count($priority) > 0) 
    671         {  
    672           // Use the priority list, selecting if we find a match. 
    673           foreach ($priority as $p) 
     701        else if ($this->widgetOptions['ExpandAllMember'] == true) 
     702        { 
     703          // Expand all categories, this is also easy... 
     704          foreach ($cats as $cat) 
    674705          { 
    675             if (!$found) 
    676             { 
    677               foreach ($cats as $cat) 
    678               { 
    679                 if (!$found) 
    680                 { 
    681                   if ($cat->term_id == $p) 
    682                   { 
    683                     $curcat[0] = $p; 
    684                     $found = true; 
    685                   } 
    686                   else 
    687                   { 
    688                     $parents = $this->GetCatParents($cat->term_id); 
    689                     if (in_array($p, $parents)) 
    690                     { 
    691                       $curcat[0] = $cat->term_id; 
    692                       $found = true; 
    693                     } 
    694                   } 
    695                 } 
    696               } 
    697             } 
     706            $curcat[] = $cat->term_id; 
     707            $found = true; 
    698708          } 
    699709        } 
    700710        else 
    701711        { 
    702           // not priority list 
    703           if ($this->widgetOptions['RootCategory'] > 0) 
    704           { 
    705             // Parent is not zero, so try and locate a category under parent 
    706             foreach ($cats as $cat) 
     712          $priority = explode(",",$this->widgetOptions['HightlightPriority']); 
     713          if (count($priority) > 0) 
     714          {  
     715            // Use the priority list, selecting if we find a match. 
     716            foreach ($priority as $p) 
    707717            { 
    708718              if (!$found) 
    709719              { 
    710                 if ($cat->term_id == $this->widgetOptions['RootCategory']) 
     720                foreach ($cats as $cat) 
    711721                { 
    712                   $curcat[0] = $cat->term_id;  
    713                   $found = true;               
    714                 } 
    715                 else 
    716                 { 
    717                   $parents = $this->GetCatParents($cat->term_id); 
    718                   if (in_array($this->widgetOptions['RootCategory'], $parents)) 
     722                  if (!$found) 
    719723                  { 
    720                     $curcat[0] = $cat->term_id;  
    721                     $found = true;               
     724                    if ($cat->term_id == $p) 
     725                    { 
     726                      $curcat[0] = $p; 
     727                      $found = true; 
     728                    } 
     729                    else 
     730                    { 
     731                      $parents = $this->GetCatParents($cat->term_id); 
     732                      if (in_array($p, $parents)) 
     733                      { 
     734                        $curcat[0] = $cat->term_id; 
     735                        $found = true; 
     736                      } 
     737                    } 
    722738                  } 
    723739                } 
     
    727743          else 
    728744          { 
    729             // Select lowest ID from Wordpress 
    730             $curcat[0] = $cats[0]->term_id;  
    731             $found = true; 
     745            // not priority list 
     746            if ($this->widgetOptions['RootCategory'] > 0) 
     747            { 
     748              // Parent is not zero, so try and locate a category under parent 
     749              foreach ($cats as $cat) 
     750              { 
     751                if (!$found) 
     752                { 
     753                  if ($cat->term_id == $this->widgetOptions['RootCategory']) 
     754                  { 
     755                    $curcat[0] = $cat->term_id;  
     756                    $found = true;               
     757                  } 
     758                  else 
     759                  { 
     760                    $parents = $this->GetCatParents($cat->term_id); 
     761                    if (in_array($this->widgetOptions['RootCategory'], $parents)) 
     762                    { 
     763                      $curcat[0] = $cat->term_id;  
     764                      $found = true;               
     765                    } 
     766                  } 
     767                } 
     768              } 
     769            } 
     770            else 
     771            { 
     772              // Select lowest ID from Wordpress 
     773              $curcat[0] = $cats[0]->term_id;  
     774              $found = true; 
     775            } 
    732776          } 
    733777        } 
     
    844888  } 
    845889 
    846   /****** confing *******/ 
     890  /****** Config ******/ 
    847891  /**** Process any options submitted to a form ****/ 
    848892  function ProcessPostSubmit() 
     
    862906    else if(!empty($_POST['focalSubmitOptions'])) 
    863907    { 
    864       $this->UpdateOptions(); 
    865     }   
     908       $this->UpdateOptions(); 
     909    }  
     910    else if(!empty($_POST['focalDeleteSetting'])) 
     911    { 
     912      $selectedWidget = $_POST['focalNumber']; 
     913      $this->RemoveWidgetOptions($selectedWidget);  
     914    }  
    866915  } 
    867916  function RebuildCache() 
    868917  { 
    869     $this->DeleteATree(1); 
    870     $this->BuildTheTree(1); 
     918    $this->DeleteATree(); 
     919    $this->BuildTheTree(); 
    871920    $this->hasAdminMessage = true; 
    872     $this->adminMessage = "Cache Rebuilt"; 
     921    $this->adminMessage = __('Cache Rebuilt', 'focal'); 
    873922  }  
    874923  function DeleteCache() 
    875924  { 
    876     $this->DeleteATree(1); 
     925    $this->DeleteATree(); 
    877926    $this->hasAdminMessage = true; 
    878     $this->adminMessage = "Cache Deleted"; 
     927    $this->adminMessage = __('Cache Deleted', 'focal'); 
    879928  } 
    880929  function Uninstall() 
    881930  { 
    882     $this->DeleteATree(1); 
     931    $this->DeleteATree(); 
    883932    delete_option($this->dbOptions); 
    884933    delete_option($this->wdOptions); 
    885934    $this->hasAdminMessage = true; 
    886     $this->adminMessage = "Plugin options deleted from database. You can now deactivate the plugin."; 
     935    $this->adminMessage = __('Plugin options deleted from database. You can now deactivate the plugin.', 'focal'); 
    887936  }   
    888937  function UpdateOptions() 
    889938  { 
    890     $selectedWidget =   $_POST['focal_selectedWidget']; 
     939    $selectedWidget = $_POST['focal_selectedWidget']; 
    891940     
    892941    if ($selectedWidget) 
     
    911960        if (isset($_POST['focal_widgetExcluded'])) 
    912961          $this->widgetOptions['ExcludeCats'] = explode(',', $_POST['focal_widgetExcluded']); 
     962        else  
     963          $this->widgetOptions['ExcludeCats'] = array(); 
    913964      } 
    914965       
     
    9621013        $this->widgetOptions['OrderByDirection'] = 'desc'; 
    9631014 
     1015      if ($_POST['focal_IncExCategories'] == 'ex') 
     1016        $this->widgetOptions['IncOrEx'] = 'ex'; 
     1017      else  
     1018        $this->widgetOptions['IncOrEx'] = 'inc'; 
     1019         
    9641020      $this->widgetOptions['UseDescriptionAsCategoryText'] = ($_POST['focal_UseDescriptionAsCategoryText'] == 'on'); 
    9651021      $this->widgetOptions['UseDescriptionAsCategoryTitle'] = ($_POST['focal_UseDescriptionAsCategoryTitle'] == 'on'); 
     
    9731029      $this->widgetOptions['NoFollowParents'] = ($_POST['focal_NoFollowParents'] == 'on'); 
    9741030      $this->widgetOptions['DontLinkCurrentCategory'] = ($_POST['focal_DontLinkCurrentCategory'] == 'on'); 
     1031 
     1032      $this->widgetOptions['MultiLingual'] = ($_POST['focal_MultiLingual'] == 'on'); 
    9751033        
    9761034      $this->widgetOptions['CountBefore'] = $_POST['focal_widegtCountBefore']; 
     
    9811039      $this->GetOptions($selectedWidget);                                        
    9821040      $this->hasAdminMessage = true; 
    983       $this->adminMessage = "Settings updated."; 
     1041      $this->adminMessage = __('Settings updated.', 'focal'); 
    9841042    } 
    9851043  }  
     
    9891047  function widget_FocalAdminPage()  
    9901048  { 
     1049    $this->ProcessPostSubmit(); 
     1050     
    9911051    global $wpdb; 
    992     $querystr = $wpdb->prepare('SELECT option_value FROM '.$wpdb->prefix.'options WHERE option_name = "widget_focal"'); 
     1052    $querystr = $wpdb->prepare('SELECT DISTINCT option_value FROM '.$wpdb->prefix.'options WHERE option_name = "widget_focal"'); 
    9931053    $result = $wpdb->get_results($querystr, ARRAY_A); 
    9941054    $widgets = unserialize($result[0]["option_value"]); 
    995     $options = ""; 
     1055    $options = ''; 
     1056    $selectedWidget = ''; 
    9961057     
    9971058    if(!empty($_POST['focalChangeWidget'])) 
    9981059    { 
    9991060      $selectedWidget = $_POST['focalNumber']; 
     1061    } 
     1062    else 
     1063    { 
     1064      $selectedWidget = $_POST['focal_selectedWidget']; 
    10001065    }   
    1001  
     1066     
     1067       
    10021068    if (count($widgets) > 0) 
    10031069    { 
    1004       foreach($widgets as $widget) 
    1005       { 
    1006         if ($widget["number"] != "") 
     1070      if (is_array($widgets)) 
     1071      { 
     1072        foreach($widgets as $widget) 
    10071073        { 
    1008            if ($selectedWidget == $widget["number"]) 
    1009            { 
    1010              $sel = "selected='selected'"; 
    1011            } 
    1012            else 
    1013            { 
    1014              $sel = '';  
    1015            } 
    1016             
    1017            if ($selectedWidget == "") 
    1018              $selectedWidget = $widget["number"]; 
    1019             
    1020            $options .= '                    <option value=' . $widget["number"] . ' ' . $sel . '>' . $widget["number"] . '</option>'; 
     1074          if ($widget["number"]) 
     1075          { 
     1076             if ($selectedWidget == $widget["number"]) 
     1077             { 
     1078               $sel = 'selected="selected"'; 
     1079             } 
     1080             else 
     1081             { 
     1082               $sel = '';  
     1083             } 
     1084             
     1085             $options .= '                      <option value="' . $widget["number"] . '" ' . $sel . '>' . $widget["number"] . '</option>'; 
     1086          } 
    10211087        } 
     1088      } 
     1089      else 
     1090      { 
     1091        $options .= '                   <option value="default">default</option>'; 
    10221092      } 
    10231093    } 
     
    10291099      <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> 
    10301100        <h2><?php _e('Folding Category List: Options', 'focal'); ?></h2> 
    1031         <p>The Folding Category List provides a fast and efficient replacement for the category list which which allows categories to be folded, or collapsed, allowing more room on your sidebar. These options allow you to customise each widget indipendantly.</p>  
     1101        <p><?php _e('The Folding Category List provides a fast and efficient replacement for the category list which which allows categories to be folded, or collapsed, allowing more room on your sidebar. These options allow you to customise each widget indipendantly.', 'focal'); ?></p>  
    10321102<?php if ($this->hasAdminMessage) { ?>         
    10331103        <div id="message" class="updated fade"><p><?php echo $this->adminMessage; ?></p></div> 
     
    10401110                <td> 
    10411111                    <input type="checkbox" id="focal_UseCache" name="focal_UseCache" <?php echo ($this->defaultOptions['UseCache']) ? "checked" : "" ;?>/><br /> 
    1042                     <span>This widget will build a category list from all the categories and store it in the database. All future requests use the cached version. Building the data can take upto 20 seconds, whereas retrieving the cached data only takes on average 0.025 seconds.</span><br/> 
     1112                    <span><?php _e('This widget will build a category list from all the categories and store it in the database. All future requests use the cached version. Building the data can take upto 20 seconds, whereas retrieving the cached data only takes on average 0.025 seconds.', 'focal'); ?></span><br/> 
    10431113                    <input type="submit" name="focalRebuildCache" value="<?php _e('Rebuild Cache', 'focal'); ?>" class="button"/> &nbsp; <input type="submit" name="focalDeleteCache" value="<?php _e('Delete Cache', 'focal'); ?>" class="button"/> &nbsp; <input type="submit" name="focalUninstall" value="<?php _e('Uninstall/Reset', 'focal'); ?>" class="button"/> 
    10441114                </td> 
     
    10481118                <td> 
    10491119                    <input type="checkbox" id="focal_AutoRebuildCache" name="focal_AutoRebuildCache" <?php echo ($this->defaultOptions['AutoBuildCache']) ? "checked" : "" ;?>/><br /> 
    1050                     <span>Rebuild the cache when posting, deleting or modifing posts. Can slow down posting, so you may wish to disable if posting multiple entries. Remember to rebuild cache when done.</span> 
     1120                    <span><?php _e('Rebuild the cache when posting, deleting or modifing posts. Can slow down posting, so you may wish to disable if posting multiple entries. Remember to rebuild cache when done.', 'focal'); ?></span> 
    10511121                </td> 
    10521122            </tr> 
     
    10551125                <td> 
    10561126                    <input type="checkbox" id="focal_UseDescriptions" name="focal_UseDescriptions" <?php echo ($this->defaultOptions['DontUseCategoryDescription']) ? "" : "checked" ;?>/><br /> 
    1057                     <span>By default category descriptions are used for the title attribute on links, but if you have long descriptions or hundreds of categories this can lead to a large database. If so, disable this option and category descriptions will be removed. Changing this value will cause the cache to be rebuilt, if it's enabled.</span> 
     1127                    <span><?php _e('By default category descriptions are used for the title attribute on links, but if you have long descriptions or hundreds of categories this can lead to a large database. If so, disable this option and category descriptions will be removed. Changing this value will cause the cache to be rebuilt, if it\'s enabled.'); ?></span> 
    10581128                </td> 
    10591129            </tr> 
     
    10681138        <table class="form-table"> 
    10691139            <tr> 
    1070                 <th scope="row" valign="top">Setting ID</th> 
     1140                <th scope="row" valign="top"><?php _e('Setting ID', 'focal'); ?></th> 
    10711141                <td> 
    10721142              <select id="focalNumber" name="focalNumber"> 
    10731143                <?php echo $options; ?> 
    1074                     </select> &nbsp; <input type="submit" name="focalChangeWidget" value="<?php _e('Set', 'focal'); ?>" class="button"/><br/> 
     1144                    </select> &nbsp; <input type="submit" name="focalChangeWidget" value="<?php _e('Load Setting Profile', 'focal'); ?>" class="button"/> 
     1145              &nbsp; <input type="submit" name="focalDeleteSetting" value="<?php _e('Delete Setting Profile', 'focal'); ?>" class="button"/><br/> 
    10751146                      <input type="hidden" name="focal_selectedWidget" value="<?php echo $selectedWidget; ?>"/> 
    1076                     <span>Which widget would you like to change? This ID relates to the Setting ID specified when adding a widget to a sidebar.</span>                   
     1147                    <span><?php _e('Which widget would you like to change? This ID relates to the Setting ID specified when adding a widget to a sidebar', 'focal'); ?>.</span>                  
    10771148                </td> 
    10781149            </tr> 
     
    10861157        $list = wp_dropdown_categories('hierarchical=1&echo=0&name=focal_widgetParent&selected=' . $this->widgetOptions['RootCategory']); 
    10871158        $pos = strpos($list, '<option'); 
    1088         $list = substr($list,0,$pos) . '<option value="showAll">show all categories</option><option value="showChild">show child categories only</option>' . substr($list,$pos); 
     1159        $list = substr($list,0,$pos) . '<option value="showAll">' . __('Show all categories', 'focal') . '</option><option value="showChild">' . __('Show child categories only', 'focal') . '</option>' . substr($list,$pos); 
    10891160      } 
    10901161      else if ($this->widgetOptions['RootCategory'] == 0) 
     
    10921163        $list = wp_dropdown_categories('hierarchical=1&echo=0&name=focal_widgetParent'); 
    10931164        $pos = strpos($list, '<option'); 
    1094         $list = substr($list,0,$pos) . '<option selected value="showAll">show all categories</option><option value="showChild">show child categories only</option>' . substr($list,$pos); 
     1165        $list = substr($list,0,$pos) . '<option selected value="showAll">' . __('Show all categories', 'focal') . '</option><option value="showChild">' . __('Show child categories only', 'focal') . '</option>' . substr($list,$pos); 
    10951166      } 
    10961167      else if ($this->widgetOptions['RootCategory'] == -1) 
     
    10981169        $list = wp_dropdown_categories('hierarchical=1&echo=0&name=focal_widgetParent'); 
    10991170        $pos = strpos($list, '<option'); 
    1100         $list = substr($list,0,$pos) . '<option value="showAll">show all categories</option><option selected value="showChild">show child categories only</option>' . substr($list,$pos); 
     1171        $list = substr($list,0,$pos) . '<option value="showAll">' . __('Show all categories', 'focal') . '</option><option selected value="showChild">' . __('Show child categories only', 'focal') . '</option>' . substr($list,$pos); 
    11011172      } 
    11021173       
    11031174      echo $list; 
    11041175?><br/> 
    1105                     <span>Select the root (parent) category to show, show all categories (default), or only show child categories of the current category.</span> 
     1176                    <span><?php _e('Select the root (parent) category to show, show all categories (default), or only show child categories of the current category.', 'focal'); ?></span> 
    11061177                </td> 
    11071178            </tr> 
    11081179            <tr> 
    1109                 <th scope="row" valign="top"><?php _e('Categories to Exclude', 'focal'); ?></th> 
     1180                <th scope="row" valign="top"><?php _e('Categories to Show', 'focal'); ?></th> 
    11101181                <td> 
     1182                <label><input type='radio' name='focal_IncExCategories' value='ex' <?php if ($this->widgetOptions['IncOrEx'] == 'ex') echo ' checked' ;?>> <span class="setting-description"><?php _e('The categories ticked below will be <strong>Excluded</strong> from FoCaL.', 'focal'); ?></span></label><br /> 
     1183                <label><input type='radio' name='focal_IncExCategories' value='inc'<?php if ($this->widgetOptions['IncOrEx'] == 'inc') echo ' checked' ;?>> <span class="setting-description"><?php _e('Only the categories ticked below will be <strong>Included</strong> in FoCaL.', 'focal'); ?></span></label><br /><br /> 
    11111184                <?php  
    11121185                  if ( function_exists('wp_category_checklist') ) 
    11131186                  { ?> 
    1114               <div id="categorydiv" style="height:170px; width:220px; overflow:auto; background-color:white;padding:8px;"><ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 
    1115  
     1187              <div id="categorydiv" style="height:170px; width:220px; overflow:auto; background-color:white;padding:8px;border:1px solid #dfdfdf;"><ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 
    11161188              <?php wp_category_checklist(0,0,$this->widgetOptions['ExcludeCats']); ?> 
    11171189              </ul></div> 
    1118               <span>The selected categories will not be shown on the Folding Category List, nor will any child categories of the selected. Uncategorized is excluded by default.</span> 
    1119                 
    11201190               <?php } 
    11211191                  else 
     
    11231193?> 
    11241194              <input type="text" name="focal_widgetExcluded" size="20" value="<?php echo implode(",",$this->widgetOptions['ExcludeCats']) ?>"/><br /> 
    1125                     <span>Comma seperated list for category ID to exclude from the list. Child categories will not be shown either.</span> 
     1195                    <span><?php _e('Comma seperated list for category ID to exclude from the list. Child categories will not be shown either.', 'focal'); ?></span> 
    11261196 
    11271197<?php                  }                
     
    11541224                      }?> 
    11551225              <select name="focal_widgetShowMethod" id="focal_widgetShowMethod" value="<?php echo $value;?>"> 
    1156                 <option value="normal" <?php echo $normal ?>>Normal</option> 
    1157                 <option value="members" <?php echo $member ?>>Expand All Members</option> 
    1158                 <option value="all" <?php echo $all ?>>Expand All</option> 
     1226                <option value="normal" <?php echo $normal ?>><?php _e('Normal', 'focal'); ?></option> 
     1227                <option value="members" <?php echo $member ?>><?php _e('Expand All Members', 'focal'); ?></option> 
     1228                <option value="all" <?php echo $all ?>><?php _e('Expand All', 'focal'); ?></option> 
    11591229              </select> 
    11601230              <br /> 
    1161                     <span>This option defines how the Folding Category List will expand. Setting this option to 'Normal' will only expand the the current category, or the category with the highest priority (see below). Setting to 'Expand All Members' will cause all categories that the current post is a member of to be selected/highlighted. Setting to 'Expand All' will show a fully expanded list with all categories shown.</span> 
     1231                    <span><?php _e('This option defines how the Folding Category List will expand. Setting this option to \'Normal\' will only expand the the current category, or the category with the highest priority (see below). Setting to \'Expand All Members\' will cause all categories that the current post is a member of to be selected/highlighted. Setting to \'Expand All\' will show a fully expanded list with all categories shown.', 'focal'); ?></span> 
    11621232                </td> 
    11631233            </tr> 
     
    11661236                <td> 
    11671237                    <input type="text" name="focal_widegtPriority" id="focal_widegtPriority" size="40" value="<?php echo $this->widgetOptions['HightlightPriority'] ?>"/><br /> 
    1168                     <span>This option is a comma seperated list of category ID's that is used to determine which category to highlight in the event that a post is assigned to multiple categories. If a post category is a member of, or a child of, a category in this list then it will be expanded. If a category is not on the priority list then Wordpress will select the lowest category id. Category ID's can be found on the Manage Categories screen. &quot;I know this is a little janky, it'll be better in future releases.&quot;</span> 
     1238                    <span><?php _e('This option is a comma seperated list of category ID\'s that is used to determine which category to highlight in the event that a post is assigned to multiple categories. If a post category is a member of, or a child of, a category in this list then it will be expanded. If a category is not on the priority list then Wordpress will select the lowest category id. Category ID\'s can be found on the Manage Categories screen. &quot;I know this is a little janky, it\'ll be better in future releases.&quot;', 'focal'); ?></span><br/> 
     1239                    <span><?php _e('You can override this list by adding a custom field to a post or page called &quot;catagory&quot; containing the numerical id of the category to expand.', 'focal'); ?></span> 
    11691240                </td> 
    11701241            </tr> 
     
    11851256                ?> 
    11861257                    <select name="focal_widgetSortBy" id="focal_widgetSortBy" value="<?php echo $value; ?>"> 
    1187                       <option<?php echo $name; ?> value="name">Category Name (default)</option> 
    1188                       <option<?php echo $id; ?> value="id">Category ID</option> 
    1189                       <option<?php echo $description; ?> value="description">Category Description</option> 
    1190                       <option<?php echo $slug; ?> value="slug">Category Slug</option> 
    1191                       <option<?php echo $postcount; ?> value="postcount">Category Post Count</option> 
    1192 <?php if (function_exists("mycategoryorder_init")) { ?>                       <option<?php echo $mycategoryorder; ?> value="mycategoryorder">My Category Order</option><?php } ?> 
     1258                      <option<?php echo $name; ?> value="name"><?php _e('Category Name (default)', 'focal'); ?></option> 
     1259                      <option<?php echo $id; ?> value="id"><?php _e('Category ID', 'focal'); ?></option> 
     1260                      <option<?php echo $description; ?> value="description"><?php _e('Category Description', 'focal'); ?></option> 
     1261                      <option<?php echo $slug; ?> value="slug"><?php _e('Category Slug', 'focal'); ?></option> 
     1262                      <option<?php echo $postcount; ?> value="postcount"><?php _e('Category Post Count', 'focal'); ?></option> 
     1263<?php if (function_exists("mycategoryorder_init")) { ?>                       <option<?php echo $mycategoryorder; ?> value="mycategoryorder"><?php _e('My Category Order', 'focal'); ?></option><?php } ?> 
    11931264              </select> &nbsp; <select name="focal_widgetSortBySeq" id="focal_widgetSortBySeq" value="<?php echo $valuea; ?>"> 
    1194                 <option<?php echo $asc; ?> value="asc">Ascending (default)</option> 
    1195                 <option<?php echo $desc; ?> value="desc">Descending</option> 
     1265                <option<?php echo $asc; ?> value="asc"><?php _e('Ascending (default)', 'focal'); ?></option> 
     1266                <option<?php echo $desc; ?> value="desc"><?php _e('Descending', 'focal'); ?></option> 
    11961267              </select><br/>                 
    1197                     <span>How should the list be sorted? <?php if (function_exists("mycategoryorder_init")) { ?><em>nb: if selecting My Category Order you must manually rebuild the cache after changing the order.</em><?php } ?></span> 
     1268                    <span><?php _e('How should the list be sorted?', 'focal'); ?> <?php if (function_exists("mycategoryorder_init")) { ?><em><?php _e('nb: if selecting My Category Order you must manually rebuild the cache after changing the order.', 'focal'); ?></em><?php } ?></span> 
    11981269                </td> 
    11991270            </tr> 
     
    12011272                <th scope="row" valign="top"><?php _e('Post Count', 'focal'); ?></th> 
    12021273                <td> 
    1203                     <input type="checkbox" id="focal_ShowPostCount" name="focal_ShowPostCount" <?php echo ($this->widgetOptions['ShowPostCount']) ? "checked" : "" ;?>/><label for="focal_ShowPostCount">Show post count</label><br /> 
    1204                     <input type="checkbox" id="focal_ShowPostCountUnique" name="focal_ShowPostCountUnique" <?php echo ($this->widgetOptions['ShowPostCountUnique']) ? "checked" : "" ;?>/><label for="focal_ShowPostCountUnique">Show unique posts only</label><br /> 
    1205                     <span>Shows the number of posts contained within a category. Unique posts counts removes duplicates, for example if a post is a member of two child categories of the one being counted.</span> 
     1274                    <input type="checkbox" id="focal_ShowPostCount" name="focal_ShowPostCount" <?php echo ($this->widgetOptions['ShowPostCount']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_ShowPostCount"><?php _e('Show post count', 'focal'); ?></label><br /> 
     1275                    <input type="checkbox" id="focal_ShowPostCountUnique" name="focal_ShowPostCountUnique" <?php echo ($this->widgetOptions['ShowPostCountUnique']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_ShowPostCountUnique"><?php _e('Show unique posts only', 'focal'); ?></label><br /> 
     1276                    <span><?php _e('Shows the number of posts contained within a category. Unique posts counts removes duplicates, for example if a post is a member of two child categories of the one being counted.', 'focal'); ?></span> 
    12061277                    <br/> 
    1207                     <label for="focal_widegtCountBefore">Before post count: </label><input type="text" name="focal_widegtCountBefore" id="focal_widegtCountBefore" size="20" value="<?php echo $this->widgetOptions['CountBefore'] ?>"/><br/> 
    1208                     <label for="focal_widegtCountAfter">After post count: </label><input type="text" name="focal_widegtCountAfter" id="focal_widegtAfterBefore" size="20" value="<?php echo $this->widgetOptions['CountAfter'] ?>"/><br/> 
    1209                     <span>Text to show before and after the post count. By default this is a pair of parenthesis, but you can use angle brackets, arrows, or any html.</span> 
     1278                    <label for="focal_widegtCountBefore"><?php _e('Before post count:', 'focal'); ?> </label><input type="text" name="focal_widegtCountBefore" id="focal_widegtCountBefore" size="20" value="<?php echo $this->widgetOptions['CountBefore'] ?>"/><br/> 
     1279                    <label for="focal_widegtCountAfter"><?php _e('After post count:', 'focal'); ?> </label><input type="text" name="focal_widegtCountAfter" id="focal_widegtAfterBefore" size="20" value="<?php echo $this->widgetOptions['CountAfter'] ?>"/><br/> 
     1280                    <span><?php _e('Text to show before and after the post count. By default this is a pair of parenthesis, but you can use angle brackets, arrows, or any html.', 'focal'); ?></span> 
    12101281                </td> 
    12111282            </tr> 
     
    12131284                <th scope="row" valign="top"><?php _e('SEO', 'focal'); ?></th> 
    12141285                <td> 
    1215                     <input type="checkbox" id="focal_UseDescriptionAsCategoryText" name="focal_UseDescriptionAsCategoryText" <?php echo ($this->widgetOptions['UseDescriptionAsCategoryText']) ? "checked" : "" ;?>/><label for="focal_UseDescriptionAsCategoryText">Use category description as the link text.</label><br /> 
    1216                     <input type="checkbox" id="focal_UseDescriptionAsCategoryTitle" name="focal_UseDescriptionAsCategoryTitle" <?php echo ($this->widgetOptions['UseDescriptionAsCategoryTitle']) ? "checked" : "" ;?>/><label for="focal_UseDescriptionAsCategoryTitle">Use category description as the popup (title) text.</label><br /> 
    1217                     <span>How should the category description be used? Note: you must have the description enabled on the global settings for these to take effect.</span><br /><br /> 
    1218                     <input type="checkbox" id="focal_DontLinkCurrentCategory" name="focal_DontLinkCurrentCategory" <?php echo ($this->widgetOptions['DontLinkCurrentCategory']) ? "checked" : "" ;?>/><label for="focal_DontLinkCurrentCategory">Don't add link for current (selected) category</label><br /> 
    1219                     <input type="checkbox" id="focal_NoFollowAllLinks" name="focal_NoFollowAllLinks" <?php echo ($this->widgetOptions['NoFollowAllLinks']) ? "checked" : "" ;?>/><label for="focal_NoFollowAllLinks">Add rel="nofollow" to all links</label><br/> 
    1220                     <input type="checkbox" id="focal_NoFollowParents" name="focal_NoFollowParents" <?php echo ($this->widgetOptions['NoFollowParents']) ? "checked" : "" ;?>/><label for="focal_NoFollowParents">Add rel="nofollow" to all links NOT below current category (allow follow on child category)</label><br/> 
     1286                    <input type="checkbox" id="focal_UseDescriptionAsCategoryText" name="focal_UseDescriptionAsCategoryText" <?php echo ($this->widgetOptions['UseDescriptionAsCategoryText']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_UseDescriptionAsCategoryText"><?php _e('Use category description as the link text.', 'focal'); ?></label><br /> 
     1287                    <input type="checkbox" id="focal_UseDescriptionAsCategoryTitle" name="focal_UseDescriptionAsCategoryTitle" <?php echo ($this->widgetOptions['UseDescriptionAsCategoryTitle']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_UseDescriptionAsCategoryTitle"><?php _e('Use category description as the popup (title) text.', 'focal'); ?></label><br /> 
     1288                    <span><?php _e('How should the category description be used? Note: you must have the description enabled on the global settings for these to take effect.', 'focal'); ?></span><br /><br /> 
     1289                    <input type="checkbox" id="focal_DontLinkCurrentCategory" name="focal_DontLinkCurrentCategory" <?php echo ($this->widgetOptions['DontLinkCurrentCategory']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_DontLinkCurrentCategory"><?php _e('Don\'t add link for current (selected) category', 'focal'); ?></label><br /> 
     1290                    <input type="checkbox" id="focal_NoFollowAllLinks" name="focal_NoFollowAllLinks" <?php echo ($this->widgetOptions['NoFollowAllLinks']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_NoFollowAllLinks"><?php _e('Add rel="nofollow" to all links', 'focal'); ?></label><br/> 
     1291                    <input type="checkbox" id="focal_NoFollowParents" name="focal_NoFollowParents" <?php echo ($this->widgetOptions['NoFollowParents']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_NoFollowParents"><?php _e('Add rel="nofollow" to all links NOT below current category (allow follow on child category)', 'focal'); ?></label><br/> 
    12211292                </td> 
    12221293            </tr> 
     
    12241295                <th scope="row" valign="top"><?php _e('Additional Links', 'focal'); ?></th> 
    12251296                <td> 
    1226                     <span>This section allows additional static links to be placed in the list, before or after the category list. You must enter a pipe delimited ("|") string in the following format, with each link on a new line.</span></br> 
    1227                     <span><pre>link title|http://www.link.url|popup title description|some text before|some text after</pre></span></br> 
    1228                     <span>Text before and after the link are not included as the anchor tag, so you can have "Visit <span style="text-decoration:underline">my photos</span> page".</span></br> 
    1229                     </br></br> 
    1230               <p><span>Links before the category list:</span><br/></br> 
    1231                     <textarea name="focal_widgetLinksBefore" id="focal_widgetLinksBefore" style="width:80%; height:80px"><?php echo ($this->widgetOptions['LinksBefore']); ?></textarea></p> 
    1232               <p><span>Links after the category list:</span><br/></br> 
     1297                    <span><?php _e('This section allows additional static links to be placed in the list, before or after the category list. You must enter a pipe delimited ("|") string in the following format, with each link on a new line.', 'focal'); ?></span></br> 
     1298                    <span><pre><?php _e('link title|http://www.link.url|popup title description|some text before|some text after', 'focal'); ?></pre></span></br> 
     1299                    <span><?php _e('Text before and after the link are not included as the anchor tag, so you can have "Visit <span style="text-decoration:underline">my photos</span> page".</span>', 'focal'); ?></br> 
     1300                    </br> 
     1301              <p><span><?php _e('Links before the category list:', 'focal'); ?></span><br/> 
     1302              <textarea name="focal_widgetLinksBefore" id="focal_widgetLinksBefore" style="width:80%; height:80px"><?php echo ($this->widgetOptions['LinksBefore']); ?></textarea></p> 
     1303              <p><span><?php _e('Links after the category list:', 'focal'); ?></span><br/> 
    12331304                    <textarea name="focal_widgetLinksAfter" id="focal_widgetLinksAfter" style="width:80%; height:80px"><?php echo ($this->widgetOptions['LinksAfter']); ?></textarea></p> 
    12341305                </td> 
     
    12371308                <th scope="row" valign="top"><?php _e('CSS', 'focal'); ?></th> 
    12381309                <td> 
    1239                     <input type="checkbox" id="focal_OutputCatIDs" name="focal_OutputCatIDs" <?php echo ($this->widgetOptions['OutputCatIDs']) ? "checked" : "" ;?>/><label for="focal_OutputCatIDs">Use category ID as CSS ID on &lt;li&gt; tags.</label><br/> 
     1310                    <input type="checkbox" id="focal_OutputCatIDs" name="focal_OutputCatIDs" <?php echo ($this->widgetOptions['OutputCatIDs']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_OutputCatIDs"><?php _e('Use category ID as CSS ID on &lt;li&gt; tags, e.g. &lt;li id=&quot;cat-53&quot;&gt;', 'focal'); ?></label><br/> 
    12401311<?php  
    12411312if ($this->widgetOptions['ApplyCSSTo'] == "li") { $li = " selected"; $value= "li"; } 
     
    12431314if ($this->widgetOptions['ApplyCSSTo'] == "span") { $span = " selected"; $value= "span"; } 
    12441315?>                       
    1245               Apply CSS classes to:  
     1316              <?php _e('Apply CSS classes to:', 'focal'); ?>  
    12461317              <select name="focal_applyCSSTo" id="focal_applyCSSTo" value="<?php echo $value; ?>"> 
    1247                       <option<?php echo $li; ?> value="li">List item tags (li) (default)</option> 
    1248                       <option<?php echo $a; ?> value="a">Links/Anchor tags (a)</option> 
    1249                       <option<?php echo $span; ?> value="span">Wrap contents in a span tag</option> 
     1318                      <option<?php echo $li; ?> value="li"><?php _e('List item tags (li) (default)', 'focal'); ?></option> 
     1319                      <option<?php echo $a; ?> value="a"><?php _e('Links/Anchor tags (a)', 'focal'); ?></option> 
     1320                      <option<?php echo $span; ?> value="span"><?php _e('Wrap contents in a span tag', 'focal'); ?></option> 
    12501321              </select> 
    12511322                </td> 
     
    12541325                <th scope="row" valign="top"><?php _e('Miscellaneous', 'focal'); ?></th> 
    12551326                <td> 
    1256                     <input type="checkbox" id="focal_ShowEmptyCats" name="focal_ShowEmptyCats" <?php echo ($this->widgetOptions['ShowEmptyCats']) ? "checked" : "" ;?>/><label for="focal_ShowEmptyCats">Show empty categories.</label><br/> 
     1327                    <input type="checkbox" id="focal_ShowEmptyCats" name="focal_ShowEmptyCats" <?php echo ($this->widgetOptions['ShowEmptyCats']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_ShowEmptyCats"><?php _e('Show empty categories.', 'focal'); ?></label><br/> 
     1328                    <input type="checkbox" id="focal_MultiLingual" name="focal_MultiLingual" <?php echo ($this->widgetOptions['MultiLingual']) ? "checked" : "" ;?>/>&nbsp;<label for="focal_MultiLingual"><?php _e('Allow Multilingual Translations.', 'focal'); ?></label><br/> 
    12571329                </td> 
    12581330            </tr>                    
     
    12601332        <br/> 
    12611333        <span style="float:right"><input type="submit" name="focalSubmitOptions" value="<?php _e('Save Changes', 'focal'); ?>" class="button"/></span> 
     1334        <br/><br/> 
    12621335        <div style="clear:both"></div> 
    12631336      </form> 
     
    12731346 
    12741347 
    1275 function register_FoldingCategoryList() 
     1348/* wp 2.8+ activator */ 
     1349if (function_exists('register_widget')) 
    12761350{ 
    1277   register_widget('FoldingCategoryList'); 
     1351  function register_FoldingCategoryList() 
     1352  { 
     1353    register_widget('FoldingCategoryList'); 
     1354  } 
     1355  add_action('init', 'register_FoldingCategoryList', 1); 
    12781356} 
    1279 add_action('init', 'register_FoldingCategoryList', 1); 
     1357else /* wp < 2.8 activator */ 
     1358{ 
     1359} 
    12801360 
    12811361?> 
  • folding-category-widget/trunk/readme.txt

    r191109 r227602  
    33Donate link: http://www.lonewolfdesigns.co.uk/focal/ 
    44Tags: categories, folding, category list, category management, category navigation, widget, sidebar, expanding, focal 
    5 Requires at least: 2.3.0 
    6 Tested up to: 2.9.1 
    7 Stable tag: 1.2.0 
    8 Date: 07/01/2009 
     5Requires at least: 2.8.0 
     6Tested up to: 2.9.2 
     7Stable tag: 1.3.0 
     8Date: 11/04/2010 
    99 
    1010Enhanced Folding Category List for Wordpress 2.3+ 
     
    1313As your blog gets more and more posts, inevitably you will create more categories to cope. Eventually your categories will take up more room on your screen, and scroll across many pages. 
    1414 
    15 This plug-in provides a *Fo*lding *Ca*tegory *L*ist (FoCaL) for Wordpress version 2.3 and above which allows categories to be expanded and collapsed to save room on your sidebar. Please see http://sharpertutorials.com http://www.yourparanormal.com http://www.galacticfool.com or the plugin homepage for demos. 
     15This plug-in provides a *Fo*lding *Ca*tegory *L*ist (FoCaL) for Wordpress version 2.3 and above which allows categories to be expanded and collapsed to save room on your sidebar. 
    1616  
    1717On the plugin homepage you can also find full documentation as well as a list of more demo sites. 
     
    3434  * Control category order by name, id, description, post count or use with "My Category Order" plugin for total control 
    3535 
    36 = What's New in 1.2.0 =  
     36= What's New in 1.3.0 =  
    3737For full version history and older versions please refer to the plugin homepage. 
    3838 
    39   * Nothing much to be honest, but multiple widgets are now supported on the latest Wordpress 2.8+ blogs. 
    40   * Removed CSS themes. They didn't work too well anyway. If you need them please see the plugin homepage. 
     39  * Specify exact category to expand on single posts and pages with a "category" custom field. 
     40  * Uses Wordpress roles to better cope with authors and contributors. 
     41  * Specify categories to include or exclude (previous only exclude was allowed). 
     42  * UI multi lingual capable. 
     43  * FoCaL output supports multilanguage plugins (I am unable to test this, please let me know if it works or not). 
     44  * Future proof version selection, shouldn't break when WP3 comes out. 
     45  * Misc bug fixes (post count, admin screen etc...). 
     46  * Dropped support for Wordpress < 2.8 due to widget API enhancements. The old version is still available to use but will not get updated. Sorry. 
    4147 
    4248== Installation == 
     
    5864 
    5965== Frequently Asked Questions == 
     66 
     67= I can't delete a setting profile =  
     68Try deleting any unused widgets from the "inactive widgets" section of the widgets dashboard and try again. 
    6069 
    6170= How do I get multiple widgets? =  
  • folding-category-widget/trunk/wp23_folding_cats.php

    r191109 r227602  
    55Description: Enhanced Folding Category List for Wordpress  
    66Author: Tim Trott 
    7 Version: 1.2.0 
     7Version: 1.3.0 
    88Author URI: http://lonewolfdesigns.co.uk/ 
    99 
     
    1616*/ 
    1717 
    18 global $wp_version; 
    19  
    20 if ( strpos($wp_version, '2.8') !== false || strpos($wp_version, '2.9') !== false)  
     18if ( class_exists('WP_Widget') )  
    2119{ 
    2220    require(dirname(__FILE__).'/focal_wp28.php'); 
Note: See TracChangeset for help on using the changeset viewer.