Changeset 584049
- Timestamp:
- 08/10/2012 08:32:42 PM (14 years ago)
- Location:
- category-icons-lite/tags/1.2
- Files:
-
- 3 edited
-
caticons-lite.class.php (modified) (8 diffs)
-
caticonslite.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
category-icons-lite/tags/1.2/caticons-lite.class.php
r583156 r584049 3 3 4 4 class CategoryIconsLite { 5 6 5 private $meta_key = '_wp_attachment_category'; // hidden custom field 7 6 private $settings = 'caticonslite_settings'; … … 241 240 if ( in_the_loop() AND $text == $GLOBALS['post']->post_title ) {// if in the loop & post title is the same than the one being processed 242 241 $this->reset_flags(); 243 /*$icon=$this->get_icon();244 if (!empty($icon)) {245 $image = $this->html_tag($icon,$text);246 }247 */248 242 $image = $this->get_cat_icon(); 249 243 } … … 292 286 } 293 287 294 295 288 /** 296 289 * This function returns the icon url … … 304 297 $cat_id = array(); 305 298 $result = array(); 306 if ( count($catlist) > 0) {299 if (0 < count($catlist) ) { 307 300 $max = $this->options['caticonslite-maxicons']; 308 if (count($catlist) <$max) {301 if (count($catlist) < $max) { 309 302 $max = count($catlist); 310 303 } 311 for ($i=0; $i<$max;$i++) {304 for ($i=0; $i<$max; $i++) { 312 305 $cat_id[] = (int) $catlist[$i]->term_id; 313 306 } … … 318 311 } 319 312 } 320 else { 313 else { // one category 321 314 $cat_id = (int) $catlist->term_id; 322 315 } … … 325 318 $cat_id = apply_filters('caticonslite_cat_id', $cat_id); 326 319 if (is_array($cat_id)) { 327 for ($i=0; $i<count($cat_id);$i++) { 328 $index = $cat_id[$i]; 329 if (0 < $index AND isset($this->caticons_array[$index]['url'])) { 330 $result[] = $this->caticons_array[$index]['url']; 331 320 for ($i=0; $i<count($cat_id); $i++) { 321 $idcat = $cat_id[$i]; 322 if (0 < $idcat AND isset($this->caticons_array[$idcat]['url'])) { 323 $result[] = $this->caticons_array[$idcat]['url']; 332 324 } 333 325 } … … 338 330 } 339 331 } 332 340 333 return $result; 341 334 } … … 373 366 * Returns the category icons 374 367 */ 375 function get_cat_icon($cat_id=-1) { 368 function get_cat_icon($cat_id=-1,$maxicons=0) { 369 if (isset($this->options['caticonslite-maxicons']) AND 1 < $this->options['caticonslite-maxicons'] AND $maxicons == 0) { 370 $maxicons = $this->options['caticonslite-maxicons']; 371 } 376 372 $result = ''; 377 373 $icons = $this->get_icon($cat_id); 378 374 if (!empty($icons)) { 379 375 if (is_array($icons)) { 376 $icons = array_slice($icons,0,$maxicons); 380 377 foreach ($icons as $icon) { 381 $result .= $this->html_tag($icon); 378 $result .= $this->html_tag($icon); 382 379 } 383 380 } -
category-icons-lite/tags/1.2/caticonslite.php
r583156 r584049 9 9 */ 10 10 11 global $pagenow; 12 include_once('caticons-lite.class.php'); // Loads Category Icons Lite class 13 11 14 /** 12 15 * This function removes all traces of the plugin in the postmeta table 13 16 */ 14 15 global $pagenow;16 17 17 function category_icons_lite_uninstall() { 18 18 global $wpdb; 19 19 $metas = $wpdb->get_results( "DELETE FROM {$wpdb->prefix}postmeta WHERE meta_key = '_wp_attachment_category'" ); 20 20 } 21 22 include_once('caticons-lite.class.php');23 21 24 22 if(class_exists('CategoryIconsLite')) { … … 33 31 $rss = $CategoryIconsLite->is_rss(); 34 32 33 // --- RSS 35 34 if ($rss) {// RSS 36 35 add_filter('the_excerpt_rss',array($CategoryIconsLite,'rss_content')); … … 39 38 } 40 39 41 40 // --- Sidebar 42 41 if ($sidebar_icons) { // if the option is checked, display the icon in the sidebar 43 42 add_filter('wp_list_categories',array($CategoryIconsLite,'list_cats'), 10, 2); 44 43 } 45 44 45 // --- Posts title 46 46 if ($post_titles_icon) { // if the option is checked, display the icon in front of the post titles 47 47 add_filter('the_title', array($CategoryIconsLite,'page_filter'), 10,2); 48 48 49 49 //--- The automagic mechanic 50 //add_filter('woo_embed',array($CategoryIconsLite,'reset_flags'),10,2); 51 add_filter('post_thumbnail_html',array($CategoryIconsLite,'reset_flags'),10,2); 52 add_filter('the_category',array($CategoryIconsLite,'reset_flags'),10,2); 53 50 54 add_action('the_content',array($CategoryIconsLite,'reset_flags')); 51 55 add_action('the_post',array($CategoryIconsLite,'reset_flags')); 52 add_filter('the_excerpt',array($CategoryIconsLite,'reset_flags') );56 add_filter('the_excerpt',array($CategoryIconsLite,'reset_flags'),10,2); 53 57 add_filter('get_comments_number',array($CategoryIconsLite,'reset_flags'),10,2); 54 58 add_filter('the_time',array($CategoryIconsLite,'reset_flags'),10,2); … … 61 65 } 62 66 63 // WP Admin GUI 64 67 // --- WP Admin GUI 65 68 if (is_admin() /*&& current_user_can( 'manage_categories' )*/ ) { 66 67 69 add_action('admin_menu',array($CategoryIconsLite,'add_menu'),1); 68 70 add_action('admin_init', array($CategoryIconsLite,'set_options'),1); … … 83 85 add_filter('deleted_term_taxonomy', array($CategoryIconsLite,'category_removed')); 84 86 } 85 86 87 } 87 88 89 // --- get_cat_icon_lite() 88 90 if (!function_exists('get_cat_icon_lite')) { 89 function get_cat_icon_lite($ cat_id=-1) {91 function get_cat_icon_lite($args='') {//$cat_id=-1,$maxicons=0 90 92 global $CategoryIconsLite; 91 return $CategoryIconsLite->get_cat_icon($cat_id); 93 $max_icons = 0; 94 $cat_id = -1; 95 if (is_integer($args)) { // if parameter is an integer, use it as cat_id 96 $cat_id = $args; 97 } 98 else { 99 parse_str($args, $parameter); 100 if (isset($parameter['cat'])) { // cat=X : display category id X icon 101 $cat_id = (int) $parameter['cat']; 102 } 103 104 if (isset($parameter['max'])) { // max=Y : display Y icon(s) maximum 105 $max_icons = (int) $parameter['max']; 106 } 107 } 108 109 return $CategoryIconsLite->get_cat_icon($cat_id,$max_icons); 92 110 } 93 111 } -
category-icons-lite/tags/1.2/readme.txt
r583442 r584049 25 25 * automatically displays icons in the categories widget, next to the category names or **just category icons** (you can disable it too) 26 26 * is compatible with My Category Order 27 * works with more themes ([ColorWay](http://wordpress.org/extend/themes/colorway) for example) 27 28 28 29 = For Designers & Developers : = … … 63 64 == Buy me a coffee == 64 65 65 If you like this plugin, or it has benefited you, [buy me a coffee](http://www.category-icons.com/support-the-plugin/).66 If you like this plugin, or it has benefited you, you can [buy me a coffee](http://www.category-icons.com/support-the-plugin/). 66 67 67 68 == Changelog ==
Note: See TracChangeset
for help on using the changeset viewer.