コード例 #1
0
 /**
  * Enqueues JS file for theme integration.
  *
  * Be sure s2Member's API Constants are already defined before firing this.
  *
  * @package s2Member\CSS_JS
  * @since 3.5
  *
  * @attaches-to ``add_action("wp_print_scripts");``
  *
  * @return null After enqueuing JS for theme integration.
  */
 public static function add_js_w_globals()
 {
     global $pagenow;
     /* Need this for comparisons. */
     /**/
     do_action("ws_plugin__s2member_before_add_js_w_globals", get_defined_vars());
     /**/
     if (!is_admin() || is_user_admin() && $pagenow === "profile.php" && !current_user_can("edit_users")) {
         $s2o = $GLOBALS["WS_PLUGIN__"]["s2member"]["c"]["s2o_url"];
         /**/
         if (is_user_logged_in()) {
             $md5 = WS_PLUGIN__S2MEMBER_API_CONSTANTS_MD5;
             /* An MD5 hash based on global key => values. */
             /* The MD5 hash allows the script to be cached in the browser until the globals happen to change. */
             /* For instance, the global variables may change when a User who is logged-in changes their Profile. */
             wp_enqueue_script("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=" . urlencode($md5) . "&qcABC=1", array("jquery", "password-strength-meter"), c_ws_plugin__s2member_utilities::ver_checksum());
         } else {
             /* This essentially creates 2 versions of the script. One while logged in & another when not. */
             wp_enqueue_script("ws-plugin--s2member", $s2o . "?ws_plugin__s2member_js_w_globals=1&qcABC=1", array("jquery", "password-strength-meter"), c_ws_plugin__s2member_utilities::ver_checksum());
         }
         /**/
         do_action("ws_plugin__s2member_during_add_js_w_globals", get_defined_vars());
     }
     /**/
     do_action("ws_plugin__s2member_after_add_js_w_globals", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #2
0
 /**
  * Remove the WordPress comments menu bar item, replacing with a Facebook comments link
  * Check if Facebook comments enabled and if the current user might be able to view a comments edit screen on Facebook
  *
  * @since 1.1
  * @see WP_Admin_Bar->add_menus()
  */
 public static function admin_bar_menu()
 {
     global $facebook_loader;
     if (is_network_admin() && is_user_admin()) {
         return;
     }
     // use moderate_comments capability as a local proxy for accounts that might be granted moderate comments permissions for the Facebook application if the application administrator fully setup the app
     // technically the WordPress menu item is added for users with 'edit_posts' due to the permissions of the destination page but we'll check for the specific comments permission instead
     // TODO: check if Facebook data stored for current user, check if Facebook user is moderator
     if (!current_user_can('moderate_comments')) {
         return;
     }
     if (!class_exists('Facebook_User')) {
         require_once dirname(dirname(__FILE__)) . '/facebook-user.php';
     }
     $current_user = wp_get_current_user();
     $facebook_user_data = Facebook_User::get_user_meta($current_user->ID, 'fb_data', true);
     if (!(is_array($facebook_user_data) && isset($facebook_user_data['fb_uid']))) {
         return;
     }
     // swap only. don't add a menu item if none existed
     if (remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60)) {
         add_action('admin_bar_menu', array('Facebook_Comments', 'admin_bar_add_comments_menu'), 60);
     }
 }
コード例 #3
0
 public static function is_user_admin()
 {
     if (version_compare(get_bloginfo("version"), "3.1-RC", ">=")) {
         return is_user_admin();
     }
     /**/
     return is_admin();
 }
コード例 #4
0
function redirect_if_user_not_admin($email)
{
    // Redirect to /e_commerce/index.php.
    if (!is_user_admin($email)) {
        header('Location: /e_commerce/index.php');
        die;
    }
}
コード例 #5
0
ファイル: helper-config.php プロジェクト: sdgdsffdsfff/shipin
function wp_admin_header()
{
    remove_action('admin_bar_menu', 'wp_admin_bar_updates_menu', 40);
    if (!is_network_admin() && !is_user_admin()) {
        //评论
        remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
    }
}
コード例 #6
0
ファイル: meta-box.php プロジェクト: nWidart/meta-box
/**
 * Prints or exports the content of the global debug array at the 'shutdown' hook
 *
 * @return void
 */
function rwmb_debug_print()
{
    global $rwmb_debug;
    if (!$rwmb_debug || is_user_logged_in() && is_user_admin()) {
        return;
    }
    $html = '<h3>' . __('RW_Meta_Box Debug:', 'rwmb') . '</h3><pre>';
    foreach ($rwmb_debug as $debug) {
        $html .= "{$debug}<hr />";
    }
    $html .= '</pre>';
    die($html);
}
コード例 #7
0
ファイル: Wp.php プロジェクト: websharks/wp-sharks-core
 /**
  * Class constructor.
  *
  * @since 160710 Common utils.
  */
 public function __construct()
 {
     $this->is_multisite = is_multisite();
     $this->is_main_site = !$this->is_multisite || is_main_site();
     $this->is_admin = is_admin();
     $this->is_user_admin = $this->is_admin && is_user_admin();
     $this->is_network_admin = $this->is_admin && $this->is_multisite && is_network_admin();
     $this->debug = defined('WP_DEBUG') && WP_DEBUG;
     $this->debug_edge = $this->debug && defined('WP_DEBUG_EDGE') && WP_DEBUG_EDGE;
     $this->debug_log = $this->debug && defined('WP_DEBUG_LOG') && WP_DEBUG_LOG;
     $this->debug_display = $this->debug && defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY;
     if (!($this->salt = wp_salt())) {
         throw new Exception('Failed to acquire WP salt.');
     }
     if (!($this->tmp_dir = rtrim(get_temp_dir(), '/'))) {
         throw new Exception('Failed to acquire a writable tmp dir.');
     }
     if (!($this->site_url = site_url('/'))) {
         throw new Exception('Failed to acquire site URL.');
     } elseif (!($this->site_url_parts = parse_url($this->site_url))) {
         throw new Exception('Failed to parse site URL parts.');
     } elseif (!($this->site_url_host = $this->site_url_parts['host'] ?? '')) {
         throw new Exception('Failed to parse site URL host.');
     } elseif (!($this->site_url_root_host = implode('.', array_slice(explode('.', $this->site_url_host), -2)))) {
         throw new Exception('Failed to parse site URL root host.');
     }
     if (!($this->site_url_option = get_option('siteurl'))) {
         throw new Exception('Failed to acquire site URL option.');
     } elseif (!($this->site_url_option_parts = parse_url($this->site_url_option))) {
         throw new Exception('Failed to parse site URL option parts.');
     } elseif (!($this->site_default_scheme = $this->site_url_option_parts['scheme'] ?? '')) {
         throw new Exception('Failed to parse site URL option scheme.');
     }
     if (!($this->template_directory_url = get_template_directory_uri())) {
         throw new Exception('Failed to acquire template directory URL.');
     } elseif (!($this->template_directory_url_parts = parse_url($this->template_directory_url))) {
         throw new Exception('Failed to parse template directory URL parts.');
     }
     $this->template = get_template();
     $this->stylesheet = get_stylesheet();
     $this->is_woocommerce_active = defined('WC_VERSION');
     $this->is_woocommerce_product_vendors_active = defined('WC_PRODUCT_VENDORS_VERSION');
     $this->is_jetpack_active = defined('JETPACK__VERSION');
 }
コード例 #8
0
/**
 * Unhook the NXTClass core menus.
 *
 * @since BuddyPress (r4151)
 *
 * @uses remove_action
 * @uses is_network_admin()
 * @uses is_user_admin()
 */
function bp_admin_bar_remove_nxt_menus()
{
    if ('3.2' == bp_get_major_nxt_version()) {
        remove_action('admin_bar_menu', 'nxt_admin_bar_my_account_menu', 10);
        remove_action('admin_bar_menu', 'nxt_admin_bar_my_sites_menu', 20);
        remove_action('admin_bar_menu', 'nxt_admin_bar_dashboard_view_site_menu', 25);
        // Don't show the 'Edit Page' menu on BP pages
        if (!bp_is_blog_page()) {
            remove_action('admin_bar_menu', 'nxt_admin_bar_edit_menu', 30);
        }
        remove_action('admin_bar_menu', 'nxt_admin_bar_shortlink_menu', 80);
        remove_action('admin_bar_menu', 'nxt_admin_bar_updates_menu', 70);
        if (!is_network_admin() && !is_user_admin()) {
            remove_action('admin_bar_menu', 'nxt_admin_bar_comments_menu', 50);
            remove_action('admin_bar_menu', 'nxt_admin_bar_appearance_menu', 60);
        }
        remove_action('admin_bar_menu', 'nxt_admin_bar_updates_menu', 70);
    }
}
コード例 #9
0
ファイル: dashboard.php プロジェクト: riasnelli/WordPress
/**
 * Dashboard widget that displays some basic stats about the site.
 *
 * Formerly 'Right Now'. A streamlined 'At a Glance' as of 3.8.
 *
 * @since 2.7.0
 */
function wp_dashboard_right_now()
{
    ?>
	<div class="main">
	<ul>
	<?php 
    // Posts and Pages
    foreach (array('post', 'page') as $post_type) {
        $num_posts = wp_count_posts($post_type);
        if ($num_posts && $num_posts->publish) {
            if ('post' == $post_type) {
                $text = _n('%s Post', '%s Posts', $num_posts->publish);
            } else {
                $text = _n('%s Page', '%s Pages', $num_posts->publish);
            }
            $text = sprintf($text, number_format_i18n($num_posts->publish));
            $post_type_object = get_post_type_object($post_type);
            if ($post_type_object && current_user_can($post_type_object->cap->edit_posts)) {
                printf('<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text);
            } else {
                printf('<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text);
            }
        }
    }
    // Comments
    $num_comm = wp_count_comments();
    if ($num_comm && $num_comm->approved) {
        $text = sprintf(_n('%s Comment', '%s Comments', $num_comm->approved), number_format_i18n($num_comm->approved));
        ?>
		<li class="comment-count"><a href="edit-comments.php"><?php 
        echo $text;
        ?>
</a></li>
		<?php 
        /* translators: Number of comments in moderation */
        $text = sprintf(_nx('%s in moderation', '%s in moderation', $num_comm->moderated, 'comments'), number_format_i18n($num_comm->moderated));
        ?>
		<li class="comment-mod-count<?php 
        if (!$num_comm->moderated) {
            echo ' hidden';
        }
        ?>
"><a href="edit-comments.php?comment_status=moderated"><?php 
        echo $text;
        ?>
</a></li>
		<?php 
    }
    /**
     * Filter the array of extra elements to list in the 'At a Glance'
     * dashboard widget.
     *
     * Prior to 3.8.0, the widget was named 'Right Now'. Each element
     * is wrapped in list-item tags on output.
     *
     * @since 3.8.0
     *
     * @param array $items Array of extra 'At a Glance' widget items.
     */
    $elements = apply_filters('dashboard_glance_items', array());
    if ($elements) {
        echo '<li>' . implode("</li>\n<li>", $elements) . "</li>\n";
    }
    ?>
	</ul>
	<?php 
    update_right_now_message();
    // Check if search engines are asked not to index this site.
    if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public')) {
        /**
         * Filter the link title attribute for the 'Search Engines Discouraged'
         * message displayed in the 'At a Glance' dashboard widget.
         *
         * Prior to 3.8.0, the widget was named 'Right Now'.
         *
         * @since 3.0.0
         *
         * @param string $title Default attribute text.
         */
        $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content'));
        /**
         * Filter the link label for the 'Search Engines Discouraged' message
         * displayed in the 'At a Glance' dashboard widget.
         *
         * Prior to 3.8.0, the widget was named 'Right Now'.
         *
         * @since 3.0.0
         *
         * @param string $content Default text.
         */
        $content = apply_filters('privacy_on_link_text', __('Search Engines Discouraged'));
        echo "<p><a href='options-reading.php' title='{$title}'>{$content}</a></p>";
    }
    ?>
	</div>
	<?php 
    /*
     * activity_box_end has a core action, but only prints content when multisite.
     * Using an output buffer is the only way to really check if anything's displayed here.
     */
    ob_start();
    /**
     * Fires at the end of the 'At a Glance' dashboard widget.
     *
     * Prior to 3.8.0, the widget was named 'Right Now'.
     *
     * @since 2.5.0
     */
    do_action('rightnow_end');
    /**
     * Fires at the end of the 'At a Glance' dashboard widget.
     *
     * Prior to 3.8.0, the widget was named 'Right Now'.
     *
     * @since 2.0.0
     */
    do_action('activity_box_end');
    $actions = ob_get_clean();
    if (!empty($actions)) {
        ?>
	<div class="sub">
		<?php 
        echo $actions;
        ?>
	</div>
	<?php 
    }
}
コード例 #10
0
ファイル: dashboard.php プロジェクト: nouphet/rata
function wp_dashboard_right_now()
{
    global $wp_registered_sidebars;
    $num_posts = wp_count_posts('post');
    $num_pages = wp_count_posts('page');
    $num_cats = wp_count_terms('category');
    $num_tags = wp_count_terms('post_tag');
    $num_comm = wp_count_comments();
    echo "\n\t" . '<div class="table table_content">';
    echo "\n\t" . '<p class="sub">' . __('Content') . '</p>' . "\n\t" . '<table>';
    echo "\n\t" . '<tr class="first">';
    // Posts
    $num = number_format_i18n($num_posts->publish);
    $text = _n('Post', 'Posts', intval($num_posts->publish));
    if (current_user_can('edit_posts')) {
        $num = "<a href='edit.php'>{$num}</a>";
        $text = "<a href='edit.php'>{$text}</a>";
    }
    echo '<td class="first b b-posts">' . $num . '</td>';
    echo '<td class="t posts">' . $text . '</td>';
    echo '</tr><tr>';
    /* TODO: Show status breakdown on hover
    	if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
    		$post_type_texts[] = '<a href="edit-pages.php">'.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
    	}
    	if ( $can_edit_posts && !empty($num_posts->draft) ) {
    		$post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( _n( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
    	}
    	if ( $can_edit_posts && !empty($num_posts->future) ) {
    		$post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( _n( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
    	}
    	if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
    		$pending_text = sprintf( _n( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
    	} else {
    		$pending_text = '';
    	}
    	*/
    // Pages
    $num = number_format_i18n($num_pages->publish);
    $text = _n('Page', 'Pages', $num_pages->publish);
    if (current_user_can('edit_pages')) {
        $num = "<a href='edit.php?post_type=page'>{$num}</a>";
        $text = "<a href='edit.php?post_type=page'>{$text}</a>";
    }
    echo '<td class="first b b_pages">' . $num . '</td>';
    echo '<td class="t pages">' . $text . '</td>';
    echo '</tr><tr>';
    // Categories
    $num = number_format_i18n($num_cats);
    $text = _n('Category', 'Categories', $num_cats);
    if (current_user_can('manage_categories')) {
        $num = "<a href='edit-tags.php?taxonomy=category'>{$num}</a>";
        $text = "<a href='edit-tags.php?taxonomy=category'>{$text}</a>";
    }
    echo '<td class="first b b-cats">' . $num . '</td>';
    echo '<td class="t cats">' . $text . '</td>';
    echo '</tr><tr>';
    // Tags
    $num = number_format_i18n($num_tags);
    $text = _n('Tag', 'Tags', $num_tags);
    if (current_user_can('manage_categories')) {
        $num = "<a href='edit-tags.php'>{$num}</a>";
        $text = "<a href='edit-tags.php'>{$text}</a>";
    }
    echo '<td class="first b b-tags">' . $num . '</td>';
    echo '<td class="t tags">' . $text . '</td>';
    echo "</tr>";
    do_action('right_now_content_table_end');
    echo "\n\t</table>\n\t</div>";
    echo "\n\t" . '<div class="table table_discussion">';
    echo "\n\t" . '<p class="sub">' . __('Discussion') . '</p>' . "\n\t" . '<table>';
    echo "\n\t" . '<tr class="first">';
    // Total Comments
    $num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
    $text = _n('Comment', 'Comments', $num_comm->total_comments);
    if (current_user_can('moderate_comments')) {
        $num = '<a href="edit-comments.php">' . $num . '</a>';
        $text = '<a href="edit-comments.php">' . $text . '</a>';
    }
    echo '<td class="b b-comments">' . $num . '</td>';
    echo '<td class="last t comments">' . $text . '</td>';
    echo '</tr><tr>';
    // Approved Comments
    $num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
    $text = _nx('Approved', 'Approved', $num_comm->approved, 'Right Now');
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=approved'>{$num}</a>";
        $text = "<a class='approved' href='edit-comments.php?comment_status=approved'>{$text}</a>";
    }
    echo '<td class="b b_approved">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>\n\t<tr>";
    // Pending Comments
    $num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
    $text = _n('Pending', 'Pending', $num_comm->moderated);
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=moderated'>{$num}</a>";
        $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>{$text}</a>";
    }
    echo '<td class="b b-waiting">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>\n\t<tr>";
    // Spam Comments
    $num = number_format_i18n($num_comm->spam);
    $text = _nx('Spam', 'Spam', $num_comm->spam, 'comment');
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>{$num}</span></a>";
        $text = "<a class='spam' href='edit-comments.php?comment_status=spam'>{$text}</a>";
    }
    echo '<td class="b b-spam">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>";
    do_action('right_now_table_end');
    do_action('right_now_discussion_table_end');
    echo "\n\t</table>\n\t</div>";
    echo "\n\t" . '<div class="versions">';
    $ct = current_theme_info();
    echo "\n\t<p>";
    if (!empty($wp_registered_sidebars)) {
        $sidebars_widgets = wp_get_sidebars_widgets();
        $num_widgets = 0;
        foreach ((array) $sidebars_widgets as $k => $v) {
            if ('wp_inactive_widgets' == $k) {
                continue;
            }
            if (is_array($v)) {
                $num_widgets = $num_widgets + count($v);
            }
        }
        $num = number_format_i18n($num_widgets);
        $switch_themes = $ct->title;
        if (current_user_can('switch_themes')) {
            $switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
        }
        if (current_user_can('edit_theme_options')) {
            printf(_n('Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $switch_themes, $num);
        } else {
            printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $switch_themes, $num);
        }
    } else {
        if (current_user_can('switch_themes')) {
            printf(__('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $ct->title);
        } else {
            printf(__('Theme <span class="b">%1$s</span>'), $ct->title);
        }
    }
    echo '</p>';
    // Check if search engines are blocked.
    if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public')) {
        $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content'));
        $content = apply_filters('privacy_on_link_text', __('Search Engines Blocked'));
        echo "<p><a href='options-privacy.php' title='{$title}'>{$content}</a></p>";
    }
    update_right_now_message();
    echo "\n\t" . '<br class="clear" /></div>';
    do_action('rightnow_end');
    do_action('activity_box_end');
}
コード例 #11
0
ファイル: link-template.php プロジェクト: vpatrinica/jfdesign
/**
 * Get the URL to the user's profile editor.
 *
 * @since 3.1.0
 *
 * @param int $user User ID
 * @param string $scheme The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl(). 'http' or 'https' can be passed to force those schemes.
 * @return string Dashboard url link with optional path appended
 */
function get_edit_profile_url($user, $scheme = 'admin')
{
    $user = (int) $user;
    if (is_user_admin()) {
        $url = user_admin_url('profile.php', $scheme);
    } elseif (is_network_admin()) {
        $url = network_admin_url('profile.php', $scheme);
    } else {
        $url = get_dashboard_url($user, 'profile.php', $scheme);
    }
    return apply_filters('edit_profile_url', $url, $user, $scheme);
}
 /**
  * Custom "Right Now" dashboard widget for Calendar Administrators.
  *
  * @return  void
  */
 function dashboard_right_now()
 {
     global $wp_registered_sidebars;
     $num_comm = wp_count_comments();
     echo "\n\t" . '<div class="table table_content">';
     echo "\n\t" . '<p class="sub">' . __('Content') . '</p>' . "\n\t" . '<table>';
     echo "\n\t" . '<tr class="first">';
     do_action('right_now_content_table_end');
     echo "\n\t</table>\n\t</div>";
     echo "\n\t" . '<div class="table table_discussion">';
     echo "\n\t" . '<p class="sub">' . __('Discussion') . '</p>' . "\n\t" . '<table>';
     echo "\n\t" . '<tr class="first">';
     // Total Comments
     $num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
     $text = _n('Comment', 'Comments', $num_comm->total_comments);
     if (current_user_can('moderate_comments')) {
         $num = '<a href="edit-comments.php">' . $num . '</a>';
         $text = '<a href="edit-comments.php">' . $text . '</a>';
     }
     echo '<td class="b b-comments">' . $num . '</td>';
     echo '<td class="last t comments">' . $text . '</td>';
     echo '</tr><tr>';
     // Approved Comments
     $num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
     $text = _nx('Approved', 'Approved', $num_comm->approved, 'Right Now');
     if (current_user_can('moderate_comments')) {
         $num = "<a href='edit-comments.php?comment_status=approved'>{$num}</a>";
         $text = "<a class='approved' href='edit-comments.php?comment_status=approved'>{$text}</a>";
     }
     echo '<td class="b b_approved">' . $num . '</td>';
     echo '<td class="last t">' . $text . '</td>';
     echo "</tr>\n\t<tr>";
     // Pending Comments
     $num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
     $text = _n('Pending', 'Pending', $num_comm->moderated);
     if (current_user_can('moderate_comments')) {
         $num = "<a href='edit-comments.php?comment_status=moderated'>{$num}</a>";
         $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>{$text}</a>";
     }
     echo '<td class="b b-waiting">' . $num . '</td>';
     echo '<td class="last t">' . $text . '</td>';
     echo "</tr>\n\t<tr>";
     // Spam Comments
     $num = number_format_i18n($num_comm->spam);
     $text = _nx('Spam', 'Spam', $num_comm->spam, 'comment');
     if (current_user_can('moderate_comments')) {
         $num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>{$num}</span></a>";
         $text = "<a class='spam' href='edit-comments.php?comment_status=spam'>{$text}</a>";
     }
     echo '<td class="b b-spam">' . $num . '</td>';
     echo '<td class="last t">' . $text . '</td>';
     echo "</tr>";
     do_action('right_now_table_end');
     do_action('right_now_discussion_table_end');
     echo "\n\t</table>\n\t</div>";
     echo "\n\t" . '<div class="versions">';
     // Check if search engines are blocked.
     if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != Ai1ec_Meta::get_option('blog_public')) {
         $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content'));
         $content = apply_filters('privacy_on_link_text', __('Search Engines Blocked'));
         echo "<p><a href='options-privacy.php' title='{$title}'>{$content}</a></p>";
     }
     $msg = sprintf(__('You are using <span class="b">All-in-One Event Calendar %s</span>.'), AI1EC_VERSION);
     echo "<span id='wp-version-message'>{$msg}</span>";
     echo "\n\t" . '<br class="clear" /></div>';
     do_action('ai1ec_rightnow_end');
     do_action('activity_box_end');
 }
コード例 #13
0
function piklist_dashboard_right_now_old()
{
    ?>

  <div class="table table_content">

    <p class="sub"><?php 
    _e('Content', 'piklist');
    ?>
</p>

      <table>

        <tbody>

          <?php 
    $post_types = get_post_types(array(), 'objects');
    ?>

          <?php 
    foreach ($post_types as $post_type) {
        ?>

            <tr>

              <td class="first b b-<?php 
        echo mb_strtolower($post_type->label);
        ?>
">

                <a href="edit.php">
                  <?php 
        $num_pages = wp_count_posts($post_type->name);
        ?>
                  <?php 
        echo number_format_i18n($num_pages->publish);
        ?>
                </a>

              </td>

                <td class="t <?php 
        echo mb_strtolower($post_type->label);
        ?>
">

                    <a href="<?php 
        echo $post_type->name == 'attachment' ? 'upload.php' : 'edit.php?post_type=' . $post_type->name;
        ?>
">
                      <?php 
        echo $post_type->label;
        ?>
                    </a>

                </td>

            </tr>

          <?php 
    }
    ?>

        </tbody>

      </table>

      <hr color="#ececec" />

      <table>

        <tbody>

          <?php 
    $comments = wp_count_comments();
    ?>

          <tr class="first">

            <td class="b b-comments">

              <a href="edit-comments.php">

                <span class="total-count"><?php 
    echo $comments->total_comments;
    ?>
</span>

              </a>

            </td>

            <td class="last t comments">

              <a href="edit-comments.php"><?php 
    _e('Comments', 'piklist');
    ?>
</a>

            </td>

          </tr>

          <tr>

            <td class="b b_approved">

              <a href="edit-comments.php?comment_status=approved">

                <span class="approved-count"><?php 
    echo $comments->approved;
    ?>
</span>

              </a>

            </td>

            <td class="last t">

              <a href="edit-comments.php?comment_status=approved" class="approved"><?php 
    _e('Approved', 'piklist');
    ?>
</a>

            </td>

          </tr>

          <tr>

            <td class="b b-waiting">

              <a href="edit-comments.php?comment_status=moderated">

                <span class="pending-count"><?php 
    echo $comments->moderated;
    ?>
</span>

              </a>

            </td>

            <td class="last t">

              <a href="edit-comments.php?comment_status=moderated" class="waiting"><?php 
    _e('Pending', 'piklist');
    ?>
</a>

            </td>

          </tr>

          <tr>

            <td class="b b-spam">

              <a href="edit-comments.php?comment_status=spam">

                <span class="spam-count"><?php 
    echo $comments->spam;
    ?>
</span>

              </a>

            </td>

            <td class="last t">

              <a href="edit-comments.php?comment_status=spam" class="spam"><?php 
    _e('Spam', 'piklist');
    ?>
</a>

            </td>

          </tr>
       
        </tbody>

      </table>

  </div>

  <div class="table table_discussion">

    <p class="sub"><?php 
    _e('Organization', 'piklist');
    ?>
</p>

    <table>

      <tbody>

        <?php 
    $taxonomies = get_taxonomies(array(), 'objects');
    ?>

        <?php 
    foreach ($taxonomies as $taxonomy) {
        ?>

          <tr>

            <td class="first b b-<?php 
        echo mb_strtolower($taxonomy->name);
        ?>
">

              <a href="edit.php">
                <?php 
        $num_pages = wp_count_terms($taxonomy->name);
        ?>
                <?php 
        echo number_format_i18n($num_pages);
        ?>
              </a>

            </td>

            <td class="t <?php 
        echo mb_strtolower($taxonomy->name);
        ?>
">

                <a href="edit-tags.php?taxonomy=<?php 
        echo $taxonomy->name;
        ?>
">
                  <?php 
        echo $taxonomy->label;
        ?>
                </a>

            </td>

          </tr>

        <?php 
    }
    ?>
      

      </tbody>

    </table>
    
  </div>


  <div class="versions">

    <p>

    <?php 
    $theme = wp_get_theme();
    if ($theme->errors()) {
        if (!is_multisite() || is_super_admin()) {
            echo '<span class="error-message">' . __('ERROR: The themes directory is either empty or does not exist. Please check your installation.', 'piklist') . '</span>';
        }
    } elseif (!empty($wp_registered_sidebars)) {
        $sidebars_widgets = wp_get_sidebars_widgets();
        $num_widgets = 0;
        foreach ((array) $sidebars_widgets as $k => $v) {
            if ('wp_inactive_widgets' == $k || 'orphaned_widgets' == substr($k, 0, 16)) {
                continue;
            }
            if (is_array($v)) {
                $num_widgets = $num_widgets + count($v);
            }
        }
        $num = number_format_i18n($num_widgets);
        $switch_themes = $theme->display('Name');
        if (current_user_can('switch_themes')) {
            $switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
        }
        if (current_user_can('edit_theme_options')) {
            printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), '<span class="b">' . $switch_themes . '</span>', '<span class="b"><a href="widgets.php">' . $num . '</a></span>');
        } else {
            printf(_n('Theme %1$s with %2$s Widget', 'Theme %1$s with %2$s Widgets', $num_widgets), '<span class="b">' . $switch_themes . '</span>', '<span class="b">' . $num . '</span>');
        }
    } else {
        if (current_user_can('switch_themes')) {
            printf(__('Theme %1$s', 'piklist'), '<span class="b"><a href="themes.php">' . $theme->display('Name') . '</a></span>');
        } else {
            printf(__('Theme %1$s', 'piklist'), '<span class="b">' . $theme->display('Name') . '</span>');
        }
    }
    ?>

    </p>

    <?php 
    if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public')) {
        ?>

      <?php 
        $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content', 'piklist'));
        ?>
      <?php 
        $content = apply_filters('privacy_on_link_text', __('Search Engines Discouraged', 'piklist'));
        ?>

      <p>
        <a href='options-reading.php' title='<?php 
        echo $title;
        ?>
 '><?php 
        echo $content;
        ?>
</a>
      </p>

    <?php 
    }
    ?>

    <?php 
    update_right_now_message();
    ?>

    <br class="clear" />

  </div>

  <?php 
    do_action('rightnow_end');
    ?>
  <?php 
    do_action('activity_box_end');
    ?>

<?php 
}
コード例 #14
0
 public function add_menus()
 {
     // User related, aligned right.
     add_action('admin_bar_menu', 'wp_admin_bar_my_account_menu', 0);
     add_action('admin_bar_menu', 'wp_admin_bar_search_menu', 4);
     add_action('admin_bar_menu', 'wp_admin_bar_my_account_item', 7);
     // Site related.
     add_action('admin_bar_menu', 'wp_admin_bar_wp_menu', 10);
     add_action('admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20);
     add_action('admin_bar_menu', 'wp_admin_bar_site_menu', 30);
     add_action('admin_bar_menu', 'wp_admin_bar_updates_menu', 40);
     // Content related.
     if (!is_network_admin() && !is_user_admin()) {
         add_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
         add_action('admin_bar_menu', 'wp_admin_bar_new_content_menu', 70);
     }
     add_action('admin_bar_menu', 'wp_admin_bar_edit_menu', 80);
     add_action('admin_bar_menu', 'wp_admin_bar_add_secondary_groups', 200);
     do_action('add_admin_bar_menus');
 }
コード例 #15
0
ファイル: all-status.php プロジェクト: wir/wp-user-profiles
/**
 * Render the primary metabox for user profile screen
 *
 * @since 0.1.0
 *
 * @param WP_User $user The WP_User object to be edited.
 */
function wp_user_profiles_status_metabox($user = null)
{
    // Bail if no user id or if the user has not activated their account yet
    if (empty($user->ID)) {
        return;
    }
    ?>

	<div class="submitbox">
		<div id="minor-publishing">
			<div id="misc-publishing-actions">
				<?php 
    // Get the spam status once here to compare against below
    if (apply_filters('wp_user_profiles_show_status', true) && (current_user_can('edit_user', $user->ID) && !IS_PROFILE_PAGE && !is_user_admin() && !in_array($user->user_login, get_super_admins()))) {
        ?>

					<div class="misc-pub-section" id="comment-status-radio">
						<label class="approved"><input type="radio" name="user_status" value="ham" <?php 
        checked($user->user_status, 0);
        ?>
><?php 
        esc_html_e('Active', 'wp-user-profiles');
        ?>
</label><br>
						<label><input type="radio" name="user_status" value="inactive" <?php 
        checked($user->user_status, 2);
        ?>
><?php 
        esc_html_e('Inactive', 'wp-user-profiles');
        ?>
</label><br>
						<label class="spam"><input type="radio" name="user_status" value="spam" <?php 
        checked($user->user_status, 1);
        ?>
><?php 
        esc_html_e('Spammer', 'wp-user-profiles');
        ?>
</label>
					</div>

				<?php 
    }
    ?>

				<div class="misc-pub-section curtime misc-pub-section-last">
					<?php 
    $datef = get_option('date_format') . ' ' . get_option('time_format');
    $date = date_i18n($datef, strtotime($user->user_registered));
    ?>

					<span id="timestamp"><?php 
    printf(esc_html__('Registered on: %1$s', 'wp-user-profiles'), '<strong>' . $date . '</strong>');
    ?>
</span>
				</div>
			</div>

			<div class="clear"></div>
		</div>

		<div id="major-publishing-actions">
			<div id="publishing-action">
				<a class="button" href="<?php 
    echo esc_url(get_author_posts_url($user->ID));
    ?>
" target="_blank"><?php 
    esc_html_e('View User', 'wp-user-profiles');
    ?>
</a>
				<?php 
    submit_button(esc_html__('Update', 'wp-user-profiles'), 'primary', 'save', false);
    ?>
				<input type="hidden" name="action" value="update" />
				<input type="hidden" name="user_id" id="user_id" value="<?php 
    echo esc_attr($user->ID);
    ?>
" />
			</div>
			<div class="clear"></div>
		</div>
	</div>

	<?php 
}
コード例 #16
0
ファイル: user-edit.php プロジェクト: harissonsofia/WordPress
}
if (!$user_id && IS_PROFILE_PAGE) {
    $user_id = $current_user->ID;
} elseif (!$user_id && !IS_PROFILE_PAGE) {
    wp_die(__('Invalid user ID.'));
} elseif (!get_userdata($user_id)) {
    wp_die(__('Invalid user ID.'));
}
wp_enqueue_script('user-profile');
$title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User');
if (current_user_can('edit_users') && !IS_PROFILE_PAGE) {
    $submenu_file = 'users.php';
} else {
    $submenu_file = 'profile.php';
}
if (current_user_can('edit_users') && !is_user_admin()) {
    $parent_file = 'users.php';
} else {
    $parent_file = 'profile.php';
}
$profile_help = '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' . '<p>' . __('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.') . '</p>' . '<p>' . __('Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.') . '</p>' . '<p>' . __('You can log out of other devices, such as your phone or a public computer, by clicking the Log Out of All Other Sessions button.') . '</p>' . '<p>' . __('Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.') . '</p>' . '<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => $profile_help));
get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="https://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>');
$wp_http_referer = remove_query_arg(array('update', 'delete_count'), $wp_http_referer);
$user_can_edit = current_user_can('edit_posts') || current_user_can('edit_pages');
/**
 * Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
 *
 * @since 2.7.0
 *
 * @param object $user User data object
コード例 #17
0
/**
 * Verify that some BP prerequisites are set up properly, and notify the admin if not.
 *
 * On every Dashboard page, this function checks the following:
 *   - that pretty permalinks are enabled.
 *   - that every BP component that needs a WP page for a directory has one.
 *   - that no WP page has multiple BP components associated with it.
 * The administrator will be shown a notice for each check that fails.
 *
 * @global WPDB $wpdb WordPress DB object
 * @global WP_Rewrite $wp_rewrite
 *
 * @since 1.2.0
 */
function bp_core_activation_notice()
{
    global $wp_rewrite, $wpdb;
    // Only the super admin gets warnings.
    if (!bp_current_user_can('bp_moderate')) {
        return;
    }
    // Bail in user admin.
    if (is_user_admin()) {
        return;
    }
    // On multisite installs, don't load on a non-root blog, unless do_network_admin is overridden.
    if (is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog()) {
        return;
    }
    // Bail if in network admin, and BuddyPress is not network activated.
    if (is_network_admin() && !bp_is_network_activated()) {
        return;
    }
    /**
     * Check to make sure that the blog setup routine has run. This can't
     * happen during the wizard because of the order which the components
     * are loaded.
     */
    if (bp_is_active('blogs')) {
        $bp = buddypress();
        $count = $wpdb->get_var("SELECT COUNT(*) FROM {$bp->blogs->table_name}");
        if (empty($count)) {
            bp_blogs_record_existing_blogs();
        }
    }
    // Add notice if no rewrite rules are enabled.
    if (empty($wp_rewrite->permalink_structure)) {
        bp_core_add_admin_notice(sprintf(__('<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress'), admin_url('options-permalink.php')), 'error');
    }
    // Get BuddyPress instance.
    $bp = buddypress();
    /**
     * Check for orphaned BP components (BP component is enabled, no WP page exists).
     */
    $orphaned_components = array();
    $wp_page_components = array();
    // Only components with 'has_directory' require a WP page to function.
    foreach (array_keys($bp->loaded_components) as $component_id) {
        if (!empty($bp->{$component_id}->has_directory)) {
            $wp_page_components[] = array('id' => $component_id, 'name' => isset($bp->{$component_id}->name) ? $bp->{$component_id}->name : ucwords($bp->{$component_id}->id));
        }
    }
    // Activate and Register are special cases. They are not components but they need WP pages.
    // If user registration is disabled, we can skip this step.
    if (bp_get_signup_allowed()) {
        $wp_page_components[] = array('id' => 'activate', 'name' => __('Activate', 'buddypress'));
        $wp_page_components[] = array('id' => 'register', 'name' => __('Register', 'buddypress'));
    }
    // On the first admin screen after a new installation, this isn't set, so grab it to suppress
    // a misleading error message.
    if (empty($bp->pages->members)) {
        $bp->pages = bp_core_get_directory_pages();
    }
    foreach ($wp_page_components as $component) {
        if (!isset($bp->pages->{$component['id']})) {
            $orphaned_components[] = $component['name'];
        }
    }
    // Special case: If the Forums component is orphaned, but the bbPress 1.x installation is
    // not correctly set up, don't show a nag. (In these cases, it's probably the case that the
    // user is using bbPress 2.x; see https://buddypress.trac.wordpress.org/ticket/4292.
    if (isset($bp->forums->name) && in_array($bp->forums->name, $orphaned_components) && !bp_forums_is_installed_correctly()) {
        $forum_key = array_search($bp->forums->name, $orphaned_components);
        unset($orphaned_components[$forum_key]);
        $orphaned_components = array_values($orphaned_components);
    }
    if (!empty($orphaned_components)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('The following active BuddyPress Components do not have associated WordPress Pages: %2$s. <a href="%1$s">Repair</a>', 'buddypress'), esc_url($admin_url), '<strong>' . implode('</strong>, <strong>', $orphaned_components) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
    // BP components cannot share a single WP page. Check for duplicate assignments, and post a message if found.
    $dupe_names = array();
    $page_ids = (array) bp_core_get_directory_page_ids();
    $dupes = array_diff_assoc($page_ids, array_unique($page_ids));
    if (!empty($dupes)) {
        foreach (array_keys($dupes) as $dupe_component) {
            $dupe_names[] = $bp->pages->{$dupe_component}->title;
        }
        // Make sure that there are no duplicate duplicates :).
        $dupe_names = array_unique($dupe_names);
    }
    // If there are duplicates, post a message about them.
    if (!empty($dupe_names)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('Each BuddyPress Component needs its own WordPress page. The following WordPress Pages have more than one component associated with them: %2$s. <a href="%1$s">Repair</a>', 'buddypress'), esc_url($admin_url), '<strong>' . implode('</strong>, <strong>', $dupe_names) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
}
コード例 #18
0
ファイル: plugin.php プロジェクト: GolgoSoft/KeenerWP
 /**
  * pre-dispatching logic for admin page controllers
  */
 public function __adminInit()
 {
     // create history folder
     $uploads = wp_upload_dir();
     $wpallimportDirs = array(WP_ALL_IMPORT_UPLOADS_BASE_DIRECTORY, self::LOGS_DIRECTORY, self::FILES_DIRECTORY, self::TEMP_DIRECTORY, self::UPLOADS_DIRECTORY, self::HISTORY_DIRECTORY);
     foreach ($wpallimportDirs as $destination) {
         $dir = $uploads['basedir'] . DIRECTORY_SEPARATOR . $destination;
         if (!is_dir($dir)) {
             wp_mkdir_p($dir);
         }
         if (!@file_exists($dir . DIRECTORY_SEPARATOR . 'index.php')) {
             @touch($dir . DIRECTORY_SEPARATOR . 'index.php');
         }
     }
     self::$session = new PMXI_Handler();
     $input = new PMXI_Input();
     $page = strtolower($input->getpost('page', ''));
     if (preg_match('%^' . preg_quote(str_replace('_', '-', self::PREFIX), '%') . '([\\w-]+)$%', $page)) {
         //$this->adminDispatcher($page, strtolower($input->getpost('action', 'index')));
         $action = strtolower($input->getpost('action', 'index'));
         // capitalize prefix and first letters of class name parts
         if (function_exists('preg_replace_callback')) {
             $controllerName = preg_replace_callback('%(^' . preg_quote(self::PREFIX, '%') . '|_).%', array($this, "replace_callback"), str_replace('-', '_', $page));
         } else {
             $controllerName = preg_replace('%(^' . preg_quote(self::PREFIX, '%') . '|_).%e', 'strtoupper("$0")', str_replace('-', '_', $page));
         }
         $actionName = str_replace('-', '_', $action);
         if (method_exists($controllerName, $actionName)) {
             @ini_set("max_input_time", PMXI_Plugin::getInstance()->getOption('max_input_time'));
             @ini_set("max_execution_time", PMXI_Plugin::getInstance()->getOption('max_execution_time'));
             if (!get_current_user_id() or !current_user_can('manage_options')) {
                 // This nonce is not valid.
                 die('Security check');
             } else {
                 $this->_admin_current_screen = (object) array('id' => $controllerName, 'base' => $controllerName, 'action' => $actionName, 'is_ajax' => strpos($_SERVER["HTTP_ACCEPT"], 'json') !== false, 'is_network' => is_network_admin(), 'is_user' => is_user_admin());
                 add_filter('current_screen', array($this, 'getAdminCurrentScreen'));
                 add_filter('admin_body_class', create_function('', 'return "' . 'wpallimport-plugin";'));
                 $controller = new $controllerName();
                 if (!$controller instanceof PMXI_Controller_Admin) {
                     throw new Exception("Administration page `{$page}` matches to a wrong controller type.");
                 }
                 if ($this->_admin_current_screen->is_ajax) {
                     // ajax request
                     $controller->{$action}();
                     do_action('pmxi_action_after');
                     die;
                     // stop processing since we want to output only what controller is randered, nothing in addition
                 } elseif (!$controller->isInline) {
                     @ob_start();
                     $controller->{$action}();
                     self::$buffer = @ob_get_clean();
                 } else {
                     self::$buffer_callback = array($controller, $action);
                 }
             }
         } else {
             // redirect to dashboard if requested page and/or action don't exist
             wp_redirect(admin_url());
             die;
         }
     }
 }
コード例 #19
0
require $xerte_toolkits_site->php_library_path . "user_library.php";
/*
 * Check the ID is numeric
 */
if (isset($_SESSION['toolkits_logon_id'])) {
    if (is_numeric($_GET['template_id'])) {
        $safe_template_id = (int) $_GET['template_id'];
        // Need to run a proper string replace on any embedded instances of '$xerte_toolkits_site->database_table_prefix' so it's actually expanded.
        $query_for_preview_content_strip = str_replace("\" . \$xerte_toolkits_site->database_table_prefix . \"", $xerte_toolkits_site->database_table_prefix, $xerte_toolkits_site->play_edit_preview_query);
        /*
         * Standard query
         */
        $query_for_preview_content = str_replace("TEMPLATE_ID_TO_REPLACE", $safe_template_id, $query_for_preview_content_strip);
        $row = db_query_one($query_for_preview_content);
        // get their username from the db which matches their login_id from the $_SESSION
        $row_username = db_query_one("select username from {$xerte_toolkits_site->database_table_prefix}logindetails where login_id=?", array($row['user_id']));
        // is there a matching template?
        if (!empty($row)) {
            // if they're an admin or have rights to see the template, then show it.
            if (is_user_admin() || has_rights_to_this_template($row['template_id'], $_SESSION['toolkits_logon_id'])) {
                require $xerte_toolkits_site->root_file_path . "modules/" . $row['template_framework'] . "/preview_site.php";
                show_preview_code($row, $row_username);
                exit(0);
            }
        }
    } else {
        echo PREVIEW_RESOURCE_FAIL;
    }
} else {
    echo PREVIEW_RESOURCE_FAIL;
}
 private static function _getPageNowAdminURLBasePath()
 {
     if (is_network_admin()) {
         $_sNeedle = '#/wp-admin/network/?(.*?)$#i';
     } else {
         if (is_user_admin()) {
             $_sNeedle = '#/wp-admin/user/?(.*?)$#i';
         } else {
             $_sNeedle = '#/wp-admin/?(.*?)$#i';
         }
     }
     preg_match($_sNeedle, $_SERVER['PHP_SELF'], $_aMatches);
     return preg_replace('#\\?.*?$#', '', trim($_aMatches[1], '/'));
 }
コード例 #21
0
/**
 * Checks if a user is logged in, if not it redirects them to the login page.
 *
 * @since 1.5
 */
function auth_redirect() {
	// Checks if a user is logged in, if not redirects them to the login page

	$secure = ( is_ssl() || force_ssl_admin() );

	$secure = apply_filters('secure_auth_redirect', $secure);

	// If https is required and request is http, redirect
	if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
		if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
			wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
			exit();
		} else {
			wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
			exit();
		}
	}

	if ( is_user_admin() )
		$scheme = 'logged_in';
	else
		$scheme = apply_filters( 'auth_redirect_scheme', '' );

	if ( $user_id = wp_validate_auth_cookie( '',  $scheme) ) {
		do_action('auth_redirect', $user_id);

		// If the user wants ssl but the session is not ssl, redirect.
		if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
			if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
				wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
				exit();
			} else {
				wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
				exit();
			}
		}

		return;  // The cookie is good so we're done
	}

	// The cookie is no good so force login
	nocache_headers();

	$redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );

	$login_url = wp_login_url($redirect, true);

	wp_redirect($login_url);
	exit();
}
コード例 #22
0
 /**
  * Checks if a user is logged in, if not it redirects them to the login page.
  *
  * @since 1.5.0
  */
 function auth_redirect()
 {
     // Checks if a user is logged in, if not redirects them to the login page
     $secure = is_ssl() || force_ssl_admin();
     /**
      * Filter whether to use a secure authentication redirect.
      *
      * @since 3.1.0
      *
      * @param bool $secure Whether to use a secure authentication redirect. Default false.
      */
     $secure = apply_filters('secure_auth_redirect', $secure);
     // If https is required and request is http, redirect
     if ($secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
         if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
             wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https'));
             exit;
         } else {
             wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
             exit;
         }
     }
     if (is_user_admin()) {
         $scheme = 'logged_in';
     } else {
         /**
          * Filter the authentication redirect scheme.
          *
          * @since 2.9.0
          *
          * @param string $scheme Authentication redirect scheme. Default empty.
          */
         $scheme = apply_filters('auth_redirect_scheme', '');
     }
     if ($user_id = wp_validate_auth_cookie('', $scheme)) {
         /**
          * Fires before the authentication redirect.
          *
          * @since 2.8.0
          *
          * @param int $user_id User ID.
          */
         do_action('auth_redirect', $user_id);
         // If the user wants ssl but the session is not ssl, redirect.
         if (!$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
             if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
                 wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https'));
                 exit;
             } else {
                 wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
                 exit;
             }
         }
         return;
         // The cookie is good so we're done
     }
     // The cookie is no good so force login
     nocache_headers();
     $redirect = strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ? wp_get_referer() : set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     $login_url = wp_login_url($redirect, true);
     wp_redirect($login_url);
     exit;
 }
コード例 #23
0
 /**
  * Highlight the Users menu if on Edit Profile and check if on the user's admin profile.
  *
  * @since 2.1.0
  */
 public function profile_admin_head()
 {
     global $submenu_file, $parent_file;
     // Is the user editing their own profile?
     if (is_user_admin() || defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE) {
         $this->is_self_profile = true;
         // Is the user attempting to edit their own profile.
     } elseif (isset($_GET['user_id']) || isset($_GET['page']) && 'bp-profile-edit' === $_GET['page']) {
         $this->is_self_profile = (bool) ($this->get_user_id() === $this->current_user_id);
     }
     // Force the parent file to users.php to open the correct top level menu
     // but only if not editing a site via the network site editing page.
     if ('sites.php' !== $parent_file) {
         $parent_file = 'users.php';
         $submenu_file = 'users.php';
     }
     // Editing your own profile, so recheck some vars.
     if (true === $this->is_self_profile) {
         // Use profile.php as the edit page.
         $edit_page = 'profile.php';
         // Set profile.php as the parent & sub files to correct the menu nav.
         if (is_blog_admin() || is_user_admin()) {
             $parent_file = 'profile.php';
             $submenu_file = 'profile.php';
         }
         // Not editing yourself, so use user-edit.php.
     } else {
         $edit_page = 'user-edit.php';
     }
     if (is_user_admin()) {
         $this->edit_profile_url = add_query_arg($this->edit_profile_args, user_admin_url('profile.php'));
         $this->edit_url = user_admin_url('profile.php');
     } elseif (is_blog_admin()) {
         $this->edit_profile_url = add_query_arg($this->edit_profile_args, admin_url('users.php'));
         $this->edit_url = admin_url($edit_page);
     } elseif (is_network_admin()) {
         $this->edit_profile_url = add_query_arg($this->edit_profile_args, network_admin_url('users.php'));
         $this->edit_url = network_admin_url($edit_page);
     }
 }
コード例 #24
0
ファイル: index.php プロジェクト: nxtclass/NXTClass
 *
 * @package NXTClass
 * @subpackage Administration
 */
/** Load NXTClass Bootstrap */
require_once './admin.php';
/** Load NXTClass dashboard API */
require_once ABSPATH . 'nxt-admin/includes/dashboard.php';
nxt_dashboard_setup();
nxt_enqueue_script('dashboard');
nxt_enqueue_script('plugin-install');
nxt_enqueue_script('media-upload');
add_thickbox();
$title = __('Dashboard');
$parent_file = 'index.php';
if (is_user_admin()) {
    add_screen_option('layout_columns', array('max' => 4, 'default' => 1));
} else {
    add_screen_option('layout_columns', array('max' => 4, 'default' => 2));
}
$help = '<p>' . __('Welcome to your NXTClass Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of NXTClass. You can get help for any screen by clicking the Help tab in the upper corner.') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => $help));
// Help tabs
$help = '<p>' . __('The left-hand navigation menu provides links to all of the NXTClass administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.') . '</p>';
$help .= '<p>' . __('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful NXTClass information.') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'help-navigation', 'title' => __('Navigation'), 'content' => $help));
$help = '<p>' . __('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.') . '</p>';
$help .= '<p>' . __('<strong>Screen Options</strong> - Use the Screen Options tab to choose which Dashboard boxes to show, and how many columns to display.') . '</p>';
$help .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.') . '</p>';
$help .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.') . '</p>';
get_current_screen()->add_help_tab(array('id' => 'help-layout', 'title' => __('Layout'), 'content' => $help));
コード例 #25
0
ファイル: menu.php プロジェクト: vivekkodira1/wordpress
        $_wp_real_parent_file[$old_parent] = $new_parent;
        $menu[$id][2] = $new_parent;
        foreach ($submenu[$old_parent] as $index => $data) {
            $submenu[$new_parent][$index] = $submenu[$old_parent][$index];
            unset($submenu[$old_parent][$index]);
        }
        unset($submenu[$old_parent], $index);
        if (isset($_wp_submenu_nopriv[$old_parent])) {
            $_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
        }
    }
}
unset($id, $data, $subs, $first_sub, $old_parent, $new_parent);
if (is_network_admin()) {
    do_action('network_admin_menu', '');
} elseif (is_user_admin()) {
    do_action('user_admin_menu', '');
} else {
    do_action('admin_menu', '');
}
// Remove menus that have no accessible submenus and require privs that the user does not have.
// Run re-parent loop again.
foreach ($menu as $id => $data) {
    if (!current_user_can($data[1])) {
        $_wp_menu_nopriv[$data[2]] = true;
    }
    // If there is only one submenu and it is has same destination as the parent,
    // remove the submenu.
    if (!empty($submenu[$data[2]]) && 1 == count($submenu[$data[2]])) {
        $subs = $submenu[$data[2]];
        $first_sub = array_shift($subs);
コード例 #26
0
ファイル: admin-bar.php プロジェクト: nxtclass/NXTClass
/**
 * Add the "Site Name" menu.
 *
 * @since 3.3.0
 */
function nxt_admin_bar_site_menu($nxt_admin_bar)
{
    global $current_site;
    // Don't show for logged out users.
    if (!is_user_logged_in()) {
        return;
    }
    // Show only when the user is a member of this site, or they're a super admin.
    if (!is_user_member_of_blog() && !is_super_admin()) {
        return;
    }
    $blogname = get_bloginfo('name');
    if (empty($blogname)) {
        $blogname = preg_replace('#^(https?://)?(www.)?#', '', get_home_url());
    }
    if (is_network_admin()) {
        $blogname = sprintf(__('Network Admin: %s'), esc_html($current_site->site_name));
    } elseif (is_user_admin()) {
        $blogname = sprintf(__('Global Dashboard: %s'), esc_html($current_site->site_name));
    }
    $title = nxt_html_excerpt($blogname, 40);
    if ($title != $blogname) {
        $title = trim($title) . '&hellip;';
    }
    $nxt_admin_bar->add_menu(array('id' => 'site-name', 'title' => $title, 'href' => is_admin() ? home_url('/') : admin_url()));
    // Create submenu items.
    if (is_admin()) {
        // Add an option to visit the site.
        $nxt_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'view-site', 'title' => __('Visit Site'), 'href' => home_url('/')));
        // We're on the front end, print a copy of the admin menu.
    } else {
        // Add the dashboard item.
        $nxt_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url()));
        // Add the appearance submenu items.
        nxt_admin_bar_appearance_menu($nxt_admin_bar);
    }
}
コード例 #27
0
 public static function is_user_admin()
 {
     return is_user_admin();
 }
コード例 #28
0
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * 
 * properties template, shows the basic page on the properties window
 *
 * @author Patrick Lockley
 * @version 1.0
 * @package
 */
require_once "../../../config.php";
include "../template_status.php";
include "../screen_size_library.php";
include "../url_library.php";
include "../user_library.php";
include "properties_library.php";
if (!empty($_POST['template_id']) && is_numeric($_POST['template_id'])) {
    $template_id = (int) $_POST['template_id'];
    if (has_rights_to_this_template($template_id, $_SESSION['toolkits_logon_id']) || is_user_admin()) {
        properties_display($xerte_toolkits_site, $template_id, false, "");
        exit(0);
    }
}
properties_display_fail();
コード例 #29
0
/**
 * Get the URL to the user's profile editor.
 *
 * @since 3.1.0
 *
 * @param int    $user_id Optional. User ID. Defaults to current user.
 * @param string $scheme  The scheme to use. Default is 'admin', which obeys force_ssl_admin() and is_ssl().
 *                        'http' or 'https' can be passed to force those schemes.
 * @return string Dashboard url link with optional path appended.
 */
function get_edit_profile_url($user_id = 0, $scheme = 'admin')
{
    $user_id = $user_id ? (int) $user_id : get_current_user_id();
    if (is_user_admin()) {
        $url = user_admin_url('profile.php', $scheme);
    } elseif (is_network_admin()) {
        $url = network_admin_url('profile.php', $scheme);
    } else {
        $url = get_dashboard_url($user_id, 'profile.php', $scheme);
    }
    /**
     * Filter the URL for a user's profile editor.
     *
     * @since 3.1.0
     *
     * @param string $url     The complete URL including scheme and path.
     * @param int    $user_id The user ID.
     * @param string $scheme  Scheme to give the URL context. Accepts 'http', 'https', 'login',
     *                        'login_post', 'admin', 'relative' or null.
     */
    return apply_filters('edit_profile_url', $url, $user_id, $scheme);
}
コード例 #30
0
/**
 * Add the "Site Name" menu.
 *
 * @since 3.3.0
 *
 * @param WP_Admin_Bar $wp_admin_bar
 */
function wp_admin_bar_site_menu($wp_admin_bar)
{
    // Don't show for logged out users.
    if (!is_user_logged_in()) {
        return;
    }
    // Show only when the user is a member of this site, or they're a super admin.
    if (!is_user_member_of_blog() && !is_super_admin()) {
        return;
    }
    $blogname = get_bloginfo('name');
    if (!$blogname) {
        $blogname = preg_replace('#^(https?://)?(www.)?#', '', get_home_url());
    }
    if (is_network_admin()) {
        $blogname = sprintf(__('Network Admin: %s'), esc_html(get_current_site()->site_name));
    } elseif (is_user_admin()) {
        $blogname = sprintf(__('Global Dashboard: %s'), esc_html(get_current_site()->site_name));
    }
    $title = wp_html_excerpt($blogname, 40, '&hellip;');
    $wp_admin_bar->add_menu(array('id' => 'site-name', 'title' => $title, 'href' => is_admin() ? home_url('/') : admin_url()));
    // Create submenu items.
    if (is_admin()) {
        // Add an option to visit the site.
        $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'view-site', 'title' => __('Visit Site'), 'href' => home_url('/')));
        if (is_blog_admin() && is_multisite() && current_user_can('manage_sites')) {
            $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'edit-site', 'title' => __('Edit Site'), 'href' => network_admin_url('site-info.php?id=' . get_current_blog_id())));
        }
    } else {
        // We're on the front end, link to the Dashboard.
        $wp_admin_bar->add_menu(array('parent' => 'site-name', 'id' => 'dashboard', 'title' => __('Dashboard'), 'href' => admin_url()));
        // Add the appearance submenu items.
        wp_admin_bar_appearance_menu($wp_admin_bar);
    }
}