Changeset 849217
- Timestamp:
- 02/01/2014 01:36:57 AM (12 years ago)
- Location:
- flickr-rss/trunk
- Files:
-
- 3 edited
- 1 moved
-
. (modified) (1 prop)
-
admin.php (moved) (moved from flickr-rss/trunk/flickrrss-settingspage.php)
-
flickrrss.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flickr-rss/trunk
-
Property
svn:ignore
set to
.git
-
Property
svn:ignore
set to
-
flickr-rss/trunk/flickrrss.php
r472311 r849217 3 3 Plugin Name: flickrRSS 4 4 Plugin URI: http://wordpress.org/extend/plugins/flickr-rss/ 5 Description: Allows you to integrate the photos from a Flickr RSS feed into your site.6 Version: 5.25 Description: Allows you to easily integrate Flickr photos into your site's templates. 6 Version: 6.0 7 7 License: GPL 8 8 Author: Dave Kellam … … 10 10 */ 11 11 12 if (!class_exists('flickrRSS')) { 12 if ( ! class_exists( 'flickrRSS' ) ) { 13 13 14 class flickrRSS { 14 15 15 function flickrRSS() { 16 $this->version = "5.2"; 17 } 18 19 function get_and_delete_option($setting) { $v = get_option($setting); delete_option($setting); return $v; } 20 21 function setupActivation() { 22 23 // check for previously installed version 4.0 or older 24 if (get_option('flickrRSS_flickrid')) { 25 // let's port previous settings and delete them 26 $settings = $this->fixArguments(array( 27 get_and_delete_option('flickrRSS_display_numitems'), 28 get_and_delete_option('flickrRSS_display_type'), 29 get_and_delete_option('flickrRSS_tags'), 30 get_and_delete_option('flickrRSS_display_imagesize'), 31 get_and_delete_option('flickrRSS_before'), 32 get_and_delete_option('flickrRSS_after'), 33 get_and_delete_option('flickrRSS_flickrid'), 34 get_and_delete_option('flickrRSS_set'), 35 get_and_delete_option('flickrRSS_use_image_cache'), 36 get_and_delete_option('flickrRSS_image_cache_uri'), 37 get_and_delete_option('flickrRSS_image_cache_dest') 38 )); 39 update_option('flickrRSS_settings', $settings); 40 } 41 42 // update version number 43 if (get_option('flickrRSS_version') != $this->version) 44 update_option('flickrRSS_version', $this->version); 45 } 46 47 function fixArguments($args) { 16 function fixArguments( $args ) { 48 17 $settings = array(); 49 18 50 if ( isset($args[0])) $settings['num_items'] = $args[0];51 if ( isset($args[1])) $settings['type'] = $args[1];52 if ( isset($args[2])) $settings['tags'] = $args[2];53 if ( isset($args[6])) $settings['id'] = $args[6];54 if ( isset($args[7])) $settings['set'] = $args[7];55 if ( isset($args[8])) $settings['do_cache'] = $args[8];56 if ( isset($args[9])) $settings['cache_uri'] = $args[9];57 if ( isset($args[10])) $settings['cache_path'] = $args[10];19 if ( isset( $args[0] ) ) $settings['num_items'] = $args[0]; 20 if ( isset( $args[1] ) ) $settings['type'] = $args[1]; 21 if ( isset( $args[2] ) ) $settings['tags'] = $args[2]; 22 if ( isset( $args[6] ) ) $settings['id'] = $args[6]; 23 if ( isset( $args[7] ) ) $settings['set'] = $args[7]; 24 if ( isset( $args[8] ) ) $settings['do_cache'] = $args[8]; 25 if ( isset( $args[9] ) ) $settings['cache_uri'] = $args[9]; 26 if ( isset( $args[10] ) ) $settings['cache_path'] = $args[10]; 58 27 59 28 $imagesize = $args[3]?$args[3]:"square"; … … 67 36 68 37 function getSettings() { 69 70 if (!get_option('flickrRSS_settings')) $this->setupActivation();71 38 72 39 $settings = array( … … 109 76 } 110 77 111 function getRSS($settings) { 112 if (!function_exists('MagpieRSS')) { 113 // Check if another plugin is using RSS, may not work 114 include_once (ABSPATH . WPINC . '/rss.php'); 115 error_reporting(E_ERROR); 116 } 117 // get the feeds 78 function getRSS( $settings ) { 79 // Construct feed URL 118 80 if ($settings['type'] == "user") { $rss_url = 'http://api.flickr.com/services/feeds/photos_public.gne?id=' . $settings['id'] . '&tags=' . $settings['tags'] . '&format=rss_200'; } 119 81 elseif ($settings['type'] == "favorite") { $rss_url = 'http://api.flickr.com/services/feeds/photos_faves.gne?id=' . $settings['id'] . '&format=rss_200'; } … … 125 87 die(); 126 88 } 127 # get rss file128 return @fetch_rss($rss_url);89 // Retrieve feed 90 return fetch_feed( $rss_url ); 129 91 } 130 92 … … 223 185 224 186 function setupSettingsPage() { 225 if ( function_exists('add_options_page')) {226 add_options_page( 'flickrRSS Settings', 'flickrRSS', 8, basename(__FILE__), array(&$this, 'printSettingsPage'));187 if ( function_exists( 'add_options_page') ) { 188 add_options_page( 'flickrRSS Settings', 'flickrRSS', 'manage_options', 'flickrrss-settingspage.php', array( &$this, 'printSettingsPage' ) ); 227 189 } 228 190 } 229 191 230 192 function printSettingsPage() { 193 231 194 $settings = $this->getSettings(); 232 if (isset($_POST['save_flickrRSS_settings'])) { 233 foreach ($settings as $name => $value) { 195 196 if ( isset( $_POST['save_flickrRSS_settings'] ) ) { 197 198 foreach ( $settings as $name => $value ) { 234 199 $settings[$name] = $_POST['flickrRSS_'.$name]; 235 200 } 201 236 202 $settings['cache_sizes'] = array(); 237 foreach (array("small", "square", "thumbnail", "medium", "large") as $size) { 203 204 foreach ( array("small", "square", "thumbnail", "medium", "large") as $size ) { 238 205 if ($_POST['flickrRSS_cache_'.$size]) $settings['cache_sizes'][] = $size; 239 206 } 240 update_option('flickrRSS_settings', $settings); 207 208 update_option( 'flickrRSS_settings', $settings ); 209 241 210 echo '<div class="updated"><p>flickrRSS settings saved!</p></div>'; 242 211 } 243 if (isset($_POST['reset_flickrRSS_settings'])) { 244 delete_option('flickrRSS_settings'); 212 213 if ( isset( $_POST['reset_flickrRSS_settings'] ) ) { 214 delete_option( 'flickrRSS_settings' ); 245 215 echo '<div class="updated"><p>flickrRSS settings restored to default!</p></div>'; 246 216 } 247 include ("flickrrss-settingspage.php"); 217 218 // add setting page 219 include ( 'flickrrss-settingspage.php' ); 220 248 221 } 249 222 } 250 223 } 251 224 $flickrRSS = new flickrRSS(); 252 add_action( 'admin_menu', array(&$flickrRSS, 'setupSettingsPage') ); 253 add_action( 'plugins_loaded', array(&$flickrRSS, 'setupWidget') ); 254 register_activation_hook( __FILE__, array( &$flickrRSS, 'setupActivation' )); 255 256 function get_flickrRSS($settings = array()) { 225 add_action( 'admin_menu', array( &$flickrRSS, 'setupSettingsPage' ) ); 226 add_action( 'plugins_loaded', array( &$flickrRSS, 'setupWidget' ) ); 227 228 /** 229 * Main function to call flickrRSS in your templates 230 */ 231 function get_flickrRSS( $settings = array() ) { 257 232 global $flickrRSS; 258 if (func_num_args() > 1 ) { 233 234 if ( func_num_args() > 1 ) { 259 235 $old_array = func_get_args(); 260 $flickrRSS->printGallery( $flickrRSS->fixArguments($old_array));236 $flickrRSS->printGallery( $flickrRSS->fixArguments( $old_array ) ); 261 237 } 262 else $flickrRSS->printGallery( $settings);238 else $flickrRSS->printGallery( $settings ); 263 239 } 264 265 ?> -
flickr-rss/trunk/readme.txt
r472311 r849217 1 1 === flickrRSS === 2 Contributors: eightface , stefano.verna3 Tags: flickr, photos, images, sidebar, widget , rss4 Requires at least: 3. 05 Tested up to: 3. 2.12 Contributors: eightface 3 Tags: flickr, photos, images, sidebar, widget 4 Requires at least: 3.5 5 Tested up to: 3.8.1 6 6 Stable tag: 5.2 7 7 … … 81 81 == Plugin History == 82 82 83 **Latest Release:** December 8, 201183 **Latest Release:** January 31, 2014 84 84 85 * 6.0 - Primary development on GitHub, see repo there for details. Removing old functionality and revamping plugin. 85 86 * 5.2 - Fixed image cache server name change, also had a nested function for some reason which was messing up multiple instances for people 86 87 * 5.1 - Minor interface tweaks to avoid confusion
Note: See TracChangeset
for help on using the changeset viewer.