function activate_handler() { //Will run when the plugin activates only //initialize settings add_option('wpvl_plugin_version', $this->version); add_option('wpvl_enable_jquery', '1'); add_option('wpvl_enable_prettyPhoto', '1'); $wpvl_prettyPhoto = WP_Video_Lightbox_prettyPhoto::get_instance(); WP_Video_Lightbox_prettyPhoto::save_object($wpvl_prettyPhoto); }
function prettyPhoto_settings_section() { if (isset($_POST['wpvl_prettyPhoto_update_settings'])) { $nonce = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce, 'wpvl_prettyPhoto_settings')) { wp_die('Error! Nonce Security Check Failed! Go back to prettyPhoto menu and save the settings again.'); } $wpvl_prettyPhoto = WP_Video_Lightbox_prettyPhoto::get_instance(); update_option('wpvl_enable_prettyPhoto', $_POST["enable_prettyPhoto"] == '1' ? '1' : ''); $wpvl_prettyPhoto->animation_speed = trim($_POST["animation_speed"]); $wpvl_prettyPhoto->slideshow = trim($_POST["slideshow"]); $wpvl_prettyPhoto->autoplay_slideshow = $_POST["autoplay_slideshow"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->opacity = trim($_POST["opacity"]); $wpvl_prettyPhoto->show_title = $_POST["show_title"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->allow_resize = $_POST["allow_resize"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->allow_expand = $_POST["allow_expand"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->default_width = trim($_POST["default_width"]); $wpvl_prettyPhoto->default_height = trim($_POST["default_height"]); $wpvl_prettyPhoto->counter_separator_label = trim($_POST["counter_separator_label"]); $wpvl_prettyPhoto->theme = trim($_POST["theme"]); $wpvl_prettyPhoto->horizontal_padding = trim($_POST["horizontal_padding"]); $wpvl_prettyPhoto->hideflash = $_POST["hideflash"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->wmode = trim($_POST["wmode"]); $wpvl_prettyPhoto->autoplay = $_POST["autoplay"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->modal = $_POST["modal"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->deeplinking = $_POST["deeplinking"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->overlay_gallery = $_POST["overlay_gallery"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->overlay_gallery_max = trim($_POST["overlay_gallery_max"]); $wpvl_prettyPhoto->keyboard_shortcuts = $_POST["keyboard_shortcuts"] == '1' ? 'true' : 'false'; $wpvl_prettyPhoto->ie6_fallback = $_POST["ie6_fallback"] == '1' ? 'true' : 'false'; WP_Video_Lightbox_prettyPhoto::save_object($wpvl_prettyPhoto); echo '<div id="message" class="updated fade"><p><strong>'; echo 'prettyPhoto Settings Updated!'; echo '</strong></p></div>'; } $wpvl_prettyPhoto = WP_Video_Lightbox_prettyPhoto::get_instance(); ?> <div style="background: none repeat scroll 0 0 #FFF6D5;border: 1px solid #D1B655;color: #3F2502;margin: 10px 0;padding: 5px 5px 5px 10px;text-shadow: 1px 1px #FFFFFF;"> <p><?php _e("For more information, updates, detailed documentation and video tutorial, please visit:", "wp-video-lightbox"); ?> <br /> <a href="https://www.tipsandtricks-hq.com/wordpress-video-lightbox-plugin-display-videos-in-a-fancy-lightbox-overlay-2700" target="_blank"><?php _e("WP Video Lightbox Homepage", "wp-video-lightbox"); ?> </a></p> </div> <form method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <?php wp_nonce_field('wpvl_prettyPhoto_settings'); ?> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"><?php _e('Enable prettyPhoto', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Enable prettyPhoto', 'wp-video-lightbox'); ?> </span></legend><label for="enable_prettyPhoto"> <input name="enable_prettyPhoto" type="checkbox" id="enable_prettyPhoto" <?php if (get_option('wpvl_enable_prettyPhoto') == '1') { echo ' checked="checked"'; } ?> value="1"> <?php _e('Check this option if you want to enable prettyPhoto library', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><label for="animation_speed"><?php _e('Animation speed', 'wp-video-lightbox'); ?> </label></th> <td> <select name="animation_speed" id="animation_speed"> <option <?php echo $wpvl_prettyPhoto->animation_speed === 'fast' ? 'selected="selected"' : ''; ?> value="fast"><?php _e('Fast', 'wp-video-lightbox'); ?> </option> <option <?php echo $wpvl_prettyPhoto->animation_speed === 'slow' ? 'selected="selected"' : ''; ?> value="slow"><?php _e('Slow', 'wp-video-lightbox'); ?> </option> <option <?php echo $wpvl_prettyPhoto->animation_speed === 'normal' ? 'selected="selected"' : ''; ?> value="normal"><?php _e('Normal', 'wp-video-lightbox'); ?> </option> </select> <!-- <span id="utc-time"><abbr title="Coordinated Universal Time">UTC</abbr> time is <code>2013-11-01 3:56:07</code></span> --> <p class="description"><?php _e('fast / slow / normal [default: fast]', 'wp-video-lightbox'); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><label for="slideshow"><?php _e('Slideshow', 'wp-video-lightbox'); ?> </label></th> <td><input name="slideshow" type="text" id="slideshow" value="<?php echo $wpvl_prettyPhoto->slideshow; ?> " class="regular-text"> <p class="description"><?php echo sprintf(__('%s OR interval time in ms [default: %s]', 'wp-video-lightbox'), 'false', '5000'); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Autoplay slideshow', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Autoplay slideshow', 'wp-video-lightbox'); ?> </span></legend><label for="autoplay_slideshow"> <input name="autoplay_slideshow" type="checkbox" id="autoplay_slideshow" <?php if ($wpvl_prettyPhoto->autoplay_slideshow == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('true / false [default: false]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><label for="opacity"><?php _e('Opacity', 'wp-video-lightbox'); ?> </label></th> <td><input name="opacity" type="text" id="opacity" value="<?php echo $wpvl_prettyPhoto->opacity; ?> " class="regular-text"> <p class="description"><?php echo sprintf(__('Value between %s and %s [default: %s]', 'wp-video-lightbox'), '0', '1', '0.8'); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Show title', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Show title', 'wp-video-lightbox'); ?> </span></legend><label for="show_title"> <input name="show_title" type="checkbox" id="show_title" <?php if ($wpvl_prettyPhoto->show_title == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('true / false [default: true]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Allow resize', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Allow resize', 'wp-video-lightbox'); ?> </span></legend><label for="allow_resize"> <input name="allow_resize" type="checkbox" id="allow_resize" <?php if ($wpvl_prettyPhoto->allow_resize == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('Resize the photos bigger than viewport. true / false [default: true]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Allow expand', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Allow expand', 'wp-video-lightbox'); ?> </span></legend><label for="allow_expand"> <input name="allow_expand" type="checkbox" id="allow_expand" <?php if ($wpvl_prettyPhoto->allow_resize == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('Allow the user to expand a resized image. true / false [default: true]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><label for="opacity"><?php _e('Default width', 'wp-video-lightbox'); ?> </label></th> <td><input name="default_width" type="text" id="default_width" value="<?php echo $wpvl_prettyPhoto->default_width; ?> " class="regular-text"> <p class="description"><?php echo sprintf(__('[default: %s]', 'wp-video-lightbox'), '640'); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><label for="opacity"><?php _e('Default height', 'wp-video-lightbox'); ?> </label></th> <td><input name="default_height" type="text" id="default_height" value="<?php echo $wpvl_prettyPhoto->default_height; ?> " class="regular-text"> <p class="description"><?php echo sprintf(__('[default: %s]', 'wp-video-lightbox'), '480'); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><label for="opacity"><?php _e('Counter separator label', 'wp-video-lightbox'); ?> </label></th> <td><input name="counter_separator_label" type="text" id="counter_separator_label" value="<?php echo $wpvl_prettyPhoto->counter_separator_label; ?> " class="regular-text"> <p class="description"><?php echo sprintf(__('The separator for the gallery counter 1 "of" 2 [default: %s]', 'wp-video-lightbox'), '/'); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><label for="theme"><?php _e('Theme', 'wp-video-lightbox'); ?> </label></th> <td> <select name="theme" id="theme"> <option selected="selected" value="pp_default"><?php _e('Default', 'wp-video-lightbox'); ?> </option> <option <?php echo $wpvl_prettyPhoto->theme === 'light_rounded' ? 'selected="selected"' : ''; ?> value="light_rounded"><?php _e('Light Rounded', 'wp-video-lightbox'); ?> </option> <option <?php echo $wpvl_prettyPhoto->theme === 'dark_rounded' ? 'selected="selected"' : ''; ?> value="dark_rounded"><?php _e('Dark Rounded', 'wp-video-lightbox'); ?> </option> <option <?php echo $wpvl_prettyPhoto->theme === 'light_square' ? 'selected="selected"' : ''; ?> value="light_square"><?php _e('Light Square', 'wp-video-lightbox'); ?> </option> <option <?php echo $wpvl_prettyPhoto->theme === 'dark_square' ? 'selected="selected"' : ''; ?> value="dark_square"><?php _e('Dark Square', 'wp-video-lightbox'); ?> </option> <option <?php echo $wpvl_prettyPhoto->theme === 'facebook' ? 'selected="selected"' : ''; ?> value="facebook"><?php _e('Facebook', 'wp-video-lightbox'); ?> </option> </select> <!-- <span id="utc-time"><abbr title="Coordinated Universal Time">UTC</abbr> time is <code>2013-11-01 3:56:07</code></span> --> <p class="description"><?php _e('Select a theme for the lightbox window', 'wp-video-lightbox'); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><label for="opacity"><?php _e('Horizontal padding', 'wp-video-lightbox'); ?> </label></th> <td><input name="horizontal_padding" type="text" id="horizontal_padding" value="<?php echo $wpvl_prettyPhoto->horizontal_padding; ?> " class="regular-text"> <p class="description"><?php echo sprintf(__('The padding on each side of the picture [default: %s]', 'wp-video-lightbox'), '20'); ?> </p></td> </tr> <tr valign="top"> <th scope="row">Hide Flash</th> <td> <fieldset><legend class="screen-reader-text"><span>Hide Flash</span></legend><label for="hideflash"> <input name="hideflash" type="checkbox" id="hideflash" <?php if ($wpvl_prettyPhoto->hideflash == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('Hides all the flash objects on a page, set to TRUE if flash appears over prettyPhoto [default: false]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><label for="animation_speed"><?php _e('wmode', 'wp-video-lightbox'); ?> </label></th> <td> <select name="wmode" id="wmode"> <option selected="selected" value="opaque"><?php _e('opaque', 'wp-video-lightbox'); ?> </option> </select> <p class="description"><?php _e('Set the flash wmode attribute [default: opaque]', 'wp-video-lightbox'); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Autoplay', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Autoplay', 'wp-video-lightbox'); ?> </span></legend><label for="autoplay"> <input name="autoplay" type="checkbox" id="autoplay" <?php if ($wpvl_prettyPhoto->autoplay == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('Automatically start videos: true / false [default: true]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Modal', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Modal', 'wp-video-lightbox'); ?> </span></legend><label for="modal"> <input name="modal" type="checkbox" id="modal" <?php if ($wpvl_prettyPhoto->modal == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('If set to true, only the close button will close the window [default: false]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Deeplinking', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Deeplinking', 'wp-video-lightbox'); ?> </span></legend><label for="deeplinking"> <input name="deeplinking" type="checkbox" id="deeplinking" <?php if ($wpvl_prettyPhoto->deeplinking == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('Allow prettyPhoto to update the url to enable deeplinking. [default: true]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Overlay gallery', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Overlay gallery', 'wp-video-lightbox'); ?> </span></legend><label for="overlay_gallery"> <input name="overlay_gallery" type="checkbox" id="overlay_gallery" <?php if ($wpvl_prettyPhoto->overlay_gallery == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('If set to true, a gallery will overlay the fullscreen image on mouse over [default: true]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><label for="opacity"><?php _e('Overlay gallery max', 'wp-video-lightbox'); ?> </label></th> <td><input name="overlay_gallery_max" type="text" id="overlay_gallery_max" value="<?php echo $wpvl_prettyPhoto->overlay_gallery_max; ?> " class="regular-text"> <p class="description"><?php echo sprintf(__('Maximum number of pictures in the overlay gallery [default: %s]', 'wp-video-lightbox'), '30'); ?> </p></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Keyboard shortcuts', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('Keyboard shortcuts', 'wp-video-lightbox'); ?> </span></legend><label for="keyboard_shortcuts"> <input name="keyboard_shortcuts" type="checkbox" id="keyboard_shortcuts" <?php if ($wpvl_prettyPhoto->keyboard_shortcuts == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('Set to false if you open forms inside prettyPhoto [default: true]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> <tr valign="top"> <th scope="row"><?php _e('IE6 fallback', 'wp-video-lightbox'); ?> </th> <td> <fieldset><legend class="screen-reader-text"><span><?php _e('IE6 fallback', 'wp-video-lightbox'); ?> </span></legend><label for="ie6_fallback"> <input name="ie6_fallback" type="checkbox" id="ie6_fallback" <?php if ($wpvl_prettyPhoto->ie6_fallback == 'true') { echo ' checked="checked"'; } ?> value="1"> <?php _e('compatibility fallback for IE6 [default: true]', 'wp-video-lightbox'); ?> </label> </fieldset></td> </tr> </tbody> </table> <p class="submit"><input type="submit" name="wpvl_prettyPhoto_update_settings" id="wpvl_prettyPhoto_update_settings" class="button button-primary" value="<?php _e('Save Changes', 'wp-video-lightbox'); ?> "></p></form> <?php }
function wp_vid_lightbox_enqueue_script() { if (get_option('wpvl_enable_jquery') == '1') { wp_enqueue_script('jquery'); } if (get_option('wpvl_enable_prettyPhoto') == '1') { $wpvl_prettyPhoto = WP_Video_Lightbox_prettyPhoto::get_instance(); wp_register_script('jquery.prettyphoto', WP_VID_LIGHTBOX_URL . '/js/jquery.prettyPhoto.js', array('jquery'), WPVL_PRETTYPHOTO_VERSION); wp_enqueue_script('jquery.prettyphoto'); wp_register_script('video-lightbox', WP_VID_LIGHTBOX_URL . '/js/video-lightbox.js', array('jquery'), WPVL_PRETTYPHOTO_VERSION); wp_enqueue_script('video-lightbox'); wp_register_style('jquery.prettyphoto', WP_VID_LIGHTBOX_URL . '/css/prettyPhoto.css'); wp_enqueue_style('jquery.prettyphoto'); wp_register_style('video-lightbox', WP_VID_LIGHTBOX_URL . '/wp-video-lightbox.css'); wp_enqueue_style('video-lightbox'); wp_localize_script('video-lightbox', 'vlpp_vars', array('prettyPhoto_rel' => WPVL_PRETTYPHOTO_REL, 'animation_speed' => $wpvl_prettyPhoto->animation_speed, 'slideshow' => $wpvl_prettyPhoto->slideshow, 'autoplay_slideshow' => $wpvl_prettyPhoto->autoplay_slideshow, 'opacity' => $wpvl_prettyPhoto->opacity, 'show_title' => $wpvl_prettyPhoto->show_title, 'allow_resize' => $wpvl_prettyPhoto->allow_resize, 'allow_expand' => $wpvl_prettyPhoto->allow_expand, 'default_width' => $wpvl_prettyPhoto->default_width, 'default_height' => $wpvl_prettyPhoto->default_height, 'counter_separator_label' => $wpvl_prettyPhoto->counter_separator_label, 'theme' => $wpvl_prettyPhoto->theme, 'horizontal_padding' => $wpvl_prettyPhoto->horizontal_padding, 'hideflash' => $wpvl_prettyPhoto->hideflash, 'wmode' => $wpvl_prettyPhoto->wmode, 'autoplay' => $wpvl_prettyPhoto->autoplay, 'modal' => $wpvl_prettyPhoto->modal, 'deeplinking' => $wpvl_prettyPhoto->deeplinking, 'overlay_gallery' => $wpvl_prettyPhoto->overlay_gallery, 'overlay_gallery_max' => $wpvl_prettyPhoto->overlay_gallery_max, 'keyboard_shortcuts' => $wpvl_prettyPhoto->keyboard_shortcuts, 'ie6_fallback' => $wpvl_prettyPhoto->ie6_fallback)); } }