Changeset 627435
- Timestamp:
- 11/20/2012 12:25:33 AM (13 years ago)
- Location:
- all-in-one-favicon/trunk
- Files:
-
- 1 deleted
- 5 edited
- 1 moved
-
all-in-one-favicon.php (modified) (1 diff)
-
includes/aio-favicon-backend.php (modified) (10 diffs)
-
includes/aio-favicon-frontend.php (modified) (2 diffs)
-
includes/settings-page/sp-left-column.php (modified) (1 diff)
-
includes/settings-page/sp-plugin-backend-settings.php (deleted)
-
includes/settings-page/sp-plugin-favicon-settings.php (moved) (moved from all-in-one-favicon/trunk/includes/settings-page/sp-plugin-frontend-settings.php) (2 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
all-in-one-favicon/trunk/all-in-one-favicon.php
r626521 r627435 97 97 98 98 if (is_admin()) { 99 //mapping of favicon types to translatable Strings 100 $this->aioFaviconFrontendMap = array( 101 'frontendICO' => 'ICO', 102 'frontendGIF' => 'GIF', 103 'frontendPNG' => 'PNG', 104 'frontendApple' => 'Apple Touch Icon' 105 ); 106 107 //mapping of favicon types to translatable Strings 108 $this->aioFaviconBackendMap = array( 109 'backendICO' => 'ICO', 110 'backendGIF' => 'GIF', 111 'backendPNG' => 'PNG', 112 'backendApple' => 'Apple Touch Icon' 113 ); 114 99 115 $donationLoader = new AIOFaviconDonationLoader(); 100 new AioFaviconBackend($this->aioFaviconSettings, $this->aioFaviconDefaultSettings(),$donationLoader); 116 $backend = new AioFaviconBackend($this->aioFaviconSettings, 117 $this->aioFaviconDefaultSettings(), 118 $donationLoader, 119 $this->aioFaviconFrontendMap, 120 $this->aioFaviconBackendMap); 121 $backend->init(); 101 122 } 102 123 else { 103 new AioFaviconFrontend($this->aioFaviconSettings); 124 $frontend = new AioFaviconFrontend($this->aioFaviconSettings); 125 $frontend->init(); 104 126 } 105 127 -
all-in-one-favicon/trunk/includes/aio-favicon-backend.php
r626519 r627435 25 25 * @param array $aioFaviconDefaultSettings default plugin settings 26 26 * @param AIOFaviconDonationLoader $donationLoader the donationloader 27 * @param array $faviconFrontendMap mapping of favicon types to translatable Strings 28 * @param array $faviconBackendMap mapping of favicon types to translatable Strings 27 29 * 28 30 * @return void 29 31 */ 30 32 //public static function AioFaviconBackend($aioFaviconSettings) { 31 function AioFaviconBackend($aioFaviconSettings, $aioFaviconDefaultSettings, $donationLoader) { 33 function AioFaviconBackend($aioFaviconSettings, $aioFaviconDefaultSettings, $donationLoader, 34 $faviconFrontendMap, $faviconBackendMap) { 32 35 33 36 $this->aioFaviconSettings = $aioFaviconSettings; 34 37 $this->aioFaviconDefaultSettings = $aioFaviconDefaultSettings; 35 38 $this->donationLoader = $donationLoader; 36 37 39 $this->faviconRenderHelper = new FaviconRenderHelper($this->aioFaviconSettings,AIOFAVICON_BACKEND); 40 $this->faviconFrontendMap = $faviconFrontendMap; 41 $this->faviconBackendMap = $faviconBackendMap; 42 $this->faviconMap = array_merge($faviconFrontendMap,$faviconBackendMap); 43 } 44 45 // AioFaviconBackend() 46 47 48 /** 49 * Initialize 50 * 51 * @since 4.0 52 * @access public 53 * @author Arne Franken 54 * 55 * @return void 56 */ 57 //public function init() { 58 function init() { 38 59 add_action('admin_head', array(& $this->faviconRenderHelper, 'renderFavicons')); 39 60 … … 46 67 //only load JavaScript if we are on this plugin's settingspage 47 68 if (isset($_GET['page']) && $_GET['page'] == AIOFAVICON_PLUGIN_BASENAME) { 48 add_action('admin_enqueue_scripts', array(& $ donationLoader, 'registerDonationJavaScript'));69 add_action('admin_enqueue_scripts', array(& $this->donationLoader, 'registerDonationJavaScript')); 49 70 add_action('admin_enqueue_scripts', array(& $this, 'registerAdminScripts')); 50 71 } 51 72 } 52 73 53 // AioFaviconBackend()74 //init() 54 75 55 76 … … 67 88 function registerAdminScripts() { 68 89 $backendJavaScriptArray = array(); 90 69 91 if (!empty($this->aioFaviconSettings)) { 70 92 foreach ((array)$this->aioFaviconSettings as $type => $url) { … … 173 195 $this->aioFaviconSettings = wp_parse_args($usersettings, wp_parse_args((array)get_option(AIOFAVICON_SETTINGSNAME), $defaultArray)); 174 196 197 //don't show link in meta box by default any more. 175 198 if (!isset($usersettings['removeLinkFromMetaBox'])) { 176 199 $this->aioFaviconSettings['removeLinkFromMetaBox'] = false; … … 196 219 } 197 220 198 //$debugger->dieWithVariable($_POST);199 200 221 $this->updateSettingsInDatabase(); 201 222 $referrer = str_replace(array('&aioFaviconUpdateSettings', '&aioFaviconDeleteSettings'), '', $_POST['_wp_http_referer']); … … 222 243 //cross check the given referer for nonce set in delete settings form 223 244 check_admin_referer('aio-favicon-delete_settings-form'); 245 246 foreach($this->faviconMap as $key => $value) { 247 $this->deleteFile($key); 248 } 249 224 250 $this->deleteSettingsFromDatabase(); 225 } else { 251 252 } 253 else { 226 254 wp_die(sprintf(__('Did not delete %1$s settings. Either you dont have the nececssary rights or you didnt check the checkbox.', AIOFAVICON_TEXTDOMAIN), AIOFAVICON_NAME)); 227 255 } … … 274 302 $regex = '#' . $uploads['baseurl'] . '/(.*)#i'; 275 303 preg_match($regex, $url, $relativePath); 304 276 305 if (count($relativePath) > 1) { 277 306 $pathToFile = $uploads['basedir'] . '/' . $relativePath[1]; … … 360 389 $response = wp_remote_request($url, $options); 361 390 362 if (is_wp_error($response)) 391 if (is_wp_error($response)) { 363 392 return false; 364 365 if (200 != wp_remote_retrieve_response_code($response)) 393 } 394 395 if (200 != wp_remote_retrieve_response_code($response)) { 366 396 return false; 397 } 367 398 368 399 return wp_remote_retrieve_body($response); … … 388 419 $currentLocation .= ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? "s" : "") . "://"; 389 420 $currentLocation .= $_SERVER['SERVER_NAME']; 421 390 422 if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { 423 391 424 if ($_SERVER['SERVER_PORT'] != '443') { 392 425 $currentLocation .= ":" . $_SERVER['SERVER_PORT']; … … 394 427 } 395 428 else { 429 396 430 if ($_SERVER['SERVER_PORT'] != '80') { 397 431 $currentLocation .= ":" . $_SERVER['SERVER_PORT']; 398 432 } 399 433 } 434 400 435 $currentLocation .= $_SERVER['REQUEST_URI']; 401 436 echo $currentLocation; -
all-in-one-favicon/trunk/includes/aio-favicon-frontend.php
r626519 r627435 28 28 29 29 $this->aioFaviconSettings = $aioFaviconSettings; 30 $this->faviconRenderHelper = new FaviconRenderHelper($this->aioFaviconSettings,AIOFAVICON_FRONTEND); 31 } 30 32 31 $this->faviconRenderHelper = new FaviconRenderHelper($this->aioFaviconSettings,AIOFAVICON_FRONTEND); 33 // AioFaviconFrontend() 34 35 /** 36 * Initialize 37 * 38 * @since 4.0 39 * @access public 40 * @author Arne Franken 41 * 42 * @return void 43 */ 44 //public function init() { 45 function init() { 32 46 add_action('wp_head', array(& $this->faviconRenderHelper, 'renderFavicons')); 33 47 … … 36 50 add_action('wp_meta', array(& $this, 'renderMetaLink')); 37 51 } 38 39 52 } 40 53 41 // AioFaviconFrontend()54 //init() 42 55 43 56 /** -
all-in-one-favicon/trunk/includes/settings-page/sp-left-column.php
r626518 r627435 16 16 <div id="poststuff"> 17 17 <?php 18 require_once 'sp-plugin-frontend-settings.php'; 19 require_once 'sp-plugin-backend-settings.php'; 18 19 //TODO: still not ideal - since all settings page files are just "HTML templates" there is currently no clean way to handle DRY. 20 21 //set values for frontend favicon-settings-box 22 $this->faviconMap = $this->faviconFrontendMap; 23 $this->identifier = AIOFAVICON_FRONTEND; 24 $this->translatedIdentifier = __('Frontend', AIOFAVICON_TEXTDOMAIN); 25 require 'sp-plugin-favicon-settings.php'; 26 27 //set values for backend favicon-settings-box 28 $this->faviconMap = $this->faviconBackendMap; 29 $this->identifier = AIOFAVICON_BACKEND; 30 $this->translatedIdentifier = __('Backend', AIOFAVICON_TEXTDOMAIN); 31 require 'sp-plugin-favicon-settings.php'; 32 20 33 require_once 'sp-plugin-meta-settings.php'; 21 34 ?> -
all-in-one-favicon/trunk/includes/settings-page/sp-plugin-favicon-settings.php
r627007 r627435 10 10 */ 11 11 ?> 12 <div id="aio-favicon- frontend-settings" class="postbox">13 <h3 id=" frontend-settings"><?php _e('Frontend', AIOFAVICON_TEXTDOMAIN); echo " "; _e('Settings', AIOFAVICON_TEXTDOMAIN); ?></h3>12 <div id="aio-favicon-<?php echo $this->identifier ?>-settings" class="postbox"> 13 <h3 id="<?php echo $this->identifier ?>-settings"><?php echo $this->translatedIdentifier; echo " "; _e('Settings', AIOFAVICON_TEXTDOMAIN); ?></h3> 14 14 15 15 <div class="inside"> 16 16 <table class="form-table"> 17 17 <?php 18 // The icons that we can set.19 $faviconMap = array(20 'frontendICO' => 'ICO',21 'frontendPNG' => 'PNG',22 'frontendGIF' => 'GIF',23 'frontendApple' => 'Apple Touch Icon');24 25 18 // Loop over this list of icons. 26 foreach ($ faviconMap as $iconName => $iconType) { ?>19 foreach ($this->faviconMap as $iconName => $iconType) { ?> 27 20 <tr> 28 21 <th scope="row"> 29 <label for="<?php echo AIOFAVICON_SETTINGSNAME .'-'. $iconName ?>"><?php printf(__('%1$s '.$iconType, AIOFAVICON_TEXTDOMAIN), __('Frontend', AIOFAVICON_TEXTDOMAIN)); ?>:</label>22 <label for="<?php echo AIOFAVICON_SETTINGSNAME .'-'. $iconName ?>"><?php printf(__('%1$s '.$iconType, AIOFAVICON_TEXTDOMAIN), $this->translatedIdentifier); ?>:</label> 30 23 </th> 31 24 <td width="32"> … … 37 30 <input id="<?php echo AIOFAVICON_SETTINGSNAME .'-'. $iconName ?>-button" type="button" name="<?php echo $iconName ?>-button" class="button-secondary" value="<?php _e('Upload') ?>" /> 38 31 <br /> 32 <?php //only display 33 if(!empty($this->aioFaviconSettings[$iconName])) { ?> 39 34 <input type="checkbox" name="delete-<?php echo $iconName ?>"/><?php _e('Check box to delete favicon.',AIOFAVICON_TEXTDOMAIN) ?> 35 <?php } ?> 40 36 </td> 41 37 </tr> -
all-in-one-favicon/trunk/readme.txt
r627007 r627435 97 97 * NEW: Turkish translation by Selçuk Yahşi 98 98 * CHANGE: Eddy Ernesto Ríos updated the Spanish translation 99 99 * CHANGE: deleting all plugin settings now also deleted uploaded favicons 100 * CHANGE: option "delete favicon" is only displayed if a favicon was already uploaded 100 101 101 102
Note: See TracChangeset
for help on using the changeset viewer.