mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Plugin enhancements.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1081 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e3e0e62cd7
commit
74c2872215
28
index.php
28
index.php
@ -1,9 +1,6 @@
|
||||
<?php
|
||||
/* Don't remove these lines. */
|
||||
$blog = 1;
|
||||
require('wp-blog-header.php');
|
||||
// Uncomment the next line if you want to track blog updates from weblogs.com
|
||||
//include_once(ABSPATH.WPINC.'/links-update-xml.php');
|
||||
/* Don't remove this lines. */
|
||||
require('./wp-blog-header.php');
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
@ -20,22 +17,21 @@ require('wp-blog-header.php');
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="print" href="<?php echo get_settings('siteurl'); ?>/print.css" />
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
|
||||
<link rel="alternate" type="application/rdf+xml" title="RDF" href="<?php bloginfo('rdf_url'); ?>" />
|
||||
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
|
||||
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
|
||||
|
||||
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
|
||||
<?php get_archives('monthly', '', 'link'); ?>
|
||||
<?php //comments_popup_script(); // off by default ?>
|
||||
|
||||
<?php wp_head(); ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="rap">
|
||||
<h1 id="header"><a href="<?php echo get_settings('siteurl'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a></h1>
|
||||
<h1 id="header"><a href="<?php echo get_settings('siteurl'); ?>"><?php bloginfo('name'); ?></a></h1>
|
||||
|
||||
<div id="content">
|
||||
<?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
|
||||
<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
|
||||
|
||||
<?php the_date('','<h2>','</h2>'); ?>
|
||||
|
||||
@ -59,9 +55,9 @@ require('wp-blog-header.php');
|
||||
<?php include(ABSPATH . 'wp-comments.php'); ?>
|
||||
</div>
|
||||
|
||||
<?php } } else { // end foreach, end if any posts ?>
|
||||
<?php endforeach; else: ?>
|
||||
<p><?php _e("Sorry, no posts matched your criteria."); ?></p>
|
||||
<?php } ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
@ -80,11 +76,11 @@ require('wp-blog-header.php');
|
||||
<form id="searchform" method="get" action="<?php echo $PHP_SELF; ?>">
|
||||
<div>
|
||||
<input type="text" name="s" id="s" size="15" /><br />
|
||||
<input type="submit" name="submit" value="<?php _e("search"); ?>" />
|
||||
<input type="submit" name="submit" value="<?php _e("Search"); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
<li id="archives"><?php _e("Archives"); ?>
|
||||
<li id="archives"><?php _e("Archives:"); ?>
|
||||
<ul>
|
||||
<?php get_archives('monthly'); ?>
|
||||
</ul>
|
||||
@ -101,9 +97,9 @@ require('wp-blog-header.php');
|
||||
<li id="meta"><?php _e("Meta:"); ?>
|
||||
<ul>
|
||||
<li><a href="<?php bloginfo('rss2_url'); ?>" title="<?php _e("Syndicate this site using RSS"); ?>"><?php _e("<abbr title=\"Really Simple Syndication\">RSS</abbr> 2.0"); ?></a></li>
|
||||
<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php _e("The latest comments to all posts in RSS"); ?>"><?php _e("Comments <abbr title=\"Really Simple Syndication\">RSS</abbr> 2.0"); ?></a></li>
|
||||
<li><a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php _e("The latest comments to all posts in RSS"); ?>"><?php _e('Comments <abbr title="Really Simple Syndication">RSS</abbr> 2.0'); ?></a></li>
|
||||
<li><a href="http://validator.w3.org/check/referer" title="<?php _e("This page validates as XHTML 1.0 Transitional"
|
||||
); ?>"><?php _e("Valid <abbr title=\"eXtensible HyperText Markup Language\">XHTML</abbr>"); ?></a></li>
|
||||
); ?>"><?php _e('Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr>'); ?></a></li>
|
||||
<li><a href="http://wordpress.org" title="<?php _e("Powered by WordPress; state-of-the-art semantic personal publishing platform."); ?>">WP</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
@ -114,6 +110,6 @@ require('wp-blog-header.php');
|
||||
|
||||
</div>
|
||||
|
||||
<p class="credit"><!--<?php echo $wpdb->querycount; ?> queries.--> <?php timer_stop(1); ?> || <cite><?php echo sprintf(__("Powered by <a href=\"http://wordpress.org\" title=\"%s\"><strong>WordPress</strong></a></cite></p>"), __("Powered by WordPress, state-of-the-art semantic personal publishing platform")); ?>
|
||||
<p class="credit"><!--<?php echo $wpdb->querycount; ?> queries.--> <?php timer_stop(1); ?> — <cite><?php echo sprintf(__("Powered by <a href='http://wordpress.org' title='%s'><strong>WordPress</strong></a>"), __("Powered by WordPress, state-of-the-art semantic personal publishing platform")); ?></cite></p>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -111,6 +111,7 @@ if (!$plugins_dir || !$plugin_files) {
|
||||
|
||||
if (!empty($current_plugins) && in_array($plugin_file, $current_plugins)) {
|
||||
$action = "<a href='plugins.php?action=deactivate&plugin=$plugin_file' title='Deactivate this plugin' class='delete'>Deactivate</a>";
|
||||
$plugin = "<strong>$plugin</strong>";
|
||||
} else {
|
||||
$action = "<a href='plugins.php?action=activate&plugin=$plugin_file' title='Activate this plugin' class='edit'>Activate</a>";
|
||||
}
|
||||
|
@ -1162,113 +1162,6 @@ function remove_action($tag, $function_to_remove, $priority = 10) {
|
||||
remove_filter($tag, $function_to_remove, $priority);
|
||||
}
|
||||
|
||||
/* Highlighting code c/o Ryan Boren */
|
||||
function get_search_query_terms($engine = 'google') {
|
||||
global $s, $s_array;
|
||||
$referer = urldecode($_SERVER[HTTP_REFERER]);
|
||||
$query_array = array();
|
||||
switch ($engine) {
|
||||
case 'google':
|
||||
// Google query parsing code adapted from Dean Allen's
|
||||
// Google Hilite 0.3. http://textism.com
|
||||
$query_terms = preg_replace('/^.*q=([^&]+)&?.*$/i','$1', $referer);
|
||||
$query_terms = preg_replace('/\'|"/', '', $query_terms);
|
||||
$query_array = preg_split ("/[\s,\+\.]+/", $query_terms);
|
||||
break;
|
||||
|
||||
case 'lycos':
|
||||
$query_terms = preg_replace('/^.*query=([^&]+)&?.*$/i','$1', $referer);
|
||||
$query_terms = preg_replace('/\'|"/', '', $query_terms);
|
||||
$query_array = preg_split ("/[\s,\+\.]+/", $query_terms);
|
||||
break;
|
||||
|
||||
case 'yahoo':
|
||||
$query_terms = preg_replace('/^.*p=([^&]+)&?.*$/i','$1', $referer);
|
||||
$query_terms = preg_replace('/\'|"/', '', $query_terms);
|
||||
$query_array = preg_split ("/[\s,\+\.]+/", $query_terms);
|
||||
break;
|
||||
|
||||
case 'wordpress':
|
||||
// Check the search form vars if the search terms
|
||||
// aren't in the referer.
|
||||
if ( ! preg_match('/^.*s=/i', $referer)) {
|
||||
if (isset($s_array)) {
|
||||
$query_array = $s_array;
|
||||
} else if (isset($s)) {
|
||||
$query_array = array($s);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$query_terms = preg_replace('/^.*s=([^&]+)&?.*$/i','$1', $referer);
|
||||
$query_terms = preg_replace('/\'|"/', '', $query_terms);
|
||||
$query_array = preg_split ("/[\s,\+\.]+/", $query_terms);
|
||||
break;
|
||||
}
|
||||
|
||||
return $query_array;
|
||||
}
|
||||
|
||||
function is_referer_search_engine($engine = 'google') {
|
||||
$siteurl = get_settings('siteurl');
|
||||
$referer = urldecode($_SERVER['HTTP_REFERER']);
|
||||
//echo "referer is: $referer<br />";
|
||||
if ( ! $engine ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch ($engine) {
|
||||
case 'google':
|
||||
if (preg_match('/^http:\/\/w?w?w?\.?google.*/i', $referer)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'lycos':
|
||||
if (preg_match('/^http:\/\/search\.lycos.*/i', $referer)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'yahoo':
|
||||
if (preg_match('/^http:\/\/search\.yahoo.*/i', $referer)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'wordpress':
|
||||
if (preg_match("#^$siteurl#i", $referer)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function hilite($text) {
|
||||
$search_engines = array('wordpress', 'google', 'lycos', 'yahoo');
|
||||
|
||||
foreach ($search_engines as $engine) {
|
||||
if ( is_referer_search_engine($engine)) {
|
||||
$query_terms = get_search_query_terms($engine);
|
||||
foreach ($query_terms as $term) {
|
||||
if (!empty($term) && $term != ' ') {
|
||||
if (!preg_match('/<.+>/',$text)) {
|
||||
$text = preg_replace('/(\b'.$term.'\b)/i','<span class="hilite">$1</span>',$text);
|
||||
} else {
|
||||
$text = preg_replace('/(?<=>)([^<]+)?(\b'.$term.'\b)/i','$1<span class="hilite">$2</span>',$text);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/* rewrite_rules
|
||||
* Construct rewrite matches and queries from permalink structure.
|
||||
* matches - The name of the match array to use in the query strings.
|
||||
@ -1450,4 +1343,8 @@ function check_comment($author, $email, $url, $comment, $user_ip) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function wp_head() {
|
||||
do_action('wp_head', '');
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user