function fb_enqueue_wp_pointer($hook_suffix) { // Don't run on WP < 3.3 if (get_bloginfo('version') < '3.3') { return; } //Define Variables $screen = get_current_screen(); $screen_id = $screen->id; $enqueue = FALSE; $admin_bar = get_user_setting('hndtst_email_pointer', 0); // check settings on user // check if admin bar is active and default filter for wp pointer is true if (!$admin_bar && apply_filters('show_wp_pointer_admin_bar', TRUE) && $screen_id == 'testimonial') { $enqueue = TRUE; add_action('admin_print_footer_scripts', 'hntst_email_pointer_content'); } // in true, include the scripts if ($enqueue) { wp_enqueue_style('wp-pointer'); wp_enqueue_script('wp-pointer'); wp_enqueue_script('utils'); // for user settings } }
function print_welcome_block($block = true, $config = "", $side, $index) { global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES; $id = "user_welcome"; $title = $pgv_lang["welcome"] . " " . getUserFullName(PGV_USER_ID); $content = "<table class=\"blockcontent\" cellspacing=\"0\" cellpadding=\"0\" style=\" width: 100%; direction:ltr;\"><tr>"; $content .= "<td class=\"tab_active_bottom\" colspan=\"3\" ></td></tr><tr>"; if (get_user_setting(PGV_USER_ID, 'editaccount') == 'Y') { $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"edituser.php\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["mygedview"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["myuserdata"] . "\" title=\"" . $pgv_lang["myuserdata"] . "\" /><br />" . $pgv_lang["myuserdata"] . "</a></td>"; } if (PGV_USER_GEDCOM_ID) { $content .= "<td class=\"center details2\" style=\" width: 34%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"" . encode_url("pedigree.php?rootid=" . PGV_USER_GEDCOM_ID) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["pedigree"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["my_pedigree"] . "\" title=\"" . $pgv_lang["my_pedigree"] . "\" /><br />" . $pgv_lang["my_pedigree"] . "</a></td>"; $content .= "<td class=\"center details2\" style=\" width: 33%; clear: none; vertical-align: top; margin-top: 2px;\"><a href=\"" . encode_url("individual.php?pid=" . PGV_USER_GEDCOM_ID) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["indis"]["small"] . "\" border=\"0\" alt=\"" . $pgv_lang["my_indi"] . "\" title=\"" . $pgv_lang["my_indi"] . "\" /><br />" . $pgv_lang["my_indi"] . "</a></td>"; } $content .= "</tr><tr><td class=\"center\" colspan=\"3\">"; $content .= print_help_link("mygedview_customize_help", "qm", "", false, true); $content .= "<a href=\"javascript:;\" onclick=\"window.open('" . encode_url("index_edit.php?name=" . PGV_USER_NAME . "&ctype=user") . "', '_blank', 'top=50,left=10,width=600,height=350,scrollbars=1,resizable=1');\">" . $pgv_lang["customize_page"] . "</a>"; $content .= "<br />" . format_timestamp(client_time()); $content .= "</td>"; $content .= "</tr></table>"; global $THEME_DIR; if ($block) { require $THEME_DIR . 'templates/block_small_temp.php'; } else { require $THEME_DIR . 'templates/block_main_temp.php'; } }
function test_set_user_setting_strip_asterisks() { $foo = get_user_setting('foo'); $this->assertEmpty($foo); $this->set_user_setting('foo', 'foo*bar*baz'); $this->assertEquals('foobarbaz', get_user_setting('foo')); }
/** * Get the editor size * * @return int */ protected static function get_height() { $cookie = (int) get_user_setting('ed_size'); // Upgrade an old TinyMCE cookie if it is still around, and the new one isn't. if (!$cookie && isset($_COOKIE['TinyMCE_content_size'])) { parse_str($_COOKIE['TinyMCE_content_size'], $cookie); $cookie = $cookie['ch']; } return $cookie; }
function bizz_admin_body_class() { $admin_body_class = ''; if (get_user_setting('bfold') == 'f') { $admin_body_class .= ' bfolded'; } if (!get_user_setting('bunfold')) { $admin_body_class .= ' auto-bfold'; } return isset($_REQUEST['tab']) ? $admin_body_class : ''; }
/** * * @global string $usersearch * @global string $role * @global wpdb $wpdb * @global string $mode */ public function prepare_items() { global $usersearch, $role, $wpdb, $mode; $usersearch = isset($_REQUEST['s']) ? wp_unslash(trim($_REQUEST['s'])) : ''; $users_per_page = $this->get_items_per_page('users_network_per_page'); $role = isset($_REQUEST['role']) ? $_REQUEST['role'] : ''; $paged = $this->get_pagenum(); $args = array('number' => $users_per_page, 'offset' => ($paged - 1) * $users_per_page, 'search' => $usersearch, 'blog_id' => 0, 'fields' => 'all_with_meta'); if (wp_is_large_network('users')) { $args['search'] = ltrim($args['search'], '*'); } else { if ('' !== $args['search']) { $args['search'] = trim($args['search'], '*'); $args['search'] = '*' . $args['search'] . '*'; } } if ($role === 'super') { $logins = implode("', '", get_super_admins()); $args['include'] = $wpdb->get_col("SELECT ID FROM {$wpdb->users} WHERE user_login IN ('{$logins}')"); } /* * If the network is large and a search is not being performed, * show only the latest users with no paging in order to avoid * expensive count queries. */ if (!$usersearch && wp_is_large_network('users')) { if (!isset($_REQUEST['orderby'])) { $_GET['orderby'] = $_REQUEST['orderby'] = 'id'; } if (!isset($_REQUEST['order'])) { $_GET['order'] = $_REQUEST['order'] = 'DESC'; } $args['count_total'] = false; } if (isset($_REQUEST['orderby'])) { $args['orderby'] = $_REQUEST['orderby']; } if (isset($_REQUEST['order'])) { $args['order'] = $_REQUEST['order']; } if (!empty($_REQUEST['mode'])) { $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; set_user_setting('network_users_list_mode', $mode); } else { $mode = get_user_setting('network_users_list_mode', 'list'); } /** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */ $args = apply_filters('users_list_table_query_args', $args); // Query the user IDs for this page $wp_user_search = new WP_User_Query($args); $this->items = $wp_user_search->get_results(); $this->set_pagination_args(array('total_items' => $wp_user_search->get_total(), 'per_page' => $users_per_page)); }
function add_admin_bar_menu_entry(&$wp_admin_bar) { $wp_admin_bar->add_menu(array('id' => 'builder', 'title' => 'Builder', 'href' => admin_url('admin.php?page=ithemes-builder-theme'))); if (!empty($this->_layout_id)) { $wp_admin_bar->add_menu(array('parent' => 'builder', 'id' => 'builder_edit_layout', 'title' => sprintf(__('Edit Layout (%s)', 'it-l10n-Builder-Cohen'), $this->_layout_description), 'href' => admin_url('admin.php?page=layout-editor&editor_tab=layouts&layout=' . $this->_layout_id))); if ('on' != get_user_setting('widgets_access')) { $wp_admin_bar->add_menu(array('parent' => 'builder', 'id' => 'builder_edit_widgets', 'title' => __('Manage Widgets for this Layout', 'it-l10n-Builder-Cohen'), 'href' => admin_url('widgets.php?builder_layout_id=' . $this->_layout_id))); } } $wp_admin_bar->add_menu(array('parent' => 'builder', 'id' => 'builder_edit_settings', 'title' => __('Modify Builder Settings', 'it-l10n-Builder-Cohen'), 'href' => admin_url('admin.php?page=theme-settings'))); do_action_ref_array('builder_add_admin_bar_menu_entries', array(&$wp_admin_bar)); }
function media_upload_gallery_form($errors) { global $redir_tab, $type; $redir_tab = 'gallery'; media_upload_header(); $post_id = intval($_REQUEST['post_id']); $form_action_url = admin_url("media-upload.php?type={$type}&tab=gallery&post_id={$post_id}"); $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type); $form_class = 'media-upload-form validate'; if (get_user_setting('uploader')) { $form_class .= ' html-uploader'; } require_once dirname(__FILE__) . '/view/gallery_form.php'; }
/** * Private, since it is a singleton. * We directly initialize sidebar options when class is created. */ private function __construct() { /** * ID of the WP-Pointer used to introduce the plugin upon activation * * ========== Pointer ========== * Internal ID: wpmudcs1 [WPMUDev CustomSidebars 1] * Point at: #menu-appearance (Appearance menu item) * Title: Custom Sidebars * Description: Create and edit custom sidebars in your widget screen! * ------------------------------------------------------------------------- */ WDev()->pointer('wpmudcs1', '#menu-appearance', __('Custom Sidebars', CSB_LANG), sprintf(__('Now you can create and edit custom sidebars in your ' . '<a href="%1$s">Widgets screen</a>!', CSB_LANG), admin_url('widgets.php'))); // Find out if the page is loaded in accessibility mode. $flag = isset($_GET['widgets-access']) ? $_GET['widgets-access'] : get_user_setting('widgets_access'); self::$accessibility_mode = 'on' == $flag; // We don't support accessibility mode. Display a note to the user. if (true === self::$accessibility_mode) { WDev()->message(sprintf(__('<strong>Accessibility mode is not supported by the %1$s plugin.</strong><br /><a href="%2$s">Click here</a> to disable accessibility mode and use the %1$s plugin!', CSB_LANG), 'Custom Sidebars', admin_url('widgets.php?widgets-access=off')), 'err', 'widgets'); } else { // Load javascripts/css files WDev()->add_ui('core', 'widgets.php'); WDev()->add_ui('scrollbar', 'widgets.php'); WDev()->add_ui('select', 'widgets.php'); WDev()->add_ui(CSB_JS_URL . 'cs.min.js', 'widgets.php'); WDev()->add_ui(CSB_CSS_URL . 'cs.css', 'widgets.php'); // AJAX actions add_action('wp_ajax_cs-ajax', array($this, 'ajax_handler')); // Extensions use this hook to initialize themselfs. do_action('cs_init'); // Display a message after import. if (!empty($_GET['cs-msg'])) { $msg = base64_decode($_GET['cs-msg']); // Prevent XSS attacks... $kses_args = array('br' => array(), 'b' => array(), 'strong' => array(), 'i' => array(), 'em' => array()); $msg = wp_kses($msg, $kses_args); if (!empty($msg)) { WDev()->message($msg); } } // Free version only add_action('in_widget_form', array($this, 'in_widget_form'), 10, 1); } }
/** * Creates the root elements for the GRAMPS XML file. * * The methods adds all the root elements and appends them to a DOMDocument. */ function begin_xml() { global $pgv_lang, $factarray; //, $eventsArray, $dom, $ePeople, $this->eFams, $eSources, $ePlaces, $eObject; $user = PGV_USER_NAME; $this->dom = new DomDocument("1.0", "UTF-8"); $this->dom->formatOutput = true; $eRoot = $this->dom->createElementNS("http://gramps-project.org/xml/1.1.0/", "database"); $eRoot = $this->dom->appendChild($eRoot); $eHeader = $this->dom->createElement("header"); $eHeader = $eRoot->appendChild($eHeader); $eCreated = $this->dom->createElement("created"); $eCreated = $eHeader->appendChild($eCreated); $eCreated->setAttribute("date", date("Y-m-d")); $eCreated->setAttribute("version", "1.1.2.6"); $eResearcher = $this->dom->createElement("researcher"); $eResname = $this->dom->createElement("resname"); $etResname = $this->dom->createTextNode(getUserFullName($user)); $etResname = $eResname->appendChild($etResname); $eResname = $eResearcher->appendChild($eResname); $eResemail = $this->dom->createElement("resemail"); $etResemail = $this->dom->createTextNode(get_user_setting($user, 'email')); $etResemail = $eResemail->appendChild($etResemail); $eResemail = $eResearcher->appendChild($eResemail); $eResearcher = $eHeader->appendChild($eResearcher); $this->eEvents = $this->dom->createElement("events"); $this->eEvents = $eRoot->appendChild($this->eEvents); $this->ePeople = $this->dom->createElement("people"); $this->ePeople = $eRoot->appendChild($this->ePeople); $this->eFams = $this->dom->createElement("families"); $this->eFams = $eRoot->appendChild($this->eFams); $this->eSources = $this->dom->createElement("sources"); $this->eSources = $eRoot->appendChild($this->eSources); $this->ePlaces = $this->dom->createElement("places"); $this->ePlaces = $eRoot->appendChild($this->ePlaces); $this->eObject = $this->dom->createElement("objects"); $this->eObject = $eRoot->appendChild($this->eObject); }
/** * * @global array $avail_post_stati * @global WP_Query $wp_query * @global int $per_page * @global string $mode */ public function prepare_items() { global $avail_post_stati, $wp_query, $per_page, $mode; // is going to call wp() $avail_post_stati = wp_edit_posts_query(); $this->set_hierarchical_display(is_post_type_hierarchical($this->screen->post_type) && 'menu_order title' === $wp_query->query['orderby']); $post_type = $this->screen->post_type; $per_page = $this->get_items_per_page('edit_' . $post_type . '_per_page'); /** This filter is documented in wp-admin/includes/post.php */ $per_page = apply_filters('edit_posts_per_page', $per_page, $post_type); if ($this->hierarchical_display) { $total_items = $wp_query->post_count; } elseif ($wp_query->found_posts || $this->get_pagenum() === 1) { $total_items = $wp_query->found_posts; } else { $post_counts = (array) wp_count_posts($post_type, 'readable'); if (isset($_REQUEST['post_status']) && in_array($_REQUEST['post_status'], $avail_post_stati)) { $total_items = $post_counts[$_REQUEST['post_status']]; } elseif (isset($_REQUEST['show_sticky']) && $_REQUEST['show_sticky']) { $total_items = $this->sticky_posts_count; } elseif (isset($_GET['author']) && $_GET['author'] == get_current_user_id()) { $total_items = $this->user_posts_count; } else { $total_items = array_sum($post_counts); // Subtract post types that are not included in the admin all list. foreach (get_post_stati(array('show_in_admin_all_list' => false)) as $state) { $total_items -= $post_counts[$state]; } } } if (!empty($_REQUEST['mode'])) { $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; set_user_setting('posts_list_mode', $mode); } else { $mode = get_user_setting('posts_list_mode', 'list'); } $this->is_trash = isset($_REQUEST['post_status']) && $_REQUEST['post_status'] === 'trash'; $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page)); }
<?php /** * Widgets administration panel. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once dirname(__FILE__) . '/admin.php'; /** WordPress Administration Widgets API */ require_once ABSPATH . 'wp-admin/includes/widgets.php'; if (!current_user_can('edit_theme_options')) { wp_die(__('Cheatin’ uh?'), 403); } $widgets_access = get_user_setting('widgets_access'); if (isset($_GET['widgets-access'])) { $widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off'; set_user_setting('widgets_access', $widgets_access); } function wp_widgets_access_body_class($classes) { return "{$classes} widgets_access "; } if ('on' == $widgets_access) { add_filter('admin_body_class', 'wp_widgets_access_body_class'); } else { wp_enqueue_script('admin-widgets'); if (wp_is_mobile()) { wp_enqueue_script('jquery-touch-punch'); }
/** * * @global array $avail_post_stati * @global WP_Query $wp_query * @global int $per_page * @global string $mode */ public function prepare_items() { global $avail_post_stati, $wp_query, $per_page, $mode; $avail_post_stati = wp_edit_posts_query(); $this->set_hierarchical_display(is_post_type_hierarchical($this->screen->post_type) && 'menu_order title' == $wp_query->query['orderby']); $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts; $post_type = $this->screen->post_type; $per_page = $this->get_items_per_page('edit_' . $post_type . '_per_page'); /** This filter is documented in wp-admin/includes/post.php */ $per_page = apply_filters('edit_posts_per_page', $per_page, $post_type); if ($this->hierarchical_display) { $total_pages = ceil($total_items / $per_page); } else { $total_pages = $wp_query->max_num_pages; } if (!empty($_REQUEST['mode'])) { $mode = $_REQUEST['mode'] == 'excerpt' ? 'excerpt' : 'list'; set_user_setting('posts_list_mode', $mode); } else { $mode = get_user_setting('posts_list_mode', 'list'); } $this->is_trash = isset($_REQUEST['post_status']) && $_REQUEST['post_status'] == 'trash'; $this->set_pagination_args(array('total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page)); }
/** * Add the custom sizes to the image sizes in article edition * * @access public * @param array $form_fields * @param object $post * @return void * @author Nicolas Juen * @author Additional Image Sizes (zui) */ public function sizesInForm($form_fields, $post) { // Protect from being view in Media editor where there are no sizes if (isset($form_fields['image-size'])) { $out = NULL; $size_names = array(); $sizes_custom = get_option(SIS_OPTION); if (is_array($sizes_custom)) { foreach ($sizes_custom as $key => $value) { if (isset($value['s']) && $value['s'] == 1) { $size_names[$key] = $this->_getThumbnailName($key); } } } foreach ($size_names as $size => $label) { $downsize = image_downsize($post->ID, $size); // is this size selectable? $enabled = $downsize[3] || 'full' == $size; $css_id = "image-size-{$size}-{$post->ID}"; // We must do a clumsy search of the existing html to determine is something has been checked yet if (FALSE === strpos('checked="checked"', $form_fields['image-size']['html'])) { if (empty($check)) { $check = get_user_setting('imgsize'); } // See if they checked a custom size last time $checked = ''; // if this size is the default but that's not available, don't select it if ($size == $check || str_replace(" ", "", $size) == $check) { if ($enabled) { $checked = " checked='checked'"; } else { $check = ''; } } elseif (!$check && $enabled && 'thumbnail' != $size) { // if $check is not enabled, default to the first available size that's bigger than a thumbnail $check = $size; $checked = " checked='checked'"; } } $html = "<div class='image-size-item' style='min-height: 50px; margin-top: 18px;'><input type='radio' " . disabled($enabled, false, false) . "name='attachments[{$post->ID}][image-size]' id='{$css_id}' value='{$size}'{$checked} />"; $html .= "<label for='{$css_id}'>{$label}</label>"; // only show the dimensions if that choice is available if ($enabled) { $html .= " <label for='{$css_id}' class='help'>" . sprintf("(%d × %d)", $downsize[1], $downsize[2]) . "</label>"; } $html .= '</div>'; $out .= $html; } $form_fields['image-size']['html'] .= $out; } // End protect from Media editor return $form_fields; }
/** * Displays the checkbox to scale images. * * @since 3.3.0 */ function media_upload_max_image_resize() { $checked = get_user_setting('upload_resize') ? ' checked="true"' : ''; $a = $end = ''; if (current_user_can('manage_options')) { $a = '<a href="' . esc_url(admin_url('options-media.php')) . '" target="_blank">'; $end = '</a>'; } ?> <p class="hide-if-no-js"><label> <input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> /> <?php /* translators: %1$s is link start tag, %2$s is link end tag, %3$d is width, %4$d is height*/ printf(__('Scale images to match the large size selected in %1$simage options%2$s (%3$d × %4$d).'), $a, $end, (int) get_option('large_size_w', '1024'), (int) get_option('large_size_h', '1024')); ?> </label></p> <?php }
function default_password_nag_handler($errors = false) { global $user_ID; if (!get_user_option('default_password_nag')) { //Short circuit it. return; } //get_user_setting = JS saved UI setting. else no-js-falback code. if ('hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag']) { delete_user_setting('default_password_nag'); update_user_option($user_ID, 'default_password_nag', false, true); } }
/** * Find out which editor should be displayed by default. * * Works out which of the two editors to display as the current editor for a * user. The 'html' setting is for the "Text" editor tab. * * @since 2.5.0 * * @return string Either 'tinymce', or 'html', or 'test' */ function wp_default_editor() { $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults if (wp_get_current_user()) { // look for cookie $ed = get_user_setting('editor', 'tinymce'); $r = in_array($ed, array('tinymce', 'html', 'test')) ? $ed : $r; } /** * Filter which editor should be displayed by default. * * @since 2.5.0 * * @param array $r An array of editors. Accepts 'tinymce', 'html', 'test'. */ return apply_filters('wp_default_editor', $r); }
public function show_screen_options() { global $wp_meta_boxes; if (is_bool($this->_show_screen_options)) { return $this->_show_screen_options; } $columns = get_column_headers($this); $show_screen = !empty($wp_meta_boxes[$this->id]) || $columns || $this->get_option('per_page'); switch ($this->base) { case 'widgets': $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n"; break; case 'post': $expand = '<div class="editor-expand hidden"><label for="editor-expand-toggle">'; $expand .= '<input type="checkbox" id="editor-expand-toggle"' . checked(get_user_setting('editor_expand', 'on'), 'on', false) . ' />'; $expand .= __('Enable full-height editor and distraction-free functionality.') . '</label></div>'; $this->_screen_settings = $expand; break; default: $this->_screen_settings = ''; break; } /** * Filter the screen settings text displayed in the Screen Options tab. * * This filter is currently only used on the Widgets screen to enable * accessibility mode. * * @since 3.0.0 * * @param string $screen_settings Screen settings. * @param WP_Screen $this WP_Screen object. */ $this->_screen_settings = apply_filters('screen_settings', $this->_screen_settings, $this); if ($this->_screen_settings || $this->_options) { $show_screen = true; } /** * Filter whether to show the Screen Options tab. * * @since 3.2.0 * * @param bool $show_screen Whether to show Screen Options tab. * Default true. * @param WP_Screen $this Current WP_Screen instance. */ $this->_show_screen_options = apply_filters('screen_options_show_screen', $show_screen, $this); return $this->_show_screen_options; }
/** * show_advanced_itesm function. * * @access private * @return boolean */ private function show_advanced_items() { $response = false; $setting = get_user_setting('beansidebarsshowadvanced', '0'); if ($setting == '1') { $response = true; } return $response; }
global $post_type, $post_type_object, $post; wp_enqueue_script('post'); $_wp_editor_expand = $_content_editor_dfw = false; /** * Filters whether to enable the 'expand' functionality in the post editor. * * @since 4.0.0 * @since 4.1.0 Added the `$post_type` parameter. * * @param bool $expand Whether to enable the 'expand' functionality. Default true. * @param string $post_type Post type. */ if (post_type_supports($post_type, 'editor') && !wp_is_mobile() && !($is_IE && preg_match('/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'])) && apply_filters('wp_editor_expand', true, $post_type)) { wp_enqueue_script('editor-expand'); $_content_editor_dfw = true; $_wp_editor_expand = get_user_setting('editor_expand', 'on') === 'on'; } if (wp_is_mobile()) { wp_enqueue_script('jquery-touch-punch'); } /** * Post ID global * @name $post_ID * @var int */ $post_ID = isset($post_ID) ? (int) $post_ID : 0; $user_ID = isset($user_ID) ? (int) $user_ID : 0; $action = isset($action) ? $action : ''; if ($post_ID == get_option('page_for_posts') && empty($post->post_content)) { add_action('edit_form_after_title', '_wp_posts_page_notice'); remove_post_type_support($post_type, 'editor');
/** * Modified from /wp-admin/includes/internal-linking.php, function wp_link_dialog() * Dialog for internal linking. * * @since 3.1.0 */ function insertPages_wp_tinymce_dialog() { // If wp_editor() is being called outside of an admin context, // required dependencies for Insert Pages will be missing (e.g., // wp-admin/includes/template.php will not be loaded, admin_head // action will not be fired). If that's the case, just skip loading // the Insert Pages tinymce button. if (!is_admin() || !function_exists('page_template_dropdown')) { return; } $options_panel_visible = '1' == get_user_setting('wpinsertpage', '0') ? ' options-panel-visible' : ''; // Get ID of post currently being edited. $post_id = array_key_exists('post', $_REQUEST) && intval($_REQUEST['post']) > 0 ? intval($_REQUEST['post']) : ''; // display: none is required here, see #WP27605 ?> <div id="wp-insertpage-backdrop" style="display: none"></div> <div id="wp-insertpage-wrap" class="wp-core-ui<?php echo $options_panel_visible; ?> " style="display: none"> <form id="wp-insertpage" tabindex="-1"> <?php wp_nonce_field('internal-inserting', '_ajax_inserting_nonce', false); ?> <input type="hidden" id="insertpage-parent-pageID" value="<?php echo $post_id; ?> " /> <div id="insertpage-modal-title"> <?php _e('Insert page'); ?> <div id="wp-insertpage-close" tabindex="0"></div> </div> <div id="insertpage-selector"> <div id="insertpage-search-panel"> <div class="insertpage-search-wrapper"> <label> <span class="search-label"><?php _e('Search'); ?> </span> <input type="search" id="insertpage-search-field" class="insertpage-search-field" autocomplete="off" /> <span class="spinner"></span> </label> </div> <div id="insertpage-search-results" class="query-results"> <ul></ul> <div class="river-waiting"> <span class="spinner"></span> </div> </div> <div id="insertpage-most-recent-results" class="query-results"> <div class="query-notice"><em><?php _e('No search term specified. Showing recent items.'); ?> </em></div> <ul></ul> <div class="river-waiting"> <span class="spinner"></span> </div> </div> </div> <p class="howto" id="insertpage-options-toggle"><?php _e('Options'); ?> </p> <div id="insertpage-options-panel"> <div class="insertpage-options-wrapper"> <label for="insertpage-slug-field"> <span><?php _e('Slug or ID'); ?> </span> <input id="insertpage-slug-field" type="text" autocomplete="off" /> <input id="insertpage-pageID" type="hidden" /> </label> </div> <div class="insertpage-format"> <label for="insertpage-format-select"> <?php _e('Display'); ?> <select name="insertpage-format-select" id="insertpage-format-select"> <option value='title'>Title</option> <option value='link'>Link</option> <option value='excerpt'>Excerpt with title</option> <option value='excerpt-only'>Excerpt only (no title)</option> <option value='content'>Content</option> <option value='all'>All (includes custom fields)</option> <option value='template'>Use a custom template »</option> </select> <select name="insertpage-template-select" id="insertpage-template-select" disabled="true"> <option value='all'><?php _e('Default Template'); ?> </option> <?php page_template_dropdown(); ?> </select> </label> </div> <div class="insertpage-extra"> <label for="insertpage-extra-classes"> <?php _e('Extra Classes'); ?> <input id="insertpage-extra-classes" type="text" autocomplete="off" /> </label> <label for="insertpage-extra-inline"> <?php _e('Inline?'); ?> <input id="insertpage-extra-inline" type="checkbox" /> </label> </div> </div> </div> <div class="submitbox"> <div id="wp-insertpage-update"> <input type="submit" value="<?php esc_attr_e('Insert Page'); ?> " class="button button-primary" id="wp-insertpage-submit" name="wp-insertpage-submit"> </div> <div id="wp-insertpage-cancel"> <a class="submitdelete deletion" href="#"><?php _e('Cancel'); ?> </a> </div> </div> </form> </div> <?php }
public static function import_choices() { if (!current_user_can('frm_edit_forms')) { wp_die(); } $field_id = absint($_REQUEST['field_id']); global $current_screen, $hook_suffix; // Catch plugins that include admin-header.php before admin.php completes. if (empty($current_screen) && function_exists('set_current_screen')) { $hook_suffix = ''; set_current_screen(); } if (function_exists('register_admin_color_schemes')) { register_admin_color_schemes(); } $hook_suffix = $admin_body_class = ''; if (get_user_setting('mfold') == 'f') { $admin_body_class .= ' folded'; } if (function_exists('is_admin_bar_showing') && is_admin_bar_showing()) { $admin_body_class .= ' admin-bar'; } if (is_rtl()) { $admin_body_class .= ' rtl'; } $admin_body_class .= ' admin-color-' . sanitize_html_class(get_user_option('admin_color'), 'fresh'); $prepop = array(); FrmFieldsHelper::get_bulk_prefilled_opts($prepop); $field = FrmField::getOne($field_id); wp_enqueue_script('utils'); wp_enqueue_style('formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css'); FrmAppHelper::load_admin_wide_js(); include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php'; wp_die(); }
/** * Retrieve HTML for the Link URL buttons with the default link type as specified. * * @since unknown * * @param unknown_type $post * @param unknown_type $url_type * @return unknown */ function image_link_input_fields($post, $url_type = '') { $file = wp_get_attachment_url($post->ID); $link = get_attachment_link($post->ID); if ( empty($url_type) ) $url_type = get_user_setting('urlbutton', 'post'); $url = ''; if ( $url_type == 'file' ) $url = $file; elseif ( $url_type == 'post' ) $url = $link; return " <input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br /> <button type='button' class='button urlnone' title=''>" . __('None') . "</button> <button type='button' class='button urlfile' title='" . esc_attr($file) . "'>" . __('File URL') . "</button> <button type='button' class='button urlpost' title='" . esc_attr($link) . "'>" . __('Post URL') . "</button> "; }
if (isset($_GET['upload-page-form'])) { $errors = array_merge($errors, (array) media_upload_form_handler()); $location = 'upload.php'; if ($errors) { $location .= '?message=3'; } wp_redirect(admin_url($location)); exit; } $title = __('Upload New Media'); $parent_file = 'upload.php'; get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:') . '</p>' . '<ul>' . '<li>' . __('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.') . '</li>' . '<li>' . __('<strong>Select Files</strong> will open the multi-file uploader, or you can use the <strong>Browser Uploader</strong>.') . '</li>' . '<li>' . __('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.') . '</li>' . '</ul>' . '<p>' . __('Basic image editing is available after upload is complete. Make sure you click Save before leaving this screen.') . '</p>')); get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.wordpress.org/Media_Add_New_Screen" target="_blank">Documentation on Uploading Media Files</a>') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'); require_once './admin-header.php'; $form_class = 'media-upload-form type-form validate'; if (get_user_setting('uploader')) { $form_class .= ' html-uploader'; } ?> <div class="wrap"> <?php screen_icon(); ?> <h2><?php echo esc_html($title); ?> </h2> <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-upload.php?inline=&upload-page-form='); ?>
function tab_uploadimage() { global $ngg; // check the cookie for the current setting $checked = get_user_setting('ngg_upload_resize') ? ' checked="true"' : ''; ?> <!-- upload images --> <h2><?php _e('Upload Images', 'nggallery'); ?> </h2> <form name="uploadimage" id="uploadimage_form" method="POST" enctype="multipart/form-data" action="<?php echo $this->filepath . '#uploadimage'; ?> " accept-charset="utf-8" > <?php wp_nonce_field('ngg_addgallery'); ?> <table class="form-table"> <tr valign="top"> <th scope="row"><?php _e('Upload image', 'nggallery'); ?> </th> <?php if ($ngg->options['swfUpload'] && defined('IS_WP_3_3')) { ?> <td> <div id="plupload-upload-ui"> <div> <?php _e('Choose files to upload'); ?> <input id="plupload-browse-button" type="button" value="<?php esc_attr_e('Select Files'); ?> " class="button" /> </div> <p class="ngg-dragdrop-info howto" style="display:none;" ><?php _e('Or you can drop the files into this window.'); ?> </p> <div id='uploadQueue'></div> <p><label><input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> /> <?php printf(__('Scale images to max width %1$dpx or max height %2$dpx', 'nggallery'), (int) $ngg->options['imgWidth'], (int) $ngg->options['imgHeight']); ?> <div id='image_resize_pointer'> </div> </label> </p> </div> </td> <?php } else { ?> <td><span id='spanButtonPlaceholder'></span><input type="file" name="imagefiles[]" id="imagefiles" size="35" class="imagefiles"/></td> <?php } ?> </tr> <tr valign="top"> <th scope="row"><?php _e('in to', 'nggallery'); ?> </th> <td><select name="galleryselect" id="galleryselect"> <option value="0" ><?php _e('Choose gallery', 'nggallery'); ?> </option> <?php foreach ($this->gallerylist as $gallery) { //special case : we check if a user has this cap, then we override the second cap check if (!current_user_can('NextGEN Upload in all galleries')) { if (!nggAdmin::can_manage_this_gallery($gallery->author)) { continue; } } $name = empty($gallery->title) ? $gallery->name : $gallery->title; echo '<option value="' . $gallery->gid . '" >' . $gallery->gid . ' - ' . esc_attr($name) . '</option>' . "\n"; } ?> </select> <br /><?php echo $this->maxsize; ?> <br /><?php if (is_multisite() && wpmu_enable_function('wpmuQuotaCheck')) { display_space_usage(); } ?> </td> </tr> </table> <div class="submit"> <?php if ($ngg->options['swfUpload']) { ?> <input type="submit" name="disable_flash" id="disable_flash" title="<?php _e('The batch upload requires Adobe Flash 10, disable it if you have problems', 'nggallery'); ?> " value="<?php _e('Disable flash upload', 'nggallery'); ?> " /> <?php } else { ?> <input type="submit" name="enable_flash" id="enable_flash" title="<?php _e('Upload multiple files at once by ctrl/shift-selecting in dialog', 'nggallery'); ?> " value="<?php _e('Enable flash based upload', 'nggallery'); ?> " /> <?php } ?> <input class="button-primary" type="submit" name="uploadimage" id="uploadimage_btn" value="<?php _e('Upload images', 'nggallery'); ?> " /> </div> </form> <?php }
/** * Dialog for internal linking. * * @since 3.1.0 * * @static */ public static function wp_link_dialog() { $search_panel_visible = '1' == get_user_setting('wplink', '0') ? ' search-panel-visible' : ''; // display: none is required here, see #WP27605 ?> <div id="wp-link-backdrop" style="display: none"></div> <div id="wp-link-wrap" class="wp-core-ui<?php echo $search_panel_visible; ?> " style="display: none"> <form id="wp-link" tabindex="-1"> <?php wp_nonce_field('internal-linking', '_ajax_linking_nonce', false); ?> <div id="link-modal-title"> <?php _e('Insert/edit link'); ?> <button type="button" id="wp-link-close"><span class="screen-reader-text"><?php _e('Close'); ?> </span></button> </div> <div id="link-selector"> <div id="link-options"> <p class="howto"><?php _e('Enter the destination URL'); ?> </p> <div> <label><span><?php _e('URL'); ?> </span><input id="wp-link-url" type="text" /></label> </div> <div class="wp-link-text-field"> <label><span><?php _e('Link Text'); ?> </span><input id="wp-link-text" type="text" /></label> </div> <div class="link-target"> <label><span> </span><input type="checkbox" id="wp-link-target" /> <?php _e('Open link in a new window/tab'); ?> </label> </div> </div> <p class="howto"><a href="#" id="wp-link-search-toggle"><?php _e('Or link to existing content'); ?> </a></p> <div id="search-panel"> <div class="link-search-wrapper"> <label> <span class="search-label"><?php _e('Search'); ?> </span> <input type="search" id="wp-link-search" class="link-search-field" autocomplete="off" /> <span class="spinner"></span> </label> </div> <div id="search-results" class="query-results" tabindex="0"> <ul></ul> <div class="river-waiting"> <span class="spinner"></span> </div> </div> <div id="most-recent-results" class="query-results" tabindex="0"> <div class="query-notice" id="query-notice-message"> <em class="query-notice-default"><?php _e('No search term specified. Showing recent items.'); ?> </em> <em class="query-notice-hint screen-reader-text"><?php _e('Search or use up and down arrow keys to select an item.'); ?> </em> </div> <ul></ul> <div class="river-waiting"> <span class="spinner"></span> </div> </div> </div> </div> <div class="submitbox"> <div id="wp-link-cancel"> <a class="submitdelete deletion" href="#"><?php _e('Cancel'); ?> </a> </div> <div id="wp-link-update"> <input type="submit" value="<?php esc_attr_e('Add Link'); ?> " class="button button-primary" id="wp-link-submit" name="wp-link-submit"> </div> </div> </form> </div> <?php }
/** * Fires in <head> for a specific admin page based on $hook_suffix. * * @since 2.1.0 */ do_action("admin_head-{$hook_suffix}"); /** * Fires in <head> for all admin pages. * * @since 2.1.0 */ do_action('admin_head'); if (get_user_setting('mfold') == 'f') { $admin_body_class .= ' folded'; } if (!get_user_setting('unfold')) { $admin_body_class .= ' auto-fold'; } if (is_admin_bar_showing()) { $admin_body_class .= ' admin-bar'; } if (is_rtl()) { $admin_body_class .= ' rtl'; } if ($current_screen->post_type) { $admin_body_class .= ' post-type-' . $current_screen->post_type; } if ($current_screen->taxonomy) { $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy; } $admin_body_class .= ' branch-' . str_replace(array('.', ','), '-', floatval($wp_version));
/** * Find out which editor should be displayed by default. * * Works out which of the two editors to display as the current editor for a * user. * * @since 2.5.0 * * @return string Either 'tinymce', or 'html', or 'test' */ function wp_default_editor() { $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults if ($user = wp_get_current_user()) { // look for cookie $ed = get_user_setting('editor', 'tinymce'); $r = in_array($ed, array('tinymce', 'html', 'test')) ? $ed : $r; } return apply_filters('wp_default_editor', $r); // filter }
/** * Dialog for internal linking. * * @since 3.1.0 */ public static function wp_link_dialog() { ?> <div style="display:none;"> <form id="wp-link" tabindex="-1"> <?php wp_nonce_field('internal-linking', '_ajax_linking_nonce', false); ?> <div id="link-selector"> <div id="link-options"> <p class="howto"><?php _e('Enter the destination URL'); ?> </p> <div> <label><span><?php _e('URL'); ?> </span><input id="url-field" type="text" name="href" /></label> </div> <div> <label><span><?php _e('Title'); ?> </span><input id="link-title-field" type="text" name="linktitle" /></label> </div> <div class="link-target"> <label><input type="checkbox" id="link-target-checkbox" /> <?php _e('Open link in a new window/tab'); ?> </label> </div> </div> <?php $show_internal = '1' == get_user_setting('wplink', '0'); ?> <p class="howto toggle-arrow <?php if ($show_internal) { echo 'toggle-arrow-active'; } ?> " id="internal-toggle"><?php _e('Or link to existing content'); ?> </p> <div id="search-panel"<?php if (!$show_internal) { echo ' style="display:none"'; } ?> > <div class="link-search-wrapper"> <label> <span class="search-label"><?php _e('Search'); ?> </span> <input type="search" id="search-field" class="link-search-field" autocomplete="off" /> <span class="spinner"></span> </label> </div> <div id="search-results" class="query-results"> <ul></ul> <div class="river-waiting"> <span class="spinner"></span> </div> </div> <div id="most-recent-results" class="query-results"> <div class="query-notice"><em><?php _e('No search term specified. Showing recent items.'); ?> </em></div> <ul></ul> <div class="river-waiting"> <span class="spinner"></span> </div> </div> </div> </div> <div class="submitbox"> <div id="wp-link-update"> <input type="submit" value="<?php esc_attr_e('Add Link'); ?> " class="button-primary" id="wp-link-submit" name="wp-link-submit"> </div> <div id="wp-link-cancel"> <a class="submitdelete deletion" href="#"><?php _e('Cancel'); ?> </a> </div> </div> </form> </div> <?php }
/** * Parse default arguments for the editor instance. * * @static * @param string $editor_id ID for the current editor instance. * @param array $settings { * Array of editor arguments. * * @type bool $wpautop Whether to use wpautop(). Default true. * @type bool $media_buttons Whether to show the Add Media/other media buttons. * @type string $default_editor When both TinyMCE and Quicktags are used, set which * editor is shown on page load. Default empty. * @type bool $drag_drop_upload Whether to enable drag & drop on the editor uploading. Default false. * Requires the media modal. * @type string $textarea_name Give the textarea a unique name here. Square brackets * can be used here. Default $editor_id. * @type int $textarea_rows Number rows in the editor textarea. Default 20. * @type string|int $tabindex Tabindex value to use. Default empty. * @type string $tabfocus_elements The previous and next element ID to move the focus to * when pressing the Tab key in TinyMCE. Default ':prev,:next'. * @type string $editor_css Intended for extra styles for both Visual and Text editors. * Should include `<style>` tags, and can use "scoped". Default empty. * @type string $editor_class Extra classes to add to the editor textarea element. Default empty. * @type bool $teeny Whether to output the minimal editor config. Examples include * Press This and the Comment editor. Default false. * @type bool $dfw Deprecated in 4.1. Since 4.3 used only to enqueue wp-fullscreen-stub.js * for backward compatibility. * @type bool|array $tinymce Whether to load TinyMCE. Can be used to pass settings directly to * TinyMCE using an array. Default true. * @type bool|array $quicktags Whether to load Quicktags. Can be used to pass settings directly to * Quicktags using an array. Default true. * } * @return array Parsed arguments array. */ public static function parse_settings($editor_id, $settings) { /** * Filters the wp_editor() settings. * * @since 4.0.0 * * @see _WP_Editors()::parse_settings() * * @param array $settings Array of editor arguments. * @param string $editor_id ID for the current editor instance. */ $settings = apply_filters('wp_editor_settings', $settings, $editor_id); $set = wp_parse_args($settings, array('wpautop' => true, 'media_buttons' => true, 'default_editor' => '', 'drag_drop_upload' => false, 'textarea_name' => $editor_id, 'textarea_rows' => 20, 'tabindex' => '', 'tabfocus_elements' => ':prev,:next', 'editor_css' => '', 'editor_class' => '', 'teeny' => false, 'dfw' => false, '_content_editor_dfw' => false, 'tinymce' => true, 'quicktags' => true)); self::$this_tinymce = $set['tinymce'] && user_can_richedit(); if (self::$this_tinymce) { if (false !== strpos($editor_id, '[')) { self::$this_tinymce = false; _deprecated_argument('wp_editor()', '3.9', 'TinyMCE editor IDs cannot have brackets.'); } } self::$this_quicktags = (bool) $set['quicktags']; if (self::$this_tinymce) { self::$has_tinymce = true; } if (self::$this_quicktags) { self::$has_quicktags = true; } if ($set['dfw']) { self::$old_dfw_compat = true; } if (empty($set['editor_height'])) { return $set; } if ('content' === $editor_id && empty($set['tinymce']['wp_autoresize_on'])) { // A cookie (set when a user resizes the editor) overrides the height. $cookie = (int) get_user_setting('ed_size'); if ($cookie) { $set['editor_height'] = $cookie; } } if ($set['editor_height'] < 50) { $set['editor_height'] = 50; } elseif ($set['editor_height'] > 5000) { $set['editor_height'] = 5000; } return $set; }