Edit File by line
/home/barbar84/www/wp-inclu...
File: functions.php
*/
[5500] Fix | Delete
function wp_guess_url() {
[5501] Fix | Delete
if ( defined( 'WP_SITEURL' ) && '' !== WP_SITEURL ) {
[5502] Fix | Delete
$url = WP_SITEURL;
[5503] Fix | Delete
} else {
[5504] Fix | Delete
$abspath_fix = str_replace( '\\', '/', ABSPATH );
[5505] Fix | Delete
$script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
[5506] Fix | Delete
[5507] Fix | Delete
// The request is for the admin.
[5508] Fix | Delete
if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
[5509] Fix | Delete
$path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
[5510] Fix | Delete
[5511] Fix | Delete
// The request is for a file in ABSPATH.
[5512] Fix | Delete
} elseif ( $script_filename_dir . '/' === $abspath_fix ) {
[5513] Fix | Delete
// Strip off any file/query params in the path.
[5514] Fix | Delete
$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] );
[5515] Fix | Delete
[5516] Fix | Delete
} else {
[5517] Fix | Delete
if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {
[5518] Fix | Delete
// Request is hitting a file inside ABSPATH.
[5519] Fix | Delete
$directory = str_replace( ABSPATH, '', $script_filename_dir );
[5520] Fix | Delete
// Strip off the subdirectory, and any file/query params.
[5521] Fix | Delete
$path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '', $_SERVER['REQUEST_URI'] );
[5522] Fix | Delete
} elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
[5523] Fix | Delete
// Request is hitting a file above ABSPATH.
[5524] Fix | Delete
$subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
[5525] Fix | Delete
// Strip off any file/query params from the path, appending the subdirectory to the installation.
[5526] Fix | Delete
$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['REQUEST_URI'] ) . $subdirectory;
[5527] Fix | Delete
} else {
[5528] Fix | Delete
$path = $_SERVER['REQUEST_URI'];
[5529] Fix | Delete
}
[5530] Fix | Delete
}
[5531] Fix | Delete
[5532] Fix | Delete
$schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet.
[5533] Fix | Delete
$url = $schema . $_SERVER['HTTP_HOST'] . $path;
[5534] Fix | Delete
}
[5535] Fix | Delete
[5536] Fix | Delete
return rtrim( $url, '/' );
[5537] Fix | Delete
}
[5538] Fix | Delete
[5539] Fix | Delete
/**
[5540] Fix | Delete
* Temporarily suspend cache additions.
[5541] Fix | Delete
*
[5542] Fix | Delete
* Stops more data being added to the cache, but still allows cache retrieval.
[5543] Fix | Delete
* This is useful for actions, such as imports, when a lot of data would otherwise
[5544] Fix | Delete
* be almost uselessly added to the cache.
[5545] Fix | Delete
*
[5546] Fix | Delete
* Suspension lasts for a single page load at most. Remember to call this
[5547] Fix | Delete
* function again if you wish to re-enable cache adds earlier.
[5548] Fix | Delete
*
[5549] Fix | Delete
* @since 3.3.0
[5550] Fix | Delete
*
[5551] Fix | Delete
* @param bool $suspend Optional. Suspends additions if true, re-enables them if false.
[5552] Fix | Delete
* @return bool The current suspend setting
[5553] Fix | Delete
*/
[5554] Fix | Delete
function wp_suspend_cache_addition( $suspend = null ) {
[5555] Fix | Delete
static $_suspend = false;
[5556] Fix | Delete
[5557] Fix | Delete
if ( is_bool( $suspend ) ) {
[5558] Fix | Delete
$_suspend = $suspend;
[5559] Fix | Delete
}
[5560] Fix | Delete
[5561] Fix | Delete
return $_suspend;
[5562] Fix | Delete
}
[5563] Fix | Delete
[5564] Fix | Delete
/**
[5565] Fix | Delete
* Suspend cache invalidation.
[5566] Fix | Delete
*
[5567] Fix | Delete
* Turns cache invalidation on and off. Useful during imports where you don't want to do
[5568] Fix | Delete
* invalidations every time a post is inserted. Callers must be sure that what they are
[5569] Fix | Delete
* doing won't lead to an inconsistent cache when invalidation is suspended.
[5570] Fix | Delete
*
[5571] Fix | Delete
* @since 2.7.0
[5572] Fix | Delete
*
[5573] Fix | Delete
* @global bool $_wp_suspend_cache_invalidation
[5574] Fix | Delete
*
[5575] Fix | Delete
* @param bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true.
[5576] Fix | Delete
* @return bool The current suspend setting.
[5577] Fix | Delete
*/
[5578] Fix | Delete
function wp_suspend_cache_invalidation( $suspend = true ) {
[5579] Fix | Delete
global $_wp_suspend_cache_invalidation;
[5580] Fix | Delete
[5581] Fix | Delete
$current_suspend = $_wp_suspend_cache_invalidation;
[5582] Fix | Delete
$_wp_suspend_cache_invalidation = $suspend;
[5583] Fix | Delete
return $current_suspend;
[5584] Fix | Delete
}
[5585] Fix | Delete
[5586] Fix | Delete
/**
[5587] Fix | Delete
* Determine whether a site is the main site of the current network.
[5588] Fix | Delete
*
[5589] Fix | Delete
* @since 3.0.0
[5590] Fix | Delete
* @since 4.9.0 The `$network_id` parameter was added.
[5591] Fix | Delete
*
[5592] Fix | Delete
* @param int $site_id Optional. Site ID to test. Defaults to current site.
[5593] Fix | Delete
* @param int $network_id Optional. Network ID of the network to check for.
[5594] Fix | Delete
* Defaults to current network.
[5595] Fix | Delete
* @return bool True if $site_id is the main site of the network, or if not
[5596] Fix | Delete
* running Multisite.
[5597] Fix | Delete
*/
[5598] Fix | Delete
function is_main_site( $site_id = null, $network_id = null ) {
[5599] Fix | Delete
if ( ! is_multisite() ) {
[5600] Fix | Delete
return true;
[5601] Fix | Delete
}
[5602] Fix | Delete
[5603] Fix | Delete
if ( ! $site_id ) {
[5604] Fix | Delete
$site_id = get_current_blog_id();
[5605] Fix | Delete
}
[5606] Fix | Delete
[5607] Fix | Delete
$site_id = (int) $site_id;
[5608] Fix | Delete
[5609] Fix | Delete
return get_main_site_id( $network_id ) === $site_id;
[5610] Fix | Delete
}
[5611] Fix | Delete
[5612] Fix | Delete
/**
[5613] Fix | Delete
* Gets the main site ID.
[5614] Fix | Delete
*
[5615] Fix | Delete
* @since 4.9.0
[5616] Fix | Delete
*
[5617] Fix | Delete
* @param int $network_id Optional. The ID of the network for which to get the main site.
[5618] Fix | Delete
* Defaults to the current network.
[5619] Fix | Delete
* @return int The ID of the main site.
[5620] Fix | Delete
*/
[5621] Fix | Delete
function get_main_site_id( $network_id = null ) {
[5622] Fix | Delete
if ( ! is_multisite() ) {
[5623] Fix | Delete
return get_current_blog_id();
[5624] Fix | Delete
}
[5625] Fix | Delete
[5626] Fix | Delete
$network = get_network( $network_id );
[5627] Fix | Delete
if ( ! $network ) {
[5628] Fix | Delete
return 0;
[5629] Fix | Delete
}
[5630] Fix | Delete
[5631] Fix | Delete
return $network->site_id;
[5632] Fix | Delete
}
[5633] Fix | Delete
[5634] Fix | Delete
/**
[5635] Fix | Delete
* Determine whether a network is the main network of the Multisite installation.
[5636] Fix | Delete
*
[5637] Fix | Delete
* @since 3.7.0
[5638] Fix | Delete
*
[5639] Fix | Delete
* @param int $network_id Optional. Network ID to test. Defaults to current network.
[5640] Fix | Delete
* @return bool True if $network_id is the main network, or if not running Multisite.
[5641] Fix | Delete
*/
[5642] Fix | Delete
function is_main_network( $network_id = null ) {
[5643] Fix | Delete
if ( ! is_multisite() ) {
[5644] Fix | Delete
return true;
[5645] Fix | Delete
}
[5646] Fix | Delete
[5647] Fix | Delete
if ( null === $network_id ) {
[5648] Fix | Delete
$network_id = get_current_network_id();
[5649] Fix | Delete
}
[5650] Fix | Delete
[5651] Fix | Delete
$network_id = (int) $network_id;
[5652] Fix | Delete
[5653] Fix | Delete
return ( get_main_network_id() === $network_id );
[5654] Fix | Delete
}
[5655] Fix | Delete
[5656] Fix | Delete
/**
[5657] Fix | Delete
* Get the main network ID.
[5658] Fix | Delete
*
[5659] Fix | Delete
* @since 4.3.0
[5660] Fix | Delete
*
[5661] Fix | Delete
* @return int The ID of the main network.
[5662] Fix | Delete
*/
[5663] Fix | Delete
function get_main_network_id() {
[5664] Fix | Delete
if ( ! is_multisite() ) {
[5665] Fix | Delete
return 1;
[5666] Fix | Delete
}
[5667] Fix | Delete
[5668] Fix | Delete
$current_network = get_network();
[5669] Fix | Delete
[5670] Fix | Delete
if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
[5671] Fix | Delete
$main_network_id = PRIMARY_NETWORK_ID;
[5672] Fix | Delete
} elseif ( isset( $current_network->id ) && 1 === (int) $current_network->id ) {
[5673] Fix | Delete
// If the current network has an ID of 1, assume it is the main network.
[5674] Fix | Delete
$main_network_id = 1;
[5675] Fix | Delete
} else {
[5676] Fix | Delete
$_networks = get_networks(
[5677] Fix | Delete
array(
[5678] Fix | Delete
'fields' => 'ids',
[5679] Fix | Delete
'number' => 1,
[5680] Fix | Delete
)
[5681] Fix | Delete
);
[5682] Fix | Delete
$main_network_id = array_shift( $_networks );
[5683] Fix | Delete
}
[5684] Fix | Delete
[5685] Fix | Delete
/**
[5686] Fix | Delete
* Filters the main network ID.
[5687] Fix | Delete
*
[5688] Fix | Delete
* @since 4.3.0
[5689] Fix | Delete
*
[5690] Fix | Delete
* @param int $main_network_id The ID of the main network.
[5691] Fix | Delete
*/
[5692] Fix | Delete
return (int) apply_filters( 'get_main_network_id', $main_network_id );
[5693] Fix | Delete
}
[5694] Fix | Delete
[5695] Fix | Delete
/**
[5696] Fix | Delete
* Determine whether global terms are enabled.
[5697] Fix | Delete
*
[5698] Fix | Delete
* @since 3.0.0
[5699] Fix | Delete
*
[5700] Fix | Delete
* @return bool True if multisite and global terms enabled.
[5701] Fix | Delete
*/
[5702] Fix | Delete
function global_terms_enabled() {
[5703] Fix | Delete
if ( ! is_multisite() ) {
[5704] Fix | Delete
return false;
[5705] Fix | Delete
}
[5706] Fix | Delete
[5707] Fix | Delete
static $global_terms = null;
[5708] Fix | Delete
if ( is_null( $global_terms ) ) {
[5709] Fix | Delete
[5710] Fix | Delete
/**
[5711] Fix | Delete
* Filters whether global terms are enabled.
[5712] Fix | Delete
*
[5713] Fix | Delete
* Returning a non-null value from the filter will effectively short-circuit the function
[5714] Fix | Delete
* and return the value of the 'global_terms_enabled' site option instead.
[5715] Fix | Delete
*
[5716] Fix | Delete
* @since 3.0.0
[5717] Fix | Delete
*
[5718] Fix | Delete
* @param null $enabled Whether global terms are enabled.
[5719] Fix | Delete
*/
[5720] Fix | Delete
$filter = apply_filters( 'global_terms_enabled', null );
[5721] Fix | Delete
if ( ! is_null( $filter ) ) {
[5722] Fix | Delete
$global_terms = (bool) $filter;
[5723] Fix | Delete
} else {
[5724] Fix | Delete
$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
[5725] Fix | Delete
}
[5726] Fix | Delete
}
[5727] Fix | Delete
return $global_terms;
[5728] Fix | Delete
}
[5729] Fix | Delete
[5730] Fix | Delete
/**
[5731] Fix | Delete
* Determines whether site meta is enabled.
[5732] Fix | Delete
*
[5733] Fix | Delete
* This function checks whether the 'blogmeta' database table exists. The result is saved as
[5734] Fix | Delete
* a setting for the main network, making it essentially a global setting. Subsequent requests
[5735] Fix | Delete
* will refer to this setting instead of running the query.
[5736] Fix | Delete
*
[5737] Fix | Delete
* @since 5.1.0
[5738] Fix | Delete
*
[5739] Fix | Delete
* @global wpdb $wpdb WordPress database abstraction object.
[5740] Fix | Delete
*
[5741] Fix | Delete
* @return bool True if site meta is supported, false otherwise.
[5742] Fix | Delete
*/
[5743] Fix | Delete
function is_site_meta_supported() {
[5744] Fix | Delete
global $wpdb;
[5745] Fix | Delete
[5746] Fix | Delete
if ( ! is_multisite() ) {
[5747] Fix | Delete
return false;
[5748] Fix | Delete
}
[5749] Fix | Delete
[5750] Fix | Delete
$network_id = get_main_network_id();
[5751] Fix | Delete
[5752] Fix | Delete
$supported = get_network_option( $network_id, 'site_meta_supported', false );
[5753] Fix | Delete
if ( false === $supported ) {
[5754] Fix | Delete
$supported = $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->blogmeta}'" ) ? 1 : 0;
[5755] Fix | Delete
[5756] Fix | Delete
update_network_option( $network_id, 'site_meta_supported', $supported );
[5757] Fix | Delete
}
[5758] Fix | Delete
[5759] Fix | Delete
return (bool) $supported;
[5760] Fix | Delete
}
[5761] Fix | Delete
[5762] Fix | Delete
/**
[5763] Fix | Delete
* gmt_offset modification for smart timezone handling.
[5764] Fix | Delete
*
[5765] Fix | Delete
* Overrides the gmt_offset option if we have a timezone_string available.
[5766] Fix | Delete
*
[5767] Fix | Delete
* @since 2.8.0
[5768] Fix | Delete
*
[5769] Fix | Delete
* @return float|false Timezone GMT offset, false otherwise.
[5770] Fix | Delete
*/
[5771] Fix | Delete
function wp_timezone_override_offset() {
[5772] Fix | Delete
$timezone_string = get_option( 'timezone_string' );
[5773] Fix | Delete
if ( ! $timezone_string ) {
[5774] Fix | Delete
return false;
[5775] Fix | Delete
}
[5776] Fix | Delete
[5777] Fix | Delete
$timezone_object = timezone_open( $timezone_string );
[5778] Fix | Delete
$datetime_object = date_create();
[5779] Fix | Delete
if ( false === $timezone_object || false === $datetime_object ) {
[5780] Fix | Delete
return false;
[5781] Fix | Delete
}
[5782] Fix | Delete
return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
[5783] Fix | Delete
}
[5784] Fix | Delete
[5785] Fix | Delete
/**
[5786] Fix | Delete
* Sort-helper for timezones.
[5787] Fix | Delete
*
[5788] Fix | Delete
* @since 2.9.0
[5789] Fix | Delete
* @access private
[5790] Fix | Delete
*
[5791] Fix | Delete
* @param array $a
[5792] Fix | Delete
* @param array $b
[5793] Fix | Delete
* @return int
[5794] Fix | Delete
*/
[5795] Fix | Delete
function _wp_timezone_choice_usort_callback( $a, $b ) {
[5796] Fix | Delete
// Don't use translated versions of Etc.
[5797] Fix | Delete
if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
[5798] Fix | Delete
// Make the order of these more like the old dropdown.
[5799] Fix | Delete
if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
[5800] Fix | Delete
return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
[5801] Fix | Delete
}
[5802] Fix | Delete
if ( 'UTC' === $a['city'] ) {
[5803] Fix | Delete
if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) {
[5804] Fix | Delete
return 1;
[5805] Fix | Delete
}
[5806] Fix | Delete
return -1;
[5807] Fix | Delete
}
[5808] Fix | Delete
if ( 'UTC' === $b['city'] ) {
[5809] Fix | Delete
if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) {
[5810] Fix | Delete
return -1;
[5811] Fix | Delete
}
[5812] Fix | Delete
return 1;
[5813] Fix | Delete
}
[5814] Fix | Delete
return strnatcasecmp( $a['city'], $b['city'] );
[5815] Fix | Delete
}
[5816] Fix | Delete
if ( $a['t_continent'] == $b['t_continent'] ) {
[5817] Fix | Delete
if ( $a['t_city'] == $b['t_city'] ) {
[5818] Fix | Delete
return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
[5819] Fix | Delete
}
[5820] Fix | Delete
return strnatcasecmp( $a['t_city'], $b['t_city'] );
[5821] Fix | Delete
} else {
[5822] Fix | Delete
// Force Etc to the bottom of the list.
[5823] Fix | Delete
if ( 'Etc' === $a['continent'] ) {
[5824] Fix | Delete
return 1;
[5825] Fix | Delete
}
[5826] Fix | Delete
if ( 'Etc' === $b['continent'] ) {
[5827] Fix | Delete
return -1;
[5828] Fix | Delete
}
[5829] Fix | Delete
return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
[5830] Fix | Delete
}
[5831] Fix | Delete
}
[5832] Fix | Delete
[5833] Fix | Delete
/**
[5834] Fix | Delete
* Gives a nicely-formatted list of timezone strings.
[5835] Fix | Delete
*
[5836] Fix | Delete
* @since 2.9.0
[5837] Fix | Delete
* @since 4.7.0 Added the `$locale` parameter.
[5838] Fix | Delete
*
[5839] Fix | Delete
* @param string $selected_zone Selected timezone.
[5840] Fix | Delete
* @param string $locale Optional. Locale to load the timezones in. Default current site locale.
[5841] Fix | Delete
* @return string
[5842] Fix | Delete
*/
[5843] Fix | Delete
function wp_timezone_choice( $selected_zone, $locale = null ) {
[5844] Fix | Delete
static $mo_loaded = false, $locale_loaded = null;
[5845] Fix | Delete
[5846] Fix | Delete
$continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific' );
[5847] Fix | Delete
[5848] Fix | Delete
// Load translations for continents and cities.
[5849] Fix | Delete
if ( ! $mo_loaded || $locale !== $locale_loaded ) {
[5850] Fix | Delete
$locale_loaded = $locale ? $locale : get_locale();
[5851] Fix | Delete
$mofile = WP_LANG_DIR . '/continents-cities-' . $locale_loaded . '.mo';
[5852] Fix | Delete
unload_textdomain( 'continents-cities' );
[5853] Fix | Delete
load_textdomain( 'continents-cities', $mofile );
[5854] Fix | Delete
$mo_loaded = true;
[5855] Fix | Delete
}
[5856] Fix | Delete
[5857] Fix | Delete
$zonen = array();
[5858] Fix | Delete
foreach ( timezone_identifiers_list() as $zone ) {
[5859] Fix | Delete
$zone = explode( '/', $zone );
[5860] Fix | Delete
if ( ! in_array( $zone[0], $continents, true ) ) {
[5861] Fix | Delete
continue;
[5862] Fix | Delete
}
[5863] Fix | Delete
[5864] Fix | Delete
// This determines what gets set and translated - we don't translate Etc/* strings here, they are done later.
[5865] Fix | Delete
$exists = array(
[5866] Fix | Delete
0 => ( isset( $zone[0] ) && $zone[0] ),
[5867] Fix | Delete
1 => ( isset( $zone[1] ) && $zone[1] ),
[5868] Fix | Delete
2 => ( isset( $zone[2] ) && $zone[2] ),
[5869] Fix | Delete
);
[5870] Fix | Delete
$exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
[5871] Fix | Delete
$exists[4] = ( $exists[1] && $exists[3] );
[5872] Fix | Delete
$exists[5] = ( $exists[2] && $exists[3] );
[5873] Fix | Delete
[5874] Fix | Delete
// phpcs:disable WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
[5875] Fix | Delete
$zonen[] = array(
[5876] Fix | Delete
'continent' => ( $exists[0] ? $zone[0] : '' ),
[5877] Fix | Delete
'city' => ( $exists[1] ? $zone[1] : '' ),
[5878] Fix | Delete
'subcity' => ( $exists[2] ? $zone[2] : '' ),
[5879] Fix | Delete
't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ),
[5880] Fix | Delete
't_city' => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ),
[5881] Fix | Delete
't_subcity' => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' ),
[5882] Fix | Delete
);
[5883] Fix | Delete
// phpcs:enable
[5884] Fix | Delete
}
[5885] Fix | Delete
usort( $zonen, '_wp_timezone_choice_usort_callback' );
[5886] Fix | Delete
[5887] Fix | Delete
$structure = array();
[5888] Fix | Delete
[5889] Fix | Delete
if ( empty( $selected_zone ) ) {
[5890] Fix | Delete
$structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
[5891] Fix | Delete
}
[5892] Fix | Delete
[5893] Fix | Delete
foreach ( $zonen as $key => $zone ) {
[5894] Fix | Delete
// Build value in an array to join later.
[5895] Fix | Delete
$value = array( $zone['continent'] );
[5896] Fix | Delete
[5897] Fix | Delete
if ( empty( $zone['city'] ) ) {
[5898] Fix | Delete
// It's at the continent level (generally won't happen).
[5899] Fix | Delete
$display = $zone['t_continent'];
[5900] Fix | Delete
} else {
[5901] Fix | Delete
// It's inside a continent group.
[5902] Fix | Delete
[5903] Fix | Delete
// Continent optgroup.
[5904] Fix | Delete
if ( ! isset( $zonen[ $key - 1 ] ) || $zonen[ $key - 1 ]['continent'] !== $zone['continent'] ) {
[5905] Fix | Delete
$label = $zone['t_continent'];
[5906] Fix | Delete
$structure[] = '<optgroup label="' . esc_attr( $label ) . '">';
[5907] Fix | Delete
}
[5908] Fix | Delete
[5909] Fix | Delete
// Add the city to the value.
[5910] Fix | Delete
$value[] = $zone['city'];
[5911] Fix | Delete
[5912] Fix | Delete
$display = $zone['t_city'];
[5913] Fix | Delete
if ( ! empty( $zone['subcity'] ) ) {
[5914] Fix | Delete
// Add the subcity to the value.
[5915] Fix | Delete
$value[] = $zone['subcity'];
[5916] Fix | Delete
$display .= ' - ' . $zone['t_subcity'];
[5917] Fix | Delete
}
[5918] Fix | Delete
}
[5919] Fix | Delete
[5920] Fix | Delete
// Build the value.
[5921] Fix | Delete
$value = implode( '/', $value );
[5922] Fix | Delete
$selected = '';
[5923] Fix | Delete
if ( $value === $selected_zone ) {
[5924] Fix | Delete
$selected = 'selected="selected" ';
[5925] Fix | Delete
}
[5926] Fix | Delete
$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . '</option>';
[5927] Fix | Delete
[5928] Fix | Delete
// Close continent optgroup.
[5929] Fix | Delete
if ( ! empty( $zone['city'] ) && ( ! isset( $zonen[ $key + 1 ] ) || ( isset( $zonen[ $key + 1 ] ) && $zonen[ $key + 1 ]['continent'] !== $zone['continent'] ) ) ) {
[5930] Fix | Delete
$structure[] = '</optgroup>';
[5931] Fix | Delete
}
[5932] Fix | Delete
}
[5933] Fix | Delete
[5934] Fix | Delete
// Do UTC.
[5935] Fix | Delete
$structure[] = '<optgroup label="' . esc_attr__( 'UTC' ) . '">';
[5936] Fix | Delete
$selected = '';
[5937] Fix | Delete
if ( 'UTC' === $selected_zone ) {
[5938] Fix | Delete
$selected = 'selected="selected" ';
[5939] Fix | Delete
}
[5940] Fix | Delete
$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __( 'UTC' ) . '</option>';
[5941] Fix | Delete
$structure[] = '</optgroup>';
[5942] Fix | Delete
[5943] Fix | Delete
// Do manual UTC offsets.
[5944] Fix | Delete
$structure[] = '<optgroup label="' . esc_attr__( 'Manual Offsets' ) . '">';
[5945] Fix | Delete
$offset_range = array(
[5946] Fix | Delete
-12,
[5947] Fix | Delete
-11.5,
[5948] Fix | Delete
-11,
[5949] Fix | Delete
-10.5,
[5950] Fix | Delete
-10,
[5951] Fix | Delete
-9.5,
[5952] Fix | Delete
-9,
[5953] Fix | Delete
-8.5,
[5954] Fix | Delete
-8,
[5955] Fix | Delete
-7.5,
[5956] Fix | Delete
-7,
[5957] Fix | Delete
-6.5,
[5958] Fix | Delete
-6,
[5959] Fix | Delete
-5.5,
[5960] Fix | Delete
-5,
[5961] Fix | Delete
-4.5,
[5962] Fix | Delete
-4,
[5963] Fix | Delete
-3.5,
[5964] Fix | Delete
-3,
[5965] Fix | Delete
-2.5,
[5966] Fix | Delete
-2,
[5967] Fix | Delete
-1.5,
[5968] Fix | Delete
-1,
[5969] Fix | Delete
-0.5,
[5970] Fix | Delete
0,
[5971] Fix | Delete
0.5,
[5972] Fix | Delete
1,
[5973] Fix | Delete
1.5,
[5974] Fix | Delete
2,
[5975] Fix | Delete
2.5,
[5976] Fix | Delete
3,
[5977] Fix | Delete
3.5,
[5978] Fix | Delete
4,
[5979] Fix | Delete
4.5,
[5980] Fix | Delete
5,
[5981] Fix | Delete
5.5,
[5982] Fix | Delete
5.75,
[5983] Fix | Delete
6,
[5984] Fix | Delete
6.5,
[5985] Fix | Delete
7,
[5986] Fix | Delete
7.5,
[5987] Fix | Delete
8,
[5988] Fix | Delete
8.5,
[5989] Fix | Delete
8.75,
[5990] Fix | Delete
9,
[5991] Fix | Delete
9.5,
[5992] Fix | Delete
10,
[5993] Fix | Delete
10.5,
[5994] Fix | Delete
11,
[5995] Fix | Delete
11.5,
[5996] Fix | Delete
12,
[5997] Fix | Delete
12.75,
[5998] Fix | Delete
13,
[5999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function