Changeset 584600
- Timestamp:
- 08/12/2012 04:09:26 PM (14 years ago)
- Location:
- category-icons-lite/tags/1.2
- Files:
-
- 2 edited
-
caticons-lite.class.php (modified) (3 diffs)
-
caticonslite.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
category-icons-lite/tags/1.2/caticons-lite.class.php
r584529 r584600 289 289 } 290 290 291 /** 292 * This function returns the icon url 293 */ 294 private function get_icon($cat_id=-1) { 295 global $wpdb; 296 $result = ''; 297 if ( -1 == $cat_id ) { 298 $catlist = get_the_category(get_the_ID()); 299 if (is_array($catlist)) {// If there are several categories, 300 $cat_id = array(); 301 $result = array(); 302 if (0 < count($catlist) ) { 303 $max = $this->options['caticonslite-maxicons']; 304 if (count($catlist) < $max) { 305 $max = count($catlist); 306 } 307 for ($i=0; $i<$max; $i++) { 308 $cat_id[] = (int) $catlist[$i]->term_id; 309 } 310 //$cat_id = apply_filters('caticonslite_cat_priority', $cat_id, $catlist); 311 } 312 else { 313 return $result; 314 } 315 } 316 else { // one category 317 $cat_id = (int) $catlist->term_id; 318 } 319 } 320 321 $cat_id = apply_filters('caticonslite_cat_id', $cat_id); 322 if (is_array($cat_id)) { 323 for ($i=0; $i<count($cat_id); $i++) { 324 $idcat = $cat_id[$i]; 325 if (0 < $idcat AND isset($this->caticons_array[$idcat]['url'])) { 326 $result[] = $this->caticons_array[$idcat]['url']; 327 } 328 } 329 } 330 else { 331 if (0 < $cat_id AND isset($this->caticons_array[$cat_id]['url'])) { 332 $result = $this->caticons_array[$cat_id]['url']; 333 } 334 } 335 336 return $result; 337 } 338 291 339 292 /** 340 293 * This function loads all the urls of the icons in an array to access them later … … 369 322 * Returns the category icons 370 323 */ 371 function get_cat_icon($cat_id=-1,$maxicons= 0) {324 function get_cat_icon($cat_id=-1,$maxicons=1) { 372 325 if (isset($this->options['caticonslite-maxicons']) AND 1 < $this->options['caticonslite-maxicons'] AND $maxicons == 0) { 373 326 $maxicons = $this->options['caticonslite-maxicons']; … … 389 342 } 390 343 344 /** 345 * This function returns the icon url 346 */ 347 private function get_icon($cat_id=-1) { 348 global $wpdb; 349 $result = ''; 350 if ( -1 == $cat_id ) { 351 $catlist = get_the_category(get_the_ID()); 352 if (is_array($catlist)) {// If there are several categories, 353 $cat_id = array(); 354 $result = array(); 355 if (0 < count($catlist) ) { 356 $max = $this->options['caticonslite-maxicons']; 357 if (count($catlist) < $max) { 358 $max = count($catlist); 359 } 360 for ($i=0; $i<$max; $i++) { 361 $cat_id[] = (int) $catlist[$i]->term_id; 362 } 363 //$cat_id = apply_filters('caticonslite_cat_priority', $cat_id, $catlist); 364 } 365 else { 366 return $result; 367 } 368 } 369 else { // one category 370 $cat_id = (int) $catlist->term_id; 371 } 372 } 373 374 $cat_id = apply_filters('caticonslite_cat_id', $cat_id); 375 if (is_array($cat_id)) { 376 for ($i=0; $i<count($cat_id); $i++) { 377 $idcat = $cat_id[$i]; 378 if (0 < $idcat AND isset($this->caticons_array[$idcat]['url'])) { 379 $result[] = $this->caticons_array[$idcat]['url']; 380 } 381 } 382 } 383 else { 384 if (0 < $cat_id AND isset($this->caticons_array[$cat_id]['url'])) { 385 $result = $this->caticons_array[$cat_id]['url']; 386 } 387 } 388 389 return $result; 390 } 391 391 392 /** 392 393 * Injects icons in the wp_list_categories result -
category-icons-lite/tags/1.2/caticonslite.php
r584524 r584600 48 48 49 49 //--- The automagic mechanic 50 // add_filter('post_thumbnail_html',array($CategoryIconsLite,'reset_flags'),10,2); 51 //add_filter('the_category',array($CategoryIconsLite,'reset_flags'),10,2); 50 52 add_action('the_content',array($CategoryIconsLite,'reset_flags')); 51 53 add_action('the_post',array($CategoryIconsLite,'reset_flags')); … … 85 87 // --- get_cat_icon_lite() 86 88 if (!function_exists('get_cat_icon_lite')) { 87 function get_cat_icon_lite($args='') {//$cat_id=-1,$maxicons= 089 function get_cat_icon_lite($args='') {//$cat_id=-1,$maxicons=1 88 90 global $CategoryIconsLite; 89 $max_icons = 0;91 $max_icons = 1; 90 92 $cat_id = -1; 91 93 if (is_integer($args)) { // if parameter is an integer, use it as cat_id
Note: See TracChangeset
for help on using the changeset viewer.