本文整理汇总了PHP中get_user_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_setting函数的具体用法?PHP get_user_setting怎么用?PHP get_user_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fb_enqueue_wp_pointer
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
}
}
示例2: print_welcome_block
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';
}
}
示例3: test_set_user_setting_strip_asterisks
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'));
}
示例4: get_height
/**
* 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;
}
示例5: bizz_admin_body_class
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 : '';
}
示例6: prepare_items
/**
*
* @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));
}
示例7: add_admin_bar_menu_entry
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));
}
示例8: media_upload_gallery_form
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';
}
示例9: __construct
/**
* 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);
}
}
示例10: begin_xml
/**
* 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);
}
示例11: prepare_items
/**
*
* @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));
}
示例12: dirname
<?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');
}
示例13: prepare_items
/**
*
* @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));
}
示例14: sizesInForm
/**
* 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;
}
示例15: media_upload_max_image_resize
/**
* 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
}