Media > FancyBox --> '; return; } // begin output FancyBox settings echo ' '; } // FancyBox Media Settings Fields function easy_fancybox_settings_fields($args){ switch($args['input']) { case 'multiple': case 'deep': foreach ($args['options'] as $options) easy_fancybox_settings_fields($options); if( !empty($args['description'])) echo $args['description']; break; case 'select': if( !empty($args['label_for']) ) echo ' '; else echo $args['title']; echo ' '; if( empty($args['label_for']) ) echo ' '; else if( !empty($args['description'])) echo $args['description']; break; case 'checkbox': if( !empty($args['label_for']) ) echo ' '; else if( !empty($args['title']) ) echo $args['title']; $value = esc_attr( get_option($args['id'], $args['default']) ); if ($value == "1") $checked = ' checked="checked"'; else $checked = ''; if ($args['default'] == "1") $default = __('Checked','easy-fancybox'); else $default = __('Unchecked','easy-fancybox'); if( empty($args['label_for']) ) echo '
'; else echo ' '.$args['description'].'
'; break; case 'text': if( !empty($args['label_for']) ) echo ' '; else echo $args['title']; echo ' '; if( empty($args['label_for']) ) echo ' '; else if( !empty($args['description'])) echo $args['description']; break; default: if( !empty($args['description'])) echo $args['description']; } } function easy_fancybox_register_settings($args){ global $easy_fancybox_array; foreach ($args as $key => $value) { // check to see if the section is enabled, else skip to next if ( array_key_exists($key, $easy_fancybox_array['Global']['options']['Enable']['options']) && !get_option($easy_fancybox_array['Global']['options']['Enable']['options'][$key]['id'], !empty($easy_fancybox_array['Global']['options']['Enalbe']['options'][$key]['default'])) ) continue; switch($value['input']) { case 'deep': // go deeper and loop back on itself easy_fancybox_register_settings($value['options']); break; case 'multiple': add_settings_field( 'fancybox_'.$key, $value['title'], 'easy_fancybox_settings_fields', 'media', 'fancybox_section', $value); foreach ($value['options'] as $_value) if (!empty($_value['id'])) register_setting( 'media', $_value['id'] ); break; default: if ($value['id']) register_setting( 'media', 'fancybox_'.$key ); } } } function easy_fancybox_admin_init(){ load_plugin_textdomain('easy-fancybox', false, TEMPLATEPATH . '/easy-fancybox/easy-fancybox.php'); add_settings_section('fancybox_section', __('FancyBox','easy-fancybox'), 'easy_fancybox', 'media'); global $easy_fancybox_array; easy_fancybox_register_settings($easy_fancybox_array); } function easy_fancybox_enqueue_scripts() { global $easy_fancybox_array; // check for any enabled sections plus the need for easing script $do_fancybox = false; $easing = false; foreach ($easy_fancybox_array['Global']['options']['Enable']['options'] as $value) { // anything enabled? if ( '1' == get_option($value['id'],$value['default']) ) { $do_fancybox = true; break; } } // break off if there is no need for any script files if (!$do_fancybox) return; // ENQUEUE // first get rid of previously registered variants of jquery.fancybox by other plugins or theme wp_deregister_script('jquery.fancybox'); wp_deregister_script('fancybox'); wp_deregister_script('jquery-fancybox'); // register main fancybox script wp_enqueue_script('jquery.fancybox', ( get_bloginfo('template_url') . '/functions/easy-fancybox/fancybox/jquery.fancybox-'.FANCYBOX_VERSION.'.pack.js'), array('jquery'), FANCYBOX_VERSION); // easing in IMG settings? if ( ( 'elastic' == get_option($easy_fancybox_array['IMG']['options']['transitionIn']['id'],$easy_fancybox_array['IMG']['options']['transitionIn']['default']) || 'elastic' == get_option($easy_fancybox_array['IMG']['options']['transitionOut']['id'],$easy_fancybox_array['IMG']['options']['transitionOut']['default']) ) && ( '' != get_option($easy_fancybox_array['IMG']['options']['easingIn']['id'],$easy_fancybox_array['IMG']['options']['easingIn']['default']) || '' != get_option($easy_fancybox_array['IMG']['options']['easingOut']['id'],$easy_fancybox_array['IMG']['options']['easingOut']['default']) ) ) { // first get rid of previously registered variants of jquery.easing by other plugins or theme wp_deregister_script('jquery.easing'); wp_deregister_script('jqueryeasing'); wp_deregister_script('jquery-easing'); wp_deregister_script('easing'); // then register our version wp_enqueue_script('jquery.easing', (get_bloginfo('template_url') . '/functions/easy-fancybox/fancybox/jquery.easing-'.EASING_VERSION.'.pack.js'), array('jquery'), EASING_VERSION, true); } // first get rid of previously registered variants of jquery.mousewheel (by other plugins) wp_deregister_script('jquery.mousewheel'); wp_deregister_script('jquerymousewheel'); wp_deregister_script('jquery-mousewheel'); wp_deregister_script('mousewheel'); // then register our version wp_enqueue_script('jquery.mousewheel', (get_bloginfo('template_url') . '/functions/easy-fancybox/fancybox/jquery.mousewheel-'.MOUSEWHEEL_VERSION.'.pack.js'), array('jquery'), MOUSEWHEEL_VERSION, true); // first get rid of previously registered variants of jquery.metadata (by other plugins) wp_deregister_script('jquery.metadata'); wp_deregister_script('jquerymetadata'); wp_deregister_script('jquery-metadata'); wp_deregister_script('metadata'); // then register our version wp_enqueue_script('jquery.metadata', (get_bloginfo('template_url') . '/functions/easy-fancybox/jquery.metadata.js'), array('jquery'), METADATA_VERSION, true); } function easy_fancybox_enqueue_styles() { // register style wp_enqueue_style('easy-fancybox.css', (get_bloginfo('template_url') . '/functions/easy-fancybox/easy-fancybox.css.php'), false, FANCYBOX_VERSION, 'screen'); } // Hack to fix missing wmode in (auto)embed code based on Crantea Mihaita's work-around on // http://www.mehigh.biz/wordpress/adding-wmode-transparent-to-wordpress-3-media-embeds.html // + own hack for dailymotion iframe embed... if(!function_exists('add_video_wmode_opaque')) { function add_video_wmode_opaque($html, $url, $attr) { if (strpos($html, "