WP-Cycle - Version 0.1.1

Version Description

Download this release

Release Info

Developer nathanrice
Plugin Icon wp plugin WP-Cycle
Version 0.1.1
Comparing to
See all releases

Code changes from version 0.1 to 0.1.1

Files changed (2) hide show
  1. readme.txt +4 -1
  2. wp-cycle.php +17 -11
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: slideshow, images, jquery cycle
5
  Requires at least: 2.7
6
  Tested up to: 2.8
7
- Stable tag: 0.1
8
 
9
  This plugin creates an image slideshow in your theme, using the jQuery Cycle plugin. You can upload/delete images via the administration panel, and display the images in your theme by using the <code>wp_cycle();</code> template tag, which will generate all the necessary HTML for outputting the rotating images.
10
 
@@ -22,6 +22,7 @@ Images can also be deleted via the plugins Administration page.
22
  1. Activate the plugin through the 'Plugins' menu in WordPress
23
  1. Configure the plugin, and upload/edit/delete images via the WP-Cycle menu within the Plugins tab
24
  1. Place `<?php wp_cycle(); ?>` in your theme where you want the slideshow to appear
 
25
 
26
  == Frequently Asked Questions ==
27
 
@@ -31,6 +32,8 @@ The plugin uses built in WordPress functions to handle image uploading. Therefor
31
 
32
  Also, a file that is not an image, or an image that does not meet the minimum height/width requirements, will not upload. Images larger than the dimensions set in the Settings of this plugin will be scaled down to fit, but images smaller than the dimensions set in the Settings will NOT be scaled up. The upload will fail and you will be asked to try again with another image.
33
 
 
 
34
  = I'm getting an error message that I don't understand. What should I do? =
35
 
36
  Please [email me](http://www.nathanrice.net/contact/ "email Nathan Rice") or [@nathanrice](http://twitter.com/nathanrice) me on Twitter. This plugin is still in early alpha stages, and I'm looking for good error reporting. I'll try to fix errors as soon as I possibly can.
4
  Tags: slideshow, images, jquery cycle
5
  Requires at least: 2.7
6
  Tested up to: 2.8
7
+ Stable tag: 0.1.1
8
 
9
  This plugin creates an image slideshow in your theme, using the jQuery Cycle plugin. You can upload/delete images via the administration panel, and display the images in your theme by using the <code>wp_cycle();</code> template tag, which will generate all the necessary HTML for outputting the rotating images.
10
 
22
  1. Activate the plugin through the 'Plugins' menu in WordPress
23
  1. Configure the plugin, and upload/edit/delete images via the WP-Cycle menu within the Plugins tab
24
  1. Place `<?php wp_cycle(); ?>` in your theme where you want the slideshow to appear
25
+ 1. Alternatively, you can use the shortcode [wp_cycle] in a post or page to display the slideshow.
26
 
27
  == Frequently Asked Questions ==
28
 
32
 
33
  Also, a file that is not an image, or an image that does not meet the minimum height/width requirements, will not upload. Images larger than the dimensions set in the Settings of this plugin will be scaled down to fit, but images smaller than the dimensions set in the Settings will NOT be scaled up. The upload will fail and you will be asked to try again with another image.
34
 
35
+ Finally, you need to verify that your upload directory is properly set. Some hosts screw this up, so you'll need to check. Go to "Settings" -> "Miscellaneous" and find the input box labeled "Store uploads in this folder". Unless you are absolutely sure this needs to be something else, this value should be exactly this (without the quotes) "wp-content/uploads". If it says "/wp-content/uploads" then the plugin will not function correctly. No matter what, the value of this field should never start with a slash "/". It expects a path relative to the root of the WordPress installation.
36
+
37
  = I'm getting an error message that I don't understand. What should I do? =
38
 
39
  Please [email me](http://www.nathanrice.net/contact/ "email Nathan Rice") or [@nathanrice](http://twitter.com/nathanrice) me on Twitter. This plugin is still in early alpha stages, and I'm looking for good error reporting. I'll try to fix errors as soon as I possibly can.
wp-cycle.php CHANGED
@@ -2,15 +2,14 @@
2
  /*
3
  Plugin Name: WP-Cycle
4
  Plugin URI: http://www.nathanrice.net/plugins/wp-cycle/
5
- Description: This plugin creates an image slideshow from the images you upload using the jQuery Cycle plugin. You can upload/delete images via the administration panel, and display the images in your theme by using the <code>wp_cycle();</code> template tag, which will generate all the necessary HTML for outputting the rotating images.
6
- Version: 0.1
7
  Author: Nathan Rice
8
  Author URI: http://www.nathanrice.net/
9
 
10
  This plugin inherits the GPL license from it's parent system, WordPress.
11
  */
12
 
13
-
14
  /*
15
  ///////////////////////////////////////////////
16
  This section defines the variables that
@@ -26,14 +25,13 @@ $wp_cycle_defaults = apply_filters('wp_cycle_defaults', array(
26
  'div' => 'rotator'
27
  ));
28
 
 
 
 
29
  // pull the settings from the db
30
  $wp_cycle_settings = get_option('wp_cycle_settings');
31
  $wp_cycle_images = get_option('wp_cycle_images');
32
 
33
- // use defaults if options aren't set yet
34
- $wp_cycle_settings = wp_parse_args($wp_cycle_settings, $wp_cycle_defaults);
35
-
36
-
37
  /*
38
  ///////////////////////////////////////////////
39
  This section hooks the proper functions
@@ -196,8 +194,8 @@ function wp_cycle_settings_update_check() {
196
  update_option('wp_cycle_settings', $wp_cycle_settings);
197
  }
198
  }
199
- // this function checks to see if we just added a new image
200
- // if so, it displays the "updated" message.
201
  function wp_cycle_images_update_check() {
202
  global $wp_cycle_images;
203
  if($wp_cycle_images['update'] == 'Added' || $wp_cycle_images['update'] == 'Deleted' || $wp_cycle_images['update'] == 'Updated') {
@@ -382,9 +380,11 @@ this final section generates all the code that
382
  is displayed on the front-end of the WP Theme
383
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
384
  */
385
- function wp_cycle($args = array()) {
386
  global $wp_cycle_settings, $wp_cycle_images;
387
- $args = wp_parse_args($args, $wp_cycle_settings);
 
 
388
 
389
  $newline = "\n"; // line break
390
 
@@ -405,12 +405,18 @@ function wp_cycle($args = array()) {
405
  echo '</div>'.$newline;
406
  }
407
 
 
 
 
 
408
  add_action('wp_print_scripts', 'wp_cycle_scripts');
409
  function wp_cycle_scripts() {
410
  if(!is_admin())
411
  wp_enqueue_script('cycle', $src = WP_CONTENT_URL.'/plugins/wp-cycle/jquery.cycle.all.min.js', $deps = array('jquery'));
412
  }
413
 
 
 
414
  add_action('wp_head', 'wp_cycle_head');
415
  function wp_cycle_head() {
416
  global $wp_cycle_settings; ?>
2
  /*
3
  Plugin Name: WP-Cycle
4
  Plugin URI: http://www.nathanrice.net/plugins/wp-cycle/
5
+ Description: This plugin creates an image slideshow from the images you upload using the jQuery Cycle plugin. You can upload/delete images via the administration panel, and display the images in your theme by using the <code><?php wp_cycle(); ?></code> template tag, which will generate all the necessary HTML for outputting the rotating images.
6
+ Version: 0.1.1
7
  Author: Nathan Rice
8
  Author URI: http://www.nathanrice.net/
9
 
10
  This plugin inherits the GPL license from it's parent system, WordPress.
11
  */
12
 
 
13
  /*
14
  ///////////////////////////////////////////////
15
  This section defines the variables that
25
  'div' => 'rotator'
26
  ));
27
 
28
+ // Insert the defaults into the database
29
+ add_option('wp_cycle_settings', $defaults, '', 'yes');
30
+
31
  // pull the settings from the db
32
  $wp_cycle_settings = get_option('wp_cycle_settings');
33
  $wp_cycle_images = get_option('wp_cycle_images');
34
 
 
 
 
 
35
  /*
36
  ///////////////////////////////////////////////
37
  This section hooks the proper functions
194
  update_option('wp_cycle_settings', $wp_cycle_settings);
195
  }
196
  }
197
+ // this function checks to see if we just added/updated/deleted an image
198
+ // if so, it displays the appropriate message
199
  function wp_cycle_images_update_check() {
200
  global $wp_cycle_images;
201
  if($wp_cycle_images['update'] == 'Added' || $wp_cycle_images['update'] == 'Deleted' || $wp_cycle_images['update'] == 'Updated') {
380
  is displayed on the front-end of the WP Theme
381
  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
382
  */
383
+ function wp_cycle($atts = array(), $content = null) {
384
  global $wp_cycle_settings, $wp_cycle_images;
385
+
386
+ // possible future use
387
+ //$args = wp_parse_args($atts, $wp_cycle_settings);
388
 
389
  $newline = "\n"; // line break
390
 
405
  echo '</div>'.$newline;
406
  }
407
 
408
+ // create the shortcode [wp_cycle]
409
+ add_shortcode('wp_cycle', 'wp_cycle');
410
+
411
+ // place the external script calls in the <head>
412
  add_action('wp_print_scripts', 'wp_cycle_scripts');
413
  function wp_cycle_scripts() {
414
  if(!is_admin())
415
  wp_enqueue_script('cycle', $src = WP_CONTENT_URL.'/plugins/wp-cycle/jquery.cycle.all.min.js', $deps = array('jquery'));
416
  }
417
 
418
+ // place jQuery Cycle plugin parameters
419
+ // and CSS code in the <head>
420
  add_action('wp_head', 'wp_cycle_head');
421
  function wp_cycle_head() {
422
  global $wp_cycle_settings; ?>