Edit File by line
/home/barbar84/www/wp-admin
File: widgets.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Widget administration panel
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/** WordPress Administration Bootstrap */
[8] Fix | Delete
require_once __DIR__ . '/admin.php';
[9] Fix | Delete
[10] Fix | Delete
/** WordPress Administration Widgets API */
[11] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/widgets.php';
[12] Fix | Delete
[13] Fix | Delete
if ( ! current_user_can( 'edit_theme_options' ) ) {
[14] Fix | Delete
wp_die(
[15] Fix | Delete
'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
[16] Fix | Delete
'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
[17] Fix | Delete
403
[18] Fix | Delete
);
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
$widgets_access = get_user_setting( 'widgets_access' );
[22] Fix | Delete
if ( isset( $_GET['widgets-access'] ) ) {
[23] Fix | Delete
check_admin_referer( 'widgets-access' );
[24] Fix | Delete
[25] Fix | Delete
$widgets_access = 'on' === $_GET['widgets-access'] ? 'on' : 'off';
[26] Fix | Delete
set_user_setting( 'widgets_access', $widgets_access );
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
if ( 'on' === $widgets_access ) {
[30] Fix | Delete
add_filter( 'admin_body_class', 'wp_widgets_access_body_class' );
[31] Fix | Delete
} else {
[32] Fix | Delete
wp_enqueue_script( 'admin-widgets' );
[33] Fix | Delete
[34] Fix | Delete
if ( wp_is_mobile() ) {
[35] Fix | Delete
wp_enqueue_script( 'jquery-touch-punch' );
[36] Fix | Delete
}
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Fires early before the Widgets administration screen loads,
[41] Fix | Delete
* after scripts are enqueued.
[42] Fix | Delete
*
[43] Fix | Delete
* @since 2.2.0
[44] Fix | Delete
*/
[45] Fix | Delete
do_action( 'sidebar_admin_setup' );
[46] Fix | Delete
[47] Fix | Delete
$title = __( 'Widgets' );
[48] Fix | Delete
$parent_file = 'themes.php';
[49] Fix | Delete
[50] Fix | Delete
get_current_screen()->add_help_tab(
[51] Fix | Delete
array(
[52] Fix | Delete
'id' => 'overview',
[53] Fix | Delete
'title' => __( 'Overview' ),
[54] Fix | Delete
'content' =>
[55] Fix | Delete
'<p>' . __( 'Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.' ) . '</p>
[56] Fix | Delete
<p>' . __( 'The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.' ) . '</p>',
[57] Fix | Delete
)
[58] Fix | Delete
);
[59] Fix | Delete
get_current_screen()->add_help_tab(
[60] Fix | Delete
array(
[61] Fix | Delete
'id' => 'removing-reusing',
[62] Fix | Delete
'title' => __( 'Removing and Reusing' ),
[63] Fix | Delete
'content' =>
[64] Fix | Delete
'<p>' . __( 'If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.' ) . '</p>
[65] Fix | Delete
<p>' . __( 'Widgets may be used multiple times. You can give each widget a title, to display on your site, but it&#8217;s not required.' ) . '</p>
[66] Fix | Delete
<p>' . __( 'Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.' ) . '</p>',
[67] Fix | Delete
)
[68] Fix | Delete
);
[69] Fix | Delete
get_current_screen()->add_help_tab(
[70] Fix | Delete
array(
[71] Fix | Delete
'id' => 'missing-widgets',
[72] Fix | Delete
'title' => __( 'Missing Widgets' ),
[73] Fix | Delete
'content' =>
[74] Fix | Delete
'<p>' . __( 'Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.' ) . '</p>' .
[75] Fix | Delete
'<p>' . __( 'When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.' ) . '</p>',
[76] Fix | Delete
)
[77] Fix | Delete
);
[78] Fix | Delete
[79] Fix | Delete
get_current_screen()->set_help_sidebar(
[80] Fix | Delete
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
[81] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/article/appearance-widgets-screen/">Documentation on Widgets</a>' ) . '</p>' .
[82] Fix | Delete
'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
[83] Fix | Delete
);
[84] Fix | Delete
[85] Fix | Delete
if ( ! current_theme_supports( 'widgets' ) ) {
[86] Fix | Delete
wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://developer.wordpress.org/themes/functionality/widgets/">follow these instructions</a>.' ) );
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
// These are the widgets grouped by sidebar.
[90] Fix | Delete
$sidebars_widgets = wp_get_sidebars_widgets();
[91] Fix | Delete
[92] Fix | Delete
if ( empty( $sidebars_widgets ) ) {
[93] Fix | Delete
$sidebars_widgets = wp_get_widget_defaults();
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
[97] Fix | Delete
if ( 'wp_inactive_widgets' === $sidebar_id ) {
[98] Fix | Delete
continue;
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
if ( ! is_registered_sidebar( $sidebar_id ) ) {
[102] Fix | Delete
if ( ! empty( $widgets ) ) { // Register the inactive_widgets area as sidebar.
[103] Fix | Delete
register_sidebar(
[104] Fix | Delete
array(
[105] Fix | Delete
'name' => __( 'Inactive Sidebar (not used)' ),
[106] Fix | Delete
'id' => $sidebar_id,
[107] Fix | Delete
'class' => 'inactive-sidebar orphan-sidebar',
[108] Fix | Delete
'description' => __( 'This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.' ),
[109] Fix | Delete
'before_widget' => '',
[110] Fix | Delete
'after_widget' => '',
[111] Fix | Delete
'before_title' => '',
[112] Fix | Delete
'after_title' => '',
[113] Fix | Delete
)
[114] Fix | Delete
);
[115] Fix | Delete
} else {
[116] Fix | Delete
unset( $sidebars_widgets[ $sidebar_id ] );
[117] Fix | Delete
}
[118] Fix | Delete
}
[119] Fix | Delete
}
[120] Fix | Delete
[121] Fix | Delete
// Register the inactive_widgets area as sidebar.
[122] Fix | Delete
register_sidebar(
[123] Fix | Delete
array(
[124] Fix | Delete
'name' => __( 'Inactive Widgets' ),
[125] Fix | Delete
'id' => 'wp_inactive_widgets',
[126] Fix | Delete
'class' => 'inactive-sidebar',
[127] Fix | Delete
'description' => __( 'Drag widgets here to remove them from the sidebar but keep their settings.' ),
[128] Fix | Delete
'before_widget' => '',
[129] Fix | Delete
'after_widget' => '',
[130] Fix | Delete
'before_title' => '',
[131] Fix | Delete
'after_title' => '',
[132] Fix | Delete
)
[133] Fix | Delete
);
[134] Fix | Delete
[135] Fix | Delete
retrieve_widgets();
[136] Fix | Delete
[137] Fix | Delete
// We're saving a widget without JS.
[138] Fix | Delete
if ( isset( $_POST['savewidget'] ) || isset( $_POST['removewidget'] ) ) {
[139] Fix | Delete
$widget_id = $_POST['widget-id'];
[140] Fix | Delete
check_admin_referer( "save-delete-widget-$widget_id" );
[141] Fix | Delete
[142] Fix | Delete
$number = isset( $_POST['multi_number'] ) ? (int) $_POST['multi_number'] : '';
[143] Fix | Delete
if ( $number ) {
[144] Fix | Delete
foreach ( $_POST as $key => $val ) {
[145] Fix | Delete
if ( is_array( $val ) && preg_match( '/__i__|%i%/', key( $val ) ) ) {
[146] Fix | Delete
$_POST[ $key ] = array( $number => array_shift( $val ) );
[147] Fix | Delete
break;
[148] Fix | Delete
}
[149] Fix | Delete
}
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
$sidebar_id = $_POST['sidebar'];
[153] Fix | Delete
$position = isset( $_POST[ $sidebar_id . '_position' ] ) ? (int) $_POST[ $sidebar_id . '_position' ] - 1 : 0;
[154] Fix | Delete
[155] Fix | Delete
$id_base = $_POST['id_base'];
[156] Fix | Delete
$sidebar = isset( $sidebars_widgets[ $sidebar_id ] ) ? $sidebars_widgets[ $sidebar_id ] : array();
[157] Fix | Delete
[158] Fix | Delete
// Delete.
[159] Fix | Delete
if ( isset( $_POST['removewidget'] ) && $_POST['removewidget'] ) {
[160] Fix | Delete
[161] Fix | Delete
if ( ! in_array( $widget_id, $sidebar, true ) ) {
[162] Fix | Delete
wp_redirect( admin_url( 'widgets.php?error=0' ) );
[163] Fix | Delete
exit;
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
$sidebar = array_diff( $sidebar, array( $widget_id ) );
[167] Fix | Delete
$_POST = array(
[168] Fix | Delete
'sidebar' => $sidebar_id,
[169] Fix | Delete
'widget-' . $id_base => array(),
[170] Fix | Delete
'the-widget-id' => $widget_id,
[171] Fix | Delete
'delete_widget' => '1',
[172] Fix | Delete
);
[173] Fix | Delete
[174] Fix | Delete
/**
[175] Fix | Delete
* Fires immediately after a widget has been marked for deletion.
[176] Fix | Delete
*
[177] Fix | Delete
* @since 4.4.0
[178] Fix | Delete
*
[179] Fix | Delete
* @param string $widget_id ID of the widget marked for deletion.
[180] Fix | Delete
* @param string $sidebar_id ID of the sidebar the widget was deleted from.
[181] Fix | Delete
* @param string $id_base ID base for the widget.
[182] Fix | Delete
*/
[183] Fix | Delete
do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base );
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
$_POST['widget-id'] = $sidebar;
[187] Fix | Delete
[188] Fix | Delete
foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
[189] Fix | Delete
if ( $name !== $id_base || ! is_callable( $control['callback'] ) ) {
[190] Fix | Delete
continue;
[191] Fix | Delete
}
[192] Fix | Delete
[193] Fix | Delete
ob_start();
[194] Fix | Delete
call_user_func_array( $control['callback'], $control['params'] );
[195] Fix | Delete
ob_end_clean();
[196] Fix | Delete
[197] Fix | Delete
break;
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
$sidebars_widgets[ $sidebar_id ] = $sidebar;
[201] Fix | Delete
[202] Fix | Delete
// Remove old position.
[203] Fix | Delete
if ( ! isset( $_POST['delete_widget'] ) ) {
[204] Fix | Delete
foreach ( $sidebars_widgets as $key => $sb ) {
[205] Fix | Delete
if ( is_array( $sb ) ) {
[206] Fix | Delete
$sidebars_widgets[ $key ] = array_diff( $sb, array( $widget_id ) );
[207] Fix | Delete
}
[208] Fix | Delete
}
[209] Fix | Delete
array_splice( $sidebars_widgets[ $sidebar_id ], $position, 0, $widget_id );
[210] Fix | Delete
}
[211] Fix | Delete
[212] Fix | Delete
wp_set_sidebars_widgets( $sidebars_widgets );
[213] Fix | Delete
wp_redirect( admin_url( 'widgets.php?message=0' ) );
[214] Fix | Delete
exit;
[215] Fix | Delete
}
[216] Fix | Delete
[217] Fix | Delete
// Remove inactive widgets without JS.
[218] Fix | Delete
if ( isset( $_POST['removeinactivewidgets'] ) ) {
[219] Fix | Delete
check_admin_referer( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' );
[220] Fix | Delete
[221] Fix | Delete
if ( $_POST['removeinactivewidgets'] ) {
[222] Fix | Delete
foreach ( $sidebars_widgets['wp_inactive_widgets'] as $key => $widget_id ) {
[223] Fix | Delete
$pieces = explode( '-', $widget_id );
[224] Fix | Delete
$multi_number = array_pop( $pieces );
[225] Fix | Delete
$id_base = implode( '-', $pieces );
[226] Fix | Delete
$widget = get_option( 'widget_' . $id_base );
[227] Fix | Delete
unset( $widget[ $multi_number ] );
[228] Fix | Delete
update_option( 'widget_' . $id_base, $widget );
[229] Fix | Delete
unset( $sidebars_widgets['wp_inactive_widgets'][ $key ] );
[230] Fix | Delete
}
[231] Fix | Delete
[232] Fix | Delete
wp_set_sidebars_widgets( $sidebars_widgets );
[233] Fix | Delete
}
[234] Fix | Delete
[235] Fix | Delete
wp_redirect( admin_url( 'widgets.php?message=0' ) );
[236] Fix | Delete
exit;
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
// Output the widget form without JS.
[240] Fix | Delete
if ( isset( $_GET['editwidget'] ) && $_GET['editwidget'] ) {
[241] Fix | Delete
$widget_id = $_GET['editwidget'];
[242] Fix | Delete
[243] Fix | Delete
if ( isset( $_GET['addnew'] ) ) {
[244] Fix | Delete
// Default to the first sidebar.
[245] Fix | Delete
$keys = array_keys( $wp_registered_sidebars );
[246] Fix | Delete
$sidebar = reset( $keys );
[247] Fix | Delete
[248] Fix | Delete
if ( isset( $_GET['base'] ) && isset( $_GET['num'] ) ) { // Multi-widget.
[249] Fix | Delete
// Copy minimal info from an existing instance of this widget to a new instance.
[250] Fix | Delete
foreach ( $wp_registered_widget_controls as $control ) {
[251] Fix | Delete
if ( $_GET['base'] === $control['id_base'] ) {
[252] Fix | Delete
$control_callback = $control['callback'];
[253] Fix | Delete
$multi_number = (int) $_GET['num'];
[254] Fix | Delete
$control['params'][0]['number'] = -1;
[255] Fix | Delete
$control['id'] = $control['id_base'] . '-' . $multi_number;
[256] Fix | Delete
$widget_id = $control['id'];
[257] Fix | Delete
$wp_registered_widget_controls[ $control['id'] ] = $control;
[258] Fix | Delete
break;
[259] Fix | Delete
}
[260] Fix | Delete
}
[261] Fix | Delete
}
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
if ( isset( $wp_registered_widget_controls[ $widget_id ] ) && ! isset( $control ) ) {
[265] Fix | Delete
$control = $wp_registered_widget_controls[ $widget_id ];
[266] Fix | Delete
$control_callback = $control['callback'];
[267] Fix | Delete
} elseif ( ! isset( $wp_registered_widget_controls[ $widget_id ] ) && isset( $wp_registered_widgets[ $widget_id ] ) ) {
[268] Fix | Delete
$name = esc_html( strip_tags( $wp_registered_widgets[ $widget_id ]['name'] ) );
[269] Fix | Delete
}
[270] Fix | Delete
[271] Fix | Delete
if ( ! isset( $name ) ) {
[272] Fix | Delete
$name = esc_html( strip_tags( $control['name'] ) );
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
if ( ! isset( $sidebar ) ) {
[276] Fix | Delete
$sidebar = isset( $_GET['sidebar'] ) ? $_GET['sidebar'] : 'wp_inactive_widgets';
[277] Fix | Delete
}
[278] Fix | Delete
[279] Fix | Delete
if ( ! isset( $multi_number ) ) {
[280] Fix | Delete
$multi_number = isset( $control['params'][0]['number'] ) ? $control['params'][0]['number'] : '';
[281] Fix | Delete
}
[282] Fix | Delete
[283] Fix | Delete
$id_base = isset( $control['id_base'] ) ? $control['id_base'] : $control['id'];
[284] Fix | Delete
[285] Fix | Delete
// Show the widget form.
[286] Fix | Delete
$width = ' style="width:' . max( $control['width'], 350 ) . 'px"';
[287] Fix | Delete
$key = isset( $_GET['key'] ) ? (int) $_GET['key'] : 0;
[288] Fix | Delete
[289] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php'; ?>
[290] Fix | Delete
<div class="wrap">
[291] Fix | Delete
<h1><?php echo esc_html( $title ); ?></h1>
[292] Fix | Delete
<div class="editwidget"<?php echo $width; ?>>
[293] Fix | Delete
<h2>
[294] Fix | Delete
<?php
[295] Fix | Delete
/* translators: %s: Widget name. */
[296] Fix | Delete
printf( __( 'Widget %s' ), $name );
[297] Fix | Delete
?>
[298] Fix | Delete
</h2>
[299] Fix | Delete
[300] Fix | Delete
<form action="widgets.php" method="post">
[301] Fix | Delete
<div class="widget-inside">
[302] Fix | Delete
<?php
[303] Fix | Delete
if ( is_callable( $control_callback ) ) {
[304] Fix | Delete
call_user_func_array( $control_callback, $control['params'] );
[305] Fix | Delete
} else {
[306] Fix | Delete
echo '<p>' . __( 'There are no options for this widget.' ) . "</p>\n";
[307] Fix | Delete
}
[308] Fix | Delete
?>
[309] Fix | Delete
</div>
[310] Fix | Delete
[311] Fix | Delete
<p class="describe"><?php _e( 'Select both the sidebar for this widget and the position of the widget in that sidebar.' ); ?></p>
[312] Fix | Delete
<div class="widget-position">
[313] Fix | Delete
<table class="widefat"><thead><tr><th><?php _e( 'Sidebar' ); ?></th><th><?php _e( 'Position' ); ?></th></tr></thead><tbody>
[314] Fix | Delete
<?php
[315] Fix | Delete
foreach ( $wp_registered_sidebars as $sbname => $sbvalue ) {
[316] Fix | Delete
echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='" . esc_attr( $sbname ) . "'" . checked( $sbname, $sidebar, false ) . " /> $sbvalue[name]</label></td><td>";
[317] Fix | Delete
if ( 'wp_inactive_widgets' === $sbname || 'orphaned_widgets' === substr( $sbname, 0, 16 ) ) {
[318] Fix | Delete
echo '&nbsp;';
[319] Fix | Delete
} else {
[320] Fix | Delete
if ( ! isset( $sidebars_widgets[ $sbname ] ) || ! is_array( $sidebars_widgets[ $sbname ] ) ) {
[321] Fix | Delete
$j = 1;
[322] Fix | Delete
$sidebars_widgets[ $sbname ] = array();
[323] Fix | Delete
} else {
[324] Fix | Delete
$j = count( $sidebars_widgets[ $sbname ] );
[325] Fix | Delete
if ( isset( $_GET['addnew'] ) || ! in_array( $widget_id, $sidebars_widgets[ $sbname ], true ) ) {
[326] Fix | Delete
$j++;
[327] Fix | Delete
}
[328] Fix | Delete
}
[329] Fix | Delete
$selected = '';
[330] Fix | Delete
echo "\t\t<select name='{$sbname}_position'>\n";
[331] Fix | Delete
echo "\t\t<option value=''>" . __( '&mdash; Select &mdash;' ) . "</option>\n";
[332] Fix | Delete
for ( $i = 1; $i <= $j; $i++ ) {
[333] Fix | Delete
if ( in_array( $widget_id, $sidebars_widgets[ $sbname ], true ) ) {
[334] Fix | Delete
$selected = selected( $i, $key + 1, false );
[335] Fix | Delete
}
[336] Fix | Delete
echo "\t\t<option value='$i'$selected> $i </option>\n";
[337] Fix | Delete
}
[338] Fix | Delete
echo "\t\t</select>\n";
[339] Fix | Delete
}
[340] Fix | Delete
echo "</td></tr>\n";
[341] Fix | Delete
}
[342] Fix | Delete
?>
[343] Fix | Delete
</tbody></table>
[344] Fix | Delete
</div>
[345] Fix | Delete
[346] Fix | Delete
<div class="widget-control-actions">
[347] Fix | Delete
<div class="alignleft">
[348] Fix | Delete
<?php if ( ! isset( $_GET['addnew'] ) ) : ?>
[349] Fix | Delete
<input type="submit" name="removewidget" id="removewidget" class="button-link button-link-delete widget-control-remove" value="<?php _e( 'Delete' ); ?>" />
[350] Fix | Delete
<span class="widget-control-close-wrapper">
[351] Fix | Delete
| <a href="widgets.php" class="button-link widget-control-close"><?php _e( 'Cancel' ); ?></a>
[352] Fix | Delete
</span>
[353] Fix | Delete
<?php else : ?>
[354] Fix | Delete
<a href="widgets.php" class="button-link widget-control-close"><?php _e( 'Cancel' ); ?></a>
[355] Fix | Delete
<?php endif; ?>
[356] Fix | Delete
</div>
[357] Fix | Delete
<div class="alignright">
[358] Fix | Delete
<?php submit_button( __( 'Save Widget' ), 'primary alignright', 'savewidget', false ); ?>
[359] Fix | Delete
<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $widget_id ); ?>" />
[360] Fix | Delete
<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" />
[361] Fix | Delete
<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" />
[362] Fix | Delete
<?php wp_nonce_field( "save-delete-widget-$widget_id" ); ?>
[363] Fix | Delete
</div>
[364] Fix | Delete
<br class="clear" />
[365] Fix | Delete
</div>
[366] Fix | Delete
[367] Fix | Delete
</form>
[368] Fix | Delete
</div>
[369] Fix | Delete
</div>
[370] Fix | Delete
<?php
[371] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[372] Fix | Delete
exit;
[373] Fix | Delete
}
[374] Fix | Delete
[375] Fix | Delete
$messages = array(
[376] Fix | Delete
__( 'Changes saved.' ),
[377] Fix | Delete
);
[378] Fix | Delete
[379] Fix | Delete
$errors = array(
[380] Fix | Delete
__( 'Error while saving.' ),
[381] Fix | Delete
__( 'Error in displaying the widget settings form.' ),
[382] Fix | Delete
);
[383] Fix | Delete
[384] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[385] Fix | Delete
?>
[386] Fix | Delete
[387] Fix | Delete
<div class="wrap">
[388] Fix | Delete
<h1 class="wp-heading-inline">
[389] Fix | Delete
<?php
[390] Fix | Delete
echo esc_html( $title );
[391] Fix | Delete
?>
[392] Fix | Delete
</h1>
[393] Fix | Delete
[394] Fix | Delete
<?php
[395] Fix | Delete
if ( current_user_can( 'customize' ) ) {
[396] Fix | Delete
printf(
[397] Fix | Delete
' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>',
[398] Fix | Delete
esc_url(
[399] Fix | Delete
add_query_arg(
[400] Fix | Delete
array(
[401] Fix | Delete
array( 'autofocus' => array( 'panel' => 'widgets' ) ),
[402] Fix | Delete
'return' => urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ),
[403] Fix | Delete
),
[404] Fix | Delete
admin_url( 'customize.php' )
[405] Fix | Delete
)
[406] Fix | Delete
),
[407] Fix | Delete
__( 'Manage with Live Preview' )
[408] Fix | Delete
);
[409] Fix | Delete
}
[410] Fix | Delete
[411] Fix | Delete
$nonce = wp_create_nonce( 'widgets-access' );
[412] Fix | Delete
?>
[413] Fix | Delete
<div class="widget-access-link">
[414] Fix | Delete
<a id="access-on" href="widgets.php?widgets-access=on&_wpnonce=<?php echo urlencode( $nonce ); ?>"><?php _e( 'Enable accessibility mode' ); ?></a><a id="access-off" href="widgets.php?widgets-access=off&_wpnonce=<?php echo urlencode( $nonce ); ?>"><?php _e( 'Disable accessibility mode' ); ?></a>
[415] Fix | Delete
</div>
[416] Fix | Delete
[417] Fix | Delete
<hr class="wp-header-end">
[418] Fix | Delete
[419] Fix | Delete
<?php if ( isset( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { ?>
[420] Fix | Delete
<div id="message" class="updated notice is-dismissible"><p><?php echo $messages[ $_GET['message'] ]; ?></p></div>
[421] Fix | Delete
<?php } ?>
[422] Fix | Delete
<?php if ( isset( $_GET['error'] ) && isset( $errors[ $_GET['error'] ] ) ) { ?>
[423] Fix | Delete
<div id="message" class="error"><p><?php echo $errors[ $_GET['error'] ]; ?></p></div>
[424] Fix | Delete
<?php } ?>
[425] Fix | Delete
[426] Fix | Delete
<?php
[427] Fix | Delete
/**
[428] Fix | Delete
* Fires before the Widgets administration page content loads.
[429] Fix | Delete
*
[430] Fix | Delete
* @since 3.0.0
[431] Fix | Delete
*/
[432] Fix | Delete
do_action( 'widgets_admin_page' );
[433] Fix | Delete
?>
[434] Fix | Delete
[435] Fix | Delete
<div class="widget-liquid-left">
[436] Fix | Delete
<div id="widgets-left">
[437] Fix | Delete
<div id="available-widgets" class="widgets-holder-wrap">
[438] Fix | Delete
<div class="sidebar-name">
[439] Fix | Delete
<button type="button" class="handlediv hide-if-no-js" aria-expanded="true">
[440] Fix | Delete
<span class="screen-reader-text"><?php _e( 'Available Widgets' ); ?></span>
[441] Fix | Delete
<span class="toggle-indicator" aria-hidden="true"></span>
[442] Fix | Delete
</button>
[443] Fix | Delete
<h2><?php _e( 'Available Widgets' ); ?> <span id="removing-widget"><?php _ex( 'Deactivate', 'removing-widget' ); ?> <span></span></span></h2>
[444] Fix | Delete
</div>
[445] Fix | Delete
<div class="widget-holder">
[446] Fix | Delete
<div class="sidebar-description">
[447] Fix | Delete
<p class="description"><?php _e( 'To activate a widget drag it to a sidebar or click on it. To deactivate a widget and delete its settings, drag it back.' ); ?></p>
[448] Fix | Delete
</div>
[449] Fix | Delete
<div id="widget-list">
[450] Fix | Delete
<?php wp_list_widgets(); ?>
[451] Fix | Delete
</div>
[452] Fix | Delete
<br class='clear' />
[453] Fix | Delete
</div>
[454] Fix | Delete
<br class="clear" />
[455] Fix | Delete
</div>
[456] Fix | Delete
[457] Fix | Delete
<?php
[458] Fix | Delete
[459] Fix | Delete
$theme_sidebars = array();
[460] Fix | Delete
foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
[461] Fix | Delete
if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) {
[462] Fix | Delete
$wrap_class = 'widgets-holder-wrap';
[463] Fix | Delete
if ( ! empty( $registered_sidebar['class'] ) ) {
[464] Fix | Delete
$wrap_class .= ' ' . $registered_sidebar['class'];
[465] Fix | Delete
}
[466] Fix | Delete
[467] Fix | Delete
$is_inactive_widgets = 'wp_inactive_widgets' === $registered_sidebar['id'];
[468] Fix | Delete
?>
[469] Fix | Delete
<div class="<?php echo esc_attr( $wrap_class ); ?>">
[470] Fix | Delete
<div class="widget-holder inactive">
[471] Fix | Delete
<?php wp_list_widget_controls( $registered_sidebar['id'], $registered_sidebar['name'] ); ?>
[472] Fix | Delete
[473] Fix | Delete
<?php if ( $is_inactive_widgets ) { ?>
[474] Fix | Delete
<div class="remove-inactive-widgets">
[475] Fix | Delete
<form action="" method="post">
[476] Fix | Delete
<p>
[477] Fix | Delete
<?php
[478] Fix | Delete
$attributes = array( 'id' => 'inactive-widgets-control-remove' );
[479] Fix | Delete
[480] Fix | Delete
if ( empty( $sidebars_widgets['wp_inactive_widgets'] ) ) {
[481] Fix | Delete
$attributes['disabled'] = '';
[482] Fix | Delete
}
[483] Fix | Delete
[484] Fix | Delete
submit_button( __( 'Clear Inactive Widgets' ), 'delete', 'removeinactivewidgets', false, $attributes );
[485] Fix | Delete
?>
[486] Fix | Delete
<span class="spinner"></span>
[487] Fix | Delete
</p>
[488] Fix | Delete
<?php wp_nonce_field( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); ?>
[489] Fix | Delete
</form>
[490] Fix | Delete
</div>
[491] Fix | Delete
<?php } ?>
[492] Fix | Delete
</div>
[493] Fix | Delete
<?php if ( $is_inactive_widgets ) { ?>
[494] Fix | Delete
<p class="description"><?php _e( 'This will clear all items from the inactive widgets list. You will not be able to restore any customizations.' ); ?></p>
[495] Fix | Delete
<?php } ?>
[496] Fix | Delete
</div>
[497] Fix | Delete
<?php
[498] Fix | Delete
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function