' . __('An error has occured. Please reload the page and try again.') . '
'.__('Title').' | '.__('Date').' | '.__('Status').' | |
---|---|---|---|
'.esc_html( $time ).' | '.esc_html( $stat ).' |
' . __('An error has occured. Please reload the page and try again.') . '
'; $sidebars = wp_get_sidebars_widgets(); $sidebar = isset($sidebars[$sidebar_id]) ? $sidebars[$sidebar_id] : array(); // delete if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) { if ( !isset($wp_registered_widgets[$widget_id]) ) die($error); $sidebar = array_diff( $sidebar, array($widget_id) ); $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1'); } elseif ( $settings && preg_match( '/__i__|%i%/', key($settings) ) ) { if ( !$multi_number ) die($error); $_POST['widget-' . $id_base] = array( $multi_number => array_shift($settings) ); $widget_id = $id_base . '-' . $multi_number; $sidebar[] = $widget_id; } $_POST['widget-id'] = $sidebar; foreach ( (array) $wp_registered_widget_updates as $name => $control ) { if ( $name == $id_base ) { if ( !is_callable( $control['callback'] ) ) continue; ob_start(); call_user_func_array( $control['callback'], $control['params'] ); ob_end_clean(); break; } } if ( isset($_POST['delete_widget']) && $_POST['delete_widget'] ) { $sidebars[$sidebar_id] = $sidebar; wp_set_sidebars_widgets($sidebars); echo "deleted:$widget_id"; die(); } if ( !empty($_POST['add_new']) ) die(); if ( $form = $wp_registered_widget_controls[$widget_id] ) call_user_func_array( $form['callback'], $form['params'] ); die(); break; case 'image-editor': $attachment_id = intval($_POST['postid']); if ( empty($attachment_id) || !current_user_can('edit_post', $attachment_id) ) die('-1'); check_ajax_referer( "image_editor-$attachment_id" ); include_once( ABSPATH . 'wp-admin/includes/image-edit.php' ); $msg = false; switch ( $_POST['do'] ) { case 'save' : $msg = wp_save_image($attachment_id); $msg = json_encode($msg); die($msg); break; case 'scale' : $msg = wp_save_image($attachment_id); break; case 'restore' : $msg = wp_restore_image($attachment_id); break; } wp_image_editor($attachment_id, $msg); die(); break; case 'set-post-thumbnail': $post_id = intval( $_POST['post_id'] ); if ( !current_user_can( 'edit_post', $post_id ) ) die( '-1' ); $thumbnail_id = intval( $_POST['thumbnail_id'] ); if ( $thumbnail_id == '-1' ) { delete_post_meta( $post_id, '_thumbnail_id' ); die( _wp_post_thumbnail_html() ); } if ( $thumbnail_id && get_post( $thumbnail_id ) ) { $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' ); if ( !empty( $thumbnail_html ) ) { update_post_meta( $post_id, '_thumbnail_id', $thumbnail_id ); die( _wp_post_thumbnail_html( $thumbnail_id ) ); } } die( '0' ); default : do_action( 'wp_ajax_' . $_POST['action'] ); die('0'); break; endswitch; ?>