2008-01-05 00:40:47 +01:00
|
|
|
<?php
|
2008-09-17 02:40:10 +02:00
|
|
|
/**
|
|
|
|
* WordPress Widgets Administration API
|
|
|
|
*
|
|
|
|
* @package WordPress
|
|
|
|
* @subpackage Administration
|
|
|
|
*/
|
2008-01-05 00:40:47 +01:00
|
|
|
|
2008-09-17 02:40:10 +02:00
|
|
|
/**
|
2010-11-10 13:28:03 +01:00
|
|
|
* Display list of the available widgets.
|
2008-09-17 02:40:10 +02:00
|
|
|
*
|
2010-11-10 13:28:03 +01:00
|
|
|
* @since 2.5.0
|
2015-05-28 23:41:30 +02:00
|
|
|
*
|
|
|
|
* @global array $wp_registered_widgets
|
|
|
|
* @global array $wp_registered_widget_controls
|
2008-09-17 02:40:10 +02:00
|
|
|
*/
|
2009-04-22 03:06:15 +02:00
|
|
|
function wp_list_widgets() {
|
2014-05-19 07:04:16 +02:00
|
|
|
global $wp_registered_widgets, $wp_registered_widget_controls;
|
2009-04-11 16:37:24 +02:00
|
|
|
|
2009-05-10 08:56:27 +02:00
|
|
|
$sort = $wp_registered_widgets;
|
2010-11-11 23:50:36 +01:00
|
|
|
usort( $sort, '_sort_name_callback' );
|
2009-05-24 17:46:09 +02:00
|
|
|
$done = array();
|
2008-01-05 00:40:47 +01:00
|
|
|
|
2009-05-10 08:56:27 +02:00
|
|
|
foreach ( $sort as $widget ) {
|
2020-01-29 01:45:18 +01:00
|
|
|
if ( in_array( $widget['callback'], $done, true ) ) { // We already showed this multi-widget.
|
2009-04-22 03:06:15 +02:00
|
|
|
continue;
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2008-01-05 00:40:47 +01:00
|
|
|
|
2009-05-04 01:20:26 +02:00
|
|
|
$sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
|
2017-12-01 00:11:00 +01:00
|
|
|
$done[] = $widget['callback'];
|
2008-02-28 01:31:46 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( ! isset( $widget['params'][0] ) ) {
|
2009-04-22 03:06:15 +02:00
|
|
|
$widget['params'][0] = array();
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2008-01-05 00:40:47 +01:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
$args = array(
|
|
|
|
'widget_id' => $widget['id'],
|
|
|
|
'widget_name' => $widget['name'],
|
|
|
|
'_display' => 'template',
|
|
|
|
);
|
|
|
|
|
|
|
|
if ( isset( $wp_registered_widget_controls[ $widget['id'] ]['id_base'] ) && isset( $widget['params'][0]['number'] ) ) {
|
|
|
|
$id_base = $wp_registered_widget_controls[ $widget['id'] ]['id_base'];
|
|
|
|
$args['_temp_id'] = "$id_base-__i__";
|
|
|
|
$args['_multi_num'] = next_widget_id_number( $id_base );
|
|
|
|
$args['_add'] = 'multi';
|
2009-04-22 03:06:15 +02:00
|
|
|
} else {
|
|
|
|
$args['_add'] = 'single';
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( $sidebar ) {
|
2009-04-22 03:06:15 +02:00
|
|
|
$args['_hide'] = '1';
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2009-04-11 16:37:24 +02:00
|
|
|
}
|
2008-01-05 00:40:47 +01:00
|
|
|
|
2019-09-15 13:41:55 +02:00
|
|
|
$control_args = array(
|
|
|
|
0 => $args,
|
|
|
|
1 => $widget['params'][0],
|
2017-12-01 00:11:00 +01:00
|
|
|
);
|
2019-09-15 13:41:55 +02:00
|
|
|
$sidebar_args = wp_list_widget_controls_dynamic_sidebar( $control_args );
|
|
|
|
|
|
|
|
wp_widget_control( ...$sidebar_args );
|
2009-05-24 17:46:09 +02:00
|
|
|
}
|
2008-01-05 00:40:47 +01:00
|
|
|
}
|
|
|
|
|
2010-11-11 23:50:36 +01:00
|
|
|
/**
|
|
|
|
* Callback to sort array by a 'name' key.
|
|
|
|
*
|
|
|
|
* @since 3.1.0
|
|
|
|
* @access private
|
2015-05-29 22:17:26 +02:00
|
|
|
*
|
2023-05-12 23:35:21 +02:00
|
|
|
* @param array $a First array.
|
|
|
|
* @param array $b Second array.
|
2015-05-29 22:17:26 +02:00
|
|
|
* @return int
|
2010-11-11 23:50:36 +01:00
|
|
|
*/
|
|
|
|
function _sort_name_callback( $a, $b ) {
|
|
|
|
return strnatcasecmp( $a['name'], $b['name'] );
|
|
|
|
}
|
|
|
|
|
2008-09-17 02:40:10 +02:00
|
|
|
/**
|
2009-11-19 10:12:16 +01:00
|
|
|
* Show the widgets and their settings for a sidebar.
|
2013-05-10 03:39:30 +02:00
|
|
|
* Used in the admin widget config screen.
|
2008-09-17 02:40:10 +02:00
|
|
|
*
|
2010-12-01 20:24:38 +01:00
|
|
|
* @since 2.5.0
|
2008-09-17 02:40:10 +02:00
|
|
|
*
|
2015-09-06 01:38:25 +02:00
|
|
|
* @param string $sidebar Sidebar ID.
|
|
|
|
* @param string $sidebar_name Optional. Sidebar name. Default empty.
|
2008-09-17 02:40:10 +02:00
|
|
|
*/
|
2013-11-27 02:30:10 +01:00
|
|
|
function wp_list_widget_controls( $sidebar, $sidebar_name = '' ) {
|
2008-03-11 00:23:32 +01:00
|
|
|
add_filter( 'dynamic_sidebar_params', 'wp_list_widget_controls_dynamic_sidebar' );
|
2008-01-05 00:40:47 +01:00
|
|
|
|
2009-11-19 10:12:16 +01:00
|
|
|
$description = wp_sidebar_description( $sidebar );
|
|
|
|
|
2013-11-27 02:30:10 +01:00
|
|
|
echo '<div id="' . esc_attr( $sidebar ) . '" class="widgets-sortables">';
|
2013-12-04 17:31:10 +01:00
|
|
|
|
2013-11-27 02:30:10 +01:00
|
|
|
if ( $sidebar_name ) {
|
2018-03-07 23:27:31 +01:00
|
|
|
$add_to = sprintf(
|
2019-09-03 02:41:05 +02:00
|
|
|
/* translators: %s: Widgets sidebar name. */
|
2018-03-07 23:27:31 +01:00
|
|
|
__( 'Add to: %s' ),
|
|
|
|
$sidebar_name
|
|
|
|
);
|
2013-11-27 02:30:10 +01:00
|
|
|
?>
|
2018-03-07 23:27:31 +01:00
|
|
|
<div class="sidebar-name" data-add-to="<?php echo esc_attr( $add_to ); ?>">
|
2017-09-27 18:29:44 +02:00
|
|
|
<button type="button" class="handlediv hide-if-no-js" aria-expanded="true">
|
|
|
|
<span class="screen-reader-text"><?php echo esc_html( $sidebar_name ); ?></span>
|
|
|
|
<span class="toggle-indicator" aria-hidden="true"></span>
|
|
|
|
</button>
|
2015-10-10 18:34:25 +02:00
|
|
|
<h2><?php echo esc_html( $sidebar_name ); ?> <span class="spinner"></span></h2>
|
2013-11-27 02:30:10 +01:00
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ! empty( $description ) ) {
|
2015-09-06 09:59:24 +02:00
|
|
|
?>
|
|
|
|
<div class="sidebar-description">
|
|
|
|
<p class="description"><?php echo $description; ?></p>
|
|
|
|
</div>
|
|
|
|
<?php
|
2009-11-19 10:12:16 +01:00
|
|
|
}
|
|
|
|
|
2009-05-03 07:27:13 +02:00
|
|
|
dynamic_sidebar( $sidebar );
|
2013-11-27 02:30:10 +01:00
|
|
|
|
|
|
|
echo '</div>';
|
2008-01-05 00:40:47 +01:00
|
|
|
}
|
|
|
|
|
2008-09-17 02:40:10 +02:00
|
|
|
/**
|
2015-10-05 05:06:24 +02:00
|
|
|
* Retrieves the widget control arguments.
|
2008-09-17 02:40:10 +02:00
|
|
|
*
|
2010-12-01 20:24:38 +01:00
|
|
|
* @since 2.5.0
|
2008-09-17 02:40:10 +02:00
|
|
|
*
|
2015-05-28 23:41:30 +02:00
|
|
|
* @global array $wp_registered_widgets
|
|
|
|
*
|
2008-10-02 03:03:26 +02:00
|
|
|
* @param array $params
|
|
|
|
* @return array
|
2008-09-17 02:40:10 +02:00
|
|
|
*/
|
2008-03-11 00:23:32 +01:00
|
|
|
function wp_list_widget_controls_dynamic_sidebar( $params ) {
|
|
|
|
global $wp_registered_widgets;
|
|
|
|
static $i = 0;
|
2023-09-09 11:28:26 +02:00
|
|
|
++$i;
|
2008-03-11 00:23:32 +01:00
|
|
|
|
|
|
|
$widget_id = $params[0]['widget_id'];
|
2017-12-01 00:11:00 +01:00
|
|
|
$id = isset( $params[0]['_temp_id'] ) ? $params[0]['_temp_id'] : $widget_id;
|
|
|
|
$hidden = isset( $params[0]['_hide'] ) ? ' style="display:none;"' : '';
|
2008-03-11 00:23:32 +01:00
|
|
|
|
2010-11-14 16:50:02 +01:00
|
|
|
$params[0]['before_widget'] = "<div id='widget-{$i}_{$id}' class='widget'$hidden>";
|
2017-12-01 00:11:00 +01:00
|
|
|
$params[0]['after_widget'] = '</div>';
|
2020-01-29 01:45:18 +01:00
|
|
|
$params[0]['before_title'] = '%BEG_OF_TITLE%'; // Deprecated.
|
|
|
|
$params[0]['after_title'] = '%END_OF_TITLE%'; // Deprecated.
|
2019-09-15 13:41:55 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( is_callable( $wp_registered_widgets[ $widget_id ]['callback'] ) ) {
|
|
|
|
$wp_registered_widgets[ $widget_id ]['_callback'] = $wp_registered_widgets[ $widget_id ]['callback'];
|
|
|
|
$wp_registered_widgets[ $widget_id ]['callback'] = 'wp_widget_control';
|
2008-03-11 18:42:09 +01:00
|
|
|
}
|
2009-04-11 16:37:24 +02:00
|
|
|
|
2008-03-11 00:23:32 +01:00
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
|
2015-05-28 23:41:30 +02:00
|
|
|
/**
|
|
|
|
* @global array $wp_registered_widgets
|
|
|
|
*
|
|
|
|
* @param string $id_base
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
function next_widget_id_number( $id_base ) {
|
2009-04-11 16:37:24 +02:00
|
|
|
global $wp_registered_widgets;
|
2009-06-16 01:57:52 +02:00
|
|
|
$number = 1;
|
2009-04-11 16:37:24 +02:00
|
|
|
|
2009-06-16 01:57:52 +02:00
|
|
|
foreach ( $wp_registered_widgets as $widget_id => $widget ) {
|
2021-05-24 11:51:56 +02:00
|
|
|
if ( preg_match( '/' . preg_quote( $id_base, '/' ) . '-([0-9]+)$/', $widget_id, $matches ) ) {
|
2017-12-01 00:11:00 +01:00
|
|
|
$number = max( $number, $matches[1] );
|
|
|
|
}
|
2009-06-16 01:57:52 +02:00
|
|
|
}
|
2023-09-09 11:28:26 +02:00
|
|
|
++$number;
|
2009-04-11 16:37:24 +02:00
|
|
|
|
|
|
|
return $number;
|
|
|
|
}
|
|
|
|
|
2008-09-17 02:40:10 +02:00
|
|
|
/**
|
|
|
|
* Meta widget used to display the control form for a widget.
|
|
|
|
*
|
|
|
|
* Called from dynamic_sidebar().
|
|
|
|
*
|
2010-12-01 20:24:38 +01:00
|
|
|
* @since 2.5.0
|
2008-09-17 02:40:10 +02:00
|
|
|
*
|
2015-05-28 23:41:30 +02:00
|
|
|
* @global array $wp_registered_widgets
|
|
|
|
* @global array $wp_registered_widget_controls
|
|
|
|
* @global array $sidebars_widgets
|
|
|
|
*
|
2008-10-02 03:03:26 +02:00
|
|
|
* @param array $sidebar_args
|
|
|
|
* @return array
|
2008-01-05 00:40:47 +01:00
|
|
|
*/
|
2008-03-11 00:23:32 +01:00
|
|
|
function wp_widget_control( $sidebar_args ) {
|
2009-04-11 16:37:24 +02:00
|
|
|
global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets;
|
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
$widget_id = $sidebar_args['widget_id'];
|
|
|
|
$sidebar_id = isset( $sidebar_args['id'] ) ? $sidebar_args['id'] : false;
|
2020-04-05 05:02:11 +02:00
|
|
|
$key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[ $sidebar_id ], true ) : '-1'; // Position of widget in sidebar.
|
2017-12-01 00:11:00 +01:00
|
|
|
$control = isset( $wp_registered_widget_controls[ $widget_id ] ) ? $wp_registered_widget_controls[ $widget_id ] : array();
|
|
|
|
$widget = $wp_registered_widgets[ $widget_id ];
|
|
|
|
|
|
|
|
$id_format = $widget['id'];
|
|
|
|
$widget_number = isset( $control['params'][0]['number'] ) ? $control['params'][0]['number'] : '';
|
|
|
|
$id_base = isset( $control['id_base'] ) ? $control['id_base'] : $widget_id;
|
|
|
|
$width = isset( $control['width'] ) ? $control['width'] : '';
|
|
|
|
$height = isset( $control['height'] ) ? $control['height'] : '';
|
|
|
|
$multi_number = isset( $sidebar_args['_multi_num'] ) ? $sidebar_args['_multi_num'] : '';
|
|
|
|
$add_new = isset( $sidebar_args['_add'] ) ? $sidebar_args['_add'] : '';
|
|
|
|
|
|
|
|
$before_form = isset( $sidebar_args['before_form'] ) ? $sidebar_args['before_form'] : '<form method="post">';
|
|
|
|
$after_form = isset( $sidebar_args['after_form'] ) ? $sidebar_args['after_form'] : '</form>';
|
2015-09-25 23:02:27 +02:00
|
|
|
$before_widget_content = isset( $sidebar_args['before_widget_content'] ) ? $sidebar_args['before_widget_content'] : '<div class="widget-content">';
|
2017-12-01 00:11:00 +01:00
|
|
|
$after_widget_content = isset( $sidebar_args['after_widget_content'] ) ? $sidebar_args['after_widget_content'] : '</div>';
|
2015-09-25 23:02:27 +02:00
|
|
|
|
2009-04-20 12:58:50 +02:00
|
|
|
$query_arg = array( 'editwidget' => $widget['id'] );
|
|
|
|
if ( $add_new ) {
|
|
|
|
$query_arg['addnew'] = 1;
|
|
|
|
if ( $multi_number ) {
|
2017-12-01 00:11:00 +01:00
|
|
|
$query_arg['num'] = $multi_number;
|
2009-04-20 12:58:50 +02:00
|
|
|
$query_arg['base'] = $id_base;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$query_arg['sidebar'] = $sidebar_id;
|
2017-12-01 00:11:00 +01:00
|
|
|
$query_arg['key'] = $key;
|
2009-04-20 12:58:50 +02:00
|
|
|
}
|
|
|
|
|
2014-07-17 11:14:16 +02:00
|
|
|
/*
|
|
|
|
* We aren't showing a widget control, we're outputting a template
|
|
|
|
* for a multi-widget control.
|
|
|
|
*/
|
2020-05-16 20:42:12 +02:00
|
|
|
if ( isset( $sidebar_args['_display'] ) && 'template' === $sidebar_args['_display'] && $widget_number ) {
|
2020-01-29 01:45:18 +01:00
|
|
|
// number == -1 implies a template where id numbers are replaced by a generic '__i__'.
|
2008-01-05 00:40:47 +01:00
|
|
|
$control['params'][0]['number'] = -1;
|
2021-12-13 11:21:07 +01:00
|
|
|
// With id_base widget ID's are constructed like {$id_base}-{$id_number}.
|
2017-12-01 00:11:00 +01:00
|
|
|
if ( isset( $control['id_base'] ) ) {
|
2009-04-11 16:37:24 +02:00
|
|
|
$id_format = $control['id_base'] . '-__i__';
|
2017-12-01 00:11:00 +01:00
|
|
|
}
|
2008-03-11 00:23:32 +01:00
|
|
|
}
|
2009-04-11 16:37:24 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
$wp_registered_widgets[ $widget_id ]['callback'] = $wp_registered_widgets[ $widget_id ]['_callback'];
|
|
|
|
unset( $wp_registered_widgets[ $widget_id ]['_callback'] );
|
2008-01-05 00:40:47 +01:00
|
|
|
|
2009-05-18 17:11:07 +02:00
|
|
|
$widget_title = esc_html( strip_tags( $sidebar_args['widget_name'] ) );
|
2017-12-01 00:11:00 +01:00
|
|
|
$has_form = 'noform';
|
2008-04-17 22:36:59 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
echo $sidebar_args['before_widget'];
|
|
|
|
?>
|
2009-04-20 12:58:50 +02:00
|
|
|
<div class="widget-top">
|
|
|
|
<div class="widget-title-action">
|
2017-04-19 23:14:44 +02:00
|
|
|
<button type="button" class="widget-action hide-if-no-js" aria-expanded="false">
|
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 19:13:59 +02:00
|
|
|
<span class="screen-reader-text edit">
|
|
|
|
<?php
|
I18N: Mark screen reader strings as such with translator comments.
This aims to provide better context for translators and make it easier to determine that some strings contain hidden accessibility text and are not displayed in the UI.
Props kebbet, mercime, pavelevap, ocean90, swissspidy, Chouby, jipmoors, afercia, desrosj, costdev, audrasjb, SergeyBiryukov.
Fixes #29748.
Built from https://develop.svn.wordpress.org/trunk@55276
git-svn-id: http://core.svn.wordpress.org/trunk@54809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 18:10:21 +01:00
|
|
|
/* translators: Hidden accessibility text. %s: Widget title. */
|
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 19:13:59 +02:00
|
|
|
printf( __( 'Edit widget: %s' ), $widget_title );
|
|
|
|
?>
|
|
|
|
</span>
|
|
|
|
<span class="screen-reader-text add">
|
|
|
|
<?php
|
I18N: Mark screen reader strings as such with translator comments.
This aims to provide better context for translators and make it easier to determine that some strings contain hidden accessibility text and are not displayed in the UI.
Props kebbet, mercime, pavelevap, ocean90, swissspidy, Chouby, jipmoors, afercia, desrosj, costdev, audrasjb, SergeyBiryukov.
Fixes #29748.
Built from https://develop.svn.wordpress.org/trunk@55276
git-svn-id: http://core.svn.wordpress.org/trunk@54809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 18:10:21 +01:00
|
|
|
/* translators: Hidden accessibility text. %s: Widget title. */
|
I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.
Includes minor code layout fixes.
Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!
Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926
git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 19:13:59 +02:00
|
|
|
printf( __( 'Add widget: %s' ), $widget_title );
|
|
|
|
?>
|
|
|
|
</span>
|
2017-04-19 23:14:44 +02:00
|
|
|
<span class="toggle-indicator" aria-hidden="true"></span>
|
|
|
|
</button>
|
2012-07-27 05:33:38 +02:00
|
|
|
<a class="widget-control-edit hide-if-js" href="<?php echo esc_url( add_query_arg( $query_arg ) ); ?>">
|
2012-07-27 05:56:27 +02:00
|
|
|
<span class="edit"><?php _ex( 'Edit', 'widget' ); ?></span>
|
|
|
|
<span class="add"><?php _ex( 'Add', 'widget' ); ?></span>
|
2012-07-27 05:33:38 +02:00
|
|
|
<span class="screen-reader-text"><?php echo $widget_title; ?></span>
|
|
|
|
</a>
|
2009-04-20 12:58:50 +02:00
|
|
|
</div>
|
2015-10-10 18:34:25 +02:00
|
|
|
<div class="widget-title"><h3><?php echo $widget_title; ?><span class="in-widget-title"></span></h3></div>
|
2009-04-20 12:58:50 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="widget-inside">
|
2015-09-25 23:02:27 +02:00
|
|
|
<?php echo $before_form; ?>
|
|
|
|
<?php echo $before_widget_content; ?>
|
|
|
|
<?php
|
|
|
|
if ( isset( $control['callback'] ) ) {
|
2009-04-20 12:58:50 +02:00
|
|
|
$has_form = call_user_func_array( $control['callback'], $control['params'] );
|
2015-09-25 23:02:27 +02:00
|
|
|
} else {
|
2017-12-01 00:11:00 +01:00
|
|
|
echo "\t\t<p>" . __( 'There are no options for this widget.' ) . "</p>\n";
|
2015-09-25 23:02:27 +02:00
|
|
|
}
|
2017-11-23 05:09:49 +01:00
|
|
|
|
|
|
|
$noform_class = '';
|
|
|
|
if ( 'noform' === $has_form ) {
|
|
|
|
$noform_class = ' widget-control-noform';
|
|
|
|
}
|
2015-09-25 23:02:27 +02:00
|
|
|
?>
|
|
|
|
<?php echo $after_widget_content; ?>
|
2017-12-01 00:11:00 +01:00
|
|
|
<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $id_format ); ?>" />
|
|
|
|
<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" />
|
|
|
|
<input type="hidden" name="widget-width" class="widget-width" value="<?php echo esc_attr( $width ); ?>" />
|
|
|
|
<input type="hidden" name="widget-height" class="widget-height" value="<?php echo esc_attr( $height ); ?>" />
|
|
|
|
<input type="hidden" name="widget_number" class="widget_number" value="<?php echo esc_attr( $widget_number ); ?>" />
|
|
|
|
<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" />
|
|
|
|
<input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr( $add_new ); ?>" />
|
2009-04-20 12:58:50 +02:00
|
|
|
|
|
|
|
<div class="widget-control-actions">
|
2009-05-31 13:34:08 +02:00
|
|
|
<div class="alignleft">
|
2017-09-08 21:11:43 +02:00
|
|
|
<button type="button" class="button-link button-link-delete widget-control-remove"><?php _e( 'Delete' ); ?></button>
|
|
|
|
<span class="widget-control-close-wrapper">
|
2020-10-09 17:53:08 +02:00
|
|
|
| <button type="button" class="button-link widget-control-close"><?php _e( 'Done' ); ?></button>
|
2017-09-08 21:11:43 +02:00
|
|
|
</span>
|
2009-05-31 13:34:08 +02:00
|
|
|
</div>
|
2017-11-23 05:09:49 +01:00
|
|
|
<div class="alignright<?php echo $noform_class; ?>">
|
2016-09-28 21:54:28 +02:00
|
|
|
<?php submit_button( __( 'Save' ), 'primary widget-control-save right', 'savewidget', false, array( 'id' => 'widget-' . esc_attr( $id_format ) . '-savewidget' ) ); ?>
|
2012-09-26 21:57:44 +02:00
|
|
|
<span class="spinner"></span>
|
2009-05-31 13:34:08 +02:00
|
|
|
</div>
|
2009-04-20 12:58:50 +02:00
|
|
|
<br class="clear" />
|
|
|
|
</div>
|
2015-09-25 23:02:27 +02:00
|
|
|
<?php echo $after_form; ?>
|
2009-05-03 07:27:13 +02:00
|
|
|
</div>
|
2009-04-20 12:58:50 +02:00
|
|
|
|
|
|
|
<div class="widget-description">
|
2019-07-01 14:52:01 +02:00
|
|
|
<?php
|
|
|
|
$widget_description = wp_widget_description( $widget_id );
|
|
|
|
echo ( $widget_description ) ? "$widget_description\n" : "$widget_title\n";
|
|
|
|
?>
|
2009-04-20 12:58:50 +02:00
|
|
|
</div>
|
2018-08-17 03:51:36 +02:00
|
|
|
<?php
|
2009-04-11 16:37:24 +02:00
|
|
|
echo $sidebar_args['after_widget'];
|
2013-12-23 01:45:11 +01:00
|
|
|
|
2009-04-11 16:37:24 +02:00
|
|
|
return $sidebar_args;
|
2008-01-05 00:40:47 +01:00
|
|
|
}
|
2015-09-10 23:22:23 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $classes
|
|
|
|
* @return string
|
|
|
|
*/
|
2017-12-01 00:11:00 +01:00
|
|
|
function wp_widgets_access_body_class( $classes ) {
|
2015-09-10 23:22:23 +02:00
|
|
|
return "$classes widgets_access ";
|
2016-09-28 21:54:28 +02:00
|
|
|
}
|