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;
}
Example #2
0
 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';
 }
Example #3
0
function pp_register_extension($slug, $label, $basename, $version, $min_pp_version = '0', $min_wp_version = '0')
{
    global $pp_extensions, $pp_min_ext_version;
    $slug = pp_sanitize_key($slug);
    if (!isset($pp_extensions) || !is_array($pp_extensions)) {
        $pp_extensions = array();
    }
    // avoid lockout in case of editing plugin via wp-admin
    if (constant('PP_DEBUG') && is_admin() && ppc_editing_plugin()) {
        return false;
    }
    $register = true;
    $error = false;
    if (!pp_wp_ver($min_wp_version)) {
        require_once dirname(__FILE__) . '/lib/error_pp.php';
        $error = PP_Error::old_wp($label, $min_wp_version);
        $register = false;
    } elseif (version_compare(PPC_VERSION, $min_pp_version, '<')) {
        require_once dirname(__FILE__) . '/lib/error_pp.php';
        $error = PP_Error::old_pp($label, $min_pp_version);
        $register = false;
    } elseif (!empty($pp_min_ext_version[$slug]) && version_compare($version, $pp_min_ext_version[$slug], '<')) {
        if (is_admin()) {
            require_once dirname(__FILE__) . '/lib/error_pp.php';
            $error = PP_Error::old_extension($label, $pp_min_ext_version[$slug]);
            // but still register extension so it can be updated!
        } else {
            $error = true;
            $register = false;
        }
    }
    if ($register) {
        $version = pp_sanitize_word($version);
        $pp_extensions[$slug] = (object) compact('slug', 'version', 'label', 'basename');
    }
    return !$error;
}
Example #4
0
 function act_save_post($post_id, $post)
 {
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         if (!pp_wp_ver('3.8') || 'revision' == $post->post_type || 'draft' != $post->post_status) {
             return;
         }
     }
     require_once dirname(__FILE__) . '/post-save_pp.php';
     PP_PostSave::act_save_item('post', $post_id, $post);
 }
Example #5
0
    function pp_types_ui($defined)
    {
        if (current_user_can('pp_manage_settings')) {
            ?>

		<dl>
			<dt><?php 
            _e('Force Type-Specific Capabilities', 'capsman');
            ?>
</dt>
			<dd style="text-align:center;">
				<?php 
            $caption = __('Force unique capability names for:', 'capsman');
            echo "<p>{$caption}</p>";
            if (pp_get_option('display_hints')) {
                ?>

				<div class="cme-subtext" style="margin-top:0">
				<?php 
                _e('(PP Filtered Post Types, Taxonomies)', 'capsman');
                ?>

				</div>
				<?php 
            }
            echo "<table style='width:100%'><tr>";
            $unfiltered['type'] = apply_filters('pp_unfiltered_post_types', array('forum', 'topic', 'reply'));
            // bbPress' dynamic role def requires additional code to enforce stored caps
            $unfiltered['taxonomy'] = apply_filters('pp_unfiltered_taxonomies', array('post_status', 'topic-tag'));
            // avoid confusion with Edit Flow administrative taxonomy
            $hidden['type'] = apply_filters('pp_hidden_post_types', array());
            $hidden['taxonomy'] = apply_filters('pp_hidden_taxonomies', array());
            foreach (array_keys($defined) as $item_type) {
                echo '<td style="width:50%">';
                $option_name = 'taxonomy' == $item_type ? 'enabled_taxonomies' : 'enabled_post_types';
                $enabled = pp_get_option($option_name);
                foreach ($defined[$item_type] as $key => $type_obj) {
                    if (!$key) {
                        continue;
                    }
                    if (in_array($key, $unfiltered[$item_type])) {
                        continue;
                    }
                    $id = "{$option_name}-" . $key;
                    ?>

						<div style="text-align:left">
						<?php 
                    if (!empty($hidden[$item_type][$key])) {
                        ?>

							<input name="<?php 
                        echo $id;
                        ?>
" type="hidden" id="<?php 
                        echo $id;
                        ?>
" value="1" />
							<input name="<?php 
                        echo "{$option_name}-options[]";
                        ?>
" type="hidden" value="<?php 
                        echo $key;
                        ?>
" />
						
						<?php 
                    } else {
                        ?>

							<div class="agp-vspaced_input">
							<label for="<?php 
                        echo $id;
                        ?>
" title="<?php 
                        echo $key;
                        ?>
">
							<input name="<?php 
                        echo "{$option_name}-options[]";
                        ?>
" type="hidden" value="<?php 
                        echo $key;
                        ?>
" />
							<input name="<?php 
                        echo $id;
                        ?>
" type="checkbox" id="<?php 
                        echo $id;
                        ?>
" value="1" <?php 
                        checked('1', !empty($enabled[$key]));
                        ?>
 /> <?php 
                        echo $type_obj->label;
                        ?>

							
							<?php 
                        echo '</label></div>';
                    }
                    // displaying checkbox UI
                    echo '</div>';
                }
                echo '</td>';
            }
            ?>

				</tr>
				</table>
				
				<?php 
            if (pp_wp_ver('3.5')) {
                $define_create_posts_cap = pp_get_option('define_create_posts_cap');
                ?>

					<div>
					<label for="pp_define_create_posts_cap">
					<input name="pp_define_create_posts_cap" type="checkbox" id="pp_define_create_posts_cap" value="1" <?php 
                checked('1', $define_create_posts_cap);
                ?>
 /> <?php 
                _e('Use create_posts capability');
                ?>

					</label>
					</div>
				<?php 
            }
            ?>

				
				<input type="submit" name="update_filtered_types" value="<?php 
            _e('Update', 'capsman');
            ?>
" class="button" />
			</dd>
		</dl>
		<?php 
        }
    }
Example #6
0
 function __construct()
 {
     global $pagenow, $pp_plugin_page;
     do_action('_pp_admin_ui');
     // ============== UI-related filters ================
     add_action('admin_menu', array(&$this, 'build_menu'));
     add_action('show_user_profile', array(&$this, 'ui_user'), 2);
     add_action('edit_user_profile', array(&$this, 'ui_user'), 2);
     add_action('admin_print_scripts-user-new.php', array(&$this, 'insert_groups_ui'));
     add_action('admin_menu', array(&$this, 'ngg_uploader_workaround'));
     $is_post_admin = false;
     if (array_intersect(array($pagenow, $pp_plugin_page), array('post-new.php', 'post.php'))) {
         global $pp_post_edit_ui;
         require_once dirname(__FILE__) . '/post-edit-ui_pp.php';
         $pp_post_edit_ui = new PP_PostEditUI();
         $is_post_admin = true;
     } elseif ('edit-tags.php' == $pagenow && !empty($_REQUEST['action']) && 'edit' == $_REQUEST['action']) {
         if (current_user_can('pp_assign_roles')) {
             global $pp_term_edit_ui;
             require_once dirname(__FILE__) . '/term-edit-ui_pp.php';
             $pp_term_edit_ui = new PP_TermEditUI();
         }
     }
     if (pp_is_user_administrator() || 0 === strpos($pp_plugin_page, 'pp-')) {
         add_action('in_admin_footer', array(&$this, 'ui_admin_footer'));
     }
     if ('users.php' == $pagenow) {
         require_once dirname(__FILE__) . '/users-ui_pp.php';
     } elseif ('edit.php' == $pagenow || pp_is_ajax('inline-save')) {
         $post_type = isset($_REQUEST['post_type']) ? pp_sanitize_key($_REQUEST['post_type']) : 'post';
         if (in_array($post_type, pp_get_enabled_post_types())) {
             global $pp_post_listing_ui;
             require_once dirname(__FILE__) . '/post-listing-ui_pp.php';
             $pp_post_listing_ui = new PP_PostsAdmin();
             $is_post_admin = true;
         }
     } elseif (in_array($pagenow, array('edit-tags.php')) || defined('DOING_AJAX') && DOING_AJAX && isset($_REQUEST['action']) && in_array($_REQUEST['action'], array('inline-save-tax', 'add-tag'))) {
         if (!empty($_REQUEST['taxonomy']) && pp_is_taxonomy_enabled($_REQUEST['taxonomy'])) {
             global $pp_admin_terms_listing;
             require_once dirname(__FILE__) . '/term-listing-ui_pp.php';
             $pp_admin_terms_listing = new PP_TermsAdmin();
         }
     } elseif (in_array($pagenow, array('plugins.php', 'plugin-install.php'))) {
         global $pp_plugin_admin;
         require_once dirname(__FILE__) . '/admin-plugins_pp.php';
         $pp_plugin_admin = new PP_Plugin_Admin();
     } else {
         if (strpos($_SERVER['REQUEST_URI'], 'page=pp-groups') && isset($_REQUEST['wp_screen_options'])) {
             require_once dirname(__FILE__) . '/ui-helper_pp.php';
             PP_UI_Helper::handle_screen_options();
         }
         if (in_array($pp_plugin_page, array('pp-edit-permissions'))) {
             // pp-group-new
             add_action('admin_head', array(&$this, 'load_scripts'));
         } elseif (in_array($pp_plugin_page, array('pp-settings', 'pp-about'))) {
             wp_enqueue_style('plugin-install');
             wp_enqueue_script('plugin-install');
             add_thickbox();
         }
     }
     if ($is_post_admin) {
         do_action('pp_post_admin');
     }
     add_action('admin_head', array(&$this, 'admin_head'));
     wp_enqueue_style('pp', PP_URLPATH . '/admin/css/pp.css', array(), PPC_VERSION);
     if (0 === strpos($pp_plugin_page, 'pp-')) {
         wp_enqueue_style('pp-plugin-pages', PP_URLPATH . '/admin/css/pp-plugin-pages.css', array(), PPC_VERSION);
     }
     if (in_array($pagenow, array('user-edit.php', 'user-new.php', 'profile.php'))) {
         wp_enqueue_style('pp-edit-permissions', PP_URLPATH . '/admin/css/pp-edit-permissions.css', array(), PPC_VERSION);
         wp_enqueue_style('pp-groups-checklist', PP_URLPATH . '/admin/css/pp-groups-checklist.css', array(), PPC_VERSION);
         if (!pp_wp_ver('3.8')) {
             wp_enqueue_style('pp-edit-perm-legacy', PP_URLPATH . '/admin/css/pp-edit-permissions-legacy.css', array(), PPC_VERSION);
         }
     } elseif (in_array($pp_plugin_page, array('pp-edit-permissions', 'pp-group-new'))) {
         wp_enqueue_style('pp-edit-permissions', PP_URLPATH . '/admin/css/pp-edit-permissions.css', array(), PPC_VERSION);
         wp_enqueue_style('pp-groups-checklist', PP_URLPATH . '/admin/css/pp-groups-checklist.css', array(), PPC_VERSION);
         if (!pp_wp_ver('3.8')) {
             wp_enqueue_style('pp-edit-perm-legacy', PP_URLPATH . '/admin/css/pp-edit-permissions-legacy.css', array(), PPC_VERSION);
         }
     } elseif ('pp-settings' == $pp_plugin_page) {
         wp_enqueue_style('pp-settings', PP_URLPATH . '/admin/css/pp-settings.css', array(), PPC_VERSION);
     } elseif ('pp-about' == $pp_plugin_page) {
         wp_enqueue_style('pp-about', PP_URLPATH . '/admin/css/pp-about.css', array(), PPC_VERSION);
     }
     global $pagenow;
     if (in_array($pagenow, array('edit.php', 'post.php')) && pp_wp_ver('3.5-beta')) {
         add_action('admin_menu', array(&$this, 'reinstate_solo_submenus'));
         add_action('network_admin_menu', array(&$this, 'reinstate_solo_submenus'));
     }
     if (in_array($pagenow, array('edit.php', 'post.php', 'post-new.php', 'edit-tags.php', 'index.php')) || !empty($pp_plugin_page)) {
         add_action('admin_notices', array(&$this, 'admin_notice'));
     }
     do_action('pp_admin_ui');
 }
    function options_ui()
    {
        global $pp_default_options, $pp_options_ui;
        $ui = $pp_options_ui;
        $tab = 'core';
        $section = 'permissions';
        // --- PERMISSIONS SECTION ---
        if (!empty($ui->form_options[$tab][$section])) {
            ?>
			<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>
			<?php 
            $hint = __('If disabled, manually "blocked" posts can be unblocked by Category / Term Exceptions.  Enabling this setting will provide more intuitive behavior, but may require configuration review and testing on prior installations.', 'pp');
            $ui->option_checkbox('post_blockage_priority', $tab, $section, $hint);
            ?>
			</td></tr>
		<?php 
        }
        // any options accessable in this section
        // --- FILTERED TAXONOMIES / POST TYPES SECTION ---
        foreach (array('object' => 'post_types', 'term' => 'taxonomies') as $scope => $section) {
            if (empty($ui->form_options[$tab][$section])) {
                continue;
            }
            ?>
			<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>
			<?php 
            if ('term' == $scope) {
                $option_name = 'enabled_taxonomies';
                _e('Modify permissions for these Taxonomies:', 'pp');
                echo '<br />';
                $types = get_taxonomies(array('public' => true), 'object');
                if ($omit_types = apply_filters('pp_unfiltered_taxonomies', array('post_status', 'topic-tag'))) {
                    // avoid confusion with Edit Flow administrative taxonomy
                    $types = array_diff_key($types, array_fill_keys((array) $omit_types, true));
                }
                $hidden_types = apply_filters('pp_hidden_taxonomies', array());
                $types = _pp_order_types($types);
            } else {
                $option_name = 'enabled_post_types';
                _e('Modify permissions for these Post Types:', 'pp');
                $types = get_post_types(array('public' => true), 'object');
                if ($omit_types = apply_filters('pp_unfiltered_post_types', array())) {
                    $types = array_diff_key($types, array_fill_keys((array) $omit_types, true));
                }
                $hidden_types = apply_filters('pp_hidden_post_types', array());
                $types = _pp_order_types($types);
            }
            $ui->all_otype_options[] = $option_name;
            if (isset($pp_default_options[$option_name])) {
                if (!($enabled = $ui->get_option($option_name))) {
                    $enabled = array();
                }
                foreach ($types as $key => $obj) {
                    if (!$key) {
                        continue;
                    }
                    $id = $option_name . '-' . $key;
                    $name = $option_name . "[{$key}]";
                    ?>
					
					<?php 
                    if ('nav_menu' == $key) {
                        ?>
						<input name="<?php 
                        echo $name;
                        ?>
" type="hidden" id="<?php 
                        echo $id;
                        ?>
" value="1" />
					<?php 
                    } else {
                        ?>
						<?php 
                        if (isset($hidden_types[$key])) {
                            ?>
							<input name="<?php 
                            echo $name;
                            ?>
" type="hidden" value="<?php 
                            echo $hidden_types[$key];
                            ?>
" />
						<?php 
                        } else {
                            ?>
							<div class="agp-vtight_input">
							<input name="<?php 
                            echo $name;
                            ?>
" type="hidden" value="0" />
							<label for="<?php 
                            echo $id;
                            ?>
" title="<?php 
                            echo $key;
                            ?>
">
							<input name="<?php 
                            echo $name;
                            ?>
" type="checkbox" id="<?php 
                            echo $id;
                            ?>
" value="1" <?php 
                            checked('1', !empty($enabled[$key]));
                            ?>
 />
							
							<?php 
                            if (isset($obj->labels_pp)) {
                                echo $obj->labels_pp->name;
                            } elseif (isset($obj->labels->name)) {
                                echo $obj->labels->name;
                            } else {
                                echo $key;
                            }
                            echo '</label></div>';
                        }
                    }
                    // displaying checkbox UI
                }
                // end foreach src_otype
            }
            // endif default option isset
            if ('object' == $scope) {
                if (pp_get_option('display_hints')) {
                    if ($types = get_post_types(array('public' => true, '_builtin' => false))) {
                        ?>
						<div class="pp-subtext">
						<?php 
                        printf(__('<span class="pp-important">Note</span>: Type-specific capability requirements (i.e. edit_things instead of edit_posts) will be imposed. If PP filters Media or a custom type, non-Administrators <span class="pp-important">will need a corresponding %1$ssupplemental role%2$s for editing</span>. Adding the type-specific capabilities directly to a WP role definition also works.'), "<a href='" . admin_url('?page=pp-groups') . "'>", '</a>');
                        ?>
						</div>
						
						<?php 
                        if (in_array('forum', $types) && !defined('PPP_VERSION') && pp_get_option('display_extension_hints')) {
                            ?>
							<div class="pp-subtext" style="margin-top:10px">
							<?php 
                            if (pp_key_active()) {
                                _e('To customize bbPress forum permissions, activate PP Compatibility Pack.', 'pp');
                            } else {
                                _e('To customize bbPress forum permissions, activate your Press Permit Pro support key.', 'pp');
                            }
                            ?>
							</div>
						<?php 
                        }
                        ?>
					<?php 
                    }
                }
                if (pp_wp_ver('3.5')) {
                    echo '<br /><div>';
                    $hint = __('If enabled, the create_posts, create_pages, etc. capabilities will be enforced for all Filtered Post Types.  <strong>NOTE: You will also need to use a WordPress Role Editor</strong> such as Capability Manager Enhanced to add the create_posts capability to desired roles.', 'pp');
                    $ret = $ui->option_checkbox('define_create_posts_cap', $tab, $section, $hint, '');
                    echo '</div>';
                }
            }
            ?>
			</td></tr>
			<?php 
        }
        // end foreach scope
        $section = 'front_end';
        // --- FRONT END SECTION ---
        if (!empty($ui->form_options[$tab][$section])) {
            ?>
			<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>
			<?php 
            $hint = __('Remove the "Private:" and "Protected" prefix from Post, Page titles', 'pp');
            $ui->option_checkbox('strip_private_caption', $tab, $section, $hint);
            ?>
			</td></tr>
		<?php 
        }
        // any options accessable in this section
        $section = 'admin';
        // --- BACK END SECTION ---
        if (!empty($ui->form_options[$tab][$section])) {
            ?>
			<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>
			<?php 
            $hint = 0 === validate_plugin("pp-collaborative-editing/pp-collaborative-editing.php") ? __('Note: pending further development, uneditable posts will always be hidden if the PP Collaborative Editing extension is active', 'pp') : '';
            if (defined('PPCE_VERSION')) {
                $args = array('val' => 1, 'disabled' => true, 'no_storage' => true);
            }
            $ui->option_checkbox('admin_hide_uneditable_posts', $tab, $section, $hint, '', $args);
            ?>
			</td></tr>
		<?php 
        }
        // any options accessable in this section
        $section = 'user_profile';
        // --- USER PROFILE SECTION ---
        if (!empty($ui->form_options[$tab][$section])) {
            ?>
			<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>
			<?php 
            $hint = '';
            if (!defined('PP_MULTISITE')) {
                $ui->option_checkbox('new_user_groups_ui', $tab, $section, $hint, '<br />');
            }
            $hint = __('note: Groups and Roles are always displayed in "Edit User"', 'pp');
            $ui->option_checkbox('display_user_profile_groups', $tab, $section);
            $ui->option_checkbox('display_user_profile_roles', $tab, $section, $hint);
            ?>
				
			</td></tr>
		<?php 
        }
        // any options accessable in this section
        $section = 'db_maint';
        if (get_option('pp_need_group_index_drop')) {
            ?>
			<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>
			<?php 
            $hint = '';
            $ui->option_checkbox('do_group_index_drop', $tab, $section, $hint, '<br />', array('no_storage' => true));
            ?>

			</td></tr>
		<?php 
        }
    }
Example #8
0
 function get_search_sql($string, $cols, $wild = false)
 {
     $string = esc_sql($string);
     $searches = array();
     $leading_wild = 'leading' == $wild || 'both' == $wild ? '%' : '';
     $trailing_wild = 'trailing' == $wild || 'both' == $wild ? '%' : '';
     foreach ($cols as $col) {
         if ('ID' == $col) {
             $searches[] = "{$col} = '{$string}'";
         } else {
             global $wpdb;
             if (pp_wp_ver('4.0')) {
                 $searches[] = "{$col} LIKE '{$leading_wild}" . $wpdb->esc_like($string) . "{$trailing_wild}'";
             } else {
                 $searches[] = "{$col} LIKE '{$leading_wild}" . like_escape($string) . "{$trailing_wild}'";
             }
         }
     }
     return ' AND (' . implode(' OR ', $searches) . ')';
 }