function prepare_items()
 {
     global $ct;
     $ct = current_theme_info();
     $themes = get_allowed_themes();
     if (!empty($_REQUEST['s'])) {
         $search = strtolower(stripslashes($_REQUEST['s']));
         $this->search = array_merge($this->search, array_filter(array_map('trim', explode(',', $search))));
         $this->search = array_unique($this->search);
     }
     if (!empty($_REQUEST['features'])) {
         $this->features = $_REQUEST['features'];
         $this->features = array_map('trim', $this->features);
         $this->features = array_map('sanitize_title_with_dashes', $this->features);
         $this->features = array_unique($this->features);
     }
     if ($this->search || $this->features) {
         foreach ($themes as $key => $theme) {
             if (!$this->search_theme($theme)) {
                 unset($themes[$key]);
             }
         }
     }
     unset($themes[$ct->name]);
     uksort($themes, "strnatcasecmp");
     $per_page = 24;
     $page = $this->get_pagenum();
     $start = ($page - 1) * $per_page;
     $this->items = array_slice($themes, $start, $per_page);
     $this->set_pagination_args(array('total_items' => count($themes), 'per_page' => $per_page));
 }
示例#2
0
 /**
  * Load all themes information into local properties
  * 
  * @todo only list themes which implement the scheme
  */
 protected function load_theme_data()
 {
     ICE_Loader::load_wpadmin_lib('ms');
     ICE_Loader::load_wpadmin_lib('theme');
     // get current theme
     $ct = current_theme_info();
     // get all themes
     $this->__wp_themes__ = get_allowed_themes();
     // extract current theme
     $this->__wp_theme__ = $this->__wp_themes__[$ct->name];
 }
示例#3
0
function wp_united_display_theme_menu()
{
    global $user_ID, $title, $parent_file, $wp_version;
    $wpuConnSettings = get_settings('wputd_connection');
    if (!validate_current_theme()) {
        ?>
	<div id="message1" class="updated fade"><p><?php 
        _e('The active theme is broken.  Reverting to the default theme.');
        ?>
</p></div>
	<?php 
    } elseif (isset($_GET['activated'])) {
        ?>
	<div id="message2" class="updated fade"><p><?php 
        printf(__('New theme activated. <a href="%s">View your blog &raquo;</a>'), wpu_homelink('wpu-activate-theme') . '/');
        ?>
</p></div>
	<?php 
    }
    $themes = get_themes();
    $theme_names = array_keys($themes);
    $user_theme = 'WordPress Default';
    $user_template = get_usermeta($user_ID, 'WPU_MyTemplate');
    $user_stylesheet = get_usermeta($user_ID, 'WPU_MyStylesheet');
    $site_theme = current_theme_info();
    $user_theme = $site_theme->title;
    // if user hasn't set a theme yet, it is the same as site default
    // get current user theme
    if ($themes) {
        foreach ($theme_names as $theme_name) {
            if ($themes[$theme_name]['Stylesheet'] == $user_stylesheet && $themes[$theme_name]['Template'] == $user_template) {
                $user_theme = $themes[$theme_name]['Name'];
                break;
            }
        }
    }
    $template = $themes[$user_theme]['Template'];
    $stylesheet = $themes[$user_theme]['Stylesheet'];
    $title = $themes[$user_theme]['Title'];
    $version = $themes[$user_theme]['Version'];
    $description = $themes[$user_theme]['Description'];
    $author = $themes[$user_theme]['Author'];
    $screenshot = $themes[$user_theme]['Screenshot'];
    $stylesheet_dir = $themes[$user_theme]['Stylesheet Dir'];
    $tags = $themes[$user_theme]['Tags'];
    if ($wp_version > 2.5) {
        // paginate if necessary
        ksort($themes);
        $theme_total = count($themes);
        $per_page = 15;
        if (isset($_GET['pagenum'])) {
            $page = absint($_GET['pagenum']);
        }
        if (empty($page)) {
            $page = 1;
        }
        $start = $offset = ($page - 1) * $per_page;
        $page_links = paginate_links(array('base' => add_query_arg('pagenum', '%#%') . '#themenav', 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => ceil($theme_total / $per_page), 'current' => $page));
        $themes = array_slice($themes, $start, $per_page);
        $pageTitle = __('Set Your Blog Theme');
        $parent_file = 'wpu-plugin.php&wputab=themes';
        ?>
		
		<div class="wrap">
			<?php 
        screen_icon();
        ?>
			<h2><?php 
        echo wp_specialchars($pageTitle);
        ?>
</h2>
		<?php 
        /* CURRENT THEME */
        ?>
			<h3><?php 
        _e('Current Theme');
        ?>
</h3>
			<div id="current-theme">
				<?php 
        if ($screenshot) {
            ?>
				<img src="<?php 
            echo WP_CONTENT_URL . $stylesheet_dir . '/' . $screenshot;
            ?>
" alt="<?php 
            _e('Current theme preview');
            ?>
" />
				<?php 
        }
        ?>
				<h4><?php 
        printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $title, $version, $author);
        ?>
</h4>
				<p class="description"><?php 
        echo $description;
        ?>
</p>
				<?php 
        if ($tags) {
            ?>
					<p><?php 
            _e('Tags:');
            ?>
 <?php 
            echo join(', ', $tags);
            ?>
</p>
				<?php 
        }
        ?>
			</div>
			
			<div class="clear"></div>
			<h3><?php 
        _e('Available Themes');
        ?>
</h3>
			<div class="clear"></div>
			
			<?php 
        /* PAGINATION */
        ?>
			<?php 
        if ($page_links) {
            ?>
			<div class="tablenav">
			<div class="tablenav-pages"><?php 
            $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n($start + 1), number_format_i18n(min($page * $per_page, $theme_total)), number_format_i18n($theme_total), $page_links);
            echo $page_links_text;
            ?>
</div>
			</div>
			<?php 
        }
        ?>
		
		
			<?php 
        /* OTHER THEMES */
        ?>
			
			<?php 
        if (1 < $theme_total) {
            ?>
			<table id="availablethemes" cellspacing="0" cellpadding="0">
			<?php 
            $style = '';
            $theme_names = array_keys($themes);
            natcasesort($theme_names);
            $rows = ceil(count($theme_names) / 3);
            for ($row = 1; $row <= $rows; $row++) {
                for ($col = 1; $col <= 3; $col++) {
                    $table[$row][$col] = array_shift($theme_names);
                }
            }
            foreach ($table as $row => $cols) {
                ?>
			<tr>
			<?php 
                foreach ($cols as $col => $theme_name) {
                    if ($theme_name != $user_theme) {
                        $class = array('available-theme');
                        if ($row == 1) {
                            $class[] = 'top';
                        }
                        if ($col == 1) {
                            $class[] = 'left';
                        }
                        if ($row == $rows) {
                            $class[] = 'bottom';
                        }
                        if ($col == 3) {
                            $class[] = 'right';
                        }
                        ?>
					<td class="<?php 
                        echo join(' ', $class);
                        ?>
">
					<?php 
                        if (!empty($theme_name)) {
                            $template = $themes[$theme_name]['Template'];
                            $stylesheet = $themes[$theme_name]['Stylesheet'];
                            $title = $themes[$theme_name]['Title'];
                            $version = $themes[$theme_name]['Version'];
                            $description = $themes[$theme_name]['Description'];
                            $author = $themes[$theme_name]['Author'];
                            $screenshot = $themes[$theme_name]['Screenshot'];
                            $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
                            $preview_link = clean_url(get_option('home') . '/');
                            $preview_link = htmlspecialchars(add_query_arg(array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400), $preview_link));
                            $preview_text = attribute_escape(sprintf(__('Preview of "%s"'), $title));
                            $tags = $themes[$theme_name]['Tags'];
                            $thickbox_class = 'thickbox';
                            $activate_link = wp_nonce_url('admin.php?page=wpu-plugin.php&amp;wputab=themes&amp;noheader=true&amp;wpu_action=activate&amp;template=' . $template . '&amp;stylesheet=' . $stylesheet, 'wp-united-switch-theme_' . $template);
                            $activate_text = attribute_escape(sprintf(__('Activate "%s"'), $title));
                            ?>
						<?php 
                            if ($screenshot) {
                                ?>
							<a href="<?php 
                                echo $preview_link;
                                ?>
" title="<?php 
                                echo $preview_text;
                                ?>
" class="<?php 
                                echo $thickbox_class;
                                ?>
 screenshot">
								<img src="<?php 
                                echo WP_CONTENT_URL . $stylesheet_dir . '/' . $screenshot;
                                ?>
" alt="" />
							</a>
						<?php 
                            }
                            ?>
						<h3><a class="<?php 
                            echo $thickbox_class;
                            ?>
" href="<?php 
                            echo $activate_link;
                            ?>
"><?php 
                            echo $title;
                            ?>
</a></h3>
						<p><?php 
                            echo $description;
                            ?>
</p>
						<?php 
                            if ($tags) {
                                ?>
							<p><?php 
                                _e('Tags:');
                                ?>
 <?php 
                                echo join(', ', $tags);
                                ?>
</p>
						<?php 
                            }
                            ?>
						<span class="action-links"><a href="<?php 
                            echo $preview_link;
                            ?>
" class="<?php 
                            echo $thickbox_class;
                            ?>
" title="<?php 
                            echo $preview_text;
                            ?>
"><?php 
                            _e('Preview');
                            ?>
</a> <a href="<?php 
                            echo $activate_link;
                            ?>
" title="<?php 
                            echo $activate_text;
                            ?>
"><?php 
                            _e('Activate');
                            ?>
</a></span>
	
					<?php 
                        }
                    }
                    ?>
				</td>
			<?php 
                }
                // end foreach $cols
                ?>
			</tr>
			<?php 
            }
            // end foreach $table
            ?>
			</table>
		<?php 
        }
        ?>

		<br class="clear" />

		<?php 
        if ($page_links) {
            ?>
			<div class="tablenav">
			<?php 
            echo "<div class='tablenav-pages'>{$page_links_text}</div>";
            ?>
			<br class="clear" />
			</div>
		<?php 
        }
        ?>
		<br class="clear" />
	</div>
			
			
<?php 
    } else {
        // old WordPress (temporary -- to remove in WP-United v0.8)
        ?>
		<div class="wrap">
		<h2><?php 
        _e('Your Current Theme');
        ?>
</h2>
		<div id="currenttheme" style="margin-bottom: 190px;" >
		<?php 
        if ($screenshot) {
            ?>
		<img src="<?php 
            echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot;
            ?>
" alt="<?php 
            _e('Current theme preview');
            ?>
" />
		<?php 
        }
        ?>
		<h3><?php 
        printf(__('%1$s %2$s by %3$s'), $title, $version, $author);
        ?>
</h3>
		<p><?php 
        echo $description;
        ?>
</p>

		</div>

		<h2><?php 
        _e('Available Themes');
        ?>
</h2>
		<?php 
        if (1 < count($themes)) {
            ?>

		<?php 
            $style = '';
            $theme_names = array_keys($themes);
            natcasesort($theme_names);
            foreach ($theme_names as $theme_name) {
                if ($theme_name == $user_theme) {
                    continue;
                }
                $template = $themes[$theme_name]['Template'];
                $stylesheet = $themes[$theme_name]['Stylesheet'];
                $title = $themes[$theme_name]['Title'];
                $version = $themes[$theme_name]['Version'];
                $description = $themes[$theme_name]['Description'];
                $author = $themes[$theme_name]['Author'];
                $screenshot = $themes[$theme_name]['Screenshot'];
                $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
                $activate_link = wp_nonce_url('admin.php?page=' . $wpuConnSettings['full_path_to_plugin'] . '&amp;noheader=true&amp;wpu_action=activate&amp;template=' . $template . '&amp;stylesheet=' . $stylesheet, 'wp-united-switch-theme_' . $template);
                ?>
		<div class="available-theme">
		<h3><a href="<?php 
                echo $activate_link;
                ?>
"><?php 
                echo "{$title} {$version}";
                ?>
</a></h3>

		<a href="<?php 
                echo $activate_link;
                ?>
" class="screenshot">
		<?php 
                if ($screenshot) {
                    ?>
		<img src="<?php 
                    echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot;
                    ?>
" alt="" />
		<?php 
                }
                ?>
		</a>

		<p><?php 
                echo $description;
                ?>
</p>
		</div>
		<?php 
            }
            // end foreach theme_names
            ?>

		<?php 
        }
        ?>

	

		<h2><?php 
        _e('Want More Themes?');
        ?>
</h2>
		<p><?php 
        _e('If you have found another WordPress theme that you would like to use, please inform an administrator.');
        ?>
</p>

		</div>
	<?php 
    }
}
示例#4
0
文件: themes.php 项目: alx/blogsfera
<?php

require_once 'admin.php';
$themes = get_themes();
$ct = current_theme_info();
$allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes());
if ($allowed_themes == false) {
    $allowed_themes = array();
}
$blog_allowed_themes = wpmu_get_blog_allowedthemes();
if (is_array($blog_allowed_themes)) {
    $allowed_themes = array_merge($allowed_themes, $blog_allowed_themes);
}
if ($blog_id != 1) {
    unset($allowed_themes["h3"]);
}
if (isset($allowed_themes[wp_specialchars($ct->stylesheet)]) == false) {
    $allowed_themes[wp_specialchars($ct->stylesheet)] = true;
}
reset($themes);
foreach ($themes as $key => $theme) {
    if (isset($allowed_themes[wp_specialchars($theme['Stylesheet'])]) == false) {
        unset($themes[$key]);
    }
}
reset($themes);
if (isset($_GET['action'])) {
    check_admin_referer('switch-theme_' . $_GET['template']);
    if ('activate' == $_GET['action']) {
        switch_theme($_GET['template'], $_GET['stylesheet']);
        wp_redirect('themes.php?activated=true');
function wp_dashboard_right_now() {
	$num_posts = wp_count_posts( 'post' );
	$num_pages = wp_count_posts( 'page' );

	$num_cats  = wp_count_terms('category');

	$num_tags = wp_count_terms('post_tag');

	$num_comm = wp_count_comments( );

	echo "\n\t".'<p class="sub">' . __('At a Glance') . '</p>';
	echo "\n\t".'<div class="table">'."\n\t".'<table>';
	echo "\n\t".'<tr class="first">';

	// Posts
	$num = number_format_i18n( $num_posts->publish );
	if ( current_user_can( 'edit_posts' ) )
		$text = "<a href='edit.php'>$num</a>";
	else
		$text = $num;
	echo '<td class="first b b-posts">' . $text . '</td>';
	echo '<td class="t posts">' . __ngettext( 'Post', 'Posts', intval($num_posts->publish) ) . '</td>';
	/* TODO: Show status breakdown on hover
	if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
		$post_type_texts[] = '<a href="edit-pages.php">'.sprintf( __ngettext( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
	}
	if ( $can_edit_posts && !empty($num_posts->draft) ) {
		$post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( __ngettext( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
	}
	if ( $can_edit_posts && !empty($num_posts->future) ) {
		$post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( __ngettext( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
	}
	if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
		$pending_text = sprintf( __ngettext( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
	} else {
		$pending_text = '';
	}
	*/

	// Total Comments
	$num = number_format_i18n($num_comm->total_comments);
	if ( current_user_can( 'moderate_comments' ) )
		$num = "<a href='edit-comments.php'>$num</a>";
	echo '<td class="b b-comments">'.$num.'</td>';
	echo '<td class="last t comments">' . __ngettext( 'Comment', 'Comments', $num_comm->total_comments ) . '</td>';

	echo '</tr><tr>';

	// Pages
	$num = number_format_i18n( $num_pages->publish );
	if ( current_user_can( 'edit_pages' ) )
		$num = "<a href='edit-pages.php'>$num</a>";
	echo '<td class="first b b_pages">'.$num.'</td>';
	echo '<td class="t pages">' . __ngettext( 'Page', 'Pages', $num_pages->publish ) . '</td>';

	// Approved Comments
	$num = number_format_i18n($num_comm->approved);
	if ( current_user_can( 'moderate_comments' ) )
		$num = "<a href='edit-comments.php?comment_status=approved'>$num</a>";
	echo '<td class="b b_approved">'.$num.'</td>';
	echo '<td class="last t approved">' . __ngettext( 'Approved', 'Approved', $num_comm->approved ) . '</td>';

	echo "</tr>\n\t<tr>";

	// Categories
	$num = number_format_i18n( $num_cats );
	if ( current_user_can( 'manage_categories' ) )
		$num = "<a href='categories.php'>$num</a>";
	echo '<td class="first b b-cats">'.$num.'</td>';
	echo '<td class="t cats">' . __ngettext( 'Category', 'Categories', $num_cats ) . '</td>';

	// Pending Comments
	$num = number_format_i18n($num_comm->moderated);
	if ( current_user_can( 'moderate_comments' ) )
		$num = "<a href='edit-comments.php?comment_status=moderated'><span class='pending-count'>$num</span></a>";
	echo '<td class="b b-waiting">'.$num.'</td>';
	echo '<td class="last t waiting">' . __ngettext( 'Pending', 'Pending', $num_comm->moderated ) . '</td>';

	echo "</tr>\n\t<tr>";

	// Tags
	$num = number_format_i18n( $num_tags );
	if ( current_user_can( 'manage_categories' ) )
		$num = "<a href='edit-tags.php'>$num</a>";
	echo '<td class="first b b-tags">'.$num.'</td>';
	echo '<td class="t tags">' . __ngettext( 'Tag', 'Tags', $num_tags ) . '</td>';

	// Spam Comments
	$num = number_format_i18n($num_comm->spam);
	if ( current_user_can( 'moderate_comments' ) )
		$num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>$num</span></a>";
	echo '<td class="b b-spam">'.$num.'</td>';
	echo '<td class="last t spam">' . __ngettext( 'Spam', 'Spam', $num_comm->spam ) . '</td>';

	echo "</tr>";
	do_action('right_now_table_end');
	echo "\n\t</table>\n\t</div>";

	echo "\n\t".'<div class="versions">';
	$ct = current_theme_info();
	$sidebars_widgets = wp_get_sidebars_widgets();
	$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
	$num = number_format_i18n( $num_widgets );

	echo "\n\t<p>";
	if ( current_user_can( 'switch_themes' ) ) {
		echo '<a href="themes.php" class="button rbutton">' . __('Change Theme') . '</a>';
		printf(__ngettext('Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b"><a href="themes.php">%1$s</a></span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $ct->title, $num);
	} else {
		printf(__ngettext('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $ct->title, $num);
	}

	echo '</p>';

	update_right_now_message();

	echo "\n\t".'</div>';
	do_action( 'rightnow_end' );
	do_action( 'activity_box_end' );
}
function csp_po_collect_by_type($type){
	$res = array();
	if (empty($type) || ($type == 'wordpress')) {
		$res[] = csp_po_get_wordpress_capabilities();
	}
	if (empty($type) || ($type == 'plugins')) {
		//WARNING: Plugin handling is not well coded by WordPress core
		$err = error_reporting(0);
		$plugs = get_plugins(); 
		error_reporting($err);
		$textdomains = array();
		foreach($plugs as $key => $value) { 
			$data = csp_po_get_plugin_capabilities($key, $value);
			if (!$data['gettext_ready']) continue;
			if (in_array($data['textdomain'], $textdomains)) {
				for ($i=0; $i<count($res); $i++) {
					if ($data['textdomain'] == $res[$i]['textdomain']) {
						$res[$i]['child-plugins'][] = $data;
						break;
					}
				}
			}
			else{
				array_push($textdomains, $data['textdomain']);
				$res[] = $data;
			}
		}
	}
	if (isset($GLOBALS['wpmu_version'])) {
		if (empty($type) || ($type == 'plugins_mu')) {
			$plugs = array();
			$textdomains = array();
			if( is_dir( WPMU_PLUGIN_DIR ) ) {
				if( $dh = opendir( WPMU_PLUGIN_DIR ) ) {
					while( ( $plugin = readdir( $dh ) ) !== false ) {
						if( substr( $plugin, -4 ) == '.php' ) {
							$plugs[$plugin] = get_plugin_data( WPMU_PLUGIN_DIR . '/' . $plugin );
						}
					}
				}
			}		
			foreach($plugs as $key => $value) { 
				$data = csp_po_get_plugin_mu_capabilities($key, $value);
				if (!$data['gettext_ready']) continue;
				if (in_array($data['textdomain'], $textdomains)) {
					for ($i=0; $i<count($res); $i++) {
						if ($data['textdomain'] == $res[$i]['textdomain']) {
							$res[$i]['child-plugins'][] = $data;
							break;
						}
					}
				}
				else{
					array_push($textdomains, $data['textdomain']);
					$res[] = $data;
				}
			}
		}
	}
	if (empty($type) || ($type == 'themes')) {
		$themes = get_themes();
		//WARNING: Theme handling is not well coded by WordPress core
		$err = error_reporting(0);
		$ct = current_theme_info();
		error_reporting($err);
		foreach($themes as $key => $value) { 
			$data = csp_po_get_theme_capabilities($key, $value, $ct);
			if (!$data['gettext_ready']) continue;
			$res[] = $data;
		}	
	}
	return $res;
}
 public function ms_copy_themes()
 {
     pb_backupbuddy::status('message', 'Copying theme(s) into temporary WordPress installation.');
     if (!function_exists('wp_get_theme')) {
         pb_backupbuddy::status('details', 'wp_get_theme() function not found. Loading `/wp-admin/includes/theme.php`.');
         require_once ABSPATH . 'wp-admin/includes/theme.php';
         pb_backupbuddy::status('details', 'Loaded `/wp-admin/includes/theme.php`.');
     }
     // Use new wp_get_theme() if available.
     if (function_exists('wp_get_theme')) {
         // WordPress v3.4 or newer.
         pb_backupbuddy::status('details', 'wp_get_theme() available. Using it.');
         $current_theme = wp_get_theme();
     } else {
         // WordPress pre-v3.4
         pb_backupbuddy::status('details', 'wp_get_theme() still unavailable (pre WordPress v3.4?). Attempting to use older current_theme_info() fallback.');
         $current_theme = current_theme_info();
     }
     //Step 5 - Copy over themes
     $template_dir = $current_theme->template_dir;
     $stylesheet_dir = $current_theme->stylesheet_dir;
     pb_backupbuddy::status('details', 'Got current theme information.');
     //If $template_dir and $stylesheet_dir don't match, that means we have a child theme and need to copy over the parent also
     $items_to_copy = array();
     $items_to_copy[basename($template_dir)] = $template_dir;
     if ($template_dir != $stylesheet_dir) {
         $items_to_copy[basename($stylesheet_dir)] = $stylesheet_dir;
     }
     pb_backupbuddy::status('details', 'About to begin copying theme files...');
     //Copy the files over
     if (count($items_to_copy) > 0) {
         $wp_dir = $this->_backup['backup_root'];
         $wp_theme_dir = $wp_dir . 'wp-content/themes/';
         foreach ($items_to_copy as $file => $original_destination) {
             if (file_exists($original_destination) && file_exists($wp_theme_dir)) {
                 $result = pb_backupbuddy::$filesystem->recursive_copy($original_destination, $wp_theme_dir . $file);
                 if ($result === false) {
                     pb_backupbuddy::status('error', 'Unable to copy theme from `' . $original_destination . '` to `' . $wp_theme_dir . $file . '`. Verify permissions.');
                     return false;
                 } else {
                     pb_backupbuddy::status('details', 'Copied theme from `' . $original_destination . '` to `' . $wp_theme_dir . $file . '`.');
                 }
             }
             // end if file exists.
         }
         // end foreach $items_to_copy.
     }
     // end if.
     pb_backupbuddy::status('message', 'Copied theme into temporary WordPress installation.');
     return true;
 }
示例#8
0
/**
 * Get the allowed themes for the current blog.
 *
 * @since 3.0.0
 *
 * @uses get_themes()
 * @uses current_theme_info()
 * @uses get_site_allowed_themes()
 * @uses wpmu_get_blog_allowedthemes
 *
 * @return array $themes Array of allowed themes.
 */
function get_allowed_themes()
{
    if (!is_multisite()) {
        return get_themes();
    }
    $themes = get_themes();
    $ct = current_theme_info();
    $allowed_themes = apply_filters("allowed_themes", get_site_allowed_themes());
    if ($allowed_themes == false) {
        $allowed_themes = array();
    }
    $blog_allowed_themes = wpmu_get_blog_allowedthemes();
    if (is_array($blog_allowed_themes)) {
        $allowed_themes = array_merge($allowed_themes, $blog_allowed_themes);
    }
    if (isset($allowed_themes[esc_html($ct->stylesheet)]) == false) {
        $allowed_themes[esc_html($ct->stylesheet)] = true;
    }
    reset($themes);
    foreach ($themes as $key => $theme) {
        if (isset($allowed_themes[esc_html($theme['Stylesheet'])]) == false) {
            unset($themes[$key]);
        }
    }
    reset($themes);
    return $themes;
}
/**
 * Site info box
 *
 * @global nxtdb $nxtdb NXTClass database object
 * @global string $nxt_version NXTClass version number
 * @global nxt_Rewrite $nxt_rewrite NXTClass Rewrite object for creating pretty URLs
 * @global object $nxt_rewrite
 * @param array $settings Site's options 'achievements' meta
 * @since 2.0
 */
function dpa_admin_screen_siteinfo($settings)
{
    global $nxtdb, $nxt_rewrite, $nxt_version;
    $active_plugins = array();
    $all_plugins = apply_filters('all_plugins', get_plugins());
    foreach ($all_plugins as $filename => $plugin) {
        if ('Achievements' != $plugin['Name'] && 'BuddyPress' != $plugin['Name'] && is_plugin_active($filename)) {
            $active_plugins[] = $plugin['Name'] . ': ' . $plugin['Version'];
        }
    }
    natcasesort($active_plugins);
    if (!$active_plugins) {
        $active_plugins[] = __('No other plugins are active', 'dpa');
    }
    if (defined('MULTISITE') && constant('MULTISITE') == true) {
        if (defined('SUBDOMAIN_INSTALL') && constant('SUBDOMAIN_INSTALL') == true) {
            $is_multisite = __('subdomain', 'dpa');
        } else {
            $is_multisite = __('subdirectory', 'dpa');
        }
    } else {
        $is_multisite = __('no', 'dpa');
    }
    if (1 == constant('BP_ROOT_BLOG')) {
        $is_bp_root_blog = __('standard', 'dpa');
    } else {
        $is_bp_root_blog = __('non-standard', 'dpa');
    }
    $is_bp_default_child_theme = __('no', 'dpa');
    $theme = current_theme_info();
    if ('BuddyPress Default' == $theme->parent_theme) {
        $is_bp_default_child_theme = __('yes', 'dpa');
    }
    if ('BuddyPress Default' == $theme->name) {
        $is_bp_default_child_theme = __('n/a', 'dpa');
    }
    if (empty($nxt_rewrite->permalink_structure)) {
        $custom_permalinks = __('default', 'dpa');
    } else {
        if (strpos($nxt_rewrite->permalink_structure, 'index.php')) {
            $custom_permalinks = __('almost', 'dpa');
        } else {
            $custom_permalinks = __('custom', 'dpa');
        }
    }
    ?>
	<p><?php 
    _e("If you're submitting a support request, some information about your NXTClass site really helps us to diagnose the problem.", 'dpa');
    ?>
</p>
	<p><?php 
    _e("It's entirely optional, but if you include the information below in your support request, it really will help. Thank you!", 'dpa');
    ?>
</p>

	<h4><?php 
    _e('Versions', 'dpa');
    ?>
</h4>
	<ul>
		<li><?php 
    printf(__('Achievements: %s', 'dpa'), ACHIEVEMENTS_VERSION);
    ?>
</li>
		<li><?php 
    printf(__('BuddyPress: %s', 'dpa'), BP_VERSION);
    ?>
</li>
		<li><?php 
    printf(__('BP_ROOT_BLOG: %s', 'dpa'), $is_bp_root_blog);
    ?>
</li>
		<li><?php 
    printf(__('MySQL: %s', 'dpa'), $nxtdb->db_version());
    ?>
</li>
		<li><?php 
    printf(__('Permalinks: %s', 'dpa'), $custom_permalinks);
    ?>
</li>
		<li><?php 
    printf(__('PHP: %s', 'dpa'), phpversion());
    ?>
</li>
		<li><?php 
    printf(__('NXTClass: %s', 'dpa'), $nxt_version);
    ?>
</li>
		<li><?php 
    printf(__('NXTClass multisite: %s', 'dpa'), $is_multisite);
    ?>
</li>
	</ul>

	<h4><?php 
    _e('Theme', 'dpa');
    ?>
</h4>
	<ul>
		<li><?php 
    printf(__('BP-Default child theme: %s', 'dpa'), $is_bp_default_child_theme);
    ?>
</li>
		<li><?php 
    printf(__('Current theme: %s', 'dpa'), $theme->name);
    ?>
</li>
	</ul>

	<h4><?php 
    _e('Active Plugins', 'dpa');
    ?>
</h4>
	<ul>
		<?php 
    foreach ($active_plugins as $plugin) {
        ?>
			<li><?php 
        echo $plugin;
        ?>
</li>
		<?php 
    }
    ?>
	</ul>
<?php 
}
示例#10
0
/**
 * Show useful support information. Props to Paul Gibbs for 90% of the code!
 *
 * @copyright Original code Copyright (C) Paul Gibbs
 */
function infinity_dashboard_support_info()
{
    // globals
    global $wpdb, $wp_rewrite, $wp_version;
    // show some useful infinity info
    if (INFINITY_DEV_MODE) {
        $is_developer_mode = __('Enabled', infinity_text_domain);
    } else {
        $is_developer_mode = __('Disabled', infinity_text_domain);
    }
    // get theme info
    $theme = current_theme_info();
    // get plugin info
    $active_plugins = array();
    $all_plugins = apply_filters('all_plugins', get_plugins());
    // what plugins are active?
    foreach ($all_plugins as $filename => $plugin) {
        if ('BuddyPress' != $plugin['Name'] && is_plugin_active($filename)) {
            $active_plugins[] = $plugin['Name'] . ': ' . $plugin['Version'];
        }
    }
    natcasesort($active_plugins);
    if (!$active_plugins) {
        $active_plugins[] = __('No other plugins are active', infinity_text_domain);
    }
    // multisite info
    if (defined('MULTISITE') && MULTISITE == true) {
        if (defined('SUBDOMAIN_INSTALL') && SUBDOMAIN_INSTALL == true) {
            $is_multisite = __('subdomain', infinity_text_domain);
        } else {
            $is_multisite = __('subdirectory', infinity_text_domain);
        }
    } else {
        $is_multisite = __('no', infinity_text_domain);
    }
    // what permalinks are being used?
    if (empty($wp_rewrite->permalink_structure)) {
        $custom_permalinks = __('default', infinity_text_domain);
    } else {
        if (strpos($wp_rewrite->permalink_structure, 'index.php')) {
            $custom_permalinks = __('almost', infinity_text_domain);
        } else {
            $custom_permalinks = __('custom', infinity_text_domain);
        }
    }
    ?>
	<h3><?php 
    _e('Installation Details', infinity_text_domain);
    ?>
</h3>
	<p><?php 
    _e("If you are having issues with the theme and need support, below is some useful info about your installation.", infinity_text_domain);
    ?>
</p>
	<p><?php 
    _e("Please submit this information with your support request so it's easier for us to help you!", infinity_text_domain);
    ?>
</p>

	<h4><?php 
    _e('Versions', infinity_text_domain);
    ?>
</h4>
	<ul>
		<li><?php 
    printf(__('Infinity Version: %s', infinity_text_domain), INFINITY_VERSION);
    ?>
</li>
		<li><?php 
    printf(__('Developer Mode: %s', infinity_text_domain), $is_developer_mode);
    ?>
</li>
		<li><?php 
    printf(__('BuddyPress: %s', infinity_text_domain), BP_VERSION);
    ?>
</li>
		<li><?php 
    printf(__('MySQL: %s', infinity_text_domain), $wpdb->db_version());
    ?>
</li>
		<li><?php 
    printf(__('Permalinks: %s', infinity_text_domain), $custom_permalinks);
    ?>
</li>
		<li><?php 
    printf(__('PHP: %s', infinity_text_domain), phpversion());
    ?>
</li>
		<li><?php 
    printf(__('WordPress: %s', infinity_text_domain), $wp_version);
    ?>
</li>
		<li><?php 
    printf(__('WordPress multisite: %s', infinity_text_domain), $is_multisite);
    ?>
</li>
	</ul>

	<h4><?php 
    _e('Theme', infinity_text_domain);
    ?>
</h4>
	<ul>
		<li><?php 
    printf(__('Current theme: %s version %s', infinity_text_domain), $theme->name, $theme->version);
    ?>
</li>
	</ul>

	<h4><?php 
    _e('Active Plugins', infinity_text_domain);
    ?>
</h4>
	<ul>
		<?php 
    foreach ($active_plugins as $plugin) {
        ?>
			<li><?php 
        echo $plugin;
        ?>
</li>
		<?php 
    }
    ?>
	</ul><?php 
}
示例#11
0
 function prepare_items()
 {
     global $ct;
     $ct = current_theme_info();
     $themes = get_allowed_themes();
     unset($themes[$ct->name]);
     uksort($themes, "strnatcasecmp");
     $per_page = 15;
     $page = $this->get_pagenum('pagenum');
     $start = $offset = ($page - 1) * $per_page;
     $this->items = array_slice($themes, $start, $per_page);
     $this->set_pagination_args(array('query_var' => 'pagenum', 'total_items' => count($themes), 'per_page' => $per_page));
 }
function bp_groupblog_management_page()
{
    global $wpdb;
    // only allow site admins to come here.
    if (is_super_admin() == false) {
        wp_die(__('You do not have permission to access this page.', 'groupblog'));
    }
    // process form submission
    if (isset($_POST['action']) && $_POST['action'] == 'update') {
        bp_groupblog_update_defaults();
        $updated = true;
    } else {
        $updated = false;
    }
    // make sure we're using latest data
    $opt = get_site_option('bp_groupblog_blog_defaults_options');
    ?>

	<?php 
    if ($updated) {
        ?>
  	<div id="message" class="updated fade">
  		<p><?php 
        _e('Options saved.', 'groupblog');
        ?>
</p>
  	</div>
  <?php 
    }
    ?>

	<div class="wrap" style="position: relative">
		<h2><?php 
    _e('BuddyPress GroupBlog Settings', 'groupblog');
    ?>
</h2>

		<form name="bp-groupblog-setup" id="bp-groupblog-setup" action="" method="post">

			<div id="tabctnr">

				<ul class="tabnav">
	      	<li><a href="#groupblog_default_theme"><?php 
    _e('Theme', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_landing_page"><?php 
    _e('Redirect', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_template_layout"><?php 
    _e('Layout', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_default_blog_settings"><?php 
    _e('Defaults', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_validation_settings"><?php 
    _e('Validation', 'groupblog');
    ?>
</a></li>
	        <li><a href="#groupblog_about"><?php 
    _e('About', 'groupblog');
    ?>
</a></li>
	      </ul>

				<div id='groupblog_default_theme'>
					<?php 
    $current_groupblog_theme = '';
    // get all themes
    if (function_exists('wp_get_themes')) {
        // get theme data the WP3.4 way...
        $themes = wp_get_themes(false, 'network', 0);
        $ct = wp_get_theme();
        $allowed_themes = WP_Theme::get_allowed_on_network();
        $blog_allowed_themes = WP_Theme::get_allowed_on_site();
    } else {
        // pre WP3.4 functions
        $themes = get_themes();
        $ct = current_theme_info();
        $allowed_themes = get_site_allowed_themes();
        $blog_allowed_themes = wpmu_get_blog_allowedthemes();
    }
    if ($allowed_themes == false) {
        $allowed_themes = array();
    }
    if (is_array($blog_allowed_themes)) {
        $allowed_themes = array_merge($allowed_themes, $blog_allowed_themes);
    }
    if ($wpdb->blogid != 1) {
        unset($allowed_themes['h3']);
    }
    if (isset($allowed_themes[esc_html($ct->stylesheet)]) == false) {
        $allowed_themes[esc_html($ct->stylesheet)] = true;
    }
    reset($themes);
    foreach ($themes as $key => $theme) {
        if (isset($allowed_themes[esc_html($theme['Stylesheet'])]) == false) {
            unset($themes[$key]);
        }
    }
    reset($themes);
    // get the names of the themes & sort them
    /* 
    Note: pre-WP3.4 the keys are the theme names. In 3.4, the keys are folder names
    Fortunately, the magic methods of the object retain backwards compatibility and allow
    array-style access to work
    */
    $theme_names = array_keys($themes);
    natcasesort($theme_names);
    ?>

					<h3><?php 
    _e('Default Theme', 'groupblog');
    ?>
</h3>

					<div id="select-theme">
						<label for="theme"><?php 
    _e('Select the default theme for new groupblogs:', 'groupblog');
    ?>
</label>
						<select id="theme" name="theme" size="1">

						<optgroup label="<?php 
    echo esc_attr(__('GroupBlog Themes:', 'groupblog'));
    ?>
">
					 	<?php 
    $groupblog_themes_options = '';
    foreach ($theme_names as $theme_name) {
        if (in_array('groupblog', (array) $themes[$theme_name]['Tags'])) {
            $template = $themes[$theme_name]['Template'];
            $stylesheet = $themes[$theme_name]['Stylesheet'];
            $title = $themes[$theme_name]['Title'];
            $selected = "";
            if ($opt['theme'] == $template . "|" . $stylesheet) {
                $selected = "selected = 'selected' ";
                $current_groupblog_theme = $theme_name;
            }
            $groupblog_themes_options .= '<option value="' . $template . "|" . $stylesheet . '"' . $selected . '>' . $title . "</option>";
        }
    }
    if (!empty($groupblog_themes_options)) {
        echo $groupblog_themes_options;
    } else {
        echo '<option value="" disabled="disabled">' . __('No groupblog-enabled themes available', 'groupblog') . '</option>';
    }
    ?>
						</optgroup>
						<optgroup label="<?php 
    echo esc_attr(__('Regular Themes:', 'groupblog'));
    ?>
">
						<?php 
    $non_groupblog_themes_options = '';
    foreach ($theme_names as $theme_name) {
        if (!in_array('groupblog', (array) $themes[$theme_name]['Tags'])) {
            $template = $themes[$theme_name]['Template'];
            $stylesheet = $themes[$theme_name]['Stylesheet'];
            $title = $themes[$theme_name]['Title'];
            $selected = "";
            if ($opt['theme'] == $template . "|" . $stylesheet) {
                $selected = "selected = 'selected' ";
                $current_groupblog_theme = $theme_name;
            }
            $non_groupblog_themes_options .= '<option value="' . $template . "|" . $stylesheet . '"' . $selected . '>' . $title . "</option>";
        }
    }
    if (!empty($non_groupblog_themes_options)) {
        echo $non_groupblog_themes_options;
    } else {
        echo '<option value="" disabled="disabled">' . __('No regular themes available', 'groupblog') . '</option>';
    }
    ?>
						</optgroup>

						<option value="" <?php 
    selected($current_groupblog_theme, '');
    ?>
><?php 
    _e('- None selected -', 'groupblog');
    ?>
</option>

						</select>
					</div>

					<?php 
    if (!empty($current_groupblog_theme)) {
        ?>

						<div id="current-theme">
							<?php 
        if (isset($themes[$current_groupblog_theme]['Screenshot'])) {
            ?>
								<img src="<?php 
            echo $themes[$current_groupblog_theme]['Theme Root URI'] . '/' . $themes[$current_groupblog_theme]['Stylesheet'] . '/' . $themes[$current_groupblog_theme]['Screenshot'];
            ?>
" alt="<?php 
            _e('Current theme preview');
            ?>
" />
							<?php 
        }
        ?>

							<div class="alt" id="current-theme-info">
								<h4><?php 
        /* translators: 1: theme title, 2: theme version, 3: theme author */
        printf(__('%1$s %2$s by %3$s'), $themes[$current_groupblog_theme]['Title'], $themes[$current_groupblog_theme]['Version'], $themes[$current_groupblog_theme]['Author']);
        ?>
</h4>
								<p class="theme-description"><?php 
        /*print_r ($themes[$current_groupblog_theme]);*/
        echo $themes[$current_groupblog_theme]['Description'];
        ?>
</p>
								</div>
						</div>

					<?php 
    }
    ?>

					<div class="clear"></div>

				</div>
				<div id='groupblog_landing_page'>

					<h3><?php 
    _e('Default Landing Page', 'groupblog');
    ?>
</h3>

					<p><?php 
    _e('The page that is linked to from the "Blog" tab of the Group navigation. Selecting "Disabled" will use the buddypress template included in the plugin, no redirect will take place. The "Home Page" setting will create a redirect to the blog front page. The "Template Page" setting will create a redirect to the blog template page, additionally when using this setting you can choose a specific page template layout in the next tab.', 'groupblog');
    ?>
</p>
					<table class="form-table">
						<tbody>
						<tr>
							<th><?php 
    _e('Redirect Enabled to:', 'groupblog');
    ?>
</th>
							<td>
								<label><input class="info-off" name="bp_groupblog_redirect_blog" id="bp_groupblog_redirect_blog"  value="0" type="radio" <?php 
    if ($opt['redirectblog'] == 0) {
        echo 'checked="checked"';
    }
    ?>
 > <?php 
    _e('Disabled', 'groupblog');
    ?>
</label>
							</td>
						</tr>
						<tr>
							<th></th>
							<td>
								<label><input class="info-off" name="bp_groupblog_redirect_blog" id="bp_groupblog_redirect_blog"  value="1" type="radio" <?php 
    if ($opt['redirectblog'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 > <?php 
    _e('Home Page', 'groupblog');
    ?>
</label>
							</td>
						<tr>
							<th></th>
							<td>
								<label><input class="info-on" name="bp_groupblog_redirect_blog" id="bp_groupblog_redirect_blog"  value="2" type="radio" <?php 
    if ($opt['redirectblog'] == 2) {
        echo 'checked="checked"';
    }
    ?>
 > <?php 
    _e('Page Template Title: ', 'groupblog');
    ?>
</label>
								<input name="bp_groupblog_page_title" id="bp_groupblog_page_title" value="<?php 
    echo $opt['pagetitle'];
    ?>
" size="10" type="text" />
								<span class="notice" id="redirect_notice" style="display:none;"> <?php 
    _e('All existing Group Blogs will be automatically updated on each change.', 'groupblog');
    ?>
</span>
								<p class="info"><?php 
    _e('The "Template Page" option will create a page on group blogs and links to a template file within your theme. Don\'t worry about the name you choose, we\'ll make sure your page finds it way to the template file. For custom themes make sure to <a href="http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates">create</a> this template file manually.', 'groupblog');
    ?>
								</p>
							</td>
						</tr>
						<tr>
							<th><?php 
    _e('Redirect Group Home:', 'groupblog');
    ?>
</th>
							<td>
								<label for="deep_group_integration"><input name="deep_group_integration" type="checkbox" id="deep_group_integration" value="1" <?php 
    if ($opt['deep_group_integration'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Yes, redirect Group Home to Blog Home', 'groupblog');
    ?>
</label><p><?php 
    _e('This option will take control of the GROUP home page and redirects it to the BLOG home page. This will enable posting from the group Home using P2 instead of the BuddyPress form.', 'groupblog');
    ?>
</p>
					  	</td>
						</tr>
						</tbody>
					</table>

				</div>
				<div id='groupblog_template_layout'>
				<?php 
    if ($opt['theme'] == 'p2|p2-buddypress') {
        ?>

					<h3><?php 
        _e('Template Page Layout', 'groupblog');
        ?>
</h3>

					<p class="disabled"><?php 
        _e('Please select the option "Template Page" on the Redirect tab in order to choose a layout.', 'groupblog');
        ?>
</p>

					<p class="enabled"><?php 
        _e('Please select a Layout which you would like to use for your Group Blog. Additionally, incombination with "Redirect Group Home" setting you can set this as your Group Home page.', 'groupblog');
        ?>
</p>

					<table class="enabled" id="availablethemes" cellspacing="0" cellpadding="0">
						<tbody>
						<tr class="alt">
							<td class="available-theme top left">
								<?php 
        echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-mag.png">';
        ?>
								<div class="clear"></div>
								<input name="page_template_layout" id="page_template_layout"  value="magazine" type="radio" <?php 
        if ($opt['page_template_layout'] == 'magazine') {
            echo 'checked="checked"';
        }
        ?>
  /><h3 style="display:inline;"> <?php 
        _e('Magazine', 'groupblog');
        ?>
</h3>
								<p class="description"><?php 
        _e('Balanced template for groups with diverse postings.', 'groupblog');
        ?>
</p>
							</td>
							<td class="available-theme top">
								<?php 
        echo '<img src="' . WP_PLUGIN_URL . '/bp-groupblog/inc/i/screenshot-micro.png">';
        ?>
								<div class="clear"></div>
								<input name="page_template_layout" id="page_template_layout"  value="microblog" type="radio" <?php 
        if ($opt['page_template_layout'] == 'microblog') {
            echo 'checked="checked"';
        }
        ?>
 /><h3 style="display:inline;"> <?php 
        _e('Microblog', 'groupblog');
        ?>
</h3>
								<p class="description"><?php 
        _e('Great for simple listing of posts in a chronological order.', 'groupblog');
        ?>
</p>
							</td>
						</tr>
						</tbody>
					</table>

					<table class="form-table enabled">
					<tbody>
						<tr>
							<th><?php 
        _e('Group admin layout control:', 'groupblog');
        ?>
</th>
							<td>
								<label for="group_admin_layout"><input name="group_admin_layout" type="checkbox" id="group_admin_layout" value="1" <?php 
        if ($opt['group_admin_layout'] == 1) {
            echo 'checked="checked"';
        }
        ?>
 /> <?php 
        _e('Allow group admins to select the layout for their group themselves.', 'groupblog');
        ?>
</label>
					  	</td>
						</tr>
						</tbody>
					</table>
				<?php 
    } else {
        ?>
					<h3><?php 
        _e('Template Page Layout', 'groupblog');
        ?>
</h3>

					<p><?php 
        _e('Layout options are only available for the "P2 BuddyPress" Theme. Please select the "P2 Buddypress" theme on the "Theme" tab in order to choose a layout. Additionally the Redirect option needs to be set to "Template Page".', 'groupblog');
        ?>
</p>
				<?php 
    }
    ?>
				</div>
				<div id='groupblog_default_blog_settings'>

		      <h3><?php 
    _e('Default Blog Settings', 'groupblog');
    ?>
</h3>

					<table class="form-table">
						<tbody>
						<tr valign="top">
			        <th><?php 
    _e('Default Post Category:', 'groupblog');
    ?>
</th>
							<td>
								<input name="default_cat_name" type="text" id="default_cat_name" size="30" value="<?php 
    echo $opt['default_cat_name'];
    ?>
"  /> <?php 
    _e('(Overwrites "Uncategorized")', 'groupblog');
    ?>
							</td>
						</tr>
						<tr valign="top">
				    	<th><?php 
    _e('Default Link Category:', 'groupblog');
    ?>
</th>
							<td>
								<input name="default_link_cat" type="text" id="default_link_cat" size="30" value="<?php 
    echo $opt['default_link_cat'];
    ?>
"  /> <?php 
    _e('(Overwrites "Blogroll")', 'groupblog');
    ?>
							</td>
						</tr>
						<tr>
							<th><?php 
    _e('Set First Post to Draft', 'groupblog');
    ?>
</th>
							<td>
								<label for="delete_first_post">
				       		<input name="delete_first_post" type="checkbox" id="delete_first_post" value="1" <?php 
    if ($opt['delete_first_post'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Yes', 'groupblog');
    ?>
 <?php 
    _e('(Default Post "Hello World")', 'groupblog');
    ?>
				       	</label>
							</td>
						</tr>
				    <tr>
							<th><?php 
    _e('Delete Initial Comment', 'groupblog');
    ?>
</th>
							<td>
								<label for="delete_first_comment">
					        <input name="delete_first_comment" type="checkbox" id="delete_first_comment" value="1" <?php 
    if ($opt['delete_first_comment'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Yes', 'groupblog');
    ?>
					       </label>
							</td>
						</tr>
						<tr>
							<th><?php 
    _e('Delete Blogroll Links', 'groupblog');
    ?>
</th>
							<td>
								<label for="delete_blogroll_links">
									<input name="delete_blogroll_links" type="checkbox" id="delete_blogroll_links" value="1" <?php 
    if ($opt['delete_blogroll_links'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Yes', 'groupblog');
    ?>
								</label>
							</td>
						</tr>
						</tbody>
					</table>

				</div>
				<div id='groupblog_validation_settings'>

					<h3><?php 
    _e('Validation Settings', 'groupblog');
    ?>
</h3>

					<div><?php 
    _e('Change the default WordPress blog validation settings.', 'groupblog');
    ?>
</div>
					<table class="form-table">
						<tbody>
						<tr>
							<th><?php 
    _e('Allow:', 'groupblog');
    ?>
</th>
							<td>
								<label for="bp_groupblog_allowdashes">
				       		<input name="bp_groupblog_allowdashes" type="checkbox" id="bp_groupblog_allowdashes" value="1" <?php 
    if ($opt['allowdashes'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Dashes', 'groupblog');
    ?>
 <?php 
    _e('(Default: Not Allowed)', 'groupblog');
    ?>
				       	</label>
							</td>
						</tr>
				    <tr>
				    	<th></th>
							<td>
								<label for="bp_groupblog_allowunderscores">
					        <input name="bp_groupblog_allowunderscores" type="checkbox" id="bp_groupblog_allowunderscores" value="1" <?php 
    if ($opt['allowunderscores'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('Underscores', 'groupblog');
    ?>
 <?php 
    _e('(Default: Not Allowed)', 'groupblog');
    ?>
					       </label>
							</td>
						</tr>
						<tr>
							<th></th>
							<td>
								<label for="bp_groupblog_allownumeric">
									<input name="bp_groupblog_allownumeric" type="checkbox" id="bp_groupblog_allownumeric" value="1" <?php 
    if ($opt['allownumeric'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <?php 
    _e('All Numeric Names', 'groupblog');
    ?>
 <?php 
    _e('(Default: Not Allowed)', 'groupblog');
    ?>
								</label>
							</td>
						</tr>
						<tr>
							<th><?php 
    _e('Minimum Length:', 'groupblog');
    ?>
</th>
							<td>
								<input name="bp_groupblog_minlength" style="width: 10%;" id="bp_groupblog_minlenth" value="<?php 
    echo $opt['minlength'];
    ?>
" size="10" type="text" /> <?php 
    _e('(Default: 4 Characters)', 'groupblog');
    ?>
							</td>
						</tr>
						</tbody>
					</table>

				</div>
				<div id='groupblog_about'>

					<h3><?php 
    _e('About This PLugin', 'groupblog');
    ?>
</h3>

			    <div>
			    	<span class="indent"><strong><?php 
    _e('Authors', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="http://oomsonline.com">Marius Ooms</a> & <a href="http://blevins.nl">Rodney Blevins</a></span>
			    </div>
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Donate', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=7374704"><?php 
    _e('PayPal', 'groupblog');
    ?>
</a></span>
			    </div>
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Support', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="http://buddypress.org/forums/"><?php 
    _e('BuddyPress Forums', 'groupblog');
    ?>
</a> |
			    	<a href="http://wordpress.org/tags/bp-groupblog?forum_id=10"><?php 
    _e('WordPress Forums', 'groupblog');
    ?>
</a></span>
			    </div>
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Trac', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="http://plugins.trac.wordpress.org/log/bp-groupblog"><?php 
    _e('Revision Log', 'groupblog');
    ?>
</a> | <a href="http://plugins.trac.wordpress.org/browser/bp-groupblog/"><?php 
    _e('Trac Browser', 'groupblog');
    ?>
</a></span>
			    </div>
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Rate', 'groupblog');
    ?>
</strong></span>
			    	<span><a href="http://wordpress.org/extend/plugins/bp-groupblog/"><?php 
    _e('Let everyone know! Only if you like it :)', 'groupblog');
    ?>
</a></span>
			    </div>
			    <hr />
			    <div>
			    	<span class="indent"><strong><?php 
    _e('Acknowledgement', 'groupblog');
    ?>
</strong></span>
			    	<span><?php 
    _e('Thanks goes out to the following people:', 'groupblog');
    ?>
</span>
				    	<ul id="acknowledge">
				    		<li><a href="http://buddypress.org/developers/apeatling/">Andy Peatling</a></li>
				    		<li>Thijs Huijssoon</li>
				    		<li><a href="http://deannaschneider.wordpress.com/">Deanna Schneider</a></li>
				    		<li><a href="http://buddypress.org/developers/boonebgorges/">Boone Gorges</a></li>
				    		<li><a href="http://wordpress.org/support/profile/5499080">Luiz Armesto</a></li>
				    		<li><a href="http://buddypress.org/developers/burtadsit/">Burt Adsit</a></li>
				    	</ul>
			    </div>

				</div>

			</div>

	    <p class="submit">
	    	<input type="hidden" name="action" value="update" />
	      <input type="submit" name="Submit" class="button-primary" value="<?php 
    _e('Save Changes', 'groupblog');
    ?>
" />
	    </p>

 		</form>

	</div>

<?php 
}
示例#13
0
        function print_message()
        {
            // Read current user
            global $current_user;
            get_currentuserinfo();
            // Array which contains all my extensions
            $arr_extension = array();
            // Read the active plugins
            foreach (get_option('active_plugins') as $plugin) {
                $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
                if (StrPos(StrToLower($plugin_data['Author']), 'dennis hoppe') !== False) {
                    $arr_extension[] = $plugin_data['Title'];
                }
            }
            // Read the current theme
            if (StrPos(StrToLower(current_theme_info()->author), 'dennis hoppe') !== False) {
                $arr_extension[] = $this->t('the theme') . ' ' . current_theme_info()->title;
            }
            // Write the Dashboard message
            ?>
<img src="http://www.gravatar.com/avatar/d50a70b7a2e91bb31e8f00c13149f059?s=100" class="alignright" alt="Dennis Hoppe" height="100" width="100" style="margin:0 0 3px 10px;" />
    
    <div style="text-align:justify">    
      <h4><?php 
            PrintF($this->t('Hello %1$s!'), $current_user->display_name);
            ?>
</h4>
      
      <p>
        <?php 
            echo $this->t('My name is Dennis Hoppe and I am a computer science student working and living in Berlin, Germany.');
            ?>
        <?php 
            PrintF($this->t('Beside other plugins and themes I developed %1$s.'), $this->Extended_Implode($arr_extension, ', ', ' ' . $this->t('and') . ' '));
            ?>
        <?php 
            echo $this->t('I love the spirit of the open source movement, to write and share code and knowledge, but I think the system can work only if everyone contributes one\'s part properly.');
            ?>
      
      </p>
      
      <p>
        <?php 
            PrintF($this->t('Because you are using %1$s of my WordPress extensions I hope you will appreciate my job.'), $this->Number_to_Word(Count($arr_extension)));
            ?>
        <?php 
            echo $this->t('So please think about a donation. You would also help to keep alive and growing the community.');
            ?>
      </p>

    </div>
    
    <ul>
      <li><?php 
            echo $this->t('Make a gift of the Amazon Wish List');
            ?>
:
        <ul>
          <li>&raquo; <a href="http://amzn.com/w/1A45MS7KY75CY" target="_blank"><?php 
            echo $this->t('Amazon USA');
            ?>
</a></li>
          <li>&raquo; <a href="http://www.amazon.de/wishlist/2AG0R8BHEOJOL" target="_blank"><?php 
            echo $this->t('Amazon Germany');
            ?>
</a></li>
        </ul>
      </li>
      
      <li class="hide_if_js">&raquo; <?php 
            echo $this->t('Make a donation via PayPal:');
            ?>
        <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=1220480" target="_blank"><?php 
            echo $this->t('U$ Dollars');
            ?>
</a> |
        <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=HECSPGLPTQL24" target="_blank"><?php 
            echo $this->t('&euro;uro');
            ?>
</a>
      </li>
      <li class="show_if_js" style="display:none"><?php 
            echo $this->t('Make a donation via PayPal');
            ?>
:
        <ul>
          <li>&raquo; U$ Dollar:
            <input type="hidden" class="dennis_hoppe_donation_currency" value="USD" />
            <select class="dennis_hoppe_donation_amount">
              <option value="" disabled="disabled" selected="selected"><?php 
            echo $this->t('Amount in USD');
            ?>
</option>
              <!--
              <option value="104.37">$104.37</option>
              <option value="83.56">$83.56</option>
              <option value="62.75">$62.75</option>
              -->
              <option value="52.34">$52.34</option>
              <option value="41.94">$41.94</option>
              <option value="31.53">$31.53</option>
              <option value="21.12">$21.12</option>
              <option value="15.92">$15.92</option>
              <option value="10.72">$10.72</option>
              <option value="5.52">$5.52</option>
              <option value="">&raquo; <?php 
            echo $this->t('other amount');
            ?>
</option>
            </select>
            <input type="button" class="dennis_hoppe_donation_button button-primary" value="<?php 
            echo $this->t('Proceed to PayPal');
            ?>
 &rarr;" disabled="disabled" />
          </li>
          <li>&raquo; &euro;uro:
            <input type="hidden" class="dennis_hoppe_donation_currency" value="EUR" />
            <select class="dennis_hoppe_donation_amount">
              <option value="" disabled="disabled" selected="selected"><?php 
            echo $this->t('Amount in EUR');
            ?>
</option>
              <!--
              <option value="102.29">102,29 &euro;</option>
              <option value="81.91">81,91 &euro;</option>
              <option value="61.52">61,52 &euro;</option>
              -->
              <option value="51.33">51,33 &euro;</option>
              <option value="41.13">41,13 &euro;</option>
              <option value="30.94">30,94 &euro;</option>
              <option value="20.74">20,74 &euro;</option>
              <option value="15.65">15,65 &euro;</option>
              <option value="10.55">10,55 &euro;</option>
              <option value="5.45">5,45 &euro;</option>
              <option value="">&raquo; <?php 
            echo $this->t('other amount');
            ?>
</option>
            </select>
            <input type="button" class="dennis_hoppe_donation_button button-primary" value="<?php 
            echo $this->t('Proceed to PayPal');
            ?>
 &rarr;" disabled="disabled" />
          </li>
        </ul>
      </li>
    </ul>
    
    <p><?php 
            echo $this->t('After donation you will possibly get to know how you can hide this notice easily. ;)');
            ?>
</p>
    
    <div class="clear"></div><?php 
        }
示例#14
0
 function ajax_site_export()
 {
     $this->_parent->set_greedy_script_limits();
     global $wpdb, $current_site, $current_blog;
     $blog_id = absint($current_blog->blog_id);
     check_ajax_referer('export-site');
     $return_args = array('completion' => 0, 'message' => '', 'errors' => false);
     require_once $this->_parent->_pluginPath . '/lib/zipbuddy/zipbuddy.php';
     $step = absint($_POST['step']);
     $zip_id = sanitize_text_field($_POST['zip_id']);
     $upload_dir = wp_upload_dir();
     $original_upload_base_dir = $upload_dir['basedir'];
     $extract_files_to = $original_upload_base_dir . '/' . $zip_id;
     switch ($step) {
         case 1:
             //Step 1 - Download a copy of WordPress
             $wp_url = 'http://wordpress.org/latest.zip';
             $wp_file = download_url($wp_url);
             if (is_wp_error($wp_file)) {
                 $return_args['errors'] = true;
                 $return_args['message'] = $wp_file->get_error_message();
                 $this->log('MS-MS Step 1 - ' . $wp_file->get_error_message(), 'error');
             } else {
                 $return_args['message'] = __('WordPress Successfully Downloaded - Extracting WordPress to a Temporary Directory', 'it-l10n-backupbuddy');
                 $return_args['completion'] = 5;
                 $return_args['wp_file'] = $wp_file;
             }
             break;
         case 2:
             //Step 2 - Extract WP into a separate directory
             $wp_file = file_exists($_POST['wp_file']) ? $_POST['wp_file'] : false;
             if (!$wp_file) {
                 $return_args['errors'] = true;
                 $return_args['message'] = __('WordPress file could not be located', 'it-l10n-backupbuddy');
                 $this->log('MS-MS Step 2 - ' . __('WordPress file could not be located', 'it-l10n-backupbuddy'), 'error');
             } else {
                 $return_args['debug'] = $extract_files_to;
                 $return_args['message'] = __('WordPress extracted - Creating installation file', 'it-l10n-backupbuddy');
                 $return_args['completion'] = 15;
                 $zipbuddy = new pluginbuddy_zipbuddy($extract_files_to);
                 ob_start();
                 //todo - upload to wp-contennt
                 //when merging, update extract_files to use new importbuddy version of zip / unzip functionality
                 $zipbuddy->unzip($wp_file, $extract_files_to);
                 $return_args['debug'] = ob_get_clean();
                 unlink($wp_file);
             }
             break;
         case 3:
             //Step 3 - Create new WP-Config File
             $wp_config_path = $extract_files_to . '/wordpress/';
             if (!file_exists($wp_config_path)) {
                 $return_args['errors'] = true;
                 $return_args['message'] = __('Temporary WordPress installation not found', 'it-l10n-backupbuddy');
                 $return_args['debug'] = $wp_config_path;
                 $this->log('MS-MS Step 3 - ' . __('Temporary WordPress installation file could not be located', 'it-l10n-backupbuddy') . $wp_config_path, 'error');
             } else {
                 $to_file = "<?php\n";
                 $to_file .= sprintf("define( 'DB_NAME', '%s' );\n", '');
                 $to_file .= sprintf("define( 'DB_USER', '%s' );\n", '');
                 $to_file .= sprintf("define( 'DB_PASSWORD', '%s' );\n", '');
                 $to_file .= sprintf("define( 'DB_HOST', '%s' );\n", '');
                 $charset = defined('DB_CHARSET') ? DB_CHARSET : '';
                 $collate = defined('DB_COLLATE') ? DB_COLLATE : '';
                 $to_file .= sprintf("define( 'DB_CHARSET', '%s' );\n", $charset);
                 $to_file .= sprintf("define( 'DB_COLLATE', '%s' );\n", $collate);
                 //Attempt to remotely retrieve salts
                 $salts = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/');
                 if (!is_wp_error($salts)) {
                     $to_file .= wp_remote_retrieve_body($salts) . "\n";
                 }
                 $to_file .= sprintf("define( 'WPLANG', '%s' );\n", WPLANG);
                 $to_file .= sprintf('$table_prefix = \'%s\';' . "\n", 'bbms' . $blog_id . '_');
                 $to_file .= "if ( !defined('ABSPATH') ) { \n\tdefine('ABSPATH', dirname(__FILE__) . '/'); }";
                 $to_file .= "/** Sets up WordPress vars and included files. */\n\n\t\t\t\t\t\trequire_once(ABSPATH . 'wp-settings.php');";
                 $to_file .= "\n?>";
                 $wp_config_path .= 'wp-config.php';
                 //Create the file, save, and close
                 $file_handle = fopen($wp_config_path, 'w');
                 fwrite($file_handle, $to_file);
                 fclose($file_handle);
                 //Prepare the response
                 $return_args['debug'] = $extract_files_to;
                 $return_args['message'] = __('Installation file created - Copying Over Plugins.', 'it-l10n-backupbuddy');
                 $return_args['completion'] = 25;
             }
             break;
         case 4:
             //Step 4 - Copy over plugins
             //Move over plugins
             $plugin_items = get_transient($zip_id);
             //Populate $items_to_copy for all plugins to copy over
             if (is_array($plugin_items)) {
                 $items_to_copy = array();
                 //Get content directories by using this plugin as a base
                 $content_dir = $dropin_plugins_dir = dirname(dirname(dirname(rtrim(plugin_dir_path(__FILE__), '/'))));
                 $mu_plugins_dir = $content_dir . '/mu-plugins';
                 $plugins_dir = $content_dir . '/plugins';
                 //Get the special plugins (mu, dropins, network activated)
                 foreach ($plugin_items as $type => $plugins) {
                     foreach ($plugins as $plugin) {
                         if ($type == 'mu') {
                             $items_to_copy[$plugin] = $mu_plugins_dir . '/' . $plugin;
                         } elseif ($type == 'dropin') {
                             $items_to_copy[$plugin] = $dropin_plugins_dir . '/' . $plugin;
                         } elseif ($type == 'network' || $type == 'site') {
                             //Determine if we're a folder-based plugin, or a file-based plugin (such as hello.php)
                             $plugin_path = dirname($plugins_dir . '/' . $plugin);
                             if (basename($plugin_path) == 'plugins') {
                                 $plugin_path = $plugins_dir . '/' . $plugin;
                             }
                             $items_to_copy[basename($plugin_path)] = $plugin_path;
                         }
                     }
                     //end foreach $plugins
                 }
                 //end foreach special plugins
                 //Copy the files over
                 $wp_dir = '';
                 if (count($items_to_copy) > 0) {
                     $wp_dir = $extract_files_to . '/wordpress/';
                     $wp_plugin_dir = $wp_dir . '/wp-content/plugins/';
                     foreach ($items_to_copy as $file => $original_destination) {
                         if (file_exists($original_destination) && file_exists($wp_plugin_dir)) {
                             $this->copy($original_destination, $wp_plugin_dir . $file);
                         }
                     }
                 }
                 //Prepare the response
                 $return_args['debug'] = $wp_dir;
                 $return_args['message'] = __('Plugins copied over.  Now copying over the active theme.', 'it-l10n-backupbuddy');
                 $return_args['completion'] = 50;
             } else {
                 //Nothing has technically failed at this point - There just aren't any plugins to copy over
                 $return_args['message'] = __('Plugins copied over.  Now copying over the active theme.', 'it-l10n-backupbuddy');
                 $return_args['completion'] = 50;
                 $this->log('MS-MS Step 4 - ' . __('No plugins to copy over', 'it-l10n-backupbuddy'), 'error');
             }
             break;
         case 5:
             //Step 5 - Copy over themes
             $current_theme = current_theme_info();
             $template_dir = $current_theme->template_dir;
             $stylesheet_dir = $current_theme->stylesheet_dir;
             //If $template_dir and $stylesheet_dir don't match, that means we have a child theme and need to copy over the parent also
             $items_to_copy = array();
             $items_to_copy[basename($template_dir)] = $template_dir;
             if ($template_dir != $stylesheet_dir) {
                 $items_to_copy[basename($stylesheet_dir)] = $stylesheet_dir;
             }
             //Copy the files over
             if (count($items_to_copy) > 0) {
                 $wp_dir = $extract_files_to . '/wordpress/';
                 $wp_theme_dir = $wp_dir . '/wp-content/themes/';
                 foreach ($items_to_copy as $file => $original_destination) {
                     if (file_exists($original_destination) && file_exists($wp_theme_dir)) {
                         $this->copy($original_destination, $wp_theme_dir . $file);
                     }
                 }
             }
             $return_args['debug'] = $wp_dir;
             $return_args['message'] = __('Theme has been copied over.  Now copying over media files.', 'it-l10n-backupbuddy');
             $return_args['completion'] = 60;
             break;
         case 6:
             //Step 6 - Copy over media/upload files
             $upload_dir = wp_upload_dir();
             $original_upload_base_dir = $upload_dir['basedir'];
             $destination_upload_base_dir = $extract_files_to . '/wordpress/wp-content/uploads';
             $this->copy($original_upload_base_dir, $destination_upload_base_dir, array('ignore_files' => array($zip_id)));
             $return_args['debug'] = $destination_upload_base_dir;
             $return_args['message'] = __('Media has been copied over.  Now preparing the export.', 'it-l10n-backupbuddy');
             $return_args['completion'] = 70;
             break;
         case 7:
             //Step 7 - Create Users Table
             //Get users of current site
             global $wpdb, $current_blog;
             $user_args = array('blog_id' => $current_blog->blog_id);
             $users = get_users($user_args);
             //Copy over the user and usermeta tables
             $found_tables = array($wpdb->users, $wpdb->usermeta);
             $user_tablename = $usermeta_tablename = '';
             $sql_to_execute = array();
             if ($found_tables) {
                 foreach ($found_tables as $index => $tablename) {
                     $new_table = '';
                     if (strstr($tablename, 'users')) {
                         $new_table = $user_tablename = $wpdb->prefix . 'users';
                     }
                     if (strstr($tablename, 'usermeta')) {
                         $new_table = $usermeta_tablename = $wpdb->prefix . 'usermeta';
                     }
                     $sql_to_execute[] = sprintf('CREATE TABLE %1$s LIKE %2$s', $new_table, $tablename);
                     $sql_to_execute[] = sprintf('INSERT %1$s SELECT * FROM %2$s', $new_table, $tablename);
                     //Couldn't use $wpdb->prepare here because sql doesn't like quotes around the tablenames
                 }
             }
             //Tables have been created, now execute a query to remove the users and user data that doesn't matter
             $users_to_capture = array();
             if ($users) {
                 foreach ($users as $user) {
                     array_push($users_to_capture, $user->ID);
                 }
             }
             $users_to_capture = implode(',', $users_to_capture);
             $sql_to_execute[] = sprintf("DELETE from %s WHERE ID NOT IN( %s )", $user_tablename, $users_to_capture);
             $sql_to_execute[] = sprintf("DELETE from %s WHERE user_id NOT IN( %s )", $usermeta_tablename, $users_to_capture);
             //Execute queries
             foreach ($sql_to_execute as $sql) {
                 $wpdb->query($sql);
             }
             //Return the response
             $return_args['message'] = __('Building the export file and cleaning up.', 'it-l10n-backupbuddy');
             $return_args['completion'] = 80;
             break;
         case 8:
             //Step 8 - Backup
             global $current_site, $wpdb;
             require_once $this->_parent->_pluginPath . '/classes/backup.php';
             $backup_directory = $extract_files_to . '/wordpress/';
             $temp_directory = $backup_directory . '/wp-content/uploads/backupbuddy_temp/';
             $prefix = $wpdb->prefix;
             $pluginbuddy_backup = new pluginbuddy_backupbuddy_backup($this->_parent);
             //Get a list of tables to backup
             $query = "SHOW TABLES LIKE '{$prefix}%'";
             $results = $wpdb->get_results($query, ARRAY_A);
             $tables_to_ignore = array($prefix . 'blogs', $prefix . 'blog_versions', $prefix . 'site', $prefix . 'sitemeta', $prefix . 'registration_log', $prefix . 'signups', $prefix . 'sitecategories');
             $list_of_tables = array();
             foreach ($results as $results_key => $table_array) {
                 foreach ($table_array as $key => $tablename) {
                     if (preg_match("/^{$prefix}(?!\\d+)/", $tablename) && !in_array($tablename, $tables_to_ignore)) {
                         array_push($list_of_tables, $tablename);
                     }
                 }
             }
             //Do the database dump
             $backup_serial = $pluginbuddy_backup->rand_string(10);
             $dat_directory = $temp_directory . '/' . $backup_serial . '/';
             $backup = array('backup_time' => time(), 'serial' => $backup_serial, 'backup_type' => 'full', 'temp_directory' => $dat_directory, 'backup_mode' => '2');
             $options = array('include_tables' => array(), 'temp_directory' => $dat_directory, 'high_security' => '1', 'backup_nonwp_tables' => '0');
             //Create the temp directory
             $this->_parent->mkdir_recursive($dat_directory);
             $pluginbuddy_backup->anti_directory_browsing($temp_directory);
             //Create the dat file
             $pluginbuddy_backup->backup_create_dat_file($backup, $options, true);
             //Create the database dump
             $pluginbuddy_backup->backup_create_database_dump($backup, $options, $list_of_tables, true);
             //Archive the file
             require_once $this->_parent->_pluginPath . '/lib/zipbuddy/zipbuddy.php';
             $zipbuddy = new pluginbuddy_zipbuddy($backup_directory);
             $archive_directory = $this->_parent->_options['backup_directory'];
             $this->_parent->mkdir_recursive($archive_directory);
             $pluginbuddy_backup->anti_directory_browsing($archive_directory);
             $archive_file = $archive_directory . 'backup-' . $this->_parent->backup_prefix() . '-' . str_replace('-', '_', date('Y-m-d')) . '-' . $backup_serial . '.zip';
             $zipbuddy->add_directory_to_zip($archive_file, $backup_directory, true);
             //Return the response
             $archive_file_url = str_replace(ABSPATH, '', $archive_file);
             $archive_file_url = site_url($archive_file_url);
             $file_args = sprintf('<a href="%s">%s</a>', $archive_file_url, __('Download Now', 'it-l10n-backupbuddy'));
             $return_args['message'] = sprintf(__('You\'re done!  The export file is ready for download. %s', 'it-l10n-backupbuddy'), $file_args);
             $return_args['completion'] = 100;
             //Cleanup
             $this->_parent->delete_directory_recursive($extract_files_to);
             break;
     }
     //end switch
     die(json_encode($return_args));
 }
 /**
  * @return string the name and the version of the current theme.
  */
 public static function getCurrentTheme()
 {
     if (function_exists('wp_get_theme')) {
         //Since WP 3.4
         $currentTheme = wp_get_theme();
         return $currentTheme->get('Name') . " v" . $currentTheme->get('Version');
     } else {
         $currentTheme = current_theme_info();
         return $currentTheme->name . " v" . $currentTheme->version;
     }
 }
示例#16
0
function hmt_admin()
{
    global $themename, $shortname, $options, $baseversion, $thisversion, $subtitle;
    if ($_REQUEST['saved']) {
        echo '<div id="message" class="updated fade"><p><strong>' . $themename . ' Theme settings saved.</strong></p></div>';
    }
    if ($_REQUEST['reset']) {
        echo '<div id="message" class="updated fade"><p><strong>' . $themename . ' Theme settings reset.</strong></p></div>';
    }
    ?>
	
	<div class="wrap">
	
	<h2><img src="<?php 
    echo bloginfo('template_url');
    ?>
/images/mappy-wp-bw-45-web.png" align="absbottom" width="47px" height="45px" />&nbsp;<?php 
    echo $themename;
    ?>
 Options</h2>
	
		<div style="width:965px;"> 
	
			<div style="float:left">
			<form method="post">
			
				<?php 
    // if we are in preset mode then we have to do some fancy footwork to bring the preset mode turner-off-er up to the top of the options page
    $preset_mode_already_shown = FALSE;
    $this_mode = hmt_get_option(hmt_preset_mode_activated);
    if ($this_mode == "ON" || $this_mode == "") {
        $preset_mode = TRUE;
        $show_next_time = FALSE;
        ?>
					
				<div id="message" class="updated fade">
					<p><span style="color:#F00"><strong>Preset Mode</strong></span> is activated. To activate <strong>Full Widget Mode</strong> (recommended) and activate all Widget Positions turn off Preset Mode below :)
				</div>
				
				<?php 
    }
    ?>
	
					
				<?php 
    foreach ($options as $value) {
        // Loop through the options array and display all the options in a form for editing.
        switch ($value['type']) {
            /* This is the left column of the options page
            -------------------------------------------------------------- */
            /* Open
            -------------------------------------------------------------- */
            case "open":
                ?>
						<table class="widefat" cellspacing="0" style="width:600px;"><tbody>
			 
					<?php 
                break;
                /* Close
                -------------------------------------------------------------- */
            /* Close
            -------------------------------------------------------------- */
            case "close":
                ?>
						</tbody></table>
						<br />
					<?php 
                break;
                /* Title
                -------------------------------------------------------------- */
            /* Title
            -------------------------------------------------------------- */
            case "title":
                ?>
						<thead>
							<tr>
								<th colspan="2" scope="col">
									<?php 
                echo $value['name'];
                ?>
 
									<div style="float:right">
										<input name="save" type="submit" value="Save" class="button-primary"/>
										<input type="hidden" name="action" value="save" />
									</div>
								</th>
							</tr>
						</thead>
					<?php 
                break;
                /* Text
                -------------------------------------------------------------- */
            /* Text
            -------------------------------------------------------------- */
            case 'text':
                ?>
						<tr>
							<td width="250px"><strong><?php 
                echo $value['name'];
                ?>
</strong><br />
								<small><a href="http://heatmaptheme.com/<?php 
                echo $subtitle;
                ?>
/version-<?php 
                echo $baseversion;
                ?>
/<?php 
                echo $value['userguide'];
                ?>
/"><strong>[User Guide]</strong></a></small><br /><br />
								<?php 
                echo $value['desc'];
                ?>
							</td>
							<td width="350px">
								<input style="width:340px; font-size:11px;" name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
" type="text" value="<?php 
                if (get_option($value['id']) != "") {
                    echo htmlspecialchars(stripslashes(get_option($value['id'])));
                } else {
                    echo $value['std'];
                }
                ?>
" />
							</td>
						</tr>
			
					<?php 
                break;
                /* Text Area
                -------------------------------------------------------------- */
            /* Text Area
            -------------------------------------------------------------- */
            case 'textarea':
                ?>
 
						<tr>
							<td width="250px"><strong><?php 
                echo $value['name'];
                ?>
</strong><br />
								<small><a href="http://heatmaptheme.com/<?php 
                echo $subtitle;
                ?>
/version-<?php 
                echo $baseversion;
                ?>
/<?php 
                echo $value['userguide'];
                ?>
/"><strong>[User Guide]</strong></a></small><br /><br />
								<?php 
                echo $value['desc'];
                ?>
							</td>
							<td width="350px">
							<textarea name="<?php 
                echo $value['id'];
                ?>
" style="width:340px; height:120px; font-size:11px;" cols="" rows=""><?php 
                if (get_option($value['id']) != "") {
                    echo stripslashes(htmlspecialchars(get_option($value['id'])));
                } else {
                    echo $value['std'];
                }
                ?>
</textarea>
							</td> 
						</tr>
						
					<?php 
                break;
                /* Checkbox
                -------------------------------------------------------------- */
            /* Checkbox
            -------------------------------------------------------------- */
            case 'checkbox':
                ?>
						<tr>
							<td width="250px"><strong><?php 
                echo $value['name'];
                ?>
</strong><br />
								<small><a href="http://heatmaptheme.com/<?php 
                echo $subtitle;
                ?>
/version-<?php 
                echo $baseversion;
                ?>
/<?php 
                echo $value['userguide'];
                ?>
/"><strong>[User Guide]</strong></a></small><br /><br />
								<?php 
                echo $value['desc'];
                ?>
							</td>
							<td width="350px">
								<?php 
                if (get_option($value['id'])) {
                    $checked = "checked=\"checked\"";
                } else {
                    $checked = "";
                }
                ?>
								<input type="checkbox" name="<?php 
                echo $value['id'];
                ?>
" id="<?php 
                echo $value['id'];
                ?>
" value="true" <?php 
                echo $checked;
                ?>
 />
							</td>
						</tr>
			
					<?php 
                break;
                /* Selection - a bit of a hack on this one - just using the select for preset mode in this case... I'll neaten this whole area of code up later I promise ;)
                -------------------------------------------------------------- */
            /* Selection - a bit of a hack on this one - just using the select for preset mode in this case... I'll neaten this whole area of code up later I promise ;)
            -------------------------------------------------------------- */
            case 'select':
                if ($preset_mode == TRUE && !$preset_mode_already_shown || $show_next_time == TRUE) {
                    ?>
			
					<table class="widefat" cellspacing="0" style="width:600px;"><tbody>
					
					<thead>
						<tr>
							<th colspan="2" scope="col">
								<?php 
                    echo 'Preset Mode';
                    ?>
 
								<div style="float:right">
									<input name="save" type="submit" value="Save" class="button-primary"/>
									<input type="hidden" name="action" value="save" />
								</div>
							</th>
						</tr>
					</thead>
					
					<tr>
						<td width="250px"><strong><?php 
                    echo $value['name'];
                    ?>
</strong><br />
						<small><a href="http://heatmaptheme.com/<?php 
                    echo $subtitle;
                    ?>
/version-<?php 
                    echo $baseversion;
                    ?>
/<?php 
                    echo $value['userguide'];
                    ?>
/"><strong>[User Guide]</strong></a></small><br /><br />
						<?php 
                    echo $value['desc'];
                    ?>
						
						</td>
						
						<td width="350px"><select style="width:100px;" name="<?php 
                    echo $value['id'];
                    ?>
" id="<?php 
                    echo $value['id'];
                    ?>
"><?php 
                    foreach ($value['options'] as $option) {
                        ?>
<option<?php 
                        if (get_settings($value['id']) == $option) {
                            echo ' selected="selected"';
                        } elseif ($option == $value['std']) {
                            echo ' selected="selected"';
                        }
                        ?>
><?php 
                        echo $option;
                        ?>
</option><?php 
                    }
                    ?>
</select></td>
					</tr>
					
					</tbody></table>
					<br />
					
					<?php 
                }
                $preset_mode_already_shown = TRUE;
                if ($preset_mode == FALSE) {
                    $show_next_time = TRUE;
                }
                break;
                /* Ad Combo box
                -------------------------------------------------------------- */
            /* Ad Combo box
            -------------------------------------------------------------- */
            case 'ad-combo':
                ?>
 
						<tr>
							<td width="250px">
							

							<input style="width:200px; font-size:11px; font-weight:bold;" name="<?php 
                echo $value['id'] . '_name';
                ?>
" id="<?php 
                echo $value['id'] . '_name';
                ?>
" type="text" value="<?php 
                if (get_option($value['id'] . '_name') != "") {
                    echo get_option($value['id'] . '_name');
                } else {
                    echo $value['name'];
                }
                ?>
" /><br />
							
								<?php 
                foreach ($value['checkbox'] as $checkbox_name => $checkbox_setting) {
                    $this_key = $value['id'] . '_' . $checkbox_name;
                    $this_setting = get_option($this_key);
                    if ($this_setting == '') {
                        $checked = "";
                    } else {
                        $checked = "checked=\"checked\"";
                    }
                    ?>
									
									<input type="checkbox" name="<?php 
                    echo $this_key;
                    ?>
" id="<?php 
                    echo $this_key;
                    ?>
" value="true" <?php 
                    echo $checked;
                    ?>
 /> <label for="<?php 
                    echo $this_key;
                    ?>
"><?php 
                    echo $checkbox_name;
                    ?>
</label><br />
								<?php 
                }
                ?>
								<small><a href="http://heatmaptheme.com/<?php 
                echo $subtitle;
                ?>
/version-<?php 
                echo $baseversion;
                ?>
/<?php 
                echo $value['userguide'];
                ?>
/"><strong>[User Guide]</strong></a></small><br />	
							</td>
							<td width="350px">
							
							<textarea name="<?php 
                echo $value['id'];
                ?>
" style="width:340px; height:120px; font-size:11px;" cols="" rows=""><?php 
                if (get_option($value['id']) != "") {
                    echo stripslashes(htmlspecialchars(get_option($value['id'])));
                } else {
                    echo $value['std'];
                }
                ?>
</textarea>
							</td> 
						</tr>
						
					<?php 
                break;
        }
    }
    ?>
	
<?php 
    /* Submit and Reset Buttons
    -------------------------------------------------------------- */
    ?>
			 
				<p class="submit">
					<input name="save" type="submit" value="Save changes" class="button-primary"/>
					<input type="hidden" name="action" value="save" />
				</p>
			</form>
			
			<form method="post">
				<p class="submit">
				<input name="reset" type="submit" value="Reset" class="button-secondary" />
				<input type="hidden" name="action" value="reset" />
			</p>
			</form>
			
			</div>
			
			
			<div style="float:left">
			

				
<?php 
    /* This is the right column of the options page
    -------------------------------------------------------------- */
    ?>
				
				<table class="widefat" cellspacing="0" style="width:350px; margin-left:15px;">
				
					<tbody> 
						<thead>
							<tr>
								<th colspan="2" scope="col">
									Latest News from <a href="http://heatmaptheme.com">HeatMapTheme.com</a>
								</th>
							</tr>
						</thead>
					
							<tr>
								<td width="350px">
									<?php 
    include_once ABSPATH . WPINC . '/rss.php';
    wp_rss('http://heatmaptheme.com/feed', 3);
    ?>
	
								</td>
							</tr>
					
					</tbody>
				</table>
				
				<br />
				
				<table class="widefat" cellspacing="0" style="width:350px; margin-left:15px;">
				
					<tbody> 
						<thead>
							<tr>
								<th colspan="2" scope="col">
									HeatMap Theme <a href="http://heatmaptheme.com/adsense-theme-for-wordpress/version-2/positioning-adsense-widgets-on-your-blog/" target="_blank">Widget Positions</a>
								</th>
							</tr>
						</thead>
					
							<tr>
								<td width="350px">
								
									<center><a href="http://heatmaptheme.com/adsense-theme-for-wordpress/version-2/positioning-adsense-widgets-on-your-blog/" target="_blank"><img src="<?php 
    echo bloginfo('template_url');
    ?>
/images/preset-images/widget-layout-small.gif" align="absbottom" width="150px" height="173px"  alt="View Widget Positions User Guide"/></a></center> 
								
						<?php 
    /*		<center><a href="http://heatmaptheme.com"><img src="<?php echo bloginfo('template_url'); ?>/images/mappy-wp-bw-250-web.png" align="absbottom" width="250px" height="181px" /></a></center> */
    ?>
								</td>
							</tr>
					
					</tbody>
				</table>
				
				
				<br />
			
				<table class="widefat" cellspacing="0" style="width:350px; margin-left:15px;">
				
					<tbody> 
						<thead>
							<tr>
								<th colspan="2" scope="col">
									Base Theme Info
								</th>
							</tr>
						</thead>
					
							<tr>
								<td width="150px">
									Author:<br />
									Theme Name:<br />
									Base Version:<br />
									This Version:
								</td>
								<td width="200px">
									<a href="http://stuartwider.com">Stuart Wider</a><br />
									<?php 
    echo $themename;
    ?>
<br />
									<?php 
    echo $baseversion;
    ?>
<br />
									<?php 
    echo $thisversion;
    ?>
								</td>
							</tr>
					
					</tbody>
				</table>
				
				<br />
			
				<?php 
    $ct = current_theme_info();
    if ($ct->parent_theme != '') {
        // if the current theme is a child theme then display extra details form the current theme array.
        ?>
				
				<table class="widefat" cellspacing="0" style="width:350px; margin-left:15px;">
				
					<tbody> 
						<thead>
							<tr>
								<th colspan="2" scope="col">
									Child Theme Info
								</th>
							</tr>
						</thead>
					
							<tr>
								<td width="150px">
									Author:<br />
									Theme Name:<br />
									Version:
								</td>
								<td width="200px">
									<?php 
        echo $ct->author . '<br />';
        echo $ct->name . '<br />';
        echo $ct->version;
        ?>
								</td>
							</tr>
					
					</tbody>
				</table>
				<br />
				
				<?php 
    }
    ?>
				
				<table class="widefat" cellspacing="0" style="width:350px; margin-left:15px;">
				
					<tbody> 
						<thead>
							<tr>
								<th colspan="2" scope="col">
									&copy; Copyright, Licensing and Trademarks
								</th>
							</tr>
						</thead>
					
							<tr>
								<td width="350px">
									<p><a href="http://heatmaptheme.com">HeatMap Theme</a> is copyright <a href="http://stuartwider.com">Stuart Wider</a> 2009 and distributed under the GPL3 License.</p>
									<?php 
    if ($ct->parent_theme != '') {
        ?>
<p>Child Themes are copyright of their respective Authors.</p><?php 
    }
    ?>
									<p>Google Adsense, Analytics, FeedBurner and Custom Search are trademarks of Google Inc.</p>
								</td>
							</tr>
					
					</tbody>
				
					
				</table>
				
			</div>
			
		
		</div>
		
<?php 
}
function csp_handle_csp_self_protection_result()
{
    csp_po_check_security();
    load_plugin_textdomain(CSP_PO_TEXTDOMAIN, PLUGINDIR . '/codestyling-localization/languages', 'codestyling-localization/languages');
    $incidents = 0;
    if (isset($_POST['data']['dirty_enqueues'])) {
        $incidents += count($_POST['data']['dirty_enqueues']);
    }
    if (isset($_POST['data']['dirty_theme'])) {
        $incidents += count($_POST['data']['dirty_theme']);
    }
    if (isset($_POST['data']['dirty_plugins'])) {
        $incidents += count($_POST['data']['dirty_plugins']);
    }
    if (isset($_POST['data']['runtime'])) {
        $incidents += count($_POST['data']['runtime']);
    }
    if (isset($_POST['data']['externals']) && isset($_POST['data']['externals']['cdn'])) {
        $incidents += count($_POST['data']['externals']['cdn']['tokens']);
    }
    if (isset($_POST['data']['externals']) && isset($_POST['data']['externals']['dubious'])) {
        $incidents += count($_POST['data']['externals']['dubious']['tokens']);
    }
    if (isset($_POST['data']['php'])) {
        $incidents += count($_POST['data']['php']);
    }
    ?>
<p class="self-protection"><strong><?php 
    _e('Scripting Guard', CSP_PO_TEXTDOMAIN);
    ?>
</strong> [ <a class="self-protection-details" href="javascript:void(0)"><?php 
    _e('details', CSP_PO_TEXTDOMAIN);
    ?>
</a> ]&nbsp;&nbsp;&nbsp;<?php 
    echo sprintf(__('The Plugin <em>Codestyling Localization</em> was forced to protect its own page rendering process against <b>%s</b> %s !', CSP_PO_TEXTDOMAIN), $incidents, _n('incident', 'incidents', $incidents, CSP_PO_TEXTDOMAIN));
    ?>
&nbsp;<a align="left" class="question-help" href="javascript:void(0);" title="<?php 
    _e("What does that mean?", CSP_PO_TEXTDOMAIN);
    ?>
" rel="selfprotection"><img src="<?php 
    echo CSP_PO_BASE_URL . "/images/question.gif";
    ?>
" /></a></p>
<div id="self-protection-details" style="display:none;">
<?php 
    if (isset($_POST['data']['php']) && count($_POST['data']['php'])) {
        ?>
		<div>
		<img class="alignleft" alt="" src="<?php 
        echo CSP_PO_BASE_URL . "/images/php-core.gif";
        ?>
" />
		<strong style="color:#800;"><?php 
        _e('PHP runtime error reporting detected !', CSP_PO_TEXTDOMAIN);
        ?>
</strong><br/>
		<?php 
        _e('Reason:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('some executed PHP code is not written proper', CSP_PO_TEXTDOMAIN);
        ?>
</strong> | 
		<?php 
        _e('Originator:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('unknown', CSP_PO_TEXTDOMAIN);
        ?>
</strong> <small>(<?php 
        _e('probably by Theme or Plugin', CSP_PO_TEXTDOMAIN);
        ?>
)</small><br/>
		<?php 
        _e('Below listed error reports has been traced and removed during page creation:', CSP_PO_TEXTDOMAIN);
        ?>
<br/>
		<ol>
		<?php 
        foreach ($_POST['data']['php'] as $message) {
            ?>
			<li><?php 
            echo $message;
            ?>
</li>
		<?php 
        }
        ?>
		</ol>
		</div>
	<?php 
    }
    if (isset($_POST['data']['dirty_enqueues']) && count($_POST['data']['dirty_enqueues'])) {
        ?>
		<div>
		<img class="alignleft" alt="" src="<?php 
        echo CSP_PO_BASE_URL . "/images/wordpress.gif";
        ?>
" />
		<strong style="color:#800;"><?php 
        _e('Malfunction at admin script core detected !', CSP_PO_TEXTDOMAIN);
        ?>
</strong><br/>
		<?php 
        _e('Reason:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('misplaced core file(s) enqueued', CSP_PO_TEXTDOMAIN);
        ?>
</strong> | 
		<?php 
        _e('Polluter:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('unknown', CSP_PO_TEXTDOMAIN);
        ?>
</strong> <small>(<?php 
        _e('probably by Theme or Plugin', CSP_PO_TEXTDOMAIN);
        ?>
)</small><br/>
		<?php 
        _e('Below listed scripts has been dequeued because of injection:', CSP_PO_TEXTDOMAIN);
        ?>
<br/>
		<ol>
		<?php 
        foreach ($_POST['data']['dirty_enqueues'] as $script) {
            ?>
			<li><?php 
            echo strip_tags($script);
            ?>
</li>
		<?php 
        }
        ?>
		</ol>
		</div>
	<?php 
    }
    if (isset($_POST['data']['dirty_theme']) && count($_POST['data']['dirty_theme'])) {
        $ct = function_exists('wp_get_theme') ? wp_get_theme() : current_theme_info();
        ?>
		<div>
		<img class="alignleft" alt="" src="<?php 
        echo CSP_PO_BASE_URL . "/images/themes.gif";
        ?>
" />
		<strong style="color:#800;"><?php 
        _e('Malfunction at current Theme detected!', CSP_PO_TEXTDOMAIN);
        ?>
</strong><br/>
		<?php 
        _e('Name:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        echo $ct->name;
        ?>
</strong> | 
		<?php 
        _e('Author:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        echo $ct->author;
        ?>
</strong><br/>
		<?php 
        _e('Below listed scripts has been automatically stripped because of injection:', CSP_PO_TEXTDOMAIN);
        ?>
<br/>
		<ol>
		<?php 
        foreach ($_POST['data']['dirty_theme'] as $script) {
            ?>
			<li><?php 
            echo strip_tags($script);
            ?>
</li>
		<?php 
        }
        ?>
		</ol>
		</div>
	<?php 
    }
    if (isset($_POST['data']['dirty_plugins']) && count($_POST['data']['dirty_plugins'])) {
        //WARNING: Plugin handling is not well coded by WordPress core
        $err = error_reporting(0);
        $plugs = get_plugins();
        error_reporting($err);
        foreach ($plugs as $slug => $data) {
            list($slug) = explode('/', $slug);
            $affected = array();
            foreach ($_POST['data']['dirty_plugins'] as $script) {
                if (stripos($script, $slug) !== false) {
                    $affected[] = $script;
                }
            }
            if (count($affected) == 0) {
                continue;
            }
            ?>
		<div>
		<img class="alignleft" alt="" src="<?php 
            echo CSP_PO_BASE_URL . "/images/plugins.gif";
            ?>
" />
		<strong style="color:#800;"><?php 
            _e('Malfunction at 3rd party Plugin detected!', CSP_PO_TEXTDOMAIN);
            ?>
</strong><br/>
		<?php 
            _e('Name:', CSP_PO_TEXTDOMAIN);
            ?>
 <strong><?php 
            echo $data['Name'];
            ?>
</strong> | 
		<?php 
            _e('Author:', CSP_PO_TEXTDOMAIN);
            ?>
 <strong><?php 
            echo $data['Author'];
            ?>
</strong><br/>
		<?php 
            _e('Below listed scripts has been automatically stripped because of injection:', CSP_PO_TEXTDOMAIN);
            ?>
<br/>
		<ol>
		<?php 
            foreach ($affected as $script) {
                ?>
			<li><?php 
                echo strip_tags($script);
                ?>
</li>
		<?php 
            }
            ?>
		</ol>
		</div>
		<?php 
        }
        ?>
	<?php 
    }
    if (isset($_POST['data']['runtime']) && count($_POST['data']['runtime'])) {
        ?>
		<div>
		<img class="alignleft" alt="" src="<?php 
        echo CSP_PO_BASE_URL . "/images/badscript.png";
        ?>
" />
		<strong style="color:#800;"><?php 
        _e('Malfunction at 3rd party inlined Javascript(s) detected!', CSP_PO_TEXTDOMAIN);
        ?>
</strong><br/>
		<?php 
        _e('Reason:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('javascript runtime exception', CSP_PO_TEXTDOMAIN);
        ?>
</strong> | 
		<?php 
        _e('Polluter:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('unknown', CSP_PO_TEXTDOMAIN);
        ?>
</strong><br/>
		<?php 
        _e('Below listed exception(s) has been caught and traced:', CSP_PO_TEXTDOMAIN);
        ?>
<br/>
		<ol>
		<?php 
        foreach ($_POST['data']['runtime'] as $script) {
            ?>
			<li><?php 
            echo strip_tags(stripslashes($script));
            ?>
</li>
		<?php 
        }
        ?>
		</ol>
		</div>
	<?php 
    }
    ?>
	
<?php 
    if (isset($_POST['data']['externals']) && isset($_POST['data']['externals']['dubious']) && count($_POST['data']['externals']['dubious']['tokens'])) {
        $errors = 0;
        ?>
		<div>
		<img class="alignleft" alt="" src="<?php 
        echo CSP_PO_BASE_URL . "/images/dubious-scripts.png";
        ?>
" />
		<strong style="color:#800;"><?php 
        _e('Malfunction at dubious external scripts detected !', CSP_PO_TEXTDOMAIN);
        ?>
</strong><br/>
		<?php 
        _e('Reason:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('unknown external script has been enqueued or hardly attached.', CSP_PO_TEXTDOMAIN);
        ?>
</strong> | 
		<?php 
        _e('Polluter:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('unknown', CSP_PO_TEXTDOMAIN);
        ?>
</strong> <small>(<?php 
        _e('probably by Theme or Plugin', CSP_PO_TEXTDOMAIN);
        ?>
)</small><br/>
		<?php 
        _e('Below listed external scripts have been traced, verified and automatically stripped because of injection:', CSP_PO_TEXTDOMAIN);
        ?>
<br/>
		<ol>
		<?php 
        for ($i = 0; $i < count($_POST['data']['externals']['dubious']['tokens']); $i++) {
            $token = $_POST['data']['externals']['dubious']['tokens'][$i];
            $script = $_POST['data']['externals']['dubious']['scripts'][$i];
            $res = wp_remote_head($script, array('sslverify' => false));
            $style = $res === false || is_object($res) && get_class($res) == 'WP_Error' || $res['response']['code'] != 200 ? ' style="color: #800;"' : '';
            if (!empty($style)) {
                $errors += 1;
            }
            ?>
			<li<?php 
            echo $style;
            ?>
>[<strong><?php 
            echo strip_tags(stripslashes($token));
            ?>
</strong>] - <span class="cdn-file"><?php 
            echo strip_tags(stripslashes($script));
            ?>
</span> <img src="<?php 
            echo CSP_PO_BASE_URL . "/images/status-" . (empty($style) ? '200' : '404') . '.gif';
            ?>
" /></li>
		<?php 
        }
        ?>
		</ol>
		<?php 
        if ($errors > 0) {
            ?>
		<p style="color:#800;font-weight:bold;"><?php 
            $text = sprintf(_n('%d file', '%d files', $errors, CSP_PO_TEXTDOMAIN), $errors);
            echo sprintf(__('This page will not work as expected because %s could not be get from CDN. Check and update the Plugin doing your CDN redirection!', CSP_PO_TEXTDOMAIN), $text);
            ?>
</p>
		<?php 
        }
        ?>
		</div>
	<?php 
    }
    ?>
		
<?php 
    if (isset($_POST['data']['externals']) && isset($_POST['data']['externals']['cdn']) && count($_POST['data']['externals']['cdn']['tokens'])) {
        $errors = 0;
        ?>
		<div style="border-top: 1px dashed gray; padding-top: 10px;">
		<img class="alignleft" alt="" src="<?php 
        echo CSP_PO_BASE_URL . "/images/cdn-scripts.png";
        ?>
" />
		<strong style="color:#008;"><?php 
        _e('CDN based script loading redirection detected!', CSP_PO_TEXTDOMAIN);
        ?>
</strong><br/>
		<?php 
        _e('Warning:', CSP_PO_TEXTDOMAIN);
        ?>
 <strong><?php 
        _e('may break the dependency script loading feature within WordPress core files.', CSP_PO_TEXTDOMAIN);
        ?>
</strong><br/>
		<?php 
        _e('Below listed redirects have been traced and verified but not revoked:', CSP_PO_TEXTDOMAIN);
        ?>
<br/>
		<ol>
		<?php 
        for ($i = 0; $i < count($_POST['data']['externals']['cdn']['tokens']); $i++) {
            $token = $_POST['data']['externals']['cdn']['tokens'][$i];
            $script = $_POST['data']['externals']['cdn']['scripts'][$i];
            $res = wp_remote_head($script, array('sslverify' => false));
            $style = $res === false || is_object($res) && get_class($res) == 'WP_Error' || $res['response']['code'] != 200 ? ' style="color: #800;"' : '';
            if (!empty($style)) {
                $errors += 1;
            }
            ?>
			<li<?php 
            echo $style;
            ?>
>[<strong><?php 
            echo strip_tags(stripslashes($token));
            ?>
</strong>] - <span class="cdn-file"><?php 
            echo strip_tags(stripslashes($script));
            ?>
</span> <img src="<?php 
            echo CSP_PO_BASE_URL . "/images/status-" . (empty($style) ? '200' : '404') . '.gif';
            ?>
" /></li>
		<?php 
        }
        ?>
		</ol>
		<?php 
        if ($errors > 0) {
            ?>
		<p style="color:#800;font-weight:bold;"><?php 
            $text = sprintf(_n('%d file', '%d files', $errors, CSP_PO_TEXTDOMAIN), $errors);
            echo sprintf(__('This page will not work as expected because %s could not be get from CDN. Check and update the Plugin doing your CDN redirection!', CSP_PO_TEXTDOMAIN), $text);
            ?>
</p>
		<?php 
        }
        ?>
		</div>
	<?php 
    }
    ?>
		
</div>
<?php 
    exit;
}
示例#18
0
function freshy_theme_page()
{
    global $freshy_options;
    $freshy_options = get_option('freshy_options');
    if ($_GET['page'] == basename(__FILE__)) {
        if (isset($_POST['freshy_options_update'])) {
            $freshy_updated_options = array();
            $freshy_updated_options = $_POST;
            update_option('nt_file', $freshy_updated_options['theme']);
            // menus
            $freshy_updated_options['custom_menus'] = $freshy_options['custom_menus'];
            if (isset($freshy_updated_options['custom_menus_delete'])) {
                $i = array_shift(array_keys($freshy_updated_options['custom_menus_delete']));
                unset($freshy_updated_options['custom_menus'][$i]);
            }
            if ($freshy_updated_options['new_custom_menu_label'] != '') {
                if (!is_array($freshy_updated_options['custom_menus'])) {
                    $freshy_updated_options['custom_menus'] = array();
                }
                $tmp = array();
                $tmp['label'] = $freshy_updated_options['new_custom_menu_label'];
                $tmp['url'] = $freshy_updated_options['new_custom_menu_url'];
                array_push($freshy_updated_options['custom_menus'], $tmp);
            }
            // quick links
            $freshy_updated_options['custom_quicklinks'] = $freshy_options['custom_quicklinks'];
            if (isset($freshy_updated_options['custom_quicklinks_delete'])) {
                $i = array_shift(array_keys($freshy_updated_options['custom_quicklinks_delete']));
                unset($freshy_updated_options['custom_quicklinks'][$i]);
            }
            if ($freshy_updated_options['new_custom_quicklink_label'] != '') {
                if (!is_array($freshy_updated_options['custom_quicklinks'])) {
                    $freshy_updated_options['custom_quicklinks'] = array();
                }
                $tmp = array();
                $tmp['label'] = $freshy_updated_options['new_custom_quicklink_label'];
                $tmp['url'] = $freshy_updated_options['new_custom_quicklink_url'];
                array_push($freshy_updated_options['custom_quicklinks'], $tmp);
            }
            update_option('freshy_options', $freshy_updated_options);
            $freshy_options = get_option('freshy_options');
            print '<div class="updated"><p>' . __('Freshy options updated.', TEMPLATE_DOMAIN) . '</p></div>';
        }
        print '<div class="wrap">
		<h2>' . __('Freshy Options', TEMPLATE_DOMAIN) . '</h2>
		
		<form name="freshy_options_form" method="post">
		<input type="hidden" name="freshy_options_update" value="update" />
		
		<table class="form-table">';
        ?>
			<tr>
				<th scope="row">
					<label for="theme"><?php 
        _e('Choose a custom style :', TEMPLATE_DOMAIN);
        ?>
</label>
				</th>
				<td>
					<select id="theme" name="theme">
						<?php 
        $theme_info = current_theme_info();
        $path = WP_CONTENT_DIR . $theme_info->template_dir . '/';
        $themes = freshy_list_files(TEMPLATEPATH, 'custom_', array('custom_template.css'));
        print '<option value="custom_template.css"';
        if (get_option('nt_file') == "custom_template.css") {
            print ' selected="selected"';
        }
        print '>' . __('Default style', 'customize') . '</option>';
        foreach ($themes as $theme) {
            print '<option value="' . $theme . '"';
            if (get_option('nt_file') == $theme) {
                print ' selected="selected"';
            }
            print '>' . $theme . '</option>';
        }
        ?>
					</select>
				</td>
			</tr>
		<?php 
        print '<tr valign="top"><td colspan="2"><h3>' . __('Layout :', TEMPLATE_DOMAIN) . '</h3></td></tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Display left sidebar', TEMPLATE_DOMAIN) . '</label>
				</th>
				<td>
					<input type="checkbox" class="form-checkbox" ';
        if ($freshy_options['sidebar_left'] == 1) {
            print 'checked="checked" ';
        }
        print 'value="1" id="edit-sidebar-left" name="sidebar_left"/>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Display right sidebar', TEMPLATE_DOMAIN) . '</label>
				</th>
				<td>
					<input type="checkbox" class="form-checkbox" ';
        if ($freshy_options['sidebar_right'] == 1) {
            print 'checked="checked" ';
        }
        print 'value="1" id="edit-sidebar-right" name="sidebar_right"/>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Hide left sidebar on these posts', TEMPLATE_DOMAIN) . '</label>
				</th>
				<td>
					<input type="text" name="hide_sidebar_left_posts" value="' . $freshy_options['hide_sidebar_left_posts'] . '"/>
					<span class="setting-description">' . __('Enter posts ids separated by commas', TEMPLATE_DOMAIN) . '</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Hide right sidebar on these posts', TEMPLATE_DOMAIN) . '</label>
				</th>
				<td>
					<input type="text" name="hide_sidebar_posts" value="' . $freshy_options['hide_sidebar_posts'] . '"/>
					<span class="setting-description">' . __('Enter posts ids separated by commas', TEMPLATE_DOMAIN) . '</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Navigation menu behaviour', TEMPLATE_DOMAIN) . '</label>
				</th>
				<td>					
					<label for="menu_type_auto"><input name="menu_type" id="menu_type_auto" type="radio" value="auto" ';
        if ($freshy_options['menu_type'] == 'auto') {
            print 'checked="checked" ';
        }
        print '/> ' . __('Auto : Display subpages on pages and blog categories in blog', TEMPLATE_DOMAIN) . '</label>
					<br/>
					<label for="menu_type_normal"><input name="menu_type" id="menu_type_normal" type="radio" value="normal" ';
        if ($freshy_options['menu_type'] == 'normal') {
            print 'checked="checked" ';
        }
        print '/> ' . __('Normal : Always display categories and pages', TEMPLATE_DOMAIN) . '</label>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Navigation menu rss', TEMPLATE_DOMAIN) . '</label>
				</th>
				<td>					
					<label for="menu_rss_true"><input name="menu_rss" id="menu_rss_true" type="radio" value="1" ';
        if ($freshy_options['menu_rss'] == 1) {
            print 'checked="checked" ';
        }
        print '/> ' . __('Display rss icon with categories', TEMPLATE_DOMAIN) . '</label>
					<br/>
					<label for="menu_rss_false"><input name="menu_rss" id="menu_rss_false" type="radio" value="0" ';
        if ($freshy_options['menu_rss'] == 0) {
            print 'checked="checked" ';
        }
        print '/> ' . __('Do not display rss icon with categories', TEMPLATE_DOMAIN) . '</label>
				</td>
			</tr>
			<tr valign="top"><td colspan="2"><h3>' . __('Date options :', TEMPLATE_DOMAIN) . '</h3>
				<small>' . __('You can change date formatting in', TEMPLATE_DOMAIN) . ' <a href="options-general.php">Settings &gt; General</a></small>		
			</td></tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Show date on posts', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<input type="checkbox" class="form-checkbox" ';
        if ($freshy_options['date'] == 1) {
            print 'checked="checked" ';
        }
        print 'value="1" id="edit-date" name="date"/>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Show time on posts', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<input type="checkbox" class="form-checkbox" ';
        if ($freshy_options['time'] == 1) {
            print 'checked="checked" ';
        }
        print 'value="1" id="edit-time" name="time"/>
				</td>
			</tr>
			<tr valign="top"><td colspan="2"><h3>' . __('Other options :', TEMPLATE_DOMAIN) . '</h3></td></tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Show author on posts', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<input type="checkbox" class="form-checkbox" ';
        if ($freshy_options['author'] == 1) {
            print 'checked="checked" ';
        }
        print 'value="1" id="edit-author" name="author"/>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Show search in header', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<input type="checkbox" class="form-checkbox" ';
        if ($freshy_options['header_search'] == 1) {
            print 'checked="checked" ';
        }
        print 'value="1" id="edit-header-search" name="header_search"/>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Show RSS icon in header', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<input type="checkbox" class="form-checkbox" ';
        if ($freshy_options['header_rss'] == 1) {
            print 'checked="checked" ';
        }
        print 'value="1" id="edit-header-rss" name="header_rss"/>
				</td>
			</tr>
			<tr valign="top"><td colspan="2"><h3>' . __('Menu :', TEMPLATE_DOMAIN) . '</h3></td></tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Enter the label of the Homepage menu link', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<input name="first_menu_label" type="text" value="' . $freshy_options['first_menu_label'] . '"/>
					<span class="setting-description">' . __('Modifying these labels should break internationalisation', TEMPLATE_DOMAIN) . '</span>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('Enter the label of the last menu link', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<input name="last_menu_label" type="text" value="' . $freshy_options['last_menu_label'] . '"/>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row">
					<label>' . __('The last menu link should be...', TEMPLATE_DOMAIN) . '</label>
				</th>
				<td>					
					<label for="last_menu_type_email"><input name="last_menu_type" id="last_menu_type_email" type="radio" value="email" ';
        if ($freshy_options['last_menu_type'] == 'email') {
            print 'checked="checked" ';
        }
        print '/> ' . __('A contact button to this email', TEMPLATE_DOMAIN) . ' :</label>
					<input name="contact_email" type="text" value="' . $freshy_options['contact_email'] . '"/>

					<br/>
					
					<label for="last_menu_type_link"><input name="last_menu_type" id="last_menu_type_link" type="radio" value="link" ';
        if ($freshy_options['last_menu_type'] == 'link') {
            print 'checked="checked" ';
        }
        print '/> ' . __('A custom link with this url', TEMPLATE_DOMAIN) . ' :</label>
					<input name="contact_link" type="text" value="' . $freshy_options['contact_link'] . '"/>
						
					<br/>
												
					<label for="last_menu_type_none"><input name="last_menu_type" id="last_menu_type_none" type="radio" value="" ';
        if ($freshy_options['last_menu_type'] == '') {
            print 'checked="checked" ';
        }
        print '/> ' . __('Nothing', TEMPLATE_DOMAIN) . '</label>
				</td>
			</tr>
			<tr valign="top"><td colspan="2"><h3>' . __('Custom menus :', TEMPLATE_DOMAIN) . '</h3></td></tr>';
        if (is_array($freshy_options['custom_menus'])) {
            foreach ($freshy_options['custom_menus'] as $i => $custom_menu) {
                print '<tr valign="top">
					<th scope="row" style="text-align:right">
						<label><a href="' . $custom_menu['url'] . '">' . $custom_menu['label'] . '</a>
					</th>
					<td>
						<input type="submit" name="custom_menus_delete[' . $i . ']" value="' . __('Delete') . '"/>
					</td>
				</tr>';
            }
        }
        print '<tr valign="top">
				<th scope="row">
					<label>' . __('New custom menu entry', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<label>' . __('label', TEMPLATE_DOMAIN) . ' :</label> <input name="new_custom_menu_label" type="text" value=""/><br/>
					<label>' . __('url', TEMPLATE_DOMAIN) . ' :</label> <input name="new_custom_menu_url" type="text" value=""/>
				</td>
			</tr>
			<tr valign="top"><td colspan="2"><h3>' . __('Custom quicklinks :', TEMPLATE_DOMAIN) . '</h3></td></tr>';
        if (is_array($freshy_options['custom_quicklinks'])) {
            foreach ($freshy_options['custom_quicklinks'] as $i => $custom_quicklink) {
                print '<tr valign="top">
					<th scope="row" style="text-align:right">
						<label><a href="' . $custom_quicklink['url'] . '">' . $custom_quicklink['label'] . '</a> 
					</th>
					<td>
						<input type="submit" name="custom_quicklinks_delete[' . $i . ']" value="' . __('Delete') . '"/>
					</td>
				</tr>';
            }
        }
        print '<tr valign="top">
				<th scope="row">
					<label>' . __('New custom quicklink entry', TEMPLATE_DOMAIN) . ' </label>
				</th>
				<td>
					<label>' . __('label', TEMPLATE_DOMAIN) . ' :</label> <input name="new_custom_quicklink_label" type="text" value=""/><br/>
					<label>' . __('url', TEMPLATE_DOMAIN) . ' :</label> <input name="new_custom_quicklink_url" type="text" value=""/>
				</td>
			</tr>
		</table>
						
		<p class="submit"><input type="submit" name="Submit" value="' . __('Update Options &raquo;', TEMPLATE_DOMAIN) . '"/></p>
		</form>
		</div>
		';
        /*
        		print '
        		<div id="preview" class="wrap">
        		<h2 id="preview-post">'.__('Preview').' <small>('.__('updated when options are saved - attention : changes you make take effect immediately on the site !').')</small></h2>
        		<iframe src="../?preview=true" width="100%" height="600" ></iframe>
        		</div>
        		';*/
    }
}
示例#19
0
function wpmp_switcher_desktop_theme()
{
    $info = current_theme_info();
    return $info->title;
}
/**
 * Verify that some BP prerequisites are set up properly, and notify the admin if not
 *
 * On every Dashboard page, this function checks the following:
 *   - that pretty permalinks are enabled
 *   - that a BP-compatible theme is activated
 *   - that every BP component that needs a nxt page for a directory has one
 *   - that no nxt page has multiple BP components associated with it
 * The administrator will be shown a notice for each check that fails.
 *
 * @package BuddyPress Core
 */
function bp_core_activation_notice()
{
    global $nxt_rewrite, $nxtdb, $bp;
    // Only the super admin gets warnings
    if (!is_super_admin()) {
        return;
    }
    // On multisite installs, don't load on a non-root blog, unless do_network_admin is
    // overridden
    if (is_multisite() && bp_core_do_network_admin() && !bp_is_root_blog()) {
        return;
    }
    // Don't show these messages during setup or upgrade
    if (isset($bp->maintenance_mode)) {
        return;
    }
    /**
     * Check to make sure that the blog setup routine has run. This can't happen during the
     * wizard because of the order which the components are loaded. We check for multisite here
     * on the off chance that someone has activated the blogs component and then disabled MS
     */
    if (bp_is_active('blogs')) {
        $count = $nxtdb->get_var($nxtdb->prepare("SELECT COUNT(*) FROM {$bp->blogs->table_name}"));
        if (!$count) {
            bp_blogs_record_existing_blogs();
        }
    }
    /**
     * Are pretty permalinks enabled?
     */
    if (isset($_POST['permalink_structure'])) {
        return false;
    }
    if (empty($nxt_rewrite->permalink_structure)) {
        bp_core_add_admin_notice(sprintf(__('<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress'), admin_url('options-permalink.php')));
    }
    /**
     * Are you using a BP-compatible theme?
     */
    // Get current theme info
    $ct = current_theme_info();
    // The best way to remove this notice is to add a "buddypress" tag to
    // your active theme's CSS header.
    if (!defined('BP_SILENCE_THEME_NOTICE') && !in_array('buddypress', (array) $ct->tags)) {
        bp_core_add_admin_notice(sprintf(__("You'll need to <a href='%s'>activate a <strong>BuddyPress-compatible theme</strong></a> to take advantage of all of BuddyPress's features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>update your existing NXTClass theme</a>.", 'buddypress'), admin_url('themes.php'), network_admin_url('theme-install.php?type=tag&s=buddypress&tab=search'), network_admin_url('plugin-install.php?type=term&tab=search&s=%22bp-template-pack%22')));
    }
    /**
     * Check for orphaned BP components (BP component is enabled, no nxt page exists)
     */
    $orphaned_components = array();
    $nxt_page_components = array();
    // Only components with 'has_directory' require a nxt page to function
    foreach ($bp->loaded_components as $component_id => $is_active) {
        if (!empty($bp->{$component_id}->has_directory)) {
            $nxt_page_components[] = array('id' => $component_id, 'name' => isset($bp->{$component_id}->name) ? $bp->{$component_id}->name : ucwords($bp->{$component_id}->id));
        }
    }
    // Activate and Register are special cases. They are not components but they need nxt pages.
    // If user registration is disabled, we can skip this step.
    if (bp_get_signup_allowed()) {
        $nxt_page_components[] = array('id' => 'activate', 'name' => __('Activate', 'buddypress'));
        $nxt_page_components[] = array('id' => 'register', 'name' => __('Register', 'buddypress'));
    }
    foreach ($nxt_page_components as $component) {
        if (!isset($bp->pages->{$component['id']})) {
            $orphaned_components[] = $component['name'];
        }
    }
    if (!empty($orphaned_components)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('The following active BuddyPress Components do not have associated NXTClass Pages: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress'), $admin_url, '<strong>' . implode('</strong>, <strong>', $orphaned_components) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
    /**
     * BP components cannot share a single nxt page. Check for duplicate assignments, and post
     * a message if found.
     */
    $dupe_names = array();
    $page_ids = (array) bp_core_get_directory_page_ids();
    $dupes = array_diff_assoc($page_ids, array_unique($page_ids));
    if (!empty($dupes)) {
        foreach ($dupes as $dupe_component => $dupe_id) {
            $dupe_names[] = $bp->pages->{$dupe_component}->title;
        }
        // Make sure that there are no duplicate duplicates :)
        $dupe_names = array_unique($dupe_names);
    }
    // If there are duplicates, post a message about them
    if (!empty($dupe_names)) {
        $admin_url = bp_get_admin_url(add_query_arg(array('page' => 'bp-page-settings'), 'admin.php'));
        $notice = sprintf(__('Each BuddyPress Component needs its own NXTClass page. The following NXTClass Pages have more than one component associated with them: %2$s. <a href="%1$s" class="button-secondary">Repair</a>', 'buddypress'), $admin_url, '<strong>' . implode('</strong>, <strong>', $dupe_names) . '</strong>');
        bp_core_add_admin_notice($notice);
    }
}
/**
 * Displays a welcome panel to introduce users to WordPress.
 *
 * @since 3.3
 */
function wp_welcome_panel()
{
    global $wp_version;
    if (!current_user_can('edit_theme_options')) {
        return;
    }
    $classes = 'welcome-panel';
    $option = get_user_meta(get_current_user_id(), 'show_welcome_panel', true);
    // 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
    $hide = 0 == $option || 2 == $option && wp_get_current_user()->user_email != get_option('admin_email');
    if ($hide) {
        $classes .= ' hidden';
    }
    list($display_version) = explode('-', $wp_version);
    ?>
	<div id="welcome-panel" class="<?php 
    echo esc_attr($classes);
    ?>
">
	<?php 
    wp_nonce_field('welcome-panel-nonce', 'welcomepanelnonce', false);
    ?>
	<a class="welcome-panel-close" href="<?php 
    echo esc_url(admin_url('?welcome=0'));
    ?>
"><?php 
    _e('Dismiss');
    ?>
</a>
	<div class="wp-badge"><?php 
    printf(__('Version %s'), $display_version);
    ?>
</div>

	<div class="welcome-panel-content">
	<h3><?php 
    _e('Welcome to your new WordPress site! ');
    ?>
</h3>
	<p class="about-description"><?php 
    _e('If you need help getting started, check out our documentation on <a href="http://codex.wordpress.org/First_Steps_With_WordPress">First Steps with WordPress</a>. If you&#8217;d rather dive right in, here are a few things most people do first when they set up a new WordPress site. If you need help, use the Help tabs in the upper right corner to get information on how to use your current screen and where to go for more assistance.');
    ?>
</p>
	<div class="welcome-panel-column-container">
	<div class="welcome-panel-column">
		<h4><span class="icon16 icon-settings"></span> <?php 
    _e('Basic Settings');
    ?>
</h4>
		<p><?php 
    _e('Here are a few easy things you can do to get your feet wet. Make sure to click Save on each Settings screen.');
    ?>
</p>
		<ul>
		<li><?php 
    echo sprintf(__('<a href="%s">Choose your privacy setting</a>'), esc_url(admin_url('options-privacy.php')));
    ?>
</li>
		<li><?php 
    echo sprintf(__('<a href="%s">Select your tagline and time zone</a>'), esc_url(admin_url('options-general.php')));
    ?>
</li>
		<li><?php 
    echo sprintf(__('<a href="%s">Turn comments on or off</a>'), esc_url(admin_url('options-discussion.php')));
    ?>
</li>
		<li><?php 
    echo sprintf(__('<a href="%s">Fill in your profile</a>'), esc_url(admin_url('profile.php')));
    ?>
</li>
		</ul>
	</div>
	<div class="welcome-panel-column">
		<h4><span class="icon16 icon-page"></span> <?php 
    _e('Add Real Content');
    ?>
</h4>
		<p><?php 
    _e('Check out the sample page & post editors to see how it all works, then delete the default content and write your own!');
    ?>
</p>
		<ul>
		<li><?php 
    echo sprintf(__('View the <a href="%1$s">sample page</a> and <a href="%2$s">post</a>'), esc_url(get_permalink(2)), esc_url(get_permalink(1)));
    ?>
</li>
		<li><?php 
    echo sprintf(__('Delete the <a href="%1$s">sample page</a> and <a href="%2$s">post</a>'), esc_url(admin_url('edit.php?post_type=page')), esc_url(admin_url('edit.php')));
    ?>
</li>
		<li><?php 
    echo sprintf(__('<a href="%s">Create an About Me page</a>'), esc_url(admin_url('edit.php?post_type=page')));
    ?>
</li>
		<li><?php 
    echo sprintf(__('<a href="%s">Write your first post</a>'), esc_url(admin_url('post-new.php')));
    ?>
</li>
		</ul>
	</div>
	<div class="welcome-panel-column welcome-panel-last">
		<h4><span class="icon16 icon-appearance"></span> <?php 
    _e('Customize Your Site');
    ?>
</h4>
		<?php 
    $ct = current_theme_info();
    if (empty($ct->stylesheet_dir)) {
        echo '<p>';
        printf(__('<a href="%s">Install a theme</a> to get started customizing your site.'), esc_url(admin_url('themes.php')));
        echo '</p>';
    } else {
        $customize_links = array();
        if ('twentyeleven' == $ct->stylesheet) {
            $customize_links[] = sprintf(__('<a href="%s">Choose light or dark</a>'), esc_url(admin_url('themes.php?page=theme_options')));
        }
        if (current_theme_supports('custom-background')) {
            $customize_links[] = sprintf(__('<a href="%s">Set a background color</a>'), esc_url(admin_url('themes.php?page=custom-background')));
        }
        if (current_theme_supports('custom-header')) {
            $customize_links[] = sprintf(__('<a href="%s">Select a new header image</a>'), esc_url(admin_url('themes.php?page=custom-header')));
        }
        if (current_theme_supports('widgets')) {
            $customize_links[] = sprintf(__('<a href="%s">Add some widgets</a>'), esc_url(admin_url('widgets.php')));
        }
        if (!empty($customize_links)) {
            echo '<p>';
            printf(__('Use the current theme &mdash; %1$s &mdash; or <a href="%2$s">choose a new one</a>. If you stick with %3$s, here are a few ways to make your site look unique.'), $ct->title, esc_url(admin_url('themes.php')), $ct->title);
            echo '</p>';
            ?>
			<ul>
				<?php 
            foreach ($customize_links as $customize_link) {
                ?>
				<li><?php 
                echo $customize_link;
                ?>
</li>
				<?php 
            }
            ?>
			</ul>
			<?php 
        } else {
            echo '<p>';
            printf(__('Use the current theme &mdash; %1$s &mdash; or <a href="%2$s">choose a new one</a>.'), $ct->title, esc_url(admin_url('themes.php')));
            echo '</p>';
        }
    }
    ?>
	</div>
	</div>
	<p class="welcome-panel-dismiss"><?php 
    printf(__('Already know what you&#8217;re doing? <a href="%s">Dismiss this message</a>.'), esc_url(admin_url('?welcome=0')));
    ?>
</p>
	</div>
	</div>
	<?php 
}
示例#22
0
	 function cets_blog_defaults_management_page(){
	 	// Display the defaults that can be set by site admins
	 
	 	global $wpdb;
		
		// only allow site admins to come here.
		if( is_super_admin() == false ) {
			wp_die( __('You do not have permission to access this page.') );
		}
		
		/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
		$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
		
		
		// process form submission    	
    	if (isset($_POST['action']) && $_POST['action'] == 'update') {
			$this->update_defaults($_POST);
			$updated = true;
    	}
		
		// make sure we're using latest data
		$opt = get_site_option('cets_blog_defaults_options');
		
    	if (isset($updated) && $updated) { ?>
        <div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div>
        <?php	} ?>
        
        <h1>New Blog Defaults</h1>
        <form name="blogdefaultsform" action="" method="post">
        <p>Set the defaults for new blog creation. Note that these defaults can still be over-ridden by blog owners.</p>
        <div class="wrap">
        <h2><?php _e('General Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog Title') ?></th>
        <td><input name="blogname" type="text" id="blogname" value="<?php echo($opt['blogname']); ?>" size="40" /><br/>
        <input type="checkbox" name="blogname_flag" value="1" <?php checked('1', $opt[blogname_flag]) ?> /> <?php _e("I understand this will overwrite the user's chosen blog name from the setup page.") ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Tagline') ?></th>
        <td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php echo($opt['blogdescription']); ?>" size="45" />
        <br />
        <?php _e('In a few words, explain what this blog is about.') ?></td>
        </tr>
		
<!-- Begin Time Zone -->
		<tr>
		<?php
		$current_offset = $opt['gmt_offset'];
		$tzstring = $opt['timezone_string'];
		
		$check_zone_info = true;
		
		// Remove old Etc mappings.  Fallback to gmt_offset.
		if ( false !== strpos($tzstring,'Etc/GMT') )
			$tzstring = '';
		
		if (empty($tzstring)) { // set the Etc zone if no timezone string exists
			$check_zone_info = false;
			if ( 0 == $current_offset )
				$tzstring = 'UTC+0';
			elseif ($current_offset < 0)
				$tzstring = 'UTC' . $current_offset;
			else
				$tzstring = 'UTC+' . $current_offset;
		}
		
		?>
		<th scope="row"><label for="timezone_string"><?php _e('Timezone') ?></label></th>
		<td>
		
		<select id="timezone_string" name="timezone_string">
		<?php echo wp_timezone_choice($tzstring); ?>
		</select>
		
		    <span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
		<?php if ($opt['timezone_string']) : ?>
			<span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
		<?php endif; ?>
		<br />
		<span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
		<br />
		<span>
		<?php if ($check_zone_info && $tzstring) : ?>
			<?php
			$now = localtime(time(),true);
			if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
			else _e('This timezone is currently in standard time.');
			?>
			<br />
			<?php
			
			if (function_exists('timezone_transitions_get')) {
				$dateTimeZoneSelected = new DateTimeZone($tzstring);
				foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
					if ($tr['ts'] > time()) {
					    $found = true;
						break;
					}
				}
		
				if ( isset($found) && $found === true ) {
					echo ' ';
					$message = $tr['isdst'] ?
						__('Daylight savings time begins on: <code>%s</code>.') :
						__('Standard time begins  on: <code>%s</code>.');
					printf( $message, date_i18n($opt['date_format'].' '. $opt['time_format'], $tr['ts'] ) );
				} else {
					_e('This timezone does not observe daylight savings time.');
				}
			}
			
			?>
			</span>
		<?php endif; ?>
		</td>
		
		
		</tr>

<!-- End Time Zone -->
	
	
	
		
        <tr>
        <th scope="row"><?php _e('Date Format') ?></th>
        <td>
			<fieldset><legend class="screen-reader-text"><span><?php _e('Date Format') ?></span></legend>
<?php

	$date_formats = apply_filters( 'date_formats', array(
		__('F j, Y'),
		'Y/m/d',
		'm/d/Y',
		'd/m/Y',
	) );

	$custom = TRUE;

	foreach ( $date_formats as $format ) {
		echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='date_format' value='" . esc_attr($format) . "'";
		if ( $opt['date_format'] === $format ) { // checked() uses "==" rather than "==="
			echo " checked='checked'";
			$custom = FALSE;
		}
		echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
	}

	echo '	<label><input type="radio" name="date_format" id="date_format_custom_radio" value="custom"';
	checked( $custom );
	echo '/> ' . __('Custom:') . ' </label><input type="text" name="date_format_custom" value="' . esc_attr( $opt['date_format'] ) . '" class="small-text" /> ' . date_i18n( $opt['date_format'] ) . "\n";
	

	echo "\t<p>" . __('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click &#8220;Save Changes&#8221; to update sample output.') . "</p>\n";
?>
	</fieldset>


		</td>
        </tr>
        <tr>
        <th scope="row"><?php _e('Time Format') ?></th>
        <td>
		<fieldset><legend class="screen-reader-text"><span><?php _e('Time Format') ?></span></legend>
		<?php
		 
			$time_formats = apply_filters( 'time_formats', array(
				__('g:i a'),
				'g:i A',
				'H:i',
			) );
		
			$custom = TRUE;
		
			foreach ( $time_formats as $format ) {
				echo "\t<label title='" . esc_attr($format) . "'><input type='radio' name='time_format' value='" . esc_attr($format) . "'";
				if ( $opt['time_format'] === $format ) { // checked() uses "==" rather than "==="
					echo " checked='checked'";
					$custom = FALSE;
				}
				echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
			}
		
			echo '	<label><input type="radio" name="time_format" id="time_format_custom_radio" value="custom"';
			checked( $custom );
			echo '/> ' . __('Custom:') . ' </label><input type="text" name="time_format_custom" value="' . esc_attr( $opt['time_format'] ) . '" class="small-text" /> ' . date_i18n( $opt['time_format'] ) . "\n";
		?>
			</fieldset>



		</td>
        </tr>
        <tr>
        <th scope="row"><?php _e('Week Starts On') ?></th>
        <td>
        
        <select name="start_of_week" id="start_of_week">
        <?php
		global $wp_locale;
        for ($day_index = 0; $day_index <= 6; $day_index++) :
            $selected = ($opt['start_of_week'] == $day_index) ? 'selected="selected"' : '';
			
            echo "\n\t<option value='$day_index' $selected>" . $wp_locale->get_weekday($day_index) . '</option>';
        endfor;
        ?>
        </select></td>
        </tr>
        </table>
        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2><?php _e('Writing Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"> <?php _e('Size of the post box') ?></th>
        <td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php echo($opt['default_post_edit_rows']); ?>" size="3" />
        <?php _e('lines') ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Formatting') ?></th>
        <td>
        <label for="use_smilies">
        <input name="use_smilies" type="checkbox" id="use_smilies" value="1" <?php checked('1', $opt['use_smilies']); ?> />
        <?php _e('Convert emoticons like <code>:-)</code> and <code>:-P</code> to graphics on display') ?></label><br />
        <label for="use_balanceTags"><input name="use_balanceTags" type="checkbox" id="use_balanceTags" value="1" <?php checked('1', $opt['use_balanceTags']); ?> /> <?php _e('WordPress should correct invalidly nested XHTML automatically') ?></label>
        </td>
        </tr>
        
        </table>
		
		<h3><?php _e('Remote Publishing') ?></h3>
		<p><?php printf(__('To post to WordPress from a desktop blogging client or remote website that uses the Atom Publishing Protocol or one of the XML-RPC publishing interfaces you must enable them below.')) ?></p>
		<table class="form-table">
		<tr valign="top">
		<th scope="row"><?php _e('Atom Publishing Protocol') ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('Atom Publishing Protocol') ?></span></legend>
		<label for="enable_app">
		<input name="enable_app" type="checkbox" id="enable_app" value="1" <?php checked('1', $opt['enable_app']); ?> />
		<?php _e('Enable the Atom Publishing Protocol.') ?></label><br />
		</fieldset></td>
		</tr>
		<tr valign="top">
		<th scope="row"><?php _e('XML-RPC') ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('XML-RPC') ?></span></legend>
		<label for="enable_xmlrpc">
		<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1" <?php checked('1', $opt['enable_xmlrpc']); ?> />
		<?php _e('Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.') ?></label><br />
		</fieldset></td>
		</tr>
		</table>
      </div>
      
      <p>&nbsp;</p>
      <div class="wrap">
        <h2><?php _e('Reading Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog pages show at most') ?></th>
        <td>
        <input name="posts_per_page" type="text" id="posts_per_page" value="<?php echo($opt['posts_per_page']); ?>" size="3" /> <?php _e('posts') ?>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Syndication feeds show the most recent') ?></th>
        <td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php echo($opt['posts_per_rss']); ?>" size="3" /> <?php _e('posts') ?></td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('For each article in a feed, show') ?> </th>
        <td>
        <p><label><input name="rss_use_excerpt"  type="radio" value="0" <?php checked(0, $opt['rss_use_excerpt']); ?>	/> <?php _e('Full text') ?></label><br />
        <label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, $opt['rss_use_excerpt']); ?> /> <?php _e('Summary') ?></label></p>
        </td>
        </tr>
        
        <tr valign="top">
        <th scope="row"><?php _e('Encoding for pages and feeds') ?></th>
        <td><input name="blog_charset" type="text" id="blog_charset" value="<?php echo($opt['blog_charset']); ?>" size="20" class="code" /><br />
        <?php _e('The character encoding you write your blog in (UTF-8 is <a href="http://developer.apple.com/documentation/macos8/TextIntlSvcs/TextEncodingConversionManager/TEC1.5/TEC.b0.html">recommended</a>)') ?></td>
        </tr>
        </table>
        
        </div>
        
        
        <p>&nbsp;</p>
        <div class="wrap">     
    	<h2>Discussion Settings</h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Default article settings') ?></th>
        <td>
         <label for="default_pingback_flag">
		 
       <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php  if ($opt['default_pingback_flag'] == 1) echo('checked="checked"'); ?> /> <?php _e('Attempt to notify any blogs linked to from the article (slows down posting.)') ?> </label>
       
        <br /> 
		<label for="default_ping_status">
		
        <input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php if ($opt['default_ping_status'] == 'open') echo('checked="checked"'); ?> /> <?php _e('Allow link notifications from other blogs (pingbacks and trackbacks.)') ?></label>
       
        <br />
        <label for="default_comment_status">
		
        <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php if ($opt['default_comment_status'] == 'open') echo('checked="checked"'); ?> /> <?php _e('Allow people to post comments on the article') ?></label>
    
        <br />
        <small><em><?php echo '(' . __('These settings may be overridden for individual articles.') . ')'; ?></em></small>
        </td>
        </tr>
		<tr valign="top">
		<th scope="row"><?php _e('Other comment settings') ?></th>
		<td><fieldset><legend class="hidden"><?php _e('Other comment settings') ?></legend>
		
		<label for="require_name_email">
		
        <input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php if ($opt['require_name_email'] == 1) echo('checked="checked"'); ?> /> <?php _e('Comment author must fill out name and e-mail') ?></label>
		<br />
		<label for="comment_registration">
		<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', $opt['comment_registration']); ?> />
		<?php _e('Users must be registered and logged in to comment') ?>
		</label>
		<br />
		
		<label for="close_comments_for_old_posts">
		<input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', $opt['close_comments_for_old_posts']); ?> />
		<?php printf( __('Automatically close comments on articles older than %s days'), '</label><input name="close_comments_days_old" type="text" id="close_comments_days_old" value="' . esc_attr($opt['close_comments_days_old']) . '" class="small-text" />') ?>
		<br />
		<label for="thread_comments">
		<input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', $opt['thread_comments']); ?> />
		<?php
		
		$maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
		
		
		
		$thread_comments_depth = '</label><select name="thread_comments_depth" id="thread_comments_depth">';
		for ( $i = 1; $i <= $maxdeep; $i++ ) {
			$thread_comments_depth .= "<option value='$i'";
			if (isset($opt['thread_comments_depth']) && $opt['thread_comments_depth'] == $i ) $thread_comments_depth .= " selected='selected'";
			$thread_comments_depth .= ">$i</option>";
		}
		$thread_comments_depth .= '</select>';
		
		printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );
		
		?><br />
		<label for="page_comments">
		<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', $opt['page_comments']); ?> />
		<?php
		
		
		$default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
		if ( isset($opt['default_comments_page']) && 'newest' == $opt['default_comments_page'] ) $default_comments_page .= ' selected="selected"';
		$default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
		if ( 'oldest' == $opt['default_comments_page'] ) $default_comments_page .= ' selected="selected"';
		$default_comments_page .= '>' . __('first') . '</option></select>';
		
		printf( __('Break comments into pages with %1$s comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="text" id="comments_per_page" value="' . esc_attr($opt['comments_per_page']) . '" class="small-text" />', $default_comments_page );
		
		?></label>
		<br />
		<label for="comment_order"><?php
		
		$comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
		if ( 'asc' == $opt['comment_order'] ) $comment_order .= ' selected="selected"';
		$comment_order .= '>' . __('older') . '</option><option value="desc"';
		if ( 'desc' == $opt['comment_order'] ) $comment_order .= ' selected="selected"';
		$comment_order .= '>' . __('newer') . '</option></select>';
		
		printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
		
		?></label>
		</fieldset></td>
		</tr>
		
		
		
		
        <tr valign="top">
        <th scope="row"><?php _e('E-mail me whenever') ?></th>
        <td>
		<label for="comments_notify">
		
        <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php if ($opt['comments_notify'] == 1 ) echo('checked="checked"'); ?> /> <?php _e('Anyone posts a comment') ?> </label>
         
        <br />
		<label for="moderation_notify">
		
        <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php if ($opt['moderation_notify'] == 1) echo('checked="checked"'); ?> /> <?php _e('A comment is held for moderation') ?></label>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Before a comment appears') ?></th>
        <td>
		<label for="comment_moderation">
		
        <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php if ($opt['comment_moderation'] == 1) echo('checked="checked"'); ?> /> <?php _e('An administrator must always approve the comment') ?></label>
    
        
        
        <br />
		<label for="comment_whitelist">
        <input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php if ($opt['comment_whitelist'] == 1) echo('checked="checked"'); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label>
       
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Comment Moderation') ?></th>
        <td>
        <p><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="text" id="comment_max_links" size="3" value="' . $opt['comment_max_links']. '" />' ) ?></p>
        
        <p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
        <p>
        <textarea name="moderation_keys" cols="60" rows="10" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php echo($opt['moderation_keys']); ?></textarea>
        </p>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Comment Blacklist') ?></th>
        <td>
        <p><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so "press" will match "WordPress".') ?></p>
        <p>
        <textarea name="blacklist_keys" cols="60" rows="10" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php echo($opt['blacklist_keys']); ?></textarea>
        </p>
        </td>
        </tr>
        </table>
        
        <h3><?php _e('Avatars') ?></h3>

        <p><?php _e('By default WordPress uses <a href="http://gravatar.com/">Gravatars</a> &#8212; short for Globally Recognized Avatars &#8212; for the pictures that show up next to comments. Plugins may override this.'); ?></p>
        
        <?php // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that? ?>
        
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Avatar display') ?></th>
        <td>
        <?php
            $yesorno = array(0 => __("Don&#8217;t show Avatars"), 1 => __('Show Avatars'));
            foreach ( $yesorno as $key => $value) {
                $selected = ($opt['show_avatars'] == $key) ? 'checked="checked"' : '';
                echo "\n\t<label><input type='radio' name='show_avatars' value='$key' $selected> $value</label><br />";
            }
        ?>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Maximum Rating') ?></th>
        <td>
        
        <?php
        $ratings = array( 'G' => __('G &#8212; Suitable for all audiences'), 'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'), 'R' => __('R &#8212; Intended for adult audiences above 17'), 'X' => __('X &#8212; Even more mature than above'));
        foreach ($ratings as $key => $rating) :
          	$selected = ($opt['avatar_rating'] == $key) ? 'checked="checked"' : '';
            echo "\n\t<label><input type='radio' name='avatar_rating' value='$key' $selected> $rating</label><br />";
        endforeach;
        ?>
        
        </td>
        </tr>
		
		
		
		<tr valign="top">
		<th scope="row"><?php _e('Default Avatar') ?></th>
		<td class="defaultavatarpicker"><fieldset><legend class="hidden"><?php _e('Default Avatar') ?></legend>
		
		<?php _e('For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their e-mail address.'); ?><br />
		
		<?php
		$avatar_defaults = array(
			'mystery' => __('Mystery Man'),
			'blank' => __('Blank'),
			'gravatar_default' => __('Gravatar Logo'),
			'identicon' => __('Identicon (Generated)'),
			'wavatar' => __('Wavatar (Generated)'),
			'monsterid' => __('MonsterID (Generated)')
		);
		$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
		$default = $opt['avatar_default'];
		if ( empty($default) )
			$default = 'mystery';
		$size = 32;
		$avatar_list = '';
		foreach ( $avatar_defaults as $default_key => $default_name ) {
			$selected = ($default == $default_key) ? 'checked="checked" ' : '';
			$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='{$default_key}' {$selected}/> ";
		
			//$avatar = get_avatar( $user_email, $size, $default_key );
			//$avatar_list .= preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
		
			$avatar_list .= ' ' . $default_name . '</label>';
			$avatar_list .= '<br />';
		}
		echo apply_filters('default_avatar_select', $avatar_list);
		?>
		
		</fieldset></td>
		</tr>
		
		
        
        </table>

        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2><?php _e('Privacy Settings') ?></h2>
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Blog Visibility') ?> </th>
        <td>
        <p>Warning: It can be confusing for users to have these settings override the setting they choose on the sign up form. If you do not want to override user settings, select "Allow User Choice".</p>
		
		<p><input id="blog-public-reset" type="radio" name="blog_public" value="" <?php checked('', $opt['blog_public']); ?> />
        <label for="blog-public-reset"><?php _e('Allow User Choice'); ?></label></p>
        <p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', $opt['blog_public']); ?> />
        <label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers and in public listings around this site.') ?></label></p>
        <p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', $opt['blog_public']); ?> />
        <label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
        <?php do_action('blog_privacy_selector'); ?>
        </td>
        </tr>
        </table>
        
       
        </div>
        <p>&nbsp;</p>
		<div class="wrap">
        <h2><?php _e('Customize Permalink Structure') ?></h2>
        <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
        
        <?php
        $prefix = '';
        
        if ( ! got_mod_rewrite() )
            $prefix = '/index.php';
        
        $structures = array(
            '',
            $prefix . '/%year%/%monthnum%/%day%/%postname%/',
            $prefix . '/%year%/%monthnum%/%postname%/',
            $prefix . '/archives/%post_id%'
            );
        ?>
        <h3><?php _e('Common settings'); ?></h3>
        
        <table class="form-table">
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="" class="tog" <?php checked('', $opt['permalink_structure']); ?> /> <?php _e('Default'); ?></label></th>
                <td>&nbsp;</td>
             </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[1]; ?>" class="tog" <?php checked($structures[1], $opt['permalink_structure']); ?> /> <?php _e('Day and name'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[2]; ?>" class="tog" <?php checked($structures[2], $opt['permalink_structure']); ?> /> <?php _e('Month and name'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th><label><input name="permalink_choice" type="radio" value="<?php echo $structures[3]; ?>" class="tog" <?php checked($structures[3], $opt['permalink_structure']); ?> /> <?php _e('Numeric'); ?></label></th>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <th>
                    <label><input name="permalink_choice" id="custom_selection" type="radio" value="custom" class="tog"
                    <?php if ( !in_array($opt['permalink_structure'], $structures) ) { ?>
                    checked="checked"
                    <?php } ?>
                     />
                    <?php _e('Custom Structure'); ?>
                    </label>
                </th>
                <td>
                    <?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $permalink_structure = str_replace( "/blog", "", $opt['permalink_structure'] ); }?>
                    <input name="permalink_structure" id="permalink_structure" type="text" class="code" style="width: 60%;" value="<?php echo esc_attr($opt['permalink_structure']); ?>" size="50" />
                </td>
            </tr>
        </table>
        
        <h3><?php _e('Optional'); ?></h3>
        <?php if ($is_apache) : ?>
            <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
        <?php else : ?>
            <p><?php _e('If you like, you may enter custom structures for your category and tag <abbr title="Universal Resource Locator">URL</abbr>s here. For example, using <code>/topics/</code> as your category base would make your category links like <code>http://example.org/index.php/topics/uncategorized/</code>. If you leave these blank the defaults will be used.') ?></p>
        <?php endif; ?>
        
        <table class="form-table">
            <tr>
                <th><?php _e('Category base'); ?></th>
                <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $opt['category_base'] = str_replace( "/blog", "", $opt['category_base'] ); }?> <input name="category_base" type="text" class="code"  value="<?php echo esc_attr( $opt['category_base'] ); ?>" size="30" /></td>
            </tr>
            <tr>
                <th><?php _e('Tag base'); ?></th>
                <td><?php if( constant( 'VHOST' ) == 'no' && $current_site->domain.$current_site->path == $current_blog->domain.$current_blog->path ) { echo "/blog"; $opt['tag_base'] = str_replace( "/blog", "", $opt['tag_base'] ); }?> <input name="tag_base" id="tag_base" type="text" class="code"  value="<?php echo esc_attr($opt['tag_base']); ?>" size="30" /></td>
            </tr>
        </table>
        
        </div>
                
        
        <p>&nbsp;</p>
        
        <div class="wrap">
        <h2><?php _e('Media Settings'); ?></h2>
        <h3><?php _e('Image sizes') ?></h3>
        <p><?php _e('The sizes listed below determine the maximum dimensions to use when inserting an image into the body of a post.'); ?></p>
        
        <table class="form-table">
        <tr valign="top">
        <th scope="row"><?php _e('Thumbnail size') ?></th>
        <td>
        <label for="thumbnail_size_w"><?php _e('Width'); ?></label>
        <input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php echo($opt['thumbnail_size_w']); ?>" size="6" />
        <label for="thumbnail_size_h"><?php _e('Height'); ?></label>
        <input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php echo($opt['thumbnail_size_h']); ?>" size="6" /><br />
        <input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', $opt['thumbnail_crop']); ?>/>
        <label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
        </td>
        </tr>
        <tr valign="top">
        <th scope="row"><?php _e('Medium size') ?></th>
        <td>
        <label for="medium_size_w"><?php _e('Max Width'); ?></label>
        <input name="medium_size_w" type="text" id="medium_size_w" value="<?php echo($opt['medium_size_w']); ?>" size="6" />
        <label for="medium_size_h"><?php _e('Max Height'); ?></label>
        <input name="medium_size_h" type="text" id="medium_size_h" value="<?php echo($opt['medium_size_h']); ?>" size="6" />
        </td>
        </tr>
			<tr valign="top">
		<th scope="row"><?php _e('Large size') ?></th>
		<td><fieldset><legend class="hidden"><?php _e('Large size') ?></legend>
		<label for="large_size_w"><?php _e('Max Width'); ?></label>
		<input name="large_size_w" type="text" id="large_size_w" value="<?php echo($opt['large_size_w']); ?>" class="small-text" />
		<label for="large_size_h"><?php _e('Max Height'); ?></label>
		<input name="large_size_h" type="text" id="large_size_h" value="<?php echo($opt['large_size_h']); ?>" class="small-text" />
		</fieldset></td>
		</tr>
		</table>
        <h3><?php _e('Embeds') ?></h3>

		<table class="form-table">
		
		<tr valign="top">
		<th scope="row"><?php _e('Auto-embeds'); ?></th>
		<td><fieldset><legend class="screen-reader-text"><span><?php _e('Attempt to automatically embed all plain text URLs'); ?></span></legend>
		<label for="embed_autourls"><input name="embed_autourls" type="checkbox" id="embed_autourls" value="1" <?php checked( '1', $opt['embed_autourls'] ); ?>/> <?php _e('Attempt to automatically embed all plain text URLs'); ?></label>
		</fieldset></td>
		</tr>
		
		<tr valign="top">
		<th scope="row"><?php _e('Maximum embed size') ?></th>
		<td>
		<label for="embed_size_w"><?php _e('Width'); ?></label>
		<input name="embed_size_w" type="text" id="embed_size_w" value="<?php echo $opt['embed_size_w']; ?>" class="small-text" />
		<label for="embed_size_h"><?php _e('Height'); ?></label>
		<input name="embed_size_h" type="text" id="embed_size_h" value="<?php echo $opt['embed_size_h']; ?>" class="small-text" />
		<?php if ( !empty($content_width) ) echo '<br />' . __("If the width value is left blank, embeds will default to the max width of your theme."); ?>
		</td>
		</tr>
		
		
		</table>
        </div>
        <p>&nbsp;</p>
        <div class="wrap">
        <h2>Default Theme</h2>
        <?php 
		$themes = get_themes();
		$ct = current_theme_info();
		$allowed_themes = get_site_allowed_themes();
		if( $allowed_themes == false )
			$allowed_themes = array();
		
		$blog_allowed_themes = wpmu_get_blog_allowedthemes();
		if( is_array( $blog_allowed_themes ) )
			$allowed_themes = array_merge( $allowed_themes, $blog_allowed_themes );
		
		if( $blog_id != 1 ) {
			unset( $allowed_themes[ "h3" ] );
		}
		
		if( isset( $allowed_themes[ esc_html( $ct->stylesheet ) ] ) == false )
			$allowed_themes[ esc_html( $ct->stylesheet ) ] = true;
		
		reset( $themes );
		foreach( $themes as $key => $theme ) {
			if( isset( $allowed_themes[ esc_html( $theme[ 'Stylesheet' ] ) ] ) == false ) {
				unset( $themes[ $key ] );
			}
		}
		reset( $themes );
		
		// get the names of the themes & sort them
		$theme_names = array_keys($themes);
		natcasesort($theme_names);
		?>
        <table class="form-table">
        <tr valign="top">
        <th>Select the default theme:</th>
        <td><select name="theme" size="1">
        <?php
		foreach ($theme_names as $theme_name) {
		$template = $themes[$theme_name]['Template'];
		$stylesheet = $themes[$theme_name]['Stylesheet'];
		$title = $themes[$theme_name]['Title'];
		$selected = "";
		if($opt[theme] == $template . "|" . $stylesheet) {
			$selected = "selected = 'selected' ";
		}
		echo('<option value="' . $template . "|" . $stylesheet .  '"' . $selected . '>' . $title . "</option>");
		}
		?>
        </select>
        </td>
        </tr>
        </table>
        </div>
        
        <div class="wrap">
        <h2>Bonus Settings</h2>
		<table class="form-table">
        <tr valign="top">
        <th>From Email:</th>
		<td><input name="from_email" type="text" id="from_email" size="30" value="<?php echo($opt['from_email']); ?>"  /></td>
		</tr>
		  <tr valign="top">
        <th>From Email Name:<br/>(defaults to site name if left blank)</th>
		<td><input name="from_email_name" type="text" id="from_email_name" size="30" value="<?php echo($opt['from_email_name']); ?>"  /></td>
		</tr>
		<tr>
			<th>Delete Standard WordPress Blogroll Links</th>
			<td>
		<label for="delete_blogroll_links">
		
        <input name="delete_blogroll_links" type="checkbox" id="delete_blogroll_links" value="1" <?php if ($opt['delete_blogroll_links'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr valign="top">
        <th>Default Link Category:<br/> (Overwrites "Blogroll")</th>
		<td><input name="default_link_cat" type="text" id="default_link_cat" size="30" value="<?php echo($opt['default_link_cat']); ?>"  /></td>
		</tr>
		<tr valign="top">
        <th scope="row"><?php _e('Additional Links') ?></th>
        <td>
        <p><?php _e('Enter links one per line with the name followed by an equals sign and a greater than sign and then the fully qualified link. Example: Google=>http://www.google.com') ?></p>
        <p>
        <textarea name="default_links" cols="60" rows="10" id="default_links" style="width: 98%; font-size: 12px;" class="code"><?php echo(str_replace('|+', "\n", $opt['default_links'])); ?></textarea>
        </p>
        </td>
        </tr>
		
		<tr valign="top">
        <th>Default Category:<br/> (Overwrites "Uncategorized")</th>
		<td><input name="default_cat_name" type="text" id="default_cat_name" size="30" value="<?php echo($opt['default_cat_name']); ?>"  /></td>
		</tr>
		<tr valign="top">
        <th scope="row"><?php _e('Additional Categories') ?></th>
        <td>
        <p><?php _e('Enter categories one per line with the name followed by an equals sign and a greater than sign and then the description => Nice Name => parent name. Example: Plugins=>Find out out about my plugins=>plugins=>code') ?></p>
        <p>
        <textarea name="default_categories" cols="60" rows="10" id="default_categories" style="width: 98%; font-size: 12px;" class="code"><?php echo(str_replace('|+', "\n", $opt['default_categories'])); ?></textarea>
        </p>
        </td>
        </tr>
		
    	<tr>
			<th>Delete Initial Comment</th>
			<td>
		<label for="delete_first_comment">
		
        <input name="delete_first_comment" type="checkbox" id="delete_first_comment" value="1" <?php if ($opt['delete_first_comment'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Close Comments on Hello World Post</th>
			<td>
		<label for="close_comments_on_hello_world">
		
        <input name="close_comments_on_hello_world" type="checkbox" id="close_comments_on_hello_world" value="1" <?php if ($opt['close_comments_on_hello_world'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Close Comments on About Page</th>
			<td>
		<label for="close_comments_on_about_page">
		
        <input name="close_comments_on_about_page" type="checkbox" id="close_comments_on_about_page" value="1" <?php if ($opt['close_comments_on_about_page'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr>
			<th>Make First Post a Draft ("Hello World")</th>
			<td>
		<label for="delete_first_post">
		
        <input name="delete_first_post" type="checkbox" id="delete_first_post" value="1" <?php if ($opt['delete_first_post'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		
		<tr>
			<th>Delete Initial Widgets</th>
			<td>
			<input name="delete_initial_widgets" type="checkbox" id="delete_initial_widgets" value="1" <?php if ($opt['delete_initial_widgets'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?>
			</td>
		</tr>
		
		<tr>
			<th colspan="2">
				Sites that use a combination of BBPress and BuddyPress need all users to be subscribed to the blog on which BBPress is installed. The following section lets you do that. Note that you may add people to a comma-delimited list of blogs, but they will have the same role on each blog. 
			</td>
		</tr>
		<tr valign="top">
        <th>Add User to Other Blog(s):</th>
		<td><input name="add_user_to_blog" type="checkbox" id="add_user_to_blog" value="1" <?php if ($opt['add_user_to_blog'] == 1) echo('checked="checked"'); ?> /> <?php _e('Yes') ?></label>
		</td>
		</tr>
		<tr valign="top">
        <th>Role on Other Blog (s)</th>
		<td>
			<select name="add_user_to_blog_role" id="add_user_to_blog_role">
			<option value="administrator"<?php if($opt['add_user_to_blog_role'] == 'administrator') echo ' selected="selected"';?>>Administator</option>
			<option value="editor"<?php if($opt['add_user_to_blog_role'] == 'editor') echo ' selected="selected"';?>>Editor</option>
			<option value="author"<?php if($opt['add_user_to_blog_role'] == 'author') echo ' selected="selected"';?>>Author</option>
			<option value="contributor"<?php if($opt['add_user_to_blog_role'] == 'contributor') echo ' selected="selected"';?>>Contributor</option>
			<option value="subscriber"<?php if($opt['add_user_to_blog_role'] == 'subscriber') echo ' selected="selected"';?>>Subscriber</option>				
		</select></td>
		</tr>
		<tr valign="top">
        <th>Blog ID's to add User To:</th>
		<td><input name="add_user_to_blog_id" type="text" id="add_user_to_blog_id" size="30" value="<?php echo($opt['add_user_to_blog_id']); ?>"  /><br/>Use Blog ID or comma-delimited list of ID's.</td>
		</tr>
		</table>
		</div>
        
        
         <p>  
         <input type="hidden" name="action" value="update" />
        <input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
          </p> 
        
        <?php
	 }
示例#23
0
/**
 * nrelate theme compatibility
 *
 * Check active theme and provide messages to user that might be helpful.
 */
function nr_theme_compat()
{
    $msg = '';
    // Theme Capability for either Related OR Popular
    if (defined('NRELATE_RELATED_ACTIVE') || defined('NRELATE_POPULAR_ACTIVE')) {
        $theme_data = function_exists('wp_get_theme') ? wp_get_theme() : current_theme_info();
        // Woothemes
        if (strlen(strstr($theme_data->author, 'woothemes')) > 0) {
            $msg = $msg . '<li><div class="warning">' . sprintf('<strong>Woothemes</strong> are supported, but may require %sconfiguration%s.', '<a href="http://nrelate.com/theblog/theme-compatibility/woothemes/" target="_blank">', '</a>') . '</div></li>';
        }
        // Genesis
        if (function_exists('genesis')) {
            $msg = $msg . '<li><div class="warning">' . sprintf('<strong>Genesis</strong> themes are supported, but may require %sconfiguration%s.', '<a href="http://nrelate.com/theblog/theme-compatibility/genesis/" target="_blank">', '</a>') . '</div></li>';
        }
        // Thesis
        if (class_exists('thesis_comments')) {
            $msg = $msg . '<li><div class="warning">' . sprintf('<strong>Thesis</strong> themes are supported, but may require %sconfiguration%s.', '<a href="http://nrelate.com/theblog/theme-compatibility/thesis/" target="_blank">', '</a>') . '</div></li>';
        }
    }
    echo $msg;
}
 /** creates a archive based on current object **/
 function create_portability_kit()
 {
     global $wpdb;
     if (!current_user_can('edit_files')) {
         echo 'Oops sorry you are not authorized to do this';
         return false;
     }
     if ($this->port_plugins) {
         $currentPlugins = get_option('active_plugins');
         array_splice($currentPlugins, array_search(WPK_PAGE, $currentPlugins), 1);
         $this->print_array($currentPlugins);
         $path = "../";
         foreach ($currentPlugins as $plugin) {
             if ($this->validate_file($path . $plugin)) {
                 $this->plugin_data .= $plugin . "\n";
                 if (stristr($plugin, "/") === FALSE) {
                 } else {
                     $pluginDir = split("/", $plugin);
                     $plugin = $pluginDir[0];
                 }
                 $this->archive_dir(WPK_PLUGIN_DIR . $plugin, WPK_PLUGIN_DIR . $plugin, WPK_PLUGIN_DIR . $plugin, true);
             }
             $this->log_message("Archiving Plugin {$plugin}<br/> ");
         }
         $handle = fopen(WPK_CONTENT_DIR . 'wpk-plugins.txt', 'w');
         if ($handle) {
             fwrite($handle, $this->plugin_data);
             fclose($handle);
         }
         array_push($this->files, trailingslashit(WPK_CONTENT_DIR) . 'wpk-plugins.txt');
     }
     $this->log_message("Finished Archiving Plugins<br/> ");
     if ($this->port_themes) {
         $ct = current_theme_info();
         $templateDir = $ct->template_dir;
         $templateDir = str_replace('wp-content/themes/', '', $templateDir);
         $this->theme_data .= $ct->template . "\n";
         $this->theme_data .= $ct->stylesheet . "\n";
         $this->archive_dir(WPK_THEMES_DIR . $templateDir, WPK_THEMES_DIR . $templateDir, WPK_THEMES_DIR . $templateDir, true);
         $handle = fopen(WPK_CONTENT_DIR . 'wpk-themes.txt', 'w');
         if ($handle) {
             fwrite($handle, $this->theme_data);
             fclose($handle);
         }
         array_push($this->files, trailingslashit(WPK_CONTENT_DIR) . 'wpk-themes.txt');
     }
     $this->log_message("Finished Archiving Themes<br/> ");
     $kit_complete = false;
     if ($this->write_to_disk()) {
         $this->log_message("Wrote File To Disk<br/> ");
         $kit_complete = true;
     }
     $this->log_message("After Writing the Files to Disk<br/> ");
     if ($this->port_plugins) {
         unlink(WPK_CONTENT_DIR . "wpk-plugins.txt");
     }
     if ($this->port_themes) {
         unlink(WPK_CONTENT_DIR . "wpk-themes.txt");
     }
     if ($this->port_settings) {
         unlink(WPK_CONTENT_DIR . "wpk-settings.txt");
     }
     $this->log_message("Before Returning Back<br/> ");
     return $kit_complete;
 }
 function checkWPhead()
 {
     $ct = current_theme_info();
     $headerfile = $ct->template_dir . '/header.php';
     if (file_exists($headerfile)) {
         $buffer = file_get_contents($headerfile);
         if (strpos($buffer, 'wp_head()')) {
             // wp_head() found
             return 1;
         } else {
             // wp_head() not found
             return 0;
         }
     } else {
         // wp_head() unable to determine
         return 2;
     }
 }
function csp_po_collect_by_type($type)
{
    $res = array();
    $do_compat_filter = $type == 'compat';
    $do_security_filter = $type == 'security';
    if ($do_compat_filter || $do_security_filter) {
        $type = '';
    }
    if (empty($type) || $type == 'wordpress') {
        if (!$do_compat_filter && !$do_security_filter) {
            $res[] = csp_po_get_wordpress_capabilities();
        }
    }
    if (empty($type) || $type == 'plugins') {
        //WARNING: Plugin handling is not well coded by WordPress core
        $err = error_reporting(0);
        $plugs = get_plugins();
        error_reporting($err);
        $textdomains = array();
        foreach ($plugs as $key => $value) {
            $data = null;
            if (dirname($key) == 'buddypress') {
                if ($do_compat_filter || $do_security_filter) {
                    continue;
                }
                $data = csp_po_get_buddypress_capabilities($key, $value);
                $res[] = $data;
                $data = csp_po_get_bbpress_on_buddypress_capabilities($key, $value);
                if ($data !== false) {
                    $res[] = $data;
                }
            } else {
                $data = csp_po_get_plugin_capabilities($key, $value);
                if (!$data['gettext_ready']) {
                    continue;
                }
                if (in_array($data['textdomain'], $textdomains)) {
                    for ($i = 0; $i < count($res); $i++) {
                        if ($data['textdomain'] == $res[$i]['textdomain']) {
                            $res[$i]['child-plugins'][] = $data;
                            break;
                        }
                    }
                } else {
                    if ($do_compat_filter && !isset($data['dev-hints'])) {
                        continue;
                    } elseif ($do_security_filter && !isset($data['dev-security'])) {
                        continue;
                    }
                    array_push($textdomains, $data['textdomain']);
                    $res[] = $data;
                }
            }
        }
    }
    if (csp_is_multisite()) {
        if (empty($type) || $type == 'plugins_mu') {
            $plugs = array();
            $textdomains = array();
            if (is_dir(WPMU_PLUGIN_DIR)) {
                if ($dh = opendir(WPMU_PLUGIN_DIR)) {
                    while (($plugin = readdir($dh)) !== false) {
                        if (substr($plugin, -4) == '.php') {
                            $plugs[$plugin] = get_plugin_data(WPMU_PLUGIN_DIR . '/' . $plugin);
                        }
                    }
                }
            }
            foreach ($plugs as $key => $value) {
                $data = csp_po_get_plugin_mu_capabilities($key, $value);
                if (!$data['gettext_ready']) {
                    continue;
                }
                if ($do_compat_filter && !isset($data['dev-hints'])) {
                    continue;
                } elseif ($do_security_filter && !isset($data['dev-security'])) {
                    continue;
                }
                if (in_array($data['textdomain'], $textdomains)) {
                    for ($i = 0; $i < count($res); $i++) {
                        if ($data['textdomain'] == $res[$i]['textdomain']) {
                            $res[$i]['child-plugins'][] = $data;
                            break;
                        }
                    }
                } else {
                    if ($do_compat_filter && !isset($data['dev-hints'])) {
                        continue;
                    } elseif ($do_security_filter && !isset($data['dev-security'])) {
                        continue;
                    }
                    array_push($textdomains, $data['textdomain']);
                    $res[] = $data;
                }
            }
        }
    }
    if (empty($type) || $type == 'themes') {
        $themes = get_themes();
        //WARNING: Theme handling is not well coded by WordPress core
        $err = error_reporting(0);
        $ct = current_theme_info();
        error_reporting($err);
        foreach ($themes as $key => $value) {
            $data = csp_po_get_theme_capabilities($key, $value, $ct);
            if (!$data['gettext_ready']) {
                continue;
            }
            if ($do_compat_filter && !isset($data['dev-hints'])) {
                continue;
            } elseif ($do_security_filter && !isset($data['dev-security'])) {
                continue;
            }
            $res[] = $data;
        }
    }
    return $res;
}
示例#27
0
 function get_list($args)
 {
     $this->_escape($args);
     $username = $args[0];
     $password = $args[1];
     if ($password != get_option('wpr_cron')) {
         if (!($user = $this->login($username, $password))) {
             return $this->error;
         }
         if (!current_user_can('switch_themes')) {
             return new IXR_Error(401, 'Sorry, you cannot manage plugins on the remote blog.');
         }
     }
     $themes = get_themes();
     $current_theme = current_theme_info();
     unset($themes[$current_theme->name]);
     return array('current' => $current_theme, 'inactive' => $themes);
 }
示例#28
0
    /**
     * "Help Me Help You" metabox
     *
     * @global wpdb $wpdb WordPress database object
     * @global string $wp_version WordPress version number
     * @global WP_Rewrite $wp_rewrite WordPress Rewrite object for creating pretty URLs
     * @global object $wp_rewrite
     * @param array $settings Plugin settings (from DB)
     * @since 3.0
     */
    public function helpushelpyou($settings)
    {
        global $wpdb, $wp_rewrite, $wp_version;
        $active_plugins = array();
        $all_plugins = apply_filters('all_plugins', get_plugins());
        // Get a list of active plugins
        foreach ($all_plugins as $filename => $plugin) {
            if ('Welcome Pack' != $plugin['Name'] && 'BuddyPress' != $plugin['Name'] && is_plugin_active($filename)) {
                $active_plugins[] = $plugin['Name'] . ': ' . $plugin['Version'];
            }
        }
        natcasesort($active_plugins);
        if (!$active_plugins) {
            $active_plugins[] = __('No other plugins are active', 'dpw');
        }
        // Is multisite active?
        if (is_multisite()) {
            if (is_subdomain_install()) {
                $is_multisite = __('subdomain', 'dpw');
            } else {
                $is_multisite = __('subdirectory', 'dpw');
            }
        } else {
            $is_multisite = __('no', 'dpw');
        }
        // Find out the BuddyPress BP_ROOT_BLOG value
        if (1 == constant('BP_ROOT_BLOG')) {
            $is_bp_root_blog = __('standard', 'dpw');
        } else {
            $is_bp_root_blog = __('non-standard', 'dpw');
        }
        $is_bp_default_child_theme = __('no', 'dpw');
        $theme = current_theme_info();
        // Is the current theme a child theme of BP-Default?
        if ('BuddyPress Default' == $theme->parent_theme) {
            $is_bp_default_child_theme = __('yes', 'dpw');
        }
        if ('BuddyPress Default' == $theme->name) {
            $is_bp_default_child_theme = __('n/a', 'dpw');
        }
        // Is the site using pretty permalinks?
        if (empty($wp_rewrite->permalink_structure)) {
            $custom_permalinks = __('default', 'dpw');
        } else {
            // Or is the site using (almost) pretty permalinks?
            if (strpos($wp_rewrite->permalink_structure, 'index.php')) {
                $custom_permalinks = __('almost', 'dpw');
            } else {
                $custom_permalinks = __('custom', 'dpw');
            }
        }
        ?>

		<p><?php 
        _e("If you have trouble, a little information about your site goes a long way.", 'dpw');
        ?>
</p>

		<h4><?php 
        _e('Versions', 'dpw');
        ?>
</h4>
		<ul>
			<li><?php 
        printf(__('Welcome Pack: %s', 'dpw'), WELCOME_PACK_VERSION);
        ?>
</li>
			<li><?php 
        printf(__('BP_ROOT_BLOG: %s', 'dpw'), $is_bp_root_blog);
        ?>
</li>
			<li><?php 
        printf(__('BuddyPress: %s', 'dpw'), BP_VERSION);
        ?>
</li>
			<li><?php 
        printf(__('MySQL: %s', 'dpw'), $wpdb->db_version());
        ?>
</li>
			<li><?php 
        printf(__('Permalinks: %s', 'dpw'), $custom_permalinks);
        ?>
</li>
			<li><?php 
        printf(__('PHP: %s', 'dpw'), phpversion());
        ?>
</li>
			<li><?php 
        printf(__('WordPress: %s', 'dpw'), $wp_version);
        ?>
</li>
			<li><?php 
        printf(__('WordPress multisite: %s', 'dpw'), $is_multisite);
        ?>
</li>
		</ul>

		<h4><?php 
        _e('Theme', 'dpw');
        ?>
</h4>
		<ul>
			<li><?php 
        printf(__('BP-Default child theme: %s', 'dpw'), $is_bp_default_child_theme);
        ?>
</li>
			<li><?php 
        printf(__('Current theme: %s', 'dpw'), $theme->name);
        ?>
</li>
		</ul>

		<h4><?php 
        _e('Active Plugins', 'dpw');
        ?>
</h4>
		<ul>
			<?php 
        foreach ($active_plugins as $plugin) {
            ?>
				<li><?php 
            echo esc_html($plugin);
            ?>
</li>
			<?php 
        }
        ?>
		</ul>

	<?php 
    }
示例#29
0
function wp_dashboard_right_now()
{
    global $wp_registered_sidebars;
    $num_posts = wp_count_posts('post');
    $num_pages = wp_count_posts('page');
    $num_cats = wp_count_terms('category');
    $num_tags = wp_count_terms('post_tag');
    $num_comm = wp_count_comments();
    echo "\n\t" . '<div class="table table_content">';
    echo "\n\t" . '<p class="sub">' . __('Content') . '</p>' . "\n\t" . '<table>';
    echo "\n\t" . '<tr class="first">';
    // Posts
    $num = number_format_i18n($num_posts->publish);
    $text = _n('Post', 'Posts', intval($num_posts->publish));
    if (current_user_can('edit_posts')) {
        $num = "<a href='edit.php'>{$num}</a>";
        $text = "<a href='edit.php'>{$text}</a>";
    }
    echo '<td class="first b b-posts">' . $num . '</td>';
    echo '<td class="t posts">' . $text . '</td>';
    echo '</tr><tr>';
    /* TODO: Show status breakdown on hover
    	if ( $can_edit_pages && !empty($num_pages->publish) ) { // how many pages is not exposed in feeds.  Don't show if !current_user_can
    		$post_type_texts[] = '<a href="edit-pages.php">'.sprintf( _n( '%s page', '%s pages', $num_pages->publish ), number_format_i18n( $num_pages->publish ) ).'</a>';
    	}
    	if ( $can_edit_posts && !empty($num_posts->draft) ) {
    		$post_type_texts[] = '<a href="edit.php?post_status=draft">'.sprintf( _n( '%s draft', '%s drafts', $num_posts->draft ), number_format_i18n( $num_posts->draft ) ).'</a>';
    	}
    	if ( $can_edit_posts && !empty($num_posts->future) ) {
    		$post_type_texts[] = '<a href="edit.php?post_status=future">'.sprintf( _n( '%s scheduled post', '%s scheduled posts', $num_posts->future ), number_format_i18n( $num_posts->future ) ).'</a>';
    	}
    	if ( current_user_can('publish_posts') && !empty($num_posts->pending) ) {
    		$pending_text = sprintf( _n( 'There is <a href="%1$s">%2$s post</a> pending your review.', 'There are <a href="%1$s">%2$s posts</a> pending your review.', $num_posts->pending ), 'edit.php?post_status=pending', number_format_i18n( $num_posts->pending ) );
    	} else {
    		$pending_text = '';
    	}
    	*/
    // Pages
    $num = number_format_i18n($num_pages->publish);
    $text = _n('Page', 'Pages', $num_pages->publish);
    if (current_user_can('edit_pages')) {
        $num = "<a href='edit.php?post_type=page'>{$num}</a>";
        $text = "<a href='edit.php?post_type=page'>{$text}</a>";
    }
    echo '<td class="first b b_pages">' . $num . '</td>';
    echo '<td class="t pages">' . $text . '</td>';
    echo '</tr><tr>';
    // Categories
    $num = number_format_i18n($num_cats);
    $text = _n('Category', 'Categories', $num_cats);
    if (current_user_can('manage_categories')) {
        $num = "<a href='edit-tags.php?taxonomy=category'>{$num}</a>";
        $text = "<a href='edit-tags.php?taxonomy=category'>{$text}</a>";
    }
    echo '<td class="first b b-cats">' . $num . '</td>';
    echo '<td class="t cats">' . $text . '</td>';
    echo '</tr><tr>';
    // Tags
    $num = number_format_i18n($num_tags);
    $text = _n('Tag', 'Tags', $num_tags);
    if (current_user_can('manage_categories')) {
        $num = "<a href='edit-tags.php'>{$num}</a>";
        $text = "<a href='edit-tags.php'>{$text}</a>";
    }
    echo '<td class="first b b-tags">' . $num . '</td>';
    echo '<td class="t tags">' . $text . '</td>';
    echo "</tr>";
    do_action('right_now_content_table_end');
    echo "\n\t</table>\n\t</div>";
    echo "\n\t" . '<div class="table table_discussion">';
    echo "\n\t" . '<p class="sub">' . __('Discussion') . '</p>' . "\n\t" . '<table>';
    echo "\n\t" . '<tr class="first">';
    // Total Comments
    $num = '<span class="total-count">' . number_format_i18n($num_comm->total_comments) . '</span>';
    $text = _n('Comment', 'Comments', $num_comm->total_comments);
    if (current_user_can('moderate_comments')) {
        $num = '<a href="edit-comments.php">' . $num . '</a>';
        $text = '<a href="edit-comments.php">' . $text . '</a>';
    }
    echo '<td class="b b-comments">' . $num . '</td>';
    echo '<td class="last t comments">' . $text . '</td>';
    echo '</tr><tr>';
    // Approved Comments
    $num = '<span class="approved-count">' . number_format_i18n($num_comm->approved) . '</span>';
    $text = _nx('Approved', 'Approved', $num_comm->approved, 'Right Now');
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=approved'>{$num}</a>";
        $text = "<a class='approved' href='edit-comments.php?comment_status=approved'>{$text}</a>";
    }
    echo '<td class="b b_approved">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>\n\t<tr>";
    // Pending Comments
    $num = '<span class="pending-count">' . number_format_i18n($num_comm->moderated) . '</span>';
    $text = _n('Pending', 'Pending', $num_comm->moderated);
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=moderated'>{$num}</a>";
        $text = "<a class='waiting' href='edit-comments.php?comment_status=moderated'>{$text}</a>";
    }
    echo '<td class="b b-waiting">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>\n\t<tr>";
    // Spam Comments
    $num = number_format_i18n($num_comm->spam);
    $text = _nx('Spam', 'Spam', $num_comm->spam, 'comment');
    if (current_user_can('moderate_comments')) {
        $num = "<a href='edit-comments.php?comment_status=spam'><span class='spam-count'>{$num}</span></a>";
        $text = "<a class='spam' href='edit-comments.php?comment_status=spam'>{$text}</a>";
    }
    echo '<td class="b b-spam">' . $num . '</td>';
    echo '<td class="last t">' . $text . '</td>';
    echo "</tr>";
    do_action('right_now_table_end');
    do_action('right_now_discussion_table_end');
    echo "\n\t</table>\n\t</div>";
    echo "\n\t" . '<div class="versions">';
    $ct = current_theme_info();
    echo "\n\t<p>";
    if (!empty($wp_registered_sidebars)) {
        $sidebars_widgets = wp_get_sidebars_widgets();
        $num_widgets = 0;
        foreach ((array) $sidebars_widgets as $k => $v) {
            if ('wp_inactive_widgets' == $k) {
                continue;
            }
            if (is_array($v)) {
                $num_widgets = $num_widgets + count($v);
            }
        }
        $num = number_format_i18n($num_widgets);
        $switch_themes = $ct->title;
        if (current_user_can('switch_themes')) {
            $switch_themes = '<a href="themes.php">' . $switch_themes . '</a>';
        }
        if (current_user_can('edit_theme_options')) {
            printf(_n('Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widget</a></span>', 'Theme <span class="b">%1$s</span> with <span class="b"><a href="widgets.php">%2$s Widgets</a></span>', $num_widgets), $switch_themes, $num);
        } else {
            printf(_n('Theme <span class="b">%1$s</span> with <span class="b">%2$s Widget</span>', 'Theme <span class="b">%1$s</span> with <span class="b">%2$s Widgets</span>', $num_widgets), $switch_themes, $num);
        }
    } else {
        if (current_user_can('switch_themes')) {
            printf(__('Theme <span class="b"><a href="themes.php">%1$s</a></span>'), $ct->title);
        } else {
            printf(__('Theme <span class="b">%1$s</span>'), $ct->title);
        }
    }
    echo '</p>';
    // Check if search engines are blocked.
    if (!is_network_admin() && !is_user_admin() && current_user_can('manage_options') && '1' != get_option('blog_public')) {
        $title = apply_filters('privacy_on_link_title', __('Your site is asking search engines not to index its content'));
        $content = apply_filters('privacy_on_link_text', __('Search Engines Blocked'));
        echo "<p><a href='options-privacy.php' title='{$title}'>{$content}</a></p>";
    }
    update_right_now_message();
    echo "\n\t" . '<br class="clear" /></div>';
    do_action('rightnow_end');
    do_action('activity_box_end');
}
示例#30
0
文件: bp-core.php 项目: n-sane/zaroka
/**
 * bp_core_activation_notice()
 *
 * When BuddyPress is activated we must make sure that mod_rewrite is enabled.
 * We must also make sure a BuddyPress compatible theme is enabled. This function
 * will show helpful messages to the administrator.
 *
 * @package BuddyPress Core
 */
function bp_core_activation_notice() {
	global $wp_rewrite, $current_blog, $bp;

	if ( isset( $_POST['permalink_structure'] ) )
		return false;

	if ( !is_super_admin() )
		return false;

	if ( !empty( $current_blog ) ) {
		if ( $current_blog->blog_id != BP_ROOT_BLOG )
			return false;
	}

	if ( empty( $wp_rewrite->permalink_structure ) ) { ?>
		<div id="message" class="updated fade">
			<p><?php printf( __( '<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress' ), admin_url( 'options-permalink.php' ) ) ?></p>
		</div><?php
	} else {
		/* Get current theme info */
		$ct = current_theme_info();

		/* The best way to remove this notice is to add a "buddypress" tag to your active theme's CSS header. */
		if ( !defined( 'BP_SILENCE_THEME_NOTICE' ) && !in_array( 'buddypress', (array)$ct->tags ) ) { ?>
			<div id="message" class="updated fade">
				<p style="line-height: 150%"><?php printf( __( "<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a BuddyPress compatible theme</a> to take advantage of all of the features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a> or <a href='%s'>upgrade your existing WordPress theme</a>.", 'buddypress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ), admin_url( 'plugin-install.php?type=term&tab=search&s=bp-template-pack' ) ) ?></p>
			</div><?php
		}
	}
}