Changeset 1155642
- Timestamp:
- 05/07/2015 08:16:08 PM (11 years ago)
- Location:
- shortcodify
- Files:
-
- 17 added
- 4 edited
-
tags/1.3.1 (added)
-
tags/1.3.1/css (added)
-
tags/1.3.1/css/shortcodify.css (added)
-
tags/1.3.1/images (added)
-
tags/1.3.1/js (added)
-
tags/1.3.1/js/shortcodify.js (added)
-
tags/1.3.1/lang (added)
-
tags/1.3.1/lang/default.mo (added)
-
tags/1.3.1/lang/default.po (added)
-
tags/1.3.1/lang/shortcodify-de_DE.mo (added)
-
tags/1.3.1/lang/shortcodify-de_DE.po (added)
-
tags/1.3.1/lang/shortcodify.pot (added)
-
tags/1.3.1/readme.txt (added)
-
tags/1.3.1/screenshot-1.png (added)
-
tags/1.3.1/screenshot-2.png (added)
-
tags/1.3.1/screenshot-3.png (added)
-
tags/1.3.1/shortcodify.php (added)
-
trunk/lang/shortcodify-de_DE.mo (modified) (previous)
-
trunk/lang/shortcodify-de_DE.po (modified) (1 diff)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/shortcodify.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
shortcodify/trunk/lang/shortcodify-de_DE.po
r689936 r1155642 1 # Copyright (C) 2013 Shortcodify2 # This file is distributed under the same license as the Shortcodify package.3 1 msgid "" 4 2 msgstr "" 5 "Project-Id-Version: Shortcodify 1.0.0\n"3 "Project-Id-Version: Shortcodify v1.3.1\n" 6 4 "Report-Msgid-Bugs-To: http://wordpress.org/tag/shortcodify\n" 7 5 "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" 8 9 "MIME-Version: 1.0\n" 9 10 "Content-Type: text/plain; charset=UTF-8\n" 10 11 "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" 16 16 "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" 17 22 18 #: shortcodify.php:78 23 #: shortcodify.php:75 24 #@ default 19 25 msgid "Bookmarks" 20 26 msgstr "" 21 27 22 #: shortcodify.php:196 23 msgid "Shortcodify Menu" 24 msgstr "" 28 #: shortcodify.php:326 29 #: shortcodify.php:338 30 #@ shortcodify 31 msgid "Add this widget to an other textfield with [widget]" 32 msgstr "Füge dieses Widget im Textfeld mittels [widget] hinzu" 25 33 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 31 37 msgid "Settings" 32 38 msgstr "Einstellungen" 33 39 34 #: shortcodify.php:329 40 #: shortcodify.php:421 41 #@ shortcodify 35 42 msgid "Success! Your changes were successfully saved!" 36 43 msgstr "Ihre Einstellungen wurde gespeichert" 37 44 38 #: shortcodify.php:332 45 #: shortcodify.php:423 46 #@ shortcodify 39 47 msgid "Whoops! There was a problem with the data you posted. Please try again." 40 msgstr " "48 msgstr "Uups... es gab ein Problem mit den Daten. Bitte versuche es nochmal." 41 49 42 #: shortcodify.php:339 50 #: shortcodify.php:430 51 #@ shortcodify 43 52 msgid "Shortcodify settings" 44 53 msgstr "Shortcodify Einstellungen" 45 54 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 57 msgid "See all possible shortcodes <a href=\"http://www.arnelorenz.de/shortcodify/\">here</a>" 58 msgstr "Eine Liste aller verfügbaren Shortcodes unter: <a href=\"http://www.arnelorenz.de/shortcodify/\">here</a>" 53 59 54 #: shortcodify.php:347 60 #: shortcodify.php:439 61 #@ shortcodify 55 62 msgid "Create widget-shortcode" 56 msgstr " "63 msgstr "Widget Shortcode erzeugen" 57 64 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 63 67 msgid "Create menu-shortcode" 64 68 msgstr "Menü-Shortcode erstellen" 65 69 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 72 msgid "Creates a menu-area for a shortcode. Create a new menu e.g. for a sitemap. Use shortcode with [menu] " 73 msgstr "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 77 msgid "Shortcodify Menu, for sitemaps" 70 78 msgstr "" 71 79 72 #: shortcodify.php:360 73 msgid "Before Markup:" 74 msgstr "" 80 #: shortcodify.php:443 81 #@ shortcodify 82 msgid "Creates a widget-area for a shortcode. Use it with [widget]" 83 msgstr "Erzeugt einen neuen Widget-Bereich, der durch [widget] in die Seite eingefügt werden kann." 75 84 76 #: shortcodify.php:362 77 msgid "The HTML markup to display before the pagination code." 78 msgstr "" 85 #: shortcodify.php:447 86 #@ shortcodify 87 msgid "Number of widgets to create" 88 msgstr "Anzahl der neuen Widget-Bereiche" 79 89 80 #: shortcodify.php:365 81 msgid "After Markup:" 82 msgstr "" 90 #: shortcodify.php:456 91 #@ shortcodify 92 msgid "Select the number of widgets you want to create." 93 msgstr "Wähle die Anzahl der neuen Widgets aus." 83 94 84 #: shortcodify.php:367 85 msgid "The HTML markup to display after the pagination code." 86 msgstr "" 95 #: shortcodify.php:468 96 #@ shortcodify 97 msgid "Create accordion-shortcode" 98 msgstr "Erstelle ein Accordion-Widget" 87 99 88 #: shortcodify.php:370 89 msgid "WP-Paginate CSS File:" 90 msgstr "" 100 #: shortcodify.php:472 101 #@ shortcodify 102 msgid "Creates a <a href=\"http://jqueryui.com/accordion/\" target=\"_blank\">accordion</a> shortcode. " 103 msgstr "Erstellt ein <a href=\"http://jqueryui.com/accordion/\" target=\"_blank\">Accordion</a> Shortcode. Der später genutzt werden kann." 91 104 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 107 msgid "Save Changes" 108 msgstr "Speichern" 98 109 99 #: shortcodify.php:375100 msgid "Page Range:"101 msgstr ""102 103 #: shortcodify.php:382104 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:385110 msgid "Page Anchors:"111 msgstr ""112 113 #: shortcodify.php:392114 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:395120 msgid "Page Gap:"121 msgstr ""122 123 #: shortcodify.php:402124 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/theme130 msgid "Shortcodify"131 msgstr ""132 133 #. #-#-#-#-# plugin.pot (Shortcodify 1.0.0) #-#-#-#-#134 #. Plugin URI of the plugin/theme135 #. #-#-#-#-# plugin.pot (Shortcodify 1.0.0) #-#-#-#-#136 #. Author URI of the plugin/theme137 msgid "http://www.arnelorenz.de/"138 msgstr ""139 140 #. Description of the plugin/theme141 msgid "Plugin to add shortcodes"142 msgstr "Plugin um nützliche Shortcodes zu WordPress hinzuzufügen"143 144 #. Author of the plugin/theme145 msgid "Arne Lorenz"146 msgstr "" -
shortcodify/trunk/readme.txt
r690031 r1155642 4 4 Tags: shortcode,shortcodes,tiny,rte,widget,widgets,menu,sitemap,menu,menus 5 5 Requires at least: 3.0 6 Tested up to: 3.5.16 Tested up to: 4.2.2 7 7 Stable tag: 1.3.0 8 8 License: GPLv2 or later … … 38 38 Please send me a request! 39 39 40 Version: 1.3. 040 Version: 1.3.1 41 41 42 42 == Installation == … … 61 61 62 62 == Changelog == 63 = 1.3.1 = 64 Code cleanup, testing up to newest WordPress version, German Translation 65 63 66 = 1.3.0 = 64 67 New shortcode: accordion, multiple widget areas … … 75 78 76 79 == Upgrade notice == 77 = 1.3. 0=78 Multiple widget areas possible 80 = 1.3.1 = 81 Code cleanup, testing up to newest WordPress version -
shortcodify/trunk/shortcodify.php
r689936 r1155642 1 1 <?php 2 2 /* 3 Copyright: © 201 2 LRNZ ( coded in germany )4 <mailto: [email protected]> <http://www.arnelorenz.de/>3 Copyright: © 2015 art@tec 4 <mailto:[email protected]> <http://www.art-at-tec.de/> 5 5 6 6 Released under the terms of the GNU General Public License. … … 10 10 */ 11 11 /* 12 Version: 1.3. 013 14 Author URI: http://www.ar nelorenz.de/12 Version: 1.3.1 13 14 Author URI: http://www.art-at-tec.de/ 15 15 Author: Arne Lorenz 16 16 17 17 Plugin Name: Shortcodify 18 Plugin URI: http://www.arnelorenz.de/ 18 Plugin URI: http://www.arnelorenz.de/shortcodify/ 19 19 Description: Plugin to add shortcodes 20 20 */ 21 21 22 if ( !class_exists('shortcodify')) {22 if ( ! class_exists( 'shortcodify' ) ) { 23 23 class shortcodify { 24 24 /** 25 25 * @var string The plugin version 26 26 */ 27 var $version = '1.3. 0';27 var $version = '1.3.1'; 28 28 /** 29 29 * @var string The options string name for this plugin … … 42 42 var $activeFunctions = array(); 43 43 var $bookmark_args = array(); 44 44 45 45 /** 46 46 * @var array $options Stores the options for this plugin 47 47 */ 48 48 var $options = array(); 49 /** 50 * PHP 4 Compatible Constructor 51 */ 52 function test() {$this->__construct();} 49 53 50 54 51 /** … … 56 53 */ 57 54 function __construct() { 58 $name = dirname(plugin_basename(__FILE__));55 $name = dirname( plugin_basename( __FILE__ ) ); 59 56 $this->localizationDomain = $name; 60 57 //Language Setup 61 load_plugin_textdomain( $this->localizationDomain, false, $name.'/lang/');58 load_plugin_textdomain( $this->localizationDomain, FALSE, $name . '/lang/' ); 62 59 63 60 //"Constants" setup 64 $this->pluginurl = plugins_url($name) . "/";61 $this->pluginurl = plugins_url( $name ) . "/"; 65 62 $this->pluginpath = WP_PLUGIN_DIR . "/$name/"; 66 63 67 64 $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 87 85 //Initialize the options 88 86 $this->get_options(); 89 87 90 88 // which shortcodes are active? 91 89 $this->check_active_functions(); 92 90 93 91 //Actions 94 92 $this->create_Actions(); 95 93 96 94 // ADD the shortcodes 97 95 $this->create_shortcode(); 98 99 } 100 96 97 } 98 101 99 // ---- ----------- 102 100 103 private function check_active_functions() {101 private function check_active_functions() { 104 102 $this->activeFunctions = array( 105 103 'wsc', … … 111 109 'links', 112 110 '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() { 117 120 // 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() { 122 125 // 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 129 131 // To use a widget-area in a shortcode 130 if($this->options['sc_widget']) 131 { 132 if ( $this->options['sc_widget'] ) { 132 133 $this->useWidgets(); 133 134 } 134 135 135 136 // To use a menu in a widget 136 if($this->options['sc_menu']) 137 { 137 if ( $this->options['sc_menu'] ) { 138 138 $this->useMenus(); 139 139 } 140 140 141 141 // To use a accordion 142 if($this->options['sc_accordion']) 143 { 142 if ( $this->options['sc_accordion'] ) { 144 143 $this->useAccordion(); 145 144 } 146 145 } 147 146 148 147 /* 149 148 Function for small shortcode handling 150 149 instead of: function wrap_shortcode_func($atts, $content= NULL) 151 150 */ 152 public function __call( $name, $argumente) {151 public function __call( $name, $argumente ) { 153 152 // 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]; 157 156 $number = $parts[1]; 158 157 } 159 160 $atts = $argumente[0];158 159 $atts = $argumente[0]; 161 160 $content = $argumente[1]; 162 switch ($name){161 switch ( $name ) { 163 162 case 'hr': 164 163 $rtn = '<hr class="clear" style="clear: both">'; 165 break;164 break; 166 165 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; 169 168 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; 172 171 case 'br': 173 172 $rtn = '<br class="clear" style="clear: both">'; 174 break;173 break; 175 174 case 'unshortcode': 176 175 $rtn = $content; 177 break;176 break; 178 177 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': 183 181 $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; 186 184 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; 195 197 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; 199 202 default: 200 203 $rtn = $content; 201 204 } 205 202 206 return $rtn; 203 207 } 204 208 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 ++ ) { 209 213 // i dont know how to give this function-call an parameter :( 210 214 // 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 222 227 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( 226 231 'shortcodify', 227 plugins_url( '/js/shortcodify.js', __FILE__),228 array( 'jquery'),229 false,230 true232 plugins_url( '/js/shortcodify.js', __FILE__ ), 233 array( 'jquery' ), 234 FALSE, 235 TRUE 231 236 ); 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 251 257 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' ) 254 260 ) ); 255 261 } 256 262 257 static function getWidgetContent( $area = 'Shortcodify'){263 static function getWidgetContent( $area = 'Shortcodify' ) { 258 264 ob_start(); 259 dynamic_sidebar( $area);265 dynamic_sidebar( $area ); 260 266 $html = ob_get_contents(); 261 267 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 271 278 // menu shortcode output 272 279 function createMenu() { 273 280 ob_start(); 274 wp_nav_menu( array( 'menu' => 'Shortcodify' ));281 wp_nav_menu( array( 'menu' => 'Shortcodify' ) ); 275 282 $html = ob_get_contents(); 276 283 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 ) { 282 289 //$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 ); 287 297 //preg_match_all('/\[section\].*\[\/section\]/', $content, $ausgabe); 288 298 289 299 // remove whitespace at beginning 290 $ausgabe = preg_replace( '/\A.*?\[section/s', '[section', $ausgabe);300 $ausgabe = preg_replace( '/\A.*?\[section/s', '[section', $ausgabe ); 291 301 // 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 ); 294 304 // 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 298 309 return $rtn; 299 310 } 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 302 315 return $rtn; 303 316 } 317 304 318 /** 305 319 * Adds a widget Area 306 320 * 307 321 */ 308 function shortcodify_widgets_init() 309 { 322 function shortcodify_widgets_init() { 310 323 $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 ), 314 327 '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>', 318 331 ); 319 332 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 ++ ) { 322 335 $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>', 330 343 ); 331 344 register_sidebar( $conf ); … … 338 351 */ 339 352 function get_options() { 340 if ( !$options = get_option($this->optionsName)) {353 if ( ! $options = get_option( $this->optionsName ) ) { 341 354 $options = array( 342 'sc_widget' => true,355 'sc_widget' => TRUE, 343 356 'sc_widget_number' => 0, 344 'sc_menu' => true,345 'sc_accordion' => true357 'sc_menu' => TRUE, 358 'sc_accordion' => TRUE 346 359 /* 347 360 'title' => 'Pages:', … … 357 370 */ 358 371 ); 359 update_option( $this->optionsName, $options);372 update_option( $this->optionsName, $options ); 360 373 } 361 374 $this->options = $options; 362 375 } 376 363 377 /** 364 378 * Saves the admin options to the database. 365 379 */ 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 ); 368 382 } 369 383 … … 372 386 */ 373 387 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 ); 376 396 } 377 397 … … 379 399 * @desc Adds the Settings link to the plugin activate/deactivate page 380 400 */ 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 links401 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 384 404 385 405 return $links; … … 390 410 */ 391 411 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; 410 419 $this->save_admin_options(); 411 420 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>'; 413 424 } 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 503 485 } 504 486 } … … 511 493 function ShortcodifyWidget() { 512 494 // Instantiate the parent object 513 parent::__construct( false, 'The Widget Title' );495 parent::__construct( FALSE, 'The Widget Title' ); 514 496 } 515 497 … … 527 509 } 528 510 529 530 531 532 511 //instantiate the class 533 if ( class_exists('shortcodify')) {512 if ( class_exists( 'shortcodify' ) ) { 534 513 $shortcodify = new shortcodify(); 535 514 }
Note: See TracChangeset
for help on using the changeset viewer.