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


PHP pp_get_option函数代码示例

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


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

示例1: option_checkbox

 function option_checkbox($option_name, $tab_name, $section_name, $hint_text = '', $trailing_html = '', $args = array())
 {
     $return = array('in_scope' => false, 'no_storage' => false, 'disabled' => false, 'title' => '');
     if (in_array($option_name, $this->form_options[$tab_name][$section_name])) {
         if (empty($args['no_storage'])) {
             $this->all_options[] = $option_name;
         }
         if (isset($args['val'])) {
             $return['val'] = $args['val'];
         } else {
             $return['val'] = !empty($args['no_storage']) ? 0 : pp_get_option($option_name, $this->option_args);
         }
         $disabled_clause = !empty($args['disabled']) || $this->hide_network_option($option_name) ? "disabled='disabled'" : '';
         $style = !empty($args['style']) ? $args['style'] : '';
         $title = !empty($args['title']) ? " title='" . esc_attr($args['title']) . "'" : '';
         echo "<div class='agp-vspaced_input'>" . "<label for='{$option_name}'{$title}><input name='{$option_name}' type='checkbox' {$disabled_clause} {$style} id='{$option_name}' value='1' " . checked('1', $return['val'], false) . " /> " . $this->option_captions[$option_name] . "</label>";
         if ($hint_text && $this->display_hints) {
             echo "<div class='pp-subtext'>" . $hint_text . "</div>";
         }
         echo "</div>";
         if ($trailing_html) {
             echo $trailing_html;
         }
         $return['in_scope'] = true;
     }
     return $return;
 }
开发者ID:severnrescue,项目名称:web,代码行数:27,代码来源:options-ui_pp.php

示例2: add_meta_boxes

 function add_meta_boxes()
 {
     // ========= register WP-rendered metaboxes ============
     $post_type = pp_find_post_type();
     if (!current_user_can('pp_assign_roles') || apply_filters('pp_disable_exception_ui', false, 'post', 0, $post_type)) {
         return;
     }
     $hidden_types = apply_filters('pp_hidden_post_types', array());
     if (!empty($hidden_types[$post_type])) {
         return;
     }
     if (!in_array($post_type, pp_get_enabled_post_types())) {
         if (!in_array($post_type, array('revision')) && pp_get_option('display_hints')) {
             $type_obj = get_post_type_object($post_type);
             if ($type_obj->public) {
                 if (!in_array($post_type, apply_filters('pp_unfiltered_post_types', array()))) {
                     add_meta_box("pp_enable_type", __('Press Permit Settings', 'pp'), array(&$this, 'draw_settings_ui'), $post_type, 'advanced', 'default', array());
                 }
             }
         }
         return;
     }
     //if ( ! $this->_roles_editable( $src_name, $object_type ) )
     //	return;
     $ops = _pp_can_set_exceptions('read', $post_type, array('via_item_source' => 'post', 'for_item_source' => 'post')) ? array('read' => true) : array();
     $operations = apply_filters('pp_item_edit_exception_ops', $ops, 'post', $post_type);
     foreach (array_keys($operations) as $op) {
         if ($op_obj = pp_get_op_object($op, $post_type)) {
             // $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null
             add_meta_box("pp_{$op}_{$post_type}_exceptions", sprintf(__('%s Exceptions', 'pp'), $op_obj->noun_label), array(&$this, 'draw_exceptions_ui'), $post_type, 'advanced', 'default', array('op' => $op));
         }
     }
 }
开发者ID:severnrescue,项目名称:web,代码行数:33,代码来源:post-edit-ui_pp.php

示例3: ppx_force_defaults

function ppx_force_defaults($options)
{
    if (!pp_get_option('advanced_options')) {
        foreach (ppx_default_options() as $key => $val) {
            $options["pp_{$key}"] = $val;
        }
    }
    return $options;
}
开发者ID:severnrescue,项目名称:web,代码行数:9,代码来源:defaults_ppx.php

示例4: _cme_update_pp_usage

function _cme_update_pp_usage()
{
    static $updated;
    if (!empty($updated)) {
        return true;
    }
    if (!current_user_can('pp_manage_settings')) {
        return false;
    }
    if (!empty($_REQUEST['update_filtered_types'])) {
        // update Press Permit "Filtered Post Types".  This determines whether type-specific capability definitions are forced
        $options = array('enabled_post_types', 'enabled_taxonomies');
        foreach ($options as $option_basename) {
            if (!isset($_POST["{$option_basename}-options"])) {
                continue;
            }
            $unselected = array();
            $value = array();
            foreach ($_POST["{$option_basename}-options"] as $key) {
                if (empty($_POST["{$option_basename}-{$key}"])) {
                    $unselected[$key] = true;
                } else {
                    $value[$key] = true;
                }
            }
            if ($current = pp_get_option($option_basename)) {
                if ($current = array_diff_key($current, $unselected)) {
                    $value = array_merge($current, $value);
                }
                // retain setting for any types which were previously enabled for filtering but are currently not registered
            }
            $value = stripslashes_deep($value);
            pp_update_option($option_basename, $value);
            $updated = true;
        }
        if (pp_wp_ver('3.5')) {
            pp_update_option('define_create_posts_cap', !empty($_REQUEST['pp_define_create_posts_cap']));
        }
    }
    if (!empty($_REQUEST['SaveRole'])) {
        if (!empty($_REQUEST['role'])) {
            $pp_only = (array) pp_get_option('supplemental_role_defs');
            if (empty($_REQUEST['pp_only_role'])) {
                $pp_only = array_diff($pp_only, array($_REQUEST['role']));
            } else {
                $pp_only[] = $_REQUEST['role'];
            }
            pp_update_option('supplemental_role_defs', array_unique($pp_only));
            _cme_pp_default_pattern_role($_REQUEST['role']);
        }
    }
    if ($updated) {
        pp_refresh_options();
    }
    return $updated;
}
开发者ID:shellygraham,项目名称:livestock-framing,代码行数:56,代码来源:pp-handler.php

示例5: force_distinct_post_caps

 function force_distinct_post_caps()
 {
     // but only if the post type has PP filtering enabled
     global $wp_post_types;
     $core_meta_caps = array_fill_keys(array('read_post', 'edit_post', 'delete_post'), true);
     $append_caps = array('edit_published_posts' => 'edit_posts', 'edit_private_posts' => 'edit_posts', 'delete_posts' => 'edit_posts', 'delete_others_posts' => 'delete_posts', 'delete_published_posts' => 'delete_posts', 'delete_private_posts' => 'delete_posts', 'read' => 'read');
     if ($force_create_posts_cap = pp_wp_ver('3.5-beta') && pp_get_option('define_create_posts_cap')) {
         foreach (array('post', 'page') as $post_type) {
             if ($force_create_posts_cap && $wp_post_types[$post_type]->cap->create_posts == $wp_post_types[$post_type]->cap->edit_posts) {
                 $wp_post_types[$post_type]->cap->create_posts = "create_{$post_type}s";
             }
         }
         $append_caps['create_posts'] = 'create_posts';
     }
     // post types which are enabled for PP filtering must have distinct type-related cap definitions
     foreach (pp_get_enabled_post_types() as $post_type) {
         // append missing capability definitions
         foreach ($append_caps as $prop => $default) {
             if (!isset($wp_post_types[$post_type]->cap->{$prop})) {
                 $wp_post_types[$post_type]->cap->{$prop} = 'read' == $prop ? 'read' : $wp_post_types[$post_type]->cap->{$default};
             }
         }
         $wp_post_types[$post_type]->map_meta_cap = true;
         $type_caps = array_diff_key((array) $wp_post_types[$post_type]->cap, $core_meta_caps);
         $cap_base = 'attachment' == $post_type ? 'file' : $post_type;
         foreach (array('post', 'page') as $generic_type) {
             if ($post_type != $generic_type) {
                 // page is not prevented from having 'page' cap defs, but IS prevented from having 'post' cap defs
                 // force distinct capability_type
                 if ($generic_type == $wp_post_types[$post_type]->capability_type) {
                     $wp_post_types[$post_type]->capability_type = $post_type;
                 }
                 // Replace "edit_posts" with "edit_doohickys". This is not ideal, but as of WP 3.4, no plural name is defined unless unless type-specific caps are already set.
                 // If this is a problem, just define the type caps in the register_post_type call, or modify existing $wp_post_types[$post_type]->cap values by hooking to the init action at priority 40.
                 //foreach( array_keys( array_intersect( (array) $wp_post_types[$generic_type]->cap, $type_caps ) ) as $cap_property ) {
                 foreach (array_keys($type_caps) as $cap_property) {
                     if (!in_array($type_caps[$cap_property], (array) $wp_post_types[$generic_type]->cap)) {
                         continue;
                     }
                     if ('create_posts' == $cap_property) {
                         $type_caps[$cap_property] = str_replace("_{$generic_type}", "_{$cap_base}", $wp_post_types[$generic_type]->cap->{$cap_property});
                     } else {
                         $type_caps[$cap_property] = str_replace("_{$generic_type}", "_{$cap_base}", $cap_property);
                     }
                 }
             }
         }
         $wp_post_types[$post_type]->cap = (object) array_merge((array) $wp_post_types[$post_type]->cap, $type_caps);
         $wp_post_types[$post_type]->plural_name = pp_plural_name_from_cap($wp_post_types[$post_type]);
         $this->all_type_caps = array_merge($this->all_type_caps, array_fill_keys($type_caps, true));
     }
     // end foreach post type
     // need this for casting to other types even if "post" type is not enabled for PP filtering
     $wp_post_types['post']->cap->set_posts_status = 'set_posts_status';
 }
开发者ID:severnrescue,项目名称:web,代码行数:55,代码来源:cap-helper_pp.php

示例6: _pp_show_contextual_help

 public static function _pp_show_contextual_help()
 {
     $screen_obj = get_current_screen();
     $link_section = '';
     if (is_object($screen_obj)) {
         $screen = $screen_obj->id;
     }
     if (strpos($screen, 'pp-')) {
         $match = array();
         if (!preg_match("/admin_page_pp-[^@]*-*/", $screen, $match)) {
             if (!preg_match("/_page_pp-[^@]*-*/", $screen, $match)) {
                 preg_match("/pp-[^@]*-*/", $screen, $match);
             }
         }
         if ($match) {
             if ($pos = strpos($match[0], 'pp-')) {
                 $link_section = substr($match[0], $pos + strlen('pp-'));
                 $link_section = str_replace('_t', '', $link_section);
             }
         }
     } elseif (in_array($screen_obj->base, array('post', 'page', 'upload', 'users', 'edit-tags', 'edit'))) {
         $link_section = $screen_obj->base;
     }
     if ($link_section) {
         $link_section = str_replace('.php', '', $link_section);
         $link_section = str_replace('/', '~', $link_section);
         $help = '';
         if (in_array($screen, array('post', 'page'))) {
             global $post;
             $id_arg = "&amp;post_id=" . $post->ID;
         } elseif (in_array($screen_obj->base, array('edit-tags')) && !empty($_REQUEST['tag_ID'])) {
             if ($term = get_term($_REQUEST['tag_ID'], $_REQUEST['taxonomy'])) {
                 $id_arg = "&amp;term_taxonomy_id=" . $term->term_taxonomy_id;
             }
         } else {
             $id_arg = '';
         }
         $help .= '<ul><li>' . sprintf(__('%1$s Press Permit Documentation%2$s', 'pp'), "<a href='http://presspermit.com/docs/?pp_topic={$link_section}' target='_blank'>", '</a>') . '</li><li>' . sprintf(__('%1$s Press Permit Support Forums%2$s', 'pp'), "<a href='http://presspermit.com/forums/?pp_topic={$link_section}' target='_blank'>", '</a>') . '</li><li>' . sprintf(__('%1$s Press Permit Support Forums (with config data upload) *%2$s', 'pp'), "<a href='admin.php?page=pp-settings&amp;pp_support_forum=1&amp;pp_topic={$link_section}{$id_arg}' target='_blank'>", '</a></li>');
         $key = pp_get_option('support_key');
         if (!$key || 1 != $key[0]) {
             $help .= '<li>' . sprintf(__('%1$s Buy a Press Permit Support Key%2$s', 'pp'), "<a href='http://presspermit.com/purchase/'>", '</a></li>');
         }
         $help .= '</ul>';
         $help .= '<div style="margin-left:20px">';
         $help .= __('* to control which configuration data is uploaded, see Permissions > Settings > Install > Help', 'pp');
         $help .= '</div>';
     }
     echo $help;
 }
开发者ID:severnrescue,项目名称:web,代码行数:49,代码来源:admin-help_pp.php

示例7: flt_hide_pp_only_roles

 function flt_hide_pp_only_roles($roles)
 {
     if ($pp_only = (array) pp_get_option('supplemental_role_defs')) {
         global $pp_role_defs;
         if (!empty($_REQUEST['user_id'])) {
             // display role already set for this user, regardless of pp_only setting
             $user = new WP_User((int) $_REQUEST['user_id']);
             if (!empty($user->roles)) {
                 $pp_only = array_diff($pp_only, $user->roles);
             }
         }
         $roles = array_diff_key($roles, array_fill_keys($pp_only, true));
     }
     return $roles;
 }
开发者ID:severnrescue,项目名称:web,代码行数:15,代码来源:filters-maint_pp.php

示例8: deactivate_key

 public static function deactivate_key()
 {
     if (PP_MULTISITE && !is_super_admin() && (pp_is_network_activated(PPC_BASENAME) || pp_is_mu_plugin(PPC_FILE))) {
         return;
     }
     require_once dirname(__FILE__) . '/plugin_pp.php';
     $support_key = pp_get_option('support_key');
     $request_vars = array('key' => $support_key[1], 'site' => site_url(''));
     $response = PP_Plugin_Status::callhome('deactivate-key', $request_vars);
     $result = json_decode($response);
     if ($result[0] == "0") {
         pp_delete_option('support_key');
     }
     echo $response;
     exit;
 }
开发者ID:severnrescue,项目名称:web,代码行数:16,代码来源:ajax-settings_pp.php

示例9: can_set_exceptions

 public static function can_set_exceptions($operation, $for_item_type, $args)
 {
     $defaults = array('item_id' => 0, 'via_item_source' => 'post', 'via_item_type' => '', 'for_item_source' => 'post');
     extract(array_merge($defaults, $args), EXTR_SKIP);
     if (!($is_administrator = pp_is_user_administrator())) {
         $enabled = 'read' == $operation ? pp_get_option('non_admins_set_read_exceptions') : pp_get_option('non_admins_set_edit_exceptions');
         if (!$enabled) {
             return false;
         }
     }
     if (in_array($via_item_source, array('post', 'term')) && 'read' == $operation) {
         $can = $is_administrator || current_user_can('pp_set_read_exceptions');
     } else {
         $can = false;
     }
     // also filter for Administrators to account for non-applicable operations
     return apply_filters('pp_can_set_exceptions', $can, $operation, $for_item_type, array_merge($args, compact('is_administrator')));
 }
开发者ID:severnrescue,项目名称:web,代码行数:18,代码来源:admin-roles_pp.php

示例10: _pp_flt_map_media_meta_cap

function _pp_flt_map_media_meta_cap($caps, $cap, $user_id, $args)
{
    if (!empty($args[0])) {
        $post = is_object($args[0]) ? $args[0] : get_post($args[0]);
        if ($post && 'attachment' == $post->post_type) {
            if (!empty($post->post_parent)) {
                $post_status = get_post_status($post->ID);
            } elseif ('inherit' == $post->post_status) {
                $post_status = pp_get_option('unattached_files_private') ? 'private' : 'publish';
            } else {
                $post_status = $post->post_status;
            }
            $post_type = get_post_type_object($post->post_type);
            $post_author_id = $post->post_author;
            $caps = array_diff($caps, (array) $cap);
            switch ($cap) {
                case 'read_post':
                case 'read_page':
                    $status_obj = get_post_status_object($post_status);
                    if ($status_obj->public || $status_obj->private && $user_id == $post_author_id) {
                        $caps[] = $post_type->cap->read;
                        break;
                    }
                    // If no author set yet, default to current user for cap checks.
                    if (!$post_author_id) {
                        $post_author_id = $user_id;
                    }
                    if ($status_obj->private) {
                        $caps[] = $post_type->cap->read_private_posts;
                    } else {
                        $caps = map_meta_cap('edit_post', $user_id, $post->ID);
                    }
                    $caps = apply_filters('pp_map_attachment_read_caps', $caps, $post, $user_id);
                    break;
                default:
                    require_once dirname(__FILE__) . '/media-edit-metacap-workaround_pp.php';
                    $args = array_merge($args, compact('post', 'post_status', 'post_type', 'post_author_id'));
                    $caps = _ppff_flt_map_media_edit_meta_cap($caps, $cap, $user_id, $args);
            }
        }
    }
    return $caps;
}
开发者ID:severnrescue,项目名称:web,代码行数:43,代码来源:media-metacap-workaround_pp.php

示例11: pp_get_metagroup

/**
 * Retrieve the Permission Group object for a WP Role or other metagroup, by providing its name
 * @param string metagroup_type
 * @param string metagroup_id
 * @param array args :
 *   - cols (return format - 'all' | 'id')
 * @return object Permission Group (unless cols = 'id')
 *  - ID
 *  - group_name
 *  - group_description
 *  - metagroup_type
 *  - metagroup_id
 */
function pp_get_metagroup($metagroup_type, $metagroup_id, $args = array())
{
    $defaults = array('cols' => 'all');
    extract(array_merge($defaults, $args), EXTR_SKIP);
    global $wpdb;
    $site_key = md5(get_option('site_url') . constant('DB_NAME') . $wpdb->prefix);
    // guard against groups table being imported into a different database (with mismatching options table)
    if (!($buffered_groups = pp_get_option("buffer_metagroup_id_{$site_key}"))) {
        $buffered_groups = array();
    }
    $key = $metagroup_id . ':' . $wpdb->pp_groups;
    // PP setting may change to/from netwide groups after buffering
    if (!isset($buffered_groups[$key])) {
        if ($group = $wpdb->get_row("SELECT * FROM {$wpdb->pp_groups} WHERE metagroup_type = '{$metagroup_type}' AND metagroup_id = '{$metagroup_id}' LIMIT 1")) {
            $group->group_id = $group->ID;
            $group->status = 'active';
            $buffered_groups[$key] = $group;
            pp_update_option("buffer_metagroup_id_{$site_key}", $buffered_groups);
        }
    }
    if ('id' == $cols) {
        return isset($buffered_groups[$key]) ? $buffered_groups[$key]->ID : false;
    } else {
        return isset($buffered_groups[$key]) ? $buffered_groups[$key] : false;
    }
}
开发者ID:severnrescue,项目名称:web,代码行数:39,代码来源:api_pp.php

示例12: elseif

" />
<?php 
        //echo esc_html( __( 'Posts with a custom Visibility or Editability require a corresponding Permission Group role assignment.', 'pp' ) );
        $pp_groups_list_table->search_box(__('Search Groups', 'pp'), 'group');
        ?>

<?php 
        $pp_groups_list_table->display();
        ?>

</form>

<br class="clear" />

<?php 
        if (defined('BP_VERSION') && !defined('PPCE_VERSION') && pp_get_option('display_extension_hints')) {
            if (0 === validate_plugin("pp-buddypress-role-groups/pp-buddypress-role-groups.php")) {
                $msg = __('To assign roles or exceptions to BuddyPress groups, activate the PP BuddyPress Role Groups', 'pp');
            } elseif (true == pp_key_status()) {
                $msg = sprintf(__('To assign roles or exceptions to BuddyPress groups, %1$sinstall%2$s the PP BuddyPress Role Groups plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>');
            } else {
                $msg = sprintf(__('To assign roles or exceptions to BuddyPress groups, %1$senter%2$s or %3$spurchase%4$s a support key and install the PP BuddyPress Role Groups plugin.', 'pp'), '<a href="admin.php?page=pp-settings&pp_tab=install">', '</a>', '<a href="http://presspermit.com/purchase">', '</a>');
            }
            echo "<div class='pp-ext-promo'>{$msg}</div>";
        }
        ?>

</div>
<?php 
        break;
}
开发者ID:severnrescue,项目名称:web,代码行数:31,代码来源:pp-groups.php

示例13: processAdminGeneral

 function processAdminGeneral($post)
 {
     global $wp_roles;
     // Create a new role.
     if (!empty($post['CreateRole'])) {
         if ($newrole = $this->createRole($post['create-name'])) {
             ak_admin_notify(__('New role created.', $this->cm->ID));
             $this->cm->current = $newrole;
         } else {
             if (empty($post['create-name']) && (!defined('WPLANG') || !WPLANG)) {
                 ak_admin_error('Error: No role name specified.', $this->cm->ID);
             } else {
                 ak_admin_error(__('Error: Failed creating the new role.', $this->cm->ID));
             }
         }
         // Copy current role to a new one.
     } elseif (!empty($post['CopyRole'])) {
         $current = get_role($post['current']);
         if ($newrole = $this->createRole($post['copy-name'], $current->capabilities)) {
             ak_admin_notify(__('New role created.', $this->cm->ID));
             $this->cm->current = $newrole;
         } else {
             if (empty($post['copy-name']) && (!defined('WPLANG') || !WPLANG)) {
                 ak_admin_error('Error: No role name specified.', $this->cm->ID);
             } else {
                 ak_admin_error(__('Error: Failed creating the new role.', $this->cm->ID));
             }
         }
         // Save role changes. Already saved at start with self::saveRoleCapabilities().
     } elseif (!empty($post['SaveRole'])) {
         if (MULTISITE) {
             global $wp_roles;
             if (method_exists($wp_roles, 'reinit')) {
                 $wp_roles->reinit();
             }
         }
         $this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
         if (defined('PP_ACTIVE')) {
             // log customized role caps for subsequent restoration
             // for bbPress < 2.2, need to log customization of roles following bbPress activation
             $plugins = function_exists('bbp_get_version') && version_compare(bbp_get_version(), '2.2', '<') ? array('bbpress.php') : array();
             // back compat
             if (!($customized_roles = get_option('pp_customized_roles'))) {
                 $customized_roles = array();
             }
             $customized_roles[$post['role']] = (object) array('caps' => array_map('boolval', $post['caps']), 'plugins' => $plugins);
             update_option('pp_customized_roles', $customized_roles);
             global $wpdb;
             $wpdb->query("UPDATE {$wpdb->options} SET autoload = 'no' WHERE option_name = 'pp_customized_roles'");
         }
         // Create New Capability and adds it to current role.
     } elseif (!empty($post['AddCap'])) {
         if (MULTISITE) {
             global $wp_roles;
             if (method_exists($wp_roles, 'reinit')) {
                 $wp_roles->reinit();
             }
         }
         $role = get_role($post['current']);
         $role->name = $post['current'];
         // bbPress workaround
         if ($newname = $this->createNewName($post['capability-name'])) {
             $role->add_cap($newname['name']);
             $this->cm->message = __('New capability added to role.');
             // for bbPress < 2.2, need to log customization of roles following bbPress activation
             $plugins = function_exists('bbp_get_version') && version_compare(bbp_get_version(), '2.2', '<') ? array('bbpress.php') : array();
             // back compat
             if (!($customized_roles = get_option('pp_customized_roles'))) {
                 $customized_roles = array();
             }
             $customized_roles[$post['role']] = (object) array('caps' => array_merge($role->capabilities, array($newname['name'] => 1)), 'plugins' => $plugins);
             update_option('pp_customized_roles', $customized_roles);
             global $wpdb;
             $wpdb->query("UPDATE {$wpdb->options} SET autoload = 'no' WHERE option_name = 'pp_customized_roles'");
         } else {
             $this->cm->message = __('Incorrect capability name.');
         }
     } elseif (!empty($post['update_filtered_types'])) {
         if (cme_update_pp_usage()) {
             ak_admin_notify(__('Capability settings saved.', $this->cm->ID));
         } else {
             ak_admin_error(__('Error saving capability settings.', $this->cm->ID));
         }
     } else {
         // TODO: Implement exceptions. This must be a fatal error.
         ak_admin_error(__('Bad form received.', $this->cm->ID));
     }
     if (!empty($newrole) && defined('PP_ACTIVE')) {
         if (!empty($post['CreateRole']) && !empty($_REQUEST['new_role_pp_only']) || !empty($post['CopyRole']) && !empty($_REQUEST['copy_role_pp_only'])) {
             $pp_only = (array) pp_get_option('supplemental_role_defs');
             $pp_only[] = $newrole;
             pp_update_option('supplemental_role_defs', $pp_only);
             _cme_pp_default_pattern_role($newrole);
             pp_refresh_options();
         }
     }
 }
开发者ID:Bakerpedia,项目名称:Development_Site5,代码行数:97,代码来源:handler.php

示例14: prepare_query

 /**
  * Prepare the query variables
  *
  * @access private
  */
 function prepare_query()
 {
     global $wpdb;
     $qv =& $this->query_vars;
     $groups_table = apply_filters('pp_use_groups_table', $wpdb->pp_groups, $this->agent_type);
     if (is_array($qv['fields'])) {
         $qv['fields'] = array_unique($qv['fields']);
         $this->query_fields = array();
         foreach ($qv['fields'] as $field) {
             $this->query_fields[] = $groups_table . '.' . esc_sql($field);
         }
         $this->query_fields = implode(',', $this->query_fields);
     } elseif ('all' == $qv['fields']) {
         $this->query_fields = "{$groups_table}.*";
     } else {
         $this->query_fields = "{$groups_table}.ID";
     }
     $this->query_from = "FROM {$groups_table}";
     $this->query_where = "WHERE 1=1";
     $group_variant = isset($_REQUEST['group_variant']) ? pp_sanitize_key($_REQUEST['group_variant']) : '';
     $group_variant = apply_filters('pp_query_group_variant', $group_variant);
     $require_meta_types = array();
     if ('wp_role' == $group_variant) {
         $require_meta_types[] = 'wp_role';
     }
     if ($require_meta_types) {
         $this->query_where .= " AND {$groups_table}.metagroup_type IN ('" . implode("','", $require_meta_types) . "')";
     }
     $skip_meta_types = array();
     if ($group_variant && 'wp_role' != $group_variant) {
         $skip_meta_types[] = 'wp_role';
     } else {
         $pp_only_roles = (array) pp_get_option('supplemental_role_defs');
         if (defined('CAPSMAN_ENH_VERSION') && version_compare(CAPSMAN_ENH_VERSION, '1.4.10', '<')) {
             // version 1.4.9 and earlier stored redundant elements
             $_pp_only_roles = (array) $pp_only_roles;
             $pp_only_roles = array_unique($pp_only_roles);
             if (count($pp_only_roles) != count($_pp_only_roles)) {
                 pp_update_option('supplemental_role_defs', $pp_only_roles);
             }
         }
         if (pp_get_option('anonymous_unfiltered')) {
             $pp_only_roles = array_merge($pp_only_roles, array('wp_anon', 'wp_all'));
         }
         $pp_only_roles = implode("','", $pp_only_roles);
         $this->query_where .= " AND ( ( {$groups_table}.metagroup_type != 'wp_role' ) OR ( {$groups_table}.metagroup_id NOT IN ( '{$pp_only_roles}' ) ) )";
     }
     if ($skip_meta_types) {
         $this->query_where .= " AND {$groups_table}.metagroup_type NOT IN ('" . implode("','", $skip_meta_types) . "')";
     }
     global $wp_roles;
     $admin_roles = array();
     if (isset($wp_roles->role_objects)) {
         foreach (array_keys($wp_roles->role_objects) as $wp_role_name) {
             if (!empty($wp_roles->role_objects[$wp_role_name]->capabilities['pp_administer_content']) || !empty($wp_roles->role_objects[$wp_role_name]->capabilities['pp_unfiltered'])) {
                 $admin_roles[$wp_role_name] = true;
             }
         }
     }
     if ($admin_roles) {
         $this->query_where .= " AND {$groups_table}.metagroup_id NOT IN ('" . implode("','", array_keys($admin_roles)) . "')";
     }
     $skip_meta_ids = array();
     if (!defined('RVY_VERSION') || defined('SCOPER_DEFAULT_MONITOR_GROUPS') || defined('PP_DEFAULT_MONITOR_GROUPS')) {
         $skip_meta_ids = array_merge($skip_meta_ids, array('rv_pending_rev_notice_ed_nr_', 'rv_scheduled_rev_notice_ed_nr_'));
     }
     if ($skip_meta_ids) {
         $this->query_where .= " AND {$groups_table}.metagroup_id NOT IN ('" . implode("','", $skip_meta_ids) . "')";
     }
     //$this->query_where .= "AND $groups_table.metagroup_id != 'wp_anon'";
     // sorting
     if ('ID' == $qv['orderby'] || 'id' == $qv['orderby']) {
         $orderby = 'ID';
     } else {
         $orderby = 'group_name';
     }
     $qv['order'] = strtoupper($qv['order']);
     if ('ASC' == $qv['order']) {
         $order = 'ASC';
     } else {
         $order = 'DESC';
     }
     $this->query_orderby = "ORDER BY {$orderby} {$order}";
     // limit
     if ($qv['number']) {
         if ($qv['offset']) {
             $this->query_limit = $wpdb->prepare("LIMIT %d, %d", $qv['offset'], $qv['number']);
         } else {
             $this->query_limit = $wpdb->prepare("LIMIT %d", $qv['number']);
         }
     }
     $search = trim($qv['search']);
     if ($search) {
         $leading_wild = ltrim($search, '*') != $search;
         $trailing_wild = rtrim($search, '*') != $search;
//.........这里部分代码省略.........
开发者ID:estrategasdigitales,项目名称:glummer,代码行数:101,代码来源:group-query_pp.php

示例15: _pp_support_upload

function _pp_support_upload($args = array())
{
    require_once dirname(__FILE__) . '/plugin_pp.php';
    //$args['post_id'] = 1;
    //$args['term_taxonomy_id'] = 1;
    $request_vars = array('site' => site_url(''));
    global $wpdb;
    $ok = (array) pp_get_option('support_data');
    $pp_config = array();
    $pp_old = array();
    //if ( ! empty( $ok['pp_options'] ) ) {
    global $pp_site_options;
    $options = array();
    foreach (array('default_category', 'permalink_structure', '_bbp_default_role', '_bbp_private_forums', '_bbp_use_wp_editor', '_bbp_allow_anonymous', '_bbp_allow_global_access', '_bbp_db_version', 'bp-active-components', 'users_can_register', 'comment_moderation', 'comment_registration', 'registration', 'default_role', 'db_version', 'enable_app', 'enable_xmlrpc', 'sticky_posts', 'initial_db_version') as $opt) {
        $options[$opt] = get_option($opt);
    }
    ksort($options);
    $pp_config['options'] = gzcompress(serialize($options));
    ksort($pp_site_options);
    $pp_config['pp_options'] = gzcompress(serialize($pp_site_options));
    $pp_config['rvy_options'] = gzcompress(serialize($wpdb->get_results("SELECT option_name, option_value, option_id FROM {$wpdb->options} WHERE option_name LIKE 'rvy_%' ORDER BY option_name", ARRAY_N)));
    if (PP_MULTISITE) {
        global $pp_netwide_options, $pp_net_options;
        if (is_array($pp_net_options)) {
            ksort($pp_net_options);
            if (!empty($pp_net_options)) {
                $pp_config['pp_net_options'] = gzcompress(serialize($pp_net_options));
            }
        }
        ksort($pp_netwide_options);
        if (!empty($pp_netwide_options)) {
            $pp_config['pp_netwide_options'] = gzcompress(serialize($pp_netwide_options));
        }
        $sitemeta_table = $wpdb->base_prefix . 'sitemeta';
        if ($rvy_net_options = $wpdb->get_results("SELECT meta_key, meta_value, site_id, meta_id FROM {$sitemeta_table} WHERE meta_key LIKE 'rvy_%' ORDER BY meta_key", ARRAY_N)) {
            $pp_config['rvy_net_options'] = gzcompress(serialize($rvy_net_options));
        }
    }
    //}
    if (!empty($ok['wp_roles_types'])) {
        global $wp_post_types, $wp_taxonomies, $wp_post_statuses, $wp_roles;
        // strip labels, label_count props
        $pp_config['wp_roles'] = gzcompress(serialize($wp_roles));
        // strip out labels and some other properties for perf
        foreach (array('wp_post_types', 'wp_taxonomies', 'wp_post_statuses') as $var) {
            $wp_data = ${$var};
            $arr = array();
            foreach (array_keys($wp_data) as $member) {
                $arr[$member] = array();
                foreach (array_keys(get_object_vars($wp_data[$member])) as $prop) {
                    if (!in_array($prop, array('labels', 'label_count', 'can_export', 'description'))) {
                        $arr[$member][$prop] = $wp_data[$member]->{$prop};
                    }
                }
            }
            $pp_config[$var] = gzcompress(serialize($arr));
        }
    }
    if (!empty($ok['theme'])) {
        $th = wp_get_theme();
        $theme_data = array();
        foreach (array('name', 'title', 'version', 'parent_theme', 'template') as $prop) {
            $theme_data[$prop] = $th->{$prop};
        }
        $theme_data['errors'] = $th->errors();
        $pp_config['theme'] = gzcompress(serialize($theme_data));
        $pp_config['widgets'] = gzcompress(serialize((array) get_option('sidebars_widgets')));
    }
    if (file_exists(ABSPATH . 'wp-admin/includes/plugin.php')) {
        include_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    if (!empty($ok['active_plugins']) && function_exists('get_plugin_data')) {
        $active_plugins = array();
        foreach (wp_get_active_and_valid_plugins() as $file) {
            // reduce to relative path for privacy
            $slug = array();
            if ($part = @basename(dirname(dirname(dirname($file))))) {
                $slug[] = $part;
            }
            if ($part = @basename(dirname(dirname($file)))) {
                $slug[] = $part;
            }
            if ($part = @basename(dirname($file))) {
                $slug[] = $part;
            }
            $slug[] = basename($file);
            $slug = implode('/', $slug);
            $active_plugins[$slug] = array_diff_key(get_plugin_data($file), array_fill_keys(array('Author', 'AuthorURI', 'TextDomain', 'DomainPath', 'Title', 'AuthorName', 'Description'), true));
        }
        $pp_config['active_plugins'] = gzcompress(serialize($active_plugins));
        if (function_exists('get_dropins')) {
            $pp_config['dropins'] = gzcompress(serialize(get_dropins()));
        }
    }
    if (!empty($ok['installed_plugins']) && function_exists('get_plugins')) {
        if ($installed_plugins = get_plugins()) {
            foreach (array_keys($installed_plugins) as $key) {
                $installed_plugins[$key] = array_diff_key($installed_plugins[$key], array_fill_keys(array('Author', 'AuthorURI', 'TextDomain', 'DomainPath', 'Title', 'AuthorName', 'Description', 'PluginURI', 'Network'), true));
            }
            $pp_config['installed_plugins'] = gzcompress(serialize($installed_plugins));
//.........这里部分代码省略.........
开发者ID:severnrescue,项目名称:web,代码行数:101,代码来源:support_pp.php


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