Changeset 431364
- Timestamp:
- 08/31/2011 06:16:14 PM (15 years ago)
- Location:
- useful-banner-manager/trunk
- Files:
-
- 1 added
- 3 edited
-
readme.txt (modified) (3 diffs)
-
screenshot-1.png (modified) (previous)
-
scripts.js (added)
-
useful-banner-manager.php (modified) (40 diffs)
Legend:
- Unmodified
- Added
- Removed
-
useful-banner-manager/trunk/readme.txt
r320150 r431364 4 4 Tags: banner manager, ads manager, banners, ads, advertisement, buddypress 5 5 Requires at least: 2.9 6 Tested up to: 3. 0.26 Tested up to: 3.2.1 7 7 8 8 This banner manager plugin helps to manage the banners easily over the WordPress blog. It works with BuddyPress too. … … 23 23 2. Activate the plugin through the Plugins menu in WordPress. 24 24 3. Go to "Banner Manager" panel and add banners. 25 4. To show the banners in the sidebar, go to the "Appearance"->"Widgets" panel and drag-and-drop the "UBM banners" box into your sidebar, configure options and save them. 26 5. To show the banners in a post or a page, add [useful_banner_manager banners=2,6 count=1] (where the numbers 2 and 6 (banners=2,6) are the IDs of the banners which would be shown, the number 1 (count=1) is the count of the banners which would be shown) into the post or the page. 27 6. Also the banners can be shown by adding `<?php if(function_exists("useful_banner_manager_banners")){ useful_banner_manager_banners("2,6",1); } ?>` (where the first argument ("2,6") is a string of the banners' IDs, separated by commas, and the second argument is the banners' count which would be shown). 25 26 = Add banners = 27 28 * To show the banners in the sidebar, go to the "Appearance"->"Widgets" panel and drag-and-drop the "UBM banners" box into your sidebar, configure options and save them. 29 * To show the banners in a post or a page, add [useful_banner_manager banners=2,6 count=1] (where the numbers 2 and 6 (banners=2,6) are the IDs of the banners which would be shown, the number 1 (count=1) is the count of the banners which would be shown) into the post or the page. 30 * Also the banners can be shown by adding `<?php if(function_exists("useful_banner_manager_banners")){ useful_banner_manager_banners("2,6",1); } ?>` (where the first argument ("2,6") is a string of the banners' IDs, separated by commas, and the second argument is the banners' count which would be shown). 31 32 = Add banners rotations = 33 34 * To show the banners rotations in the sidebar, go to the "Appearance"->"Widgets" panel and drag-and-drop the "UBM banners rotation" box into your sidebar, configure the options and save them. 35 * To show the banners in a post or a page, add [useful_banner_manager_banner_rotation banners=2,6 interval=5 width=468 height=60 orderby=rand] (where the numbers 2 and 6 (banners=2,6) are the IDs of the banners which would be shown, the number 5 (interval=1) is the seconds of the delay between banners rotations, the numbers 468 and 60 are the width and height of the banners which will be rotating and set "orderby" option to "rand" to show the banners in random order or "order" (orderby=rand or orderby=order)) into the post or the page. 36 * Also the banners rotations can be shown by adding `<?php if(function_exists("useful_banner_manager_banners_rotation")){ useful_banner_manager_banners_rotation("2,6",5,468,60,"rand"); } ?>` (where the first argument ("2,6") is a string of the banners' IDs, separated by commas, the second argument (5) is the seconds of the delay between banners rotations, the third and forth arguments (468 and 60) are the width and height of the banners which will be rotating and put the fifth argument ("rand"), which is optional, to show the banners in random order). 28 37 29 38 == Frequently Asked Questions == … … 33 42 == Screenshots == 34 43 35 1. Administration Interface44 1. Manage Banners 36 45 37 46 == Changelog == 38 47 48 = 1.1 = 49 * Added banners rotation function. 50 * Added new options for banners - "Image Alt" and "Link Rel". 51 * Fixed some bugs. 52 39 53 = 1.0 = 40 54 * First release. -
useful-banner-manager/trunk/useful-banner-manager.php
r320112 r431364 4 4 Plugin URI: http://rubensargsyan.com/wordpress-plugin-useful-banner-manager/ 5 5 Description: This banner manager plugin helps to manage the banners easily over the WordPress blog. It works with BuddyPress too. <a href="admin.php?page=useful-banner-manager.php">Banner Manager</a> 6 Version: 1. 06 Version: 1.1 7 7 Author: Ruben Sargsyan 8 8 Author URI: http://rubensargsyan.com/ 9 9 */ 10 10 11 /* Copyright 201 0Ruben Sargsyan (email: [email protected])11 /* Copyright 2011 Ruben Sargsyan (email: [email protected]) 12 12 13 13 This program is free software; you can redistribute it and/or modify … … 34 34 $useful_banner_manager_table_name = $wpdb->prefix."useful_banner_manager_banners"; 35 35 $useful_banner_manager_plugin_prefix = "useful_banner_manager_"; 36 $useful_banner_manager_version = "1. 0";36 $useful_banner_manager_version = "1.1"; 37 37 38 38 $charset_collate = ""; … … 52 52 "banner_type VARCHAR(4) NOT NULL,". 53 53 "banner_title VARCHAR(255) NOT NULL,". 54 "banner_alt TEXT NOT NULL,". 54 55 "banner_link VARCHAR(255) NOT NULL,". 55 56 "link_target VARCHAR(7) NOT NULL,". 57 "link_rel VARCHAR(8) NOT NULL,". 56 58 "banner_width INT(11) NOT NULL,". 57 59 "banner_height INT(11) NOT NULL,". … … 94 96 ?> 95 97 <div class="wrap"> 98 <div style="float: right; margin: 20px 0 0 0"><a href="http://blorner.com" target="_blank"><img src="http://banners.blorner.com/blorner.com-468x60.jpg" alt="Blorner" style="border: none" /></a></div> 96 99 <h1><?php echo $useful_banner_manager_plugin_title; ?></h1> 97 100 <h2>Banners</h2> … … 99 102 if(isset($_GET[$useful_banner_manager_plugin_prefix."banner_id"]) && is_numeric($_GET[$useful_banner_manager_plugin_prefix."banner_id"]) && intval($_GET[$useful_banner_manager_plugin_prefix."banner_id"])>0){ 100 103 if($_GET["page"]==basename(__FILE__)){ 101 if(isset($_POST[$ share_buttons_simple_use_plugin_prefix."save_banner"])){104 if(isset($_POST[$useful_banner_manager_plugin_prefix."save_banner"])){ 102 105 $banner_id = intval($_GET[$useful_banner_manager_plugin_prefix."banner_id"]); 103 106 … … 126 129 $banner_title = htmlentities(trim(stripslashes($_POST[$useful_banner_manager_plugin_prefix."banner_title"])),ENT_QUOTES); 127 130 } 131 132 $banner_alt = htmlentities(trim(stripslashes($_POST[$useful_banner_manager_plugin_prefix."banner_alt"])),ENT_QUOTES); 133 128 134 $banner_link = trim(str_replace(array("\"","'"),array("",""),stripslashes($_POST[$useful_banner_manager_plugin_prefix."banner_link"]))); 129 135 if($banner_link!=""){ … … 146 152 }else{ 147 153 $link_target = ""; 154 } 155 156 if($banner_link!=""){ 157 switch($_POST[$useful_banner_manager_plugin_prefix."link_rel"]){ 158 case "nofollow": 159 $link_rel = "nofollow"; 160 break; 161 default: 162 $link_rel = "dofollow"; 163 } 164 }else{ 165 $link_rel = ""; 148 166 } 149 167 … … 196 214 197 215 if(empty($errors)){ 198 useful_banner_manager_update_banner($banner_id,$banner_name,$banner_type,$banner_title,$banner_ link,$link_target,$banner_width,$banner_height,$active_until,$banner_order,$is_visible,$banner_edited_by,$last_edited_date);216 useful_banner_manager_update_banner($banner_id,$banner_name,$banner_type,$banner_title,$banner_alt,$banner_link,$link_target,$link_rel,$banner_width,$banner_height,$active_until,$banner_order,$is_visible,$banner_edited_by,$last_edited_date); 199 217 if($_FILES[$useful_banner_manager_plugin_prefix."banner_file"]["error"]==0){ 200 218 if(file_exists(ABSPATH."wp-content/uploads/useful_banner_manager_banners/".$banner_old_file)){ … … 227 245 228 246 if(!empty($banner)){ 229 ?>247 ?> 230 248 <form method="post" enctype="multipart/form-data"> 231 249 <table id="useful_banner_manager_edit_banner"> … … 240 258 if($banner->banner_type!="swf"){ 241 259 ?> 242 <img src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>" alt="<?php echo($banner->banner_ title); ?>" />260 <img src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>" alt="<?php echo($banner->banner_alt); ?>" /> 243 261 <?php 244 262 }else{ … … 265 283 </tr> 266 284 <tr> 285 <td width="25%" valign="middle"><strong>Image Alt</strong></td> 286 <td width="75%"> 287 <input type="text" name="<?php echo($useful_banner_manager_plugin_prefix); ?>banner_alt" id="<?php echo($useful_banner_manager_plugin_prefix); ?>banner_alt" style="width: 300px" <?php if(isset($errors) && !empty($errors)){ echo('value="'.$banner_alt.'"'); }else{ echo('value="'.$banner->banner_alt.'"'); } ?> /> <small>Not for swf files.</small> 288 </td> 289 </tr> 290 <tr> 267 291 <td width="25%" valign="middle"><strong>Banner Link</strong></td> 268 292 <td width="75%"> … … 278 302 <option value="_blank" <?php if(isset($errors) && !empty($errors) && $link_target=="_blank"){ echo('selected="selected"'); }elseif((!isset($errors) || empty($errors)) && $banner->link_target=="_blank"){ echo('selected="selected"'); } ?>>_blank</option> 279 303 <option value="_parent" <?php if(isset($errors) && !empty($errors) && $link_target=="_parent"){ echo('selected="selected"'); }elseif((!isset($errors) || empty($errors)) && $banner->link_target=="_parent"){ echo('selected="selected"'); } ?>>_parent</option> 304 </select> <small>Not for swf files.</small> 305 </td> 306 </tr> 307 <tr> 308 <td width="25%" valign="middle"><strong>Link Rel</strong></td> 309 <td width="75%"> 310 <select id="<?php echo($useful_banner_manager_plugin_prefix); ?>link_rel" name="<?php echo($useful_banner_manager_plugin_prefix); ?>link_rel" style="width: 80px"> 311 <option value="dofollow" <?php if(isset($errors) && !empty($errors) && $link_target=="dofollow"){ echo('selected="selected"'); }elseif((!isset($errors) || empty($errors)) && $banner->link_rel=="dofollow"){ echo('selected="selected"'); } ?>>dofollow</option> 312 <option value="nofollow" <?php if(isset($errors) && !empty($errors) && $link_target=="nofollow"){ echo('selected="selected"'); }elseif((!isset($errors) || empty($errors)) && $banner->link_rel=="nofollow"){ echo('selected="selected"'); } ?>>nofollow</option> 280 313 </select> <small>Not for swf files.</small> 281 314 </td> … … 320 353 </table> 321 354 <p class="submit"> 322 <input name="<?php echo($ share_buttons_simple_use_plugin_prefix); ?>save_banner" type="submit" value="Save" /> <a href="admin.php?page=useful-banner-manager.php">Cancel</a>355 <input name="<?php echo($useful_banner_manager_plugin_prefix); ?>save_banner" type="submit" value="Save" /> <a href="admin.php?page=useful-banner-manager.php">Cancel</a> 323 356 </p> 324 357 </form> … … 329 362 }else{ 330 363 if($_GET["page"]==basename(__FILE__)){ 331 if(isset($_POST[$ share_buttons_simple_use_plugin_prefix."add_banner"])){364 if(isset($_POST[$useful_banner_manager_plugin_prefix."add_banner"])){ 332 365 $errors = array(); 333 366 $banner_name_parts = explode(".",$_FILES[$useful_banner_manager_plugin_prefix."banner_file"]["name"]); … … 344 377 $banner_title = htmlentities(trim(stripslashes($_POST[$useful_banner_manager_plugin_prefix."banner_title"])),ENT_QUOTES); 345 378 } 379 380 $banner_alt = htmlentities(trim(stripslashes($_POST[$useful_banner_manager_plugin_prefix."banner_alt"])),ENT_QUOTES); 381 346 382 $banner_link = trim(str_replace(array("\"","'"),array("",""),stripslashes($_POST[$useful_banner_manager_plugin_prefix."banner_link"]))); 347 383 if($banner_link!=""){ … … 366 402 } 367 403 404 if($banner_link!=""){ 405 switch($_POST[$useful_banner_manager_plugin_prefix."link_rel"]){ 406 case "nofollow": 407 $link_rel = "nofollow"; 408 break; 409 default: 410 $link_rel = "dofollow"; 411 } 412 }else{ 413 $link_rel = ""; 414 } 415 368 416 if(isset($_POST[$useful_banner_manager_plugin_prefix."auto_sizes"]) && !in_array("banner_type",$errors)){ 369 417 if($banner_type!="swf"){ … … 413 461 414 462 if(empty($errors)){ 415 $added_banner_id = useful_banner_manager_add_banner($banner_name,$banner_type,$banner_title,$banner_ link,$link_target,$banner_width,$banner_height,$added_date,$active_until,$banner_order,$is_visible,$banner_added_by);463 $added_banner_id = useful_banner_manager_add_banner($banner_name,$banner_type,$banner_title,$banner_alt,$banner_link,$link_target,$link_rel,$banner_width,$banner_height,$added_date,$active_until,$banner_order,$is_visible,$banner_added_by); 416 464 move_uploaded_file($banner_tmp_file,ABSPATH."wp-content/uploads/useful_banner_manager_banners/".$added_banner_id."-".$banner_name.".".$banner_type); 417 465 echo('<div id="message" class="updated fade"><p><strong>New banner added.</strong></p></div>'); … … 432 480 } 433 481 434 if(isset($_POST[$ share_buttons_simple_use_plugin_prefix."delete"])){482 if(isset($_POST[$useful_banner_manager_plugin_prefix."delete"])){ 435 483 if(isset($_POST[$useful_banner_manager_plugin_prefix."banner_id"]) && is_numeric($_POST[$useful_banner_manager_plugin_prefix."banner_id"])){ 436 484 $banner_id = intval($_POST[$useful_banner_manager_plugin_prefix."banner_id"]); … … 461 509 </tr> 462 510 <tr> 511 <td width="25%" valign="middle"><strong>Image Alt</strong></td> 512 <td width="75%"> 513 <input type="text" name="<?php echo($useful_banner_manager_plugin_prefix); ?>banner_alt" id="<?php echo($useful_banner_manager_plugin_prefix); ?>banner_alt" style="width: 300px" <?php if(isset($errors) && !empty($errors)){ echo('value="'.$banner_alt.'"'); } ?> /> <small>Not for swf files.</small> 514 </td> 515 </tr> 516 <tr> 463 517 <td width="25%" valign="middle"><strong>Banner Link</strong></td> 464 518 <td width="75%"> … … 474 528 <option value="_blank" <?php if(isset($errors) && !empty($errors) && $link_target=="_blank"){ echo('selected="selected"'); } ?>>_blank</option> 475 529 <option value="_parent" <?php if(isset($errors) && !empty($errors) && $link_target=="_parent"){ echo('selected="selected"'); } ?>>_parent</option> 530 </select> <small>Not for swf files.</small> 531 </td> 532 </tr> 533 <tr> 534 <td width="25%" valign="middle"><strong>Link Rel</strong></td> 535 <td width="75%"> 536 <select id="<?php echo($useful_banner_manager_plugin_prefix); ?>link_rel" name="<?php echo($useful_banner_manager_plugin_prefix); ?>link_rel" style="width: 80px"> 537 <option value="dofollow" <?php if(isset($errors) && !empty($errors) && $link_rel=="dofollow"){ echo('selected="selected"'); }elseif(!isset($errors) || empty($errors)){ echo('selected="selected"'); } ?>>dofollow</option> 538 <option value="nofollow" <?php if(isset($errors) && !empty($errors) && $link_rel=="nofollow"){ echo('selected="selected"'); } ?>>nofollow</option> 476 539 </select> <small>Not for swf files.</small> 477 540 </td> … … 516 579 </table> 517 580 <p class="submit"> 518 <input name="<?php echo($ share_buttons_simple_use_plugin_prefix); ?>add_banner" type="submit" value="Add banner" />581 <input name="<?php echo($useful_banner_manager_plugin_prefix); ?>add_banner" type="submit" value="Add banner" /> 519 582 </p> 520 583 </form> … … 536 599 <thead> 537 600 <tr> 538 <th scope="col" width="2%">ID</th> 539 <th scope="col" width="4%">Type</th> 540 <th scope="col" width="15%">Title</th> 541 <th scope="col" width="28%">Link</th> 601 <th scope="col" width="3%">ID</th> 602 <th scope="col" width="5%">Type</th> 603 <th scope="col" width="12%">Title</th> 604 <th scope="col" width="23%">Link</th> 605 <th scope="col" width="6%">Rel</th> 542 606 <th scope="col" width="9%">Added Date</th> 543 607 <th scope="col" width="9%">Active Until</th> … … 555 619 <th scope="col">Title</th> 556 620 <th scope="col">Link</th> 621 <th scope="col">Rel</th> 557 622 <th scope="col">Added Date</th> 558 623 <th scope="col">Active Until</th> … … 573 638 <td><?php echo($banner->banner_title); ?></td> 574 639 <td><?php echo($banner->banner_link); ?></td> 640 <td><?php echo($banner->link_rel); ?></td> 575 641 <td><?php echo($banner->added_date); ?></td> 576 642 <td><?php if($banner->active_until==-1){ echo("No date"); }else{ echo($banner->active_until); } ?></td> … … 590 656 <form method="post"> 591 657 <p class="submit"> 592 <input name=" delete" type="submit" value="Delete" onclick="javascript:if(!confirm('Are you sure you want to delete the banner "<?php echo($banner->banner_title); ?>"?')){ return false; }" />658 <input name="<?php echo($useful_banner_manager_plugin_prefix); ?>delete" type="submit" value="Delete" onclick="javascript:if(!confirm('Are you sure you want to delete the banner "<?php echo($banner->banner_title); ?>"?')){ return false; }" /> 593 659 <input type="hidden" name="<?php echo($useful_banner_manager_plugin_prefix); ?>banner_id" value="<?php echo($banner->id); ?>" /> 594 660 </p> … … 605 671 ?> 606 672 <br /> 607 <p><strong style="color: #FF0000">To have the statistics of the impressions and the clicks of the banners, get the premium version only for <span style="font-size: 16px">$9.99</span>. To get the premium version of the plugin, just contact by the <a href="http://rubensargsyan.com/contact/" target="_blank">contact from</a>.</strong></p>673 <p><strong style="color: #FF0000">To have more features in this plugin (statistics of the impressions and the clicks of the banners, etc.) get the premium version of it. Read more about the premium version on its <a href="http://rubensargsyan.com/wordpress-plugin-ubm-premium/" target="_blank">homepage</a>.</strong></p> 608 674 </div> 609 675 <?php 610 676 } 611 677 612 function useful_banner_manager_add_banner($banner_name,$banner_type,$banner_title,$banner_ link,$link_target,$banner_width,$banner_height,$added_date,$active_until,$banner_order,$is_visible,$banner_added_by){678 function useful_banner_manager_add_banner($banner_name,$banner_type,$banner_title,$banner_alt,$banner_link,$link_target,$link_rel,$banner_width,$banner_height,$added_date,$active_until,$banner_order,$is_visible,$banner_added_by){ 613 679 global $wpdb, $useful_banner_manager_table_name; 614 680 615 $query = "INSERT INTO ".$useful_banner_manager_table_name." (banner_name,banner_type,banner_title,banner_ link,link_target,banner_width,banner_height,added_date,active_until,banner_order,is_visible,banner_added_by) VALUES ('".$banner_name."','".$banner_type."','".$banner_title."','".$banner_link."','".$link_target."','".$banner_width."','".$banner_height."','".$added_date."','".$active_until."','".$banner_order."','".$is_visible."','".$banner_added_by."');";681 $query = "INSERT INTO ".$useful_banner_manager_table_name." (banner_name,banner_type,banner_title,banner_alt,banner_link,link_target,link_rel,banner_width,banner_height,added_date,active_until,banner_order,is_visible,banner_added_by) VALUES ('".$banner_name."','".$banner_type."','".$banner_title."','".$banner_alt."','".$banner_link."','".$link_target."','".$link_rel."','".$banner_width."','".$banner_height."','".$added_date."','".$active_until."','".$banner_order."','".$is_visible."','".$banner_added_by."');"; 616 682 $wpdb->query($query); 617 683 618 684 $banner_id = $wpdb->insert_id; 619 685 … … 621 687 } 622 688 623 function useful_banner_manager_update_banner($banner_id,$banner_name,$banner_type,$banner_title,$banner_ link,$link_target,$banner_width,$banner_height,$active_until,$banner_order,$is_visible,$banner_edited_by,$last_edited_date){689 function useful_banner_manager_update_banner($banner_id,$banner_name,$banner_type,$banner_title,$banner_alt,$banner_link,$link_target,$link_rel,$banner_width,$banner_height,$active_until,$banner_order,$is_visible,$banner_edited_by,$last_edited_date){ 624 690 global $wpdb, $useful_banner_manager_table_name; 625 691 626 $query = "UPDATE ".$useful_banner_manager_table_name." SET banner_name='".$banner_name."', banner_type='".$banner_type."', banner_title='".$banner_title."', banner_ link='".$banner_link."', link_target='".$link_target."', banner_width='".$banner_width."', banner_height='".$banner_height."', active_until='".$active_until."', banner_order='".$banner_order."', is_visible='".$is_visible."', banner_edited_by='".$banner_edited_by."', last_edited_date='".$last_edited_date."' WHERE id='".$banner_id."';";692 $query = "UPDATE ".$useful_banner_manager_table_name." SET banner_name='".$banner_name."', banner_type='".$banner_type."', banner_title='".$banner_title."', banner_alt='".$banner_alt."', banner_link='".$banner_link."', link_target='".$link_target."', link_rel='".$link_rel."', banner_width='".$banner_width."', banner_height='".$banner_height."', active_until='".$active_until."', banner_order='".$banner_order."', is_visible='".$is_visible."', banner_edited_by='".$banner_edited_by."', last_edited_date='".$last_edited_date."' WHERE id='".$banner_id."';"; 627 693 $wpdb->query($query); 628 694 } … … 645 711 global $wpdb, $useful_banner_manager_table_name; 646 712 647 $query = "SELECT id,banner_type,banner_title,banner_link, added_date,active_until,banner_order,is_visible,banner_added_by FROM ".$useful_banner_manager_table_name." ORDER BY id ASC;";713 $query = "SELECT id,banner_type,banner_title,banner_link,link_rel,added_date,active_until,banner_order,is_visible,banner_added_by FROM ".$useful_banner_manager_table_name." ORDER BY id ASC;"; 648 714 $banners = $wpdb->get_results($query); 649 715 … … 683 749 684 750 function widget($args, $instance){ 685 global $wpdb, $useful_banner_manager_table_name , $useful_banner_manager_plugin_url;751 global $wpdb, $useful_banner_manager_table_name; 686 752 687 753 extract($args); … … 717 783 if($banner->banner_link!=""){ 718 784 ?> 719 <a href="<?php echo($banner->banner_link); ?>" target="<?php echo($banner->link_target); ?>" >785 <a href="<?php echo($banner->banner_link); ?>" target="<?php echo($banner->link_target); ?>" rel="<?php echo($banner->link_rel); ?>"> 720 786 <?php 721 787 } 722 788 ?> 723 <img src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>" alt="<?php echo($banner->banner_ title); ?>" />789 <img src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>" alt="<?php echo($banner->banner_alt); ?>" /> 724 790 <?php 725 791 if($banner->banner_link!=""){ … … 741 807 <?php 742 808 } 743 744 echo($after_widget); 745 }809 } 810 811 echo($after_widget); 746 812 } 747 813 … … 762 828 763 829 function form($instance){ 764 global $wpdb, $useful_banner_manager_table_name , $useful_banner_manager_plugin_prefix;830 global $wpdb, $useful_banner_manager_table_name; 765 831 766 832 $instance = wp_parse_args((array)$instance,array("title"=>"","banners_ids"=>"")); … … 801 867 } 802 868 869 class Useful_Banner_Manager_Rotation_Widget extends WP_Widget{ 870 function Useful_Banner_Manager_Rotation_Widget(){ 871 $widget_opions = array('classname' => 'useful_banner_manager_rotation_widget', 'description' => __('Useful banner manager banners rotation')); 872 $this->WP_Widget('useful-banner-manager-banners-rotation', 'UBM banners rotation', $widget_opions); 873 } 874 875 function widget($args, $instance){ 876 global $wpdb, $useful_banner_manager_table_name; 877 878 extract($args); 879 880 $title = $instance["title"]; 881 $banners_ids = $instance["banners_ids"]; 882 $interval = $instance["interval"]; 883 $width = $instance["width"]; 884 $height = $instance["height"]; 885 if($instance["orderby"]=="rand"){ 886 $orderby = "RAND()"; 887 }else{ 888 $orderby = "banner_order, id DESC"; 889 } 890 891 892 echo($before_widget); 893 if(!empty($title)){ 894 echo($before_title.$title.$after_title); 895 } 896 897 if(!empty($banners_ids)){ 898 $query = "SELECT * FROM ".$useful_banner_manager_table_name." WHERE ("; 899 $banners_ids_query = array(); 900 901 foreach($banners_ids as $banner_id){ 902 $banners_ids_query[] = "id='".$banner_id."'"; 903 } 904 905 $query .= implode(" OR ",$banners_ids_query); 906 907 $query .= ") AND (active_until=-1 OR active_until>='".date("Y-m-d")."') AND is_visible='yes' ORDER BY ".$orderby.";"; 908 909 $banners = $wpdb->get_results($query); 910 911 ?> 912 <div id="<?php echo($args["widget_id"]); ?>" class="useful_banner_manager_banners_rotation" style="overflow: hidden; width: <?php echo($width); ?>px; height: <?php echo($height); ?>px;"> 913 <?php 914 $first_banner = true; 915 foreach($banners as $banner){ 916 ?> 917 <div class="useful_banner_manager_rotating_banner"<?php if($first_banner){ $first_banner = false; }else{ echo(' style="display: none"'); } ?>> 918 <?php 919 if($banner->banner_link!=""){ 920 ?> 921 <a href="<?php echo($banner->banner_link); ?>" target="<?php echo($banner->link_target); ?>" rel="<?php echo($banner->link_rel); ?>"> 922 <?php 923 } 924 ?> 925 <img src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($width); ?>" height="<?php echo($height); ?>" alt="<?php echo($banner->banner_alt); ?>" /> 926 <?php 927 if($banner->banner_link!=""){ 928 ?> 929 </a> 930 <?php 931 } 932 ?> 933 </div> 934 <?php 935 } 936 ?> 937 </div> 938 <script type="text/javascript"> 939 jQuery(function($){ 940 $(document).ready(function(){ 941 var useful_banner_manager_banners_rotation_block = "<?php echo($args['widget_id']); ?>"; 942 var interval_between_rotations = <?php echo(($interval*1000)); ?>; 943 if($("#"+useful_banner_manager_banners_rotation_block+" .useful_banner_manager_rotating_banner").length>1){ 944 setTimeout("useful_banner_manager_rotate_banners('"+useful_banner_manager_banners_rotation_block+"',"+interval_between_rotations+")",interval_between_rotations); 945 } 946 }); 947 }); 948 </script> 949 <?php 950 } 951 952 echo($after_widget); 953 } 954 955 function update($new_instance, $old_instance){ 956 $instance = $old_instance; 957 $instance["title"] = strip_tags($new_instance["title"]); 958 $instance["banners_ids"] = $new_instance["banners_ids"]; 959 if(is_numeric($new_instance["interval"]) && intval($new_instance["interval"])>0){ 960 $instance["interval"] = intval($new_instance["interval"]); 961 }elseif(is_numeric($old_instance["interval"]) && intval($old_instance["interval"])>0){ 962 $instance["interval"] = intval($old_instance["interval"]); 963 }else{ 964 $instance["interval"] = 10; 965 } 966 if(is_numeric($new_instance["width"]) && intval($new_instance["width"])>0){ 967 $instance["width"] = intval($new_instance["width"]); 968 }elseif(is_numeric($old_instance["width"]) && intval($old_instance["width"])>0){ 969 $instance["width"] = intval($old_instance["width"]); 970 }else{ 971 $instance["width"] = 180; 972 } 973 if(is_numeric($new_instance["height"]) && intval($new_instance["height"])>0){ 974 $instance["height"] = intval($new_instance["height"]); 975 }elseif(is_numeric($old_instance["height"]) && intval($old_instance["height"])>0){ 976 $instance["height"] = intval($old_instance["height"]); 977 }else{ 978 $instance["height"] = 180; 979 } 980 if($new_instance["orderby"]=="rand"){ 981 $instance["orderby"] = "rand"; 982 }else{ 983 $instance["orderby"] = "banner_order, id"; 984 } 985 986 987 return $instance; 988 } 989 990 function form($instance){ 991 global $wpdb, $useful_banner_manager_table_name; 992 993 $instance = wp_parse_args((array)$instance,array("title"=>"","banners_ids"=>"")); 994 $title = strip_tags($instance["title"]); 995 $banners_ids = $instance["banners_ids"]; 996 if($instance["interval"]){ 997 $interval = intval($instance["interval"]); 998 }else{ 999 $interval = 10; 1000 } 1001 if($instance["width"]){ 1002 $width = intval($instance["width"]); 1003 }else{ 1004 $width = 180; 1005 } 1006 if($instance["height"]){ 1007 $height = intval($instance["height"]); 1008 }else{ 1009 $height = 180; 1010 } 1011 1012 1013 $banners = $wpdb->get_results("SELECT id, banner_name, banner_type, banner_title FROM ".$useful_banner_manager_table_name." WHERE is_visible='yes' ORDER BY id ASC;"); 1014 1015 if($banners){ 1016 ?> 1017 <p><label for="<?php echo($this->get_field_id("title")); ?>">Title:</label> 1018 <input class="widefat" id="<?php echo($this->get_field_id("title")); ?>" name="<?php echo($this->get_field_name("title")); ?>" type="text" value="<?php echo(esc_attr($title)); ?>" /></p> 1019 <table width="100%" style="border-collapse: collapse"> 1020 <caption>Banners</caption> 1021 <?php 1022 foreach($banners as $banner){ 1023 if($banner->banner_type=="swf"){ 1024 continue; 1025 } 1026 ?> 1027 <tr><td width="90%" style="border: 1px solid #f1f1f1; text-align: left; padding: 2px 5px"><label for="<?php echo($this->get_field_id("banners_ids")); ?>_<?php echo($banner->id); ?>"><?php echo($banner->banner_title); ?></label></td><td width="10%" style="border: 1px solid #f1f1f1; text-align: center; padding: 2px 0"><input class="checkbox" id="<?php echo($this->get_field_id("banners_ids")); ?>_<?php echo($banner->id); ?>" name="<?php echo($this->get_field_name("banners_ids")); ?>[]" type="checkbox" value="<?php echo($banner->id); ?>" <?php if(is_array($banners_ids)){ if(in_array($banner->id,$banners_ids)){ echo('checked="checked"'); } } ?> /></td></tr> 1028 <?php 1029 } 1030 ?> 1031 </table><br /> 1032 <p><label for="<?php echo($this->get_field_id("interval")); ?>">Interval:</label> 1033 <input id="<?php echo($this->get_field_id("interval")); ?>" name="<?php echo($this->get_field_name("interval")); ?>" type="text" value="<?php echo(esc_attr($interval)); ?>" size="2" /> seconds</p> 1034 <p><label for="<?php echo($this->get_field_id("width")); ?>">Width of rotating banners:</label> 1035 <input id="<?php echo($this->get_field_id("width")); ?>" name="<?php echo($this->get_field_name("width")); ?>" type="text" value="<?php echo(esc_attr($width)); ?>" size="2" /></p> 1036 <p><label for="<?php echo($this->get_field_id("height")); ?>">Height of rotating banners:</label> 1037 <input id="<?php echo($this->get_field_id("height")); ?>" name="<?php echo($this->get_field_name("height")); ?>" type="text" value="<?php echo(esc_attr($height)); ?>" size="2" /></p> 1038 <p><label for="<?php echo($this->get_field_id("orderby")); ?>">Order by rand:</label> 1039 <input class="checkbox" id="<?php echo($this->get_field_id("orderby")); ?>" name="<?php echo($this->get_field_name("orderby")); ?>" type="checkbox" value="rand" <?php if($instance["orderby"]=="rand"){ echo('checked="checked"'); } ?> /> 1040 </p> 1041 <?php 1042 }else{ 1043 ?> 1044 <p>There is no visible banner. <a href="admin.php?page=useful-banner-manager.php">Settings</a></p> 1045 <?php 1046 } 1047 } 1048 } 1049 803 1050 function useful_banner_manager_widget_init(){ 804 1051 if(!is_blog_installed()){ … … 807 1054 808 1055 register_widget('Useful_Banner_Manager_Widget'); 809 810 do_action('widgets_init'); 811 } 1056 register_widget('Useful_Banner_Manager_Rotation_Widget'); 1057 } 1058 1059 $banners_rotation_id = 1; 812 1060 813 1061 function add_useful_banner_manager_banners($content){ 814 global $wpdb, $useful_banner_manager_table_name, $useful_banner_manager_plugin_url;815 816 if(preg_match_all("/\[useful_banner_manager banners=(. *) count=([0-9]+)\]/i",$content,$matches,PREG_SET_ORDER)){1062 global $wpdb, $useful_banner_manager_table_name, $banners_rotation_id; 1063 1064 if(preg_match_all("/\[useful_banner_manager banners=(.[^\]]*) count=([0-9]+)\]/i",$content,$matches,PREG_SET_ORDER)){ 817 1065 foreach($matches as $match){ 818 1066 $banners_ids = explode(",",$match[1]); 819 $count = intval($match[2]);1067 $count = $match[2]; 820 1068 821 1069 $query = "SELECT * FROM (SELECT * FROM ".$useful_banner_manager_table_name." WHERE ("; … … 832 1080 $banners = $wpdb->get_results($query); 833 1081 834 $the_banner = ""; 835 836 foreach($banners as $banner){ 837 $the_banner .= '<div class="useful_banner_manager_banner">'; 838 839 if($banner->banner_type!="swf"){ 1082 if($banners){ 1083 $the_banner = ""; 1084 1085 foreach($banners as $banner){ 1086 $the_banner .= '<div class="useful_banner_manager_banner">'; 1087 1088 if($banner->banner_type!="swf"){ 1089 if($banner->banner_link!=""){ 1090 $the_banner .= '<a href="'.$banner->banner_link.'" target="'.$banner->link_target.'">'; 1091 } 1092 $the_banner .= '<img src="'.get_home_url().'/wp-content/uploads/useful_banner_manager_banners/'.$banner->id."-".$banner->banner_name.'.'.$banner->banner_type.'" width="'.$banner->banner_width.'" height="'.$banner->banner_height.'" alt="'.$banner->banner_title.'" />'; 1093 1094 if($banner->banner_link!=""){ 1095 $the_banner .= '</a>'; 1096 } 1097 }else{ 1098 $the_banner .= '<object width="'.$banner->banner_width.'" height="'.$banner->banner_height.'"> 1099 <param name="movie" value="'.get_home_url().'/wp-content/uploads/useful_banner_manager_banners/'.$banner->id."-".$banner->banner_name.'.'.$banner->banner_type.'"> 1100 <embed src="'.get_home_url().'/wp-content/uploads/useful_banner_manager_banners/'.$banner->id."-".$banner->banner_name.'.'.$banner->banner_type.'" width="'.$banner->banner_width.'" height="'.$banner->banner_height.'"> 1101 </embed> 1102 </object>'; 1103 } 1104 $the_banner .= '</div>'; 1105 } 1106 1107 $content = str_replace($match[0],$the_banner,$content); 1108 } 1109 } 1110 } 1111 1112 if(preg_match_all("/\[useful_banner_manager_banner_rotation banners=(.[^\]]*) interval=([0-9]+) width=([0-9]+) height=([0-9]+) orderby=(rand)\]/i",$content,$matches,PREG_SET_ORDER)){ 1113 foreach($matches as $match){ 1114 $banners_ids = explode(",",$match[1]); 1115 $interval = $match[2]; 1116 $width = $match[3]; 1117 $height = $match[4]; 1118 if($match[5]=="rand"){ 1119 $orderby = "RAND()"; 1120 }else{ 1121 $orderby = "banner_order, id DESC"; 1122 } 1123 1124 $query = "SELECT * FROM (SELECT * FROM ".$useful_banner_manager_table_name." WHERE ("; 1125 $banners_ids_query = array(); 1126 1127 foreach($banners_ids as $banner_id){ 1128 $banners_ids_query[] = "id='".trim($banner_id)."'"; 1129 } 1130 1131 $query .= implode(" OR ",$banners_ids_query); 1132 1133 $query .= ") AND (active_until=-1 OR active_until>='".date("Y-m-d")."') AND banner_type!='swf' AND is_visible='yes' ORDER BY ".$orderby.") as banners ORDER BY banner_order DESC;"; 1134 1135 $banners = $wpdb->get_results($query); 1136 1137 if($banners){ 1138 $the_banner = '<div id="useful-banner-manager-banners-rotation-n'.$banners_rotation_id.'" class="useful_banner_manager_banners_rotation" style="overflow: hidden; width: '.$width.'px; height: '.$height.'px;">'; 1139 1140 $first_banner = true; 1141 foreach($banners as $banner){ 1142 $the_banner .= '<div class="useful_banner_manager_rotating_banner"'; 1143 if($first_banner){ 1144 $first_banner = false; 1145 }else{ 1146 $the_banner .= ' style="display: none"'; 1147 } 1148 $the_banner .= '>'; 1149 840 1150 if($banner->banner_link!=""){ 841 $the_banner .= '<a href="'.$banner->banner_link.'" target="'.$banner->link_target.'">'; 842 } 843 $the_banner .= '<img src="'.get_home_url().'/wp-content/uploads/useful_banner_manager_banners/'.$banner->id."-".$banner->banner_name.'.'.$banner->banner_type.'" width="'.$banner->banner_width.'" height="'.$banner->banner_height.'" alt="'.$banner->banner_title.'" />'; 1151 $the_banner .= '<a href="'.$banner->banner_link.'" target="'.$banner->link_target.'" rel="'.$banner->link_rel.'">'; 1152 } 1153 1154 $the_banner .= '<img src="'.get_home_url().'/wp-content/uploads/useful_banner_manager_banners/'.$banner->id.'-'.$banner->banner_name.'.'.$banner->banner_type.'" width="'.$width.'" height="'.$height.'" alt="'.$banner->banner_alt.'" />'; 844 1155 845 1156 if($banner->banner_link!=""){ 846 1157 $the_banner .= '</a>'; 847 1158 } 848 }else{ 849 $the_banner .= '<object width="'.$banner->banner_width.'" height="'.$banner->banner_height.'"> 850 <param name="movie" value="'.get_home_url().'/wp-content/uploads/useful_banner_manager_banners/'.$banner->id."-".$banner->banner_name.'.'.$banner->banner_type.'"> 851 <embed src="'.get_home_url().'/wp-content/uploads/useful_banner_manager_banners/'.$banner->id."-".$banner->banner_name.'.'.$banner->banner_type.'" width="'.$banner->banner_width.'" height="'.$banner->banner_height.'"> 852 </embed> 853 </object>'; 854 } 1159 1160 $the_banner .= '</div>'; 1161 } 1162 855 1163 $the_banner .= '</div>'; 856 } 857 858 $content = str_replace($match[0],$the_banner,$content); 1164 1165 $the_banner .= '<script type="text/javascript"> 1166 jQuery(function($){ 1167 $(document).ready(function(){ 1168 var useful_banner_manager_banners_rotation_block = "useful-banner-manager-banners-rotation-n'.$banners_rotation_id.'"; 1169 var interval_between_rotations = '.($interval*1000).'; 1170 if($("#"+useful_banner_manager_banners_rotation_block+" .useful_banner_manager_rotating_banner").length>1){ 1171 setTimeout("useful_banner_manager_rotate_banners(\'"+useful_banner_manager_banners_rotation_block+"\',"+interval_between_rotations+")",interval_between_rotations); 1172 } 1173 }); 1174 }); 1175 </script>'; 1176 1177 $banners_rotation_id++; 1178 1179 $content = str_replace($match[0],$the_banner,$content); 1180 } 859 1181 } 860 1182 } … … 864 1186 865 1187 function useful_banner_manager_banners($banners,$count){ 866 global $wpdb, $useful_banner_manager_table_name , $useful_banner_manager_plugin_url;1188 global $wpdb, $useful_banner_manager_table_name; 867 1189 868 1190 if(!is_numeric($count) || intval($count)<1){ … … 873 1195 874 1196 foreach($banners_ids as $key => $banner_id){ 875 if(!is_numeric($banner_id) || intval($ count)<1){1197 if(!is_numeric($banner_id) || intval($banner_id)<1){ 876 1198 unset($banners_ids[$key]); 877 1199 } … … 882 1204 } 883 1205 884 $count = intval($count);885 886 1206 $query = "SELECT * FROM (SELECT * FROM ".$useful_banner_manager_table_name." WHERE ("; 887 1207 $banners_ids_query = array(); … … 897 1217 $banners = $wpdb->get_results($query); 898 1218 899 foreach($banners as $banner){ 900 ?> 901 <div class="useful_banner_manager_banner"> 1219 if($banners){ 1220 foreach($banners as $banner){ 1221 ?> 1222 <div class="useful_banner_manager_banner"> 1223 <?php 1224 if($banner->banner_type!="swf"){ 1225 if($banner->banner_link!=""){ 1226 ?> 1227 <a href="<?php echo($banner->banner_link); ?>" target="<?php echo($banner->link_target); ?>" rel="<?php echo($banner->link_rel); ?>"> 1228 <?php 1229 } 1230 ?> 1231 <img src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>" alt="<?php echo($banner->banner_alt); ?>" /> 1232 <?php 1233 if($banner->banner_link!=""){ 1234 ?> 1235 </a> 1236 <?php 1237 } 1238 }else{ 1239 ?> 1240 <object width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>"> 1241 <param name="movie" value="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>"> 1242 <embed src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>"> 1243 </embed> 1244 </object> 1245 <?php 1246 } 1247 ?> 1248 </div> 902 1249 <?php 903 if($banner->banner_type!="swf"){ 904 if($banner->banner_link!=""){ 905 ?> 906 <a href="<?php echo($banner->banner_link); ?>" target="<?php echo($banner->link_target); ?>"> 1250 } 1251 } 1252 } 1253 1254 function useful_banner_manager_banners_rotation($banners,$interval,$width,$height,$orderby=""){ 1255 global $wpdb, $useful_banner_manager_table_name, $banners_rotation_id; 1256 1257 if($orderby=="rand"){ 1258 $orderby = "RAND()"; 1259 }else{ 1260 $orderby = "banner_order, id DESC"; 1261 } 1262 1263 if(!is_numeric($interval) || intval($interval)<=0){ 1264 return false; 1265 } 1266 1267 if(!is_numeric($width) || intval($width)<=0){ 1268 return false; 1269 } 1270 1271 if(!is_numeric($height) || intval($height)<=0){ 1272 return false; 1273 } 1274 1275 $banners_ids = explode(",",$banners); 1276 1277 foreach($banners_ids as $key => $banner_id){ 1278 if(!is_numeric($banner_id) || intval($banner_id)<1){ 1279 unset($banners_ids[$key]); 1280 } 1281 } 1282 1283 if(empty($banners_ids)){ 1284 return false; 1285 } 1286 1287 $query = "SELECT * FROM (SELECT * FROM ".$useful_banner_manager_table_name." WHERE ("; 1288 $banners_ids_query = array(); 1289 1290 foreach($banners_ids as $banner_id){ 1291 $banners_ids_query[] = "id='".trim($banner_id)."'"; 1292 } 1293 1294 $query .= implode(" OR ",$banners_ids_query); 1295 1296 $query .= ") AND (active_until=-1 OR active_until>='".date("Y-m-d")."') AND banner_type!='swf' AND is_visible='yes' ORDER BY ".$orderby.") as banners ORDER BY banner_order DESC;"; 1297 1298 $banners = $wpdb->get_results($query); 1299 1300 if($banners){ 1301 ?> 1302 <div id="useful-banner-manager-banners-rotation-n<?php echo($banners_rotation_id); ?>" class="useful_banner_manager_banners_rotation" style="overflow: hidden; width: <?php echo($width); ?>px; height: <?php echo($height); ?>px;"> 1303 <?php 1304 $first_banner = true; 1305 foreach($banners as $banner){ 1306 ?> 1307 <div class="useful_banner_manager_rotating_banner"<?php if($first_banner){ $first_banner = false; }else{ echo(' style="display: none"'); } ?>> 1308 <?php 1309 if($banner->banner_link!=""){ 1310 ?> 1311 <a href="<?php echo($banner->banner_link); ?>" target="<?php echo($banner->link_target); ?>" rel="<?php echo($banner->link_rel); ?>"> 1312 <?php 1313 } 1314 ?> 1315 <img src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($width); ?>" height="<?php echo($height); ?>" alt="<?php echo($banner->banner_alt); ?>" /> 1316 <?php 1317 if($banner->banner_link!=""){ 1318 ?> 1319 </a> 1320 <?php 1321 } 1322 ?> 1323 </div> 907 1324 <?php 908 }909 ?>910 <img src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>" alt="<?php echo($banner->banner_title); ?>" />911 <?php912 if($banner->banner_link!=""){913 ?>914 </a>915 <?php916 }917 }else{918 ?>919 <object width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>">920 <param name="movie" value="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>">921 <embed src="<?php bloginfo("url"); ?>/wp-content/uploads/useful_banner_manager_banners/<?php echo($banner->id."-".$banner->banner_name); ?>.<?php echo($banner->banner_type); ?>" width="<?php echo($banner->banner_width); ?>" height="<?php echo($banner->banner_height); ?>">922 </embed>923 </object>924 <?php925 1325 } 926 1326 ?> 927 1327 </div> 928 <?php 1328 <script type="text/javascript"> 1329 jQuery(function($){ 1330 $(document).ready(function(){ 1331 var useful_banner_manager_banners_rotation_block = "useful-banner-manager-banners-rotation-n<?php echo($banners_rotation_id); ?>"; 1332 var interval_between_rotations = <?php echo(($interval*1000)); ?>; 1333 if($("#"+useful_banner_manager_banners_rotation_block+" .useful_banner_manager_rotating_banner").length>1){ 1334 setTimeout("useful_banner_manager_rotate_banners('"+useful_banner_manager_banners_rotation_block+"',"+interval_between_rotations+")",interval_between_rotations); 1335 } 1336 }); 1337 }); 1338 </script> 1339 <?php 1340 $banners_rotation_id++; 929 1341 } 930 1342 } … … 933 1345 add_filter('the_content', 'add_useful_banner_manager_banners'); 934 1346 935 add_action('init', 'useful_banner_manager_widget_init', 1); 1347 wp_enqueue_script('jquery'); 1348 wp_enqueue_script('useful_banner_manager_scripts',$useful_banner_manager_plugin_url."scripts.js"); 1349 add_action('widgets_init', 'useful_banner_manager_widget_init'); 936 1350 add_action('plugins_loaded','useful_banner_manager_load'); 937 1351 add_action("admin_menu", "useful_banner_manager_menu");
Note: See TracChangeset
for help on using the changeset viewer.