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 
        }
    }
Esempio n. 2
0
function pp_update_info_enabled()
{
    if (defined('PP_FORCE_PPCOM_INFO') || pp_get_option('ppcom_update_info')) {
        return true;
    }
    return pp_key_active();
}
Esempio n. 3
0
    function options_ui()
    {
        global $pp_options_ui;
        $ui = $pp_options_ui;
        // shorten syntax
        $tab = 'advanced';
        $section = 'enable';
        // --- ENABLE SECTION ---
        if (!empty($ui->form_options[$tab][$section])) {
            ?>
			<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>
			<?php 
            $hint = '';
            $ui->option_checkbox('advanced_options', $tab, $section, $hint);
            ?>
			</td></tr>
		<?php 
        }
        // any options accessable in this section
        $section = 'file_filtering';
        if ($this->enabled || true || PP_MULTISITE) {
            ?>
		<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>
		<?php 
            if (defined('PPFF_VERSION')) {
                do_action('ppff_pp_option_hint');
            } else {
                _e('To filter access to attached files, install the Press Permit File URL Filter extension.', 'pp');
                echo '<br />';
            }
            ?>
		</td></tr>
		<?php 
        }
        if ($this->enabled) {
            $section = 'anonymous';
            // --- ANONYMOUS USERS SECTION ---
            if (!empty($ui->form_options[$tab][$section])) {
                ?>
				<tr><th scope="row"><?php 
                echo $ui->section_captions[$tab][$section];
                ?>
</th><td>
				<?php 
                $hint = sprintf(__('Disable PP filtering for users who are not logged in. %1$sNote that this performance enhancement will make reading exceptions ineffective%2$s.', 'pp'), '<span class="pp-warning"><strong>', '</strong></span>');
                $ui->option_checkbox('anonymous_unfiltered', $tab, $section, $hint);
                $hint = __('If checked, pages blocked from the "All" or "Authenticated" groups will still be listed to Administrators.', 'pp');
                $ui->option_checkbox('suppress_administrator_metagroups', $tab, $section, $hint);
                do_action('pp_options_ui_insertion', $tab, $section);
                ?>
				</td></tr>
			<?php 
            }
            // any options accessable in this section
            $section = 'custom_statuses';
            // --- CUSTOM POST STATUSES SECTION ---
            if (!empty($ui->form_options[$tab][$section])) {
                ?>
				<tr><th scope="row"><?php 
                echo $ui->section_captions[$tab][$section];
                ?>
</th><td>
				<?php 
                do_action('pp_options_ui_insertion', $tab, $section);
                ?>
				</td></tr>
			<?php 
            }
            // any options accessable in this section
            $section = 'permissions_admin';
            // --- PERMISSIONS ADMIN SECTION ---
            if (!empty($ui->form_options[$tab][$section])) {
                ?>
				<tr><th scope="row"><?php 
                echo $ui->section_captions[$tab][$section];
                ?>
</th><td>
				<?php 
                $hint = __('If enabled, users with the pp_set_read_exceptions capability in the WP role can set reading exceptions for their editable posts.', 'pp');
                $ui->option_checkbox('non_admins_set_read_exceptions', $tab, $section, $hint);
                do_action('pp_options_ui_insertion', $tab, $section);
                ?>
				</td></tr>
			<?php 
            }
            // any options accessable in this section
            $section = 'capabilities';
            // --- PP CAPABILITIES SECTION ---
            ?>
				<tr><td scope="row" colspan="2"><span style="font-weight:bold"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</span>
				<span style="margin-left:125px">
				<?php 
            if (pp_get_option('display_hints')) {
                ?>
					<span class="pp-subtext">
					<?php 
                if (ppc_is_plugin_active('capsman-enhanced')) {
                    $url = 'admin.php?page=capsman';
                    printf(__('You can customize Press Permit administration capabilities %1$s for any WP role%2$s:', 'pp'), '<a href="' . $url . '">', '</a>');
                } else {
                    printf(__('You can customize Press Permit administration capabilities by using a WP role editor such as %1$s:', 'pp'), '<span class="plugins update-message"><a href="' . pp_plugin_info_url('capability-manager-enhanced') . '" class="thickbox" title=" Capability Manager Enhanced">Capability&nbsp;Manager&nbsp;Enhanced</a></span>');
                }
                ?>
					</span>
				<?php 
            }
            ?>
				</span>
				
	
				<table id="pp_cap_descripts">
				<thead>
				<tr>
				<th class="cap-name"><?php 
            _e('Capability Name', 'pp');
            ?>
</th>
				<th><?php 
            echo __ppw('Description', 'pp');
            ?>
</th>
				</tr>
				</thead>
				<tbody>
				
				<?php 
            $pp_caps = array('pp_manage_settings' => __('Modify these Press Permit settings', 'pp'), 'pp_unfiltered' => __('Press Permit does not apply any supplemental roles or exceptions to limit or expand viewing or editing access', 'pp'), 'pp_administer_content' => __('PP implicitly grants capabilities for all post types and statuses, but does not apply exceptions', 'pp'), 'pp_create_groups' => __('Can create Permission Groups', 'pp'), 'pp_edit_groups' => __('Can edit all Permission Groups (barring Exceptions)', 'pp'), 'pp_delete_groups' => __('Can delete Permission Groups', 'pp'), 'pp_manage_members' => __('If group editing is allowed, can also modify group membership', 'pp'), 'pp_assign_roles' => __('Assign supplemental Roles or Exceptions. Other capabilities may also be required.', 'pp'), 'pp_set_read_exceptions' => __('Set Reading Exceptions for editable posts on Edit Post/Term screen (for non-Administrators lacking edit_users capability; may be disabled by PP option)', 'pp'));
            if (!defined('PPCE_VERSION') && !pp_key_active()) {
                if (class_exists('Fork')) {
                    $pp_caps['pp_set_fork_exceptions'] = __('(PP Pro capability)', 'pp');
                }
                if (defined('RVY_VERSION')) {
                    $pp_caps['pp_set_revise_exceptions'] = __('(PP Pro capability)', 'pp');
                }
                $pp_caps = array_merge($pp_caps, array('pp_set_edit_exceptions' => __('(PP Pro capability)', 'pp'), 'pp_set_associate_exceptions' => __('(PP Pro capability)', 'pp'), 'pp_set_term_assign_exceptions' => __('(PP Pro capability)', 'pp'), 'pp_set_term_manage_exceptions' => __('(PP Pro capability)', 'pp'), 'pp_set_term_associate_exceptions' => __('(PP Pro capability)', 'pp'), 'list_others_unattached_files' => __('(PP Pro capability)', 'pp'), 'edit_own_attachments' => __('(PP Pro capability)', 'pp')));
            }
            if (!defined('PPS_VERSION') && !pp_key_active()) {
                $pp_caps = array_merge($pp_caps, array('pp_define_post_status' => __('(PP Pro capability)', 'pp'), 'pp_define_moderation' => __('(PP Pro capability)', 'pp'), 'pp_define_privacy' => __('(PP Pro capability)', 'pp'), 'set_posts_status' => __('(PP Pro capability)', 'pp'), 'pp_moderate_any' => __('(PP Pro capability)', 'pp')));
            }
            $pp_caps = apply_filters('pp_cap_descriptions', $pp_caps);
            foreach ($pp_caps as $cap_name => $descript) {
                ?>
				<tr>
				<td class="cap-name"><?php 
                echo $cap_name;
                ?>
</td>
				<td><?php 
                echo $descript;
                ?>
</td>
				</tr>
				<?php 
            }
            ?>
				</tbody>
				</table>

	
				</td></tr>
			<?php 
            $section = 'misc';
            // --- MISC SECTION ---
            if (!empty($ui->form_options[$tab][$section])) {
                ?>
				<tr><th scope="row"><?php 
                echo $ui->section_captions[$tab][$section];
                ?>
</th><td>
				<?php 
                $hint = __('Display a role dropdown alongside the user search input box to narrow results.', 'pp');
                $ui->option_checkbox('user_search_by_role', $tab, $section, $hint);
                $hint = __('Display additional descriptions in role assignment and options UI.', 'pp');
                $ui->option_checkbox('display_hints', $tab, $section, $hint);
                $hint = __('Display descriptive captions for additional functionality provided by missing or deactivated extension plugins (Press Permit Pro package).', 'pp');
                $ui->option_checkbox('display_extension_hints', $tab, $section, $hint);
                ?>
				</td></tr>
			<?php 
            }
            // any options accessable in this section
            $section = 'role_integration';
            // --- ROLE INTEGRATION SECTION ---
            if (!empty($ui->form_options[$tab][$section])) {
                ?>
				<tr><th scope="row"><?php 
                echo $ui->section_captions[$tab][$section];
                ?>
</th><td>
				<?php 
                $hint = __('Detect user roles which are appended dynamically but not stored to the WP database. May be useful for sites that sync with Active Directory or other external user registration systems.', 'pp');
                $args = defined('PP_FORCE_DYNAMIC_ROLES') ? array('val' => 1, 'no_storage' => true, 'disabled' => true) : array();
                $ui->option_checkbox('dynamic_wp_roles', $tab, $section, $hint, '', $args);
                ?>
				</td></tr>
			<?php 
            }
            // any options accessable in this section
        }
        // endif advanced options enabled
        if (PP_MULTISITE) {
            $section = 'network';
            ?>
			<tr><th scope="row"><?php 
            echo $ui->section_captions[$tab][$section];
            ?>
</th><td>

			<div id="pp_modify_default_settings" style="max-width:700px">
			<?php 
            _e('To modify one or more default settings network-wide, <strong>copy</strong> the following code into your theme&apos;s <strong>functions.php</strong> file (or some other file which is always executed and not auto-updated) and modify as desired:', 'pp');
            ?>
			<textarea rows='10' cols='150' readonly='readonly' style="margin-top:5px">
// Use this filter if you want to change the default, but still allow manual setting
add_filter( 'pp_default_options', 'my_pp_default_options', 99 );

function my_pp_default_options( $def_options ) {
	// Array key corresponds to name attributes of checkboxes, dropdowns and input boxes. Modify for desired default settings.

	$def_options['new_user_groups_ui'] = 0;
	
	return $def_options;
}
			</textarea>
			</div>
			<br />
			
			<div id="pp_force_settings" style="max-width:700px">
			<?php 
            _e('To force the value of one or more settings network-wide, <strong>copy</strong> the following code into your theme&apos;s <strong>functions.php</strong> file (or some other file which is always executed and not auto-updated) and modify as desired:', 'pp');
            ?>
			<textarea rows='13' cols='150' readonly='readonly' style="margin-top:5px">
// Use this filter if you want to force an option, blocking/disregarding manual setting
add_filter( 'pp_options', 'my_pp_options', 99 );

// Use this filter if you also want to hide an option from the PP settings screen (works for most options)
add_filter( 'pp_hide_options', 'my_pp_options', 99 );

function my_pp_options( $options ) {
	// Array key corresponds to pp_prefixed name attributes of checkboxes, dropdowns and input boxes. Modify for desired settings.

	$options['pp_new_user_groups_ui'] = 1;
	$options['pp_display_hints'] = 0;	// note: advanced options can be forced here even if advanced settings are disabled
	
	return $options;
}
			</textarea>
			</div>
			
			</td></tr>
		<?php 
        }
        // endif multisite
    }