Changeset 1020856
- Timestamp:
- 11/06/2014 11:45:31 AM (11 years ago)
- Location:
- flickr-media-scanner
- Files:
-
- 1 added
- 4 edited
- 4 copied
-
tags/1.0.4 (added)
-
tags/1.0.4/assets (copied) (copied from flickr-media-scanner/trunk/assets)
-
tags/1.0.4/assets/css/admin.css (modified) (1 diff)
-
tags/1.0.4/flickr-media-scanner.php (copied) (copied from flickr-media-scanner/trunk/flickr-media-scanner.php) (1 diff)
-
tags/1.0.4/includes (copied) (copied from flickr-media-scanner/trunk/includes)
-
tags/1.0.4/readme.txt (copied) (copied from flickr-media-scanner/trunk/readme.txt) (2 diffs)
-
trunk/assets/css/admin.css (modified) (1 diff)
-
trunk/flickr-media-scanner.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flickr-media-scanner/tags/1.0.4/assets/css/admin.css
r1020716 r1020856 22 22 font-size: 15px; 23 23 color: #fff; 24 margin- left: 15px;24 margin-right: 15px; 25 25 padding: 7px 15px; 26 26 } -
flickr-media-scanner/tags/1.0.4/flickr-media-scanner.php
r1020854 r1020856 6 6 * Description: Finds all Flickr photos used in posts that have been removed 7 7 * Author: Alan Cesarini 8 * Version: 1.0. 38 * Version: 1.0.4 9 9 * Author URI: http://alancesarini.com 10 10 * License: GPL2+ 11 11 */ 12 12 13 $version = '1.0.3'; 13 class Flickr_Media_Scanner { 14 14 15 require( 'includes/class_scanner.php' );15 private static $_this; 16 16 17 add_action( 'wp_loaded', 'fms_register_assets' );17 private static $_version; 18 18 19 add_action( 'admin_enqueue_scripts', 'fms_enqueue_assets' ); 19 function __construct() { 20 21 if( isset( self::$_this ) ) 22 wp_die( sprintf( '%s is a singleton class and you cannot create a second instance.', get_class( $this ) ) ); 23 self::$_this = $this; 20 24 21 add_action( 'admin_menu', 'add_menu_item' );25 self::$_version = '1.0.4'; 22 26 23 function add_menu_item() { 24 $page = add_options_page( __( 'Flickr Media Scanner', 'plugin_textdomain' ), __( 'Flickr Media Scanner', 'plugin_textdomain' ), 'manage_options', 'flickr_media_scanner', 'settings_page' ); 27 require( 'includes/class_scanner.php' ); 28 29 add_action( 'wp_loaded', array( $this, 'register_assets' ) ); 30 31 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); 32 33 add_action( 'admin_menu', array( $this, 'add_menu_item' ) ); 34 35 } 36 37 static function this() { 38 39 return self::$_this; 40 41 } 42 43 function add_menu_item() { 44 45 $page = add_options_page( __( 'Flickr Media Scanner', 'plugin_textdomain' ), __( 'Flickr Media Scanner', 'plugin_textdomain' ), 'manage_options', 'flickr_media_scanner', array( $this, 'render_admin_page' ) ); 46 47 } 48 49 function render_admin_page() { 50 51 if( !$flickr_api_key = get_option( 'fms_api_key' ) ) { 52 if( isset( $_POST[ 'fms-api-key' ] ) ) 53 $flickr_api_key = sanitize_text_field( $_POST[ 'fms-api-key' ] ); 54 else { 55 $flickr_api_key = ''; 56 } 57 } 58 $selected_category = ( isset( $_POST[ 'fms-scan-category' ] ) ? intval( $_POST[ 'fms-scan-category' ] ) : '' ); 59 $selected_tags = ( isset( $_POST[ 'fms-scan-tags' ] ) ? sanitize_text_field( $_POST[ 'fms-scan-tags' ] ) : '' ); 60 $categories = get_categories(); 61 ?> 62 <div class="wrap"> 63 <h2>Flickr Media Scanner</h2> 64 <form method="post" action="<?php echo admin_url( 'options-general.php?page=flickr_media_scanner.php' ) ?>"> 65 <table class="form-table"> 66 <tr> 67 <th><label for="fms-api-key">Yout Flickr API key</label></th> 68 <td><input type="text" name="fms-api-key" id="fms-api-key" value="<?php echo $flickr_api_key; ?>" class="regular-text"></td> 69 </tr> 70 <tr> 71 <th><label for="fms-scan-category">Category</label></th> 72 <td> 73 <select name="fms-scan-category"> 74 <option value="-1">--Choose a category--</option> 75 <?php foreach( $categories as $category ) { ?> 76 <option value="<?php echo $category->term_id; ?>" <?php if( $category->term_id == $selected_category ) echo 'selected'; ?>><?php echo $category->name; ?></option> 77 <?php } ?> 78 </select> 79 </td> 80 </tr> 81 <tr> 82 <th><label for="fms-scan-tags">Tags</label></th> 83 <td><input type="text" name="fms-scan-tags" value="<?php echo $selected_tags; ?>" class="regular-text" /><span class="description"> (comma separated)</span></td> 84 </tr> 85 <tr> 86 <td></td> 87 <td><input type="submit" name="fms-scan" id="fms-scan" value="Scan now" class="button button-primary" /></td> 88 </tr> 89 </table> 90 </form> 91 92 <?php 93 if( isset( $_POST[ 'fms-scan'] ) ) { 94 update_option( 'fms_api_key', sanitize_text_field( $_POST[ 'fms-api-key' ] ) ); 95 echo '<div class="fms-colors"><p class="fms-loading fms-label">Not yet scanned</p><p class="fms-ok fms-label">Exists in Flickr</p><p class="fms-fail fms-label">Has been removed from Flickr</p></div>'; 96 $args = array(); 97 if( $selected_category > 0 ) { 98 $args[ 'category'] = $selected_category; 99 } 100 if( $selected_tags != '' ) { 101 $args[ 'tags' ] = $selected_tags; 102 } 103 $scanner = new FMS_Scanner( $flickr_api_key ); 104 $scanner->scan( $args ); 105 } 106 107 echo '</div>'; 108 109 } 110 111 function register_assets() { 112 113 wp_register_script( 'fms-admin-js', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), self::$_version ); 114 wp_register_style( 'fms-admin-style', plugins_url( 'assets/css/admin.css', __FILE__ ), false, self::$_version ); 115 116 } 117 118 function enqueue_assets() { 119 120 wp_enqueue_script( 'fms-admin-js' ); 121 wp_enqueue_style( 'fms-admin-style' ); 122 123 } 124 25 125 } 26 126 27 function settings_page() { 28 29 if( !$flickr_api_key = get_option( 'fms_api_key' ) ) { 30 if( isset( $_POST[ 'fms-api-key' ] ) ) 31 $flickr_api_key = sanitize_text_field( $_POST[ 'fms-api-key' ] ); 32 else { 33 $flickr_api_key = ''; 34 } 35 } 36 $selected_category = ( isset( $_POST[ 'fms-scan-category' ] ) ? intval( $_POST[ 'fms-scan-category' ] ) : '' ); 37 $selected_tags = ( isset( $_POST[ 'fms-scan-tags' ] ) ? sanitize_text_field( $_POST[ 'fms-scan-tags' ] ) : '' ); 38 $categories = get_categories(); 39 ?> 40 <div class="wrap"> 41 <h2>Flickr Media Scanner</h2> 42 <form method="post" action="<?php echo admin_url( 'options-general.php?page=flickr_media_scanner.php' ) ?>"> 43 <table class="form-table"> 44 <tr> 45 <th><label for="fms-api-key">Yout Flickr API key</label></th> 46 <td><input type="text" name="fms-api-key" id="fms-api-key" value="<?php echo $flickr_api_key; ?>" class="regular-text"></td> 47 </tr> 48 <tr> 49 <th><label for="fms-scan-category">Category</label></th> 50 <td> 51 <select name="fms-scan-category"> 52 <option value="-1">--Choose a category--</option> 53 <?php foreach( $categories as $category ) { ?> 54 <option value="<?php echo $category->term_id; ?>" <?php if( $category->term_id == $selected_category ) echo 'selected'; ?>><?php echo $category->name; ?></option> 55 <?php } ?> 56 </select> 57 </td> 58 </tr> 59 <tr> 60 <th><label for="fms-scan-tags">Tags</label></th> 61 <td><input type="text" name="fms-scan-tags" value="<?php echo $selected_tags; ?>" class="regular-text" /><span class="description"> (comma separated)</span></td> 62 </tr> 63 <tr> 64 <td></td> 65 <td><input type="submit" name="fms-scan" id="fms-scan" value="Scan now" /></td> 66 </tr> 67 </table> 68 </form> 69 70 <?php 71 if( isset( $_POST[ 'fms-scan'] ) ) { 72 update_option( 'fms_api_key', sanitize_text_field( $_POST[ 'fms-api-key' ] ) ); 73 echo '<div class="fms-colors"><p class="fms-loading fms-label">Not yet scanned</p><p class="fms-ok fms-label">Exists in Flickr</p><p class="fms-fail fms-label">Has been removed from Flickr</p></div>'; 74 $args = array(); 75 if( $selected_category > 0 ) { 76 $args[ 'category'] = $selected_category; 77 } 78 if( $selected_tags != '' ) { 79 $args[ 'tags' ] = $selected_tags; 80 } 81 $scanner = new FMS_Scanner( $flickr_api_key ); 82 $scanner->scan( $args ); 83 } 84 85 echo '</div>'; 86 87 } 88 89 function fms_register_assets() { 90 91 global $version; 92 93 wp_register_script( 'fms-admin-js', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), $version ); 94 wp_register_style( 'fms-admin-style', plugins_url( 'assets/css/admin.css', __FILE__ ), false, $version ); 95 96 } 97 98 function fms_enqueue_assets() { 99 100 wp_enqueue_script( 'fms-admin-js' ); 101 wp_enqueue_style( 'fms-admin-style' ); 102 103 } 127 new Flickr_Media_Scanner(); -
flickr-media-scanner/tags/1.0.4/readme.txt
r1020854 r1020856 4 4 Requires at least: 3.0 5 5 Tested up to: 4.0 6 Stable tag: trunk6 Stable tag: 1.0.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 28 28 == Changelog == 29 29 30 = 1.0.4 = 31 * Disable de scan button while we query Flickr 32 * Refactoring 33 * Minor CSS changes 34 30 35 == Upgrade Notice == -
flickr-media-scanner/trunk/assets/css/admin.css
r1020716 r1020856 22 22 font-size: 15px; 23 23 color: #fff; 24 margin- left: 15px;24 margin-right: 15px; 25 25 padding: 7px 15px; 26 26 } -
flickr-media-scanner/trunk/flickr-media-scanner.php
r1020716 r1020856 6 6 * Description: Finds all Flickr photos used in posts that have been removed 7 7 * Author: Alan Cesarini 8 * Version: 1.0. 38 * Version: 1.0.4 9 9 * Author URI: http://alancesarini.com 10 10 * License: GPL2+ 11 11 */ 12 12 13 $version = '1.0.3'; 13 class Flickr_Media_Scanner { 14 14 15 require( 'includes/class_scanner.php' );15 private static $_this; 16 16 17 add_action( 'wp_loaded', 'fms_register_assets' );17 private static $_version; 18 18 19 add_action( 'admin_enqueue_scripts', 'fms_enqueue_assets' ); 19 function __construct() { 20 21 if( isset( self::$_this ) ) 22 wp_die( sprintf( '%s is a singleton class and you cannot create a second instance.', get_class( $this ) ) ); 23 self::$_this = $this; 20 24 21 add_action( 'admin_menu', 'add_menu_item' );25 self::$_version = '1.0.4'; 22 26 23 function add_menu_item() { 24 $page = add_options_page( __( 'Flickr Media Scanner', 'plugin_textdomain' ), __( 'Flickr Media Scanner', 'plugin_textdomain' ), 'manage_options', 'flickr_media_scanner', 'settings_page' ); 27 require( 'includes/class_scanner.php' ); 28 29 add_action( 'wp_loaded', array( $this, 'register_assets' ) ); 30 31 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); 32 33 add_action( 'admin_menu', array( $this, 'add_menu_item' ) ); 34 35 } 36 37 static function this() { 38 39 return self::$_this; 40 41 } 42 43 function add_menu_item() { 44 45 $page = add_options_page( __( 'Flickr Media Scanner', 'plugin_textdomain' ), __( 'Flickr Media Scanner', 'plugin_textdomain' ), 'manage_options', 'flickr_media_scanner', array( $this, 'render_admin_page' ) ); 46 47 } 48 49 function render_admin_page() { 50 51 if( !$flickr_api_key = get_option( 'fms_api_key' ) ) { 52 if( isset( $_POST[ 'fms-api-key' ] ) ) 53 $flickr_api_key = sanitize_text_field( $_POST[ 'fms-api-key' ] ); 54 else { 55 $flickr_api_key = ''; 56 } 57 } 58 $selected_category = ( isset( $_POST[ 'fms-scan-category' ] ) ? intval( $_POST[ 'fms-scan-category' ] ) : '' ); 59 $selected_tags = ( isset( $_POST[ 'fms-scan-tags' ] ) ? sanitize_text_field( $_POST[ 'fms-scan-tags' ] ) : '' ); 60 $categories = get_categories(); 61 ?> 62 <div class="wrap"> 63 <h2>Flickr Media Scanner</h2> 64 <form method="post" action="<?php echo admin_url( 'options-general.php?page=flickr_media_scanner.php' ) ?>"> 65 <table class="form-table"> 66 <tr> 67 <th><label for="fms-api-key">Yout Flickr API key</label></th> 68 <td><input type="text" name="fms-api-key" id="fms-api-key" value="<?php echo $flickr_api_key; ?>" class="regular-text"></td> 69 </tr> 70 <tr> 71 <th><label for="fms-scan-category">Category</label></th> 72 <td> 73 <select name="fms-scan-category"> 74 <option value="-1">--Choose a category--</option> 75 <?php foreach( $categories as $category ) { ?> 76 <option value="<?php echo $category->term_id; ?>" <?php if( $category->term_id == $selected_category ) echo 'selected'; ?>><?php echo $category->name; ?></option> 77 <?php } ?> 78 </select> 79 </td> 80 </tr> 81 <tr> 82 <th><label for="fms-scan-tags">Tags</label></th> 83 <td><input type="text" name="fms-scan-tags" value="<?php echo $selected_tags; ?>" class="regular-text" /><span class="description"> (comma separated)</span></td> 84 </tr> 85 <tr> 86 <td></td> 87 <td><input type="submit" name="fms-scan" id="fms-scan" value="Scan now" class="button button-primary" /></td> 88 </tr> 89 </table> 90 </form> 91 92 <?php 93 if( isset( $_POST[ 'fms-scan'] ) ) { 94 update_option( 'fms_api_key', sanitize_text_field( $_POST[ 'fms-api-key' ] ) ); 95 echo '<div class="fms-colors"><p class="fms-loading fms-label">Not yet scanned</p><p class="fms-ok fms-label">Exists in Flickr</p><p class="fms-fail fms-label">Has been removed from Flickr</p></div>'; 96 $args = array(); 97 if( $selected_category > 0 ) { 98 $args[ 'category'] = $selected_category; 99 } 100 if( $selected_tags != '' ) { 101 $args[ 'tags' ] = $selected_tags; 102 } 103 $scanner = new FMS_Scanner( $flickr_api_key ); 104 $scanner->scan( $args ); 105 } 106 107 echo '</div>'; 108 109 } 110 111 function register_assets() { 112 113 wp_register_script( 'fms-admin-js', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), self::$_version ); 114 wp_register_style( 'fms-admin-style', plugins_url( 'assets/css/admin.css', __FILE__ ), false, self::$_version ); 115 116 } 117 118 function enqueue_assets() { 119 120 wp_enqueue_script( 'fms-admin-js' ); 121 wp_enqueue_style( 'fms-admin-style' ); 122 123 } 124 25 125 } 26 126 27 function settings_page() { 28 29 if( !$flickr_api_key = get_option( 'fms_api_key' ) ) { 30 if( isset( $_POST[ 'fms-api-key' ] ) ) 31 $flickr_api_key = sanitize_text_field( $_POST[ 'fms-api-key' ] ); 32 else { 33 $flickr_api_key = ''; 34 } 35 } 36 $selected_category = ( isset( $_POST[ 'fms-scan-category' ] ) ? intval( $_POST[ 'fms-scan-category' ] ) : '' ); 37 $selected_tags = ( isset( $_POST[ 'fms-scan-tags' ] ) ? sanitize_text_field( $_POST[ 'fms-scan-tags' ] ) : '' ); 38 $categories = get_categories(); 39 ?> 40 <div class="wrap"> 41 <h2>Flickr Media Scanner</h2> 42 <form method="post" action="<?php echo admin_url( 'options-general.php?page=flickr_media_scanner.php' ) ?>"> 43 <table class="form-table"> 44 <tr> 45 <th><label for="fms-api-key">Yout Flickr API key</label></th> 46 <td><input type="text" name="fms-api-key" id="fms-api-key" value="<?php echo $flickr_api_key; ?>" class="regular-text"></td> 47 </tr> 48 <tr> 49 <th><label for="fms-scan-category">Category</label></th> 50 <td> 51 <select name="fms-scan-category"> 52 <option value="-1">--Choose a category--</option> 53 <?php foreach( $categories as $category ) { ?> 54 <option value="<?php echo $category->term_id; ?>" <?php if( $category->term_id == $selected_category ) echo 'selected'; ?>><?php echo $category->name; ?></option> 55 <?php } ?> 56 </select> 57 </td> 58 </tr> 59 <tr> 60 <th><label for="fms-scan-tags">Tags</label></th> 61 <td><input type="text" name="fms-scan-tags" value="<?php echo $selected_tags; ?>" class="regular-text" /><span class="description"> (comma separated)</span></td> 62 </tr> 63 <tr> 64 <td></td> 65 <td><input type="submit" name="fms-scan" id="fms-scan" value="Scan now" /></td> 66 </tr> 67 </table> 68 </form> 69 70 <?php 71 if( isset( $_POST[ 'fms-scan'] ) ) { 72 update_option( 'fms_api_key', sanitize_text_field( $_POST[ 'fms-api-key' ] ) ); 73 echo '<div class="fms-colors"><p class="fms-loading fms-label">Not yet scanned</p><p class="fms-ok fms-label">Exists in Flickr</p><p class="fms-fail fms-label">Has been removed from Flickr</p></div>'; 74 $args = array(); 75 if( $selected_category > 0 ) { 76 $args[ 'category'] = $selected_category; 77 } 78 if( $selected_tags != '' ) { 79 $args[ 'tags' ] = $selected_tags; 80 } 81 $scanner = new FMS_Scanner( $flickr_api_key ); 82 $scanner->scan( $args ); 83 } 84 85 echo '</div>'; 86 87 } 88 89 function fms_register_assets() { 90 91 global $version; 92 93 wp_register_script( 'fms-admin-js', plugins_url( 'assets/js/admin.js', __FILE__ ), array( 'jquery' ), $version ); 94 wp_register_style( 'fms-admin-style', plugins_url( 'assets/css/admin.css', __FILE__ ), false, $version ); 95 96 } 97 98 function fms_enqueue_assets() { 99 100 wp_enqueue_script( 'fms-admin-js' ); 101 wp_enqueue_style( 'fms-admin-style' ); 102 103 } 127 new Flickr_Media_Scanner(); -
flickr-media-scanner/trunk/readme.txt
r1020716 r1020856 4 4 Requires at least: 3.0 5 5 Tested up to: 4.0 6 Stable tag: trunk6 Stable tag: 1.0.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 28 28 == Changelog == 29 29 30 = 1.0.4 = 31 * Disable de scan button while we query Flickr 32 * Refactoring 33 * Minor CSS changes 34 30 35 == Upgrade Notice ==
Note: See TracChangeset
for help on using the changeset viewer.