Changeset 650011
- Timestamp:
- 01/09/2013 01:29:58 AM (13 years ago)
- Location:
- simple-slideshow-background/trunk
- Files:
-
- 6 edited
-
admin-form.php (modified) (3 diffs)
-
admin-menu.php (modified) (2 diffs)
-
admin-table.php (modified) (2 diffs)
-
display-background.php (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
-
simple-slideshow-background.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-slideshow-background/trunk/admin-form.php
r644112 r650011 1 1 <?php 2 2 function ssbg_form_list_images(){ 3 global $ssbg_settings; 4 3 5 // Create an instructions list table and prepare 4 6 $imagesTable = new Slideshow_Background_List_Table(); … … 8 10 <div id="icon-tools" class="icon32"><br/></div> 9 11 <h2><?php echo 'Slideshow Background Images'; ?></h2> 12 <br/> 10 13 <form id="edit_ssb" action='' method="post"> 11 14 <input type="hidden" name="action" value="add_ssb" /> … … 13 16 </form> 14 17 <?php $imagesTable->display() ?> 15 <i><b>Note:</b> All changes are saved automatically.</i> 18 <i><b>Note:</b> All changes to table are saved automatically.</i> 19 20 <div> 21 <h2>Settings</h2> 22 23 <form action="" method="post"> 24 <input type="hidden" name="action" value="settings_ssb" /> 25 <table class="form-table"> 26 <tbody> 27 <tr> 28 <th scope="row"> 29 <label for="delay">Rotation Timer in Seconds</label> 30 </th> 31 <td> 32 <input name="delay" type="text" id="delay" value="<?php echo $ssbg_settings['delay']; ?>" class="regular-text"> 33 </td> 34 </tr> 35 <tr> 36 <th scope="row"> 37 <label for="enabled">Slideshow Enabled</label> 38 </th> 39 <td> 40 <input name="enabled" type="checkbox" id="enabled" value="enabled" class="regular-text" <?php if($ssbg_settings['enabled']) echo "checked"; ?> > 41 </td> 42 </tr> 43 </tbody> 44 </table> 45 <p class="submit"><input type="submit" value="Save Settings" class="button-primary" name="Submit"></p> 46 </form> 47 48 </div> 16 49 </div> 17 50 <? -
simple-slideshow-background/trunk/admin-menu.php
r644112 r650011 10 10 function ssbg_menu_appearance() { 11 11 // WordPress globals 12 global $ssbg_option ;12 global $ssbg_option_name, $ssbg_settings, $ssbg_settings_name; 13 13 14 14 $action = 'default'; … … 19 19 20 20 switch ($action){ 21 case 'settings_ssb': 22 if(is_numeric($_REQUEST['delay'])) $ssbg_settings['delay'] = $_REQUEST['delay']; 23 if($_REQUEST['enabled'] == "enabled") $ssbg_settings['enabled'] = true; 24 else $ssbg_settings['enabled'] = false; 25 update_option($ssbg_settings_name, $ssbg_settings); 26 ssbg_form_list_images(); 27 break; 21 28 case 'save_picture': 22 29 $id = $_REQUEST['id']; 23 $images = get_option($ssbg_option , array());30 $images = get_option($ssbg_option_name, array()); 24 31 $images[$id]['picture'] = $_REQUEST['picture'.$id]; 25 update_option($ssbg_option , array_values($images));26 print $_REQUEST['picture'];32 update_option($ssbg_option_name, array_values($images)); 33 //print $_REQUEST['picture']; 27 34 ssbg_form_list_images(); 28 35 break; 29 36 case 'delete': 30 37 $id = $_REQUEST['id']; 31 $images = get_option($ssbg_option , array());38 $images = get_option($ssbg_option_name, array()); 32 39 unset($images[$id]); 33 update_option($ssbg_option , array_values($images));40 update_option($ssbg_option_name, array_values($images)); 34 41 ssbg_form_list_images(); 35 42 break; 36 43 case 'add_ssb': 37 $images = get_option($ssbg_option , array());44 $images = get_option($ssbg_option_name, array()); 38 45 $images[] = array("picture" => ''); 39 update_option($ssbg_option , array_values($images));46 update_option($ssbg_option_name, array_values($images)); 40 47 ssbg_form_list_images(); 41 48 break; -
simple-slideshow-background/trunk/admin-table.php
r644112 r650011 86 86 // WordPress globals 87 87 global $wpdb; 88 global $ssbg_option ;88 global $ssbg_option_name; 89 89 90 90 /** … … 102 102 $this->_column_headers = array($columns, $hidden, $sortable); 103 103 104 $data = get_option($ssbg_option , array());104 $data = get_option($ssbg_option_name, array()); 105 105 for($id = 0; $id < count($data); $id++){ 106 106 $data[$id]['id'] = $id; -
simple-slideshow-background/trunk/display-background.php
r644112 r650011 2 2 3 3 function ssbg_display_background() { 4 global $ssbg_option ;4 global $ssbg_option_name, $ssbg_settings; 5 5 6 $images = get_option($ssbg_option); 7 8 if($images) { 9 $image_html = '<img id="ssbg_image1"/>'; 10 $image_html .= '<img id="ssbg_image2"/>'; 11 $image_html .= '<script language="JavaScript1.2"> 12 var imgs=new Array() 13 '; 6 if($ssbg_settings['enabled']){ 7 $images = get_option($ssbg_option_name); 14 8 15 for($i = 0; $i < count($images); $i++){ 16 $image_html .= 'imgs['.$i.']="'.$images[$i]['picture']."\";\n"; 9 if($images) { 10 $image_html = '<img id="ssbg_image1"/>'; 11 $image_html .= '<img id="ssbg_image2"/>'; 12 $image_html .= '<script language="JavaScript1.2"> 13 var imgs=new Array() 14 '; 15 16 for($i = 0; $i < count($images); $i++){ 17 $image_html .= 'imgs['.$i.']="'.$images[$i]['picture']."\";\n"; 18 } 19 20 $image_html .= ' 21 if( ! /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { 22 //preload images 23 var pathToImg=new Array() 24 for (i=0;i<imgs.length;i++) 25 { 26 pathToImg[i]=new Image() 27 pathToImg[i].src=imgs[i] 28 } 29 30 var inc = Math.floor(Math.random()*imgs.length); 31 32 jQuery(\'#ssbg_image1\').attr(\'src\',imgs[inc]); 33 34 fadeout = 1; 35 fadein = 2; 36 37 function simpleSlideshow() 38 { 39 if (inc<imgs.length-1) 40 inc++ 41 else 42 inc=0 43 44 jQuery(\'#ssbg_image\'+fadein).css(\'zIndex\', -9999); 45 jQuery(\'#ssbg_image\'+fadeout).css(\'zIndex\', -9998); 46 47 jQuery(\'#ssbg_image\'+fadein).attr(\'src\', imgs[inc]); 48 jQuery(\'#ssbg_image\'+fadein).show(); 49 50 jQuery(\'#ssbg_image\'+fadeout).fadeOut(1000,function(){}); 51 52 temp = fadeout; 53 fadeout = fadein; 54 fadein = temp; 55 } 56 57 jQuery(\'document\').ready(setInterval(function() { simpleSlideshow() },'.$ssbg_settings['delay'].'000)); 58 } 59 </script>'; 17 60 } 18 19 $image_html .= ' 20 if( ! /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { 21 //preload images 22 var pathToImg=new Array() 23 for (i=0;i<imgs.length;i++) 24 { 25 pathToImg[i]=new Image() 26 pathToImg[i].src=imgs[i] 27 } 28 29 var inc = Math.floor(Math.random()*imgs.length); 30 31 jQuery(\'#ssbg_image1\').attr(\'src\',imgs[inc]); 32 33 fadeout = 1; 34 fadein = 2; 35 36 function simpleSlideshow() 37 { 38 if (inc<imgs.length-1) 39 inc++ 40 else 41 inc=0 42 43 jQuery(\'#ssbg_image\'+fadein).css(\'zIndex\', -9999); 44 jQuery(\'#ssbg_image\'+fadeout).css(\'zIndex\', -9998); 45 46 jQuery(\'#ssbg_image\'+fadein).attr(\'src\', imgs[inc]); 47 jQuery(\'#ssbg_image\'+fadein).show(); 48 49 jQuery(\'#ssbg_image\'+fadeout).fadeOut(1000,function(){}); 50 51 temp = fadeout; 52 fadeout = fadein; 53 fadein = temp; 54 } 55 56 jQuery(\'document\').ready(setInterval(function() { simpleSlideshow() },5000)); 57 } 58 </script>'; 59 } 60 // output the image 61 echo $image_html; 61 // output the image 62 echo $image_html; 63 } 62 64 } 63 65 add_action('wp_footer', 'ssbg_display_background'); -
simple-slideshow-background/trunk/readme.txt
r644112 r650011 5 5 Requires at least: 3.0.1 6 6 Tested up to: 3.4 7 Stable tag: 4.37 Stable tag: 0.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 21 21 == Installation == 22 22 23 Installation from zip: 24 23 25 1. From wp-admin interface, select Plugins -> Add New 24 26 2. Click Upload … … 26 28 4. Click "Install Now" 27 29 5. Activate the plugin through the 'Plugins' menu in WordPress 30 31 Installation from Wordpress Plugin Directory 32 33 1. From wp-admin interface, go to Plugins -> Add New 34 2. Search for "Simple Slideshow Background" 35 3. Click Install Now under the plugin name 36 4. Click Ok to install the plugin 37 5. Click Activate Plugin once installed 28 38 29 39 == Frequently Asked Questions == … … 42 52 == Changelog == 43 53 54 = 0.2 = 55 * Added two settings to allow temporarily disabling slideshow and setting timer between images. 56 44 57 = 0.1 = 45 58 * First release with simple functionality. 46 59 60 == Upgrade Notice == 61 62 = 0.2 = 63 * Added two settings to allow temporarily disabling slideshow and setting timer between images. 47 64 48 65 66 67 -
simple-slideshow-background/trunk/simple-slideshow-background.php
r644112 r650011 2 2 /** 3 3 * @package simple-slideshow-background 4 * @version 0. 14 * @version 0.2 5 5 */ 6 6 /* … … 14 14 15 15 // Globals 16 $ssbg_option = 'simple-slideshow_background_images'; 16 $ssbg_option_name = 'simple-slideshow_background_images'; 17 $ssbg_settings_name = 'simple-slideshow_settings'; 18 19 $ssbg_settings = get_option($ssbg_settings_name); 20 if(!$ssbg_settings){ 21 // If settings are not yet set, create them based on defaults 22 $ssbg_settings['delay'] = 5; 23 $ssbg_settings['enabled'] = true; 24 update_option($ssbg_settings_name, $ssbg_settings); 25 } 17 26 18 27 include_once 'admin-form.php';
Note: See TracChangeset
for help on using the changeset viewer.