当前位置: 首页>>代码示例>>PHP>>正文


PHP __awp函数代码示例

本文整理汇总了PHP中__awp函数的典型用法代码示例。如果您正苦于以下问题:PHP __awp函数的具体用法?PHP __awp怎么用?PHP __awp使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了__awp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handle_submission

 function handle_submission($action, $sitewide = false, $customize_defaults = false)
 {
     if ($sitewide || $customize_defaults) {
         if (function_exists('is_super_admin') && !is_super_admin()) {
             wp_die(__awp('Cheatin’ uh?'));
         }
     }
     if ($customize_defaults) {
         $sitewide = true;
     }
     // default customization is only for per-blog options, but is sitewide in terms of DB storage in sitemeta table
     if ('flush' == $action) {
         wpp_cache_flush_all_sites();
         return;
     }
     if (!in_array($_GET["page"], array('rs-options', 'rs-site_options', 'rs-default_options'))) {
         return;
     }
     if (empty($_POST['rs_submission_topic'])) {
         return;
     }
     if ('options' == $_POST['rs_submission_topic']) {
         if (!is_option_administrator_rs()) {
             wp_die(__awp('Cheatin’ uh?'));
         }
         scoper_refresh_default_options();
         scoper_refresh_default_otype_options();
         $method = "{$action}_options";
         if (method_exists($this, $method)) {
             call_user_func(array($this, $method), $sitewide, $customize_defaults);
         }
         $method = "{$action}_realm";
         if (method_exists($this, $method)) {
             call_user_func(array($this, $method), $sitewide, $customize_defaults);
         }
         if ($sitewide && !$customize_defaults) {
             $method = "{$action}_sitewide";
             if (method_exists($this, $method)) {
                 call_user_func(array($this, $method));
             }
         }
         if (isset($_POST['rs_role_defs']) && empty($_POST['rs_defaults'])) {
             if ($customize_defaults) {
                 $function = 'update_rs_role_defs_customize_defaults';
             } elseif ($sitewide) {
                 $function = 'update_rs_role_defs_sitewide';
             } else {
                 $function = 'update_rs_role_defs';
             }
             add_action('init', array(&$this, $function), 20);
             // this must execute after other plugins have added rs config filters
         }
     }
     scoper_refresh_options();
     // force DB schema update if sitewide_groups option was changed
     require SCOPER_ABSPATH . '/db-config_rs.php';
 }
开发者ID:par-orillonsoft,项目名称:creationOfSociety,代码行数:57,代码来源:submittee_rs.php

示例2: flt_manage_posts_custom_column

 function flt_manage_posts_custom_column($column_name, $id)
 {
     global $scoper, $scoper_role_usage, $posts;
     switch ($column_name) {
         case 'restricted':
             $restricted_ops = array();
             if (isset($scoper_role_usage->objscoped_ids['post'][$id]['read'])) {
                 $restricted_ops[] = '<strong>' . __('Read', 'scoper') . '</strong>';
             } elseif (isset($scoper_role_usage->termscoped_ids['post'][$id]['read'])) {
                 $restricted_ops[] = __('Read', 'scoper');
             }
             if (isset($scoper_role_usage->objscoped_ids['post'][$id]['edit'])) {
                 $restricted_ops[] = '<strong>' . __awp('Edit') . '</strong>';
             } elseif (isset($scoper_role_usage->termscoped_ids['post'][$id]['edit'])) {
                 $restricted_ops[] = __awp('Edit');
             }
             if ($restricted_ops) {
                 echo implode(", ", $restricted_ops);
             }
             break;
         case 'termroles':
             $role_names = array();
             if (isset($scoper_role_usage->have_termrole_ids['post'][$id])) {
                 foreach (array_keys($scoper_role_usage->have_termrole_ids['post'][$id]) as $role_handle) {
                     $role_names[] = str_replace(' ', '&nbsp;', $scoper->role_defs->get_micro_abbrev($role_handle));
                 }
                 sort($role_names);
                 echo implode(", ", $role_names);
             }
             break;
         case 'objroles':
             $role_names = array();
             if (isset($scoper_role_usage->have_objrole_ids['post'][$id])) {
                 foreach (array_keys($scoper_role_usage->have_objrole_ids['post'][$id]) as $role_handle) {
                     $role_names[] = str_replace(' ', '&nbsp;', $scoper->role_defs->get_micro_abbrev($role_handle, OBJECT_UI_RS));
                 }
                 sort($role_names);
                 echo implode(", ", $role_names);
             }
             break;
     }
 }
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:42,代码来源:filters-admin-ui-listing_rs.php

示例3: printGroupMembers

function printGroupMembers()
{
    $results = ScoperAdminLib::get_all_groups(FILTERED_RS);
    $alt = false;
    if (isset($results) && count($results) > 0) {
        echo "\n<table class='rs-member_table' width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">";
        echo "\n\t<tr class=\"thead\">";
        echo "\n\t\t<th>Group Name</th>\n\t\t<th>Members</th>\n\t\t<th>&nbsp;</th>";
        echo "\n\t</tr>";
        foreach ($results as $result) {
            $alt = !$alt;
            $style = $alt ? 'class=\'alternate\'' : 'margin: 1em 0 1em 0;';
            echo "<tr " . $style . "><td>" . $result->display_name . "</td><td>";
            if ($members = ScoperAdminLib::get_group_members($result->ID)) {
                printf(_n('%d user', '%d users', count($members), 'scoper'), count($members));
                echo '<br />';
                foreach ($members as $member) {
                    echo "- " . $member->display_name . "<br />";
                }
            } else {
                if ($result->meta_id) {
                    _e('(automatic)', 'scoper');
                } else {
                    _e('(no users)', 'scoper');
                }
            }
            echo "</td><td " . $style . ">";
            if (!$result->meta_id) {
                echo "<a class='edit' href='admin.php?page=rs-group_members&amp;mode=edit&amp;id={$result->ID}'>" . __awp('Edit') . "</a>";
            }
            echo "</td></tr>";
        }
        echo "\n</table>";
    } else {
        echo "<p><strong>" . __('No groups available.', 'scoper') . "</strong></p>";
    }
}
开发者ID:par-orillonsoft,项目名称:creationOfSociety,代码行数:37,代码来源:group_members.php

示例4: item_tree

    function item_tree($scope, $mode, $src, $otype_or_tx, $all_items, $assigned_roles, $strict_items, $role_defs_by_otype, $role_codes, $args = array())
    {
        $defaults = array('admin_items' => '', 'editable_roles' => '', 'ul_class' => 'rs-termlist', 'ie_link_style' => '', 'object_names' => '', 'table_captions' => '', 'err' => '', 'object_status' => '', 'agent_caption_plural' => '', 'agent_list_prefix' => '', 'agent_names' => '', 'default_hide_empty' => false, 'role_bases' => array(ROLE_BASIS_USER, ROLE_BASIS_GROUPS), 'single_item' => false);
        $args = array_merge($defaults, (array) $args);
        extract($args);
        global $scoper;
        if (!is_object($src)) {
            $src = $scoper->data_sources->get($src);
        }
        $col_id = $src->cols->id;
        $col_name = $src->cols->name;
        $col_parent = isset($src->cols->parent) ? $src->cols->parent : '';
        $item_label = $otype_or_tx->labels->singular_name;
        if (TERM_SCOPE_RS == $scope) {
            $src_or_tx_name = $otype_or_tx->name;
            $edit_url_base = !empty($otype_or_tx->edit_url) ? $otype_or_tx->edit_url : '';
        } else {
            $src_or_tx_name = $src->name;
            $edit_url_base = !empty($src->edit_url) ? $src->edit_url : '';
        }
        if ($default_hide_empty) {
            $hide_tr_sfx = '-hide';
            $hide_li_sfx = '-hide';
        } else {
            $hide_tr_sfx = '';
            $hide_li_sfx = '';
        }
        $nextlink = '';
        $prevlink = '';
        if (empty($admin_items)) {
            $admin_items = array();
        }
        if (empty($agent_caption_plural)) {
            $agent_caption_plural = __('Users or Groups', 'scoper');
        }
        if (empty($agent_list_prefix)) {
            $agent_list_prefix = array();
            $agent_list_prefix[ROLE_BASIS_USER] = '';
            $agent_list_prefix[ROLE_BASIS_GROUPS] = __('Groups') . ': ';
        }
        static $prevtext, $nexttext, $is_administrator, $role_header, $agents_header;
        if (empty($prevtext)) {
            // buffer prev/next caption for display with each term
            //$prevtext = _ x('prev', '|abbreviated link to previous item', 'scoper');
            //$nexttext = _ x('next', '|abbreviated link to next item', 'scoper');
            $prevtext = __('prev', 'scoper');
            $nexttext = __('next', 'scoper');
            $is_administrator = is_administrator_rs($src, 'user');
            $role_header = __awp('Role');
            switch ($mode) {
                case ROLE_ASSIGNMENT_RS:
                    //$agents_header = sprintf( _ x('Current %s', 'users or groups', 'scoper'), $agent_caption_plural);
                    $agents_header = sprintf(__('Current %s', 'scoper'), $agent_caption_plural);
                    break;
                case ROLE_RESTRICTION_RS:
                    $agents_header = __('Current Restrictions', 'scoper');
                    break;
                default:
                    return;
            }
        }
        // disregard roles that don't apply to this scope
        foreach ($role_defs_by_otype as $object_type => $role_defs) {
            foreach ($role_defs as $role_handle => $role) {
                if (!isset($role->valid_scopes[$scope])) {
                    unset($role_defs_by_otype[$object_type][$role_handle]);
                }
            }
        }
        // for object scope, assign "private post reader" role, but label it as "post reader" to limit confusion
        $role_display_name = array();
        foreach ($role_defs_by_otype as $role_defs) {
            foreach (array_keys($role_defs) as $role_handle) {
                $role_display_name[$role_handle] = $scoper->role_defs->get_display_name($role_handle, $scope . '_ui');
            }
        }
        // display a separate role assignment list for each individual term / object
        $last_id = -1;
        $last_name = '';
        $last_parent_id = -1;
        $parent_id = 0;
        $parents = array();
        $depth = 0;
        $_top_link = "<a{$ie_link_style} href='#scoper_top'>" . __('top', 'scoper') . '</a>';
        $tr_display = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false ? 'block' : 'table-row';
        $show_all_caption = __('show all', 'scoper');
        echo "<ul class='{$ul_class}' style='padding-left:0.1em;'>";
        if (empty($all_items)) {
            $all_items = array();
        }
        if (!$single_item && is_user_administrator_rs() && 'nav_menu' != $src_or_tx_name) {
            // TODO: action handler for new menu item storage
            if (ROLE_ASSIGNMENT_RS == $mode) {
                $root_caption = sprintf(__('DEFAULTS for new %s', 'scoper'), $otype_or_tx->labels->name);
            } else {
                $root_caption = sprintf(__('DEFAULTS for all %s', 'scoper'), $otype_or_tx->labels->name);
            }
            if (TERM_SCOPE_RS == $scope) {
                $root_item = (object) array($col_id => 0, $col_name => $root_caption, $col_parent => 0);
                array_unshift($all_items, $root_item);
//.........这里部分代码省略.........
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:101,代码来源:admin-bulk_rs.php

示例5: role_owners_key

 function role_owners_key($tx_or_otype, $args = array())
 {
     $defaults = array('display_links' => true, 'display_restriction_key' => true, 'restriction_caption' => '', 'role_basis' => '', 'agent_caption' => '', 'single_item' => false);
     $args = array_merge($defaults, (array) $args);
     extract($args);
     $item_label = agp_strtolower($tx_or_otype->labels->name);
     $item_label_singular = agp_strtolower($tx_or_otype->labels->singular_name);
     if ($role_basis) {
         if (!$agent_caption && $role_basis) {
             $agent_caption = ROLE_BASIS_GROUPS == $role_basis ? __('Group', 'scoper') : __('User', 'scoper');
         }
         $generic_name = ROLE_BASIS_GROUPS == $role_basis ? __('Groupname', 'scoper') : __('Username', 'scoper');
     } else {
         $generic_name = __awp('Name');
     }
     $agent_caption = agp_strtolower($agent_caption);
     if ($single_item) {
         echo '<div id="single_item_roles_key" style="display:none">';
         echo '<div style="margin-bottom:0.1em;margin-top:0"><strong><a name="scoper_key"></a>' . __("Users / Groups Key", 'scoper') . ':</strong></div><ul class="rs-agents_key">';
     } else {
         echo '<h4 style="margin-bottom:0.1em"><a name="scoper_key"></a>' . __("Users / Groups Key", 'scoper') . ':</h4><ul class="rs-agents_key">';
     }
     $link_open = $display_links ? "<a class='rs-link_plain' href='javascript:void(0)'>" : '';
     $link_close = $display_links ? '</a>' : '';
     echo '<li>';
     echo "{$link_open}{$generic_name}{$link_close}: ";
     printf(__('%1$s has role assigned for the specified %2$s.', 'scoper'), $agent_caption, $item_label_singular);
     echo '</li>';
     echo '<li>';
     echo "<span class='rs-bold'>{$link_open}{$generic_name}{$link_close}</span>: ";
     printf(__('%1$s has role assigned for the specified %2$s and, by default, for all its sub-%3$s. (Propagated roles can also be explicitly removed).', 'scoper'), $agent_caption, $item_label_singular, $item_label);
     echo '</li>';
     echo '<li>';
     echo "<span class='rs-bold rs-gray'>{$link_open}{$generic_name}{$link_close}</span>: ";
     printf(__('%1$s does NOT have role assigned for the specified %2$s, but has it by default for sub-%3$s.', 'scoper'), $agent_caption, $item_label_singular, $item_label);
     echo '</li>';
     echo '<li>';
     echo '<span class="rs-bold">{' . "{$link_open}{$generic_name}{$link_close}" . '}</span>: ';
     printf(__('%1$s has this role via propagation from parent %2$s, and by default for sub-%3$s.', 'scoper'), $agent_caption, $item_label_singular, $item_label);
     echo '</li>';
     if ($display_restriction_key) {
         echo '<li>';
         echo "<span class='rs-bold rs-backylw' style='border:1px solid #00a;padding-left:0.5em;padding-right:0.5em'>" . __('Role Name', 'scoper') . "</span>: ";
         echo "<span>" . sprintf(__('role is restricted for specified %s.', 'scoper'), $item_label_singular) . "</span>";
         echo '</li>';
     }
     echo '</ul>';
     if ($single_item) {
         echo '</div><br />';
     }
 }
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:51,代码来源:admin_ui_lib_rs.php

示例6: flt_wp_dropdown_users

 function flt_wp_dropdown_users($wp_output)
 {
     // just filter Post Author dropdown
     if (!strpos($wp_output, "name='post_author_override'")) {
         return $wp_output;
     }
     // this is meant to filter the post author selection
     if (!is_admin()) {
         return $wp_output;
     }
     // if (even after our blogcap tinkering) the author list is already locked due to insufficient blog-wide caps, don't mess
     if (!($pos = strpos($wp_output, '<option'))) {
         return $wp_output;
     }
     if (!strpos($wp_output, '<option', $pos + 1)) {
         return $wp_output;
     }
     global $wpdb, $scoper;
     $last_query = $wpdb->last_query;
     if (!($object_type = cr_find_post_type())) {
         return $wp_output;
     }
     if (!($post_type_obj = get_post_type_object($object_type))) {
         return $wp_output;
     }
     global $current_user;
     $is_ngg_edit = strpos($_SERVER['REQUEST_URI'], 'nggallery-manage-gallery');
     if (!$is_ngg_edit) {
         $src_name = 'post';
         $object_id = scoper_get_object_id('post', $object_type);
         // only modify the default authors list if current user has Editor role for the current post/page
         $have_cap = cr_user_can($post_type_obj->cap->edit_others_posts, $object_id, 0, array('require_full_object_role' => true));
     } else {
         $src_name = 'ngg_gallery';
         $object_id = $_REQUEST['gid'];
         $have_cap = !empty($current_user->allcaps[$post_type_obj->cap->edit_others_posts]);
         // $post_type_obj defaults to 'post' type on NGG Manage Gallery page
     }
     //if ( ! $have_cap )
     //	return $wp_output;
     $orderpos = strpos($last_query, 'ORDER BY');
     $orderby = $orderpos ? substr($last_query, $orderpos) : '';
     if (!strpos($orderby, 'display_name')) {
         // sanity check in case the last_query buffer gets messed up
         $orderby = '';
     }
     $id_in = $id_not_in = $show_option_all = $show_option_none = '';
     $pos = strpos($last_query, 'AND ID IN(');
     if ($pos) {
         $pos_close = strpos($last_query, ')', $pos);
         if ($pos_close) {
             $id_in = substr($last_query, $pos, $pos_close - $pos + 1);
         }
     }
     $pos = strpos($last_query, 'AND ID NOT IN(');
     if ($pos) {
         $pos_close = strpos($last_query, ')', $pos);
         if ($pos_close) {
             $id_not_in = substr($last_query, $pos, $pos_close - $pos + 1);
         }
     }
     $search = "<option value='0'>";
     $pos = strpos($wp_output, $search . __awp('Any'));
     if ($pos) {
         $pos_close = strpos($wp_output, '</option>', $pos);
         if ($pos_close) {
             $show_option_all = substr($wp_output, $pos + strlen($search), $pos_close - $pos - strlen($search));
         }
     }
     $search = "<option value='-1'>";
     $pos = strpos($wp_output, $search . __awp('None'));
     if ($pos) {
         $pos_close = strpos($wp_output, '</option>', $pos);
         if ($pos_close) {
             $show_option_none = substr($wp_output, $pos + strlen($search), $pos_close - $pos - strlen($search));
         }
     }
     $search = "<select name='";
     $pos = strpos($wp_output, $search);
     if (false !== $pos) {
         $pos_close = strpos($wp_output, "'", $pos + strlen($search));
         if ($pos_close) {
             $name = substr($wp_output, $pos + strlen($search), $pos_close - $pos - strlen($search));
         }
     }
     $search = " id='";
     $multi = !strpos($wp_output, $search);
     // beginning with WP 2.7, some users dropdowns lack id attribute
     $search = " class='";
     $pos = strpos($wp_output, $search);
     if ($pos) {
         $pos_close = strpos($wp_output, "'", $pos + strlen($search));
         if ($pos_close) {
             $class = substr($wp_output, $pos + strlen($search), $pos_close - $pos - strlen($search));
         }
     }
     $search = " selected='selected'";
     $pos = strpos($wp_output, $search);
     if ($pos) {
         $search = "<option value='";
//.........这里部分代码省略.........
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:101,代码来源:hardway-users-legacy_rs.php

示例7: install_strings

 function install_strings($plugin)
 {
     if ($title = ucwords(str_replace('-', ' ', $plugin))) {
         $this->strings['no_package'] = __awp('Install package not available.');
         $this->strings['downloading_package'] = sprintf(__awp('Downloading install package from <span class="code">%s</span>&#8230;'), untrailingslashit('http://presspermit.com/'));
         $this->strings['unpack_package'] = __awp('Unpacking the package&#8230;');
         $this->strings['installing_package'] = __awp('Installing the plugin&#8230;');
         $this->strings['process_failed'] = sprintf(__awp('%s install Failed.', 'pp'), $title);
         $this->strings['process_success'] = sprintf(__awp('%s installed successfully.', 'pp'), $title);
     }
 }
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:11,代码来源:plugin-update_rs.php

示例8: scoper_display_rs_roledefs


//.........这里部分代码省略.........
            $use_taxonomies = scoper_get_option('use_taxonomies');
        }
        foreach ($object_types as $object_type => $otype) {
            if ('post' == $src_name && empty($use_post_types[$object_type]) && empty($use_taxonomies[$object_type])) {
                continue;
            }
            $otype_roles = array();
            $otype_display_names = array();
            if ($obj_roles = $rs_default_role_defs->get_matching('rs', $src_name, $object_type)) {
                $otype_roles[$object_type] = $obj_roles;
            }
            if (!empty($otype->labels->name)) {
                $otype_display_names[$object_type] = $otype->labels->singular_name;
            } else {
                $otype_display_names[$object_type] = $otype->display_name;
            }
            if (!$otype_roles) {
                continue;
            }
            if ('post' == $src_name) {
                $plural_name = plural_name_from_cap_rs(get_post_type_object($object_type));
            } else {
                $plural_name = '';
            }
            foreach ($otype_roles as $object_type => $roles) {
                //display each role which has capabilities for this object type
                echo '<br />';
                echo '<h3>' . sprintf(__('%s Roles'), $otype_display_names[$object_type]) . '</h3>';
                ?>
<table class='widefat rs-backwhite'>
<thead>
<tr class="thead">
	<th width="15%"><?php 
                echo __awp('Role');
                ?>
</th>
	<th><?php 
                _e('Capabilities (abbreviated, defaults are bolded)', 'scoper');
                ?>
</th>
</tr>
</thead>
<tbody>
<?php 
                $wp_role_sync = array('rs_post_contributor' => 'contributor', 'rs_post_revisor' => 'revisor', 'rs_post_author' => 'author', 'rs_post_editor' => 'editor', 'rs_page_editor' => 'editor');
                if (defined('RVY_VERSION')) {
                    $wp_role_sync['rs_page_revisor'] = 'revisor';
                }
                global $wp_roles;
                $style = '';
                foreach ($roles as $rs_role_handle => $role_def) {
                    $reviewed_roles[] = $rs_role_handle;
                    $style = ' class="alternate"' == $style ? '' : ' class="alternate"';
                    echo "\n\t" . "<tr{$style}><td><strong>" . $rs_role_defs->get_display_name($rs_role_handle) . '</strong>';
                    if (isset($wp_role_sync[$rs_role_handle])) {
                        if (isset($wp_roles->role_objects[$wp_role_sync[$rs_role_handle]])) {
                            $wp_role_handle = "wp_" . $wp_role_sync[$rs_role_handle];
                            $wp_display_name = $wp_roles->role_names[$wp_role_sync[$rs_role_handle]];
                            $contained_roles = $rs_role_defs->get_contained_roles($wp_role_handle);
                            if (!isset($contained_roles[$rs_role_handle])) {
                                echo '<br /><br /><span class="rs-warning">';
                                printf(__('Warning: Since the WP %1$s role def lacks some caps selected here, it will be treated as a lesser role if Restrictions are applied.', 'scoper'), $wp_display_name);
                                echo '</span>';
                                $missing_caps = true;
                            } else {
                                $missing_caps = false;
开发者ID:par-orillonsoft,项目名称:creationOfSociety,代码行数:67,代码来源:role_definition.php

示例9: scoper_object_roles_list

function scoper_object_roles_list($viewing_user, $args = array())
{
    $html = '';
    if (!USER_ROLES_RS && !GROUP_ROLES_RS) {
        wp_die(__awp('Cheatin&#8217; uh?'));
    }
    $defaults = array('enforce_duration_limits' => true, 'is_user_profile' => false, 'echo' => true);
    $args = array_merge($defaults, (array) $args);
    extract($args);
    global $scoper, $wpdb, $current_user;
    if ($viewing_user) {
        if (!is_object($viewing_user)) {
            global $current_rs_user;
            if ($viewing_user == $current_rs_user->ID) {
                $viewing_user = $current_rs_user;
            } else {
                $viewing_user = new WP_Scoped_User($viewing_user);
            }
        }
    }
    $all_roles = array();
    $role_display = array();
    foreach ($scoper->role_defs->get_all_keys() as $role_handle) {
        if ($viewing_user) {
            $role_display[$role_handle] = $scoper->role_defs->get_display_name($role_handle, OBJECT_UI_RS);
        } else {
            $role_display[$role_handle] = $scoper->role_defs->get_abbrev($role_handle, OBJECT_UI_RS);
        }
    }
    if (!$is_user_profile) {
        $require_blogwide_editor = scoper_get_option('role_admin_blogwide_editor_only');
        if ('admin' === $require_blogwide_editor && !is_user_administrator_rs()) {
            return false;
        }
        if ('admin_content' === $require_blogwide_editor && !is_content_administrator_rs()) {
            return false;
        }
    } else {
        $require_blogwide_editor = false;
    }
    foreach ($scoper->data_sources->get_all() as $src_name => $src) {
        $otype_count = 0;
        if (!empty($src->taxonomy_only) || $src_name == 'group' && !$viewing_user) {
            continue;
        }
        $strict_objects = $scoper->get_restrictions(OBJECT_SCOPE_RS, $src_name);
        foreach ($src->object_types as $object_type => $otype) {
            $otype_count++;
            $disable_role_admin = false;
            if ($require_blogwide_editor) {
                if (!$scoper->user_can_edit_blogwide('post', $object_type, array('require_others_cap' => true))) {
                    $disable_role_admin = true;
                }
            }
            if (!empty($src->cols->type) && !empty($otype->name)) {
                $col_type = $src->cols->type;
                $otype_clause = "AND {$src->table}.{$col_type} = '{$otype->name}'";
            } elseif ($otype_count < 2) {
                $otype_clause = '';
            } else {
                continue;
            }
            $col_id = $src->cols->id;
            $col_name = $src->cols->name;
            $ug_clause_for_user_being_viewed = $viewing_user ? $viewing_user->get_user_clause('uro') : '';
            // TODO: replace join with uro subselect
            $qry = "SELECT DISTINCT {$src->table}.{$col_name}, {$src->table}.{$col_id}, uro.role_name, uro.date_limited, uro.start_date_gmt, uro.end_date_gmt" . " FROM {$src->table} ";
            $join = " INNER JOIN {$wpdb->user2role2object_rs} AS uro" . " ON uro.obj_or_term_id = {$src->table}.{$col_id}" . " AND uro.src_or_tx_name = '{$src_name}'" . " AND uro.scope = 'object' AND uro.role_type = 'rs'";
            $duration_clause = $enforce_duration_limits ? scoper_get_duration_clause("{$src->table}.{$src->cols->date}") : '';
            $status_clause = 'post' == $src_name ? "AND post_status != 'auto-draft'" : '';
            // TODO: version update script to delete post roles on auto-drafts (stored via default roles)
            $where = " WHERE 1=1 {$status_clause} {$otype_clause} {$duration_clause} {$ug_clause_for_user_being_viewed}";
            $orderby = " ORDER BY {$src->table}.{$col_name} ASC, uro.role_name ASC";
            $qry .= $join . $where . $orderby;
            $results = scoper_get_results($qry);
            if (!is_user_administrator_rs()) {
                // no need to filter admins - just query the assignments
                // only list role assignments which the logged-in user can administer
                $args['required_operation'] = OP_EDIT_RS;
                // Possible TODO: re-implement OP_ADMIN distinction with admin-specific capabilities
                /*
                if ( cr_get_reqd_caps( $src_name, OP_ADMIN_RS, $object_type ) {
                	$args['required_operation'] = OP_ADMIN_RS;
                } else {
                	$reqd_caps = array();
                	foreach (array_keys($src->statuses) as $status_name) {
                		$admin_caps = $scoper->cap_defs->get_matching($src_name, $object_type, OP_ADMIN_RS, $status_name);
                		$delete_caps = $scoper->cap_defs->get_matching($src_name, $object_type, OP_DELETE_RS, $status_name);
                		$reqd_caps[$object_type][$status_name] = array_merge(array_keys($admin_caps), array_keys($delete_caps));
                	}
                	$args['force_reqd_caps'] = $reqd_caps;
                }
                */
                $qry = "SELECT {$src->table}.{$col_id} FROM {$src->table} WHERE 1=1";
                $args['require_full_object_role'] = true;
                $qry_flt = apply_filters('objects_request_rs', $qry, $src_name, $object_type, $args);
                $cu_admin_results = scoper_get_col($qry_flt);
                if (empty($viewing_user) || $current_user->ID != $viewing_user->ID) {
                    foreach ($results as $key => $row) {
                        if (!in_array($row->{$col_id}, $cu_admin_results)) {
//.........这里部分代码省略.........
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:101,代码来源:object_roles_list.php

示例10: draw_object_roles_content

 function draw_object_roles_content($src_name, $object_type, $role_handle, $object_id = '', $skip_user_validation = false, $object = false)
 {
     //log_mem_usage_rs( 'start ItemRolesUI::draw_object_roles_content()' );
     if (!$object_id) {
         $object_id = scoper_get_object_id($src_name, $object_type);
     }
     if (!empty($object) && 'auto-draft' == $object->post_status) {
         $object_id = 0;
     }
     if ($src_name != $this->loaded_src_name || $object_type != $this->loaded_object_type || $object_id != $this->loaded_object_id) {
         $this->load_roles($src_name, $object_type, $object_id);
     }
     if (!($otype_def = $this->scoper->data_sources->member_property($src_name, 'object_types', $object_type))) {
         return;
     }
     if (!$skip_user_validation && !$this->scoper_admin->user_can_admin_role($role_handle, $object_id, $src_name, $object_type)) {
         return;
     }
     // since we may be dumping a lot of hidden user <li> into the page, enumerate role names to shorten html
     $role_code = 'r' . array_search($role_handle, $this->role_handles);
     $role_def = $this->scoper->role_defs->get($role_handle);
     if (!isset($role_def->valid_scopes[OBJECT_SCOPE_RS])) {
         return;
     }
     if (empty($this->drew_objroles_marker)) {
         echo "<input type='hidden' name='rs_object_roles' value='true' />";
         $this->drew_objroles_marker = true;
     }
     // ========== OBJECT RESTRICTION CHECKBOX(ES) ============
     // checkbox to control object role scoping (dictates whether taxonomy and blog role assignments also be honored for operations on this object )
     $checked = empty($this->object_strict_roles[$role_handle]) ? '' : 'checked="checked"';
     $val = $checked ? '1' : '0';
     echo "<input type='hidden' name='last_objscope_{$role_code}' value='{$val}' id='last_objscope_{$role_code}' />";
     echo "\r\n<p style='margin-bottom:0.8em;'>" . "<span class='alignright'><a href='#wphead'>" . __('top', 'scoper') . '</a></span>' . "<label for='objscope_{$role_code}'>" . "<input type='checkbox' class='rs-check' name='objscope_{$role_code}' value='1' id='objscope_{$role_code}' {$checked} /> " . sprintf(__('Restrict for %1$s (<strong>only</strong> selected users/groups are %2$s)', 'scoper'), $otype_def->labels->singular_name, $this->scoper->role_defs->get_abbrev($role_handle, OBJECT_UI_RS)) . '</label></p>';
     if ($this->do_propagation_cboxes) {
         $checked = empty($this->child_strict_roles[$role_handle]) ? '' : 'checked="checked"';
         $val = $checked ? '1' : '0';
         echo "<input type='hidden' name='last_objscope_children_{$role_code}' value='{$val}' id='last_objscope_children_{$role_code}' />";
         echo "<p style='margin-top: 0.5em;'>" . "<label for='objscope_children_{$role_code}'>" . "<input type='checkbox' class='rs-check' name='objscope_children_{$role_code}' value='1' id='objscope_children_{$role_code}' {$checked} /> " . sprintf(__('Restrict for Sub-%1$s', 'scoper'), $otype_def->labels->name) . '</label></p>';
     }
     // ========== OBJECT ROLE ASSIGNMENT CHECKBOX(ES) ============
     // toggle groups / users view if both are enabled
     //echo "<p style='margin: 1em 0 0.2em 0;'><strong>" . sprintf(__('Assign %s Role:', 'scoper'), $display_name ) . '</strong></p>';
     //echo '<br />';
     $toggle_agents = USER_ROLES_RS && GROUP_ROLES_RS && !empty($this->all_groups);
     if ($toggle_agents) {
         if (!empty($this->current_roles[ROLE_BASIS_USER][$role_handle])) {
             $default_role_basis = ROLE_BASIS_USER;
         } else {
             $default_role_basis = ROLE_BASIS_GROUPS;
         }
         $class_selected = 'agp-selected_agent_colorized agp-selected_agent agp-agent';
         $class_unselected = 'agp-unselected_agent_colorized agp-unselected_agent agp-agent';
         $class = ROLE_BASIS_GROUPS == $default_role_basis ? "class='{$class_selected}'" : "class='{$class_unselected}'";
         $js_call = "agp_swap_display('{$role_code}_groups', '{$role_code}_user', '{$role_code}_show_group_roles', '{$role_code}_show_user_roles', '{$class_selected}', '{$class_unselected}')";
         $bottom_margin = !empty($GLOBALS['is_IE']) ? '-0.7em' : 0;
         echo "\r\n" . "<div class='agp_js_show' style='display:none;margin:0 0 {$bottom_margin} 0'>" . "<ul class='rs-list_horiz' style='margin-bottom:-0.1em'><li {$class}>" . "<a href='javascript:void(0)' id='{$role_code}_show_group_roles' onclick=\"{$js_call}\">" . __('Groups', 'scoper') . '</a></li>';
         $class = ROLE_BASIS_USER == $default_role_basis ? "class='{$class_selected}'" : "class='{$class_unselected}'";
         $js_call = "agp_swap_display('{$role_code}_user', '{$role_code}_groups', '{$role_code}_show_user_roles', '{$role_code}_show_group_roles', '{$class_selected}', '{$class_unselected}')";
         echo "\r\n" . "<li {$class}><a href='javascript:void(0)' id='{$role_code}_show_user_roles' onclick=\"{$js_call}\">" . __awp('Users') . '</a></li>' . '</ul></div>';
     }
     $class = "class='rs-agents'";
     //need effective line break here if not IE
     echo "<div style='clear:both;margin:0 0 0.3em 0' {$class}>";
     $role_ops = $this->scoper->cap_defs->get_cap_ops($this->scoper->role_defs->role_caps[$role_handle]);
     $agents_reqd_op = isset($role_ops[OP_EDIT_RS]) ? OP_EDIT_RS : OP_READ_RS;
     $containing_roles = $this->scoper->role_defs->get_containing_roles($role_handle);
     require_once dirname(__FILE__) . '/agents_checklist_rs.php';
     $args = array('suppress_extra_prefix' => true, 'default_hide_threshold' => 20, 'propagation' => $this->do_propagation_cboxes, 'otype_label_singular' => $otype_def->labels->singular_name, 'otype_label' => $otype_def->labels->name, 'object_type' => $object_type, 'object_id' => $object_id);
     $args['via_other_role_ids'] = array();
     // must set this here b/c subsequent for loop is set up for users iteration to recall via_other_role_ids from groups iteration
     foreach ($this->agent_captions as $role_basis => $agent_caption) {
         if (!is_array($this->blog_term_roles[$role_basis][$role_handle])) {
             $this->blog_term_roles[$role_basis][$role_handle] = array();
         }
         // for the purpose of indicating implicit role ownership, we will consider any assignment of a containing role as equivalent
         foreach (array_keys($containing_roles) as $containing_role_handle) {
             if (isset($this->blog_term_roles[$role_basis][$containing_role_handle]) && is_array($this->blog_term_roles[$role_basis][$containing_role_handle])) {
                 $this->blog_term_roles[$role_basis][$role_handle] = array_merge($this->blog_term_roles[$role_basis][$role_handle], $this->blog_term_roles[$role_basis][$containing_role_handle]);
             }
         }
         $this->blog_term_roles[$role_basis][$role_handle] = array_unique($this->blog_term_roles[$role_basis][$role_handle]);
         $hide_class = $toggle_agents && $role_basis != $default_role_basis ? ' class="agp_js_hide"' : '';
         echo "\r\n<div id='{$role_code}_{$role_basis}' {$hide_class}>";
         // also abbreviate "groups" to 'g', 'user' to 'u'
         $id_prefix = $role_code . substr($role_basis, 0, 1);
         if ($this->indicate_blended_roles && $object_id && GROUP_ROLES_RS && ROLE_BASIS_USER == $role_basis) {
             $args['via_other_basis_ids'] = array();
             // note users who are in a group that has this role object-assigned
             if (!empty($this->current_roles[ROLE_BASIS_GROUPS][$role_handle]['assigned'])) {
                 foreach (array_keys($this->current_roles[ROLE_BASIS_GROUPS][$role_handle]['assigned']) as $group_id) {
                     if (!isset($this->group_members[$group_id])) {
                         $this->group_members[$group_id] = ScoperAdminLib::get_group_members($group_id, COL_ID_RS, true);
                     }
                     //arg: maybe WP role metagroup
                     $args['via_other_basis_ids'] = array_merge($args['via_other_basis_ids'], $this->group_members[$group_id]);
                 }
             }
             // note users who are in a group that has this role term-assigned or blog-assigned (and not restricted)
             foreach ($this->blog_term_roles[ROLE_BASIS_GROUPS][$role_handle] as $group_id) {
//.........这里部分代码省略.........
开发者ID:joostrijneveld,项目名称:cscircles-wp-content,代码行数:101,代码来源:item_roles_ui_rs.php

示例11: touch_time

    function touch_time($edit = 1, $for_post = 1, $tab_index = 0, $multi = 0, $id_prefix = '', $suppress_hidden_inputs = false, $suppress_current_inputs = false, $use_js = true, $empty_month_option = false)
    {
        global $wp_locale, $post, $comment;
        if ($for_post) {
            if (empty($post)) {
                $edit = true;
                $current_post_date = 0;
            } else {
                $edit = in_array($post->post_status, array('draft', 'pending')) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt) ? false : true;
                $current_post_date = $post->post_date;
            }
        } else {
            $edit = true;
            $current_comment_date = empty($comment) ? 0 : $comment->comment_date;
        }
        $tab_index_attribute = '';
        if ((int) $tab_index > 0) {
            $tab_index_attribute = " tabindex='{$tab_index}'";
        }
        // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
        if (!empty($_POST)) {
            $jj = !empty($_POST[$id_prefix . 'jj']) ? $_POST[$id_prefix . 'jj'] : '';
            $mm = !empty($_POST[$id_prefix . 'mm']) ? $_POST[$id_prefix . 'mm'] : '';
            $aa = !empty($_POST[$id_prefix . 'aa']) ? $_POST[$id_prefix . 'aa'] : '';
            $hh = !empty($_POST[$id_prefix . 'hh']) ? $_POST[$id_prefix . 'hh'] : '';
            $mn = !empty($_POST[$id_prefix . 'mn']) ? $_POST[$id_prefix . 'mn'] : '';
            $ss = !empty($_POST[$id_prefix . 'ss']) ? $_POST[$id_prefix . 'ss'] : '';
        } else {
            $time_adj = time() + get_option('gmt_offset') * 3600;
            $post_date = $for_post ? $current_post_date : $current_comment_date;
            $jj = $edit ? mysql2date('d', $post_date, false) : gmdate('d', $time_adj);
            $mm = $edit ? mysql2date('m', $post_date, false) : gmdate('m', $time_adj);
            $aa = $edit ? mysql2date('Y', $post_date, false) : gmdate('Y', $time_adj);
            $hh = $edit ? mysql2date('H', $post_date, false) : gmdate('H', $time_adj);
            $mn = $edit ? mysql2date('i', $post_date, false) : gmdate('i', $time_adj);
            $ss = $edit ? mysql2date('s', $post_date, false) : gmdate('s', $time_adj);
        }
        if (!$suppress_current_inputs) {
            $cur_jj = gmdate('d', $time_adj);
            $cur_mm = gmdate('m', $time_adj);
            $cur_aa = gmdate('Y', $time_adj);
            $cur_hh = gmdate('H', $time_adj);
            $cur_mn = gmdate('i', $time_adj);
        }
        $month = "<select " . ($multi ? '' : "id='{$id_prefix}mm' ") . "name='{$id_prefix}mm' {$tab_index_attribute}>\n";
        if ($empty_month_option) {
            $month .= "\t\t\t" . '<option value=""></option>';
        }
        for ($i = 1; $i < 13; $i = $i + 1) {
            $month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';
            if ($i == $mm) {
                $month .= ' selected="selected"';
            }
            $month .= '>' . $wp_locale->get_month_abbrev($wp_locale->get_month($i)) . "</option>\n";
        }
        $month .= '</select>';
        $day = '<input type="text" ' . ($multi ? '' : 'id="' . $id_prefix . 'jj" ') . 'name="' . $id_prefix . 'jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
        $year = '<input type="text" ' . ($multi ? '' : 'id="' . $id_prefix . 'aa" ') . 'name="' . $id_prefix . 'aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" />';
        $hour = '<input type="text" ' . ($multi ? '' : 'id="' . $id_prefix . 'hh" ') . 'name="' . $id_prefix . 'hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
        $minute = '<input type="text" ' . ($multi ? '' : 'id="' . $id_prefix . 'mn" ') . 'name="' . $id_prefix . 'mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';
        /* translators: 1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input */
        printf(__('%1$s%2$s, %3$s @ %4$s : %5$s'), $month, $day, $year, $hour, $minute);
        echo '<input type="hidden" id="' . $id_prefix . 'ss" name="' . $id_prefix . 'ss" value="' . $ss . '" />';
        if ($multi) {
            return;
        }
        echo "\n\n";
        foreach (array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit) {
            if (!$suppress_hidden_inputs) {
                echo '<input type="hidden" id="' . $id_prefix . 'hidden_' . $timeunit . '" name="' . $id_prefix . 'hidden_' . $timeunit . '" value="' . ${$timeunit} . '" />' . "\n";
            }
            if (!$suppress_current_inputs) {
                $cur_timeunit = 'cur_' . $timeunit;
                echo '<input type="hidden" id="' . $id_prefix . '' . $cur_timeunit . '" name="' . $id_prefix . $cur_timeunit . '" value="' . ${$cur_timeunit} . '" />' . "\n";
            }
        }
        ?>
		<p>
		<?php 
        if ($use_js) {
            ?>
		<a href="#<?php 
            echo $id_prefix;
            ?>
edit_timestamp" id="<?php 
            echo $id_prefix;
            ?>
save-timestamp" class="rs_role_save-timestamp hide-if-no-js button"><?php 
            echo __awp('OK');
            ?>
</a>
		<a href="#<?php 
            echo $id_prefix;
            ?>
edit_timestamp" id="<?php 
            echo $id_prefix;
            ?>
cancel-timestamp" class="rs_role_cancel-timestamp hide-if-no-js"><?php 
            echo __awp('Cancel');
            ?>
//.........这里部分代码省略.........
开发者ID:par-orillonsoft,项目名称:creationOfSociety,代码行数:101,代码来源:admin_lib-bulk_rs.php

示例12: scoper_display_wp_roledefs

function scoper_display_wp_roledefs($args = array())
{
    global $scoper;
    echo "<div id='wp-roledefs' style='clear:both;margin:0;' class='rs-options agp_js_hide {$args['bgcolor_class']}'>";
    if (scoper_get_option('display_hints')) {
        echo '<div class="rs-optionhint">';
        echo '<p style="margin-top:0">';
        _e('Note that only <strong>capabilities configured for filtering by Role Scoper</strong> are listed here.', 'scoper');
        echo ' ';
        _e('These WordPress role definitions may be modified via the Capability Manager or Role Manager plugin.', 'scoper');
        echo '</p>';
        echo '<p style="margin-top:0">';
        _e('To understand how your WordPress roles relate to type-specific RS Roles, see <a href="#wp_rs_equiv">WP/RS Role Equivalence</a>.', 'scoper');
        echo '</p>';
        echo '</div>';
    }
    $roles = $scoper->role_defs->get_matching('wp', '', '');
    echo '<h3>' . __('WordPress Roles', 'scoper'), '</h3>';
    ?>

<table class='widefat rs-backwhite'>
<thead>
<tr class="thead">
	<th width="15%"><?php 
    echo __awp('Role');
    ?>
</th>
	<th><?php 
    _e('Capabilities', 'scoper');
    ?>
</th>
</tr>
</thead>
<tbody>
<?php 
    $style = '';
    global $wp_roles;
    $wp_role_names = $wp_roles->role_names;
    uasort($wp_role_names, "strnatcasecmp");
    // sort by array values, but maintain keys
    // order WP roles by display name
    foreach (array_keys($wp_role_names) as $wp_role_name) {
        $role_handle = scoper_get_role_handle($wp_role_name, 'wp');
        $style = ' class="alternate"' == $style ? '' : ' class="alternate"';
        if (empty($scoper->role_defs->role_caps[$role_handle])) {
            continue;
        }
        $cap_names = array_keys($scoper->role_defs->role_caps[$role_handle]);
        sort($cap_names);
        $cap_display_names = array();
        foreach ($cap_names as $cap_name) {
            $cap_display_names[] = ucwords(str_replace('_', ' ', $cap_name));
        }
        $caplist = "<li>" . implode("</li><li>", $cap_display_names) . "</li>";
        echo "\n\t" . "<tr{$style}><td>" . $scoper->role_defs->get_display_name($role_handle) . "</td><td><ul class='rs-cap_list'>{$caplist}</ul></td></tr>";
    }
    // end foreach role
    echo '</tbody></table>';
    echo '<br /><br />';
    echo '<a name="wp_rs_equiv"></a>';
    echo '<h3>' . __('WP / RS Role Equivalence', 'scoper'), '</h3>';
    ?>

<table class='widefat rs-backwhite'>
<thead>
<tr class="thead">
	<th width="15%"><?php 
    _e('WP Role', 'scoper');
    ?>
</th>
	<th><?php 
    _e('Contained RS Roles', 'scoper');
    ?>
</th>
</tr>
</thead>
<tbody>
<?php 
    $style = '';
    $use_post_types = scoper_get_option('use_post_types');
    // order WP roles by display name
    foreach (array_keys($wp_role_names) as $wp_role_name) {
        $role_handle = scoper_get_role_handle($wp_role_name, 'wp');
        $style = ' class="alternate"' == $style ? '' : ' class="alternate"';
        $display_names = array();
        $contained_roles_handles = $scoper->role_defs->get_contained_roles($role_handle, false, 'rs');
        foreach (array_keys($contained_roles_handles) as $contained_role_handle) {
            $role_def = $scoper->role_defs->get($contained_role_handle);
            if ($role_def->object_type && post_type_exists($role_def->object_type) && !isset($use_post_types[$role_def->object_type])) {
                continue;
            }
            $display_names[] = $scoper->role_defs->get_display_name($contained_role_handle);
        }
        $list = "<li>" . implode("</li><li>", $display_names) . "</li>";
        $note = 'administrator' == $wp_role_name ? '<br /><br />' . __('<strong>note</strong>: Role Scoper also implicitly grants Administrators the Editor role for each enabled custom post type, and the Manager role for each enabled taxonomy.', 'scoper') : '';
        echo "\n\t" . "<tr{$style}><td>" . $scoper->role_defs->get_display_name($role_handle) . $note . "</td><td><ul class='rs-cap_list'>{$list}</ul></td></tr>";
    }
    // end foreach role
    echo '</tbody></table>';
    echo '<br /><br />';
//.........这里部分代码省略.........
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:101,代码来源:role_definition_wp.php

示例13: build_menu


//.........这里部分代码省略.........
                     $show_roles_menu = true;
                     $menu_label = $use_users_menu ? sprintf(__('%s Roles', 'scoper'), $tx->labels->singular_name) : $tx->labels->name;
                     add_submenu_page($roles_menu, sprintf(__('%s Roles', 'scoper'), $tx->labels->singular_name), $menu_label, 'read', "rs-{$taxonomy}-roles_t", array(&$this, 'menu_handler'));
                     if (!empty($tx->requires_term)) {
                         $show_restrictions_menu = true;
                         $menu_label = $use_users_menu ? sprintf(__('%s Restrictions', 'scoper'), $tx->labels->singular_name) : $tx->labels->name;
                         add_submenu_page($restrictions_menu, sprintf(__('%s Restrictions', 'scoper'), $tx->labels->singular_name), $menu_label, 'read', "rs-{$taxonomy}-restrictions_t", array(&$this, 'menu_handler'));
                     }
                 }
                 // end foreach taxonomy
             }
             // endif can admin terms
         } else {
             // Object Roles (will only display objects user can edit)
             if ($can_admin_objects) {
                 foreach ($this->scoper->data_sources->get_all() as $src_name => $src) {
                     if (!empty($src->no_object_roles) || !empty($src->taxonomy_only) || 'group' == $src_name) {
                         continue;
                     }
                     $object_types = isset($src->object_types) ? $src->object_types : array($src_name => true);
                     foreach (array_keys($object_types) as $object_type) {
                         if (empty($can_admin_objects[$src_name][$object_type])) {
                             continue;
                         }
                         if ($require_blogwide_editor) {
                             if (!$this->scoper->user_can_edit_blogwide($src_name, $object_type, array('require_others_cap' => true))) {
                                 continue;
                             }
                         }
                         $show_roles_menu = true;
                         $show_restrictions_menu = true;
                         if ($src_name != $object_type && 'post' != $src_name) {
                             $roles_page = "rs-{$object_type}-roles_{$src_name}";
                             $restrictions_page = "rs-{$object_type}-restrictions_{$src_name}";
                         } else {
                             $roles_page = "rs-{$object_type}-roles";
                             $restrictions_page = "rs-{$object_type}-restrictions";
                         }
                         $src_otype = isset($src->object_types) ? "{$src_name}:{$object_type}" : $src_name;
                         $item_label_singular = $this->interpret_src_otype($src_otype, 'singular_name');
                         $item_label = $this->interpret_src_otype($src_otype);
                         $menu_label = $use_users_menu ? sprintf(__('%s Roles', 'scoper'), $item_label_singular) : $item_label;
                         add_submenu_page($roles_menu, sprintf(__('%s Roles', 'scoper'), $item_label_singular), $menu_label, 'read', $roles_page, array(&$this, 'menu_handler'));
                         $menu_label = $use_users_menu ? sprintf(__('%s Restrictions', 'scoper'), $item_label_singular) : $item_label;
                         add_submenu_page($restrictions_menu, sprintf(__('%s Restrictions', 'scoper'), $item_label_singular), $menu_label, 'read', $restrictions_page, array(&$this, 'menu_handler'));
                     }
                     // end foreach obj type
                 }
                 // end foreach data source
             }
             // endif can admin objects
         }
         // endif drawing object scope submenus
     }
     // end foreach submenu scope
     if ($is_user_administrator) {
         add_submenu_page($roles_menu, __('About Role Scoper', 'scoper'), __('About', 'scoper'), 'read', 'rs-about', array(&$this, 'menu_handler'));
     }
     global $submenu;
     // Change Role Scoper Options submenu title from default "Roles" to "Options"
     if ($is_option_administrator) {
         if (isset($submenu[$roles_menu][0][2]) && $roles_menu == $submenu[$roles_menu][0][2]) {
             $submenu[$roles_menu][0][0] = __awp('Options');
         }
         // satisfy WordPress' demand that all admin links be properly defined in menu
         if ('rs-attachments_utility' == $plugin_page_cr) {
             add_submenu_page($roles_menu, __('Attachment Utility', 'scoper'), __('Attachment Utility', 'scoper'), 'read', 'rs-attachments_utility', array(&$this, 'menu_handler'));
         }
     } elseif (empty($show_restrictions_menu) || empty($show_roles_menu)) {
         // Remove Roles or Restrictions menu if it has no submenu
         if ($tweak_menu) {
             // since we forced the menu keys, no need to loop through menu looking for them
             if (empty($show_restrictions_menu) && isset($menu[$restrictions_menu_key])) {
                 unset($menu[$restrictions_menu_key]);
             }
             if (empty($show_roles_menu) && isset($menu[$roles_menu_key])) {
                 unset($menu[$roles_menu_key]);
             }
         } else {
             global $menu;
             foreach (array_keys($menu) as $key) {
                 if (isset($menu[$key][0])) {
                     if (empty($show_roles_menu) && $roles_caption == $menu[$key][0]) {
                         unset($menu[$key]);
                     } elseif (empty($show_restrictions_menu) && $restrictions_caption == $menu[$key][0]) {
                         unset($menu[$key]);
                     }
                 }
             }
         }
     }
     // WP MU site options
     if (!awp_ver('3.1') && $is_option_administrator && IS_MU_RS) {
         scoper_mu_site_menu();
     }
     // satisfy WordPress' demand that all admin links be properly defined in menu
     if ('rs-object_role_edit' == $plugin_page_cr) {
         add_submenu_page($roles_menu, __('Object Role Edit', 'scoper'), __('Object Role Edit', 'scoper'), 'read', 'rs-object_role_edit', array(&$this, 'menu_handler'));
     }
 }
开发者ID:btj,项目名称:cscircles-wp-content,代码行数:101,代码来源:admin_rs.php

示例14: die

<?php

if (basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME'])) {
    die('This page cannot be called directly.');
}
if (!is_option_administrator_rs()) {
    wp_die(__awp('Cheatin&#8217; uh?'));
}
function scoper_attach_linked_uploads($echo = false)
{
    global $wpdb;
    require_once SCOPER_ABSPATH . '/uploads_rs.php';
    if (MULTISITE) {
        global $wpdb, $blog_id;
        $blog_ids = scoper_get_col("SELECT blog_id FROM {$wpdb->blogs} ORDER BY blog_id");
        $orig_blog_id = $blog_id;
    } else {
        $blog_ids = array('1');
    }
    foreach ($blog_ids as $id) {
        if (count($blog_ids) > 1) {
            switch_to_blog($id);
            _e("<br /><strong>site {$id} :</strong><br />");
        }
        $uploads = scoper_get_upload_info();
        $site_url = untrailingslashit(get_option('siteurl'));
        if (false === strpos($uploads['baseurl'], $site_url)) {
            if ($echo) {
                _e('<strong>Note</strong>: Direct access to uploaded file attachments cannot be filtered because your WP_CONTENT_DIR is not in the WordPress branch.', 'scoper');
                echo '<br /><br />';
                _e('The operation was terminated due to an invalid configuration.', 'scoper');
开发者ID:par-orillonsoft,项目名称:creationOfSociety,代码行数:31,代码来源:attachments_utility.php

示例15: scoper_new_version_notice

function scoper_new_version_notice()
{
    $rechecked = false;
    $check_minutes = scoper_get_option('version_check_minutes');
    $last_check = scoper_get_option('last_version_update_check');
    if (time() - $last_check > $check_minutes * 60 || !($vcheck = get_site_option('scoper_version_info'))) {
        $vcheck = wp_remote_fopen('http://agapetry.net/downloads/role-scoper_version.chk');
        $rechecked = true;
        update_option('scoper_version_info', $vcheck);
    }
    if ($vcheck) {
        if (time() - $last_check > $check_minutes * 60 || !($vcheck_ext = get_site_option('scoper_extension_info'))) {
            $vcheck_ext = awp_remote_fopen('http://agapetry.net/downloads/role-scoper-extensions.chk', 5);
            $rechecked = true;
            update_option('scoper_extension_info', $vcheck_ext);
        }
    } else {
        $vcheck_ext = false;
    }
    if ($rechecked) {
        update_option('scoper_last_version_update_check', time());
    }
    if ($vcheck) {
        $status = explode('@', $vcheck);
        $theVersion = $status[1];
        if (version_compare(strval($theVersion), strval(SCOPER_VERSION), '>') == 1) {
            $msg = '<strong>' . sprintf(__("A new version of Role Scoper is available (%s)", "scoper"), $theVersion);
            if ($rechecked || !($vcheck = get_site_option('scoper_version_message'))) {
                $vcheck = awp_remote_fopen('http://agapetry.net/downloads/role-scoper.chk', 5);
                add_site_option('scoper_version_message', $vcheck);
            }
            if ($vcheck) {
                $status = explode('@', $vcheck);
                $theMessage = $status[3];
                if ($ver_pos = strpos($theMessage, '<br />' . SCOPER_VERSION)) {
                    $theMessage = substr($theMessage, 0, $ver_pos);
                }
                $theMessage = str_replace("'", '&#39;', $theMessage);
                // Despite this precaution, don't include apostrophes in .chk file because older RS versions (< 1.0.0-rc9) will choke on it.
                $theMessage = str_replace('"', '&quot;', $theMessage);
                $msg .= '</strong><small>' . $theMessage . '</small>';
            }
            if (strpos($msg, '<!--more-->')) {
                $more_caption = __('read more...', 'scoper');
                $msg = preg_replace('/\\<\\!\\-\\-more\\-\\-\\>/', '<a href="javascript:void(0)" onclick="rs_display_version_more();">' . $more_caption . '</a><p id="rs_version_more" class="rs_more" style="display:none;">', $msg, 1);
                $msg .= '</p>';
            } else {
                $msg .= '<br />';
            }
            $msg .= '<a href="http://agapetry.net/category/role-scoper/" target="_blank">' . __('Read about the update', 'scoper') . '</a>';
            $msg .= '&nbsp;&nbsp;&nbsp;<a href="http://wordpress.org/extend/plugins/role-scoper/changelog/" target="_blank">' . __('View full changelog', 'scoper') . '</a>';
            if (version_compare(strval($theVersion), '1.0.0', '>=')) {
                $url = awp_plugin_update_url(SCOPER_BASENAME);
                $msg .= '&nbsp;&nbsp;&nbsp;<a href="' . $url . '">' . __awp('Upgrade Automatically') . '</a>';
            } else {
                $msg .= '&nbsp;&nbsp;&nbsp;<a href="http://agapetry.net/downloads/role-scoper_current" target="_blank">' . __('Download for manual install', 'scoper') . '</a>';
            }
            // slick method copied from NextGEN Gallery plugin
            add_action('admin_notices', create_function('', 'echo \'<div id="rs-ver_msg" class="plugin-update rs-ver_msg fade" style="margin:0;"><p>' . $msg . '</p></div>\';'));
        }
    }
    if ($vcheck_ext) {
        $plugin_titles = array();
        $plugin_links = array();
        if ($extensions = explode(';', $vcheck_ext)) {
            foreach ($extensions as $ext) {
                if ($ext_info = explode(',', $ext)) {
                    if (count($ext_info) < 4) {
                        continue;
                    }
                    if (($plugin_file = awp_is_plugin_active($ext_info[0])) && !awp_is_plugin_active($ext_info[1])) {
                        $plugin_path = WP_CONTENT_DIR . '/plugins/' . $plugin_file;
                        if (file_exists($plugin_path)) {
                            $plugin_data = implode('', file($plugin_path));
                            preg_match('|Plugin Name:(.*)$|mi', $plugin_data, $name);
                            if ($name) {
                                $name = trim($name[1]);
                                $plugin_titles[$ext_info[0]] = $name;
                                if (false === strpos($ext_info[3], 'wp_repository') || false !== strpos($ext_info[3], 'is_alpha')) {
                                    $plugin_links[$ext_info[0]] = "http://agapetry.net/category/role-scoper-extensions/";
                                } else {
                                    $plugin_links[$ext_info[0]] = awp_plugin_info_url($ext_info[2]);
                                }
                            }
                        }
                    }
                }
            }
            $plugins = get_option('active_plugins');
            if ($plugin_titles) {
                $plugin_array = array();
                foreach ($plugin_titles as $name => $title) {
                    $plugin_array[] = "<a href=\"{$plugin_links[$name]}\">{$title}</a>";
                }
                $msg = '<strong>' . sprintf(__("Role Scoper Extensions are available for the following plugins: %s", "scoper"), implode(', ', $plugin_array)) . '</strong><br />';
                // slick method copied from NextGEN Gallery plugin
                add_action('admin_notices', create_function('', 'echo \'<div id="rs-ext_ver_msg" class="plugin-update rs-ver_msg fade"><p>' . $msg . '</p></div>\';'));
            }
        }
    }
//.........这里部分代码省略.........
开发者ID:Netsoro,项目名称:gdnlteamgroup,代码行数:101,代码来源:version_notice_rs.php


注:本文中的__awp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。