Пример #1
0
/**
 * Output the BuddyPress maintenance mode
 *
 * @since BuddyPress (1.6)
 * @deprecated BuddyPress (1.7)
 * @uses bp_get_maintenance_mode() To get the BuddyPress maintenance mode
 */
function bp_maintenance_mode()
{
    echo bp_get_maintenance_mode();
}
Пример #2
0
    function step_finish()
    {
        // What type of action is happening here?
        $type = bp_get_maintenance_mode() == 'install' ? __('setup', 'buddypress') : __('update', 'buddypress');
        ?>

		<p><?php 
        printf(__("The BuddyPress %1\$s is complete, and your site is ready to go!", 'buddypress'), $type);
        ?>
</p>

		<div class="submit clear">
			<input type="hidden" name="save" value="finish" />
			<input type="hidden" name="step" value="<?php 
        echo esc_attr($this->current_step());
        ?>
" />

			<?php 
        wp_nonce_field('bpwizard_finish');
        ?>

		</div>

	<?php 
    }
Пример #3
0
        /**
         * Add any admin notices we might need, mostly for update or new installs
         *
         * @since BuddyPress (1.6)
         *
         * @global string $pagenow
         * @return If no notice is needed
         */
        public function admin_notices()
        {
            global $pagenow;
            // Bail if not in maintenance mode
            if (!bp_get_maintenance_mode()) {
                return;
            }
            // Bail if user cannot manage options
            if (!current_user_can('manage_options')) {
                return;
            }
            // Are we looking at a network?
            if (bp_core_do_network_admin()) {
                // Bail if looking at wizard page
                if ('admin.php' == $pagenow && (!empty($_GET['page']) && 'bp-wizard' == $_GET['page'])) {
                    return;
                }
                // Set the url for the nag
                $url = network_admin_url('admin.php?page=bp-wizard');
                // Single site
            } else {
                // Bail if looking at wizard page
                if ('index.php' == $pagenow && (!empty($_GET['page']) && 'bp-wizard' == $_GET['page'])) {
                    return;
                }
                // Set the url for the nag
                $url = admin_url('index.php?page=bp-wizard');
            }
            // What does the nag say?
            switch (bp_get_maintenance_mode()) {
                // Update text
                case 'update':
                    $msg = sprintf(__('BuddyPress has been updated! Please run the <a href="%s">update wizard</a>.', 'buddypress'), $url);
                    break;
                    // First install text
                // First install text
                case 'install':
                default:
                    $msg = sprintf(__('BuddyPress was successfully activated! Please run the <a href="%s">installation wizard</a>.', 'buddypress'), $url);
                    break;
            }
            ?>

		<div class="update-nag"><?php 
            echo $msg;
            ?>
</div>

		<?php 
        }
Пример #4
0
/**
 * Creates reusable markup for component setup on the Components and Pages dashboard panel.
 *
 * This markup has been abstracted so that it can be used both during the setup wizard as well as
 * when BP has been fully installed.
 *
 * @package BuddyPress
 * @since BuddyPress (1.6)
 * @todo Use settings API
 */
function bp_core_admin_components_options()
{
    // Load core functions, if needed
    if (!function_exists('bp_get_option')) {
        require BP_PLUGIN_DIR . '/bp-core/bp-core-functions.php';
    }
    // Declare local variables
    $deactivated_components = array();
    $required_components = array();
    $active_components = apply_filters('bp_active_components', bp_get_option('bp-active-components'));
    // Optional core components
    $optional_components = array('xprofile' => array('title' => __('Extended Profiles', 'buddypress'), 'description' => __('Customize your community with fully editable profile fields that allow your users to describe themselves.', 'buddypress')), 'settings' => array('title' => __('Account Settings', 'buddypress'), 'description' => __('Allow your users to modify their account and notification settings directly from within their profiles.', 'buddypress')), 'friends' => array('title' => __('Friend Connections', 'buddypress'), 'description' => __('Let your users make connections so they can track the activity of others and focus on the people they care about the most.', 'buddypress')), 'messages' => array('title' => __('Private Messaging', 'buddypress'), 'description' => __('Allow your users to talk to each other directly and in private. Not just limited to one-on-one discussions, messages can be sent between any number of members.', 'buddypress')), 'activity' => array('title' => __('Activity Streams', 'buddypress'), 'description' => __('Global, personal, and group activity streams with threaded commenting, direct posting, favoriting and @mentions, all with full RSS feed and email notification support.', 'buddypress')), 'groups' => array('title' => __('User Groups', 'buddypress'), 'description' => __('Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.', 'buddypress')), 'forums' => array('title' => __('Discussion Forums', 'buddypress'), 'description' => __('Site-wide and Group forums allow for focused, bulletin-board style conversations. Powered by bbPress.', 'buddypress')), 'blogs' => array('title' => __('Site Tracking', 'buddypress'), 'description' => __('Record activity for new posts and comments from your site.', 'buddypress')));
    // Add blogs tracking if multisite
    if (is_multisite()) {
        $optional_components['blogs']['description'] = __('Record activity for new sites, posts, and comments across your network.', 'buddypress');
    }
    // Required components
    $required_components = array('core' => array('title' => __('BuddyPress Core', 'buddypress'), 'description' => __('It&#8216;s what makes <del>time travel</del> BuddyPress possible!', 'buddypress')), 'members' => array('title' => __('Community Members', 'buddypress'), 'description' => __('Everything in a BuddyPress community revolves around its members.', 'buddypress')));
    // Merge optional and required together
    $all_components = $optional_components + $required_components;
    // If this is an upgrade from before BuddyPress 1.5, we'll have to convert
    // deactivated components into activated ones.
    if (empty($active_components)) {
        $deactivated_components = bp_get_option('bp-deactivated-components');
        if (!empty($deactivated_components)) {
            // Trim off namespace and filename
            $trimmed = array();
            foreach ((array) $deactivated_components as $component => $value) {
                $trimmed[] = str_replace('.php', '', str_replace('bp-', '', $component));
            }
            // Loop through the optional components to create an active component array
            foreach ((array) $optional_components as $ocomponent => $ovalue) {
                if (!in_array($ocomponent, $trimmed)) {
                    $active_components[$ocomponent] = 1;
                }
            }
        }
    }
    // On new install, set all components to be active by default
    if (empty($active_components) && bp_get_maintenance_mode() == 'install') {
        $active_components = $optional_components;
    }
    // Core component is always active
    $active_components['core'] = $all_components['core'];
    $inactive_components = array_diff(array_keys($all_components), array_keys($active_components));
    /** Display ***************************************************************/
    // Get the total count of all plugins
    $all_count = count($all_components);
    $page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
    $action = !empty($_GET['action']) ? $_GET['action'] : 'all';
    switch ($action) {
        case 'all':
            $current_components = $all_components;
            break;
        case 'active':
            foreach (array_keys($active_components) as $component) {
                $current_components[$component] = $all_components[$component];
            }
            break;
        case 'inactive':
            foreach ($inactive_components as $component) {
                $current_components[$component] = $all_components[$component];
            }
            break;
        case 'mustuse':
            $current_components = $required_components;
            break;
    }
    // The setup wizard uses different, more descriptive text
    if (bp_get_maintenance_mode()) {
        ?>

		<h3><?php 
        _e('Available Components', 'buddypress');
        ?>
</h3>

		<p><?php 
        _e('Each component has a unique purpose, and your community may not need each one.', 'buddypress');
        ?>
</p>

	<?php 
    }
    ?>
		
		<ul class="subsubsub">
			<li><a href="<?php 
    echo add_query_arg(array('page' => 'bp-components', 'action' => 'all'), bp_get_admin_url($page));
    ?>
" <?php 
    if ($action === 'all') {
        ?>
class="current"<?php 
    }
    ?>
><?php 
    printf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $all_count, 'plugins', 'buddypress'), number_format_i18n($all_count));
    ?>
</a> | </li>
			<li><a href="<?php 
    echo add_query_arg(array('page' => 'bp-components', 'action' => 'active'), bp_get_admin_url($page));
    ?>
" <?php 
    if ($action === 'active') {
        ?>
class="current"<?php 
    }
    ?>
><?php 
    printf(_n('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', count($active_components), 'buddypress'), number_format_i18n(count($active_components)));
    ?>
</a> | </li>
			<li><a href="<?php 
    echo add_query_arg(array('page' => 'bp-components', 'action' => 'inactive'), bp_get_admin_url($page));
    ?>
" <?php 
    if ($action === 'inactive') {
        ?>
class="current"<?php 
    }
    ?>
><?php 
    printf(_n('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', count($inactive_components), 'buddypress'), number_format_i18n(count($inactive_components)));
    ?>
</a> | </li>
			<li><a href="<?php 
    echo add_query_arg(array('page' => 'bp-components', 'action' => 'mustuse'), bp_get_admin_url($page));
    ?>
" <?php 
    if ($action === 'mustuse') {
        ?>
class="current"<?php 
    }
    ?>
><?php 
    printf(_n('Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', count($required_components), 'buddypress'), number_format_i18n(count($required_components)));
    ?>
</a></li>
		</ul>

		<table class="widefat fixed plugins" cellspacing="0">
			<thead>
				<tr>
					<th scope="col" id="cb" class="manage-column column-cb check-column">&nbsp;</th>
					<th scope="col" id="name" class="manage-column column-name" style="width: 190px;"><?php 
    _e('Component', 'buddypress');
    ?>
</th>
					<th scope="col" id="description" class="manage-column column-description"><?php 
    _e('Description', 'buddypress');
    ?>
</th>
				</tr>
			</thead>

			<tfoot>
				<tr>
					<th scope="col" class="manage-column column-cb check-column">&nbsp;</th>
					<th scope="col" class="manage-column column-name" style="width: 190px;"><?php 
    _e('Component', 'buddypress');
    ?>
</th>
					<th scope="col" class="manage-column column-description"><?php 
    _e('Description', 'buddypress');
    ?>
</th>
				</tr>
			</tfoot>

			<tbody id="the-list">
				
				<?php 
    if (!empty($current_components)) {
        ?>

					<?php 
        foreach ($current_components as $name => $labels) {
            ?>

						<?php 
            if (!in_array($name, array('core', 'members'))) {
                $class = isset($active_components[esc_attr($name)]) ? 'active' : 'inactive';
            } else {
                $class = 'active';
            }
            ?>

						<tr id="<?php 
            echo $name;
            ?>
" class="<?php 
            echo $name . ' ' . $class;
            ?>
">
							<th scope="row">

								<?php 
            if (!in_array($name, array('core', 'members'))) {
                ?>

									<input type="checkbox" id="bp_components[<?php 
                echo esc_attr($name);
                ?>
]" name="bp_components[<?php 
                echo esc_attr($name);
                ?>
]" value="1"<?php 
                checked(isset($active_components[esc_attr($name)]));
                ?>
 />

								<?php 
            }
            ?>

								<label class="screen-reader-text" for="bp_components[<?php 
            echo esc_attr($name);
            ?>
]"><?php 
            sprintf(__('Select %s', 'buddypress'), esc_html($labels['title']));
            ?>
</label>
							</th>
							<td class="plugin-title" style="width: 190px;">
								<span></span>
								<strong><?php 
            echo esc_html($labels['title']);
            ?>
</strong>
								<div class="row-actions-visible">
									
								</div>
							</td>

							<td class="column-description desc">
								<div class="plugin-description">
									<p><?php 
            echo $labels['description'];
            ?>
</p>
								</div>
								<div class="active second plugin-version-author-uri">
									
								</div>
							</td>
						</tr>

					<?php 
        }
        ?>

				<?php 
    } else {
        ?>
						
					<tr class="no-items">
						<td class="colspanchange" colspan="3"><?php 
        _e('No components found.', 'buddypress');
        ?>
</td>
					</tr>

				<?php 
    }
    ?>

			</tbody>
		</table>

	<input type="hidden" name="bp_components[members]" value="1" />

	<?php 
}