Plugin Directory

Changeset 494545


Ignore:
Timestamp:
01/24/2012 10:06:41 AM (14 years ago)
Author:
moskis
Message:

*Plugin now checks that the smilies folder exists in the active theme. If it doesn't, it loads the default WordPress smilies and shows an error notice in the admin panel letting the user know he has to upload the smilies to the theme directory.

  • Tagging 1.1
Location:
custom-smilies-directory
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • custom-smilies-directory/trunk/custom-smilies-directory.php

    r494365 r494545  
    44Plugin URI: http://plugins.josepardilla.com/custom-smilies-directory/
    55Description: Light plugin that tells WordPress to load Smilies from your theme's directory. This allows you to use custom Smilies without loosing them when you update WordPress.
    6 Version: 1.0
     6Version: 1.1
    77Author: José Pardilla
    88Author URI: http://josepardilla.com/
    9 
    109*/
    1110
     
    1817 *
    1918 * @global array $wpsmiliestrans
    20  * @since 2.8.0
     19 * @since 1.0
    2120 *
    2221 * @param string $smiley Smiley code to convert to image.
     
    3938}
    4039
     40
    4141/**
    4242 * Convert text equivalent of smilies to images.
     
    4545 * used in the function isn't empty.
    4646 *
    47  * @since 0.71
     47 * @since 1.0
    4848 * @uses $wp_smiliessearch
    4949 *
     
    7474
    7575/**
    76  * Hook
     76 * Main Hook
    7777 */
    7878function jpm_custom_smilies_init() {
    79     remove_filter( 'the_content', 'convert_smilies' );
    80     remove_filter( 'the_excerpt', 'convert_smilies' );
    81     remove_filter( 'comment_text', 'convert_smilies' );
    82     add_filter( 'the_content', 'jpm_convert_smilies' );
    83     add_filter( 'the_excerpt', 'jpm_convert_smilies' );
    84     add_filter( 'comment_text', 'jpm_convert_smilies' );
     79    $smilies_path = STYLESHEETPATH . "/smilies/";
     80  if( file_exists($smilies_path) ) {
     81        remove_filter( 'the_content', 'convert_smilies' );
     82        remove_filter( 'the_excerpt', 'convert_smilies' );
     83        remove_filter( 'comment_text', 'convert_smilies' );
     84        add_filter( 'the_content', 'jpm_convert_smilies' );
     85        add_filter( 'the_excerpt', 'jpm_convert_smilies' );
     86        add_filter( 'comment_text', 'jpm_convert_smilies' );
     87    } else {
     88        add_action('admin_notices','jpm_convert_smilies_warning');
     89    }
     90}
     91add_action( 'init', 'jpm_custom_smilies_init' );
     92
     93
     94/**
     95 * Check for smilies directory in theme
     96 *
     97 * Will check that the smilies directory exists in the theme, and if it doesn't
     98 * show an admin panel error to let the user know.
     99 *
     100 * @since 1.1
     101 *
     102 */
     103function jpm_convert_smilies_warning() {
     104  echo '<div id="jpm-convert-smilies-warning" class="error"><p><strong>Custom Smilies Directory needs your attenttion:</strong> \'/smilies/\' directory not found in the current theme. You have to upload your new smilies to your theme directory for them to work!</p></div>';
    85105}
    86106
    87 add_action( 'init', 'jpm_custom_smilies_init' );
     107
    88108?>
  • custom-smilies-directory/trunk/readme.txt

    r494374 r494545  
    44Requires at least: 2.8
    55Tested up to: 3.3
    6 Stable tag: 1.0
     6Stable tag: 1.1
    77License: GPL/MIT
    88
     
    1313
    1414Custom Smilies Directory is a plugin that tells WordPress to load Smilies from your theme's directory. This allows you to use custom Smilies without loosing them when you update WordPress.
     15
     16Since version 1.1 plugin will check that the smilies folder exists in the active theme. If it doesn't, it will load the default WordPress smilies and show an error notice in the admin panel letting the user know he has to upload the smilies to the theme directory.
    1517
    1618
     
    2426This changelog is for the WordPress plugin. For the Fancybox main changelog go to its [home page](http://fancybox.net/changelog/).
    2527
     28= 1.1 =
     29* Plugin now checks that the smilies folder exists in the active theme. If it doesn't, it loads the default WordPress smilies and shows an error notice in the admin panel letting the user know he has to upload the smilies to the theme directory.
     30
    2631= 1.0 =
    2732* Initial release.
Note: See TracChangeset for help on using the changeset viewer.