Changeset 368919
- Timestamp:
- 04/05/2011 03:58:51 AM (15 years ago)
- File:
-
- 1 edited
-
galleria-galleria/trunk/galleria-galleria.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
galleria-galleria/trunk/galleria-galleria.php
r368028 r368919 2 2 /* 3 3 Plugin Name: Galleria Galleria 4 Plugin URI: 4 Plugin URI: https://github.com/samargulies/galleria-galleria/ 5 5 Description: Transform standard WordPress galleries into galleria slideshows. 6 6 Version: 0.1.1 … … 17 17 http://galleria.aino.se/ 18 18 19 Mr. Philip Arthur Moore for IE debugging 19 Mr. Philip Arthur Moore for IE debugging of Photo Galleria 20 20 http://www.philiparthurmoore.com 21 21 … … 74 74 } 75 75 76 function galleria_galleria_admin_head() {77 78 76 /** 79 77 * Prints out the inline javascript needed for the colorpicker and choosing … … 81 79 */ 82 80 83 ?> 84 85 <script type="text/javascript"> 86 jQuery(document).ready(function($) { 87 88 // Color Picker 89 $('.colorSelector').each(function(){ 90 var Othis = this; //cache a copy of the this variable for use inside nested function 91 var initialColor = $(Othis).next('input').attr('value'); 92 $(this).ColorPicker({ 93 color: initialColor, 94 onShow: function (colpkr) { 95 $(colpkr).fadeIn(500); 96 return false; 97 }, 98 onHide: function (colpkr) { 99 $(colpkr).fadeOut(500); 100 return false; 101 }, 102 onChange: function (hsb, hex, rgb) { 103 $(Othis).children('div').css('backgroundColor', '#' + hex); 104 $(Othis).next('input').attr('value','#' + hex); 105 } 106 }); 107 }); //end color picker 108 });//end document ready functions 109 </script> 110 111 <?php 112 } 113 81 function galleria_galleria_admin_head() { 82 ?> 83 <script type="text/javascript"> 84 jQuery(document).ready(function($) { 85 86 // Color Picker 87 $('.colorSelector').each(function(){ 88 var Othis = this; //cache a copy of the this variable for use inside nested function 89 var initialColor = $(Othis).next('input').attr('value'); 90 $(this).ColorPicker({ 91 color: initialColor, 92 onShow: function (colpkr) { 93 $(colpkr).fadeIn(500); 94 return false; 95 }, 96 onHide: function (colpkr) { 97 $(colpkr).fadeOut(500); 98 return false; 99 }, 100 onChange: function (hsb, hex, rgb) { 101 $(Othis).children('div').css('backgroundColor', '#' + hex); 102 $(Othis).next('input').attr('value','#' + hex); 103 } 104 }); 105 }); //end color picker 106 });//end document ready functions 107 </script> 108 <?php 109 } 114 110 115 111 /** … … 117 113 */ 118 114 119 $design_options = array( 120 'classic' => array( 121 'value' => 'classic', 122 'label' => __( 'Classic' ) 123 ), 124 'dots' => array( 125 'value' => 'dots', 126 'label' => __( 'Dots' ) 127 ), 128 /* 129 'fullscreen' => array( 130 'value' => 'fullscreen', 131 'label' => __( 'Fullscreen' ) 132 ) 133 */ 134 ); 135 136 $transition_options = array( 137 'fade' => array( 138 'value' => 'fade', 139 'label' => __( 'Fade' ) 140 ), 141 'flash' => array( 142 'value' => 'flash', 143 'label' => __( 'Flash' ) 144 ), 145 'slide' => array( 146 'value' => 'slide', 147 'label' => __( 'Slide' ) 148 ), 149 'fadeslide' => array( 150 'value' => 'fadeslide', 151 'label' => __( 'Fade & Slide' ) 152 ) 153 ); 154 155 $image_options = array( 156 'medium' => array( 157 'value' => 'medium', 158 'label' => __( 'Medium' ) 159 ), 160 'large' => array( 161 'value' => 'large', 162 'label' => __( 'Large' ) 163 ) 164 ); 115 function galleria_galleria_default_options() { 116 117 $options['design'] = array( 118 'classic' => array( 119 'value' => 'classic', 120 'label' => __( 'Classic' ) 121 ), 122 'dots' => array( 123 'value' => 'dots', 124 'label' => __( 'Dots' ) 125 ), 126 /* 127 'fullscreen' => array( 128 'value' => 'fullscreen', 129 'label' => __( 'Fullscreen' ) 130 ) 131 */ 132 ); 133 134 $options['transition'] = array( 135 'fade' => array( 136 'value' => 'fade', 137 'label' => __( 'Fade' ) 138 ), 139 'flash' => array( 140 'value' => 'flash', 141 'label' => __( 'Flash' ) 142 ), 143 'slide' => array( 144 'value' => 'slide', 145 'label' => __( 'Slide' ) 146 ), 147 'fadeslide' => array( 148 'value' => 'fadeslide', 149 'label' => __( 'Fade & Slide' ) 150 ) 151 ); 152 153 $options['image'] = array( 154 'medium' => array( 155 'value' => 'medium', 156 'label' => __( 'Medium' ) 157 ), 158 'large' => array( 159 'value' => 'large', 160 'label' => __( 'Large' ) 161 ) 162 ); 163 164 return $options; 165 } 166 165 167 166 168 /** … … 169 171 170 172 function galleria_galleria_options_do_page() { 171 global $design_options, $transition_options, $image_options;173 $defaults = galleria_galleria_default_options(); 172 174 173 175 if ( ! isset( $_REQUEST['updated'] ) ) … … 199 201 $r = ''; 200 202 201 foreach ( $de sign_optionsas $option ) {203 foreach ( $defaults['design'] as $option ) { 202 204 $label = $option['label']; 203 205 if ( $selected == $option['value'] ) // Make default first in list … … 227 229 $r = ''; 228 230 229 foreach ( $ transition_optionsas $option ) {231 foreach ( $defaults['transition'] as $option ) { 230 232 $label = $option['label']; 231 233 if ( $selected == $option['value'] ) // Make default first in list … … 285 287 $r = ''; 286 288 287 foreach ( $ image_optionsas $option ) {289 foreach ( $defaults['image'] as $option ) { 288 290 $label = $option['label']; 289 291 if ( $selected == $option['value'] ) // Make default first in list … … 325 327 */ 326 328 function galleria_galleria_options_validate( $input ) { 327 global $design_options, $transition_options;329 $defaults = galleria_galleria_default_options(); 328 330 329 331 // Our checkbox value is either 0 or 1 … … 333 335 334 336 if ( ! isset( $input['color'] ) ) { 335 $input['color'] = '#000 ';337 $input['color'] = '#000000'; 336 338 } 337 339 … … 343 345 344 346 // Our select option must actually be in our array of select options 345 if ( ! array_key_exists( $input['design'], $de sign_options) )347 if ( ! array_key_exists( $input['design'], $defaults['design'] ) ) 346 348 $input['design'] = null; 347 349 348 350 // Our select option must actually be in our array of select options 349 if ( ! array_key_exists( $input['transition'], $ transition_options) )351 if ( ! array_key_exists( $input['transition'], $defaults['transition'] ) ) 350 352 $input['transition'] = null; 351 353 … … 365 367 wp_enqueue_script('galleria', plugins_url( '/js/galleria-1.2.2.min.js', __FILE__ ), array('jquery')); 366 368 wp_print_scripts('galleria'); 367 galleria_galleria_script s_head();369 galleria_galleria_script_options(); 368 370 } 369 371 add_action('wp_footer', 'galleria_galleria_load_scripts' ); … … 372 374 * Add scripts to head 373 375 */ 374 function galleria_galleria_scripts_head(){ 376 377 function galleria_galleria_script_options(){ 375 378 // Retreive our plugin options 376 379 $galleria_galleria = get_option( 'galleria_galleria' );
Note: See TracChangeset
for help on using the changeset viewer.