Beispiel #1
0
     if (!current_user_can('edit_theme_options')) {
         die('-1');
     }
     require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
     _wp_ajax_menu_quick_search($_REQUEST);
     exit;
     break;
 case 'wp-link-ajax':
     check_ajax_referer('internal-linking', '_ajax_linking_nonce');
     $args = array();
     if (isset($_POST['search'])) {
         $args['s'] = stripslashes($_POST['search']);
     }
     $args['pagenum'] = !empty($_POST['page']) ? absint($_POST['page']) : 1;
     require ABSPATH . WPINC . '/class-wp-editor.php';
     $results = WP_Editor::wp_link_query($args);
     if (!isset($results)) {
         die('0');
     }
     echo json_encode($results);
     echo "\n";
     exit;
     break;
 case 'menu-locations-save':
     if (!current_user_can('edit_theme_options')) {
         die('-1');
     }
     check_ajax_referer('add-menu_item', 'menu-settings-column-nonce');
     if (!isset($_POST['menu-locations'])) {
         die('0');
     }
Beispiel #2
0
/**
 * Find out which editor should be displayed
 *
 * @see WP_Editor::wp_default_editor()
 * @since 2.5.0
 * @deprecated 3.5
 *
 * @return bool
 */
function wp_default_editor()
{
    _deprecated_function(__FUNCTION__, '3.3');
    global $wp_editor;
    if (!is_a($wp_editor, 'WP_Editor')) {
        require_once ABSPATH . WPINC . '/class-wp-editor.php';
        $wp_editor = new WP_Editor();
    }
    return $wp_editor->wp_default_editor();
}
/**
 * Loads and initializes WP_Editor class if needed, passes the settings for an instance of the editor
 *
 * @see wp-includes/class-wp-editor.php
 * @since 3.3
 *
 * @param string $content Initial content for the editor.
 * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE.
 * @param array $settings See WP_Editor::editor().
 */
function wp_editor($content, $editor_id, $settings = array())
{
    global $wp_editor;
    if (!is_a($wp_editor, 'WP_Editor')) {
        require ABSPATH . WPINC . '/class-wp-editor.php';
        $wp_editor = new WP_Editor();
    }
    $wp_editor->editor($content, $editor_id, $settings);
}