Changeset 221691
- Timestamp:
- 03/25/2010 08:18:32 PM (16 years ago)
- Location:
- faviroll/trunk
- Files:
-
- 3 edited
-
Faviroll.class.php (modified) (20 diffs)
-
faviroll.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
faviroll/trunk/Faviroll.class.php
r191165 r221691 84 84 $init && update_option('faviroll_debug','off'); 85 85 86 // default is use faviroll/style.css. 87 $css = get_option('faviroll_use_stylesheet'); 88 if (empty($css)) 89 $init && update_option('faviroll_use_stylesheet','on'); 90 91 86 92 $this->debug = (get_option('faviroll_debug') == 'on'); 87 88 93 } 89 94 … … 105 110 106 111 /** 107 * For WordPress MU. Any MU user has a blogid, which must be included into the cache file name. 112 * For WordPress MU. Any MU user has a blogid, which must be included into the cache file name. 108 113 */ 109 114 function setPrefix() { … … 114 119 115 120 } 116 117 121 118 122 119 123 /** … … 156 160 return false; 157 161 158 // Make shure that transparency flag is set 162 // Make shure that transparency flag is set 159 163 if (is_null($this->transparency)) 160 164 $this->transparency = (get_option('faviroll_transparency') == 'on'); … … 190 194 191 195 imagecopyresampled($image_tmp, $image, 0, 0, 0, 0, 16, 16, $width, $height); 192 imagedestroy($image); 196 imagedestroy($image); 193 197 $image = $image_tmp; 194 198 } … … 197 201 if (!is_null($image)) { 198 202 $result = imagepng($image,$icopath); 199 imagedestroy($image); 203 imagedestroy($image); 200 204 } 201 205 … … 240 244 $lk_path = ($pi_basename == $pi_filename) ? '/' : dirname($lk_path).'/'; 241 245 } 242 246 243 247 244 248 // cached favicons filenames are build with prefix (for WPMU) and MD5 checksum from the favicon … … 261 265 /** 262 266 * Loads the given filename if the needed class isn't defined already 263 * @return TRUE if the PHP class is already present 267 * @return TRUE if the PHP class is already present 264 268 */ 265 269 function loadClass($class,$filename) { … … 308 312 /** 309 313 * @param $withsize [optional] If TRUE skip all "zero size" files 310 * @param $fullpath [optional] If TRUE full filepath is returned, instead just the basename 314 * @param $fullpath [optional] If TRUE full filepath is returned, instead just the basename 311 315 * @return reference to List-Array with all favicon file basenames from cache directory. 312 316 */ … … 316 320 317 321 // MD5 Strings are always 32 characters f.e. cc33ac77c986e91fb30604dd516a61c7 318 $pattern = $this->cachedir.'/'.$this->prefix.'????????????????????????????????'; 322 $pattern = $this->cachedir.'/'.$this->prefix.'????????????????????????????????'; 319 323 $items = @glob($pattern); 320 324 if ($items === false) … … 359 363 if ($offsetFromNow < $this->lastcheck) 360 364 return false; 361 365 362 366 // Max. Laufzeit auf 5 Min. setzen 363 367 @ini_set('max_execution_time',300); … … 370 374 Cache directory = '.$this->cachedir.'<br /></b>'; 371 375 372 373 # ---------- next stage 376 377 # ---------- next stage 374 378 foreach(get_bookmarks() as $link) { 375 379 $this->putIconIntoCache($link,true); … … 381 385 ob_flush(); 382 386 flush(); 383 387 384 388 return true; 385 389 } … … 406 410 407 411 // -------------- [Request URL analysieren] -------------- 408 412 409 413 if (!isset($_SERVER['REQUEST_URI'])) 410 414 return false; … … 474 478 * Wandelt Backslashes einheitlich in Slashes um. 475 479 * Säubert den Pfad von "/" Dubletten 476 * @param $path string contains the pathname 480 * @param $path string contains the pathname 477 481 */ 478 482 function normalize($path) { … … 492 496 /** 493 497 * Check write permissions on cache directory. 494 * @return error message if cache directory is not writable, or the string is given into method 498 * @return error message if cache directory is not writable, or the string is given into method 495 499 */ 496 500 function get_message($othermsg=null) { 497 501 498 // non-admin 502 // non-admin 499 503 if (!is_admin() || $this->can_write_cache()) 500 504 return $othermsg; … … 520 524 * from http://de3.php.net/is_writable 521 525 * Since looks like the Windows ACLs bug "wont fix" (see http://bugs.php.net/bug.php?id=27609) I propose this alternative function: 522 * For directory check $path must end with a slash 526 * For directory check $path must end with a slash 523 527 */ 524 528 function is__writable($path) { … … 545 549 /** 546 550 * Detect the URL to the favicon 547 * @param $i_url Website URL which (hopefully) contains the favicon href 551 * @param $i_url Website URL which (hopefully) contains the favicon href 548 552 */ 549 553 function locateIcon($i_url) { … … 652 656 function patchPlugin($plugindir,$activate=false) { 653 657 654 $result = null; 658 $result = null; 655 659 656 660 foreach (get_plugins() as $path => $data) { … … 686 690 default: 687 691 break; 688 } 692 } 689 693 690 694 if ($activate) { -
faviroll/trunk/faviroll.php
r221490 r221691 5 5 Description: Locally caches all favicon.ico in PNG format and use this into the blogroll. Native ICO Images are not supported from all browsers/operating systems. <strong><a href="link-manager.php?page=faviroll.php">For Settings jump to: Links » Faviroll</a></strong> 6 6 Author: grobator 7 Version: 0.4. 67 Version: 0.4.7 8 8 Author URI: http://www.grobator.de/ 9 9 ---------------------------------------------------------------------------------------- … … 97 97 update_option('faviroll_default_favicon', (empty($defico) ? $faviroll->getFavirollDefaultIcon() : $defico)); 98 98 99 update_option('faviroll_revisit' , (int) trim($_REQUEST['faviroll_revisit'])); 100 update_option('faviroll_transparency', (isset($_REQUEST['faviroll_transparency']) ? 'on' : 'off') ); 101 update_option('faviroll_debug' , (isset($_REQUEST['faviroll_debug']) ? 'on' : 'off') ); 99 update_option('faviroll_revisit' , (int) trim($_REQUEST['faviroll_revisit'])); 100 update_option('faviroll_transparency' , (isset($_REQUEST['faviroll_transparency']) ? 'on' : 'off') ); 101 update_option('faviroll_debug' , (isset($_REQUEST['faviroll_debug']) ? 'on' : 'off') ); 102 update_option('faviroll_use_stylesheet', (isset($_REQUEST['faviroll_use_stylesheet']) ? 'on' : 'off') ); 102 103 103 104 $message = 'Settings updated'; … … 113 114 $is_transparency = (get_option('faviroll_transparency') == 'on'); 114 115 $is_debugMode = (get_option('faviroll_debug') == 'on'); 116 $use_stylesheet = (get_option('faviroll_use_stylesheet') == 'on'); 115 117 116 118 if (!$removeSettings) { … … 140 142 <table class="form-table" summary=""> 141 143 <tr> 142 <td scope="row" valign="top">Default Favicon URL:</td>143 <td><input type="text" name="faviroll_default_favicon" size=" 120" value="'.$default_favicon.'" /><br />(If the favicon on the link is missing this will be shown instead.)</td>144 </tr> 145 <tr> 146 <td scope="row">Favions revisit after:</td>144 <td width="150">Default Favicon URL:</td> 145 <td><input type="text" name="faviroll_default_favicon" size="80" value="'.$default_favicon.'" /><br />(If the favicon on the link is missing this will be shown instead.)</td> 146 </tr> 147 <tr> 148 <td>Favions revisit after:</td> 147 149 <td><input type="text" name="faviroll_revisit" size="4" value="'.$revisit.'" /> days</td> 148 150 </tr> 149 151 <tr> 150 <td scope="row">Use transparent background:</td>152 <td>make Favicon<br />background transparent:</td> 151 153 <td><input type="checkbox" name="faviroll_transparency" value="on"'.($is_transparency ? ' checked="checked"' : null).' /></td> 152 154 </tr> 153 155 <tr> 154 <td scope="row"> </td> 155 <td><a href="plugin-editor.php?file=faviroll/style.css&plugin=faviroll/faviroll.php" title="Edit the faviroll css-styles">Edit faviroll stylesheet</a></td> 156 </tr> 157 <tr> 158 <td colspan="2" width="98%"><hr size="1" /></td> 159 </tr> 156 <td>Use faviroll/style.css:</td> 157 <td> 158 <input type="checkbox" name="faviroll_use_stylesheet" value="on"'.($use_stylesheet ? ' checked="checked"' : null).' /> 159 160 <label for="faviroll_use_stylesheet"><a href="plugin-editor.php?file=faviroll/style.css&plugin=faviroll/faviroll.php" title="Edit the faviroll css-styles">Edit faviroll stylesheet</a></label> 161 </td> 162 </tr> 163 <tr> 164 <td colspan="2" style="line-height:5px;padding:0px;"><hr size="1" width="90%" /></td> 165 </tr> 160 166 <tr> 161 167 <td><strong>Actions</strong></td> 162 168 </tr> 163 169 <tr> 164 <td scope="row">(re)build FavIcons now:</td>170 <td>(re)build FavIcons now:</td> 165 171 <td><input type="checkbox" name="faviroll_renew_icons" value="true"'.(($faviroll->cacheIconsCount() == 0) ? ' checked="checked"' : null).' /></td> 166 172 </tr> 167 173 <tr> 168 <td scope="row"title="This will remove plugin settings from database and drop the favicon cache">Remove settings:</td>174 <td title="This will remove plugin settings from database and drop the favicon cache">Remove settings:</td> 169 175 <td><input type="checkbox" name="faviroll_remove_settings" value="true" /> 170 176 </tr> … … 172 178 /* 173 179 <tr> 174 <td scope="row"title="Write debug informations as comments into the HTML code">Debug mode:</td>175 <td><input type="checkbox" name="faviroll_debug" value="true" '.($is_debugMode ? ' checked="checked"' : null).' /> ( just for Developers, normally switch off )180 <td title="Write debug informations as comments into the HTML code">Debug mode:</td> 181 <td><input type="checkbox" name="faviroll_debug" value="true" '.($is_debugMode ? ' checked="checked"' : null).' /> ( just for Developers, normally switch off ) 176 182 </tr> 177 183 */ … … 198 204 199 205 200 201 /** 202 * Register Enqueue CSS203 */ 204 function faviroll_enqueue_scripts() {205 wp_enqueue_style('faviroll', WP_PLUGIN_URL.'/faviroll/style.css', false, false, 'all');206 }207 add_action('wp_enqueue_scripts', 'faviroll_enqueue_scripts');208 206 /** 207 * Register Enqueue CSS, if option is activated in Faviroll-Settings 208 */ 209 if (get_option('faviroll_use_stylesheet') == 'on') { 210 function faviroll_enqueue_scripts() { 211 wp_enqueue_style('faviroll', WP_PLUGIN_URL.'/faviroll/style.css', false, false, 'all'); 212 } 213 add_action('wp_enqueue_scripts', 'faviroll_enqueue_scripts'); 214 } 209 215 210 216 /** -
faviroll/trunk/readme.txt
r221490 r221691 5 5 Requires at least: 2.7 6 6 Tested up to: 2.9.1, (WPMU 2.8.6) 7 Stable tag: 0.4. 67 Stable tag: 0.4.7 8 8 9 9 Locally caches all favicon.ico in PNG format and use this into the blogroll. Native ICO Images are not supported from all browsers (f.e. IE). … … 37 37 * CLN = Cleanup/Refactoring 38 38 * OTH = Other 39 40 = 0.4.7 = 41 * FEA: Options has a new checkbox for disabling faviroll/style.css (Request from Dixie) 39 42 40 43 = 0.4.6 =
Note: See TracChangeset
for help on using the changeset viewer.