Headline
CVE-2023-5945: wp-responsive-video-gallery-with-lightbox.php in wp-responsive-video-gallery-with-lightbox/tags/1.0.1 – WordPress Plugin Repository
The video carousel slider with lightbox plugin for WordPress is vulnerable to Cross-Site Request Forgery in version 1.0. This is due to missing or incorrect nonce validation on the responsive_video_gallery_with_lightbox_video_management_func() function. This makes it possible for unauthenticated attackers to delete videos hosted from the video slider via a forged request granted they can trick a site administrator into performing an action such as clicking on a link.
1<?php2/*3 * Plugin Name: WP Responsive Video Gallery With Lightbox 4 * Plugin URI:http://www.i13websolution.com/wordpress-responsive-video-gallery-with-lightbox-pro.html 5 * Author URI:http://www.i13websolution.com/wordpress-responsive-video-gallery-with-lightbox-pro.html 6 * Description:This is beautiful responsive video gallery with responsive lightbox.Add any number of video from admin panel. 7 * Author:I Thirteen Web Solution 8 * Version:1.0.19 */10//error_reporting ( 0 );11add_filter ( ‘widget_text’, ‘do_shortcode’ );12add_action ( ‘admin_menu’, ‘responsive_video_gallery_plus_lightbox_add_admin_menu’ );13//add_action ( ‘admin_init’, ‘responsive_video_gallery_plus_lightbox_add_admin_init’ );14register_activation_hook ( __FILE__, ‘install_responsive_video_gallery_plus_lightbox’ );15add_action ( ‘wp_enqueue_scripts’, ‘responsive_video_gallery_plus_lightbox_load_styles_and_js’ );16add_shortcode ( ‘print_responsive_video_gallery_plus_lightbox’, ‘print_responsive_video_gallery_plus_lightbox_func’ );17add_action ( ‘admin_notices’, ‘responsive_video_gallery_plus_lightbox_admin_notices’ );1819add_action( ‘wp_ajax_check_file_exist’, ‘check_file_exist_callback’ );20add_action( ‘wp_ajax_get_youtube_info’, ‘get_youtube_info_callback’ );2122function vgallery_save_image_curl($url,$saveto){23 $ch = curl_init ($url);24 curl_setopt($ch, CURLOPT_HEADER, 0);25 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);26 curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);27 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);28 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);29 $raw=curl_exec($ch);30 curl_close ($ch);31 if(file_exists($saveto)){32 @unlink($saveto);33 }34 $fp = @fopen($saveto,’x’);35 @fwrite($fp, $raw);36 @fclose($fp);37}3839function get_youtube_info_callback(){40 41 if(isset($_POST) and is_array($_POST) and isset($_POST[‘url’])){42 43 44 $retrieved_nonce = ‘’;4546 if (isset($_POST[‘vNonce’]) and $_POST[‘vNonce’] != ‘’) {4748 $retrieved_nonce = $_POST[‘vNonce’];49 }50 if (!wp_verify_nonce($retrieved_nonce, ‘vNonce’)) {515253 wp_die(‘Security check fail’);54 }5556 $vid=htmlentities(strip_tags($_POST[‘vid’]),ENT_QUOTES);57 $url=$_POST[‘url’]; 58 $ch = curl_init();59 60 // Set the URL61 curl_setopt($ch, CURLOPT_URL, $url);62 63 // Removes the headers from the output64 curl_setopt($ch, CURLOPT_HEADER, 0);65 66 // Return the output instead of displaying it directly67 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);68 69 curl_setopt($ch, CURLOPT_TIMEOUT, 60);70 @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);71 72 // Execute the curl session73 $output = curl_exec($ch);74 75 // Close the curl session76 curl_close($ch);77 $output=json_decode($output);78 79 80 $videoInfo= file_get_contents(“https://www.youtube.com/watch?v=$vid”);8182 $doc = new DomDocument;8384 $doc->validateOnParse = false;85 86 $doc->loadHTML($videoInfo);8788 $node= $doc->getElementById(‘watch-description-text’);89 90 $description=’’;91 if($node!=null and $node!=false){92 93 $description = $node->ownerDocument->saveHTML( $node );9495 $description= strip_tags($description,’<br>’);96 97 $breaks = array(“<br />","<br>","<br/>”); 98 $description = str_ireplace($breaks, “\r\n", $description); 99 }100 101 $return=array();102 if(is_object($output)){103 104 $return[‘title’]=$output->title;105 $return[‘thumbnail_url’]=$output->thumbnail_url;106 $return[‘description’]=$description;107 108 }109 110 echo json_encode($return);111 exit;112 113 }114 115}116117function check_file_exist_callback() {118 119 if(isset($_POST) and is_array($_POST) and isset($_POST[‘url’])){120121 $retrieved_nonce = '’;122123 if (isset($_POST[‘vNonce’]) and $_POST[‘vNonce’] != ‘’) {124125 $retrieved_nonce = $_POST[‘vNonce’];126 }127 if (!wp_verify_nonce($retrieved_nonce, ‘vNonce’)) {128129130 wp_die(‘Security check fail’);131 }132133 $handle = curl_init($_POST[‘url’]);134 curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);135 136 $response = curl_exec($handle);137 138 $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE);139 140 curl_close($handle);141 142 echo trim((string)$httpCode);die;143 144 }145 //echo die;146 147}148149150function responsive_video_gallery_plus_lightbox_admin_notices() {151 if (is_plugin_active ( ‘wp-responsive-video-gallery-with-lightbox/wp-responsive-video-gallery-with-lightbox.php’ )) {152 153 $uploads = wp_upload_dir ();154 $baseDir = $uploads [‘basedir’];155 $baseDir = str_replace ( “\\", “/", $baseDir );156 $pathToImagesFolder = $baseDir . '/wp-responsive-video-gallery-with-lightbox’;157 158 if (file_exists ( $pathToImagesFolder ) and is_dir ( $pathToImagesFolder )) {159 160 if (! is_writable ( $pathToImagesFolder )) {161 echo “<div class=’updated’><p>Responsive video gallery with lightbox is active but does not have write permission on</p><p><b>” . $pathToImagesFolder . “</b> directory.Please allow write permission.</p></div> “;162 }163 } else {164 165 wp_mkdir_p ( $pathToImagesFolder );166 if (! file_exists ( $pathToImagesFolder ) and ! is_dir ( $pathToImagesFolder )) {167 echo “<div class=’updated’><p>Responsive video gallery with lightbox is active but plugin does not have permission to create directory</p><p><b>” . $pathToImagesFolder . “</b> .Please create wp-responsive-video-gallery-with-lightbox directory inside upload directory and allow write permission.</p></div> “;168 }169 }170 }171}172function responsive_video_gallery_plus_lightbox_load_styles_and_js() {173 if (! is_admin ()) {174 175 wp_enqueue_style ( 'wp-video-gallery-lighbox-style’, plugins_url ( '/css/wp-video-gallery-lighbox-style.css’, __FILE__ ) );176 wp_enqueue_style ( 'vl-box-css’, plugins_url ( '/css/vl-box-css.css’, __FILE__ ) );177 wp_enqueue_script ( ‘jquery’ );178 wp_enqueue_script ( 'video-gallery-jc’, plugins_url ( '/js/video-gallery-jc.js’, __FILE__ ) );179 wp_enqueue_script ( 'vl-box-js’, plugins_url ( '/js/vl-box-js.js’, __FILE__ ) );180 }181}182function install_responsive_video_gallery_plus_lightbox() {183 global $wpdb;184 $table_name = $wpdb->prefix . “responsive_video_gallery_plus_responsive_lightbox";185 $charset_collate = $wpdb->get_charset_collate();186 187 $sql = “CREATE TABLE " . $table_name . " (188 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,189 `vtype` varchar(50) NOT NULL,190 `vid` varchar(500) NOT NULL,191 `video_url` varchar(1000) DEFAULT NULL,192 `embed_url` varchar(300) NOT NULL,193 `HdnMediaSelection` varchar(500) NOT NULL,194 `image_name` varchar(500) NOT NULL,195 `videotitle` varchar(1000) NOT NULL,196 `videotitleurl` varchar(1000) DEFAULT NULL,197 `video_description` text DEFAULT NULL,198 `video_order` int(11) NOT NULL DEFAULT '0’,199 `open_link_in` tinyint(1) NOT NULL DEFAULT '1’,200 `enable_light_box_video_desc` tinyint(1) NOT NULL DEFAULT '1’,201 `createdon` datetime NOT NULL,202 `slider_id` int(10) unsigned NOT NULL DEFAULT '0’,203 PRIMARY KEY (`id`)204 ) $charset_collate;";205 206 $responsive_video_gallery_slider_settings=array(207 ‘pauseonmouseover’ => '1’,208 ‘auto’ =>’’,209 ‘speed’ => '1000’,210 'pause’=>1000,211 ‘circular’ => '1’,212 ‘imageheight’ => '120’,213 ‘imagewidth’ => '120’,214 'imageMargin’=>’15’,215 'visible’=> '3’,216 'min_visible’=> '1’,217 ‘scroll’ => '1’,218 'resizeImages’=>’1’,219 'scollerBackground’=>’#FFFFFF’220 221 );222 223 if( !get_option( ‘responsive_video_gallery_slider_settings’ ) ) {224 225 update_option('responsive_video_gallery_slider_settings’,$responsive_video_gallery_slider_settings);226 } 227 228 require_once (ABSPATH . ‘wp-admin/includes/upgrade.php’);229 dbDelta ( $sql );230 231 $uploads = wp_upload_dir ();232 $baseDir = $uploads [‘basedir’];233 $baseDir = str_replace ( “\\", “/", $baseDir );234 $pathToImagesFolder = $baseDir . '/wp-responsive-video-gallery-with-lightbox’;235 wp_mkdir_p ( $pathToImagesFolder );236 237 238 239}240function responsive_video_gallery_plus_lightbox_add_admin_menu() {241 $hook_suffix=add_menu_page ( __ ( ‘Responsive Video Gallery Plus Lightbox’ ), __ ( ‘Video Gallery with Lightbox’ ), 'administrator’, 'responsive_video_gallery_with_lightbox’, ‘responsive_video_gallery_with_lightbox_admin_options_func’ );242 $hook_suffix=add_submenu_page ( 'responsive_video_gallery_with_lightbox’, __ ( ‘Gallery Settings’ ), __ ( ‘Gallery Settings’ ), 'administrator’, 'responsive_video_gallery_with_lightbox’, ‘responsive_video_gallery_with_lightbox_admin_options_func’ );243 $hook_suffix_image=add_submenu_page ( 'responsive_video_gallery_with_lightbox’, __ ( ‘Manage Videos’ ), __ ( ‘Manage Videos’ ), 'administrator’, 'responsive_video_gallery_with_lightbox_video_management’, ‘responsive_video_gallery_with_lightbox_video_management_func’ );244 $hook_suffix_prev=add_submenu_page ( 'responsive_video_gallery_with_lightbox’, __ ( ‘Preview Gallery’ ), __ ( ‘Preview Gallery’ ), 'administrator’, 'responsive_video_gallery_with_lightbox_video_preview’, ‘responsive_video_gallery_with_lightbox_video_preview_func’ );245 246 add_action( 'load-' . $hook_suffix , ‘responsive_video_gallery_plus_lightbox_add_admin_init’ );247 add_action( 'load-' . $hook_suffix_image , ‘responsive_video_gallery_plus_lightbox_add_admin_init’ );248 add_action( 'load-' . $hook_suffix_prev , ‘responsive_video_gallery_plus_lightbox_add_admin_init’ );249 250}251function responsive_video_gallery_plus_lightbox_add_admin_init() {252 $url = plugin_dir_url ( __FILE__ );253 254 wp_enqueue_style ( 'wp-video-gallery-lighbox-style’, plugins_url ( '/css/wp-video-gallery-lighbox-style.css’, __FILE__ ) );255 wp_enqueue_style ( 'vl-box-css’, plugins_url ( '/css/vl-box-css.css’, __FILE__ ) );256 wp_enqueue_script ( ‘jquery’ );257 wp_enqueue_script ( 'jquery.validate’, $url . ‘js/jquery.validate.js’ );258 wp_enqueue_script ( 'video-gallery-jc’, plugins_url ( '/js/video-gallery-jc.js’, __FILE__ ) );259 wp_enqueue_script ( 'vl-box-js’, plugins_url ( ‘/js/vl-box-js.js’, __FILE__ ) );260 261 responsive_video_gallery_plus_lightbox_admin_scripts_init ();262}263264265 function responsive_video_gallery_with_lightbox_admin_options_func(){266 267 if(isset($_POST[‘btnsave’])){268 269 if (!check_admin_referer(‘action_image_add_edit’, ‘add_edit_image_nonce’)) {270271 wp_die(‘Security check fail’);272 }273274275 $auto=trim(htmlentities(strip_tags($_POST[‘isauto’]),ENT_QUOTES));276 277 if($auto==’auto’)278 $auto=true;279 else if($auto==’manuall’)280 $auto=false; 281 else282 $auto=2; 283 284 $speed=(int)trim(htmlentities(strip_tags($_POST[‘speed’]),ENT_QUOTES));285 $pause=(int)trim(htmlentities(strip_tags($_POST[‘pause’]),ENT_QUOTES));286 287 if(isset($_POST[‘circular’]))288 $circular=true; 289 else290 $circular=false; 291292 //$scrollerwidth=$_POST[‘scrollerwidth’];293 294 $visible=trim(htmlentities(strip_tags($_POST[‘visible’]),ENT_QUOTES));295 296 $min_visible=trim(htmlentities(strip_tags($_POST[‘min_visible’]),ENT_QUOTES));297298 299 if(isset($_POST[‘pauseonmouseover’]))300 $pauseonmouseover=true; 301 else 302 $pauseonmouseover=false;303 304 if(isset($_POST[‘linkimage’]))305 $linkimage=true; 306 else 307 $linkimage=false;308 309 $scroll=trim(htmlentities(strip_tags($_POST[‘scroll’]),ENT_QUOTES));310 311 if($scroll=="”)312 $scroll=1;313 314 $imageMargin=(int) trim(htmlentities(strip_tags($_POST[‘imageMargin’]),ENT_QUOTES));315 $imageheight=(int) trim(htmlentities(strip_tags($_POST[‘imageheight’]),ENT_QUOTES));316 $imagewidth=(int) trim(htmlentities(strip_tags($_POST[‘imagewidth’]),ENT_QUOTES));317 318 $scollerBackground=trim(htmlentities(strip_tags($_POST[‘scollerBackground’]),ENT_QUOTES));319 320 $options=array();321 $options[‘pauseonmouseover’]=$pauseonmouseover; 322 $options[‘auto’]=$auto; 323 $options[‘speed’]=$speed; 324 $options[‘pause’]=$pause; 325 $options[‘circular’]=$circular; 326 //$options[‘scrollerwidth’]=$scrollerwidth; 327 $options[‘imageMargin’]=$imageMargin; 328 $options[‘imageheight’]=$imageheight; 329 $options[‘imagewidth’]=$imagewidth; 330 $options[‘visible’]=$visible; 331 $options[‘min_visible’]=$min_visible; 332 $options[‘scroll’]=$scroll; 333 $options[‘resizeImages’]=1; 334 $options[‘scollerBackground’]=$scollerBackground; 335 336 337 $settings=update_option('responsive_video_gallery_slider_settings’,$options); 338 $responsive_video_gallery_plus_lightbox_messages=array();339 $responsive_video_gallery_plus_lightbox_messages[‘type’]=’succ’;340 $responsive_video_gallery_plus_lightbox_messages[‘message’]=’Settings saved successfully.’;341 update_option('responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages);342343 344 345 } 346 $settings=get_option(‘responsive_video_gallery_slider_settings’);347 348?> 349<div id="poststuff” > 350 <div id="post-body” class="metabox-holder columns-2” > 351 <div id="post-body-content">352 <div class="wrap">353 <table><tr><td><a href="https://twitter.com/FreeAdsPost” class="twitter-follow-button” data-show-count="false” data-size="large” data-show-screen-name="false">Follow @FreeAdsPost</a>354 <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs”);</script></td>355 <td>356 <a target="_blank” title="Donate” href="http://www.i13websolution.com/donate-wordpress_image_thumbnail.php">357 <img id="help us for free plugin" height="30" width="90" src="<?php echo plugins_url( ‘images/paypaldonate.jpg’, __FILE__ ) ;?>" border="0" alt="help us for free plugin" title="help us for free plugin">358 </a>359 </td>360 </tr>361 </table>362<span><h3 style="color: blue;"><a target="_blank" href="http://www.i13websolution.com/wordpress-responsive-video-gallery-with-lightbox-pro.html">UPGRADE TO PRO VERSION</a></h3></span>363 <?php364 $messages=get_option(‘responsive_video_gallery_plus_lightbox_messages’); 365 $type=’’;366 $message=’’;367 if(isset($messages[‘type’]) and $messages[‘type’]!=""){368369 $type=$messages[‘type’];370 $message=$messages[‘message’];371372 } 373374375 if($type==’err’){ echo "<div class=’errMsg’>"; echo $message; echo "</div>";}376 else if($type==’succ’){ echo “<div class=’succMsg’>"; echo $message; echo “</div>";}377378379 update_option('responsive_video_gallery_plus_lightbox_messages’, array()); 380 ?> 381 382 <h2>Gallery Slider Settings</h2>383 <div id="poststuff">384 <div id="post-body” class="metabox-holder columns-2">385 <div id="post-body-content">386 <form method="post” action="" id="scrollersettiings" name="scrollersettiings" >387388 389 <div class="stuffbox" id="namediv" style="width:100%;">390 <h3><label>Auto Scroll ?</label></h3>391 <div class="inside">392 <table>393 <tr>394 <td>395 <?php $settings[‘auto’]=(int)$settings[‘auto’];?>396 <input style="width:20px;" type=’radio’ <?php if($settings[‘auto’]==1){echo "checked=’checked’";}?> name=’isauto’ value=’auto’ >Auto <input style="width:20px;" type=’radio’ name=’isauto’ <?php if($settings[‘auto’]==0){echo "checked=’checked’";} ?> value=’manuall’ >Scroll By Left & Right Arrow <input style="width:20px;" type=’radio’ name=’isauto’ <?php if($settings[‘auto’]==2){echo “checked=’checked’";} ?> value=’both’ >Scroll Auto With Arrow397 <div style="clear:both"></div>398 <div></div>399 </td>400 </tr>401 </table>402 <div style="clear:both"></div>403 </div>404 </div>405 <div class="stuffbox” id="namediv" style="width:100%;">406 <h3><label >Speed</label></h3>407 <div class="inside">408 <table>409 <tr>410 <td>411 <input type="text" id="speed" size="30" name="speed" value="<?php echo $settings[‘speed’]; ?>" style="width:100px;">412 <div style="clear:both"></div>413 <div></div>414 </td>415 </tr>416 </table>417 <div style="clear:both"></div>418419 </div>420 </div>421 <div class="stuffbox" id="namediv" style="width:100%;">422 <h3><label >Pause</label></h3>423 <div class="inside">424 <table>425 <tr>426 <td>427 <input type="text" id="pause" size="30" name="pause" value="<?php echo $settings[‘pause’]; ?>" style="width:100px;">428 <div style="clear:both"></div>429 <div></div>430 </td>431 </tr>432 </table>433 <div style="clear:both">The amount of time (in ms) between each auto transition</div>434435 </div>436 </div>437 <div class="stuffbox" id="namediv" style="width:100%;">438 <h3><label >Circular Slider ?</label></h3>439 <div class="inside">440 <table>441 <tr>442 <td>443 <input type="checkbox" id="circular" size="30" name="circular" value="" <?php if($settings[‘circular’]==true){echo “checked=’checked’";} ?> style="width:20px;"> Circular Slider ? 444 <div style="clear:both"></div>445 <div></div>446 </td>447 </tr>448 </table>449 <div style="clear:both"></div>450451 </div>452 </div>453 <div class="stuffbox” id="namediv" style="width:100%;">454 <h3><label>Slider Background color</label></h3>455 <div class="inside">456 <table>457 <tr>458 <td>459 <input type="text" id="scollerBackground" size="30" name="scollerBackground" value="<?php echo $settings[‘scollerBackground’]; ?>" style="width:100px;">460 <div style="clear:both"></div>461 <div></div>462 </td>463 </tr>464 </table>465466 <div style="clear:both"></div>467 </div>468 </div>469 <div class="stuffbox" id="namediv" style="width:100%;">470 <h3><label>Max Visible</label></h3>471 <div class="inside">472 <table>473 <tr>474 <td>475 <input type="text" id="visible" size="30" name="visible" value="<?php echo $settings[‘visible’]; ?>" style="width:100px;">476 <div style="clear:both">This will decide your slider width automatically</div>477 <div></div>478 </td>479 </tr>480 </table>481 specifies the number of items visible at all times within the slider.482 <div style="clear:both"></div>483484 </div>485 </div>486 <div class="stuffbox" id="namediv" style="width:100%;">487 <h3><label>Min Visible</label></h3>488 <div class="inside">489 <table>490 <tr>491 <td>492 <input type="text" id="min_visible" size="30" name="min_visible" value="<?php echo $settings[‘min_visible’]; ?>" style="width:100px;">493 <div style="clear:both">This will decide your slider width in responsive layout</div>494 <div></div>495 </td>496 </tr>497 </table>498 The responsive layout decide by slider itself using min visible.499 <div style="clear:both"></div>500 501 </div>502 </div>503 <div class="stuffbox" id="namediv" style="width:100%;">504 <h3><label>Scroll</label></h3>505 <div class="inside">506 <table>507 <tr>508 <td>509 <input type="text" id="scroll" size="30" name="scroll" value="<?php echo $settings[‘scroll’]; ?>" style="width:100px;">510 <div style="clear:both"></div>511 <div></div>512 </td>513 </tr>514 </table>515 You can specify the number of items to scroll when you click the next or prev buttons.516 <div style="clear:both"></div>517 </div>518 </div>519 <div class="stuffbox" id="namediv" style="width:100%;">520 <h3><label>Pause On Mouse Over ?</label></h3>521 <div class="inside">522 <table>523 <tr>524 <td>525 <input type="checkbox" id="pauseonmouseover" size="30" name="pauseonmouseover" value="" <?php if($settings[‘pauseonmouseover’]==true){echo “checked=’checked’";} ?> style="width:20px;"> Pause On Mouse Over ? 526 <div style="clear:both"></div>527 <div></div>528 </td>529 </tr>530 </table>531 <div style="clear:both"></div>532 </div>533 </div>534 535 <div class="stuffbox” id="namediv" style="width:100%;">536 <h3><label>Image Height</label></h3>537 <div class="inside">538 <table>539 <tr>540 <td>541 <input type="text" id="imageheight" size="30" name="imageheight" value="<?php echo $settings[‘imageheight’]; ?>" style="width:100px;">542 <div style="clear:both"></div>543 <div></div>544 </td>545 </tr>546 </table>547548 <div style="clear:both"></div>549 </div>550 </div>551 <div class="stuffbox" id="namediv" style="width:100%;">552 <h3><label>Image Width</label></h3>553 <div class="inside">554 <table>555 <tr>556 <td>557 <input type="text" id="imagewidth" size="30" name="imagewidth" value="<?php echo $settings[‘imagewidth’]; ?>" style="width:100px;">558 <div style="clear:both"></div>559 <div></div>560 </td>561 </tr>562 </table>563564 <div style="clear:both"></div>565 </div>566 </div>567 <div class="stuffbox" id="namediv" style="width:100%;">568 <h3><label>Image Margin</label></h3>569 <div class="inside">570 <table>571 <tr>572 <td>573 <input type="text" id="imageMargin" size="30" name="imageMargin" value="<?php echo $settings[‘imageMargin’]; ?>" style="width:100px;">574 <div style="clear:both;padding-top:5px">Gap between two images </div>575 <div></div>576 </td>577 </tr>578 </table>579580 <div style="clear:both"></div>581 </div>582 </div>583 584 <?php wp_nonce_field(‘action_image_add_edit’, ‘add_edit_image_nonce’); ?> 585 <input type="submit" name="btnsave" id="btnsave" value="Save Changes" class="button-primary"> <input type="button" name="cancle" id="cancle" value="Cancel" class="button-primary" onclick="location.href=’admin.php?page=responsive_video_gallery_with_lightbox_video_management’">586587 </form> 588 <script type="text/javascript">589590 var $n = jQuery.noConflict(); 591 $n(document).ready(function() {592593 $n(“#scrollersettiings”).validate({594 rules: {595 isauto: {596 required:true597 },speed: {598 required:true, 599 number:true, 600 maxlength:15601 },pause: {602 required:true, 603 number:true, 604 maxlength:15605 },606 visible:{607 required:true, 608 number:true,609 maxlength:15610611 },612 min_visible:{613 required:true, 614 number:true,615 maxlength:15616617 },618 scroll:{619 required:true,620 number:true,621 maxlength:15 622 },623 scollerBackground:{624 required:true,625 maxlength:7 626 },627 /*scrollerwidth:{628 required:true,629 number:true,630 maxlength:15 631 },*/imageheight:{632 required:true,633 number:true,634 maxlength:15 635 },636 imagewidth:{637 required:true,638 number:true,639 maxlength:15 640 },imageMargin:{641 required:true,642 number:true,643 maxlength:15 644 }645646 },647 errorClass: “image_error",648 errorPlacement: function(error, element) {649 error.appendTo( element.next().next());650 } 651652653 })654 655 $n(‘#scollerBackground’).wpColorPicker();656 657 });658659 </script> 660661 </div>662 </div>663 </div> 664 </div> 665 </div>666 <div id="postbox-container-1” class="postbox-container" > 667668 <div class="postbox"> 669 <h3 class="hndle"><span></span>Access All Themes In One Price</h3> 670 <div class="inside">671 <center><a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=11715_0_1_10" target="_blank"><img border="0" src="<?php echo plugins_url( ‘images/300x250.gif’, __FILE__ ) ;?>" width="250" height="250"></a></center>672673 <div style="margin:10px 5px">674675 </div>676 </div></div>677 <div class="postbox"> 678 <h3 class="hndle"><span></span>Best WordPress Themes</h3> 679 <div class="inside">680 <center><a href="https://mythemeshop.com/?ref=nik_gandhi007" target="_blank"><img src="<?php echo plugins_url( ‘images/300x250.png’, __FILE__ ) ;?>" width="250" height="250" border="0"></a></center>681 <div style="margin:10px 5px">682 </div>683 </div></div>684685 </div> 686 687 <div class="clear"></div>688 </div> 689 </div> 690<?php691 } 692 693function responsive_video_gallery_with_lightbox_video_management_func() {694 $action = ‘gridview’;695 global $wpdb;696 697 698 699 if (isset ( $_GET [‘action’] ) and $_GET [‘action’] != ‘’) {700 701 $action = trim ( $_GET [‘action’] );702 }703 ?>704705 <?php706 if (strtolower ( $action ) == strtolower ( ‘gridview’ )) {707 708 $wpcurrentdir = dirname ( __FILE__ );709 $wpcurrentdir = str_replace ( “\\", “/", $wpcurrentdir );710 711 $uploads = wp_upload_dir ();712 $baseurl = $uploads [‘baseurl’];713 $baseurl .= '/wp-responsive-video-gallery-with-lightbox/’;714 ?> 715 <div class="wrap">716 <style type="text/css">717 .pagination {718 clear: both;719 padding: 20px 0;720 position: relative;721 font-size: 11px;722 line-height: 13px;723 }724725 .pagination span, .pagination a {726 display: block;727 float: left;728 margin: 2px 2px 2px 0;729 padding: 6px 9px 5px 9px;730 text-decoration: none;731 width: auto;732 color: #fff;733 background: #555;734 }735736 .pagination a:hover {737 color: #fff;738 background: #3279BB;739 }740741 .pagination .current {742 padding: 6px 9px 5px 9px;743 background: #3279BB;744 color: #fff;745 }746 </style>747 <!–[if !IE]><!–>748 <style type="text/css">749 @media only screen and (max-width: 800px) {750 /* Force table to not be like tables anymore */751 #no-more-tables table, #no-more-tables thead, #no-more-tables tbody,752 #no-more-tables th, #no-more-tables td, #no-more-tables tr {753 display: block;754 }755756 /* Hide table headers (but not display: none;, for accessibility) */757 #no-more-tables thead tr {758 position: absolute;759 top: -9999px;760 left: -9999px;761 }762 #no-more-tables tr {763 border: 1px solid #ccc;764 }765 #no-more-tables td {766 /* Behave like a “row” */767 border: none;768 border-bottom: 1px solid #eee;769 position: relative;770 padding-left: 50%;771 white-space: normal;772 text-align: left;773 }774 #no-more-tables td:before {775 /* Now like a table header */776 position: absolute;777 /* Top/left values mimic padding */778 top: 6px;779 left: 6px;780 width: 45%;781 padding-right: 10px;782 white-space: nowrap;783 text-align: left;784 font-weight: bold;785 }786787 /*788 Label the data789 */790 #no-more-tables td:before {791 content: attr(data-title);792 }793 }794 </style>795 <!–<![endif]–>796 <?php797 $messages = get_option ( ‘responsive_video_gallery_plus_lightbox_messages’ );798 $type = '’;799 $message = '’;800 if (isset ( $messages [‘type’] ) and $messages [‘type’] != “”) {801 802 $type = $messages [‘type’];803 $message = $messages [‘message’];804 }805 806 if ($type == ‘err’) {807 echo “<div class=’errMsg’>";808 echo $message;809 echo “</div>";810 } else if ($type == ‘succ’) {811 echo “<div class=’succMsg’>";812 echo $message;813 echo “</div>";814 }815 816 update_option ( 'responsive_video_gallery_plus_lightbox_messages’, array () );817 ?>818 <div id="poststuff” > 819 <div id="post-body” class="metabox-holder columns-2” > 820 <div id="post-body-content">821 <div class="wrap">822 <span><h3 style="color: blue;"><a target="_blank” href="http://www.i13websolution.com/wordpress-responsive-video-gallery-with-lightbox-pro.html">UPGRADE TO PRO VERSION</a></h3></span>823 <div style="width: 100%;">824 <div style="float: left; width: 100%;">825 <div class="icon32 icon32-posts-post” id="icon-edit">826 <br>827 </div>828 <h2>829 Videos<a class="button add-new-h2"830 href="admin.php?page=responsive_video_gallery_with_lightbox_video_management&action=addedit">Add831 New</a>832 </h2>833 <br />834835 <form method="POST"836 action="admin.php?page=responsive_video_gallery_with_lightbox_video_management&action=deleteselected"837 id="posts-filter">838 <div class="alignleft actions">839 <select name="action_upper” id="action_upper">840 <option selected="selected" value="-1">Bulk Actions</option>841 <option value="delete">delete</option>842 </select> <input type="submit" value="Apply"843 class="button-secondary action" id="deleteselected"844 name="deleteselected" onclick="return confirmDelete_bulk();">845 </div>846 <br class="clear">847 <?php848 global $wpdb;849 $settings=get_option(‘responsive_video_gallery_slider_settings’);850 851 $visibleImages = $settings [‘visible’];852 $query = “SELECT * FROM " . $wpdb->prefix . “responsive_video_gallery_plus_responsive_lightbox order by video_order,createdon desc";853 $rows = $wpdb->get_results ( $query, ‘ARRAY_A’ );854 $rowCount = sizeof ( $rows );855 ?>856 <?php if ($rowCount < $visibleImages) { ?>857 <h4 style="color: green"> Current slider setting - Total visible Videos <?php echo $visibleImages; ?></h4>858 <h4 style="color: green">Please add atleast <?php echo $visibleImages; ?> videos</h4>859 <?php860 } else {861 echo “<br/>";862 }863 ?>864 <div id="no-more-tables">865 <table cellspacing="0” id="gridTbl"866 class="table-bordered table-striped table-condensed cf">867 <thead>868 <tr>869 <th class="manage-column column-cb check-column” scope="col"><input870 type="checkbox"></th>871 <th>Id</th>872 <th><span>Video Type</span></th>873 <th><span>Title</span></th>874 <th><span></span></th>875 <th><span>Published On</span></th>876 <th><span>Edit</span></th>877 <th><span>Delete</span></th>878 </tr>879 </thead>880881 <tbody id="the-list">882 <?php883 if (count ( $rows ) > 0) {884 885 global $wp_rewrite;886 $rows_per_page = 15;887 888 $current = (isset ( $_GET [‘paged’] )) ? ((int) htmlentities(strip_tags($_GET [‘paged’]),ENT_QUOTES)) : 1;889 $pagination_args = array (890 ‘base’ => @add_query_arg ( 'paged’, ‘%#%’ ),891 ‘format’ => '’,892 ‘total’ => ceil ( sizeof ( $rows ) / $rows_per_page ),893 ‘current’ => $current,894 ‘show_all’ => false,895 ‘type’ => ‘plain’ 896 );897 898 $start = ($current - 1) * $rows_per_page;899 $end = $start + $rows_per_page;900 $end = (sizeof ( $rows ) < $end) ? sizeof ( $rows ) : $end;901 $delRecNonce = wp_create_nonce(‘delete_image’);902 903 for($i = $start; $i < $end; ++ $i) {904 905 $row = $rows [$i];906 907 $id = $row [‘id’];908 $editlink = “admin.php?page=responsive_video_gallery_with_lightbox_video_management&action=addedit&id=$id";909 $deletelink = “admin.php?page=responsive_video_gallery_with_lightbox_video_management&action=delete&id=$id&nonce=$delRecNonce";910 911 $outputimgmain = $baseurl . $row [‘image_name’].’?rand=’. rand(0, 5000);912 ?>913 <tr valign="top">914 <td class="alignCenter check-column” data-title="Select Record"><input915 type="checkbox” value="<?php echo $row[‘id’] ?>"916 name="thumbnails[]“></td>917 <td data-title="Id” class="alignCenter"><?php echo $row[‘id’]; ?></td>918 <td data-title="Video Type” class="alignCenter"><div>919 <strong><?php echo $row[‘vtype’]; ?></strong>920 </div></td>921 <td data-title="Title" class="alignCenter">922 <div>923 <strong><?php echo $row[‘videotitle’]; ?></strong>924 </div></td>925 <td class="alignCenter"><img926 src="<?php echo $outputimgmain; ?>" style="width: 50px"927 height="50px" /></td>928 <td data-title="Published On" class="alignCenter"><?php echo $row[‘createdon’] ?></td>929 <td data-title="Edit" class="alignCenter"><strong><a930 href=’<?php echo $editlink; ?>’ title="edit">Edit</a></strong></td>931 <td data-title="Delete" class="alignCenter"><strong><a932 href=’<?php echo $deletelink; ?>’933 onclick="return confirmDelete();" title="delete">Delete</a> </strong></td>934 </tr>935 <?php936 }937 } else {938 ?>939 <tr valign="top" class=""940 id="">941 <td colspan="8" data-title="No Record" align="center"><strong>No942 Videos Found</strong></td>943 </tr>944 <?php945 }946 ?> 947 </tbody>948 </table>949 </div>950 <?php951 if (sizeof ( $rows ) > 0) {952 echo "<div class=’pagination’ style=’padding-top:10px’>";953 echo paginate_links ( $pagination_args );954 echo “</div>";955 }956 ?>957 <br />958 <div class="alignleft actions">959 <select name="action” id="action_bottom">960 <option selected="selected" value="-1">Bulk Actions</option>961 <option value="delete">delete</option>962 </select>963 <?php wp_nonce_field(‘action_settings_mass_delete’, ‘mass_delete_nonce’); ?>964 <input type="submit" value="Apply"965 class="button-secondary action" id="deleteselected"966 name="deleteselected" onclick="return confirmDelete_bulk();">967 </div>968969 </form>970 <script type="text/JavaScript">971972 function confirmDelete_bulk(){973 var topval=document.getElementById(“action_bottom”).value;974 var bottomVal=document.getElementById(“action_upper”).value;975976 if(topval==’delete’ || bottomVal==’delete’){977978979 var agree=confirm(“Are you sure you want to delete selected videos ?”);980 if (agree)981 return true ;982 else983 return false;984 }985 }986 function confirmDelete(){987988 var agree=confirm(“Are you sure you want to delete this video ?”);989 if (agree)990 return true ;991 else992 return false;993 }994 </script>995996 <br class="clear">997 </div>998 <div style="clear: both;"></div>999 <?php $url = plugin_dir_url(__FILE__); ?>100010011002 </div>1003 <h3>To print this video gallery into WordPress Post/Page use below code</h3>1004 <input type="text"1005 value=’[print_responsive_video_gallery_plus_lightbox] '1006 style="width: 400px; height: 30px"1007 onclick="this.focus(); this.select()" />1008 <div class="clear"></div>1009 <h3>To print this video gallery into WordPress theme/template PHP files use1010 below code</h3>1011 <?php1012 $shortcode = '[print_responsive_video_gallery_plus_lightbox]‘;1013 ?>1014 <input type="text"1015 value="<?php echo do_shortcode(‘<?php echo htmlentities($shortcode, ENT_QUOTES); ?>’); ?>"1016 style="width: 400px; height: 30px"1017 onclick="this.focus(); this.select()" />1018 <div class="clear"></div>1019 </div>1020 </div>1021 <div id="postbox-container-1" class="postbox-container" > 10221023 <div class="postbox"> 1024 <h3 class="hndle"><span></span>Access All Themes In One Price</h3> 1025 <div class="inside">1026 <center><a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=11715_0_1_10" target="_blank"><img border="0" src="<?php echo plugins_url( ‘images/300x250.gif’, __FILE__ ) ;?>" width="250" height="250"></a></center>10271028 <div style="margin:10px 5px">10291030 </div>1031 </div></div>1032 <div class="postbox"> 1033 <h3 class="hndle"><span></span>Best WordPress Themes</h3> 1034 <div class="inside">1035 <center><a href="https://mythemeshop.com/?ref=nik_gandhi007" target="_blank"><img src="<?php echo plugins_url( ‘images/300x250.png’, __FILE__ ) ;?>" width="250" height="250" border="0"></a></center>1036 <div style="margin:10px 5px">1037 </div>1038 </div></div>10391040 </div>1041 </div>1042 </div> <?php1043 } else if (strtolower ( $action ) == strtolower ( ‘addedit’ )) {1044 $url = plugin_dir_url ( __FILE__ );1045 $vNonce = wp_create_nonce(‘vNonce’);1046 ?><?php1047 if (isset ( $_POST [‘btnsave’] )) {1048 1049 if (!check_admin_referer(‘action_image_add_edit’, ‘add_edit_image_nonce’)) {10501051 wp_die(‘Security check fail’);1052 }10531054 $uploads = wp_upload_dir ();1055 $baseDir = $uploads [‘basedir’];1056 $baseDir = str_replace ( "\\", "/", $baseDir );1057 $pathToImagesFolder = $baseDir . ‘/wp-responsive-video-gallery-with-lightbox’;1058 1059 $vtype = trim ( htmlentities(strip_tags ( $_POST [‘vtype’] ),ENT_QUOTES) );1060 $videourl = trim ( htmlentities(strip_tags($_POST [‘videourl’] ),ENT_QUOTES));1061 // echo $videourl;die;1062 $vid = uniqid ( ‘vid_’ );1063 $embed_url=’’;1064 if ($vtype == ‘youtube’) {1065 // parse1066 1067 $parseUrl = @parse_url ( $videourl );1068 if (is_array ( $parseUrl )) {1069 1070 $queryStr = $parseUrl [‘query’];1071 parse_str ( $queryStr, $array );1072 if (is_array ( $array ) and isset ( $array [‘v’] )) {1073 1074 $vid = $array [‘v’];1075 }1076 }1077 1078 $embed_url="//www.youtube.com/embed/$vid"; 1079 }1080 else if($vtype==’dailymotion’){1081 1082 $pattern = “#(?<=video/).*?(?=_)#";1083 preg_match($pattern, $videourl, $matches, PREG_OFFSET_CAPTURE, 3);1084 $vid=0;1085 if($matches and is_array($matches)){1086 1087 $vid=$matches[0][0];1088 }1089 1090 $embed_url="//www.dailymotion.com/embed/video/$vid";1091 1092 }1093 1094 1095 $HdnMediaSelection = trim ( htmlentities(strip_tags($_POST [‘HdnMediaSelection’] ),ENT_QUOTES));1096 $videotitle = trim ( htmlentities(strip_tags($_POST [‘videotitle’] ),ENT_QUOTES)) ;1097 $videotitleurl = trim ( htmlentities(strip_tags($_POST [‘videotitleurl’] ),ENT_QUOTES));1098 $video_order = 0;1099 1100 $video_description = '’;1101 1102 $videotitle = str_replace(“’","’",$videotitle);1103 $videotitle = str_replace('"’, ‘"’, $videotitle);1104 1105 $open_link_in = 0;1106 1107 $enable_light_box_video_desc = 0;11081109 $location = “admin.php?page=responsive_video_gallery_with_lightbox_video_management";1110 // edit save1111 if (isset ( $_POST [‘videoid’] )) {1112 1113 try {1114 1115 $videoidEdit=htmlentities(strip_tags($_POST [‘videoid’]),ENT_QUOTES);1116 if (trim ( $_POST [‘HdnMediaSelection’] ) != ‘’) {1117 1118 $pInfo = pathinfo ( $HdnMediaSelection );1119 $ext = $pInfo [‘extension’];1120 $imagename = $vid . ‘_big.’ . $ext;1121 $imageUploadTo = $pathToImagesFolder . ‘/’ . $imagename;1122 @copy ( $HdnMediaSelection, $imageUploadTo );1123 if(!file_exists($imageUploadTo)){1124 vg_save_image_curl($HdnMediaSelection,$imageUploadTo);1125 }1126 $settings=get_option(‘responsive_video_gallery_slider_settings’);1127 $imageheight = $settings [‘imageheight’];1128 $imagewidth = $settings [‘imagewidth’];1129 @unlink($pathToImagesFolder.’/’.$vid . '_big_’.$imageheight.’_’.$imagewidth.’.’.$ext);1130 }1131 1132 $query = “update " . $wpdb->prefix . “responsive_video_gallery_plus_responsive_lightbox1133 set vtype=’$vtype’,vid=’$vid’,video_url=’$videourl’,embed_url=’$embed_url’,image_name=’$imagename’,HdnMediaSelection=’$HdnMediaSelection’,1134 videotitle=’$videotitle’,videotitleurl=’$videotitleurl’,video_description=’$video_description’,video_order=$video_order,1135 open_link_in=$open_link_in,enable_light_box_video_desc=$enable_light_box_video_desc where id=$videoidEdit";1136 1137 1138 $wpdb->query ( $query );1139 1140 $responsive_video_gallery_plus_lightbox_messages = array ();1141 $responsive_video_gallery_plus_lightbox_messages [‘type’] = 'succ’;1142 $responsive_video_gallery_plus_lightbox_messages [‘message’] = 'Video updated successfully.’;1143 update_option ( 'responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages );1144 } catch ( Exception $e ) {1145 1146 $responsive_video_gallery_plus_lightbox_messages = array ();1147 $responsive_video_gallery_plus_lightbox_messages [‘type’] = 'err’;1148 $responsive_video_gallery_plus_lightbox_messages [‘message’] = 'Error while adding video’;1149 update_option ( 'responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages );1150 }11511152 1153 1154 echo “<script type=’text/javascript’> location.href=’$location’;</script>";1155 exit ();1156 } else {1157 1158 // add new1159 1160 $createdOn = current_time ( ‘Y-m-d h:i:s’ );1161 1162 try {1163 1164 if (trim ( $_POST [‘HdnMediaSelection’] ) != ‘’) {1165 $pInfo = pathinfo ( $HdnMediaSelection );1166 $ext = $pInfo [‘extension’];1167 $imagename = $vid . ‘_big.’ . $ext;1168 $imageUploadTo = $pathToImagesFolder . ‘/’ . $imagename;1169 @copy ( $HdnMediaSelection, $imageUploadTo );1170 if(!file_exists($imageUploadTo)){1171 vg_save_image_curl($HdnMediaSelection,$imageUploadTo);1172 }11731174 }1175 1176 $query = “INSERT INTO " . $wpdb->prefix . “responsive_video_gallery_plus_responsive_lightbox 1177 (vtype, vid,video_url,embed_url,image_name,HdnMediaSelection,videotitle,videotitleurl,video_description,video_order,open_link_in,1178 enable_light_box_video_desc,createdon) 1179 VALUES (‘$vtype’,’$vid’,’$videourl’,’$embed_url’,’$imagename’,’$HdnMediaSelection’,’$videotitle’,’$videotitleurl’,’$video_description’,1180 $video_order,$open_link_in,$enable_light_box_video_desc,’$createdOn’)“;1181 1182 //echo $query;die;1183 $wpdb->query ( $query );1184 1185 $responsive_video_gallery_plus_lightbox_messages = array ();1186 $responsive_video_gallery_plus_lightbox_messages [‘type’] = 'succ’;1187 $responsive_video_gallery_plus_lightbox_messages [‘message’] = 'New video added successfully.’;1188 update_option ( 'responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages );1189 } catch ( Exception $e ) {1190 1191 $responsive_video_gallery_plus_lightbox_messages = array ();1192 $responsive_video_gallery_plus_lightbox_messages [‘type’] = 'err’;1193 $responsive_video_gallery_plus_lightbox_messages [‘message’] = 'Error while adding video’;1194 update_option ( 'responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages );1195 }1196 1197 echo “<script type=’text/javascript’> location.href=’$location’;</script>";1198 exit ();1199 }1200 } else {1201 1202 $uploads = wp_upload_dir ();1203 $baseurl = $uploads [‘baseurl’];1204 $baseurl .= '/wp-responsive-video-gallery-with-lightbox/’;1205 ?>1206 <div id="poststuff” > 1207 <div id="post-body” class="metabox-holder columns-2” > 1208 <div id="post-body-content">1209 <div class="wrap">1210 <div style="float: left; width: 100%;">1211 <div class="wrap">1212 <?php1213 if (isset ( $_GET [‘id’] ) and $_GET [‘id’] > 0) {1214 1215 $id = $_GET [‘id’];1216 $query = “SELECT * FROM " . $wpdb->prefix . “responsive_video_gallery_plus_responsive_lightbox WHERE id=$id";1217 1218 $myrow = $wpdb->get_row ( $query );1219 1220 if (is_object ( $myrow )) {1221 1222 1223 $vtype = $myrow->vtype ;1224 $title = $myrow->videotitle ;1225 $image_name = $myrow->image_name;1226 $video_url = $myrow->video_url ;1227 $HdnMediaSelection = $myrow->HdnMediaSelection;1228 $videotitle = $myrow->videotitle;1229 $videotitleurl=$myrow->videotitleurl;1230 $video_order = $myrow->video_order;1231 $video_description = $myrow->video_description;1232 $open_link_in = $myrow->open_link_in ;1233 $enable_light_box_video_desc = $myrow->enable_light_box_video_desc ;1234 }1235 ?>1236 <h2>Update Video</h2><?php1237 } else {1238 1239 $vtype=’’;1240 $title = '’;1241 $videotitle=’’;1242 $videotitleurl=’’;1243 $HdnMediaSelection=’’;1244 $video_url = '’;1245 $image_link = '’;1246 $image_name = '’;1247 $video_order = '’;1248 $video_description = '’;1249 $open_link_in = true;1250 $enable_light_box_video_desc = true;1251 ?>1252 1253 <div style="clear:both">1254 <span><h3 style="color: blue;"><a target="_blank” href="http://www.i13websolution.com/wordpress-responsive-video-gallery-with-lightbox-pro.html">UPGRADE TO PRO VERSION</a></h3></span>1255 </div> 1256 <h2>Add Video</h2>1257 <?php } ?>1258 <br />1259 <div id="poststuff">1260 <div id="post-body” class="metabox-holder columns-2">1261 <div id="post-body-content">1262 <form method="post” action="” id="addimage” name="addimage"1263 enctype="multipart/form-data">1264 <div class="stuffbox” id="namediv” style="width: 100%">1265 <h3>1266 <label for="link_name">Video Information (<span1267 style="font-size: 11px; font-weight: normal"><?php _e(' Choose Video Site’); ?></span>)1268 </label>1269 </h3>1270 <div class="inside">1271 <div>1272 <input type="radio” value="youtube” name="vtype"1273 <?php if($vtype==’youtube’): ?> checked=’checked’ <?php endif;?> style="width: 15px" id="type_youtube" />Youtube 1274 <input <?php if($vtype==’dailymotion’): ?> checked=’checked’ <?php endif;?> type="radio" value="dailymotion" name="vtype"1275 style="width: 15px" id="type_DailyMotion" />DailyMotion 1276 </div>1277 <div style="clear: both"></div>1278 <div></div>1279 <div style="clear: both"></div>1280 <br />1281 <div>1282 <b>Video Url</b> <input type="text" id="videourl"1283 class="url" tabindex="1" size="30" name="videourl"1284 value="<?php echo $video_url; ?>">1285 </div>1286 <div style="clear: both"></div>1287 <div></div>1288 <div style="clear: both"></div>1289 </div>1290 </div>1291 <div class="stuffbox" id="namediv" style="width: 100%">1292 <h3>1293 <label for="link_name">Video Thumbnail Information</label>1294 </h3>1295 <div class="inside" id="fileuploaddiv">1296 <?php if ($image_name != “”) { ?>1297 <div>1298 <b>Current Image : </b>1299 <br/>1300 <img id="img_disp" name="img_disp"1301 src="<?php echo $baseurl . $image_name; ?>" />1302 </div>1303 <?php }else{ ?> 1304 <img1305 src="<?php echo plugins_url('/images/no-img.jpeg’, __FILE__); ?>"1306 id="img_disp" name="img_disp" />1307 1308 <?php } ?>1309 <br /> <a1310 href="javascript:;" class="niks_media"1311 id="videoFromExternalSite" ><b>Click Here to get video1312 information and thumbnail<span id=’fromval’> From <?php echo $vtype;?></span>1313 </b></a> <img1314 src="<?php echo plugins_url('/images/ajax-loader.gif’, __FILE__); ?>"1315 style="display: none" id="loading_img" name="loading_img" />1316 <div style="clear: both"></div>1317 <div></div>1318 <div class="uploader">1319 <br /> <b style="margin-left: 50px;">OR</b>1320 <div style="clear: both; margin-top: 15px;"></div>1321 <?php if (responsive_video_gallery_plus_responsive_lightbox_get_wp_version() >= 3.5) { ?>1322 <a1323 href="javascript:;" class="niks_media" id="myMediaUploader"><b>Click1324 Here to upload custom video thumbnail</b></a>1325 <?php } ?> 1326 <br /> <br />1327 <div>1328 <input id="HdnMediaSelection" name="HdnMediaSelection"1329 type="hidden" value="<?php echo $HdnMediaSelection;?>" />1330 </div>1331 <div style="clear: both"></div>1332 <div></div>1333 <div style="clear: both"></div>13341335 <br />1336 </div>1337 <script>13381339 function GetParameterValues(param,str) {1340 var return_p=’’; 1341 var url = str.slice(str.indexOf(‘?’) + 1).split(‘&’);1342 for (var i = 0; i < url.length; i++) {1343 var urlparam = url[i].split(‘=’);1344 if (urlparam[0] == param) {1345 return_p= urlparam[1];1346 }1347 }1348 return return_p;1349 }13501351 var $n = jQuery.noConflict();13521353 function UrlExists(url, cb){1354 $n.ajax({1355 url: url,1356 dataType: 'text’,1357 type: ‘GET’,1358 complete: function(xhr){1359 if(typeof cb === ‘function’)1360 cb.apply(this, [xhr.status]);1361 }1362 });1363 }1364 1365 function getDailyMotionId(url) {1366 var m = url.match(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);1367 if (m !== null) {1368 if(m[4] !== undefined) {1369 return m[4];1370 }1371 return m[2];1372 }1373 return null;1374 }1375 1376 1377 $n(document).ready(function() {13781379 1380 $n(“input:radio[name=vtype]").click(function() {13811382 1383 var value = $n(this).val();1384 $n(“#fromval”).html(" from " + value);1385 });1386 1387 $n(“#videoFromExternalSite”).click(function() {13881389 1390 var videoService = $n('input[name="vtype”]:checked’).length;1391 var videourlVal = $n.trim($n(“#videourl”).val());1392 var flag = true;1393 if (videourlVal == ‘’ && videoService == 0){13941395 alert(‘Please select video site.\nPlease enter video url.’);1396 $n(“input:radio[name=vtype]").focus();1397 flag = false;1398 1399 }1400 else if (videoService == 0){14011402 alert(‘Please select video site.’);1403 $n(“input:radio[name=vtype]").focus();1404 flag = false;1405 }1406 else if (videourlVal == ‘’){14071408 alert(‘Please enter video url.’);1409 $n(“#videourl”).focus();1410 flag = false;1411 }14121413 if (flag){14141415 setTimeout(function() {1416 $n(“#loading_img”).show(); 1417 }, 100);14181419 var selectedRadio = $n('input[name=vtype]');1420 var checkedValueRadio = selectedRadio.filter(‘:checked’).val();1421 if (checkedValueRadio == ‘youtube’) {1422 var vId = GetParameterValues(‘v’, videourlVal);1423 if(vId!=’’){14241425 1426 var tumbnailImg=’http://img.youtube.com/vi/’+vId+’/maxresdefault.jpg’;14271428 var data = {1429 'action’: ‘check_file_exist’,1430 ‘url’: tumbnailImg,1431 ‘vNonce’:’<?php echo $vNonce; ?>’1432 };14331434 $n.post(ajaxurl, data, function(response) {14351436 1437 1438 var youtubeJsonUri=’http://www.youtube.com/oembed?url=https://www.youtube.com/watch%3Fv=’+vId+’&format=json’;1439 var data_youtube = {1440 ‘action’: ‘get_youtube_info’,1441 ‘url’: youtubeJsonUri,1442 ‘vid’:vId,1443 ‘vNonce’:’<?php echo $vNonce; ?>’1444 };1445 1446 $n.post(ajaxurl, data_youtube, function(data) {1447 1448 data = $n.parseJSON(data);1449 1450 if(typeof data ==’object’){ 1451 if(typeof data ==’object’){ 1452 1453 if(data.title!=’’ && data.title!=’’){1454 $n(“#videotitle”).val(data.title); 1455 }1456 $n(“#videotitleurl”).val(videourlVal);1457 if(data.description!=’’ && data.description!=’’){1458 $n(“#video_description”).val(data.description); 1459 }1460 if(response==’404’ && data.thumbnail_url!=’’){1461 tumbnailImg=data.thumbnail_url;1462 }1463 else{1464 tumbnailImg=’http://img.youtube.com/vi/’+vId+’/0.jpg’;1465 }1466 1467 $n(“#img_disp”).attr(‘src’, tumbnailImg);1468 $n(“#HdnMediaSelection”).val(tumbnailImg);1469 $n(“#loading_img”).hide();1470 1471 }1472 1473 }1474 $n(“#loading_img”).hide();1475 }) 1476 1477 1478 });1479 1480 }1481 else{1482 alert(‘Could not found such video’);1483 $n(“#loading_img”).hide();1484 }1485 }1486 else if(checkedValueRadio == ‘dailymotion’){14871488 var vid=getDailyMotionId(videourlVal); 1489 var apiUrl=’https://api.dailymotion.com/video/’+vid+’?fields=description,id,thumbnail_720_url,title’;1490 $n.getJSON( apiUrl, function( data ) {1491 if(typeof data ==’object’){ 149214931494 $n(“#HdnMediaSelection”).val(data.thumbnail_720_url); 1495 $n(“#videotitle”).val($n.trim(data.title));1496 $n(“#videotitleurl”).val(videourlVal);1497 $n(“#img_disp”).attr('src’, data.thumbnail_720_url);1498 $n(“#loading_img”).hide();1499 } 1500 $n(“#loading_img”).hide(); 1501 }) 150215031504 $n(“#loading_img”).hide();1505 } 15061507 $n(“#loading_img”).hide();1508 }1509 1510 setTimeout(function() {1511 $n(“#loading_img”).hide(); 1512 }, 2000); 1513 1514 });1515 //uploading files variable1516 var custom_file_frame;1517 $n(“#myMediaUploader”).click(function(event) {1518 event.preventDefault();1519 //If the frame already exists, reopen it1520 if (typeof (custom_file_frame) !== “undefined”) {1521 custom_file_frame.close();1522 }15231524 //Create WP media frame.1525 custom_file_frame = wp.media.frames.customHeader = wp.media({1526 //Title of media manager frame1527 title: “WP Media Uploader",1528 library: {1529 type: 'image’1530 },1531 button: {1532 //Button text1533 text: “Set Image"1534 },1535 //Do not allow multiple files, if you want multiple, set true1536 multiple: false1537 });1538 //callback for selected image1539 custom_file_frame.on('select’, function() {15401541 var attachment = custom_file_frame.state().get(‘selection’).first().toJSON();1542 var validExtensions = new Array();1543 validExtensions[0] = 'jpg’;1544 validExtensions[1] = 'jpeg’;1545 validExtensions[2] = 'png’;1546 validExtensions[3] = ‘gif’;1547 1548 var inarr = parseInt($n.inArray(attachment.subtype, validExtensions));1549 if (inarr > 0 && attachment.type.toLowerCase() == ‘image’){15501551 var titleTouse = “";1552 var imageDescriptionTouse = “";1553 if ($n.trim(attachment.title) != ‘’){15541555 titleTouse = $n.trim(attachment.title);1556 }1557 else if ($n.trim(attachment.caption) != ‘’){15581559 titleTouse = $n.trim(attachment.caption);1560 }15611562 if ($n.trim(attachment.description) != ‘’){15631564 imageDescriptionTouse = $n.trim(attachment.description);1565 }1566 else if ($n.trim(attachment.caption) != ‘’){15671568 imageDescriptionTouse = $n.trim(attachment.caption);1569 }15701571 // $n(“#videotitle”).val(titleTouse);1572 // $n(“#video_description”).val(imageDescriptionTouse);1573 1574 if (attachment.id != ‘’){1575 1576 $n(“#HdnMediaSelection”).val(attachment.url);1577 $n(“#img_disp”).attr('src’, attachment.url);1578 1579 }15801581 }1582 else{15831584 alert(‘Invalid image selection.’);1585 }1586 //do something with attachment variable, for example attachment.filename1587 //Object:1588 //attachment.alt - image alt1589 //attachment.author - author id1590 //attachment.caption1591 //attachment.dateFormatted - date of image uploaded1592 //attachment.description1593 //attachment.editLink - edit link of media1594 //attachment.filename1595 //attachment.height1596 //attachment.icon - don’t know WTF?))1597 //attachment.id - id of attachment1598 //attachment.link - public link of attachment, for example “"http://site.com/?attachment_id=115""1599 //attachment.menuOrder1600 //attachment.mime - mime type, for example image/jpeg"1601 //attachment.name - name of attachment file, for example “my-image"1602 //attachment.status - usual is “inherit"1603 //attachment.subtype - “jpeg” if is “jpg"1604 //attachment.title1605 //attachment.type - “image"1606 //attachment.uploadedTo1607 //attachment.url - http url of image, for example “http://site.com/wp-content/uploads/2012/12/my-image.jpg"1608 //attachment.width1609 });1610 //Open modal1611 custom_file_frame.open();1612 });1613 })1614 </script>1615 </div>1616 </div>16171618 <div class="stuffbox” id="namediv” style="width: 100%">1619 <h3>1620 <label for="link_name">Video Title (<span1621 style="font-size: 11px; font-weight: normal"><?php _e(‘Used into lightbox’); ?></span>)1622 </label>1623 </h3>1624 <div class="inside">1625 <div>1626 <input type="text” id="videotitle” tabindex="1” size="30"1627 name="videotitle” value="<?php echo $videotitle; ?>">1628 </div>1629 <div style="clear: both"></div>1630 <div></div>1631 <div style="clear: both"></div>1632 </div>1633 </div>1634 <div class="stuffbox” id="namediv” style="width: 100%">1635 <h3>1636 <label for="link_name">Video Title Url (<span1637 style="font-size: 11px; font-weight: normal"><?php _e(' click on title redirect to this url.Used in lightbox for video title’); ?></span>)1638 </label>1639 </h3>1640 <div class="inside">1641 <div>1642 <input type="text” id="videotitleurl” class="url"1643 tabindex="1” size="30” name="videotitleurl"1644 value="<?php echo $videotitleurl; ?>">1645 </div>1646 <div style="clear: both"></div>1647 <div></div>1648 <div style="clear: both"></div>16491650 </div>1651 </div>1652 1653 1654 <?php if (isset($_GET[‘id’]) and $_GET[‘id’] > 0) { ?> 1655 <input type="hidden" name="videoid" id="videoid" value="<?php echo (int) htmlentities(strip_tags($_GET[‘id’]),ENT_QUOTES); ?>">1656 <?php1657 }1658 ?>1659 <?php wp_nonce_field(‘action_image_add_edit’,’add_edit_image_nonce’); ?> 1660 <input type="submit"1661 onclick="" name="btnsave" id="btnsave" value="Save Changes"1662 class="button-primary"> <input type="button"1663 name="cancle" id="cancle" value="Cancel"1664 class="button-primary"1665 onclick="location.href = ‘admin.php?page=responsive_video_gallery_with_lightbox_video_management’">16661667 </form>1668 <script type="text/javascript">16691670 var $n = jQuery.noConflict();1671 $n(document).ready(function() {16721673 $n.validator.setDefaults({ 1674 ignore: [],1675 // any other default options and/or rules1676 });16771678 $n(“#addimage”).validate({1679 rules: {1680 videotitle: {1681 required:true,1682 maxlength: 2001683 },1684 vtype: {1685 required:true16861687 },1688 videourl: {1689 required:true,1690 url:true,1691 maxlength: 5001692 },1693 HdnMediaSelection:{1694 required:true 1695 },1696 videotitleurl: {16971698 url:true,1699 maxlength: 5001700 }1701 1702 },1703 errorClass: "image_error",1704 errorPlacement: function(error, element) {1705 error.appendTo(element.parent().next().next());1706 }, messages: {1707 HdnMediaSelection: “Please select video thumbnail or Upload by wordpress media uploader.",1708 1709 }1710 1711 })1712 });1713 function validateFile(){17141715 var $n = jQuery.noConflict();1716 if ($n(‘#currImg’).length > 0 || $n.trim($n(“#HdnMediaSelection”).val()) != “”){1717 return true;1718 }1719 var fragment = $n(“#image_name”).val();1720 var filename = $n(“#image_name”).val().replace(/.+[\\\/]/, “”);1721 var videoid = $n(“#image_name”).val();1722 if (videoid == “”){17231724 if (filename != “”)1725 return true;1726 else1727 {1728 $n(“#err_daynamic”).remove();1729 $n(“#image_name”).after('<label class="image_error” id="err_daynamic">Please select file or use media manager to select file.</label>’);1730 return false;1731 }1732 }1733 else{1734 return true;1735 }1736 }1737 function reloadfileupload(){17381739 var $n = jQuery.noConflict();1740 var fragment = $n(“#image_name”).val();1741 var filename = $n(“#image_name”).val().replace(/.+[\\\/]/, “”);1742 var validExtensions = new Array();1743 validExtensions[0] = 'jpg’;1744 validExtensions[1] = ‘jpeg’;1745 validExtensions[2] = ‘png’;1746 validExtensions[3] = ‘gif’;1747 validExtensions[4] = ‘bmp’;1748 validExtensions[5] = ‘tif’;1749 var extension = filename.substr((filename.lastIndexOf(‘.’) + 1)).toLowerCase();1750 var inarr = parseInt($n.inArray(extension, validExtensions));1751 if (inarr < 0){17521753 $n(“#err_daynamic”).remove();1754 $n(‘#fileuploaddiv’).html($n(‘#fileuploaddiv’).html());1755 $n(“#image_name”).after(‘<label class="image_error" id="err_daynamic">Invalid file extension</label>’);1756 }1757 else{1758 $n(“#err_daynamic”).remove();1759 }176017611762 }1763 </script>17641765 </div>1766 </div>1767 </div>1768 1769 </div>1770 </div>1771 </div>1772 </div> 1773 <div id="postbox-container-1" class="postbox-container" > 17741775 <div class="postbox"> 1776 <h3 class="hndle"><span></span>Access All Themes In One Price</h3> 1777 <div class="inside">1778 <center><a href="http://www.elegantthemes.com/affiliates/idevaffiliate.php?id=11715_0_1_10" target="_blank"><img border="0" src="<?php echo plugins_url( ‘images/300x250.gif’, __FILE__ ) ;?>" width="250" height="250"></a></center>17791780 <div style="margin:10px 5px">17811782 </div>1783 </div></div>1784 <div class="postbox"> 1785 <h3 class="hndle"><span></span>Best WordPress Themes</h3> 1786 <div class="inside">1787 <center><a href="https://mythemeshop.com/?ref=nik_gandhi007" target="_blank"><img src="<?php echo plugins_url( ‘images/300x250.png’, __FILE__ ) ;?>" width="250" height="250" border="0"></a></center>1788 <div style="margin:10px 5px">1789 </div>1790 </div></div>17911792 </div>1793 </div>1794 </div> 1795<?php1796 }1797 } else if (strtolower ( $action ) == strtolower ( ‘delete’ )) {1798 1799 1800 $retrieved_nonce = ‘’;18011802 if(isset($_GET[‘nonce’]) and $_GET[‘nonce’]!=’’){18031804 $retrieved_nonce=$_GET[‘nonce’];18051806 }1807 if (!wp_verify_nonce($retrieved_nonce, ‘delete_image’ ) ){180818091810 wp_die(‘Security check fail’); 1811 }1812 1813 $uploads = wp_upload_dir ();1814 $baseDir = $uploads [‘basedir’];1815 $baseDir = str_replace ( “\\", “/", $baseDir );1816 $pathToImagesFolder = $baseDir . ‘/wp-responsive-video-gallery-with-lightbox’;1817 1818 1819 $location = "admin.php?page=responsive_video_gallery_with_lightbox_video_management";1820 $deleteId = ( int ) htmlentities(strip_tags($_GET [‘id’]),ENT_QUOTES);1821 1822 try {1823 1824 $query = "SELECT * FROM " . $wpdb->prefix . "responsive_video_gallery_plus_responsive_lightbox WHERE id=$deleteId";1825 $myrow = $wpdb->get_row ( $query );1826 1827 if (is_object ( $myrow )) {1828 1829 $image_name = $myrow->image_name;1830 $wpcurrentdir = dirname ( __FILE__ );1831 $wpcurrentdir = str_replace ( "\\", “/", $wpcurrentdir );1832 $imagetoDel = $pathToImagesFolder . ‘/’ . $image_name;1833 $settings=get_option(‘responsive_video_gallery_slider_settings’);1834 $imageheight = $settings [‘imageheight’];1835 $imagewidth = $settings [‘imagewidth’];1836 1837 $pInfo = pathinfo ( $myrow->HdnMediaSelection );1838 $ext = $pInfo [‘extension’];18391840 @unlink ( $imagetoDel );1841 @unlink($pathToImagesFolder.’/’.$myrow->vid . ‘_big_’.$imageheight.’_’.$imagewidth.’.’.$ext);18421843 1844 $query = “delete from " . $wpdb->prefix . “responsive_video_gallery_plus_responsive_lightbox where id=$deleteId";1845 $wpdb->query ( $query );1846 1847 $responsive_video_gallery_plus_lightbox_messages = array ();1848 $responsive_video_gallery_plus_lightbox_messages [‘type’] = 'succ’;1849 $responsive_video_gallery_plus_lightbox_messages [‘message’] = 'Video deleted successfully.’;1850 update_option ( 'responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages );1851 }1852 } catch ( Exception $e ) {1853 1854 $responsive_video_gallery_plus_lightbox_messages = array ();1855 $responsive_video_gallery_plus_lightbox_messages [‘type’] = 'err’;1856 $responsive_video_gallery_plus_lightbox_messages [‘message’] = 'Error while deleting video.’;1857 update_option ( 'responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages );1858 }1859 1860 echo “<script type=’text/javascript’> location.href=’$location’;</script>";1861 exit ();1862 } else if (strtolower ( $action ) == strtolower ( ‘deleteselected’ )) {1863 1864 if(!check_admin_referer(‘action_settings_mass_delete’,’mass_delete_nonce’)){18651866 wp_die(‘Security check fail’); 1867 }1868 1869 1870 $location = “admin.php?page=responsive_video_gallery_with_lightbox_video_management";1871 1872 if (isset ( $_POST ) and isset ( $_POST [‘deleteselected’] ) and ($_POST [‘action’] == ‘delete’ or $_POST [‘action_upper’] == ‘delete’)) {1873 1874 $uploads = wp_upload_dir ();1875 $baseDir = $uploads [‘basedir’];1876 $baseDir = str_replace ( “\\", “/", $baseDir );1877 $pathToImagesFolder = $baseDir . '/wp-responsive-video-gallery-with-lightbox’;1878 1879 if (sizeof ( $_POST [‘thumbnails’] ) > 0) {1880 1881 $deleteto = $_POST [‘thumbnails’];1882 $implode = implode ( ‘,’, $deleteto );1883 1884 try {1885 1886 $settings=get_option(‘responsive_video_gallery_slider_settings’);1887 $imageheight = $settings [‘imageheight’];1888 $imagewidth = $settings [‘imagewidth’];18891890 foreach ( $deleteto as $img ) {1891 1892 $query = "SELECT * FROM " . $wpdb->prefix . "responsive_video_gallery_plus_responsive_lightbox WHERE id=$img";1893 $myrow = $wpdb->get_row ( $query );1894 1895 if (is_object ( $myrow )) {1896 1897 $image_name = $myrow->image_name;1898 $wpcurrentdir = dirname ( __FILE__ );1899 $wpcurrentdir = str_replace ( "\\", "/", $wpcurrentdir );1900 $imagetoDel = $pathToImagesFolder . ‘/’ . $image_name;1901 1902 $pInfo = pathinfo ( $myrow->HdnMediaSelection );1903 $ext = $pInfo [‘extension’];19041905 @unlink ( $imagetoDel );1906 @unlink($pathToImagesFolder.’/’.$myrow->vid . ‘_big_’.$imageheight.’_’.$imagewidth.’.’.$ext);19071908 1909 1910 $query = "delete from " . $wpdb->prefix . "responsive_video_gallery_plus_responsive_lightbox where id=$img";1911 $wpdb->query ( $query );1912 1913 $responsive_video_gallery_plus_lightbox_messages = array ();1914 $responsive_video_gallery_plus_lightbox_messages [‘type’] = ‘succ’;1915 $responsive_video_gallery_plus_lightbox_messages [‘message’] = ‘selected videos deleted successfully.’;1916 update_option ( ‘responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages );1917 }1918 }1919 } catch ( Exception $e ) {1920 1921 $responsive_video_gallery_plus_lightbox_messages = array ();1922 $responsive_video_gallery_plus_lightbox_messages [‘type’] = ‘err’;1923 $responsive_video_gallery_plus_lightbox_messages [‘message’] = ‘Error while deleting videos.’;1924 update_option ( ‘responsive_video_gallery_plus_lightbox_messages’, $responsive_video_gallery_plus_lightbox_messages );1925 }1926 1927 echo "<script type=’text/javascript’> location.href=’$location’;</script>";1928 exit ();1929 } else {1930 1931 echo "<script type=’text/javascript’> location.href=’$location’;</script>";1932 exit ();1933 }1934 } else {1935 1936 echo "<script type=’text/javascript’> location.href=’$location’;</script>";1937 exit ();1938 }1939 }1940}1941function responsive_video_gallery_with_lightbox_video_preview_func() {1942 global $wpdb;1943 19441945 $settings=get_option(‘responsive_video_gallery_slider_settings’);1946 1947 $rand_Numb = uniqid ( ‘thumnail_slider’ );1948 $rand_Num_td = uniqid ( ‘divSliderMain’ );1949 $rand_var_name = uniqid ( ‘rand_’ );1950 1951 1952 $wpcurrentdir = dirname ( __FILE__ );1953 $wpcurrentdir = str_replace ( "\\", "/", $wpcurrentdir );1954 // $settings=get_option(‘thumbnail_slider_settings’);1955 1956 $uploads = wp_upload_dir ();1957 $baseDir = $uploads [‘basedir’];1958 $baseDir = str_replace ( “\\", “/", $baseDir );1959 $pathToImagesFolder = $baseDir . '/wp-responsive-video-gallery-with-lightbox’;1960 $baseurl = $uploads [‘baseurl’];1961 $baseurl .= '/wp-responsive-video-gallery-with-lightbox/’;1962 ?> 1963 <style type=’text/css’>1964#<?php echo $rand_Num_td;?> .bx-wrapper .bx-viewport {background: none repeat scroll 0 0<?php echo $settings [‘scollerBackground’];?> ! important;1965 border: 0px none !important;1966 box-shadow: 0 0 0 0 !important;1967 /*padding:<?php echo $settings[‘imageMargin’]; ?>px !important;*/1968}1969#poststuff #post-body.columns-2{margin-right: 0px}1970</style>1971<?php1972 $wpcurrentdir = dirname ( __FILE__ );1973 $wpcurrentdir = str_replace ( “\\", “/", $wpcurrentdir );1974 $randOmeAlbName = uniqid ( ‘alb_’ );1975 $randOmeRel = uniqid ( ‘rel_’ );1976 1977 ?>1978 <div style="width: 100%;">1979 <div style="float: left; width: 100%;">1980 <div class="wrap">1981 <h2>Slider Preview</h2>1982 1983 <?php if (is_array($settings)) { ?>1984 <div id="poststuff">1985 <div id="post-body” class="metabox-holder columns-2">1986 <div id="post-body-content">1987 <div style="clear: both;"></div>1988 <?php $url = plugin_dir_url(__FILE__); ?> 19891990 <div style="width: auto; postion: relative” id="<?php echo $rand_Num_td; ?>">1991 <div id="<?php echo $rand_Numb; ?>” class="responsiveSlider” style="margin-top: 2px !important; visibility: hidden;">1992 <?php1993 global $wpdb;1994 $imageheight = $settings [‘imageheight’];1995 $imagewidth = $settings [‘imagewidth’];1996 $query = "SELECT * FROM " . $wpdb->prefix . "responsive_video_gallery_plus_responsive_lightbox order by createdon desc";1997 $rows = $wpdb->get_results ( $query, ‘ARRAY_A’ );19981999 if (count ( $rows ) > 0) {2000 2001 foreach ( $rows as $row ) {20022003 $imagename = $row [‘image_name’];2004 $video_url = $row [‘video_url’];2005 $imageUploadTo = $pathToImagesFolder . ‘/’ . $imagename;2006 $imageUploadTo = str_replace ( "\\", "/", $imageUploadTo );2007 $pathinfo = pathinfo ( $imageUploadTo );2008 $filenamewithoutextension = $pathinfo [‘filename’];2009 $outputimg = "";20102011 $outputimgmain = $baseurl . $row [‘image_name’];2012 if ($settings [‘resizeImages’] == 0) {20132014 $outputimg = $baseurl . $row [‘image_name’];2015 } else {2016 $imagetoCheck = $pathToImagesFolder . ‘/’ . $filenamewithoutextension . ‘_’ . $imageheight . ‘_’ . $imagewidth . ‘.’ . $pathinfo [‘extension’];20172018 if (file_exists ( $imagetoCheck )) {2019 $outputimg = $baseurl . $filenamewithoutextension . ‘_’ . $imageheight . ‘_’ . $imagewidth . ‘.’ . $pathinfo [‘extension’];2020 } else {20212022 if (function_exists ( ‘wp_get_image_editor’ )) {20232024 $image = wp_get_image_editor ( $pathToImagesFolder . “/” . $row [‘image_name’] );20252026 if (! is_wp_error ( $image )) {2027 $image->resize ( $imagewidth, $imageheight, true );2028 $image->save ( $imagetoCheck );2029 $outputimg = $baseurl . $filenamewithoutextension . ‘_’ . $imageheight . ‘_’ . $imagewidth . ‘.’ . $pathinfo [‘extension’];2030 } else {2031 $outputimg = $baseurl . $row [‘image_name’];2032 }2033 } else if (function_exists ( ‘image_resize’ )) {20342035 $return = image_resize ( $pathToImagesFolder . “/” . $row [‘image_name’], $imagewidth, $imageheight );2036 if (! is_wp_error ( $return )) {20372038 $isrenamed = rename ( $return, $imagetoCheck );2039 if ($isrenamed) {2040 $outputimg = $baseurl . $filenamewithoutextension . ‘_’ . $imageheight . ‘_’ . $imagewidth . ‘.’ . $pathinfo [‘extension’];2041 } else {2042 $outputimg = $baseurl . $row [‘image_name’];2043 }2044 } else {2045 $outputimg = $baseurl . $row [‘image_name’];2046 }2047 } else {20482049 $outputimg = $baseurl . $row [‘image_name’];2050 }20512052 // $url = plugin_dir_url(__FILE__)."imagestoscroll/".$filenamewithoutextension.’_’.$imageheight.’_’.$imagewidth.’.’.$pathinfo[‘extension’];2053 }2054 }2055 $embed_url=$row[‘embed_url’];20562057 $title="";2058 $rowTitle=$row[‘videotitle’];2059 $rowTitle=str_replace("’","’",$rowTitle); 2060 $rowTitle=str_replace(‘"’,’”’,$rowTitle); 2061 2062 $rowDescrption=$row[‘video_description’];2063 $rowDescrption=str_replace("’","’",$rowDescrption); 2064 $rowDescrption=str_replace(‘"’,’”’,$rowDescrption); 2065 $rowDescrption=strip_tags($rowDescrption); 2066 2067 if(strlen($rowDescrption)>300){2068 2069 $rowDescrption=substr($rowDescrption,0,300)."…"; 2070 }2071 //$openImageInNewTab=’_blank’;2072 $open_link_in=$row[‘open_link_in’];2073 // if($open_link_in==0){2074 $openImageInNewTab=’_self’; 2075 //}2076 2077 if(trim($row[‘videotitle’])!=’’ and trim($row[‘videotitleurl’])!=’’){2078 2079 $title="<a class=’Imglink’ target=’$openImageInNewTab’ href=’{$row[‘videotitleurl’]}’>{$rowTitle}</a>";2080 if($row[‘video_description’]!=’’){2081 $title.="<div class=’clear_description_’>{$rowDescrption}</div>";2082 }2083 }2084 else if(trim($row[‘videotitle’])!=’’ and trim($row[‘videotitleurl’])==’’){2085 2086 $title="<a class=’Imglink’ href=’#’>{$rowTitle}</a>"; 2087 if($row[‘video_description’]!=’’){2088 $title.="<div class=’clear_description_’>{$rowDescrption}</div>";2089 }2090 }2091 else{2092 2093 if($row[‘video_description’]!=’’)2094 $title="<div class=’clear_description_’>{$row[‘video_description’]}</div>"; 2095 }2096 2097 2098 ?>2099 <div>2100 <a rel="<?php echo $randOmeRel;?>” data-overlay="1” data-title="<?php echo $title;?>” class="video_lbox” href="<?php echo $embed_url;?>">2101 <img src="<?php echo $outputimg; ?>” alt="<?php echo $rowTitle; ?>” title="<?php if(trim($rowDescrption)!=’’){ echo $rowDescrption;} else{echo $rowTitle;}; ?>” />2102 <span class="playbtnCss"></span> 2103 </a> 2104 2105 </div>2106 2107 <?php } ?> 2108 <?php } ?> 2109 </div>2110 </div>2111 <script>2112 var $n = jQuery.noConflict();2113 var uniqObj=$n("a[rel=’<?php echo $randOmeRel;?>’]");2114 2115 $n(document).ready(function(){2116 var <?php echo $rand_var_name; ?> = $n(‘#<?php echo $rand_Num_td; ?>’).html();2117 $n(‘#<?php echo $rand_Numb; ?>’).bxSlider({2118 <?php if($settings[‘visible’]==1 ):?>2119 mode:’fade’,2120 <?php endif;?>2121 slideWidth: <?php echo $settings[‘imagewidth’]; ?>,2122 minSlides: <?php echo $settings[‘min_visible’]; ?>,2123 maxSlides: <?php echo $settings[‘visible’]; ?>,2124 moveSlides: <?php echo $settings[‘scroll’]; ?>,2125 slideMargin:<?php echo $settings[‘imageMargin’]; ?>,2126 speed:<?php echo $settings[‘speed’]; ?>,2127 pause:<?php echo $settings[‘pause’]; ?>,2128 <?php if($settings[‘pauseonmouseover’] and ($settings[‘auto’]==1 or $settings[‘auto’]==2) ){ ?>2129 autoHover: true,2130 <?php2131 } else {2132 if ($settings[‘auto’]==1 or $settings[‘auto’]==2) {2133 ?>2134 autoHover:false,2135 <?php2136 }2137 }2138 ?>2139 <?php if ($settings[‘auto’]==1): ?>2140 controls:false,2141 <?php else: ?>2142 controls:true,2143 <?php endif; ?>2144 pager:false,2145 useCSS:false,2146 <?php if($settings[‘auto’]==1 or $settings[‘auto’]==2):?>2147 autoStart:true,2148 autoDelay:200,2149 auto:true,2150 <?php endif; ?>2151 <?php if ($settings[‘circular’]): ?>2152 infiniteLoop: true,2153 <?php else: ?>2154 infiniteLoop: false,2155 <?php endif; ?>2156 captions:false,2157 pager:false,2158 onSliderLoad: function(){2159 2160 $n(“#<?php echo $rand_Numb; ?>”).css(“visibility", “visible”);2161 $n(“.video_lbox”).fancybox({2162 ‘type’ : “iframe",2163 'overlayColor’:’#000000’,2164 'padding’: 10,2165 'autoScale’: true,2166 'autoDimensions’:true,2167 'transitionIn’: 'none’,2168 'uniqObj’:uniqObj,2169 'transitionOut’: 'none’,2170 'titlePosition’: 'outside’,2171 <?php if ($settings[‘circular’]): ?>2172 'cyclic’:true,2173 <?php else: ?>2174 'cyclic’:false,2175 <?php endif; ?>2176 'hideOnContentClick’:false,2177 ‘width’ : 650,2178 ‘height’ : 400,2179 'titleFormat’: function(title, currentArray, currentIndex, currentOpts) {21802181 var currtElem = $n('#<?php echo $rand_Numb; ?> a[href="’+currentOpts.href+’”]');21822183 var isoverlay = $n(currtElem).attr(‘data-overlay’)21842185 if(isoverlay=="1” && $n.trim(title)!="”){2186 return ‘<span id="fancybox-title-over">’ + title + '</span>’;2187 }2188 else{2189 return '’;2190 }21912192 },21932194 });2195 2196 2197 2198 2199 } 22002201 });2202 $n(“#<?php echo $rand_Numb; ?>”).show();2203 <?php if ($settings[‘auto’]) { ?>2204 <?php $newrand = rand(0, 1111111111); ?>2205 var is_firefox = navigator.userAgent.toLowerCase().indexOf(‘firefox’) > - 1;2206 var is_android = navigator.userAgent.toLowerCase().indexOf(‘android’) > - 1;2207 var is_iphone = navigator.userAgent.toLowerCase().indexOf(‘iphone’) > - 1;2208 var width = $n(window).width();2209 if (is_firefox && (is_android || is_iphone)){22102211 } else{2212 var timer;2213 $n(window).bind('resize’, function(){2214 if ($n(window).width() != width){2215 2216 width = $n(window).width();2217 timer && clearTimeout(timer);2218 timer = setTimeout(onResize<?php echo $newrand; ?>, 600);2219 }2220 });2221 }22222223 function onResize<?php echo $newrand; ?>(){2224 $n(‘#<?php echo $rand_Num_td; ?>’).html(‘’);2225 $n(‘#<?php echo $rand_Num_td; ?>’).html(<?php echo $rand_var_name; ?>);2226 $n(‘#<?php echo $rand_Numb; ?>’).bxSlider({22272228 <?php if($settings[‘visible’]==1 ):?>2229 mode:’fade’,2230 <?php endif;?>2231 slideWidth: <?php echo $settings[‘imagewidth’]; ?>,2232 minSlides: <?php echo $settings[‘min_visible’]; ?>,2233 maxSlides: <?php echo $settings[‘visible’]; ?>,2234 moveSlides: <?php echo $settings[‘scroll’]; ?>,2235 slideMargin:<?php echo $settings[‘imageMargin’]; ?>,2236 speed:<?php echo $settings[‘speed’]; ?>,2237 pause:<?php echo $settings[‘pause’]; ?>,2238 <?php if($settings[‘pauseonmouseover’] and ($settings[‘auto’]==1 or $settings[‘auto’]==2) ){ ?>2239 autoHover: true,2240 <?php2241 } 2242 else {2243 if ($settings[‘auto’]==1 or $settings[‘auto’]==2) {2244 ?>2245 autoHover:false,2246 <?php2247 }2248 }2249 ?>2250 <?php if ($settings[‘auto’]==1): ?>2251 controls:false,2252 <?php else: ?>2253 controls:true,2254 <?php endif; ?>2255 pager:false,2256 useCSS:false,2257 <?php if ($settings[‘auto’]==1 or $settings[‘auto’]==2): ?>2258 autoStart:true,2259 autoDelay:200,2260 auto:true,2261 <?php endif; ?>2262 <?php if ($settings[‘circular’]): ?>2263 infiniteLoop: true,2264 <?php else: ?>2265 infiniteLoop: false,2266 <?php endif; ?>2267 captions:false,2268 pager:false,2269 onSliderLoad: function(){2270 2271 $n(“#<?php echo $rand_Numb; ?>”).css(“visibility", “visible”);2272 $n(“.video_lbox”).fancybox({2273 ‘type’ : “iframe",2274 'overlayColor’:’#000000’,2275 'padding’: 10,2276 'autoScale’: true,2277 'autoDimensions’:true,2278 'transitionIn’: 'none’,2279 'uniqObj’:uniqObj,2280 'transitionOut’: 'none’,2281 'titlePosition’: 'outside’,2282 <?php if ($settings[‘circular’]): ?>2283 'cyclic’:true,2284 <?php else: ?>2285 'cyclic’:false,2286 <?php endif; ?>2287 'hideOnContentClick’:false,2288 ‘width’ : 650,2289 ‘height’ : 400,2290 'titleFormat’: function(title, currentArray, currentIndex, currentOpts) {22912292 var currtElem = $n('#<?php echo $rand_Numb; ?> a[href="’+currentOpts.href+’”]');22932294 var isoverlay = $n(currtElem).attr(‘data-overlay’)22952296 if(isoverlay=="1” && $n.trim(title)!="”){2297 return ‘<span id="fancybox-title-over">’ + title + ‘</span>’;2298 }2299 else{2300 return ‘’;2301 }23022303 },23042305 });23062307230823092310 } 23112312 });2313 2314 }23152316 <?php } ?>23172318 2319 2320 });2321 </script>2322 2323 </div>2324 </div>2325 </div> 2326 <?php } ?>2327 </div>2328 </div>2329 <div class="clear"></div>2330 </div>2331 <?php if (is_array($settings)) { ?>23322333 <h3>To print this video gallery into WordPress Post/Page use below code</h3>2334 <input type="text" value=’[print_responsive_video_gallery_plus_lightbox] ‘2335 style="width: 400px; height: 30px"2336 onclick="this.focus(); this.select()" />2337 <div class="clear"></div>2338 <h3>To print this video gallery into WordPress theme/template PHP files use below code</h3>2339 <?php2340 $shortcode = '[print_responsive_video_gallery_plus_lightbox]‘;2341 ?>2342 <input type="text" value="<?php echo do_shortcode(‘<?php echo htmlentities($shortcode, ENT_QUOTES); ?>’); ?>" style="width: 400px; height: 30px" onclick="this.focus(); this.select()" />2343 <?php } ?>2344 <div class="clear"></div>2345 <?php2346 }2347function print_responsive_video_gallery_plus_lightbox_func($atts) {2348 ob_start();23492350 global $wpdb;23512352 $settings=get_option(‘responsive_video_gallery_slider_settings’);2353 $rand_Numb = uniqid ( ‘thumnail_slider’ );2354 $rand_Num_td = uniqid ( ‘divSliderMain’ );2355 $rand_var_name = uniqid ( ‘rand_’ );2356 2357 2358 $wpcurrentdir = dirname ( __FILE__ );2359 $wpcurrentdir = str_replace ( "\\", “/", $wpcurrentdir );2360 // $settings=get_option(‘thumbnail_slider_settings’);2361 2362 $uploads = wp_upload_dir ();2363 $baseDir = $uploads [‘basedir’];2364 $baseDir = str_replace ( “\\", “/", $baseDir );2365 $pathToImagesFolder = $baseDir . '/wp-responsive-video-gallery-with-lightbox’;2366 $baseurl = $uploads [‘baseurl’];2367 $baseurl .= '/wp-responsive-video-gallery-with-lightbox/’;2368 $randOmeRel = uniqid ( ‘rel_’ );2369 $randOmVlBox= uniqid(‘video_lbox_’);2370 ?> 2371 <style type=’text/css’>2372 #<?php echo $rand_Num_td;?> .bx-wrapper .bx-viewport {2373 background: none repeat scroll 0 0<?php echo $settings [‘scollerBackground’];?> ! important;2374 border: 0px none !important;2375 box-shadow: 0 0 0 0 !important;2376 /*padding:<?php echo $settings[‘imageMargin’]; ?>px !important;*/2377 }2378 </style> 2379 <?php2380 2381 if (is_array($settings)) 2382 2383 { ?>2384 <div style="clear: both;"></div>2385 <?php $url = plugin_dir_url(__FILE__); ?> 23862387 <div style="width: auto; postion: relative” id="<?php echo $rand_Num_td; ?>">2388 <div id="<?php echo $rand_Numb; ?>” class="responsiveSlider” style="margin-top: 2px !important; visibility: hidden;">2389 <?php2390 global $wpdb;2391 $imageheight = $settings [‘imageheight’];2392 $imagewidth = $settings [‘imagewidth’];2393 $query = "SELECT * FROM " . $wpdb->prefix . "responsive_video_gallery_plus_responsive_lightbox order by createdon desc";2394 $rows = $wpdb->get_results ( $query, ‘ARRAY_A’ );23952396 if (count ( $rows ) > 0) {2397 foreach ( $rows as $row ) {23982399 $imagename = $row [‘image_name’];2400 $video_url = $row [‘video_url’];2401 $imageUploadTo = $pathToImagesFolder . ‘/’ . $imagename;2402 $imageUploadTo = str_replace ( "\\", "/", $imageUploadTo );2403 $pathinfo = pathinfo ( $imageUploadTo );2404 $filenamewithoutextension = $pathinfo [‘filename’];2405 $outputimg = "";24062407 $outputimgmain = $baseurl . $row [‘image_name’];2408 if ($settings [‘resizeImages’] == 0) {24092410 $outputimg = $baseurl . $row [‘image_name’];2411 } else {2412 $imagetoCheck = $pathToImagesFolder . ‘/’ . $filenamewithoutextension . ‘_’ . $imageheight . ‘_’ . $imagewidth . ‘.’ . $pathinfo [‘extension’];24132414 if (file_exists ( $imagetoCheck )) {2415 $outputimg = $baseurl . $filenamewithoutextension . ‘_’ . $imageheight . ‘_’ . $imagewidth . ‘.’ . $pathinfo [‘extension’];2416 } else {24172418 if (function_exists ( ‘wp_get_image_editor’ )) {24192420 $image = wp_get_image_editor ( $pathToImagesFolder . “/” . $row [‘image_name’] );24212422 if (! is_wp_error ( $image )) {2423 $image->resize ( $imagewidth, $imageheight, true );2424 $image->save ( $imagetoCheck );2425 $outputimg = $baseurl . $filenamewithoutextension . ‘_’ . $imageheight . ‘_’ . $imagewidth . ‘.’ . $pathinfo [‘extension’];2426 } else {2427 $outputimg = $baseurl . $row [‘image_name’];2428 }2429 } else if (function_exists ( ‘image_resize’ )) {24302431 $return = image_resize ( $pathToImagesFolder . “/” . $row [‘image_name’], $imagewidth, $imageheight );2432 if (! is_wp_error ( $return )) {24332434 $isrenamed = rename ( $return, $imagetoCheck );2435 if ($isrenamed) {2436 $outputimg = $baseurl . $filenamewithoutextension . ‘_’ . $imageheight . ‘_’ . $imagewidth . ‘.’ . $pathinfo [‘extension’];2437 } else {2438 $outputimg = $baseurl . $row [‘image_name’];2439 }2440 } else {2441 $outputimg = $baseurl . $row [‘image_name’];2442 }2443 } else {24442445 $outputimg = $baseurl . $row [‘image_name’];2446 }24472448 // $url = plugin_dir_url(__FILE__)."imagestoscroll/".$filenamewithoutextension.’_’.$imageheight.’_’.$imagewidth.’.’.$pathinfo[‘extension’];2449 }2450 }2451 $embed_url=$row[‘embed_url’];24522453 $title="";2454 $rowTitle=$row[‘videotitle’];2455 $rowTitle=str_replace("’","’",$rowTitle); 2456 $rowTitle=str_replace(‘"’,’”’,$rowTitle); 24572458 $rowDescrption=$row[‘video_description’];2459 $rowDescrption=str_replace("’","’",$rowDescrption); 2460 $rowDescrption=str_replace(‘"’,’”’,$rowDescrption); 2461 $rowDescrption=strip_tags($rowDescrption); 24622463 if(strlen($rowDescrption)>300){24642465 $rowDescrption=substr($rowDescrption,0,300)."…"; 2466 }2467 // $openImageInNewTab=’_blank’;2468 $open_link_in=$row[‘open_link_in’];2469 //if($open_link_in==0){2470 $openImageInNewTab=’_self’; 2471 //}24722473 if(trim($row[‘videotitle’])!=’’ and trim($row[‘videotitleurl’])!=’’){24742475 $title="<a class=’Imglink’ target=’$openImageInNewTab’ href=’{$row[‘videotitleurl’]}’>{$rowTitle}</a>";2476 if($row[‘video_description’]!=’’){2477 $title.="<div class=’clear_description_’>{$rowDescrption}</div>";2478 }2479 }2480 else if(trim($row[‘videotitle’])!=’’ and trim($row[‘videotitleurl’])==’’){24812482 $title="<a class=’Imglink’ href=’#’>{$rowTitle}</a>"; 2483 if($row[‘video_description’]!=’’){2484 $title.="<div class=’clear_description_’>{$rowDescrption}</div>";2485 }2486 }2487 else{24882489 if($row[‘video_description’]!=’’)2490 $title="<div class=’clear_description_’>{$row[‘video_description’]}</div>"; 2491 }249224932494 ?>2495 <div>2496 <a rel="<?php echo $randOmeRel;?>" data-overlay="1" data-title="<?php echo $title;?>" class="<?php echo $randOmVlBox;?>" href="<?php echo $embed_url;?>">2497 <img src="<?php echo $outputimg; ?>" alt="<?php echo $rowTitle; ?>" title="<?php if(trim($rowDescrption)!=’’){ echo $rowDescrption;} else{echo $rowTitle;}; ?>" />2498 <span class="playbtnCss">2499 </span> 2500 2501 </a> 25022503 </div>2504 2505 <?php } ?> 2506 <?php } ?> 2507 </div>2508 </div>2509 <script>2510 var $n = jQuery.noConflict();2511 <?php $uniqId=uniqid();?>2512 var uniqObj<?php echo $uniqId?>=$n("a[rel=’<?php echo $randOmeRel;?>’]");2513 $n(document).ready(function(){2514 var <?php echo $rand_var_name; ?> = $n(‘#<?php echo $rand_Num_td; ?>’).html();2515 $n(‘#<?php echo $rand_Numb; ?>’).bxSlider({2516 <?php if($settings[‘visible’]==1 ):?>2517 mode:’fade’,2518 <?php endif;?>2519 slideWidth: <?php echo $settings[‘imagewidth’]; ?>,2520 minSlides: <?php echo $settings[‘min_visible’]; ?>,2521 maxSlides: <?php echo $settings[‘visible’]; ?>,2522 moveSlides: <?php echo $settings[‘scroll’]; ?>,2523 slideMargin:<?php echo $settings[‘imageMargin’]; ?>,2524 speed:<?php echo $settings[‘speed’]; ?>,2525 pause:<?php echo $settings[‘pause’]; ?>,2526 <?php if($settings[‘pauseonmouseover’] and ($settings[‘auto’]==1 or $settings[‘auto’]==2) ){ ?>2527 autoHover: true,2528 <?php2529 } else {2530 if ($settings[‘auto’]==1 or $settings[‘auto’]==2) {2531 ?>2532 autoHover:false,2533 <?php2534 }2535 }2536 ?>2537 <?php if ($settings[‘auto’]==1): ?>2538 controls:false,2539 <?php else: ?>2540 controls:true,2541 <?php endif; ?>2542 pager:false,2543 useCSS:false,2544 <?php if($settings[‘auto’]==1 or $settings[‘auto’]==2):?>2545 autoStart:true,2546 autoDelay:200,2547 auto:true,2548 <?php endif; ?>2549 <?php if ($settings[‘circular’]): ?>2550 infiniteLoop: true,2551 <?php else: ?>2552 infiniteLoop: false,2553 <?php endif; ?>2554 captions:false,2555 pager:false,2556 2557 onSliderLoad: function(){2558 2559 $n(“#<?php echo $rand_Numb; ?>”).css(“visibility", “visible”);2560 2561 $n(“.<?php echo $randOmVlBox;?>”).fancybox({2562 ‘type’ : “iframe",2563 'overlayColor’:’#000000’,2564 'padding’: 10,2565 'autoScale’: true,2566 'autoDimensions’:true,2567 'uniqObj’:uniqObj<?php echo $uniqId;?>,2568 'transitionIn’: 'none’,2569 'transitionOut’: 'none’,2570 'titlePosition’: 'outside’,2571 <?php if ($settings[‘circular’]): ?>2572 'cyclic’:true,2573 <?php else: ?>2574 'cyclic’:false,2575 <?php endif; ?>2576 'hideOnContentClick’:false,2577 ‘width’ : 650,2578 ‘height’ : 400,2579 'titleFormat’: function(title, currentArray, currentIndex, currentOpts) {25802581 var currtElem = $n('#<?php echo $rand_Numb; ?> a[href="’+currentOpts.href+’”]');25822583 var isoverlay = $n(currtElem).attr(‘data-overlay’)25842585 if(isoverlay=="1” && $n.trim(title)!=""){2586 return ‘<span id="fancybox-title-over">’ + title + '</span>’;2587 }2588 else{2589 return '’;2590 }25912592 },25932594 }); 2595 2596 } 2597 2598 2599 });2600 2601 <?php if ($settings[‘auto’]) { ?>2602 <?php $newrand = rand(0, 1111111111); ?>2603 var is_firefox = navigator.userAgent.toLowerCase().indexOf(‘firefox’) > - 1;2604 var is_android = navigator.userAgent.toLowerCase().indexOf(‘android’) > - 1;2605 var is_iphone = navigator.userAgent.toLowerCase().indexOf(‘iphone’) > - 1;2606 var width = $n(window).width();2607 if (is_firefox && (is_android || is_iphone)){26082609 } else{2610 var timer;2611 $n(window).bind('resize’, function(){2612 if ($n(window).width() != width){26132614 width = $n(window).width();2615 timer && clearTimeout(timer);2616 timer = setTimeout(onResize<?php echo $newrand; ?>, 600);2617 }2618 });2619 }26202621 function onResize<?php echo $newrand; ?>(){2622 $n(‘#<?php echo $rand_Num_td; ?>’).html(‘’);2623 $n(‘#<?php echo $rand_Num_td; ?>’).html(<?php echo $rand_var_name; ?>);2624 $n(‘#<?php echo $rand_Numb; ?>’).bxSlider({26252626 <?php if($settings[‘visible’]==1 ):?>2627 mode:’fade’,2628 <?php endif;?>2629 slideWidth: <?php echo $settings[‘imagewidth’]; ?>,2630 minSlides: <?php echo $settings[‘min_visible’]; ?>,2631 maxSlides: <?php echo $settings[‘visible’]; ?>,2632 moveSlides: <?php echo $settings[‘scroll’]; ?>,2633 slideMargin:<?php echo $settings[‘imageMargin’]; ?>,2634 speed:<?php echo $settings[‘speed’]; ?>,2635 pause:<?php echo $settings[‘pause’]; ?>,2636 <?php if($settings[‘pauseonmouseover’] and ($settings[‘auto’]==1 or $settings[‘auto’]==2) ){ ?>2637 autoHover: true,2638 <?php2639 } 2640 else {2641 if ($settings[‘auto’]==1 or $settings[‘auto’]==2) {2642 ?>2643 autoHover:false,2644 <?php2645 }2646 }2647 ?>2648 <?php if ($settings[‘auto’]==1): ?>2649 controls:false,2650 <?php else: ?>2651 controls:true,2652 <?php endif; ?>2653 pager:false,2654 useCSS:false,2655 <?php if($settings[‘auto’]==1 or $settings[‘auto’]==2):?>2656 autoStart:true,2657 autoDelay:200,2658 auto:true,2659 <?php endif; ?>2660 <?php if ($settings[‘circular’]): ?>2661 infiniteLoop: true,2662 <?php else: ?>2663 infiniteLoop: false,2664 <?php endif; ?>2665 captions:false,2666 pager:false,2667 onSliderLoad: function(){2668 2669 $n(“#<?php echo $rand_Numb; ?>”).css(“visibility", “visible”);26702671 $n(“.<?php echo $randOmVlBox;?>”).fancybox({2672 ‘type’ : “iframe",2673 'overlayColor’:’#000000’,2674 'padding’: 10,2675 'autoScale’: true,2676 'autoDimensions’:true,2677 'uniqObj’:uniqObj<?php echo $uniqId;?>,2678 'transitionIn’: 'none’,2679 'transitionOut’: 'none’,2680 'titlePosition’: 'outside’,2681 <?php if ($settings[‘circular’]): ?>2682 'cyclic’:true,2683 <?php else: ?>2684 'cyclic’:false,2685 <?php endif; ?>2686 'hideOnContentClick’:false,2687 ‘width’ : 650,2688 ‘height’ : 400,2689 'titleFormat’: function(title, currentArray, currentIndex, currentOpts) {26902691 var currtElem = $n('#<?php echo $rand_Numb; ?> a[href="’+currentOpts.href+’”]');26922693 var isoverlay = $n(currtElem).attr(‘data-overlay’)26942695 if(isoverlay=="1” && $n.trim(title)!=""){2696 return ‘<span id="fancybox-title-over">’ + title + '</span>’;2697 }2698 else{2699 return '’;2700 }27012702 },27032704 }); 27052706 } 27072708 });2709 $n(“#<?php echo $rand_Numb; ?>”).css("visibility", “visible”);2710 }27112712 <?php } ?>27132714 27152716 });2717 2718 2719 </script>27202721 2722 <?php } 2723 $output = ob_get_clean ();2724 return $output;2725}2726function responsive_video_gallery_plus_responsive_lightbox_get_wp_version() {2727 global $wp_version;2728 return $wp_version;2729}27302731// also we will add an option function that will check for plugin admin page or not2732function responsive_video_gallery_plus_lightbox_is_plugin_page() {2733 $server_uri = "http://{$_SERVER[‘HTTP_HOST’]}{$_SERVER[‘REQUEST_URI’]}";2734 2735 foreach ( array (2736 ‘responsive_video_gallery_with_lightbox’ 2737 ) as $allowURI ) {2738 if (stristr ( $server_uri, $allowURI ))2739 return true;2740 }2741 return false;2742}27432744// add media WP scripts2745function responsive_video_gallery_plus_lightbox_admin_scripts_init() {2746 if (responsive_video_gallery_plus_lightbox_is_plugin_page ()) {2747 // double check for WordPress version and function exists2748 if (function_exists ( ‘wp_enqueue_media’ ) && version_compare ( responsive_video_gallery_plus_responsive_lightbox_get_wp_version (), '3.5’, ‘>=’ )) {2749 // call for new media manager2750 wp_enqueue_media ();2751 }2752 wp_enqueue_style ( ‘media’ );2753 wp_enqueue_style( ‘wp-color-picker’ );2754 wp_enqueue_script( ‘wp-color-picker’ );27552756 }2757}2758275927602761?>