Changeset 822235
- Timestamp:
- 12/15/2013 01:12:20 AM (12 years ago)
- Location:
- jellyfish-invaders/trunk
- Files:
-
- 2 edited
-
jellyfish_invaders.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jellyfish-invaders/trunk/jellyfish_invaders.php
r648631 r822235 2 2 /* 3 3 Plugin Name: Jellyfish Invaders 4 Plugin URI: http://strawberryjellyfish.com/ wordpress-plugin-jellyfish-invaders/4 Plugin URI: http://strawberryjellyfish.com/jellyfish-invaders/ 5 5 Description: Randomly animates retro space invaders on your WordPress blog 6 6 Author: Robert Miller <rob@strawberryjellyfish.com> 7 Version: 0. 67 Version: 0.8.1 8 8 Author URI: http://strawberryjellyfish.com/ 9 9 */ 10 ?> 11 <?php 10 11 /* 12 This program is free software; you can redistribute it and/or modify 13 it under the terms of the GNU General Public License as published by 14 the Free Software Foundation; either version 2 of the License, or 15 (at your option) any later version. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 Online: http://www.gnu.org/licenses/gpl.txt 26 */ 27 12 28 /* 13 29 * Hooks and Actions … … 31 47 if (!is_admin() && ($jellyfish_invaders_options['enable'] == true)) { 32 48 add_action('wp_enqueue_scripts', 'jellyfish_invaders_queue_scripts'); 33 add_action('wp_footer', 'jellyfish_invaders_print_script',100);34 49 } 35 50 … … 41 56 42 57 function jellyfish_invaders_queue_scripts() { 43 //enqueue Spritely jquery library for animation and necessary css to page footer 44 wp_register_script( 'spritely', plugins_url( 'js/jquery.spritely-0.6.js', __FILE__ ), array('jquery'), '', true ); 45 wp_enqueue_script( 'spritely' ); 46 wp_enqueue_style( 'jellyfish_invaders_style',plugins_url( 'jellyfish_invaders.css', __FILE__ ) ); 58 // to save unnecessary requests and bandwidth, only include js scripts 59 // and css when invaders are needed. This is slightly complicated by the fact 60 // we can have them displaying on a per post basis. 61 62 $jellyfish_invaders_options = get_option('jellyfish_invaders_options'); 63 $need_invaders = false; 64 65 if (!is_admin() && ($jellyfish_invaders_options['enable'] == true)) { 66 // most likely we need to print scripts 67 $need_invaders = true; 68 if ($jellyfish_invaders_options['use_custom_field'] == true) { 69 // but now only show invaders on specific pages 70 // check we need them before queueing up the js and css 71 if (is_single() OR is_page()) { 72 $cv = get_post_meta(get_the_ID(), 'jellyfish_invaders',true); 73 if ( ($cv != 'true') && ($cv != 'on')){ 74 // abort: no custom field, no invaders needed 75 $need_invaders = false; 76 } 77 } else { 78 // abort: not a single page or post can't show them anyway 79 $need_invaders = false; 80 } 81 } 82 } 83 84 if ($need_invaders) { 85 //enqueue Spritely jquery library and js for animation and necessary css to page footer 86 wp_register_script( 'spritely', plugins_url( 'js/jquery.spritely-0.6.js', __FILE__ ), array('jquery'), '', true ); 87 wp_enqueue_script( 'spritely' ); 88 wp_enqueue_style( 'jellyfish_invaders_style',plugins_url( 'jellyfish_invaders.css', __FILE__ ) ); 89 add_action('wp_footer', 'jellyfish_invaders_print_script',100); 90 } 47 91 } 48 92 … … 94 138 <?php settings_fields('jellyfish_invaders_options'); ?> 95 139 <?php do_settings_sections('jellyfish_invaders'); ?> 96 <input name="Submit" type="submit" value="Save Changes"/>140 <input name="Submit" type="submit" class="button action" value="Save Changes"/> 97 141 </form> 98 142 </div> -
jellyfish-invaders/trunk/readme.txt
r648542 r822235 6 6 Tags: retro, space invaders, 8bit, animation, visual effect, animated aliens, sci fi, gaming, 7 7 Requires at least: 3.0 8 Tested up to: 3. 59 Stable tag: 0. 68 Tested up to: 3.8 9 Stable tag: 0.8.1 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 74 74 75 75 == Changelog == 76 0.6 initial release 76 77 * 0.8.1 tweaked admin for WordPress 3.8 78 * 0.75 changed the way scripts are queued to ensure javascript is only included 79 when invaders are actually needed. 80 * 0.6 initial release 77 81 78 82 == Upgrade Notice ==
Note: See TracChangeset
for help on using the changeset viewer.