Changeset 2138574
- Timestamp:
- 08/13/2019 01:58:39 AM (7 years ago)
- Location:
- papier-mache
- Files:
-
- 11 edited
-
assets/icon-128x128.png (modified) (previous)
-
assets/icon-256x256.png (modified) (previous)
-
trunk/inc/settings/custom-controls/multiple-checkbox.php (modified) (4 diffs)
-
trunk/inc/settings/custom-controls/multiple-select.php (modified) (1 diff)
-
trunk/inc/settings/custom-controls/palette.php (modified) (3 diffs)
-
trunk/inc/settings/papier-mache.php (modified) (7 diffs)
-
trunk/languages/papier-mache-es_ES.mo (modified) (previous)
-
trunk/languages/papier-mache-es_ES.po (modified) (3 diffs)
-
trunk/languages/papier-mache.pot (modified) (3 diffs)
-
trunk/papier-mache.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
papier-mache/trunk/inc/settings/custom-controls/multiple-checkbox.php
r1922542 r2138574 1 1 <?php 2 // File: multiselect-dropdown.php 2 namespace PapierMache\Controls; 3 3 4 4 if (class_exists('WP_Customize_Control')) { … … 6 6 * Class to create a custom multiselect dropdown control 7 7 */ 8 class Multiple_Checkbox_Custom_Control extends WP_Customize_Control8 class Multiple_Checkbox_Custom_Control extends \WP_Customize_Control 9 9 { 10 10 /** … … 15 15 public function enqueue() 16 16 { 17 wp_enqueue_script('multiple-checkbox');18 wp_enqueue_style('multiple-checkbox');17 wp_enqueue_script('ppm_multiple-checkbox', plugin_dir_url(__FILE__)."multiple-checkbox.js", array(), PPM_V); 18 wp_enqueue_style('ppm_multiple-checkbox', plugin_dir_url(__FILE__)."multiple-checkbox.css", array(), PPM_V); 19 19 } 20 20 … … 51 51 <?php 52 52 } 53 54 public static function sanitize($values) 55 { 56 $multi_values = !is_array($values) ? explode(',', $values) : $values; 57 58 return !empty($multi_values) ? array_map('sanitize_text_field', $multi_values) : false; 59 } 53 60 } 54 61 } -
papier-mache/trunk/inc/settings/custom-controls/multiple-select.php
r1922542 r2138574 1 1 <?php 2 // File: multiple-select.php 2 namespace PapierMache\Controls; 3 3 4 4 if (class_exists('WP_Customize_Control')) { 5 /** 6 * Class to create a custom multiselect dropdown control 7 */ 8 class Multiple_Select_Custom_Control extends WP_Customize_Control 9 { 10 /** 11 * Render the content on the theme customizer page 12 */ 13 public $type = 'multiple-select'; 5 /** 6 * Class to create a custom multiselect dropdown control 7 */ 8 class Multiple_Select_Custom_Control extends \WP_Customize_Control 9 { 10 /** 11 * Render the content on the theme customizer page 12 */ 13 public $type = 'multiple-select'; 14 public $all_options_text = false; 15 public $all_options_value = 0; 16 public $rows = 5; 14 17 15 public function render_content() { 16 if ( empty( $this->choices ) ) 17 return; 18 public function enqueue() 19 { 20 wp_enqueue_script('ppm_multiple-select', plugin_dir_url(__FILE__)."multiple-select.js", array(), PLA_TAX_V); 21 wp_enqueue_style('ppm_multiple-select', plugin_dir_url(__FILE__)."multiple-select.css", array(), PLA_TAX_V); 22 } 18 23 19 //Size 20 $size = 5; 21 if(isset($this->input_attrs['size'])) { 22 $size = $this->input_attrs['size']; 23 } 24 ?> 25 <label> 26 <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 27 <select <?php $this->link(); ?> multiple="multiple" size="<?php echo $size; ?>"> 28 <?php 29 foreach ( $this->choices as $value => $label ) { 30 $selected = ( in_array( $value, $this->value() ) ) ? selected( 1, 1, false ) : ''; 31 echo '<option value="' . esc_attr( $value ) . '"' . $selected . '>' . $label . '</option>'; 32 } 33 ?> 34 </select> 35 </label> 36 <?php } 37 } 24 public function render_content() 25 { 26 if (empty($this->choices)) { 27 return; 28 } 29 30 $values = $this->value(); 31 if(!is_array($values)) { 32 $values = explode(',', $this->value()); 33 } 34 35 ?> 36 <div class="multiple_select_control"> 37 <?php if(!empty($this->label)) : ?> 38 <span class="customize-control-title"><?php echo $this->label; ?></span> 39 <?php endif; ?> 40 41 <?php if(!empty($this->description)) : ?> 42 <span class="description customize-control-description"><?php echo $this->description; ?></span> 43 <?php endif; ?> 44 45 <?php if(!empty($this->all_options_value)) : ?> 46 <?php echo $this->all_options_text; ?> 47 <input type='checkbox' data-value="<?php echo $this->all_options_value; ?>" class="all_options" <?php echo checked( in_array($this->all_options_value, $values) ); ?>> 48 <?php endif; ?> 49 50 <select multiple="multiple" <?php if( in_array($this->all_options_value, $values) ) : ?>disabled<?php endif; ?> size="<?php echo $this->rows; ?>"> 51 <?php foreach( $this->choices as $key => $label) : ?> 52 <option value="<?php echo $key; ?>" <?php echo selected( in_array($key, $values) ); ?>><?php echo $label; ?></option> 53 <?php endforeach; ?> 54 </select> 55 56 <input type="hidden" <?php $this->link(); ?> value="<?php echo implode( ',', $values ); ?>" /> 57 </div> 58 59 <?php 60 } 61 62 public static function sanitize($values) 63 { 64 $multi_values = !is_array($values) ? explode(',', $values) : $values; 65 66 return !empty($multi_values) ? array_map('sanitize_text_field', $multi_values) : false; 67 } 68 } 38 69 } -
papier-mache/trunk/inc/settings/custom-controls/palette.php
r1922542 r2138574 1 1 <?php 2 namespace PapierMache\Controls; 3 2 4 if (! class_exists('WP_Customize_Control')) { 3 5 return null; … … 7 9 * Class to create a custom date picker 8 10 */ 9 class Palette_Custom_Control extends WP_Customize_Control11 class Palette_Custom_Control extends \WP_Customize_Control 10 12 { 11 13 public $type = 'palette'; … … 16 18 public function enqueue() 17 19 { 18 wp_enqueue_style('palette');19 wp_enqueue_script('ppm-customize');20 wp_enqueue_script('ppm_palette', plugin_dir_url(__FILE__)."palette.js", array(), PPM_V); 21 wp_enqueue_style('ppm_palette', plugin_dir_url(__FILE__)."palette.css", array(), PPM_V); 20 22 } 21 23 -
papier-mache/trunk/inc/settings/papier-mache.php
r2037457 r2138574 45 45 'default' => array( ), 46 46 'type' => 'option', // or 'theme_mod' 47 'sanitize_callback' => ' sanitize_multiple_checkbox',47 'sanitize_callback' => '\PapierMache\Controls\Multiple_Checkbox_Custom_Control::sanitize', 48 48 'capability' => 'activate_plugins' 49 49 ) … … 52 52 //Opción para definir el campo para 'max number of confetti' 53 53 $wp_customize->add_control( 54 new Multiple_Checkbox_Custom_Control(54 new \PapierMache\Controls\Multiple_Checkbox_Custom_Control( 55 55 $wp_customize, 'ppm_props', array( 56 56 'label' => __( 'Type of confetti', 'papier-mache' ), … … 80 80 //Opción para definir el campo para 'colores' 81 81 $wp_customize->add_control( 82 new Palette_Custom_Control(82 new \PapierMache\Controls\Palette_Custom_Control( 83 83 $wp_customize, 'ppm_colors', array( 84 84 'label' => __('Colors', 'papier-mache'), … … 145 145 ); 146 146 147 //L ostado de roles147 //Listado de roles 148 148 global $wp_roles; 149 149 $roles = $wp_roles->get_names(); … … 156 156 //Opción para definir el campo para perfiles que no podrán vr el confeti 157 157 $wp_customize->add_control( 158 new Multiple_Checkbox_Custom_Control(158 new \PapierMache\Controls\Multiple_Checkbox_Custom_Control( 159 159 $wp_customize, 'ppm_disabled_roles', array( 160 160 'label' => __( 'Roles that can not see the confetti', 'papier-mache' ), … … 167 167 ); 168 168 169 //Declarar el campo para 'mostrar_en' 170 $wp_customize->add_setting( 171 'papier_mache[show_in]', 172 array( 173 'type' => 'option', // or 'theme_mod' 174 'capability' => 'edit_theme_options' 175 ) 176 ); 177 178 //Páginas 169 //Dönde se mostrará el papel maché 170 $wp_customize->add_setting( 171 'papier_mache[show_in]', 172 array( 173 'default' => array( ), 174 'type' => 'option', // or 'theme_mod' 175 'sanitize_callback' => '\PapierMache\Controls\Multiple_Select_Custom_Control::sanitize', 176 'capability' => 'activate_plugins' 177 ) 178 ); 179 180 //Páginas 179 181 $pages = array( 180 '-1' => __( '— All site —', 'papier-mache' ),182 // '-1' => __( '— All site —', 'papier-mache' ), 181 183 '0' => __( '— Homepage —', 'papier-mache' ), 182 184 ); … … 197 199 } 198 200 199 200 //Opción para definir el campo para 'conocenos' de facebook 201 $wp_customize->add_control( 202 'papier_mache[show_in]', 203 array( 204 'type' => 'select', 205 'label' => __( 'Show in', 'papier-mache' ), 206 'section' => 'papier-mache', 207 'settings' => 'papier_mache[show_in]', 208 'choices' => $pages 209 ) 210 ); 201 //Opción para definir el campo para páginas 202 $wp_customize->add_control( 203 new \PapierMache\Controls\Multiple_Select_Custom_Control( 204 $wp_customize, 205 'papier_mache[show_in]', 206 array( 207 'label' => __('Display', 'papier-mache'), 208 // 'description' => __('Description', 'papier-mache'), 209 'section' => 'papier-mache', 210 'settings' => 'papier_mache[show_in]', 211 'type' => 'multiple-select', 212 'choices' => $pages, 213 'all_options_value' => -1, 214 'all_options_text' => __('In all site', 'papier-mache'), 215 'rows' => 9 216 ) 217 ) 218 ); 211 219 212 220 } -
papier-mache/trunk/languages/papier-mache-es_ES.po
r2037457 r2138574 5 5 "Project-Id-Version: Confetti\n" 6 6 "Report-Msgid-Bugs-To: \n" 7 "POT-Creation-Date: 2019-0 2-22 18:19-0500\n"8 "PO-Revision-Date: 2019-0 2-22 18:20-0500\n"7 "POT-Creation-Date: 2019-08-12 19:10-0500\n" 8 "PO-Revision-Date: 2019-08-12 19:11-0500\n" 9 9 "Last-Translator: Juan Sebastián Echeverry <baxtian.echeverry@gmail.com>\n" 10 10 "Language-Team: Juan Sebastián Echeverry <baxtian.echeverry@gmail.com>\n" … … 16 16 "X-Poedit-Basepath: .\n" 17 17 "Plural-Forms: nplurals=2; plural=n != 1;\n" 18 "X-Generator: Poedit 2. 1.1\n"18 "X-Generator: Poedit 2.2.1\n" 19 19 "X-Poedit-SourceCharset: UTF-8\n" 20 20 "X-Poedit-SearchPath-0: ..\n" 21 21 22 #: ../inc/settings/custom-controls/palette.php:3 022 #: ../inc/settings/custom-controls/palette.php:32 23 23 msgid "Add color" 24 24 msgstr "Agregar color" 25 25 26 #: ../inc/settings/custom-controls/palette.php:3 026 #: ../inc/settings/custom-controls/palette.php:32 27 27 msgid "Change color" 28 28 msgstr "Cambiar color" 29 29 30 #: ../inc/settings/custom-controls/palette.php:3 030 #: ../inc/settings/custom-controls/palette.php:32 31 31 msgid "Reset palette" 32 32 msgstr "Reiniciar paleta" … … 80 80 msgstr "Perfiles que no verán el confeti" 81 81 82 #: ../inc/settings/papier-mache.php:180 83 msgid "— All site —" 84 msgstr "— Todo el sitio —" 85 86 #: ../inc/settings/papier-mache.php:181 82 #: ../inc/settings/papier-mache.php:183 87 83 msgid "— Homepage —" 88 84 msgstr "— Página de inicio —" 89 85 90 #: ../inc/settings/papier-mache.php:205 91 msgid "Show in" 92 msgstr "Mostrar en" 86 #: ../inc/settings/papier-mache.php:207 87 msgid "Display" 88 msgstr "Desplegar" 89 90 #: ../inc/settings/papier-mache.php:208 91 msgid "Description" 92 msgstr "Descripción" 93 94 #: ../inc/settings/papier-mache.php:214 95 msgid "In all site" 96 msgstr "En todo el sitio" 97 98 #~ msgid "— All site —" 99 #~ msgstr "— Todo el sitio —" 100 101 #~ msgid "Show in" 102 #~ msgstr "Mostrar en" 93 103 94 104 #~ msgid "Confetti" -
papier-mache/trunk/languages/papier-mache.pot
r2037457 r2138574 6 6 "Project-Id-Version: Confetti\n" 7 7 "Report-Msgid-Bugs-To: \n" 8 "POT-Creation-Date: 2019-0 2-22 18:19-0500\n"8 "POT-Creation-Date: 2019-08-12 19:10-0500\n" 9 9 "PO-Revision-Date: 2014-10-09 21:36-0500\n" 10 10 "Last-Translator: Juan Sebastián Echeverry <baxtian.echeverry@gmail.com>\n" … … 17 17 "X-Poedit-Basepath: .\n" 18 18 "Plural-Forms: nplurals=2; plural=n != 1;\n" 19 "X-Generator: Poedit 2. 1.1\n"19 "X-Generator: Poedit 2.2.1\n" 20 20 "X-Poedit-SourceCharset: UTF-8\n" 21 21 "X-Poedit-SearchPath-0: ..\n" 22 22 23 #: ../inc/settings/custom-controls/palette.php:3 023 #: ../inc/settings/custom-controls/palette.php:32 24 24 msgid "Add color" 25 25 msgstr "" 26 26 27 #: ../inc/settings/custom-controls/palette.php:3 027 #: ../inc/settings/custom-controls/palette.php:32 28 28 msgid "Change color" 29 29 msgstr "" 30 30 31 #: ../inc/settings/custom-controls/palette.php:3 031 #: ../inc/settings/custom-controls/palette.php:32 32 32 msgid "Reset palette" 33 33 msgstr "" … … 81 81 msgstr "" 82 82 83 #: ../inc/settings/papier-mache.php:180 84 msgid "— All site —" 85 msgstr "" 86 87 #: ../inc/settings/papier-mache.php:181 83 #: ../inc/settings/papier-mache.php:183 88 84 msgid "— Homepage —" 89 85 msgstr "" 90 86 91 #: ../inc/settings/papier-mache.php:20 592 msgid " Show in"87 #: ../inc/settings/papier-mache.php:207 88 msgid "Display" 93 89 msgstr "" 90 91 #: ../inc/settings/papier-mache.php:208 92 msgid "Description" 93 msgstr "" 94 95 #: ../inc/settings/papier-mache.php:214 96 msgid "In all site" 97 msgstr "" -
papier-mache/trunk/papier-mache.php
r2041834 r2138574 67 67 wp_enqueue_style('admin-confetti'); 68 68 69 //Para el multiple-checkbox70 wp_register_script('multiple-checkbox', plugin_dir_url(__FILE__)."scripts/multiple-checkbox.js", array( 'jquery' ), PPM_V);71 wp_register_style('multiple-checkbox', plugin_dir_url(__FILE__)."styles/multiple-checkbox.css", array( ), PPM_V);72 73 69 //Para el customize 74 70 wp_register_style('palette', plugin_dir_url(__FILE__)."styles/palette.css", array(), PPM_V); … … 107 103 //Es una página habilitada 108 104 //Si es -1 es en toda la página 109 if( $show_in == -1) {105 if(in_array('-1', $show_in) ) { 110 106 //Está habilitado en todas las páginas 111 } elseif( $show_in == 0) {107 } elseif(in_array('0', $show_in) ) { 112 108 //Solo en home 113 109 if(!is_home() && !is_front_page()) { … … 115 111 } 116 112 } else { 117 //Otra página 118 if(!is_page( $show_in )) { 113 if(!is_array($show_in) || count($show_in) == 0) { //¿Hay alguna página? 114 $habilitado = false; 115 } elseif(!is_page( $show_in )) { //¿Es esta la página? 119 116 $habilitado = false; 120 117 } -
papier-mache/trunk/readme.txt
r2037457 r2138574 4 4 Requires at least: 4.1 5 5 Tested up to: 4.9.8 6 Stable tag: 0. 56 Stable tag: 0.6 7 7 8 8 Show the world your site has something to celebrate.
Note: See TracChangeset
for help on using the changeset viewer.