Changeset 757707
- Timestamp:
- 08/17/2013 09:47:11 PM (12 years ago)
- Location:
- iphods-itunes-top-products-rss-widget/trunk
- Files:
-
- 1 added
- 2 edited
-
iphods.php (modified) (6 diffs)
-
iphods_settings.php (added)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
iphods-itunes-top-products-rss-widget/trunk/iphods.php
r757652 r757707 2 2 /** 3 3 * @package iphods 4 * @version 8.1 64 * @version 8.17 5 5 */ 6 6 /* … … 9 9 Description: This plugin is a simple plugin to generate widgets highlighting top mac apps, music, books, ios apps, audiobooks and university courses available on Apple iTunes Store. This is in development, but provides a starting point for experienced developers who want to customize the widget to their needs. At this time, the plugin does not support affiliate links but will in the near future. 10 10 Author: Bradford Knowton 11 Version: 8.1 611 Version: 8.17 12 12 Author URI: http://bradknowlton.com/ 13 13 License: GPLv2 or later … … 21 21 define('APPLE_ITUNES_URL','https://itunes.apple.com/'); 22 22 define('ACTIVATION_URL','http://iphods.com/activation.php'); 23 define('IPHODS_TOP_PRODUCTS_WIDGET_VERSION','8.17'); 23 24 24 25 require(dirname(__FILE__)."/iphods_top_widget.php"); 25 26 require(dirname(__FILE__)."/iphods_shortcode.php"); 27 require(dirname(__FILE__)."/iphods_settings.php"); 26 28 27 29 class iPhods { … … 36 38 37 39 add_action( 'widgets_init', array($this,'register_iphods_widget') ); 38 add_action( 'wp_enqueue_scripts', array($this,'register_iphods_css') );39 40 40 if ( is_admin() ){41 // add settings admin page42 add_action('admin_menu', array($this,'iphods_admin_menu')); 43 add_action('admin_init', array( $this, 'iphods_page_init' ) );41 // only initate css on frontend 42 if(!is_admin()){ 43 add_action( 'wp_enqueue_scripts', array($this,'register_iphods_css') ); 44 } 44 45 45 // add shortcut to settings from plugin page 46 add_filter('plugin_action_links', array($this,'iphods_plugin_action_links'), 10, 2); 47 } 46 48 47 } 49 48 … … 55 54 // removed to confirm to site WP repository guidelines 56 55 /* 57 else{56 else{ 58 57 // otherwise use md5 hash of url 59 58 wp_remote_post( ACTIVATION_URL, array( 'body' => array( 'op'=> 'activate', 'bu' => md5(get_bloginfo('url')) ) ) ); … … 70 69 // removed to confirm to site WP repository guidelines 71 70 /* 72 else{71 else{ 73 72 // otherwise use md5 hash of url 74 73 wp_remote_post( ACTIVATION_URL, array( 'body' => array( 'op'=> 'deactivate', 'bu' => md5(get_bloginfo('url')) ) ) ); 75 74 } 76 75 */ 77 78 79 } 80 81 public function iphods_admin_menu() { 82 $page_title = 'iPhods Top Products Settings'; 83 $menu_title = 'iPhods Settings'; 84 $capability = 'manage_options'; 85 $menu_slug = 'iphods-settings'; 86 $function = array($this,'iphods_settings'); 87 add_options_page($page_title, $menu_title, $capability, $menu_slug, $function); 88 } 89 90 function iphods_settings() { 91 if (!current_user_can('manage_options')) { 92 wp_die('You do not have sufficient permissions to access this page.'); 93 } 94 95 // Here is where you could start displaying the HTML needed for the settings 96 // page, or you could include a file that handles the HTML output for you. 97 98 ?> 99 <div class="wrap"> 100 <?php screen_icon(); ?> 101 <h2>iPhods Settings</h2> 102 <form method="post" action="options.php"> 103 <?php 104 // This prints out all hidden setting fields 105 settings_fields( 'iphods_option_group' ); 106 do_settings_sections( 'iphods-settings' ); 107 ?> 108 <?php submit_button(); ?> 109 </form> 110 </div> 111 <?php 112 113 } 114 115 // initialize settings page 116 117 public function iphods_page_init() { 118 119 register_setting( 'iphods_option_group', 'iphods_activation_permission', array( $this, 'check_activation_permissions' ) ); 120 register_setting( 'iphods_option_group', 'iphods_backlink_permission', array( $this, 'check_backlink_permissions' ) ); 121 122 add_settings_section( 123 'iphods_section_id', 124 'Setting', 125 array( $this, 'print_section_info' ), 126 'iphods-settings' 127 ); 128 129 add_settings_field( 130 'iphods_activation_permissions', 131 __('Permission to notify plugin author of site url during activation of plugin, default is turned OFF','iphods'), 132 array( $this, 'create_activation_permissions_field' ), 133 'iphods-settings', 134 'iphods_section_id' 135 ); 136 137 add_settings_field( 138 'iphods_backlink_permissions', 139 __('Permission to display backlink below widget','iphods'), 140 array( $this, 'create_backlink_permissions_field' ), 141 'iphods-settings', 142 'iphods_section_id' 143 ); 144 } 145 146 public function check_activation_permissions( $input ) { 147 if ( is_numeric( $input['iphods_activation_permissions'] ) ) { 148 $mid = $input['iphods_activation_permissions']; 149 if ( get_option( 'iphods_activation_permissions' ) === FALSE ) { 150 add_option( 'iphods_activation_permissions', $mid ); 151 } else { 152 update_option( 'iphods_activation_permissions', $mid ); 153 } 154 } else { 155 $mid = ''; 156 } 157 return $mid; 158 } 159 160 public function check_backlink_permissions( $input ) { 161 if ( is_numeric( $input['iphods_backlink_permissions'] ) ) { 162 $mid = $input['iphods_backlink_permissions']; 163 if ( get_option( 'iphods_backlink_permissions' ) === FALSE ) { 164 add_option( 'iphods_backlink_permissions', $mid ); 165 } else { 166 update_option( 'iphods_backlink_permissions', $mid ); 167 } 168 } else { 169 $mid = ''; 170 } 171 return $mid; 172 } 173 174 175 public function print_section_info(){ 176 print 'Enter your setting below:'; 177 } 178 179 public function create_activation_permissions_field(){ 180 ?> 181 <select id="input_iphods_activation_permissions" name="iphods_activation_permission[iphods_activation_permissions]"> 182 <option value="0" <?php echo (get_option( 'iphods_activation_permissions') != 1 )?'selected="selected"':''; ?>>Disabled</option> 183 <option value="1" <?php echo (get_option( 'iphods_activation_permissions') == 1 )?'selected="selected"':''; ?>>Enabled</option> 184 </select><?php 185 186 } 187 188 public function create_backlink_permissions_field(){ 189 ?> 190 <select type="text" id="input_iphods_backlink_permission" name="iphods_backlink_permission[iphods_backlink_permissions]" > 191 <option value="0" <?php echo (get_option( 'iphods_backlink_permissions') != 1 )?'selected="selected"':''; ?>>Disabled</option> 192 <option value="1" <?php echo (get_option( 'iphods_backlink_permissions') == 1 )?'selected="selected"':''; ?>>Enabled</option> 193 </select><?php 194 } 195 196 // End of settings code 197 198 199 public function iphods_plugin_action_links($links, $file) { 200 static $this_plugin; 201 202 if (!$this_plugin) { 203 $this_plugin = plugin_basename(__FILE__); 204 } 205 206 if ($file == $this_plugin) { 207 // The "page" query string value must be equal to the slug 208 // of the Settings admin page we defined earlier, which in 209 // this case equals "myplugin-settings". 210 $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=iphods-settings">Settings</a>'; 211 array_unshift($links, $settings_link); 212 } 213 214 return $links; 215 } 76 } 77 78 216 79 217 80 // register iPhods_Widget widget -
iphods-itunes-top-products-rss-widget/trunk/readme.txt
r757652 r757707 5 5 Requires at least: 3.2.1 6 6 Tested up to: 3.6.5 7 Stable tag: 8.1 67 Stable tag: 8.17 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 98 98 * added setting for permission to add a backlink after widgets linking back to iPhods.com. 99 99 100 = 8.17 = 101 102 * added settings to begin to use affiliate commission links in widgets and shortcodes. 103 100 104 == Upgrade Notice == 101 105 … … 106 110 Added feed type dropdown to list, may not be compatible with previous widgets 107 111 112 = 8.17 = 113 Added more settings, but should be fully backwards compatible. 114 108 115 == Frequently Asked Questions == 109 116 110 1. Why did I write this plugin? I wanted to help others add unique dynamic content easily to their wordpress blog and sidebars. 117 1. Why did I write this plugin? 118 I wanted to help others add unique dynamic content easily to their wordpress blog and sidebars. 119 120 2. Why so many updates? 121 I'm having fun, adding new features and patching small bugs. I will slow down once I'm happy with the plugin and it does everything I want it to do. 122
Note: See TracChangeset
for help on using the changeset viewer.