Plugin Directory

Changeset 221691


Ignore:
Timestamp:
03/25/2010 08:18:32 PM (16 years ago)
Author:
UnderWordPressure
Message:

New Checkbox to control faviroll/style.css

Location:
faviroll/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • faviroll/trunk/Faviroll.class.php

    r191165 r221691  
    8484            $init && update_option('faviroll_debug','off');
    8585
     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
    8692        $this->debug = (get_option('faviroll_debug') == 'on');
    87 
    8893    }
    8994
     
    105110
    106111    /**
    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.
    108113     */
    109114    function setPrefix() {
     
    114119
    115120    }
    116    
    117    
     121
    118122
    119123    /**
     
    156160                return false;
    157161
    158             // Make shure that transparency flag is set 
     162            // Make shure that transparency flag is set
    159163            if (is_null($this->transparency))
    160164                $this->transparency = (get_option('faviroll_transparency') == 'on');
     
    190194
    191195                    imagecopyresampled($image_tmp, $image, 0, 0, 0, 0, 16, 16, $width, $height);
    192                     imagedestroy($image);                   
     196                    imagedestroy($image);
    193197                    $image = $image_tmp;
    194198                }
     
    197201            if (!is_null($image)) {
    198202                $result = imagepng($image,$icopath);
    199                 imagedestroy($image);                   
     203                imagedestroy($image);
    200204            }
    201205
     
    240244            $lk_path = ($pi_basename == $pi_filename) ? '/' : dirname($lk_path).'/';
    241245        }
    242  
     246
    243247
    244248        // cached favicons filenames are build with prefix (for WPMU) and MD5 checksum from the favicon
     
    261265    /**
    262266     * 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
    264268     */
    265269    function loadClass($class,$filename) {
     
    308312    /**
    309313     * @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
    311315     * @return reference to List-Array with all favicon file basenames from cache directory.
    312316     */
     
    316320
    317321        // MD5 Strings are always 32 characters f.e. cc33ac77c986e91fb30604dd516a61c7
    318         $pattern = $this->cachedir.'/'.$this->prefix.'????????????????????????????????'; 
     322        $pattern = $this->cachedir.'/'.$this->prefix.'????????????????????????????????';
    319323        $items = @glob($pattern);
    320324        if ($items === false)
     
    359363        if ($offsetFromNow < $this->lastcheck)
    360364            return false;
    361            
     365
    362366        // Max. Laufzeit auf 5 Min. setzen
    363367        @ini_set('max_execution_time',300);
     
    370374Cache directory = '.$this->cachedir.'<br /></b>';
    371375
    372            
    373         # ---------- next stage 
     376
     377        # ---------- next stage
    374378        foreach(get_bookmarks() as $link) {
    375379            $this->putIconIntoCache($link,true);
     
    381385        ob_flush();
    382386        flush();
    383        
     387
    384388        return true;
    385389    }
     
    406410
    407411        // -------------- [Request URL analysieren] --------------
    408        
     412
    409413        if (!isset($_SERVER['REQUEST_URI']))
    410414            return false;
     
    474478     * Wandelt Backslashes einheitlich in Slashes um.
    475479     * Säubert den Pfad von "/" Dubletten
    476      * @param $path string contains the pathname 
     480     * @param $path string contains the pathname
    477481     */
    478482    function normalize($path) {
     
    492496    /**
    493497     * 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
    495499     */
    496500    function get_message($othermsg=null) {
    497501
    498         // non-admin 
     502        // non-admin
    499503        if (!is_admin() || $this->can_write_cache())
    500504            return $othermsg;
     
    520524     * from http://de3.php.net/is_writable
    521525     * 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
    523527     */
    524528    function is__writable($path) {
     
    545549    /**
    546550     * 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
    548552     */
    549553    function locateIcon($i_url) {
     
    652656    function patchPlugin($plugindir,$activate=false) {
    653657
    654         $result = null; 
     658        $result = null;
    655659
    656660        foreach (get_plugins() as $path => $data) {
     
    686690            default:
    687691                break;
    688         }           
     692        }
    689693
    690694        if ($activate) {
  • faviroll/trunk/faviroll.php

    r221490 r221691  
    55Description: 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 &raquo; Faviroll</a></strong>
    66Author: grobator
    7 Version:  0.4.6
     7Version:  0.4.7
    88Author URI:  http://www.grobator.de/
    99----------------------------------------------------------------------------------------
     
    9797            update_option('faviroll_default_favicon', (empty($defico) ? $faviroll->getFavirollDefaultIcon() : $defico));
    9898
    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') );
    102103
    103104            $message = 'Settings updated';
     
    113114    $is_transparency = (get_option('faviroll_transparency') == 'on');
    114115    $is_debugMode    = (get_option('faviroll_debug') == 'on');
     116    $use_stylesheet  = (get_option('faviroll_use_stylesheet') == 'on');
    115117
    116118    if (!$removeSettings) {
     
    140142    <table class="form-table" summary="">
    141143     <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>
    147149      <td><input type="text" name="faviroll_revisit" size="4" value="'.$revisit.'" /> days</td>
    148150     </tr>
    149151     <tr>
    150       <td scope="row">Use transparent background:</td>
     152      <td>make Favicon<br />background transparent:</td>
    151153      <td><input type="checkbox" name="faviroll_transparency" value="on"'.($is_transparency ? ' checked="checked"' : null).' /></td>
    152154     </tr>
    153155     <tr>
    154       <td scope="row">&nbsp;</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         &nbsp;&nbsp;&nbsp;
     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>
    160166     <tr>
    161167      <td><strong>Actions</strong></td>
    162168     </tr>
    163169     <tr>
    164       <td scope="row">(re)build FavIcons now:</td>
     170      <td>(re)build FavIcons now:</td>
    165171      <td><input type="checkbox" name="faviroll_renew_icons" value="true"'.(($faviroll->cacheIconsCount() == 0) ? ' checked="checked"' : null).' /></td>
    166172     </tr>
    167173     <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>
    169175      <td><input type="checkbox" name="faviroll_remove_settings" value="true" />
    170176     </tr>
     
    172178/*
    173179                <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).' /> &nbsp; ( 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).' /> &nbsp; ( just for Developers, normally switch off )
    176182                </tr>
    177183*/
     
    198204
    199205
    200 
    201 /**
    202  * Register Enqueue CSS
    203  */
    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 */
     209if (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}
    209215
    210216/**
  • faviroll/trunk/readme.txt

    r221490 r221691  
    55Requires at least: 2.7
    66Tested up to: 2.9.1, (WPMU 2.8.6)
    7 Stable tag: 0.4.6
     7Stable tag: 0.4.7
    88
    99Locally 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).
     
    3737* CLN = Cleanup/Refactoring
    3838* OTH = Other
     39
     40= 0.4.7 =
     41* FEA: Options has a new checkbox for disabling faviroll/style.css  (Request from Dixie)
    3942
    4043= 0.4.6 =
Note: See TracChangeset for help on using the changeset viewer.