Plugin Directory

Changeset 1155642


Ignore:
Timestamp:
05/07/2015 08:16:08 PM (11 years ago)
Author:
lrnz
Message:

[FEATURE] Version V 1.3.1

Location:
shortcodify
Files:
17 added
4 edited

Legend:

Unmodified
Added
Removed
  • shortcodify/trunk/lang/shortcodify-de_DE.po

    r689936 r1155642  
    1 # Copyright (C) 2013 Shortcodify
    2 # This file is distributed under the same license as the Shortcodify package.
    31msgid ""
    42msgstr ""
    5 "Project-Id-Version: Shortcodify 1.0.0\n"
     3"Project-Id-Version: Shortcodify v1.3.1\n"
    64"Report-Msgid-Bugs-To: http://wordpress.org/tag/shortcodify\n"
    75"POT-Creation-Date: 2013-02-10 21:20:14+00:00\n"
     6"PO-Revision-Date: 2015-05-07 20:01:33+0000\n"
     7"Last-Translator: Arne Lorenz <[email protected]>\n"
     8"Language-Team: Arne Lorenz <[email protected]>\n"
    89"MIME-Version: 1.0\n"
    910"Content-Type: text/plain; charset=UTF-8\n"
    1011"Content-Transfer-Encoding: 8bit\n"
    11 "PO-Revision-Date: 2013-02-10 22:26+0100\n"
    12 "Last-Translator: Arne Lorenz <[email protected]>\n"
    13 "Language-Team: Arne Lorenz <[email protected]>\n"
    14 "X-Generator: Poedit 1.5.5\n"
    15 "Language: German\n"
     12"Plural-Forms: nplurals=2; plural=n != 1;\n"
     13"X-Generator: Poedit 1.6.4\n"
     14"X-Poedit-Language: \n"
     15"X-Poedit-Country: \n"
    1616"X-Poedit-SourceCharset: UTF-8\n"
     17"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
     18"X-Poedit-Basepath: \n"
     19"X-Poedit-Bookmarks: \n"
     20"X-Poedit-SearchPath-0: .\n"
     21"X-Textdomain-Support: yes"
    1722
    18 #: shortcodify.php:78
     23#: shortcodify.php:75
     24#@ default
    1925msgid "Bookmarks"
    2026msgstr ""
    2127
    22 #: shortcodify.php:196
    23 msgid "Shortcodify Menu"
    24 msgstr ""
     28#: shortcodify.php:326
     29#: shortcodify.php:338
     30#@ shortcodify
     31msgid "Add this widget to an other textfield with [widget]"
     32msgstr "Füge dieses Widget im Textfeld mittels [widget] hinzu"
    2533
    26 #: shortcodify.php:235
    27 msgid "Add this widget to an other textfield with [widget]"
    28 msgstr ""
    29 
    30 #: shortcodify.php:301 shortcodify.php:342
     34#: shortcodify.php:402
     35#: shortcodify.php:434
     36#@ shortcodify
    3137msgid "Settings"
    3238msgstr "Einstellungen"
    3339
    34 #: shortcodify.php:329
     40#: shortcodify.php:421
     41#@ shortcodify
    3542msgid "Success! Your changes were successfully saved!"
    3643msgstr "Ihre Einstellungen wurde gespeichert"
    3744
    38 #: shortcodify.php:332
     45#: shortcodify.php:423
     46#@ shortcodify
    3947msgid "Whoops! There was a problem with the data you posted. Please try again."
    40 msgstr ""
     48msgstr "Uups... es gab ein Problem mit den Daten. Bitte versuche es nochmal."
    4149
    42 #: shortcodify.php:339
     50#: shortcodify.php:430
     51#@ shortcodify
    4352msgid "Shortcodify settings"
    4453msgstr "Shortcodify Einstellungen"
    4554
    46 #: shortcodify.php:343
    47 msgid ""
    48 "See all possible shortcodes <a href=\"http://www.arnelorenz.de/shortcodify/"
    49 "\">here</a>"
    50 msgstr ""
    51 "Eine Liste aller verfügbaren Shortcodes unter: <a href=\"http://www."
    52 "arnelorenz.de/shortcodify/\">here</a>"
     55#: shortcodify.php:435
     56#@ shortcodify
     57msgid "See all possible shortcodes <a href=\"http://www.arnelorenz.de/shortcodify/\">here</a>"
     58msgstr "Eine Liste aller verfügbaren Shortcodes unter: <a href=\"http://www.arnelorenz.de/shortcodify/\">here</a>"
    5359
    54 #: shortcodify.php:347
     60#: shortcodify.php:439
     61#@ shortcodify
    5562msgid "Create widget-shortcode"
    56 msgstr ""
     63msgstr "Widget Shortcode erzeugen"
    5764
    58 #: shortcodify.php:350
    59 msgid "Creates a widget-area for a shortcode. Use it with [widget] "
    60 msgstr ""
    61 
    62 #: shortcodify.php:353
     65#: shortcodify.php:460
     66#@ shortcodify
    6367msgid "Create menu-shortcode"
    6468msgstr "Menü-Shortcode erstellen"
    6569
    66 #: shortcodify.php:356
    67 msgid ""
    68 "Creates a menu-area for a shortcode. Create a new menu e.g. for a sitemap. "
    69 "Use shortcode with [menu] "
     70#: shortcodify.php:464
     71#@ shortcodify
     72msgid "Creates a menu-area for a shortcode. Create a new menu e.g. for a sitemap. Use shortcode with [menu] "
     73msgstr "Menu Bereich für Shortcodes erstellen. Das Menü kann als Sitemap o.Ä. genutzt werden. Einfügen über [menu]"
     74
     75#: shortcodify.php:259
     76#@ default
     77msgid "Shortcodify Menu, for sitemaps"
    7078msgstr ""
    7179
    72 #: shortcodify.php:360
    73 msgid "Before Markup:"
    74 msgstr ""
     80#: shortcodify.php:443
     81#@ shortcodify
     82msgid "Creates a widget-area for a shortcode. Use it with [widget]"
     83msgstr "Erzeugt einen neuen Widget-Bereich, der durch [widget] in die Seite eingefügt werden kann."
    7584
    76 #: shortcodify.php:362
    77 msgid "The HTML markup to display before the pagination code."
    78 msgstr ""
     85#: shortcodify.php:447
     86#@ shortcodify
     87msgid "Number of widgets to create"
     88msgstr "Anzahl der neuen Widget-Bereiche"
    7989
    80 #: shortcodify.php:365
    81 msgid "After Markup:"
    82 msgstr ""
     90#: shortcodify.php:456
     91#@ shortcodify
     92msgid "Select the number of widgets you want to create."
     93msgstr "Wähle die Anzahl der neuen Widgets aus."
    8394
    84 #: shortcodify.php:367
    85 msgid "The HTML markup to display after the pagination code."
    86 msgstr ""
     95#: shortcodify.php:468
     96#@ shortcodify
     97msgid "Create accordion-shortcode"
     98msgstr "Erstelle ein Accordion-Widget"
    8799
    88 #: shortcodify.php:370
    89 msgid "WP-Paginate CSS File:"
    90 msgstr ""
     100#: shortcodify.php:472
     101#@ shortcodify
     102msgid "Creates a <a href=\"http://jqueryui.com/accordion/\" target=\"_blank\">accordion</a> shortcode. "
     103msgstr "Erstellt ein <a href=\"http://jqueryui.com/accordion/\" target=\"_blank\">Accordion</a> Shortcode. Der später genutzt werden kann."
    91104
    92 #: shortcodify.php:372
    93 msgid ""
    94 "Include the default stylesheet wp-paginate.css? WP-Paginate will first look "
    95 "for <code>wp-paginate.css</code> in your theme directory (<code>themes/%s</"
    96 "code>)."
    97 msgstr ""
     105#: shortcodify.php:478
     106#@ shortcodify
     107msgid "Save Changes"
     108msgstr "Speichern"
    98109
    99 #: shortcodify.php:375
    100 msgid "Page Range:"
    101 msgstr ""
    102 
    103 #: shortcodify.php:382
    104 msgid ""
    105 "The number of page links to show before and after the current page. "
    106 "Recommended value: 3"
    107 msgstr ""
    108 
    109 #: shortcodify.php:385
    110 msgid "Page Anchors:"
    111 msgstr ""
    112 
    113 #: shortcodify.php:392
    114 msgid ""
    115 "The number of links to always show at beginning and end of pagination. "
    116 "Recommended value: 1"
    117 msgstr ""
    118 
    119 #: shortcodify.php:395
    120 msgid "Page Gap:"
    121 msgstr ""
    122 
    123 #: shortcodify.php:402
    124 msgid ""
    125 "The minimum number of pages in a gap before an ellipsis (...) is added. "
    126 "Recommended value: 3"
    127 msgstr ""
    128 
    129 #. Plugin Name of the plugin/theme
    130 msgid "Shortcodify"
    131 msgstr ""
    132 
    133 #. #-#-#-#-#  plugin.pot (Shortcodify 1.0.0)  #-#-#-#-#
    134 #. Plugin URI of the plugin/theme
    135 #. #-#-#-#-#  plugin.pot (Shortcodify 1.0.0)  #-#-#-#-#
    136 #. Author URI of the plugin/theme
    137 msgid "http://www.arnelorenz.de/"
    138 msgstr ""
    139 
    140 #. Description of the plugin/theme
    141 msgid "Plugin to add shortcodes"
    142 msgstr "Plugin um nützliche Shortcodes zu WordPress hinzuzufügen"
    143 
    144 #. Author of the plugin/theme
    145 msgid "Arne Lorenz"
    146 msgstr ""
  • shortcodify/trunk/readme.txt

    r690031 r1155642  
    44Tags: shortcode,shortcodes,tiny,rte,widget,widgets,menu,sitemap,menu,menus
    55Requires at least: 3.0
    6 Tested up to: 3.5.1
     6Tested up to: 4.2.2
    77Stable tag: 1.3.0
    88License: GPLv2 or later
     
    3838Please send me a request!
    3939
    40 Version: 1.3.0
     40Version: 1.3.1
    4141
    4242== Installation ==
     
    6161
    6262== Changelog ==
     63= 1.3.1 =
     64Code cleanup, testing up to newest WordPress version, German Translation
     65
    6366= 1.3.0 =
    6467New shortcode: accordion, multiple widget areas
     
    7578
    7679== Upgrade notice ==
    77 = 1.3.0 =
    78 Multiple widget areas possible
     80= 1.3.1 =
     81Code cleanup, testing up to newest WordPress version
  • shortcodify/trunk/shortcodify.php

    r689936 r1155642  
    11<?php
    22/*
    3 Copyright: © 2012 LRNZ ( coded in germany )
    4 <mailto:[email protected]> <http://www.arnelorenz.de/>
     3Copyright: © 2015 art@tec
     4<mailto:[email protected]> <http://www.art-at-tec.de/>
    55
    66Released under the terms of the GNU General Public License.
     
    1010*/
    1111/*
    12 Version: 1.3.0
    13 
    14 Author URI: http://www.arnelorenz.de/
     12Version: 1.3.1
     13
     14Author URI: http://www.art-at-tec.de/
    1515Author: Arne Lorenz
    1616
    1717Plugin Name: Shortcodify
    18 Plugin URI: http://www.arnelorenz.de/
     18Plugin URI: http://www.arnelorenz.de/shortcodify/
    1919Description: Plugin to add shortcodes
    2020*/
    2121
    22 if (!class_exists('shortcodify')) {
     22if ( ! class_exists( 'shortcodify' ) ) {
    2323    class shortcodify {
    2424        /**
    2525         * @var string The plugin version
    2626         */
    27         var $version = '1.3.0';
     27        var $version = '1.3.1';
    2828        /**
    2929         * @var string The options string name for this plugin
     
    4242        var $activeFunctions = array();
    4343        var $bookmark_args = array();
    44            
     44
    4545        /**
    4646         * @var array $options Stores the options for this plugin
    4747         */
    4848        var $options = array();
    49         /**
    50          * PHP 4 Compatible Constructor
    51          */
    52         function test() {$this->__construct();}
     49
    5350
    5451        /**
     
    5653         */
    5754        function __construct() {
    58             $name = dirname(plugin_basename(__FILE__));
     55            $name                     = dirname( plugin_basename( __FILE__ ) );
    5956            $this->localizationDomain = $name;
    6057            //Language Setup
    61             load_plugin_textdomain($this->localizationDomain, false, $name.'/lang/');
     58            load_plugin_textdomain( $this->localizationDomain, FALSE, $name . '/lang/' );
    6259
    6360            //"Constants" setup
    64             $this->pluginurl = plugins_url($name) . "/";
     61            $this->pluginurl  = plugins_url( $name ) . "/";
    6562            $this->pluginpath = WP_PLUGIN_DIR . "/$name/";
    66            
     63
    6764            $this->bookmark_args = array(
    68                 'orderby'          => 'name',
    69                 'order'            => 'ASC',
    70                 'limit'            => -1,
    71                 'category'         => '',
    72                 'exclude_category' => '',
    73                 'category_name'    => '',
    74                 'hide_invisible'   => 1,
    75                 'show_updated'     => 0,
    76                 'echo'             => 0,
    77                 'categorize'       => 1,
    78                 'title_li'         => __('Bookmarks'),
    79                 'title_before'     => '<h2>',
    80                 'title_after'      => '</h2>',
    81                 'category_orderby' => 'name',
    82                 'category_order'   => 'ASC',
    83                 'class'            => 'linkcat',
    84                 'category_before'  => '<li id=%id class=%class>',
    85                 'category_after'   => '</li>' );
    86                
     65                'orderby'          => 'name',
     66                'order'            => 'ASC',
     67                'limit'            => - 1,
     68                'category'         => '',
     69                'exclude_category' => '',
     70                'category_name'    => '',
     71                'hide_invisible'   => 1,
     72                'show_updated'     => 0,
     73                'echo'             => 0,
     74                'categorize'       => 1,
     75                'title_li'         => __( 'Bookmarks' ),
     76                'title_before'     => '<h2>',
     77                'title_after'      => '</h2>',
     78                'category_orderby' => 'name',
     79                'category_order'   => 'ASC',
     80                'class'            => 'linkcat',
     81                'category_before'  => '<li id=%id class=%class>',
     82                'category_after'   => '</li>'
     83            );
     84
    8785            //Initialize the options
    8886            $this->get_options();
    89            
     87
    9088            // which shortcodes are active?
    9189            $this->check_active_functions();
    92            
     90
    9391            //Actions
    9492            $this->create_Actions();
    95            
     93
    9694            // ADD the shortcodes
    9795            $this->create_shortcode();
    98            
    99         }
    100        
     96
     97        }
     98
    10199// ----  -----------
    102100
    103         private function check_active_functions(){
     101        private function check_active_functions() {
    104102            $this->activeFunctions = array(
    105103                'wsc',
     
    111109                'links',
    112110                'random'
    113             ) ;
    114         }
    115        
    116         private function create_Actions(){
     111            );
     112            /* todo:
     113            - analytics opt out
     114            - post content
     115            - meta options
     116            */
     117        }
     118
     119        private function create_Actions() {
    117120            // WP Admin Menu entry
    118             add_action('admin_menu', array(&$this, 'admin_menu_link'));
    119         }
    120        
    121         private function create_shortcode(){
     121            add_action( 'admin_menu', array( &$this, 'admin_menu_link' ) );
     122        }
     123
     124        private function create_shortcode() {
    122125            // SHORTCODES
    123            
    124             foreach($this->activeFunctions as $name)
    125             {
    126                 add_shortcode( $name, array(&$this, $name) );   
    127             }
    128            
     126
     127            foreach ( $this->activeFunctions as $name ) {
     128                add_shortcode( $name, array( &$this, $name ) );
     129            }
     130
    129131            // To use a widget-area in a shortcode
    130             if($this->options['sc_widget'])
    131             {
     132            if ( $this->options['sc_widget'] ) {
    132133                $this->useWidgets();
    133134            }
    134            
     135
    135136            // To use a menu in a widget
    136             if($this->options['sc_menu'])
    137             {
     137            if ( $this->options['sc_menu'] ) {
    138138                $this->useMenus();
    139139            }
    140            
     140
    141141            // To use a accordion
    142             if($this->options['sc_accordion'])
    143             {
     142            if ( $this->options['sc_accordion'] ) {
    144143                $this->useAccordion();
    145144            }
    146145        }
    147        
     146
    148147        /*
    149148            Function for small shortcode handling
    150149            instead of: function wrap_shortcode_func($atts, $content= NULL)
    151150        */
    152         public function __call($name, $argumente) {
     151        public function __call( $name, $argumente ) {
    153152            // for calling the widget functions
    154             if(substr($name, 0, 12) == 'createWidget'){
    155                 $parts = explode('-', $name);
    156                 $name = $parts[0];
     153            if ( substr( $name, 0, 12 ) == 'createWidget' ) {
     154                $parts  = explode( '-', $name );
     155                $name   = $parts[0];
    157156                $number = $parts[1];
    158157            }
    159            
    160             $atts = $argumente[0];
     158
     159            $atts    = $argumente[0];
    161160            $content = $argumente[1];
    162             switch($name){
     161            switch ( $name ) {
    163162                case 'hr':
    164163                    $rtn = '<hr class="clear" style="clear: both">';
    165                 break;
     164                    break;
    166165                case 'date':
    167                     $rtn = '<span class="sc_date">'.date_i18n( get_option('date_format') ).'</span>';
    168                 break;
     166                    $rtn = '<span class="sc_date">' . date_i18n( get_option( 'date_format' ) ) . '</span>';
     167                    break;
    169168                case 'time':
    170                     $rtn = '<span class="sc_time">'.date_i18n( get_option('time_format') ).'</span>';
    171                 break;
     169                    $rtn = '<span class="sc_time">' . date_i18n( get_option( 'time_format' ) ) . '</span>';
     170                    break;
    172171                case 'br':
    173172                    $rtn = '<br class="clear" style="clear: both">';
    174                 break;
     173                    break;
    175174                case 'unshortcode':
    176175                    $rtn = $content;
    177                 break;
     176                    break;
    178177                case 'wsc':
    179                     //return '<span class="wrap_shortcode '.$atts['class'].'">'.apply_filters('the_content', $content).'</span>';
    180                     $rtn = '<span class="wrap_shortcode '.$atts['link'].'">'.do_shortcode($content).'</span>';
    181                 break;
    182                 case 'links':                     
     178                    $rtn = '<span class="wrap_shortcode ' . $atts['link'] . '">' . do_shortcode( $content ) . '</span>';
     179                    break;
     180                case 'links':
    183181                    $html = wp_list_bookmarks( $this->bookmark_args );
    184                     $rtn = '<ul class="shortcodify_links">'.$html.'</ul>';
    185                 break;
     182                    $rtn  = '<ul class="shortcodify_links">' . $html . '</ul>';
     183                    break;
    186184                case 'random':
    187                     if( isset( $atts['trennzeichen'] ) ) $trenner = $atts['trennzeichen'];
    188                     elseif( isset( $atts['separator'] ) ) $trenner = $atts['separator'];
    189                     else {$trenner = PHP_EOL;}
    190                    
    191                     $content = explode($trenner, $content);
    192                     $rnd = rand(0, count($content) - 1);
    193                     $rtn = '<span class="wrap_shortcode random">'.do_shortcode( $content[ $rnd ] ).'</span>';
    194                 break;
     185                    if ( isset( $atts['trennzeichen'] ) ) {
     186                        $trenner = $atts['trennzeichen'];
     187                    } elseif ( isset( $atts['separator'] ) ) {
     188                        $trenner = $atts['separator'];
     189                    } else {
     190                        $trenner = PHP_EOL;
     191                    }
     192
     193                    $content = explode( $trenner, $content );
     194                    $rnd     = rand( 0, count( $content ) - 1 );
     195                    $rtn     = '<span class="wrap_shortcode random">' . do_shortcode( $content[ $rnd ] ) . '</span>';
     196                    break;
    195197                case 'createWidget':
    196                     $html = $this->getWidgetContent('Shortcodify '.$number);
    197                     return '<div class="shortcodify_widget sc_w'.$number.'">'.$html.'</div>';
    198                 break;
     198                    $html = $this->getWidgetContent( 'Shortcodify ' . $number );
     199
     200                    return '<div class="shortcodify_widget sc_w' . $number . '">' . $html . '</div>';
     201                    break;
    199202                default:
    200203                    $rtn = $content;
    201204            }
     205
    202206            return $rtn;
    203207        }
    204208
    205         function useWidgets(){
    206             add_action( 'widgets_init', array(&$this, 'shortcodify_widgets_init') );
    207             add_shortcode( 'widget', array(&$this, 'createWidget') );
    208             for ($i=1; $i<= $this->options['sc_widget_number']+1; $i++){
     209        function useWidgets() {
     210            add_action( 'widgets_init', array( &$this, 'shortcodify_widgets_init' ) );
     211            add_shortcode( 'widget', array( &$this, 'createWidget' ) );
     212            for ( $i = 1; $i <= $this->options['sc_widget_number'] + 1; $i ++ ) {
    209213                // i dont know how to give this function-call an parameter :(
    210214                // so i use this _call method
    211                 add_shortcode( 'widget'.$i, array(&$this, 'createWidget-'.$i ) );
    212             }
    213         }
    214        
    215         function useAccordion(){
    216             //Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
    217             add_action( 'wp_enqueue_scripts', array(&$this,'loadCss') );
    218             add_action( 'wp_enqueue_scripts', array(&$this,'loadJs') );
    219             add_shortcode( 'accordion', array(&$this, 'createAccordion') );
    220             add_shortcode( 'section', array(&$this, 'createAccordionSection') );
    221         }
     215                add_shortcode( 'widget' . $i, array( &$this, 'createWidget-' . $i ) );
     216            }
     217        }
     218
     219        function useAccordion() {
     220            //Register with hook 'wp_enqueue_scripts', which can be used for front end CSS and JavaScript
     221            add_action( 'wp_enqueue_scripts', array( &$this, 'loadCss' ) );
     222            add_action( 'wp_enqueue_scripts', array( &$this, 'loadJs' ) );
     223            add_shortcode( 'accordion', array( &$this, 'createAccordion' ) );
     224            add_shortcode( 'section', array( &$this, 'createAccordionSection' ) );
     225        }
     226
    222227        function loadJs() {
    223             wp_enqueue_script('jquery');
    224             wp_enqueue_script('jquery-ui-accordion');
    225             wp_enqueue_script(
     228            wp_enqueue_script( 'jquery' );
     229            wp_enqueue_script( 'jquery-ui-accordion' );
     230            wp_enqueue_script(
    226231                'shortcodify',
    227                 plugins_url('/js/shortcodify.js', __FILE__),
    228                 array('jquery'),
    229                 false,
    230                 true
     232                plugins_url( '/js/shortcodify.js', __FILE__ ),
     233                array( 'jquery' ),
     234                FALSE,
     235                TRUE
    231236            );
    232         }
    233         /**
    234          * Enqueue plugin style-file
    235          */
    236         function loadCss() {
    237             // Respects SSL, Style.css is relative to the current file
    238             // this css changes some font-sizes etc. :(
    239             //wp_register_style( 'jquery-ui-default', 'http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css' );
    240             //wp_enqueue_style( 'jquery-ui-default' );
    241             // we use this
    242             wp_register_style( 'shortcodify', plugins_url('css/shortcodify.css', __FILE__) );
    243             wp_enqueue_style( 'shortcodify' );
    244         }
    245        
    246         function useMenus(){
    247             add_action( 'init', array(&$this, 'register_my_menus') );
    248             add_shortcode( 'menu', array(&$this, 'createMenu') );
    249         }
    250        
     237        }
     238
     239        /**
     240         * Enqueue plugin style-file
     241         */
     242        function loadCss() {
     243            // Respects SSL, Style.css is relative to the current file
     244            // this css changes some font-sizes etc. :(
     245            //wp_register_style( 'jquery-ui-default', 'http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css' );
     246            //wp_enqueue_style( 'jquery-ui-default' );
     247            // we use this
     248            wp_register_style( 'shortcodify', plugins_url( 'css/shortcodify.css', __FILE__ ) );
     249            wp_enqueue_style( 'shortcodify' );
     250        }
     251
     252        function useMenus() {
     253            add_action( 'init', array( &$this, 'register_my_menus' ) );
     254            add_shortcode( 'menu', array( &$this, 'createMenu' ) );
     255        }
     256
    251257        function register_my_menus() {
    252             register_nav_menus( array(
    253                     'Shortcodify' => __('Shortcodify Menu, for sitemaps')
     258            register_nav_menus( array(
     259                'Shortcodify' => __( 'Shortcodify Menu, for sitemaps' )
    254260            ) );
    255261        }
    256262
    257         static function getWidgetContent($area = 'Shortcodify'){
     263        static function getWidgetContent( $area = 'Shortcodify' ) {
    258264            ob_start();
    259             dynamic_sidebar($area);
     265            dynamic_sidebar( $area );
    260266            $html = ob_get_contents();
    261267            ob_end_clean();
    262            
    263             return $html;           
    264         }       
    265        
    266         function createWidget($number) {
    267             $html = $this->getWidgetContent('Shortcodify '.$number);
    268             return '<div class="shortcodify_widget sc_w'.$number.'">'.$html.'</div>';
    269         }   
    270        
     268
     269            return $html;
     270        }
     271
     272        function createWidget( $number ) {
     273            $html = $this->getWidgetContent( 'Shortcodify ' . $number );
     274
     275            return '<div class="shortcodify_widget sc_w' . $number . '">' . $html . '</div>';
     276        }
     277
    271278        // menu shortcode output
    272279        function createMenu() {
    273280            ob_start();
    274             wp_nav_menu( array('menu' => 'Shortcodify' ));
     281            wp_nav_menu( array( 'menu' => 'Shortcodify' ) );
    275282            $html = ob_get_contents();
    276283            ob_end_clean();
    277            
    278             return '<div class="shortcodify_menu">'.$html.'</div>';
    279         }
    280 
    281         function createAccordion($atts, $content = NULL){
     284
     285            return '<div class="shortcodify_menu">' . $html . '</div>';
     286        }
     287
     288        function createAccordion( $atts, $content = NULL ) {
    282289            //$atts['link']
    283             if(isset($atts['type'])) $name = $atts['type'];
    284             else $name = 'no-auto';
    285            
    286             $ausgabe = trim($content);
     290            if ( isset( $atts['type'] ) ) {
     291                $name = $atts['type'];
     292            } else {
     293                $name = 'no-auto';
     294            }
     295
     296            $ausgabe = trim( $content );
    287297            //preg_match_all('/\[section\].*\[\/section\]/', $content, $ausgabe);
    288            
     298
    289299            // remove whitespace at beginning
    290             $ausgabe = preg_replace('/\A.*?\[section/s', '[section', $ausgabe);
     300            $ausgabe = preg_replace( '/\A.*?\[section/s', '[section', $ausgabe );
    291301            // remove whitespace at end of sting
    292             $ausgabe = preg_replace('/\A.*?\]noitces\/\[/s', ']noitces/[', strrev($ausgabe));
    293             $ausgabe = strrev($ausgabe);
     302            $ausgabe = preg_replace( '/\A.*?\]noitces\/\[/s', ']noitces/[', strrev( $ausgabe ) );
     303            $ausgabe = strrev( $ausgabe );
    294304            // remove whitespace between tags
    295             $ausgabe = preg_replace('/\[\/section\].*?\[section/s', '[/section][section', $ausgabe);
    296            
    297             $rtn = '<div class="sc_accordion '.$name.'">'.do_shortcode( $ausgabe ).'</div>';
     305            $ausgabe = preg_replace( '/\[\/section\].*?\[section/s', '[/section][section', $ausgabe );
     306
     307            $rtn = '<div class="sc_accordion ' . $name . '">' . do_shortcode( $ausgabe ) . '</div>';
     308
    298309            return $rtn;
    299310        }
    300         function createAccordionSection($atts, $content = NULL){
    301             $rtn = '<h3>'.$atts['name'].'</h3><div>'.do_shortcode($content).'</div>';
     311
     312        function createAccordionSection( $atts, $content = NULL ) {
     313            $rtn = '<h3>' . $atts['name'] . '</h3><div>' . do_shortcode( $content ) . '</div>';
     314
    302315            return $rtn;
    303316        }
     317
    304318        /**
    305319         * Adds a widget Area
    306320         *
    307321         */
    308         function shortcodify_widgets_init()
    309         {
     322        function shortcodify_widgets_init() {
    310323            $conf = array(
    311                 'name' => 'Shortcodify',
    312                 'id' => 'shortcodify',
    313                 'description' => __( 'Add this widget to an other textfield with [widget]' , $this->localizationDomain),
     324                'name'          => 'Shortcodify',
     325                'id'            => 'shortcodify',
     326                'description'   => __( 'Add this widget to an other textfield with [widget]', $this->localizationDomain ),
    314327                'before_widget' => '<p class="shortcodify_widget">',
    315                 'after_widget' => '</p>',
    316                 'before_title' => '<h2>',
    317                 'after_title' => '</h2>',
     328                'after_widget'  => '</p>',
     329                'before_title'  => '<h2>',
     330                'after_title'   => '</h2>',
    318331            );
    319332            register_sidebar( $conf );
    320            
    321             for ($i=1; $i<=$this->options['sc_widget_number']+1; $i++){
     333
     334            for ( $i = 1; $i <= $this->options['sc_widget_number'] + 1; $i ++ ) {
    322335                $conf = array(
    323                     'name' => 'Shortcodify '.$i,
    324                     'id' => 'shortcodify'.$i,
    325                     'description' => __( 'Add this widget to an other textfield with [widget'.$i.']' , $this->localizationDomain),
    326                     'before_widget' => '<p class="shortcodify_widget sc_w'.$i.'">',
    327                     'after_widget' => '</p>',
    328                     'before_title' => '<h2>',
    329                     'after_title' => '</h2>',
     336                    'name'          => 'Shortcodify ' . $i,
     337                    'id'            => 'shortcodify' . $i,
     338                    'description'   => __( 'Add this widget to an other textfield with [widget' . $i . ']', $this->localizationDomain ),
     339                    'before_widget' => '<p class="shortcodify_widget sc_w' . $i . '">',
     340                    'after_widget'  => '</p>',
     341                    'before_title'  => '<h2>',
     342                    'after_title'   => '</h2>',
    330343                );
    331344                register_sidebar( $conf );
     
    338351         */
    339352        function get_options() {
    340             if (!$options = get_option($this->optionsName)) {
     353            if ( ! $options = get_option( $this->optionsName ) ) {
    341354                $options = array(
    342                     'sc_widget' => true,
     355                    'sc_widget'        => TRUE,
    343356                    'sc_widget_number' => 0,
    344                     'sc_menu' => true,
    345                     'sc_accordion' => true
     357                    'sc_menu'          => TRUE,
     358                    'sc_accordion'     => TRUE
    346359                    /*
    347360                    'title' => 'Pages:',
     
    357370                    */
    358371                );
    359                 update_option($this->optionsName, $options);
     372                update_option( $this->optionsName, $options );
    360373            }
    361374            $this->options = $options;
    362375        }
     376
    363377        /**
    364378         * Saves the admin options to the database.
    365379         */
    366         function save_admin_options(){
    367             return update_option($this->optionsName, $this->options);
     380        function save_admin_options() {
     381            return update_option( $this->optionsName, $this->options );
    368382        }
    369383
     
    372386         */
    373387        function admin_menu_link() {
    374             add_options_page('Shortcodify', 'Shortcodify', 'manage_options', basename(__FILE__), array(&$this, 'admin_options_page'));
    375             add_filter('plugin_action_links_' . plugin_basename(__FILE__), array(&$this, 'filter_plugin_actions'), 10, 2 );
     388            add_options_page( 'Shortcodify', 'Shortcodify', 'manage_options', basename( __FILE__ ), array(
     389                &$this,
     390                'admin_options_page'
     391            ) );
     392            add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array(
     393                &$this,
     394                'filter_plugin_actions'
     395            ), 10, 2 );
    376396        }
    377397
     
    379399         * @desc Adds the Settings link to the plugin activate/deactivate page
    380400         */
    381         function filter_plugin_actions($links, $file) {
    382             $settings_link = '<a href="options-general.php?page=' . basename(__FILE__) . '">' . __('Settings', $this->localizationDomain) . '</a>';
    383             array_unshift($links, $settings_link); // before other links
     401        function filter_plugin_actions( $links, $file ) {
     402            $settings_link = '<a href="options-general.php?page=' . basename( __FILE__ ) . '">' . __( 'Settings', $this->localizationDomain ) . '</a>';
     403            array_unshift( $links, $settings_link ); // before other links
    384404
    385405            return $links;
     
    390410         */
    391411        function admin_options_page() {
    392             if (isset($_POST['wp_test_save'])) {
    393                 if (wp_verify_nonce($_POST['_wpnonce'], 'wp-test-update-options')) {
    394                     $this->options['sc_widget'] = (isset($_POST['sc_widget']) && $_POST['sc_widget'] === 'on') ? true : false;
    395                     $this->options['sc_widget_number'] = (int)$_POST['sc_widget_number'];
    396                    
    397                     $this->options['sc_menu'] = (isset($_POST['sc_menu']) && $_POST['sc_menu'] === 'on') ? true : false;
    398                     $this->options['sc_accordion'] = (isset($_POST['sc_accordion']) && $_POST['sc_accordion'] === 'on') ? true : false;
    399                     /*
    400                     $this->options['title'] = $_POST['title'];
    401                     $this->options['previouspage'] = $_POST['previouspage'];
    402                     $this->options['nextpage'] = $_POST['nextpage'];
    403                     $this->options['before'] = $_POST['before'];
    404                     $this->options['after'] = $_POST['after'];
    405                     $this->options['css'] = (isset($_POST['css']) && $_POST['css'] === 'on') ? true : false;
    406                     $this->options['range'] = intval($_POST['range']);
    407                     $this->options['anchor'] = intval($_POST['anchor']);
    408                     $this->options['gap'] = intval($_POST['gap']);
    409                     */
     412            if ( isset( $_POST['wp_test_save'] ) ) {
     413                if ( wp_verify_nonce( $_POST['_wpnonce'], 'wp-test-update-options' ) ) {
     414                    $this->options['sc_widget']        = ( isset( $_POST['sc_widget'] ) && $_POST['sc_widget'] === 'on' ) ? TRUE : FALSE;
     415                    $this->options['sc_widget_number'] = (int) $_POST['sc_widget_number'];
     416
     417                    $this->options['sc_menu']      = ( isset( $_POST['sc_menu'] ) && $_POST['sc_menu'] === 'on' ) ? TRUE : FALSE;
     418                    $this->options['sc_accordion'] = ( isset( $_POST['sc_accordion'] ) && $_POST['sc_accordion'] === 'on' ) ? TRUE : FALSE;
    410419                    $this->save_admin_options();
    411420
    412                     echo '<div class="updated"><p>' . __('Success! Your changes were successfully saved!', $this->localizationDomain) . '</p></div>';
     421                    echo '<div class="updated"><p>' . __( 'Success! Your changes were successfully saved!', $this->localizationDomain ) . '</p></div>';
     422                } else {
     423                    echo '<div class="error"><p>' . __( 'Whoops! There was a problem with the data you posted. Please try again.', $this->localizationDomain ) . '</p></div>';
    413424                }
    414                 else {
    415                     echo '<div class="error"><p>' . __('Whoops! There was a problem with the data you posted. Please try again.', $this->localizationDomain) . '</p></div>';
    416                 }
    417             }
    418 ?>
    419 
    420 <div class="wrap">
    421 <div class="icon32" id="icon-options-general"><br/></div>
    422 <h2><?php _e('Shortcodify settings', $this->localizationDomain); ?></h2>
    423 <form method="post" id="wp_test_options">
    424 <?php wp_nonce_field('wp-test-update-options'); ?>
    425     <h3><?php _e('Settings', $this->localizationDomain); ?></h3>
    426     <h5><?php _e('See all possible shortcodes <a href="http://www.arnelorenz.de/shortcodify/">here</a>', $this->localizationDomain); ?></h5>
    427     <table class="form-table">
    428    
    429         <tr valign="top">
    430             <th scope="row"><?php _e('Create widget-shortcode', $this->localizationDomain); ?></th>
    431             <td><label for="empty">
    432                 <input type="checkbox" id="sc_widget" name="sc_widget" <?php echo ($this->options['sc_widget'] === true) ? "checked='checked'" : ""; ?>/> <?php
    433                 _e('Creates a widget-area for a shortcode. Use it with [widget]', $this->localizationDomain); ?></label></td>
    434         </tr>
    435         <tr valign="top">
    436             <th scope="row"><?php _e('Number of widgets to create', $this->localizationDomain); ?></th>
    437             <td>
    438                 <select name="sc_widget_number" id="sc_widget_number">
    439                 <?php for ($i=0; $i<= 20; $i++) : ?>
    440                     <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['sc_widget_number']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
    441                 <?php endfor; ?>
    442                 </select>
    443                 <span class="description"><?php _e('Select the number of widgets you want to create.', $this->localizationDomain); ?></span></td>
    444         </tr>
    445         <tr valign="top">
    446             <th scope="row"><?php _e('Create menu-shortcode', $this->localizationDomain); ?></th>
    447             <td><label for="empty">
    448                 <input type="checkbox" id="sc_menu" name="sc_menu" <?php echo ($this->options['sc_menu'] === true) ? "checked='checked'" : ""; ?>/> <?php
    449                 _e('Creates a menu-area for a shortcode. Create a new menu e.g. for a sitemap. Use shortcode with [menu] ', $this->localizationDomain); ?></label></td>
    450         </tr>
    451         <tr valign="top">
    452             <th scope="row"><?php _e('Create accordion-shortcode', $this->localizationDomain); ?></th>
    453             <td><label for="empty">
    454                 <input type="checkbox" id="sc_accordion" name="sc_accordion" <?php echo ($this->options['sc_accordion'] === true) ? "checked='checked'" : ""; ?>/> <?php
    455                 _e('Creates a <a href="http://jqueryui.com/accordion/" target="_blank">accordion</a> shortcode. ', $this->localizationDomain); ?></label></td>
    456         </tr>
    457        
    458     <?php /*
    459         <tr valign="top" style="display: none">
    460             <th scope="row"><?php _e('...', $this->localizationDomain); ?></th>
    461             <td><label for="css">
    462                 <input type="checkbox" id="css" name="css" <?php echo ($this->options['css'] === true) ? "checked='checked'" : ""; ?>/> <?php printf(__('Include the default stylesheet wp-paginate.css? WP-Paginate will first look for <code>wp-paginate.css</code> in your theme directory (<code>themes/%s</code>).', $this->localizationDomain), get_template()); ?></label></td>
    463         </tr>
    464         <tr valign="top" style="display: none">
    465             <th scope="row"><?php _e('...', $this->localizationDomain); ?></th>
    466             <td>
    467                 <select name="range" id="range">
    468                 <?php for ($i=1; $i<=10; $i++) : ?>
    469                     <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['range']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
    470                 <?php endfor; ?>
    471                 </select>
    472                 <span class="description"><?php _e('...', $this->localizationDomain); ?></span></td>
    473         </tr>
    474         <tr valign="top" style="display: none">
    475             <th scope="row"><?php _e('...', $this->localizationDomain); ?></th>
    476             <td>
    477                 <select name="anchor" id="anchor">
    478                 <?php for ($i=0; $i<=10; $i++) : ?>
    479                     <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['anchor']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
    480                 <?php endfor; ?>
    481                 </select>
    482                 <span class="description"><?php _e('...', $this->localizationDomain); ?></span></td>
    483         </tr>
    484         <tr valign="top" style="display: none">
    485             <th scope="row"><?php _e('...', $this->localizationDomain); ?></th>
    486             <td>
    487                 <select name="gap" id="gap">
    488                 <?php for ($i=1; $i<=10; $i++) : ?>
    489                     <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['gap']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
    490                 <?php endfor; ?>
    491                 </select>
    492                 <span class="description"><?php _e('', $this->localizationDomain); ?></span></td>
    493         </tr>
    494         */?>
    495     </table>
    496     <p class="submit">
    497         <input type="submit" value="<?php _e('Save Changes', $this->localizationDomain); ?>" name="wp_test_save" class="button-primary" />
    498     </p>
    499 </form>
    500 </div>
    501 
    502 <?php
     425            }
     426            ?>
     427
     428            <div class="wrap">
     429                <div class="icon32" id="icon-options-general"><br/></div>
     430                <h2><?php _e( 'Shortcodify settings', $this->localizationDomain ); ?></h2>
     431
     432                <form method="post" id="wp_test_options">
     433                    <?php wp_nonce_field( 'wp-test-update-options' ); ?>
     434                    <h3><?php _e( 'Settings', $this->localizationDomain ); ?></h3>
     435                    <h5><?php _e( 'See all possible shortcodes <a href="http://www.arnelorenz.de/shortcodify/">here</a>', $this->localizationDomain ); ?></h5>
     436                    <table class="form-table">
     437
     438                        <tr valign="top">
     439                            <th scope="row"><?php _e( 'Create widget-shortcode', $this->localizationDomain ); ?></th>
     440                            <td><label for="empty">
     441                                    <input type="checkbox" id="sc_widget"
     442                                           name="sc_widget" <?php echo ( $this->options['sc_widget'] === TRUE ) ? "checked='checked'" : ""; ?>/> <?php
     443                                    _e( 'Creates a widget-area for a shortcode. Use it with [widget]', $this->localizationDomain ); ?>
     444                                </label></td>
     445                        </tr>
     446                        <tr valign="top">
     447                            <th scope="row"><?php _e( 'Number of widgets to create', $this->localizationDomain ); ?></th>
     448                            <td>
     449                                <select name="sc_widget_number" id="sc_widget_number">
     450                                    <?php for ( $i = 0; $i <= 20; $i ++ ) : ?>
     451                                        <option
     452                                            value="<?php echo $i; ?>" <?php echo ( $i == $this->options['sc_widget_number'] ) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
     453                                    <?php endfor; ?>
     454                                </select>
     455                                <span
     456                                    class="description"><?php _e( 'Select the number of widgets you want to create.', $this->localizationDomain ); ?></span>
     457                            </td>
     458                        </tr>
     459                        <tr valign="top">
     460                            <th scope="row"><?php _e( 'Create menu-shortcode', $this->localizationDomain ); ?></th>
     461                            <td><label for="empty">
     462                                    <input type="checkbox" id="sc_menu"
     463                                           name="sc_menu" <?php echo ( $this->options['sc_menu'] === TRUE ) ? "checked='checked'" : ""; ?>/> <?php
     464                                    _e( 'Creates a menu-area for a shortcode. Create a new menu e.g. for a sitemap. Use shortcode with [menu] ', $this->localizationDomain ); ?>
     465                                </label></td>
     466                        </tr>
     467                        <tr valign="top">
     468                            <th scope="row"><?php _e( 'Create accordion-shortcode', $this->localizationDomain ); ?></th>
     469                            <td><label for="empty">
     470                                    <input type="checkbox" id="sc_accordion"
     471                                           name="sc_accordion" <?php echo ( $this->options['sc_accordion'] === TRUE ) ? "checked='checked'" : ""; ?>/> <?php
     472                                    _e( 'Creates a <a href="http://jqueryui.com/accordion/" target="_blank">accordion</a> shortcode. ', $this->localizationDomain ); ?>
     473                                </label></td>
     474                        </tr>
     475
     476                    </table>
     477                    <p class="submit">
     478                        <input type="submit" value="<?php _e( 'Save Changes', $this->localizationDomain ); ?>"
     479                               name="wp_test_save" class="button-primary"/>
     480                    </p>
     481                </form>
     482            </div>
     483
     484        <?php
    503485        }
    504486    }
     
    511493    function ShortcodifyWidget() {
    512494        // Instantiate the parent object
    513         parent::__construct( false, 'The Widget Title' );
     495        parent::__construct( FALSE, 'The Widget Title' );
    514496    }
    515497
     
    527509}
    528510
    529 
    530 
    531 
    532511//instantiate the class
    533 if (class_exists('shortcodify')) {
     512if ( class_exists( 'shortcodify' ) ) {
    534513    $shortcodify = new shortcodify();
    535514}
Note: See TracChangeset for help on using the changeset viewer.