Edit File by line
/home/barbar84/www/wp-admin/includes
File: misc.php
echo esc_html( $label );
[500] Fix | Delete
}
[501] Fix | Delete
?>
[502] Fix | Delete
</a>
[503] Fix | Delete
</li>
[504] Fix | Delete
<?php
[505] Fix | Delete
}
[506] Fix | Delete
}
[507] Fix | Delete
[508] Fix | Delete
/**
[509] Fix | Delete
* Flushes rewrite rules if siteurl, home or page_on_front changed.
[510] Fix | Delete
*
[511] Fix | Delete
* @since 2.1.0
[512] Fix | Delete
*
[513] Fix | Delete
* @param string $old_value
[514] Fix | Delete
* @param string $value
[515] Fix | Delete
*/
[516] Fix | Delete
function update_home_siteurl( $old_value, $value ) {
[517] Fix | Delete
if ( wp_installing() ) {
[518] Fix | Delete
return;
[519] Fix | Delete
}
[520] Fix | Delete
[521] Fix | Delete
if ( is_multisite() && ms_is_switched() ) {
[522] Fix | Delete
delete_option( 'rewrite_rules' );
[523] Fix | Delete
} else {
[524] Fix | Delete
flush_rewrite_rules();
[525] Fix | Delete
}
[526] Fix | Delete
}
[527] Fix | Delete
[528] Fix | Delete
[529] Fix | Delete
/**
[530] Fix | Delete
* Resets global variables based on $_GET and $_POST
[531] Fix | Delete
*
[532] Fix | Delete
* This function resets global variables based on the names passed
[533] Fix | Delete
* in the $vars array to the value of $_POST[$var] or $_GET[$var] or ''
[534] Fix | Delete
* if neither is defined.
[535] Fix | Delete
*
[536] Fix | Delete
* @since 2.0.0
[537] Fix | Delete
*
[538] Fix | Delete
* @param array $vars An array of globals to reset.
[539] Fix | Delete
*/
[540] Fix | Delete
function wp_reset_vars( $vars ) {
[541] Fix | Delete
foreach ( $vars as $var ) {
[542] Fix | Delete
if ( empty( $_POST[ $var ] ) ) {
[543] Fix | Delete
if ( empty( $_GET[ $var ] ) ) {
[544] Fix | Delete
$GLOBALS[ $var ] = '';
[545] Fix | Delete
} else {
[546] Fix | Delete
$GLOBALS[ $var ] = $_GET[ $var ];
[547] Fix | Delete
}
[548] Fix | Delete
} else {
[549] Fix | Delete
$GLOBALS[ $var ] = $_POST[ $var ];
[550] Fix | Delete
}
[551] Fix | Delete
}
[552] Fix | Delete
}
[553] Fix | Delete
[554] Fix | Delete
/**
[555] Fix | Delete
* Displays the given administration message.
[556] Fix | Delete
*
[557] Fix | Delete
* @since 2.1.0
[558] Fix | Delete
*
[559] Fix | Delete
* @param string|WP_Error $message
[560] Fix | Delete
*/
[561] Fix | Delete
function show_message( $message ) {
[562] Fix | Delete
if ( is_wp_error( $message ) ) {
[563] Fix | Delete
if ( $message->get_error_data() && is_string( $message->get_error_data() ) ) {
[564] Fix | Delete
$message = $message->get_error_message() . ': ' . $message->get_error_data();
[565] Fix | Delete
} else {
[566] Fix | Delete
$message = $message->get_error_message();
[567] Fix | Delete
}
[568] Fix | Delete
}
[569] Fix | Delete
echo "<p>$message</p>\n";
[570] Fix | Delete
wp_ob_end_flush_all();
[571] Fix | Delete
flush();
[572] Fix | Delete
}
[573] Fix | Delete
[574] Fix | Delete
/**
[575] Fix | Delete
* @since 2.8.0
[576] Fix | Delete
*
[577] Fix | Delete
* @param string $content
[578] Fix | Delete
* @return array
[579] Fix | Delete
*/
[580] Fix | Delete
function wp_doc_link_parse( $content ) {
[581] Fix | Delete
if ( ! is_string( $content ) || empty( $content ) ) {
[582] Fix | Delete
return array();
[583] Fix | Delete
}
[584] Fix | Delete
[585] Fix | Delete
if ( ! function_exists( 'token_get_all' ) ) {
[586] Fix | Delete
return array();
[587] Fix | Delete
}
[588] Fix | Delete
[589] Fix | Delete
$tokens = token_get_all( $content );
[590] Fix | Delete
$count = count( $tokens );
[591] Fix | Delete
$functions = array();
[592] Fix | Delete
$ignore_functions = array();
[593] Fix | Delete
for ( $t = 0; $t < $count - 2; $t++ ) {
[594] Fix | Delete
if ( ! is_array( $tokens[ $t ] ) ) {
[595] Fix | Delete
continue;
[596] Fix | Delete
}
[597] Fix | Delete
[598] Fix | Delete
if ( T_STRING == $tokens[ $t ][0] && ( '(' === $tokens[ $t + 1 ] || '(' === $tokens[ $t + 2 ] ) ) {
[599] Fix | Delete
// If it's a function or class defined locally, there's not going to be any docs available.
[600] Fix | Delete
if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ), true ) )
[601] Fix | Delete
|| ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] )
[602] Fix | Delete
) {
[603] Fix | Delete
$ignore_functions[] = $tokens[ $t ][1];
[604] Fix | Delete
}
[605] Fix | Delete
// Add this to our stack of unique references.
[606] Fix | Delete
$functions[] = $tokens[ $t ][1];
[607] Fix | Delete
}
[608] Fix | Delete
}
[609] Fix | Delete
[610] Fix | Delete
$functions = array_unique( $functions );
[611] Fix | Delete
sort( $functions );
[612] Fix | Delete
[613] Fix | Delete
/**
[614] Fix | Delete
* Filters the list of functions and classes to be ignored from the documentation lookup.
[615] Fix | Delete
*
[616] Fix | Delete
* @since 2.8.0
[617] Fix | Delete
*
[618] Fix | Delete
* @param string[] $ignore_functions Array of names of functions and classes to be ignored.
[619] Fix | Delete
*/
[620] Fix | Delete
$ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );
[621] Fix | Delete
[622] Fix | Delete
$ignore_functions = array_unique( $ignore_functions );
[623] Fix | Delete
[624] Fix | Delete
$out = array();
[625] Fix | Delete
foreach ( $functions as $function ) {
[626] Fix | Delete
if ( in_array( $function, $ignore_functions, true ) ) {
[627] Fix | Delete
continue;
[628] Fix | Delete
}
[629] Fix | Delete
$out[] = $function;
[630] Fix | Delete
}
[631] Fix | Delete
[632] Fix | Delete
return $out;
[633] Fix | Delete
}
[634] Fix | Delete
[635] Fix | Delete
/**
[636] Fix | Delete
* Saves option for number of rows when listing posts, pages, comments, etc.
[637] Fix | Delete
*
[638] Fix | Delete
* @since 2.8.0
[639] Fix | Delete
*/
[640] Fix | Delete
function set_screen_options() {
[641] Fix | Delete
[642] Fix | Delete
if ( isset( $_POST['wp_screen_options'] ) && is_array( $_POST['wp_screen_options'] ) ) {
[643] Fix | Delete
check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
[644] Fix | Delete
[645] Fix | Delete
$user = wp_get_current_user();
[646] Fix | Delete
if ( ! $user ) {
[647] Fix | Delete
return;
[648] Fix | Delete
}
[649] Fix | Delete
$option = $_POST['wp_screen_options']['option'];
[650] Fix | Delete
$value = $_POST['wp_screen_options']['value'];
[651] Fix | Delete
[652] Fix | Delete
if ( sanitize_key( $option ) != $option ) {
[653] Fix | Delete
return;
[654] Fix | Delete
}
[655] Fix | Delete
[656] Fix | Delete
$map_option = $option;
[657] Fix | Delete
$type = str_replace( 'edit_', '', $map_option );
[658] Fix | Delete
$type = str_replace( '_per_page', '', $type );
[659] Fix | Delete
if ( in_array( $type, get_taxonomies(), true ) ) {
[660] Fix | Delete
$map_option = 'edit_tags_per_page';
[661] Fix | Delete
} elseif ( in_array( $type, get_post_types(), true ) ) {
[662] Fix | Delete
$map_option = 'edit_per_page';
[663] Fix | Delete
} else {
[664] Fix | Delete
$option = str_replace( '-', '_', $option );
[665] Fix | Delete
}
[666] Fix | Delete
[667] Fix | Delete
switch ( $map_option ) {
[668] Fix | Delete
case 'edit_per_page':
[669] Fix | Delete
case 'users_per_page':
[670] Fix | Delete
case 'edit_comments_per_page':
[671] Fix | Delete
case 'upload_per_page':
[672] Fix | Delete
case 'edit_tags_per_page':
[673] Fix | Delete
case 'plugins_per_page':
[674] Fix | Delete
case 'export_personal_data_requests_per_page':
[675] Fix | Delete
case 'remove_personal_data_requests_per_page':
[676] Fix | Delete
// Network admin.
[677] Fix | Delete
case 'sites_network_per_page':
[678] Fix | Delete
case 'users_network_per_page':
[679] Fix | Delete
case 'site_users_network_per_page':
[680] Fix | Delete
case 'plugins_network_per_page':
[681] Fix | Delete
case 'themes_network_per_page':
[682] Fix | Delete
case 'site_themes_network_per_page':
[683] Fix | Delete
$value = (int) $value;
[684] Fix | Delete
if ( $value < 1 || $value > 999 ) {
[685] Fix | Delete
return;
[686] Fix | Delete
}
[687] Fix | Delete
break;
[688] Fix | Delete
default:
[689] Fix | Delete
$screen_option = false;
[690] Fix | Delete
[691] Fix | Delete
if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
[692] Fix | Delete
/**
[693] Fix | Delete
* Filters a screen option value before it is set.
[694] Fix | Delete
*
[695] Fix | Delete
* The filter can also be used to modify non-standard [items]_per_page
[696] Fix | Delete
* settings. See the parent function for a full list of standard options.
[697] Fix | Delete
*
[698] Fix | Delete
* Returning false from the filter will skip saving the current option.
[699] Fix | Delete
*
[700] Fix | Delete
* @since 2.8.0
[701] Fix | Delete
* @since 5.4.2 Only applied to options ending with '_page',
[702] Fix | Delete
* or the 'layout_columns' option.
[703] Fix | Delete
*
[704] Fix | Delete
* @see set_screen_options()
[705] Fix | Delete
*
[706] Fix | Delete
* @param mixed $screen_option The value to save instead of the option value.
[707] Fix | Delete
* Default false (to skip saving the current option).
[708] Fix | Delete
* @param string $option The option name.
[709] Fix | Delete
* @param int $value The option value.
[710] Fix | Delete
*/
[711] Fix | Delete
$screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
[712] Fix | Delete
}
[713] Fix | Delete
[714] Fix | Delete
/**
[715] Fix | Delete
* Filters a screen option value before it is set.
[716] Fix | Delete
*
[717] Fix | Delete
* The dynamic portion of the hook, `$option`, refers to the option name.
[718] Fix | Delete
*
[719] Fix | Delete
* Returning false from the filter will skip saving the current option.
[720] Fix | Delete
*
[721] Fix | Delete
* @since 5.4.2
[722] Fix | Delete
*
[723] Fix | Delete
* @see set_screen_options()
[724] Fix | Delete
*
[725] Fix | Delete
* @param mixed $screen_option The value to save instead of the option value.
[726] Fix | Delete
* Default false (to skip saving the current option).
[727] Fix | Delete
* @param string $option The option name.
[728] Fix | Delete
* @param int $value The option value.
[729] Fix | Delete
*/
[730] Fix | Delete
$value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
[731] Fix | Delete
[732] Fix | Delete
if ( false === $value ) {
[733] Fix | Delete
return;
[734] Fix | Delete
}
[735] Fix | Delete
break;
[736] Fix | Delete
}
[737] Fix | Delete
[738] Fix | Delete
update_user_meta( $user->ID, $option, $value );
[739] Fix | Delete
[740] Fix | Delete
$url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() );
[741] Fix | Delete
if ( isset( $_POST['mode'] ) ) {
[742] Fix | Delete
$url = add_query_arg( array( 'mode' => $_POST['mode'] ), $url );
[743] Fix | Delete
}
[744] Fix | Delete
[745] Fix | Delete
wp_safe_redirect( $url );
[746] Fix | Delete
exit;
[747] Fix | Delete
}
[748] Fix | Delete
}
[749] Fix | Delete
[750] Fix | Delete
/**
[751] Fix | Delete
* Check if rewrite rule for WordPress already exists in the IIS 7+ configuration file
[752] Fix | Delete
*
[753] Fix | Delete
* @since 2.8.0
[754] Fix | Delete
*
[755] Fix | Delete
* @return bool
[756] Fix | Delete
* @param string $filename The file path to the configuration file
[757] Fix | Delete
*/
[758] Fix | Delete
function iis7_rewrite_rule_exists( $filename ) {
[759] Fix | Delete
if ( ! file_exists( $filename ) ) {
[760] Fix | Delete
return false;
[761] Fix | Delete
}
[762] Fix | Delete
if ( ! class_exists( 'DOMDocument', false ) ) {
[763] Fix | Delete
return false;
[764] Fix | Delete
}
[765] Fix | Delete
[766] Fix | Delete
$doc = new DOMDocument();
[767] Fix | Delete
if ( $doc->load( $filename ) === false ) {
[768] Fix | Delete
return false;
[769] Fix | Delete
}
[770] Fix | Delete
$xpath = new DOMXPath( $doc );
[771] Fix | Delete
$rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' );
[772] Fix | Delete
if ( 0 == $rules->length ) {
[773] Fix | Delete
return false;
[774] Fix | Delete
} else {
[775] Fix | Delete
return true;
[776] Fix | Delete
}
[777] Fix | Delete
}
[778] Fix | Delete
[779] Fix | Delete
/**
[780] Fix | Delete
* Delete WordPress rewrite rule from web.config file if it exists there
[781] Fix | Delete
*
[782] Fix | Delete
* @since 2.8.0
[783] Fix | Delete
*
[784] Fix | Delete
* @param string $filename Name of the configuration file
[785] Fix | Delete
* @return bool
[786] Fix | Delete
*/
[787] Fix | Delete
function iis7_delete_rewrite_rule( $filename ) {
[788] Fix | Delete
// If configuration file does not exist then rules also do not exist, so there is nothing to delete.
[789] Fix | Delete
if ( ! file_exists( $filename ) ) {
[790] Fix | Delete
return true;
[791] Fix | Delete
}
[792] Fix | Delete
[793] Fix | Delete
if ( ! class_exists( 'DOMDocument', false ) ) {
[794] Fix | Delete
return false;
[795] Fix | Delete
}
[796] Fix | Delete
[797] Fix | Delete
$doc = new DOMDocument();
[798] Fix | Delete
$doc->preserveWhiteSpace = false;
[799] Fix | Delete
[800] Fix | Delete
if ( $doc->load( $filename ) === false ) {
[801] Fix | Delete
return false;
[802] Fix | Delete
}
[803] Fix | Delete
$xpath = new DOMXPath( $doc );
[804] Fix | Delete
$rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' );
[805] Fix | Delete
if ( $rules->length > 0 ) {
[806] Fix | Delete
$child = $rules->item( 0 );
[807] Fix | Delete
$parent = $child->parentNode;
[808] Fix | Delete
$parent->removeChild( $child );
[809] Fix | Delete
$doc->formatOutput = true;
[810] Fix | Delete
saveDomDocument( $doc, $filename );
[811] Fix | Delete
}
[812] Fix | Delete
return true;
[813] Fix | Delete
}
[814] Fix | Delete
[815] Fix | Delete
/**
[816] Fix | Delete
* Add WordPress rewrite rule to the IIS 7+ configuration file.
[817] Fix | Delete
*
[818] Fix | Delete
* @since 2.8.0
[819] Fix | Delete
*
[820] Fix | Delete
* @param string $filename The file path to the configuration file
[821] Fix | Delete
* @param string $rewrite_rule The XML fragment with URL Rewrite rule
[822] Fix | Delete
* @return bool
[823] Fix | Delete
*/
[824] Fix | Delete
function iis7_add_rewrite_rule( $filename, $rewrite_rule ) {
[825] Fix | Delete
if ( ! class_exists( 'DOMDocument', false ) ) {
[826] Fix | Delete
return false;
[827] Fix | Delete
}
[828] Fix | Delete
[829] Fix | Delete
// If configuration file does not exist then we create one.
[830] Fix | Delete
if ( ! file_exists( $filename ) ) {
[831] Fix | Delete
$fp = fopen( $filename, 'w' );
[832] Fix | Delete
fwrite( $fp, '<configuration/>' );
[833] Fix | Delete
fclose( $fp );
[834] Fix | Delete
}
[835] Fix | Delete
[836] Fix | Delete
$doc = new DOMDocument();
[837] Fix | Delete
$doc->preserveWhiteSpace = false;
[838] Fix | Delete
[839] Fix | Delete
if ( $doc->load( $filename ) === false ) {
[840] Fix | Delete
return false;
[841] Fix | Delete
}
[842] Fix | Delete
[843] Fix | Delete
$xpath = new DOMXPath( $doc );
[844] Fix | Delete
[845] Fix | Delete
// First check if the rule already exists as in that case there is no need to re-add it.
[846] Fix | Delete
$wordpress_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' );
[847] Fix | Delete
if ( $wordpress_rules->length > 0 ) {
[848] Fix | Delete
return true;
[849] Fix | Delete
}
[850] Fix | Delete
[851] Fix | Delete
// Check the XPath to the rewrite rule and create XML nodes if they do not exist.
[852] Fix | Delete
$xmlnodes = $xpath->query( '/configuration/system.webServer/rewrite/rules' );
[853] Fix | Delete
if ( $xmlnodes->length > 0 ) {
[854] Fix | Delete
$rules_node = $xmlnodes->item( 0 );
[855] Fix | Delete
} else {
[856] Fix | Delete
$rules_node = $doc->createElement( 'rules' );
[857] Fix | Delete
[858] Fix | Delete
$xmlnodes = $xpath->query( '/configuration/system.webServer/rewrite' );
[859] Fix | Delete
if ( $xmlnodes->length > 0 ) {
[860] Fix | Delete
$rewrite_node = $xmlnodes->item( 0 );
[861] Fix | Delete
$rewrite_node->appendChild( $rules_node );
[862] Fix | Delete
} else {
[863] Fix | Delete
$rewrite_node = $doc->createElement( 'rewrite' );
[864] Fix | Delete
$rewrite_node->appendChild( $rules_node );
[865] Fix | Delete
[866] Fix | Delete
$xmlnodes = $xpath->query( '/configuration/system.webServer' );
[867] Fix | Delete
if ( $xmlnodes->length > 0 ) {
[868] Fix | Delete
$system_webServer_node = $xmlnodes->item( 0 );
[869] Fix | Delete
$system_webServer_node->appendChild( $rewrite_node );
[870] Fix | Delete
} else {
[871] Fix | Delete
$system_webServer_node = $doc->createElement( 'system.webServer' );
[872] Fix | Delete
$system_webServer_node->appendChild( $rewrite_node );
[873] Fix | Delete
[874] Fix | Delete
$xmlnodes = $xpath->query( '/configuration' );
[875] Fix | Delete
if ( $xmlnodes->length > 0 ) {
[876] Fix | Delete
$config_node = $xmlnodes->item( 0 );
[877] Fix | Delete
$config_node->appendChild( $system_webServer_node );
[878] Fix | Delete
} else {
[879] Fix | Delete
$config_node = $doc->createElement( 'configuration' );
[880] Fix | Delete
$doc->appendChild( $config_node );
[881] Fix | Delete
$config_node->appendChild( $system_webServer_node );
[882] Fix | Delete
}
[883] Fix | Delete
}
[884] Fix | Delete
}
[885] Fix | Delete
}
[886] Fix | Delete
[887] Fix | Delete
$rule_fragment = $doc->createDocumentFragment();
[888] Fix | Delete
$rule_fragment->appendXML( $rewrite_rule );
[889] Fix | Delete
$rules_node->appendChild( $rule_fragment );
[890] Fix | Delete
[891] Fix | Delete
$doc->encoding = 'UTF-8';
[892] Fix | Delete
$doc->formatOutput = true;
[893] Fix | Delete
saveDomDocument( $doc, $filename );
[894] Fix | Delete
[895] Fix | Delete
return true;
[896] Fix | Delete
}
[897] Fix | Delete
[898] Fix | Delete
/**
[899] Fix | Delete
* Saves the XML document into a file
[900] Fix | Delete
*
[901] Fix | Delete
* @since 2.8.0
[902] Fix | Delete
*
[903] Fix | Delete
* @param DOMDocument $doc
[904] Fix | Delete
* @param string $filename
[905] Fix | Delete
*/
[906] Fix | Delete
function saveDomDocument( $doc, $filename ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
[907] Fix | Delete
$config = $doc->saveXML();
[908] Fix | Delete
$config = preg_replace( "/([^\r])\n/", "$1\r\n", $config );
[909] Fix | Delete
$fp = fopen( $filename, 'w' );
[910] Fix | Delete
fwrite( $fp, $config );
[911] Fix | Delete
fclose( $fp );
[912] Fix | Delete
}
[913] Fix | Delete
[914] Fix | Delete
/**
[915] Fix | Delete
* Display the default admin color scheme picker (Used in user-edit.php)
[916] Fix | Delete
*
[917] Fix | Delete
* @since 3.0.0
[918] Fix | Delete
*
[919] Fix | Delete
* @global array $_wp_admin_css_colors
[920] Fix | Delete
*
[921] Fix | Delete
* @param int $user_id User ID.
[922] Fix | Delete
*/
[923] Fix | Delete
function admin_color_scheme_picker( $user_id ) {
[924] Fix | Delete
global $_wp_admin_css_colors;
[925] Fix | Delete
[926] Fix | Delete
ksort( $_wp_admin_css_colors );
[927] Fix | Delete
[928] Fix | Delete
if ( isset( $_wp_admin_css_colors['fresh'] ) ) {
[929] Fix | Delete
// Set Default ('fresh') and Light should go first.
[930] Fix | Delete
$_wp_admin_css_colors = array_filter(
[931] Fix | Delete
array_merge(
[932] Fix | Delete
array(
[933] Fix | Delete
'fresh' => '',
[934] Fix | Delete
'light' => '',
[935] Fix | Delete
'modern' => '',
[936] Fix | Delete
),
[937] Fix | Delete
$_wp_admin_css_colors
[938] Fix | Delete
)
[939] Fix | Delete
);
[940] Fix | Delete
}
[941] Fix | Delete
[942] Fix | Delete
$current_color = get_user_option( 'admin_color', $user_id );
[943] Fix | Delete
[944] Fix | Delete
if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) {
[945] Fix | Delete
$current_color = 'fresh';
[946] Fix | Delete
}
[947] Fix | Delete
[948] Fix | Delete
?>
[949] Fix | Delete
<fieldset id="color-picker" class="scheme-list">
[950] Fix | Delete
<legend class="screen-reader-text"><span><?php _e( 'Admin Color Scheme' ); ?></span></legend>
[951] Fix | Delete
<?php
[952] Fix | Delete
wp_nonce_field( 'save-color-scheme', 'color-nonce', false );
[953] Fix | Delete
foreach ( $_wp_admin_css_colors as $color => $color_info ) :
[954] Fix | Delete
[955] Fix | Delete
?>
[956] Fix | Delete
<div class="color-option <?php echo ( $color == $current_color ) ? 'selected' : ''; ?>">
[957] Fix | Delete
<input name="admin_color" id="admin_color_<?php echo esc_attr( $color ); ?>" type="radio" value="<?php echo esc_attr( $color ); ?>" class="tog" <?php checked( $color, $current_color ); ?> />
[958] Fix | Delete
<input type="hidden" class="css_url" value="<?php echo esc_url( $color_info->url ); ?>" />
[959] Fix | Delete
<input type="hidden" class="icon_colors" value="<?php echo esc_attr( wp_json_encode( array( 'icons' => $color_info->icon_colors ) ) ); ?>" />
[960] Fix | Delete
<label for="admin_color_<?php echo esc_attr( $color ); ?>"><?php echo esc_html( $color_info->name ); ?></label>
[961] Fix | Delete
<table class="color-palette">
[962] Fix | Delete
<tr>
[963] Fix | Delete
<?php
[964] Fix | Delete
[965] Fix | Delete
foreach ( $color_info->colors as $html_color ) {
[966] Fix | Delete
?>
[967] Fix | Delete
<td style="background-color: <?php echo esc_attr( $html_color ); ?>">&nbsp;</td>
[968] Fix | Delete
<?php
[969] Fix | Delete
}
[970] Fix | Delete
[971] Fix | Delete
?>
[972] Fix | Delete
</tr>
[973] Fix | Delete
</table>
[974] Fix | Delete
</div>
[975] Fix | Delete
<?php
[976] Fix | Delete
[977] Fix | Delete
endforeach;
[978] Fix | Delete
[979] Fix | Delete
?>
[980] Fix | Delete
</fieldset>
[981] Fix | Delete
<?php
[982] Fix | Delete
}
[983] Fix | Delete
[984] Fix | Delete
/**
[985] Fix | Delete
*
[986] Fix | Delete
* @global array $_wp_admin_css_colors
[987] Fix | Delete
*/
[988] Fix | Delete
function wp_color_scheme_settings() {
[989] Fix | Delete
global $_wp_admin_css_colors;
[990] Fix | Delete
[991] Fix | Delete
$color_scheme = get_user_option( 'admin_color' );
[992] Fix | Delete
[993] Fix | Delete
// It's possible to have a color scheme set that is no longer registered.
[994] Fix | Delete
if ( empty( $_wp_admin_css_colors[ $color_scheme ] ) ) {
[995] Fix | Delete
$color_scheme = 'fresh';
[996] Fix | Delete
}
[997] Fix | Delete
[998] Fix | Delete
if ( ! empty( $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) {
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function