Plugin Directory

Changeset 623890


Ignore:
Timestamp:
11/12/2012 05:59:24 AM (13 years ago)
Author:
vicchi
Message:

Committing v1.1 changes

Location:
wp-shortcode-shield/trunk
Files:
3 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • wp-shortcode-shield/trunk/readme.txt

    r536549 r623890  
    33Donate link: http://www.vicchi.org/codeage/donate/
    44Tags: page, post, shortcode, documentation
    5 Requires at least: 3.3
    6 Tested up to: 3.3.2
    7 Stable tag: 1.0.1
     5Requires at least: 3.4
     6Tested up to: 3.4.2
     7Stable tag: 1.1.0
     8License: GPLv2 or later
     9License URI: http://www.gnu.org/licenses/gpl-2.0.html
    810
    911Allows posts and pages to easily document WordPress shortcodes without the shortcode being expanded.
     
    6264= How do I get help or support for this plugin? =
    6365
    64 In short, very easily. But before you read any further, take a look at [Asking For WordPress Plugin Help And Support Without Tears](http://www.vicchi.org/2012/03/31/asking-for-wordpress-plugin-help-and-support-without-tears/) before firing off a question. In order of preference, you can ask a question on the [WordPress support forum](http://wordpress.org/tags/wp-shortcode-shield?forum_id=10); this is by far the best way so that other users can follow the conversation. You can ask me a question on Twitter; I'm [@vicchi](http://twitter.com/vicchi). Or you can drop me an email instead. I can't promise to answer your question but I do promise to answer and do my best to help.
     66In short, very easily. But before you read any further, take a look at [Asking For WordPress Plugin Help And Support Without Tears](http://www.vicchi.org/2012/03/31/asking-for-wordpress-plugin-help-and-support-without-tears/) before firing off a question. In order of preference, you can ask a question on the [WordPress support forum](http://wordpress.org/support/plugin/wp-shortcode-shield); this is by far the best way so that other users can follow the conversation. You can ask me a question on Twitter; I'm [@vicchi](http://twitter.com/vicchi). Or you can drop me an email instead. I can't promise to answer your question but I do promise to answer and do my best to help.
    6567
    6668= Is there a web site for this plugin? =
     
    7880== Changelog ==
    7981
    80 The current version is 1.0 (2012.04.24)
     82The current version is 1.1.0 (2012.11.12)
     83
     84= 1.1.0 =
     85* Released 2012.11.12
     86* Other: Upgraded plugin to new version of WP_PluginBase to prevent class name clashes during future upgrades.
     87* Other: Ensure WP_ShortCodeShield is not already defined and instantiate as a singleton.
     88* Other: Rename misleading plugin constants (they're square brackets not angle brackets)
     89
     90= 1.0.1 =
     91* Released 2012.08.29
     92* Fixed: Ensure WP_PluginBase is properly included and defined.
    8193
    8294= 1.0 =
     95* Released 2012.07.17
    8396* This is the first version of WP Shortcode Shield.
    8497
    8598== Upgrade Notice ==
    8699
     100= 1.1.0 =
     101Maintenance version; upgraded plugin to new version of WP_PluginBase to prevent class name clashes during future upgrades.
     102
     103= 1.0.1 =
     104Fixed a bug where WP_PluginBase is properly included and defined. This is the 2nd. version of WP Shortcode Shield.
     105
    87106= 1.0 =
    88107* This is the first version of WP Shortcode Shield.
  • wp-shortcode-shield/trunk/wp-shortcode-shield.php

    r536549 r623890  
    44Plugin URI: http://www.vicchi.org/codeage/wp-shortcode-shield/
    55Description: Allows posts and pages to easily document WordPress short-codes without the short-code being expanded.
    6 Version: 1.0.1
     6Version: 1.1.0
    77Author: Gary Gale
    88Author URI: http://www.garygale.com/
     
    1212define ('WPSHORTCODESHIELD_PATH', plugin_dir_path (__FILE__));
    1313
    14 require_once (WPSHORTCODESHIELD_PATH . '/wp-plugin-base/wp-plugin-base.php');
     14require_once (WPSHORTCODESHIELD_PATH . '/includes/wp-plugin-base/wp-plugin-base.php');
    1515
    16 class WP_ShortCodeShield extends WP_PluginBase {
    17     static $instance;
     16if (!class_exists ('WP_ShortCodeShield')) {
     17    class WP_ShortCodeShield extends WP_PluginBase_v1_1 {
     18        private static $instance;
    1819   
    19     const LANGB = '[';
    20     const RANGB = ']';
     20        const LSQB = '[';
     21        const RSQB = ']';
    2122   
    22     function __construct () {
    23         self::$instance = $this;
     23        /**
     24         * Class constructor
     25         */
    2426       
    25         $this->hook ('plugins_loaded');
    26     }
     27        private function __construct () {
     28            $this->hook ('plugins_loaded');
     29        }
    2730   
    28     function plugins_loaded () {
    29         add_shortcode ('wp_scs', array ($this, 'shortcode'));
    30         add_shortcode ('wp_shortcode_shield', array ($this, 'shortcode'));
    31     }
     31        /**
     32         * Class singleton factory helper
     33         */
     34       
     35        public static function get_instance () {
     36            if (!isset (self::$instance)) {
     37                $c = __CLASS__;
     38                self::$instance = new $c ();
     39            }
     40           
     41            return self::$instance;
     42           
     43        }
     44
     45        /**
     46         * "plugins_loaded" action hook; called after all active plugins and pluggable
     47         * functions are loaded.
     48         *
     49         * Add the shortcode support actions for the short form shortcode [wp_scs] and the
     50         * long form shortcode [wp_shortcode_shield].
     51         */
     52       
     53        public function plugins_loaded () {
     54            add_shortcode ('wp_scs', array ($this, 'shortcode'));
     55            add_shortcode ('wp_shortcode_shield', array ($this, 'shortcode'));
     56        }
    3257   
    33     function shortcode ($atts, $content=null) {
    34         extract (shortcode_atts (array ('code' => ''), $atts));
     58        /**
     59         * Shortcode handler for the [wp_scs] and [wp_shortcode_shield] shortcodes; expands
     60         * the shortcode to wrap the enclosed shortcode.
     61         */
    3562       
    36         // Self-closing shortcode form ...
    37         if (empty ($content) && !empty ($code)) {
    38             return $this->enclose ($code);
     63        public function shortcode ($atts, $content=null) {
     64            extract (shortcode_atts (array ('code' => ''), $atts));
     65       
     66            // Self-closing shortcode form ...
     67            if (empty ($content) && !empty ($code)) {
     68                return $this->enclose ($code);
     69            }
     70       
     71            // Enclosing shortcode form ...
     72            else {
     73                if (strpos ($content, '[') === false) {
     74                    return $this->enclose ($content);
     75                }
     76           
     77                else {
     78                    return $content;
     79                }
     80            }
     81        }
     82   
     83        /**
     84         * Helper function; encloses a section of content in square brackets [ ... ]
     85         */
     86       
     87        private function enclose ($content) {
     88            return self::LSQB . $content . self::RSQB;
    3989        }
    4090       
    41         // Enclosing shortcode form ...
    42         else {
    43             if (strpos ($content, '[') === false) {
    44                 return $this->enclose ($content);
    45             }
    46            
    47             else {
    48                 return $content;
    49             }
    50         }
    51     }
    52    
    53     function enclose ($content) {
    54         return self::LANGB . $content . self::RANGB;
    55     }
    56 }   // end-class WP_ShortCodeShield
     91    }   // end-class WP_ShortCodeShield
     92}   // if (!class_exists ('WP_ShortCodeShield'))
    5793
    58 $__wp_shortcode_shield_instance = new WP_ShortCodeShield;
     94WP_ShortCodeShield::get_instance ();
    5995
    6096?>
Note: See TracChangeset for help on using the changeset viewer.