Changeset 443817
- Timestamp:
- 09/26/2011 06:53:17 PM (15 years ago)
- Location:
- auto-url/trunk
- Files:
-
- 4 edited
-
auto-url-data.php (modified) (2 diffs)
-
auto-url.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
templates/pattern.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
auto-url/trunk/auto-url-data.php
r439221 r443817 4 4 '%categories%', 5 5 '%categorypath%', 6 '%tags%', 6 '%tags%', 7 7 ); 8 8 … … 113 113 return $path; 114 114 } 115 116 function auto_url_get_category_tree($pid = 0, $d=1) { 117 $cats = get_categories(array( 118 'parent' => $pid, 119 'hide_empty' => false 120 )); 121 122 for ($i = 0; $i < count($cats); $i++) { 123 $children = auto_url_get_category_tree($cats[$i]->cat_ID, $d + 1); 124 if (!empty($children)) { 125 for ($j = 0; $j < count($children); $j++) { 126 $children[$j]->cat_name = str_repeat('–', $d) . ' ' . $children[$j]->cat_name; 127 } 128 $cats[$i]->children = $children; 129 } 130 } 131 132 return $cats; 133 } 134 135 function auto_url_walk_category_tree($categories, $patterns) { 136 $output = ''; 137 foreach ($categories as $c) { 138 $output .= 139 '<div class="formRow patternRow"> 140 <label>' . $c->name . '</label> 141 <input type="text" name="p[category][' . $c->term_id . ']" value="' . (isset($patterns['category'][$c->term_id]) ? $patterns['category'][$c->term_id] : '') . '" /> 142 </div>'; 143 144 if (isset($c->children) && !empty($c->children)) 145 $output .= auto_url_walk_category_tree($c->children, $patterns); 146 } 147 148 return $output; 149 } -
auto-url/trunk/auto-url.php
r442720 r443817 5 5 Plugin URI: http://www.bunchacode.com/programming/auto-url 6 6 Description: generates customized permalinks according to post types, categories and tags 7 Version: 0.9.17 Version: 1.0 8 8 Author: FunkyDude 9 9 Author URI: http://www.bunchacode.com … … 177 177 $patterns = json_decode(get_option(AU_OPTION_PATTERN_NAME), true); 178 178 $tags = get_tags(); 179 $categories = get_categories();179 $categories = auto_url_get_category_tree(); 180 180 181 181 require(AU_TEMPLATE . 'pattern.php'); -
auto-url/trunk/readme.txt
r442720 r443817 4 4 Requires at least: 3.1 5 5 Tested up to: 3.2.1 6 Stable tag: 0.9.16 Stable tag: 1.0 7 7 8 8 Auto URL generates customized permalinks according to post types, categories and tags -
auto-url/trunk/templates/pattern.php
r439221 r443817 28 28 </fieldset> 29 29 <fieldset> 30 <legend>Post /PageURL Patterns by Tag</legend>30 <legend>Post URL Patterns by Tag</legend> 31 31 <div class="formRow"> 32 32 <?php foreach($tags as $t){?> … … 39 39 </fieldset> 40 40 <fieldset> 41 <legend>Post/Page URL Patterns by Category</legend> 42 <?php foreach($categories as $c){?> 43 <div class="formRow patternRow"> 44 <label><?php echo $c->name;?></label> 45 <input type="text" name="p[category][<?php echo $c->term_id;?>]" value="<?php echo isset($patterns['category'][$c->term_id])?$patterns['category'][$c->term_id]:'';?>" /> 46 </div> 47 <?php }?> 41 <legend>Post URL Patterns by Category</legend> 42 <?php echo auto_url_walk_category_tree($categories, $patterns);?> 48 43 </fieldset> 49 44 <fieldset>
Note: See TracChangeset
for help on using the changeset viewer.