added amazing w3 caching plugin
@@ -1,147 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Custom Post Templates
|
||||
Plugin URI: http://wordpress.org/extend/plugins/custom-post-template/
|
||||
Description: Provides a drop-down to select different templates for posts from the post edit screen. The templates are defined similarly to page templates, and will replace single.php for the specified post.
|
||||
Author: Simon Wheatley
|
||||
Version: 1.1
|
||||
Author URI: http://simonwheatley.co.uk/wordpress/
|
||||
*/
|
||||
|
||||
/* Copyright 2008 Simon Wheatley
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
require_once( dirname (__FILE__) . '/plugin.php' );
|
||||
|
||||
/**
|
||||
*
|
||||
* @package default
|
||||
* @author Simon Wheatley
|
||||
**/
|
||||
class CustomPostTemplates extends CustomPostTemplates_Plugin
|
||||
{
|
||||
private $tpl_meta_key;
|
||||
private $post_ID;
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Init properties
|
||||
$this->tpl_meta_key = 'custom_post_template';
|
||||
// Init hooks and all that
|
||||
$this->register_plugin ( 'post-templates', __FILE__ );
|
||||
$this->add_meta_box( 'select_post_template', __('Post Template'), 'select_post_template', 'post', 'side', 'default' );
|
||||
$this->add_action( 'save_post' );
|
||||
$this->add_filter( 'single_template', 'filter_single_template' );
|
||||
}
|
||||
|
||||
/*
|
||||
* FILTERS & ACTIONS
|
||||
* *******************
|
||||
*/
|
||||
|
||||
public function select_post_template( $post )
|
||||
{
|
||||
$this->post_ID = $post->ID;
|
||||
|
||||
$template_vars = array();
|
||||
$template_vars[ 'templates' ] = $this->get_post_templates();
|
||||
$template_vars[ 'custom_template' ] = $this->get_custom_post_template();
|
||||
|
||||
// Render the template
|
||||
$this->render_admin ( 'select_post_template', $template_vars );
|
||||
}
|
||||
|
||||
public function save_post( $post_ID )
|
||||
{
|
||||
$action_needed = (bool) @ $_POST[ 'custom_post_template_present' ];
|
||||
if ( ! $action_needed ) return;
|
||||
|
||||
$this->post_ID = $post_ID;
|
||||
|
||||
$template = (string) @ $_POST[ 'custom_post_template' ];
|
||||
$this->set_custom_post_template( $template );
|
||||
}
|
||||
|
||||
public function filter_single_template( $template )
|
||||
{
|
||||
global $wp_query;
|
||||
|
||||
$this->post_ID = $wp_query->post->ID;
|
||||
|
||||
$template_file = $this->get_custom_post_template();
|
||||
$custom_template = TEMPLATEPATH . "/" . $template_file;
|
||||
// Check both the template file and the full path, otherwise you discover that the theme dir
|
||||
// exists (which is not surprising)
|
||||
if ( $template_file && file_exists( $custom_template ) ) return $custom_template;
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/*
|
||||
* UTILITY METHODS
|
||||
* *****************
|
||||
*/
|
||||
|
||||
protected function set_custom_post_template( $template )
|
||||
{
|
||||
delete_post_meta( $this->post_ID, $this->tpl_meta_key );
|
||||
if ( ! $template || $template == 'default' ) return;
|
||||
|
||||
add_post_meta( $this->post_ID, $this->tpl_meta_key, $template );
|
||||
}
|
||||
|
||||
protected function get_custom_post_template()
|
||||
{
|
||||
$custom_template = get_post_meta( $this->post_ID, $this->tpl_meta_key, true );
|
||||
return $custom_template;
|
||||
}
|
||||
|
||||
protected function get_post_templates()
|
||||
{
|
||||
$themes = get_themes();
|
||||
$theme = get_current_theme();
|
||||
$templates = $themes[ $theme ][ 'Template Files' ];
|
||||
|
||||
$page_templates = array();
|
||||
|
||||
if ( is_array( $templates ) ) {
|
||||
foreach ( $templates as $template ) {
|
||||
// Get the file data and collapse it into a single string
|
||||
$template_data = implode( '', file( $template ) );
|
||||
if ( ! preg_match( '|Template Name Posts:(.*)$|mi', $template_data, $name ) )
|
||||
continue;
|
||||
|
||||
$name = _cleanup_header_comment( $name[ 1 ] );
|
||||
|
||||
$page_templates[ trim( $name ) ] = basename( $template );
|
||||
}
|
||||
}
|
||||
|
||||
return $page_templates;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate the plugin
|
||||
*
|
||||
* @global
|
||||
**/
|
||||
|
||||
$CustomPostTemplates = new CustomPostTemplates();
|
||||
|
||||
?>
|
||||
@@ -1,676 +0,0 @@
|
||||
<?php
|
||||
|
||||
// ======================================================================================
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
// ======================================================================================
|
||||
// @author John Godley (http://urbangiraffe.com)
|
||||
// @version 0.1.25
|
||||
// @copyright Copyright © 2007 John Godley, All Rights Reserved
|
||||
// ======================================================================================
|
||||
// 0.1.6 - Corrected WP locale functions
|
||||
// 0.1.7 - Add phpdoc comments
|
||||
// 0.1.8 - Support for Admin SSL
|
||||
// 0.1.9 - URL encoding, defer localization until init
|
||||
// 0.1.10 - Better URL encoding
|
||||
// 0.1.11 - Make work in WP 2.0, fix HTTPS issue on IIS
|
||||
// 0.1.12 - Activation/deactivation actions that take into account the directory
|
||||
// 0.1.13 - Add realpath function
|
||||
// 0.1.14 - Add select/checked functions, fix locale loader
|
||||
// 0.1.15 - Remove dependency on prototype
|
||||
// 0.1.16 - Add support for homedir in realpath
|
||||
// 0.1.17 - Added widget class
|
||||
// 0.1.18 - Expand checked function
|
||||
// 0.1.19 - Make url() cope with sites with no trailing slash
|
||||
// 0.1.20 - Change init function to prevent overloading
|
||||
// 0.1.21 - Make widget work for WP 2.1
|
||||
// 0.1.22 - Make select work with option groups, RSS compatability fix
|
||||
// 0.1.23 - Make widget count work better, fix widgets in K2
|
||||
// 0.1.24 - Make realpath better
|
||||
// 0.1.25 - Support for new WP2.6 config location
|
||||
// ======================================================================================
|
||||
|
||||
|
||||
/**
|
||||
* Wraps up several useful functions for WordPress plugins and provides a method to separate
|
||||
* display HTML from PHP code.
|
||||
*
|
||||
* <h4>Display Rendering</h4>
|
||||
* The class uses a similar technique to Ruby On Rails views, whereby the display HTML is kept
|
||||
* in a separate directory and file from the main code. A display is 'rendered' (sent to the browser)
|
||||
* or 'captured' (returned to the calling function).
|
||||
*
|
||||
* Template files are separated into two areas: admin and user. Admin templates are only for display in
|
||||
* the WordPress admin interface, while user templates are typically for display on the site (although neither
|
||||
* of these are enforced). All templates are PHP code, but are referred to without .php extension.
|
||||
*
|
||||
* The reason for this separation is that one golden rule of plugin creation is that someone will always want to change
|
||||
* the formatting and style of your output. Rather than forcing them to modify the plugin (bad), or modify files within
|
||||
* the plugin (equally bad), the class allows user templates to be overridden with files contained within the theme.
|
||||
*
|
||||
* An additional benefit is that it leads to code re-use, especially with regards to Ajax (i.e. your display code can be called from
|
||||
* many locations)
|
||||
*
|
||||
* Template files are located within the 'view' subdirectory of the plugins base (specified when registering the plugin):
|
||||
*
|
||||
* <pre>myplugin/view/admin
|
||||
* myplugin/view/myplugin</pre>
|
||||
*
|
||||
* Admin templates are contained within 'admin', and user templates are contained within a directory of the same name as the plugin.
|
||||
*
|
||||
* User files can be overridden within the theme by creating a similar directory structure:
|
||||
*
|
||||
* <pre>/themes/mytheme/view/myplugin</pre>
|
||||
*
|
||||
* The class will first look in the theme and then defaults to the plugin. A plugin should always provide default templates.
|
||||
*
|
||||
* <h4>Display Parameters</h4>
|
||||
* Also similar to Ruby On Rails, when you display a template you must supply the parameters that the template has access to. This tries
|
||||
* to ensure a very clean separation between code and display. Parameters are supplied as an associative array mapping variable name to variable value.
|
||||
*
|
||||
* For example,
|
||||
*
|
||||
* array ('message' => 'Your data was processed', 'items' => 103);
|
||||
*
|
||||
* <h4>How it works in practice</h4>
|
||||
* You create a template file to display how many items have been processed. You store this in 'view/admin/processed.php':
|
||||
*
|
||||
* <pre><p>You processed <?php echo $items ?> items</p></pre>
|
||||
*
|
||||
* When you want to display this in your plugin you use:
|
||||
*
|
||||
* <pre> $this->render_admin ('processed', array ('items' => 100));
|
||||
*
|
||||
* @package WordPress base library
|
||||
* @author John Godley
|
||||
* @copyright Copyright (C) John Godley
|
||||
**/
|
||||
|
||||
class CustomPostTemplates_Plugin
|
||||
{
|
||||
/**
|
||||
* Plugin name
|
||||
* @var string
|
||||
**/
|
||||
var $plugin_name;
|
||||
|
||||
/**
|
||||
* Plugin 'view' directory
|
||||
* @var string Directory
|
||||
**/
|
||||
var $plugin_base;
|
||||
|
||||
|
||||
/**
|
||||
* Register your plugin with a name and base directory. This <strong>must</strong> be called once.
|
||||
*
|
||||
* @param string $name Name of your plugin. Is used to determine the plugin locale domain
|
||||
* @param string $base Directory containing the plugin's 'view' files.
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function register_plugin ($name, $base)
|
||||
{
|
||||
$this->plugin_base = rtrim (dirname ($base), '/');
|
||||
$this->plugin_name = $name;
|
||||
|
||||
$this->add_action ('init', 'load_locale');
|
||||
}
|
||||
|
||||
function load_locale ()
|
||||
{
|
||||
// Here we manually fudge the plugin locale as WP doesnt allow many options
|
||||
$locale = get_locale ();
|
||||
if ( empty($locale) )
|
||||
$locale = 'en_US';
|
||||
|
||||
$mofile = dirname (__FILE__)."/locale/$locale.mo";
|
||||
load_textdomain ($this->plugin_name, $mofile);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a WordPress action and map it back to the calling object
|
||||
*
|
||||
* @param string $action Name of the action
|
||||
* @param string $function Function name (optional)
|
||||
* @param int $priority WordPress priority (optional)
|
||||
* @param int $accepted_args Number of arguments the function accepts (optional)
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function add_action ($action, $function = '', $priority = 10, $accepted_args = 1)
|
||||
{
|
||||
add_action ($action, array (&$this, $function == '' ? $action : $function), $priority, $accepted_args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a WordPress filter and map it back to the calling object
|
||||
*
|
||||
* @param string $action Name of the action
|
||||
* @param string $function Function name (optional)
|
||||
* @param int $priority WordPress priority (optional)
|
||||
* @param int $accepted_args Number of arguments the function accepts (optional)
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function add_filter ($filter, $function = '', $priority = 10, $accepted_args = 1)
|
||||
{
|
||||
add_filter ($filter, array (&$this, $function == '' ? $filter : $function), $priority, $accepted_args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register a WordPress meta box
|
||||
*
|
||||
* @param string $id ID for the box, also used as a function name if none is given
|
||||
* @param string $title Title for the box
|
||||
* @param int $page WordPress priority (optional)
|
||||
* @param string $function Function name (optional)
|
||||
* @param string $context e.g. 'advanced' or 'core' (optional)
|
||||
* @param int $priority Priority, rough effect on the ordering (optional)
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function add_meta_box($id, $title, $function = '', $page, $context = 'advanced', $priority = 'default')
|
||||
{
|
||||
require_once( ABSPATH . 'wp-admin/includes/template.php' );
|
||||
add_meta_box( $id, $title, array( &$this, $function == '' ? $id : $function ), $page, $context, $priority );
|
||||
}
|
||||
|
||||
/**
|
||||
* Special activation function that takes into account the plugin directory
|
||||
*
|
||||
* @param string $pluginfile The plugin file location (i.e. __FILE__)
|
||||
* @param string $function Optional function name, or default to 'activate'
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function register_activation ($pluginfile, $function = '')
|
||||
{
|
||||
add_action ('activate_'.basename (dirname ($pluginfile)).'/'.basename ($pluginfile), array (&$this, $function == '' ? 'activate' : $function));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Special deactivation function that takes into account the plugin directory
|
||||
*
|
||||
* @param string $pluginfile The plugin file location (i.e. __FILE__)
|
||||
* @param string $function Optional function name, or default to 'deactivate'
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function register_deactivation ($pluginfile, $function = '')
|
||||
{
|
||||
add_action ('deactivate_'.basename (dirname ($pluginfile)).'/'.basename ($pluginfile), array (&$this, $function == '' ? 'deactivate' : $function));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders an admin section of display code
|
||||
*
|
||||
* @param string $ug_name Name of the admin file (without extension)
|
||||
* @param string $array Array of variable name=>value that is available to the display code (optional)
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function render_admin ($ug_name, $ug_vars = array ())
|
||||
{
|
||||
global $plugin_base;
|
||||
foreach ($ug_vars AS $key => $val)
|
||||
$$key = $val;
|
||||
|
||||
if (file_exists ("{$this->plugin_base}/view/admin/$ug_name.php"))
|
||||
include ("{$this->plugin_base}/view/admin/$ug_name.php");
|
||||
else
|
||||
echo "<p>Rendering of admin template {$this->plugin_base}/view/admin/$ug_name.php failed</p>";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders a section of user display code. The code is first checked for in the current theme display directory
|
||||
* before defaulting to the plugin
|
||||
*
|
||||
* @param string $ug_name Name of the admin file (without extension)
|
||||
* @param string $array Array of variable name=>value that is available to the display code (optional)
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function render ($ug_name, $ug_vars = array ())
|
||||
{
|
||||
foreach ($ug_vars AS $key => $val)
|
||||
$$key = $val;
|
||||
|
||||
if (file_exists (TEMPLATEPATH."/view/{$this->plugin_name}/$ug_name.php"))
|
||||
include (TEMPLATEPATH."/view/{$this->plugin_name}/$ug_name.php");
|
||||
else if (file_exists ("{$this->plugin_base}/view/{$this->plugin_name}/$ug_name.php"))
|
||||
include ("{$this->plugin_base}/view/{$this->plugin_name}/$ug_name.php");
|
||||
else
|
||||
echo "<p>Rendering of template $ug_name.php failed</p>";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders a section of user display code. The code is first checked for in the current theme display directory
|
||||
* before defaulting to the plugin
|
||||
*
|
||||
* @param string $ug_name Name of the admin file (without extension)
|
||||
* @param string $array Array of variable name=>value that is available to the display code (optional)
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function capture ($ug_name, $ug_vars = array ())
|
||||
{
|
||||
ob_start ();
|
||||
$this->render ($ug_name, $ug_vars);
|
||||
$output = ob_get_contents ();
|
||||
ob_end_clean ();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Captures an admin section of display code
|
||||
*
|
||||
* @param string $ug_name Name of the admin file (without extension)
|
||||
* @param string $array Array of variable name=>value that is available to the display code (optional)
|
||||
* @return string Captured code
|
||||
**/
|
||||
|
||||
function capture_admin ($ug_name, $ug_vars = array ())
|
||||
{
|
||||
ob_start ();
|
||||
$this->render_admin ($ug_name, $ug_vars);
|
||||
$output = ob_get_contents ();
|
||||
ob_end_clean ();
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display a standard error message (using CSS ID 'message' and classes 'fade' and 'error)
|
||||
*
|
||||
* @param string $message Message to display
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function render_error ($message)
|
||||
{
|
||||
?>
|
||||
<div class="fade error" id="message">
|
||||
<p><?php echo $message ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display a standard notice (using CSS ID 'message' and class 'updated').
|
||||
* Note that the notice can be made to automatically disappear, and can be removed
|
||||
* by clicking on it.
|
||||
*
|
||||
* @param string $message Message to display
|
||||
* @param int $timeout Number of seconds to automatically remove the message (optional)
|
||||
* @return void
|
||||
**/
|
||||
|
||||
function render_message ($message, $timeout = 0)
|
||||
{
|
||||
?>
|
||||
<div class="updated" id="message" onclick="this.parentNode.removeChild (this)">
|
||||
<p><?php echo $message ?></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the plugin's base directory
|
||||
*
|
||||
* @return string Base directory
|
||||
**/
|
||||
|
||||
function dir ()
|
||||
{
|
||||
return $this->plugin_base;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a URL to the plugin. Useful for specifying JS and CSS files
|
||||
*
|
||||
* For example, <img src="<?php echo $this->url () ?>/myimage.png"/>
|
||||
*
|
||||
* @return string URL
|
||||
**/
|
||||
|
||||
function url ($url = '')
|
||||
{
|
||||
if ($url)
|
||||
return str_replace ('\\', urlencode ('\\'), str_replace ('&amp', '&', str_replace ('&', '&', $url)));
|
||||
else
|
||||
{
|
||||
$root = ABSPATH;
|
||||
if (defined ('WP_PLUGIN_DIR'))
|
||||
$root = WP_PLUGIN_DIR;
|
||||
|
||||
$url = substr ($this->plugin_base, strlen ($this->realpath ($root)));
|
||||
if (DIRECTORY_SEPARATOR != '/')
|
||||
$url = str_replace (DIRECTORY_SEPARATOR, '/', $url);
|
||||
|
||||
if (defined ('WP_PLUGIN_URL'))
|
||||
$url = WP_PLUGIN_URL.'/'.ltrim ($url, '/');
|
||||
else
|
||||
$url = get_bloginfo ('wpurl').'/'.ltrim ($url, '/');
|
||||
|
||||
// Do an SSL check - only works on Apache
|
||||
global $is_IIS;
|
||||
if (isset ($_SERVER['HTTPS']) && !$is_IIS)
|
||||
$url = str_replace ('http://', 'https://', $url);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a version update check using an RSS feed. The function ensures that the feed is only
|
||||
* hit once every given number of days, and the data is cached using the WordPress Magpie library
|
||||
*
|
||||
* @param string $url URL of the RSS feed
|
||||
* @param int $days Number of days before next check
|
||||
* @return string Text to display
|
||||
**/
|
||||
|
||||
function version_update ($url, $days = 7)
|
||||
{
|
||||
if (!function_exists ('fetch_rss'))
|
||||
{
|
||||
if (!file_exists (ABSPATH.'wp-includes/rss.php'))
|
||||
return '';
|
||||
include (ABSPATH.'wp-includes/rss.php');
|
||||
}
|
||||
|
||||
$now = time ();
|
||||
|
||||
$checked = get_option ('plugin_urbangiraffe_rss');
|
||||
|
||||
// Use built-in Magpie caching
|
||||
if (function_exists ('fetch_rss') && (!isset ($checked[$this->plugin_name]) || $now > $checked[$this->plugin_name] + ($days * 24 * 60 * 60)))
|
||||
{
|
||||
$rss = fetch_rss ($url);
|
||||
if (count ($rss->items) > 0)
|
||||
{
|
||||
foreach ($rss->items AS $pos => $item)
|
||||
{
|
||||
if (isset ($checked[$this->plugin_name]) && strtotime ($item['pubdate']) < $checked[$this->plugin_name])
|
||||
unset ($rss->items[$pos]);
|
||||
}
|
||||
}
|
||||
|
||||
$checked[$this->plugin_name] = $now;
|
||||
update_option ('plugin_urbangiraffe_rss', $checked);
|
||||
return $rss;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Version of realpath that will work on systems without realpath
|
||||
*
|
||||
* @param string $path The path to canonicalize
|
||||
* @return string Canonicalized path
|
||||
**/
|
||||
|
||||
function realpath ($path)
|
||||
{
|
||||
if (function_exists ('realpath'))
|
||||
return realpath ($path);
|
||||
else if (DIRECTORY_SEPARATOR == '/')
|
||||
{
|
||||
$path = preg_replace ('/^~/', $_SERVER['DOCUMENT_ROOT'], $path);
|
||||
|
||||
// canonicalize
|
||||
$path = explode (DIRECTORY_SEPARATOR, $path);
|
||||
$newpath = array ();
|
||||
for ($i = 0; $i < sizeof ($path); $i++)
|
||||
{
|
||||
if ($path[$i] === '' || $path[$i] === '.')
|
||||
continue;
|
||||
|
||||
if ($path[$i] === '..')
|
||||
{
|
||||
array_pop ($newpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push ($newpath, $path[$i]);
|
||||
}
|
||||
|
||||
$finalpath = DIRECTORY_SEPARATOR.implode (DIRECTORY_SEPARATOR, $newpath);
|
||||
return $finalpath;
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
|
||||
function checked ($item, $field = '')
|
||||
{
|
||||
if ($field && is_array ($item))
|
||||
{
|
||||
if (isset ($item[$field]) && $item[$field])
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
else if (!empty ($item))
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
|
||||
function select ($items, $default = '')
|
||||
{
|
||||
if (count ($items) > 0)
|
||||
{
|
||||
foreach ($items AS $key => $value)
|
||||
{
|
||||
if (is_array ($value))
|
||||
{
|
||||
echo '<optgroup label="'.$key.'">';
|
||||
foreach ($value AS $sub => $subvalue)
|
||||
echo '<option value="'.$sub.'"'.($sub == $default ? ' selected="selected"' : '').'>'.$subvalue.'</option>';
|
||||
echo '</optgroup>';
|
||||
}
|
||||
else
|
||||
echo '<option value="'.$key.'"'.($key == $default ? ' selected="selected"' : '').'>'.$value.'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists ('pr'))
|
||||
{
|
||||
function pr ($thing)
|
||||
{
|
||||
echo '<pre>';
|
||||
print_r ($thing);
|
||||
echo '</pre>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists ('Widget_SU'))
|
||||
{
|
||||
class Widget_SU
|
||||
{
|
||||
function Widget_SU ($name, $max = 1, $id = '', $args = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->id = $id;
|
||||
$this->widget_max = $max;
|
||||
$this->args = $args;
|
||||
|
||||
if ($this->id == '')
|
||||
$this->id = strtolower (preg_replace ('/[^A-Za-z]/', '-', $this->name));
|
||||
|
||||
$this->widget_available = 1;
|
||||
if ($this->widget_max > 1)
|
||||
{
|
||||
$this->widget_available = get_option ('widget_available_'.$this->id ());
|
||||
if ($this->widget_available === false)
|
||||
$this->widget_available = 1;
|
||||
}
|
||||
|
||||
add_action ('init', array (&$this, 'initialize'));
|
||||
}
|
||||
|
||||
function initialize ()
|
||||
{
|
||||
// Compatability functions for WP 2.1
|
||||
if (!function_exists ('wp_register_sidebar_widget'))
|
||||
{
|
||||
function wp_register_sidebar_widget ($id, $name, $output_callback, $classname = '')
|
||||
{
|
||||
register_sidebar_widget($name, $output_callback, $classname);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists ('wp_register_widget_control'))
|
||||
{
|
||||
function wp_register_widget_control($name, $control_callback, $width = 300, $height = 200)
|
||||
{
|
||||
register_widget_control($name, $control_callback, $width, $height);
|
||||
}
|
||||
}
|
||||
|
||||
if (function_exists ('wp_register_sidebar_widget'))
|
||||
{
|
||||
if ($this->widget_max > 1)
|
||||
{
|
||||
add_action ('sidebar_admin_setup', array (&$this, 'setup_save'));
|
||||
add_action ('sidebar_admin_page', array (&$this, 'setup_display'));
|
||||
}
|
||||
|
||||
$this->load_widgets ();
|
||||
}
|
||||
}
|
||||
|
||||
function load_widgets ()
|
||||
{
|
||||
for ($pos = 1; $pos <= $this->widget_max; $pos++)
|
||||
{
|
||||
wp_register_sidebar_widget ($this->id ($pos), $this->name ($pos), $pos <= $this->widget_available ? array (&$this, 'show_display') : '', $this->args (), $pos);
|
||||
|
||||
if ($this->has_config ())
|
||||
wp_register_widget_control ($this->id ($pos), $this->name ($pos), $pos <= $this->widget_available ? array (&$this, 'show_config') : '', $this->args (), $pos);
|
||||
}
|
||||
}
|
||||
|
||||
function args ()
|
||||
{
|
||||
if ($this->args)
|
||||
return $args;
|
||||
return array ('classname' => '');
|
||||
}
|
||||
|
||||
function name ($pos)
|
||||
{
|
||||
if ($this->widget_available > 1)
|
||||
return $this->name.' ('.$pos.')';
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
function id ($pos = 0)
|
||||
{
|
||||
if ($pos == 0)
|
||||
return $this->id;
|
||||
return $this->id.'-'.$pos;
|
||||
}
|
||||
|
||||
function show_display ($args, $number = 1)
|
||||
{
|
||||
$config = get_option ('widget_config_'.$this->id ($number));
|
||||
if ($config === false)
|
||||
$config = array ();
|
||||
|
||||
$this->load ($config);
|
||||
$this->display ($args);
|
||||
}
|
||||
|
||||
function show_config ($position)
|
||||
{
|
||||
if (isset ($_POST['widget_config_save_'.$this->id ($position)]))
|
||||
{
|
||||
$data = $_POST[$this->id ()];
|
||||
if (count ($data) > 0)
|
||||
{
|
||||
$newdata = array ();
|
||||
foreach ($data AS $item => $values)
|
||||
$newdata[$item] = $values[$position];
|
||||
$data = $newdata;
|
||||
}
|
||||
|
||||
update_option ('widget_config_'.$this->id ($position), $this->save ($data));
|
||||
}
|
||||
|
||||
$options = get_option ('widget_config_'.$this->id ($position));
|
||||
if ($options === false)
|
||||
$options = array ();
|
||||
|
||||
$this->config ($options, $position);
|
||||
echo '<input type="hidden" name="widget_config_save_'.$this->id ($position).'" value="1" />';
|
||||
}
|
||||
|
||||
function has_config () { return false; }
|
||||
function save ($data)
|
||||
{
|
||||
return array ();
|
||||
}
|
||||
|
||||
function setup_save ()
|
||||
{
|
||||
if (isset ($_POST['widget_setup_save_'.$this->id ()]))
|
||||
{
|
||||
$this->widget_available = intval ($_POST['widget_setup_count_'.$this->id ()]);
|
||||
if ($this->widget_available < 1)
|
||||
$this->widget_available = 1;
|
||||
else if ($this->widget_available > $this->widget_max)
|
||||
$this->widget_available = $this->widget_max;
|
||||
|
||||
update_option ('widget_available_'.$this->id (), $this->widget_available);
|
||||
|
||||
$this->load_widgets ();
|
||||
}
|
||||
}
|
||||
|
||||
function config_name ($field, $pos)
|
||||
{
|
||||
return $this->id ().'['.$field.']['.$pos.']';
|
||||
}
|
||||
|
||||
function setup_display ()
|
||||
{
|
||||
?>
|
||||
<div class="wrap">
|
||||
<form method="post">
|
||||
<h2><?php echo $this->name ?></h2>
|
||||
<p style="line-height: 30px;"><?php _e('How many widgets would you like?', $this->id); ?>
|
||||
<select name="widget_setup_count_<?php echo $this->id () ?>" value="<?php echo $options; ?>">
|
||||
<?php for ( $i = 1; $i <= $this->widget_max; ++$i ) : ?>
|
||||
<option value="<?php echo $i ?>"<?php if ($this->widget_available == $i) echo ' selected="selected"' ?>><?php echo $i ?></option>
|
||||
<?php endfor; ?>
|
||||
</select>
|
||||
<span class="submit">
|
||||
<input type="submit" name="widget_setup_save_<?php echo $this->id () ?>" value="<?php echo attribute_escape(__('Save', $this->id)); ?>" />
|
||||
</span>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,87 +0,0 @@
|
||||
=== Custom Post Template ===
|
||||
Contributors: simonwheatley
|
||||
Donate link: http://www.simonwheatley.co.uk/wordpress/
|
||||
Tags: post, template, theme
|
||||
Requires at least: 2.9
|
||||
Tested up to: 2.9.1
|
||||
Stable tag: 1.1
|
||||
|
||||
Provides a drop-down to select different templates for posts from the post edit screen. The templates replace single.php for the specified post.
|
||||
|
||||
== Description ==
|
||||
|
||||
**This plugin requires PHP5 (see Other Notes > PHP4 for more).**
|
||||
|
||||
Provides a drop-down to select different templates for posts from the post edit screen. The templates are defined similarly to page templates, and will replace single.php for the specified post.
|
||||
|
||||
Post templates, as far as this plugin is concerned, are configured similarly to [page templates](http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates) in that they have a particular style of PHP comment at the top of them. Each post template must contain the following, or similar, at the top:
|
||||
<code>
|
||||
<?php
|
||||
/*
|
||||
Template Name Posts: Snarfer
|
||||
*/
|
||||
?>
|
||||
</code>
|
||||
|
||||
Note that *page* templates use "_Template Name:_", whereas *post* templates use "_Template Name Posts:_".
|
||||
|
||||
Plugin initially produced on behalf of [Words & Pictures](http://www.wordsandpics.co.uk/).
|
||||
|
||||
Is this plugin lacking a feature you want? I'm happy to discuss ideas, or to accept offers of feature sponsorship: [contact me](http://www.simonwheatley.co.uk/contact-me/) and we can have a chat.
|
||||
|
||||
Any issues: [contact me](http://www.simonwheatley.co.uk/contact-me/).
|
||||
|
||||
== Installation ==
|
||||
|
||||
The plugin is simple to install:
|
||||
|
||||
1. Download the plugin, it will arrive as a zip file
|
||||
1. Unzip it
|
||||
1. Upload `custom-post-template` directory to your WordPress Plugin directory
|
||||
1. Go to the plugin management page and enable the plugin
|
||||
1. Upload your post template files (see the Description for details on configuring these), and choose them through the new menu
|
||||
1. Give yourself a pat on the back
|
||||
|
||||
== PHP4 ==
|
||||
|
||||
Many of my plugin now require at least PHP5. I know that WordPress officially supports PHP4, but I don't. PHP4 is a mess and makes coding a lot less efficient, and when you're releasing stuff for free these things matter. PHP5 has been out for several years now and is fully production ready, as well as being naturally more secure and performant.
|
||||
|
||||
If you're still running PHP4, I strongly suggest you talk to your hosting company about upgrading your servers. All reputable hosting companies should offer PHP5 as well as PHP4.
|
||||
|
||||
Right, that's it. Grump over. ;)
|
||||
|
||||
== Change Log ==
|
||||
|
||||
= v1.1 2010/01/27 =
|
||||
|
||||
* IDIOTFIX: Managed to revert to an old version somehow, this version should fix that.
|
||||
|
||||
= v1 2010/01/15 (released 2010/01/26) =
|
||||
|
||||
* BUGFIX: Theme templates now come with a complete filepath, so no need to add WP_CONTENT_DIR constant to the beginning.
|
||||
* ENHANCEMENT: Metabox now shows up on the side, under the publish box... where you'd expect.
|
||||
|
||||
= v0.9b 2008/11/26 =
|
||||
|
||||
* Plugin first released
|
||||
|
||||
= v0.91b 2008/11/28 =
|
||||
|
||||
* BUGFIX: The plugin was breaking posts using the "default" template, this is now fixed. Apologies for the inconvenience.
|
||||
* Tested up to WordPress 2.7-beta3-9922
|
||||
|
||||
= v0.91b 2008/11/28 =
|
||||
|
||||
* BUGFIX: The plugin was breaking posts using the "default" template, this is now fixed. Apologies for the inconvenience.
|
||||
* Tested up to WordPress 2.7-beta3-9922* Tested up to WordPress 2.7-beta3-9922
|
||||
|
||||
= v0.92b 2008/12/04 =
|
||||
|
||||
* Minor code tweaks
|
||||
* Blocked direct access to templates
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= I get an error like this: <code>Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /web/wp-content/plugins/custom-post-template/custom-post-templates.php</code> =
|
||||
|
||||
This is because your server is running PHP4. Please see "Other Notes > PHP4" for more information.
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
|
||||
<label class="hidden" for="page_template"><?php _e( 'Post Template' ); ?></label>
|
||||
<input type="hidden" name="custom_post_template_present" value="1" />
|
||||
<select name="custom_post_template" id="custom_post_template">
|
||||
<option
|
||||
value='default'
|
||||
<?php
|
||||
if ( ! $custom_template ) {
|
||||
echo "selected='selected'";
|
||||
}
|
||||
?>><?php _e( 'Default Template' ); ?></option>
|
||||
<?php foreach( $templates AS $name => $filename ) { ?>
|
||||
<option
|
||||
value='<?php echo $filename; ?>'
|
||||
<?php
|
||||
if ( $custom_template == $filename ) {
|
||||
echo "selected='selected'";
|
||||
}
|
||||
?>><?php echo $name; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<p><?php _e( 'Some themes have custom templates you can use for certain posts that might have additional features or custom layouts. If so, you’ll see them above.' ); ?></p>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
$permalink = get_permalink();
|
||||
$title = get_the_title();
|
||||
$excerpt = get_the_excerpt();
|
||||
?>
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
var disqus_url = '<?php echo $permalink; ?> ';
|
||||
var disqus_title = '<?php echo $title; ?>';
|
||||
var disqus_message = '<?php echo $excerpt; ?>';
|
||||
</script>
|
||||
<script type="text/javascript" src="<?php echo DISQUS_URL; ?>/forums/<?php echo get_option('disqus_forum_url'); ?>/embed.js"></script>
|
||||
<noscript>Please enable JavaScript to view the <a href="<?php echo 'http://disqus.com/?ref_noscript=' . get_option('disqus_forum_url') ?>">comments powered by Disqus.</a></noscript>
|
||||
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
global $dsq_response, $dsq_version;
|
||||
?>
|
||||
|
||||
<div id="disqus_thread">
|
||||
<div id="dsq-content">
|
||||
<ul id="dsq-comments">
|
||||
<?php foreach ( $dsq_response['posts'] as $comment ) : ?>
|
||||
<li id="dsq-comment-<?php echo $comment['id']; ?>">
|
||||
<div id="dsq-comment-header-<?php echo $comment['id']; ?>" class="dsq-comment-header">
|
||||
<cite id="dsq-cite-<?php echo $comment['id']; ?>">
|
||||
<?php if($comment['user']['url']) : ?>
|
||||
<a id="dsq-author-user-<?php echo $comment['id']; ?>" href="<?php echo $comment['user']['url']; ?>" target="_blank" rel="nofollow"><?php echo $comment['user']['display_name']; ?></a>
|
||||
<?php else : ?>
|
||||
<span id="dsq-author-user-<?php echo $comment['id']; ?>"><?php echo $comment['user']['display_name']; ?></span>
|
||||
<?php endif; ?>
|
||||
</cite>
|
||||
</div>
|
||||
<div id="dsq-comment-body-<?php echo $comment['id']; ?>" class="dsq-comment-body">
|
||||
<div id="dsq-comment-message-<?php echo $comment['id']; ?>" class="dsq-comment-message"><?php echo $comment['message']; ?></div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var disqus_url = '<?php echo get_permalink(); ?> ';
|
||||
var disqus_container_id = 'disqus_thread';
|
||||
var facebookXdReceiverPath = '<?php echo DSQ_PLUGIN_URL . '/xd_receiver.htm' ?>';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
var DsqLocal = {
|
||||
'trackbacks': [
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($comments as $comment) {
|
||||
$comment_type = get_comment_type();
|
||||
if ( $comment_type != 'comment' ) {
|
||||
if( $count ) { echo ','; }
|
||||
?>
|
||||
{
|
||||
'author_name': '<?php echo htmlspecialchars(get_comment_author(), ENT_QUOTES); ?>',
|
||||
'author_url': '<?php echo htmlspecialchars(get_comment_author_url(), ENT_QUOTES); ?>',
|
||||
'date': '<?php comment_date('m/d/Y h:i A'); ?>',
|
||||
'excerpt': '<?php echo str_replace(array("\r\n", "\n", "\r"), '<br />', htmlspecialchars(get_comment_excerpt(), ENT_QUOTES)); ?>',
|
||||
'type': '<?php echo $comment_type; ?>'
|
||||
}
|
||||
<?php
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
],
|
||||
'trackback_url': '<?php trackback_url(); ?>'
|
||||
};
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
(function() {
|
||||
var dsq = document.createElement('script');
|
||||
dsq.type = 'text/javascript';
|
||||
dsq.async = true;
|
||||
dsq.src = "http://<?php echo strtolower(get_option('disqus_forum_url')); ?>.<?php echo DISQUS_DOMAIN; ?>/disqus.js?v=2.0&slug=<?php echo $dsq_response['thread_slug']; ?>&pname=wordpress&pver=<?php echo $dsq_version; ?>";
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
@@ -1,977 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Disqus Comment System
|
||||
Plugin URI: http://disqus.com/
|
||||
Description: The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus. Head over to the Comments admin page to set up your DISQUS Comment System.
|
||||
Author: Disqus <team@disqus.com>
|
||||
Version: 2.33.8752
|
||||
Author URI: http://disqus.com/
|
||||
*/
|
||||
|
||||
require_once('lib/api.php');
|
||||
|
||||
define('DISQUS_URL', 'http://disqus.com');
|
||||
define('DISQUS_API_URL', DISQUS_URL);
|
||||
define('DISQUS_DOMAIN', 'disqus.com');
|
||||
define('DISQUS_IMPORTER_URL', 'http://import.disqus.net');
|
||||
define('DISQUS_MEDIA_URL', 'http://media.disqus.com');
|
||||
define('DISQUS_RSS_PATH', '/latest.rss');
|
||||
|
||||
function dsq_plugin_basename($file) {
|
||||
$file = dirname($file);
|
||||
|
||||
// From WP2.5 wp-includes/plugin.php:plugin_basename()
|
||||
$file = str_replace('\\','/',$file); // sanitize for Win32 installs
|
||||
$file = preg_replace('|/+|','/', $file); // remove any duplicate slash
|
||||
$file = preg_replace('|^.*/' . PLUGINDIR . '/|','',$file); // get relative path from plugins dir
|
||||
|
||||
if ( strstr($file, '/') === false ) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
$pieces = explode('/', $file);
|
||||
return !empty($pieces[count($pieces)-1]) ? $pieces[count($pieces)-1] : $pieces[count($pieces)-2];
|
||||
}
|
||||
|
||||
if ( !defined('WP_CONTENT_URL') ) {
|
||||
define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
|
||||
}
|
||||
if ( !defined('PLUGINDIR') ) {
|
||||
define('PLUGINDIR', 'wp-content/plugins'); // Relative to ABSPATH. For back compat.
|
||||
}
|
||||
|
||||
define('DSQ_PLUGIN_URL', WP_CONTENT_URL . '/plugins/' . dsq_plugin_basename(__FILE__));
|
||||
|
||||
/**
|
||||
* Disqus WordPress plugin version.
|
||||
*
|
||||
* @global string $dsq_version
|
||||
* @since 1.0
|
||||
*/
|
||||
$dsq_version = '2.33';
|
||||
$mt_dsq_version = '2.01';
|
||||
/**
|
||||
* Response from Disqus get_thread API call for comments template.
|
||||
*
|
||||
* @global string $dsq_response
|
||||
* @since 1.0
|
||||
*/
|
||||
$dsq_response = '';
|
||||
/**
|
||||
* Comment sort option.
|
||||
*
|
||||
* @global string $dsq_sort
|
||||
* @since 1.0
|
||||
*/
|
||||
$dsq_sort = 1;
|
||||
/**
|
||||
* Flag to determine whether or not the comment count script has been embedded.
|
||||
*
|
||||
* @global string $dsq_cc_script_embedded
|
||||
* @since 1.0
|
||||
*/
|
||||
$dsq_cc_script_embedded = false;
|
||||
/**
|
||||
* Disqus API instance.
|
||||
*
|
||||
* @global string $dsq_api
|
||||
* @since 1.0
|
||||
*/
|
||||
$dsq_api = new DisqusAPI(get_option('disqus_forum_url'), get_option('disqus_api_key'));
|
||||
/**
|
||||
* DISQUS is_feed check.
|
||||
*
|
||||
* @global bool $dsq_is_feed
|
||||
* @since 2.2
|
||||
*/
|
||||
$dsq_is_feed = false;
|
||||
|
||||
/**
|
||||
* DISQUS currently unsupported dev toggle to output comments for this query.
|
||||
*
|
||||
* @global bool $dsq_comments_for_query
|
||||
* @since ?
|
||||
*/
|
||||
$DSQ_QUERY_COMMENTS = false;
|
||||
|
||||
/**
|
||||
* DISQUS array to store post_ids from WP_Query for comment JS output.
|
||||
*
|
||||
* @global array $DSQ_QUERY_POST_IDS
|
||||
* @since 2.2
|
||||
*/
|
||||
$DSQ_QUERY_POST_IDS = array();
|
||||
|
||||
/**
|
||||
* Helper functions.
|
||||
*/
|
||||
|
||||
function dsq_legacy_mode() {
|
||||
return get_option('disqus_forum_url') && !get_option('disqus_api_key');
|
||||
}
|
||||
|
||||
function dsq_is_installed() {
|
||||
return get_option('disqus_forum_url') && get_option('disqus_api_key');
|
||||
}
|
||||
|
||||
function dsq_can_replace() {
|
||||
global $id, $post;
|
||||
$replace = get_option('disqus_replace');
|
||||
|
||||
if ( 'draft' == $post->post_status ) { return false; }
|
||||
if ( !get_option('disqus_forum_url') ) { return false; }
|
||||
else if ( 'all' == $replace ) { return true; }
|
||||
|
||||
if ( !isset($post->comment_count) ) {
|
||||
$num_comments = 0;
|
||||
} else {
|
||||
if ( 'empty' == $replace ) {
|
||||
// Only get count of comments, not including pings.
|
||||
|
||||
// If there are comments, make sure there are comments (that are not track/pingbacks)
|
||||
if ( $post->comment_count > 0 ) {
|
||||
// Yuck, this causes a DB query for each post. This can be
|
||||
// replaced with a lighter query, but this is still not optimal.
|
||||
$comments = get_approved_comments($post->ID);
|
||||
foreach ( $comments as $comment ) {
|
||||
if ( $comment->comment_type != 'trackback' && $comment->comment_type != 'pingback' ) {
|
||||
$num_comments++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$num_comments = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$num_comments = $post->comment_count;
|
||||
}
|
||||
}
|
||||
|
||||
return ( ('empty' == $replace && 0 == $num_comments)
|
||||
|| ('closed' == $replace && 'closed' == $post->comment_status) );
|
||||
}
|
||||
|
||||
function dsq_manage_dialog($message, $error = false) {
|
||||
global $wp_version;
|
||||
|
||||
echo '<div '
|
||||
. ( $error ? 'id="disqus_warning" ' : '')
|
||||
. 'class="updated fade'
|
||||
. ( (version_compare($wp_version, '2.5', '<') && $error) ? '-ff0000' : '' )
|
||||
. '"><p><strong>'
|
||||
. $message
|
||||
. '</strong></p></div>';
|
||||
}
|
||||
|
||||
function dsq_sync_comments($post, $comments) {
|
||||
global $wpdb;
|
||||
|
||||
// Get last_comment_date id for $post with Disqus metadata
|
||||
// (This is the date that is stored in the Disqus DB.)
|
||||
$last_comment_date = $wpdb->get_var('SELECT max(comment_date) FROM ' . $wpdb->prefix . 'comments WHERE comment_post_ID=' . intval($post->ID) . " AND comment_agent LIKE 'Disqus/%';");
|
||||
if ( $last_comment_date ) {
|
||||
$last_comment_date = strtotime($last_comment_date);
|
||||
}
|
||||
|
||||
if ( !$last_comment_date ) {
|
||||
$last_comment_date = 0;
|
||||
}
|
||||
|
||||
foreach ( $comments as $comment ) {
|
||||
if ( $comment['imported'] ) {
|
||||
continue;
|
||||
} else if ( $comment['date'] <= $last_comment_date ) {
|
||||
// If comment date of comment is <= last_comment_date, skip comment.
|
||||
continue;
|
||||
} else {
|
||||
// Else, insert_comment
|
||||
$commentdata = array(
|
||||
'comment_post_ID' => $post->ID,
|
||||
'comment_author' => $comment['user']['display_name'],
|
||||
'comment_author_email' => $comment['user']['email'],
|
||||
'comment_author_url' => $comment['user']['url'],
|
||||
'comment_author_IP' => $comment['user']['ip_address'],
|
||||
'comment_date' => date('Y-m-d H:i:s', $comment['date']),
|
||||
'comment_date_gmt' => date('Y-m-d H:i:s', $comment['date_gmt']),
|
||||
'comment_content' => $comment['message'],
|
||||
'comment_approved' => 1,
|
||||
'comment_agent' => 'Disqus/1.0:' . intval($comment['id']),
|
||||
'comment_type' => '',
|
||||
);
|
||||
wp_insert_comment($commentdata);
|
||||
}
|
||||
}
|
||||
|
||||
if( isset($_POST['dsq_api_key']) && $_POST['dsq_api_key'] == get_option('disqus_api_key') ) {
|
||||
if( isset($_GET['dsq_sync_action']) && isset($_GET['dsq_sync_comment_id']) ) {
|
||||
$comment_parts = explode('=', $_GET['dsq_sync_comment_id']);
|
||||
if( 'wp_id' == $comment_parts[0] ) {
|
||||
$comment_id = intval($comment_parts[1]);
|
||||
} else {
|
||||
$comment_id = $wpdb->get_var('SELECT comment_ID FROM ' . $wpdb->prefix . 'comments WHERE comment_post_ID=' . intval($post->ID) . " AND comment_agent LIKE 'Disqus/1.0:" . intval($comment_parts[1]) . "'");
|
||||
}
|
||||
|
||||
switch( $_GET['dsq_sync_action'] ) {
|
||||
case 'mark_spam':
|
||||
wp_set_comment_status($comment_id, 'spam');
|
||||
echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'spam') -->";
|
||||
break;
|
||||
case 'mark_approved':
|
||||
wp_set_comment_status($comment_id, 'approve');
|
||||
echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'approve') -->";
|
||||
break;
|
||||
case 'mark_killed':
|
||||
wp_set_comment_status($comment_id, 'hold');
|
||||
echo "<!-- dsq_sync: wp_set_comment_status($comment_id, 'hold') -->";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function dsq_request_handler() {
|
||||
if (!empty($_GET['cf_action'])) {
|
||||
switch ($_GET['cf_action']) {
|
||||
case 'export_comments':
|
||||
if (current_user_can('manage_options')) {
|
||||
// handle vars
|
||||
$post_id = intval($_GET['post_id']);
|
||||
$limit = 2;
|
||||
global $wpdb, $dsq_api;
|
||||
$posts = $wpdb->get_results("
|
||||
SELECT *
|
||||
FROM $wpdb->posts
|
||||
WHERE post_type != 'revision'
|
||||
AND post_status = 'publish'
|
||||
AND comment_count > 0
|
||||
AND ID > $post_id
|
||||
ORDER BY ID ASC
|
||||
LIMIT $limit
|
||||
");
|
||||
$first_post_id = $posts[0]->ID;
|
||||
$last_post_id = $posts[(count($posts) - 1)]->ID;
|
||||
$max_post_id = $wpdb->get_var("
|
||||
SELECT MAX(ID)
|
||||
FROM $wpdb->posts
|
||||
WHERE post_type != 'revision'
|
||||
AND post_status = 'publish'
|
||||
AND comment_count > 0
|
||||
AND ID > $post_id
|
||||
");
|
||||
if ($last_post_id == $max_post_id) {
|
||||
$status = 'complete';
|
||||
$msg = 'All comments sent to Disqus!';
|
||||
}
|
||||
else {
|
||||
$status = 'partial';
|
||||
if (count($posts) == 1) {
|
||||
$msg = 'Processed comments on post #'.$first_post_id.'…';
|
||||
}
|
||||
else {
|
||||
$msg = 'Processed comments on posts #'.$first_post_id.'-'.$last_post_id.'…';
|
||||
}
|
||||
}
|
||||
$result = 'fail';
|
||||
if (count($posts)) {
|
||||
include_once(dirname(__FILE__) . '/export.php');
|
||||
$wxr = dsq_export_wp($posts);
|
||||
$import_id = $dsq_api->import_wordpress_comments($wxr);
|
||||
if ($import_id < 0) {
|
||||
$result = 'fail';
|
||||
$msg = '<p class="status dsq-export-fail">Sorry, something unexpected happened with the export. Please <a href="#" id="dsq_export_retry">try again</a></p><p>If your API key has changed, you may need to reinstall Disqus (deactivate the plugin and then reactivate it). If you are still having issues, refer to the <a href="http://disqus.com/help/wordpress" onclick="window.open(this.href); return false">WordPress help page</a>.</p>';
|
||||
}
|
||||
else {
|
||||
$result = 'success';
|
||||
}
|
||||
}
|
||||
// send AJAX response
|
||||
$response = compact('result', 'status', 'last_post_id', 'msg');
|
||||
header('Content-type: text/javascript');
|
||||
echo cf_json_encode($response);
|
||||
die();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('init', 'dsq_request_handler');
|
||||
|
||||
/**
|
||||
* Compatibility
|
||||
*/
|
||||
|
||||
if (!function_exists ( '_wp_specialchars' ) ) {
|
||||
function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
|
||||
$string = (string) $string;
|
||||
|
||||
if ( 0 === strlen( $string ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Don't bother if there are no specialchars - saves some processing
|
||||
if ( !preg_match( '/[&<>"\']/', $string ) ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
// Account for the previous behaviour of the function when the $quote_style is not an accepted value
|
||||
if ( empty( $quote_style ) ) {
|
||||
$quote_style = ENT_NOQUOTES;
|
||||
} elseif ( !in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
|
||||
$quote_style = ENT_QUOTES;
|
||||
}
|
||||
|
||||
// Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
|
||||
if ( !$charset ) {
|
||||
static $_charset;
|
||||
if ( !isset( $_charset ) ) {
|
||||
$alloptions = wp_load_alloptions();
|
||||
$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
|
||||
}
|
||||
$charset = $_charset;
|
||||
}
|
||||
if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
|
||||
$charset = 'UTF-8';
|
||||
}
|
||||
|
||||
$_quote_style = $quote_style;
|
||||
|
||||
if ( $quote_style === 'double' ) {
|
||||
$quote_style = ENT_COMPAT;
|
||||
$_quote_style = ENT_COMPAT;
|
||||
} elseif ( $quote_style === 'single' ) {
|
||||
$quote_style = ENT_NOQUOTES;
|
||||
}
|
||||
|
||||
// Handle double encoding ourselves
|
||||
if ( !$double_encode ) {
|
||||
$string = wp_specialchars_decode( $string, $_quote_style );
|
||||
$string = preg_replace( '/&(#?x?[0-9a-z]+);/i', '|wp_entity|$1|/wp_entity|', $string );
|
||||
}
|
||||
|
||||
$string = @htmlspecialchars( $string, $quote_style, $charset );
|
||||
|
||||
// Handle double encoding ourselves
|
||||
if ( !$double_encode ) {
|
||||
$string = str_replace( array( '|wp_entity|', '|/wp_entity|' ), array( '&', ';' ), $string );
|
||||
}
|
||||
|
||||
// Backwards compatibility
|
||||
if ( 'single' === $_quote_style ) {
|
||||
$string = str_replace( "'", ''', $string );
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists ( 'wp_check_invalid_utf8' ) ) {
|
||||
function wp_check_invalid_utf8( $string, $strip = false ) {
|
||||
$string = (string) $string;
|
||||
|
||||
if ( 0 === strlen( $string ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Store the site charset as a static to avoid multiple calls to get_option()
|
||||
static $is_utf8;
|
||||
if ( !isset( $is_utf8 ) ) {
|
||||
$is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
|
||||
}
|
||||
if ( !$is_utf8 ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
// Check for support for utf8 in the installed PCRE library once and store the result in a static
|
||||
static $utf8_pcre;
|
||||
if ( !isset( $utf8_pcre ) ) {
|
||||
$utf8_pcre = @preg_match( '/^./u', 'a' );
|
||||
}
|
||||
// We can't demand utf8 in the PCRE installation, so just return the string in those cases
|
||||
if ( !$utf8_pcre ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
// preg_match fails when it encounters invalid UTF8 in $string
|
||||
if ( 1 === @preg_match( '/^./us', $string ) ) {
|
||||
return $string;
|
||||
}
|
||||
|
||||
// Attempt to strip the bad chars if requested (not recommended)
|
||||
if ( $strip && function_exists( 'iconv' ) ) {
|
||||
return iconv( 'utf-8', 'utf-8', $string );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists ( 'esc_html' ) ) {
|
||||
function esc_html( $text ) {
|
||||
$safe_text = wp_check_invalid_utf8( $text );
|
||||
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
|
||||
return apply_filters( 'esc_html', $safe_text, $text );
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists ( 'esc_attr' ) ) {
|
||||
function esc_attr( $text ) {
|
||||
$safe_text = wp_check_invalid_utf8( $text );
|
||||
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
|
||||
return apply_filters( 'attribute_escape', $safe_text, $text );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters/Actions
|
||||
*/
|
||||
|
||||
function dsq_get_style() {
|
||||
echo "<link rel=\"stylesheet\" href=\"" . DISQUS_API_URL ."/stylesheets/" . strtolower(get_option('disqus_forum_url')) . "/disqus.css?v=2.0\" type=\"text/css\" media=\"screen\" />";
|
||||
}
|
||||
|
||||
add_action('wp_head','dsq_get_style');
|
||||
|
||||
function dsq_comments_template($value) {
|
||||
global $dsq_response;
|
||||
global $dsq_sort;
|
||||
global $dsq_api;
|
||||
global $post;
|
||||
|
||||
if ( !( is_singular() && ( have_comments() || 'open' == $post->comment_status ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !dsq_can_replace() ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ( dsq_legacy_mode() ) {
|
||||
return dirname(__FILE__) . '/comments-legacy.php';
|
||||
}
|
||||
|
||||
$permalink = get_permalink();
|
||||
$title = get_the_title();
|
||||
$excerpt = get_the_excerpt();
|
||||
|
||||
$dsq_sort = get_option('disqus_sort');
|
||||
if ( is_numeric($_COOKIE['disqus_sort']) ) {
|
||||
$dsq_sort = $_COOKIE['disqus_sort'];
|
||||
}
|
||||
|
||||
if ( is_numeric($_GET['dsq_sort']) ) {
|
||||
setcookie('disqus_sort', $_GET['dsq_sort']);
|
||||
$dsq_sort = $_GET['dsq_sort'];
|
||||
}
|
||||
|
||||
// Call "get_thread" API method.
|
||||
$dsq_response = $dsq_api->get_thread($post, $permalink, $title, $excerpt);
|
||||
if( $dsq_response < 0 ) {
|
||||
return false;
|
||||
}
|
||||
// Sync comments with database.
|
||||
dsq_sync_comments($post, $dsq_response['posts']);
|
||||
|
||||
// TODO: If a disqus-comments.php is found in the current template's
|
||||
// path, use that instead of the default bundled comments.php
|
||||
//return TEMPLATEPATH . '/disqus-comments.php';
|
||||
|
||||
return dirname(__FILE__) . '/comments.php';
|
||||
}
|
||||
|
||||
// Mark entries in index to replace comments link.
|
||||
function dsq_comments_number($comment_text) {
|
||||
global $post;
|
||||
|
||||
if ( dsq_can_replace() ) {
|
||||
return '<span class="dsq-postid-'.$post->ID.'">View Comments</span>';
|
||||
} else {
|
||||
return $comment_text;
|
||||
}
|
||||
}
|
||||
|
||||
function dsq_bloginfo_url($url) {
|
||||
if ( get_feed_link('comments_rss2') == $url ) {
|
||||
return 'http://' . strtolower(get_option('disqus_forum_url')) . '.' . DISQUS_DOMAIN . DISQUS_RSS_PATH;
|
||||
} else {
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
function dsq_plugin_action_links($links, $file) {
|
||||
$plugin_file = basename(__FILE__);
|
||||
if (basename($file) == $plugin_file) {
|
||||
$settings_link = '<a href="edit-comments.php?page=disqus#adv">'.__('Settings', 'disqus-comment-system').'</a>';
|
||||
array_unshift($links, $settings_link);
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
add_filter('plugin_action_links', 'dsq_plugin_action_links', 10, 2);
|
||||
|
||||
// Always add Disqus management page to the admin menu
|
||||
function dsq_add_pages() {
|
||||
add_submenu_page(
|
||||
'edit-comments.php',
|
||||
'Disqus',
|
||||
'Disqus',
|
||||
'moderate_comments',
|
||||
'disqus',
|
||||
'dsq_manage'
|
||||
);
|
||||
}
|
||||
add_action('admin_menu', 'dsq_add_pages', 10);
|
||||
|
||||
// a little jQuery goodness to get comments menu working as desired
|
||||
function sdq_menu_admin_head() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
// fix menu
|
||||
var mc = $('#menu-comments');
|
||||
mc.find('a.wp-has-submenu').attr('href', 'edit-comments.php?page=disqus').end().find('.wp-submenu li:has(a[href=edit-comments.php?page=disqus])').prependTo(mc.find('.wp-submenu ul'));
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
add_action('admin_head', 'sdq_menu_admin_head');
|
||||
|
||||
// only active on dashboard
|
||||
function dsq_dash_comment_counts() {
|
||||
global $wpdb;
|
||||
// taken from wp-includes/comment.php - WP 2.8.5
|
||||
$count = $wpdb->get_results("
|
||||
SELECT comment_approved, COUNT( * ) AS num_comments
|
||||
FROM {$wpdb->comments}
|
||||
WHERE comment_type != 'trackback'
|
||||
AND comment_type != 'pingback'
|
||||
GROUP BY comment_approved
|
||||
", ARRAY_A );
|
||||
$total = 0;
|
||||
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
|
||||
$known_types = array_keys( $approved );
|
||||
foreach( (array) $count as $row_num => $row ) {
|
||||
$total += $row['num_comments'];
|
||||
if ( in_array( $row['comment_approved'], $known_types ) )
|
||||
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
|
||||
}
|
||||
|
||||
$stats['total_comments'] = $total;
|
||||
foreach ( $approved as $key ) {
|
||||
if ( empty($stats[$key]) )
|
||||
$stats[$key] = 0;
|
||||
}
|
||||
$stats = (object) $stats;
|
||||
?>
|
||||
<style type="text/css">
|
||||
#dashboard_right_now .inside,
|
||||
#dashboard_recent_comments div.trackback {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$('#dashboard_right_now').find('.b-comments a').html('<?php echo $stats->total_comments; ?>').end().find('.b_approved a').html('<?php echo $stats->approved; ?>').end().find('.b-waiting a').html('<?php echo $stats->moderated; ?>').end().find('.b-spam a').html('<?php echo $stats->spam; ?>').end().find('.inside').slideDown();
|
||||
$('#dashboard_recent_comments div.trackback').remove();
|
||||
$('#dashboard_right_now .inside table td.last a, #dashboard_recent_comments .inside .textright a.button').attr('href', 'edit-comments.php?page=disqus');
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
function dsq_wp_dashboard_setup() {
|
||||
add_action('admin_head', 'dsq_dash_comment_counts');
|
||||
}
|
||||
add_action('wp_dashboard_setup', 'dsq_wp_dashboard_setup');
|
||||
|
||||
function dsq_manage() {
|
||||
include_once(dirname(__FILE__) . '/manage.php');
|
||||
}
|
||||
|
||||
function dsq_admin_head() {
|
||||
if (isset($_GET['page']) && $_GET['page'] == 'disqus') {
|
||||
?>
|
||||
<link rel='stylesheet' href='<?php echo DSQ_PLUGIN_URL; ?>/styles/manage.css' type='text/css' />
|
||||
<style type="text/css">
|
||||
.dsq-exporting, .dsq-exported, .dsq-export-fail {
|
||||
background: url(<?php echo admin_url('images/loading.gif'); ?>) left center no-repeat;
|
||||
line-height: 16px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
.dsq-exported {
|
||||
background: url(<?php echo admin_url('images/yes.png'); ?>) left center no-repeat;
|
||||
}
|
||||
.dsq-export-fail {
|
||||
background: url(<?php echo admin_url('images/no.png'); ?>) left center no-repeat;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
jQuery(function($) {
|
||||
$('#dsq-tabs li').click(function() {
|
||||
$('#dsq-tabs li.selected').removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
$('.dsq-main, .dsq-advanced').hide();
|
||||
$('.' + $(this).attr('rel')).show();
|
||||
});
|
||||
if (location.href.indexOf('#adv') != -1) {
|
||||
$('#dsq-tab-advanced').click();
|
||||
}
|
||||
dsq_fire_export();
|
||||
});
|
||||
dsq_fire_export = function() {
|
||||
var $ = jQuery;
|
||||
$('#dsq_export a.button, #dsq_export_retry').unbind().click(function() {
|
||||
$('#dsq_export').html('<p class="status"></p>');
|
||||
$('#dsq_export .status').removeClass('dsq-export-fail').addClass('dsq-exporting').html('Processing...');
|
||||
dsq_export_comments();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
dsq_export_comments = function() {
|
||||
var $ = jQuery;
|
||||
var status = $('#dsq_export .status');
|
||||
var post_id = status.attr('rel') || 0;
|
||||
$.get(
|
||||
'<?php echo admin_url('index.php'); ?>',
|
||||
{
|
||||
cf_action: 'export_comments',
|
||||
post_id: post_id
|
||||
},
|
||||
function(response) {
|
||||
switch (response.result) {
|
||||
case 'success':
|
||||
status.html(response.msg).attr('rel', response.last_post_id);
|
||||
switch (response.status) {
|
||||
case 'partial':
|
||||
dsq_export_comments();
|
||||
break;
|
||||
case 'complete':
|
||||
status.removeClass('dsq-exporting').addClass('dsq-exported');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'fail':
|
||||
status.parent().html(response.msg);
|
||||
dsq_fire_export();
|
||||
break;
|
||||
}
|
||||
},
|
||||
'json'
|
||||
);
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
// HACK: Our own styles for older versions of WordPress.
|
||||
global $wp_version;
|
||||
if ( version_compare($wp_version, '2.5', '<') ) {
|
||||
echo "<link rel='stylesheet' href='" . DSQ_PLUGIN_URL . "/styles/manage-pre25.css' type='text/css' />";
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('admin_head', 'dsq_admin_head');
|
||||
|
||||
function dsq_warning() {
|
||||
if ( !get_option('disqus_forum_url') && !isset($_POST['forum_url']) && $_GET['page'] != 'disqus' ) {
|
||||
dsq_manage_dialog('You must <a href="edit-comments.php?page=disqus">configure the plugin</a> to enable Disqus Comments.', true);
|
||||
}
|
||||
|
||||
if ( dsq_legacy_mode() && $_GET['page'] == 'disqus' ) {
|
||||
dsq_manage_dialog('Disqus Comments has not yet been configured. (<a href="edit-comments.php?page=disqus">Click here to configure</a>)');
|
||||
}
|
||||
}
|
||||
|
||||
// catch original query
|
||||
function dsq_parse_query($query) {
|
||||
add_action('the_posts', 'dsq_add_request_post_ids', 999);
|
||||
}
|
||||
add_action('parse_request', 'dsq_parse_query');
|
||||
|
||||
// track the original request post_ids, only run once
|
||||
function dsq_add_request_post_ids($posts) {
|
||||
dsq_add_query_posts($posts);
|
||||
remove_action('the_posts', 'dsq_log_request_post_ids', 999);
|
||||
return $posts;
|
||||
}
|
||||
|
||||
function dsq_maybe_add_post_ids($posts) {
|
||||
global $DSQ_QUERY_COMMENTS;
|
||||
if ($DSQ_QUERY_COMMENTS) {
|
||||
dsq_add_query_posts($posts);
|
||||
}
|
||||
return $posts;
|
||||
}
|
||||
add_action('the_posts', 'dsq_maybe_add_post_ids');
|
||||
|
||||
function dsq_add_query_posts($posts) {
|
||||
global $DSQ_QUERY_POST_IDS;
|
||||
if (count($posts)) {
|
||||
foreach ($posts as $post) {
|
||||
$post_ids[] = intval($post->ID);
|
||||
}
|
||||
$DSQ_QUERY_POST_IDS[md5(serialize($post_ids))] = $post_ids;
|
||||
}
|
||||
}
|
||||
|
||||
// check to see if the posts in the loop match the original request or an explicit request, if so output the JS
|
||||
function dsq_loop_end($query) {
|
||||
if ( get_option('disqus_cc_fix') == '1' || !count($query->posts) || is_single() || is_page() || is_feed() ) {
|
||||
return;
|
||||
}
|
||||
global $DSQ_QUERY_POST_IDS;
|
||||
foreach ($query->posts as $post) {
|
||||
$loop_ids[] = intval($post->ID);
|
||||
}
|
||||
$posts_key = md5(serialize($loop_ids));
|
||||
if (isset($DSQ_QUERY_POST_IDS[$posts_key])) {
|
||||
dsq_output_loop_comment_js($DSQ_QUERY_POST_IDS[$posts_key]);
|
||||
}
|
||||
}
|
||||
add_action('loop_end', 'dsq_loop_end');
|
||||
|
||||
function dsq_js_comment_count_url() {
|
||||
return 'http://'.strtolower(get_option('disqus_forum_url')).'.'.DISQUS_DOMAIN.'/get_num_replies_from_wpid.js?v=2.2&t=span';
|
||||
}
|
||||
|
||||
function dsq_output_loop_comment_js($post_ids = null) {
|
||||
if (count($post_ids)) {
|
||||
$post_id_str = '';
|
||||
$i = 0;
|
||||
foreach ($post_ids as $post_id) {
|
||||
$post_id_str .= '&wpid'.$i.'='.$post_id;
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
(function() {
|
||||
document.write('<script charset="utf-8" type="text/javascript" src="<?php echo dsq_js_comment_count_url().$post_id_str; ?>"><' + '/script>');
|
||||
|
||||
})();
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
function dsq_output_footer_comment_js() {
|
||||
if (get_option('disqus_cc_fix') == '1') {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
(function() {
|
||||
var nodes = document.getElementsByTagName('span');
|
||||
var query = '&';
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if (nodes[i].className.indexOf('dsq-postid') != -1) {
|
||||
query += 'wpid' + i + '=' + encodeURIComponent(nodes[i].className.replace('dsq-postid-', '')) + '&';
|
||||
}
|
||||
}
|
||||
document.write('<script charset="utf-8" type="text/javascript" src="<?php echo dsq_js_comment_count_url(); ?>' + query + '"><' + '/script>');
|
||||
|
||||
})();
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_action('wp_footer', 'dsq_output_footer_comment_js');
|
||||
|
||||
// UPDATE DSQ when a permalink changes
|
||||
|
||||
$dsq_prev_permalinks = array();
|
||||
|
||||
function dsq_prev_permalink($post_id) {
|
||||
// if post not published, return
|
||||
$post = &get_post($post_id);
|
||||
if ($post->post_status != 'publish') {
|
||||
return;
|
||||
}
|
||||
global $dsq_prev_permalinks;
|
||||
$dsq_prev_permalinks['post_'.$post_id] = get_permalink($post_id);
|
||||
}
|
||||
add_action('pre_post_update', 'dsq_prev_permalink');
|
||||
|
||||
function dsq_check_permalink($post_id) {
|
||||
global $dsq_prev_permalinks;
|
||||
if (!empty($dsq_prev_permalinks['post_'.$post_id]) && $dsq_prev_permalinks['post_'.$post_id] != get_permalink($post_id)) {
|
||||
// API request to get old DSQ ID - get_thread_by_url
|
||||
$post = get_post($post_id);
|
||||
global $dsq_api;
|
||||
$thread = $dsq_api->get_thread(
|
||||
$post,
|
||||
$dsq_prev_permalinks['post_'.$post_id],
|
||||
get_the_title($post_id),
|
||||
get_the_excerpt($post_id)
|
||||
);
|
||||
// API request to update DSQ ID to new permalink - update_thread
|
||||
if (is_array($thread) && !empty($thread['thread_id'])) {
|
||||
$http = new WP_Http;
|
||||
$response = $http->request(
|
||||
DISQUS_API_URL . '/api/update_thread/',
|
||||
array(
|
||||
'method' => 'POST',
|
||||
'body' => array(
|
||||
'thread_id' => $thread['thread_id'],
|
||||
'url' => get_permalink($post_id),
|
||||
'forum_api_key' => $dsq_api->forum_api_key,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('edit_post', 'dsq_check_permalink');
|
||||
|
||||
add_action('admin_notices', 'dsq_warning');
|
||||
|
||||
// Only replace comments if the disqus_forum_url option is set.
|
||||
add_filter('comments_template', 'dsq_comments_template');
|
||||
add_filter('comments_number', 'dsq_comments_number');
|
||||
add_filter('bloginfo_url', 'dsq_bloginfo_url');
|
||||
|
||||
/**
|
||||
* JSON ENCODE for PHP < 5.2.0
|
||||
* Checks if json_encode is not available and defines json_encode
|
||||
* to use php_json_encode in its stead
|
||||
* Works on iteratable objects as well - stdClass is iteratable, so all WP objects are gonna be iteratable
|
||||
*/
|
||||
if(!function_exists('cf_json_encode')) {
|
||||
function cf_json_encode($data) {
|
||||
// json_encode is sending an application/x-javascript header on Joyent servers
|
||||
// for some unknown reason.
|
||||
// if(function_exists('json_encode')) { return json_encode($data); }
|
||||
// else { return cfjson_encode($data); }
|
||||
return cfjson_encode($data);
|
||||
}
|
||||
|
||||
function cfjson_encode_string($str) {
|
||||
if(is_bool($str)) {
|
||||
return $str ? 'true' : 'false';
|
||||
}
|
||||
|
||||
return str_replace(
|
||||
array(
|
||||
'"'
|
||||
, '/'
|
||||
, "\n"
|
||||
, "\r"
|
||||
)
|
||||
, array(
|
||||
'\"'
|
||||
, '\/'
|
||||
, '\n'
|
||||
, '\r'
|
||||
)
|
||||
, $str
|
||||
);
|
||||
}
|
||||
|
||||
function cfjson_encode($arr) {
|
||||
$json_str = '';
|
||||
if (is_array($arr)) {
|
||||
$pure_array = true;
|
||||
$array_length = count($arr);
|
||||
for ( $i = 0; $i < $array_length ; $i++) {
|
||||
if (!isset($arr[$i])) {
|
||||
$pure_array = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($pure_array) {
|
||||
$json_str = '[';
|
||||
$temp = array();
|
||||
for ($i=0; $i < $array_length; $i++) {
|
||||
$temp[] = sprintf("%s", cfjson_encode($arr[$i]));
|
||||
}
|
||||
$json_str .= implode(',', $temp);
|
||||
$json_str .="]";
|
||||
}
|
||||
else {
|
||||
$json_str = '{';
|
||||
$temp = array();
|
||||
foreach ($arr as $key => $value) {
|
||||
$temp[] = sprintf("\"%s\":%s", $key, cfjson_encode($value));
|
||||
}
|
||||
$json_str .= implode(',', $temp);
|
||||
$json_str .= '}';
|
||||
}
|
||||
}
|
||||
else if (is_object($arr)) {
|
||||
$json_str = '{';
|
||||
$temp = array();
|
||||
foreach ($arr as $k => $v) {
|
||||
$temp[] = '"'.$k.'":'.cfjson_encode($v);
|
||||
}
|
||||
$json_str .= implode(',', $temp);
|
||||
$json_str .= '}';
|
||||
}
|
||||
else if (is_string($arr)) {
|
||||
$json_str = '"'. cfjson_encode_string($arr) . '"';
|
||||
}
|
||||
else if (is_numeric($arr)) {
|
||||
$json_str = $arr;
|
||||
}
|
||||
else if (is_bool($arr)) {
|
||||
$json_str = $arr ? 'true' : 'false';
|
||||
}
|
||||
else {
|
||||
$json_str = '"'. cfjson_encode_string($arr) . '"';
|
||||
}
|
||||
return $json_str;
|
||||
}
|
||||
}
|
||||
|
||||
// Single Sign-on Integration
|
||||
|
||||
function dsq_sso() {
|
||||
if (!$partner_key = get_option('disqus_partner_key')) {
|
||||
return;
|
||||
}
|
||||
global $current_user, $dsq_api;
|
||||
get_currentuserinfo();
|
||||
if ($current_user->ID) {
|
||||
$avatar_tag = get_avatar($current_user->ID);
|
||||
$avatar_data = array();
|
||||
preg_match('/(src)=((\'|")[^(\'|")]*(\'|"))/i', $avatar_tag, $avatar_data);
|
||||
$avatar = str_replace(array('"', "'"), '', $avatar_data[2]);
|
||||
$user_data = array(
|
||||
'username' => $current_user->display_name,
|
||||
'id' => $current_user->ID,
|
||||
'avatar' => $avatar,
|
||||
'email' => $current_user->user_email,
|
||||
);
|
||||
}
|
||||
else {
|
||||
$user_data = array();
|
||||
}
|
||||
$user_data = base64_encode(cf_json_encode($user_data));
|
||||
$time = time();
|
||||
$hmac = dsq_hmacsha1($user_data.' '.$time, $partner_key);
|
||||
|
||||
$payload = $user_data.' '.$hmac.' '.$time;
|
||||
echo '<script type="text/javascript" src="http://'.$dsq_api->short_name.'.disqus.com/remote_auth.js?remote_auth_s2='.urlencode($payload).'"></script>';
|
||||
}
|
||||
add_action('wp_head', 'dsq_sso');
|
||||
|
||||
// from: http://www.php.net/manual/en/function.sha1.php#39492
|
||||
//Calculate HMAC-SHA1 according to RFC2104
|
||||
// http://www.ietf.org/rfc/rfc2104.txt
|
||||
function dsq_hmacsha1($data, $key) {
|
||||
$blocksize=64;
|
||||
$hashfunc='sha1';
|
||||
if (strlen($key)>$blocksize)
|
||||
$key=pack('H*', $hashfunc($key));
|
||||
$key=str_pad($key,$blocksize,chr(0x00));
|
||||
$ipad=str_repeat(chr(0x36),$blocksize);
|
||||
$opad=str_repeat(chr(0x5c),$blocksize);
|
||||
$hmac = pack(
|
||||
'H*',$hashfunc(
|
||||
($key^$opad).pack(
|
||||
'H*',$hashfunc(
|
||||
($key^$ipad).$data
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
return bin2hex($hmac);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,289 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Adapted from WordPress 2.8
|
||||
*/
|
||||
@set_time_limit(0);
|
||||
@ini_set('memory_limit', '256M');
|
||||
define('WXR_VERSION', '1.0');
|
||||
|
||||
// receives an array of posts to export
|
||||
function dsq_export_wp($posts) {
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$categories = (array) get_categories('get=all');
|
||||
$tags = (array) get_tags('get=all');
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @param unknown_type $categories
|
||||
*/
|
||||
function wxr_missing_parents($categories) {
|
||||
if ( !is_array($categories) || empty($categories) )
|
||||
return array();
|
||||
|
||||
foreach ( $categories as $category )
|
||||
$parents[$category->term_id] = $category->parent;
|
||||
|
||||
$parents = array_unique(array_diff($parents, array_keys($parents)));
|
||||
|
||||
if ( $zero = array_search('0', $parents) )
|
||||
unset($parents[$zero]);
|
||||
|
||||
return $parents;
|
||||
}
|
||||
|
||||
while ( $parents = wxr_missing_parents($categories) ) {
|
||||
$found_parents = get_categories("include=" . join(', ', $parents));
|
||||
if ( is_array($found_parents) && count($found_parents) )
|
||||
$categories = array_merge($categories, $found_parents);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
// Put them in order to be inserted with no child going before its parent
|
||||
$pass = 0;
|
||||
$passes = 1000 + count($categories);
|
||||
while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
|
||||
if ( $cat->parent == 0 || isset($cats[$cat->parent]) ) {
|
||||
$cats[$cat->term_id] = $cat;
|
||||
} else {
|
||||
$categories[] = $cat;
|
||||
}
|
||||
}
|
||||
unset($categories);
|
||||
|
||||
/**
|
||||
* Place string in CDATA tag.
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @param string $str String to place in XML CDATA tag.
|
||||
*/
|
||||
function wxr_cdata($str) {
|
||||
if ( seems_utf8($str) == false )
|
||||
$str = utf8_encode($str);
|
||||
|
||||
// $str = ent2ncr(esc_html($str));
|
||||
|
||||
$str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>";
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @return string Site URL.
|
||||
*/
|
||||
function wxr_site_url() {
|
||||
global $current_site;
|
||||
|
||||
// mu: the base url
|
||||
if ( isset($current_site->domain) ) {
|
||||
return 'http://'.$current_site->domain.$current_site->path;
|
||||
}
|
||||
// wp: the blog url
|
||||
else {
|
||||
return get_bloginfo_rss('url');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @param object $c Category Object
|
||||
*/
|
||||
function wxr_cat_name($c) {
|
||||
if ( empty($c->name) )
|
||||
return;
|
||||
|
||||
echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @param object $c Category Object
|
||||
*/
|
||||
function wxr_category_description($c) {
|
||||
if ( empty($c->description) )
|
||||
return;
|
||||
|
||||
echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @param object $t Tag Object
|
||||
*/
|
||||
function wxr_tag_name($t) {
|
||||
if ( empty($t->name) )
|
||||
return;
|
||||
|
||||
echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*
|
||||
* @param object $t Tag Object
|
||||
*/
|
||||
function wxr_tag_description($t) {
|
||||
if ( empty($t->description) )
|
||||
return;
|
||||
|
||||
echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@internal Missing Short Description}}
|
||||
*
|
||||
* @since unknown
|
||||
*/
|
||||
function wxr_post_taxonomy() {
|
||||
$categories = get_the_category();
|
||||
$tags = get_the_tags();
|
||||
$the_list = '';
|
||||
$filter = 'rss';
|
||||
|
||||
if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
|
||||
$cat_name = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);
|
||||
// for backwards compatibility
|
||||
$the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
|
||||
// forwards compatibility: use a unique identifier for each cat to avoid clashes
|
||||
// http://trac.wordpress.org/ticket/5447
|
||||
$the_list .= "\n\t\t<category domain=\"category\" nicename=\"{$category->slug}\"><![CDATA[$cat_name]]></category>\n";
|
||||
}
|
||||
|
||||
if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
|
||||
$tag_name = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
|
||||
$the_list .= "\n\t\t<category domain=\"tag\"><![CDATA[$tag_name]]></category>\n";
|
||||
// forwards compatibility as above
|
||||
$the_list .= "\n\t\t<category domain=\"tag\" nicename=\"{$tag->slug}\"><![CDATA[$tag_name]]></category>\n";
|
||||
}
|
||||
|
||||
echo $the_list;
|
||||
}
|
||||
|
||||
// start catching output
|
||||
ob_start();
|
||||
|
||||
|
||||
echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
||||
|
||||
?>
|
||||
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
|
||||
<!-- It contains information about your blog's posts, comments, and categories. -->
|
||||
<!-- You may use this file to transfer that content from one site to another. -->
|
||||
<!-- This file is not intended to serve as a complete backup of your blog. -->
|
||||
|
||||
<!-- To import this information into a WordPress blog follow these steps. -->
|
||||
<!-- 1. Log into that blog as an administrator. -->
|
||||
<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
|
||||
<!-- 3. Choose "WordPress" from the list. -->
|
||||
<!-- 4. Upload this file using the form provided on that page. -->
|
||||
<!-- 5. You will first be asked to map the authors in this export file to users -->
|
||||
<!-- on the blog. For each author, you may choose to map to an -->
|
||||
<!-- existing user on the blog or to create a new user -->
|
||||
<!-- 6. WordPress will then import each of the posts, comments, and categories -->
|
||||
<!-- contained in this file into your blog -->
|
||||
|
||||
<?php the_generator('export');?>
|
||||
<rss version="2.0"
|
||||
xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
|
||||
>
|
||||
|
||||
<channel>
|
||||
<title><?php bloginfo_rss('name'); ?></title>
|
||||
<link><?php bloginfo_rss('url') ?></link>
|
||||
<description><?php bloginfo_rss("description") ?></description>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
|
||||
<generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
|
||||
<language><?php echo get_option('rss_language'); ?></language>
|
||||
<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
|
||||
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
|
||||
<wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
|
||||
<?php if ( $cats ) : foreach ( $cats as $c ) : ?>
|
||||
<wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
|
||||
<?php endforeach; endif; ?>
|
||||
<?php if ( $tags ) : foreach ( $tags as $t ) : ?>
|
||||
<wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
|
||||
<?php endforeach; endif; ?>
|
||||
<?php
|
||||
if (count($posts)) {
|
||||
global $wp_query, $post;
|
||||
$wp_query->in_the_loop = true; // Fake being in the loop.
|
||||
foreach ($posts as $post) {
|
||||
setup_postdata($post); ?>
|
||||
<item>
|
||||
<title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
|
||||
<link><?php the_permalink_rss() ?></link>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
||||
<dc:creator><?php echo wxr_cdata(get_the_author()); ?></dc:creator>
|
||||
<?php wxr_post_taxonomy() ?>
|
||||
|
||||
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
||||
<description></description>
|
||||
<content:encoded><?php echo wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
|
||||
<excerpt:encoded><?php echo wxr_cdata( apply_filters('the_excerpt_export', $post->post_excerpt) ); ?></excerpt:encoded>
|
||||
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
|
||||
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
|
||||
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
|
||||
<wp:comment_status><?php echo $post->comment_status; ?></wp:comment_status>
|
||||
<wp:ping_status><?php echo $post->ping_status; ?></wp:ping_status>
|
||||
<wp:post_name><?php echo $post->post_name; ?></wp:post_name>
|
||||
<wp:status><?php echo $post->post_status; ?></wp:status>
|
||||
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
|
||||
<wp:menu_order><?php echo $post->menu_order; ?></wp:menu_order>
|
||||
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
|
||||
<?php
|
||||
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_agent NOT LIKE 'Disqus/%%'", $post->ID) );
|
||||
if ( $comments ) { foreach ( $comments as $c ) { ?>
|
||||
<wp:comment>
|
||||
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
|
||||
<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
|
||||
<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
|
||||
<wp:comment_author_url><?php echo $c->comment_author_url; ?></wp:comment_author_url>
|
||||
<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
|
||||
<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
|
||||
<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
|
||||
<wp:comment_content><?php echo wxr_cdata($c->comment_content) ?></wp:comment_content>
|
||||
<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
|
||||
<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
|
||||
<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
|
||||
<wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
|
||||
</wp:comment>
|
||||
<?php } } // comments ?>
|
||||
</item>
|
||||
<?php } } // count(posts) ?>
|
||||
</channel>
|
||||
</rss>
|
||||
<?php
|
||||
|
||||
// end of WXR output
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
?>
|
||||
|
Before Width: | Height: | Size: 3.2 KiB |
@@ -1,149 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Implementation of the Disqus v2 API.
|
||||
*
|
||||
* @author Disqus <team@disqus.com>
|
||||
* @copyright 2007-2008 Big Head Labs
|
||||
* @link http://disqus.com/
|
||||
* @package Disqus
|
||||
* @subpackage lib
|
||||
* @version 2.0
|
||||
*/
|
||||
|
||||
require_once('url.php');
|
||||
require_once(ABSPATH.WPINC.'/http.php');
|
||||
|
||||
/** @#+
|
||||
* Constants
|
||||
*/
|
||||
/**
|
||||
* Base URL for Disqus.
|
||||
*/
|
||||
define('ALLOWED_HTML', '<b><u><i><h1><h2><h3><code><blockquote><br><hr>');
|
||||
|
||||
/**
|
||||
* Helper methods for all of the Disqus v2 API methods.
|
||||
*
|
||||
* @package Disqus
|
||||
* @author DISQUS.com <team@disqus.com>
|
||||
* @copyright 2007-2008 Big Head Labs
|
||||
* @version 2.0
|
||||
*/
|
||||
class DisqusAPI {
|
||||
var $short_name;
|
||||
var $forum_api_key;
|
||||
|
||||
function DisqusAPI($short_name=NULL, $forum_api_key=NULL) {
|
||||
$this->short_name = $short_name;
|
||||
$this->forum_api_key = $forum_api_key;
|
||||
}
|
||||
|
||||
function get_forum_list($username, $password) {
|
||||
$credentials = base64_encode($username . ':' . $password);
|
||||
$response = dsq_urlopen(DISQUS_API_URL . '/api/v2/get_forum_list/', array(
|
||||
'credentials' => $credentials,
|
||||
'response_type' => 'php'
|
||||
));
|
||||
$data = unserialize($response['data']);
|
||||
if(!$data || $data['stat'] == 'fail') {
|
||||
if($data['err']['code'] == 'bad-credentials') {
|
||||
return -2;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return $data['forums'];
|
||||
}
|
||||
|
||||
function get_forum_api_key($username, $password, $short_name) {
|
||||
$credentials = base64_encode($username . ':' . $password);
|
||||
$response = dsq_urlopen(DISQUS_API_URL . '/api/v2/get_forum_api_key/', array(
|
||||
'credentials' => $credentials,
|
||||
'short_name' => $short_name,
|
||||
'response_type' => 'php'
|
||||
));
|
||||
$data = unserialize($response['data']);
|
||||
if(!$data || $data['stat'] == 'fail') {
|
||||
if($data['err']['code'] == 'bad-credentials') {
|
||||
return -2;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return $data['forum_api_key'];
|
||||
}
|
||||
|
||||
function get_thread($post, $permalink, $title, $excerpt) {
|
||||
$title = strip_tags($title, ALLOWED_HTML);
|
||||
$title = urlencode($title);
|
||||
|
||||
$excerpt = strip_tags($excerpt, ALLOWED_HTML);
|
||||
$excerpt = urlencode($excerpt);
|
||||
$excerpt = substr($excerpt, 0, 300);
|
||||
|
||||
$thread_meta = $post->ID . ' ' . $post->guid;
|
||||
|
||||
$response = @dsq_urlopen(DISQUS_API_URL . '/api/v2/get_thread/', array(
|
||||
'short_name' => $this->short_name,
|
||||
'thread_url' => $permalink,
|
||||
'thread_meta' => $thread_meta,
|
||||
'response_type' => 'php',
|
||||
'title' => $title,
|
||||
'message' => $excerpt,
|
||||
'api_key' => $this->forum_api_key,
|
||||
'source' => 'DsqWordPress20',
|
||||
'state_closed' => ($post->comment_status == 'closed') ? '1' : '0'
|
||||
));
|
||||
|
||||
$data = unserialize($response['data']);
|
||||
if(!$data || $data['stat'] == 'fail') {
|
||||
if($data['err']['code'] == 'bad-key') {
|
||||
return -2;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function import_wordpress_comments($wxr) {
|
||||
$http = new WP_Http();
|
||||
$response = $http->request(
|
||||
DISQUS_IMPORTER_URL . '/api/import-wordpress-comments/',
|
||||
array(
|
||||
'method' => 'POST',
|
||||
'body' => array(
|
||||
'forum_url' => $this->short_name,
|
||||
'forum_api_key' => $this->forum_api_key,
|
||||
'response_type' => 'php',
|
||||
'wxr' => $wxr,
|
||||
)
|
||||
)
|
||||
);
|
||||
$data = unserialize($response['body']);
|
||||
if (!$data || $data['stat'] == 'fail') {
|
||||
return -1;
|
||||
}
|
||||
return $data['import_id'];
|
||||
}
|
||||
|
||||
function get_import_status($import_id) {
|
||||
$response = @dsq_urlopen(DISQUS_IMPORTER_URL . '/api/get-import-status/', array(
|
||||
'forum_url' => $this->short_name,
|
||||
'forum_api_key' => $this->forum_api_key,
|
||||
'import_id' => $import_id,
|
||||
'response_type' => 'php'
|
||||
));
|
||||
|
||||
$data = unserialize($response['data']);
|
||||
if(!$data || $data['stat'] == 'fail') {
|
||||
return -1;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,265 +0,0 @@
|
||||
<?php
|
||||
define('USER_AGENT', 'Disqus-WPPlugin/2.0-dev');
|
||||
|
||||
function dsq_get_query_string($postdata) {
|
||||
$postdata_str = '';
|
||||
|
||||
if($postdata) {
|
||||
foreach($postdata as $key=>$value) {
|
||||
$postdata_str .= urlencode($key) . '=' . urlencode($value) . '&';
|
||||
}
|
||||
}
|
||||
|
||||
return $postdata_str;
|
||||
}
|
||||
|
||||
|
||||
function dsq_get_post_content($boundary, $postdata, $file_name, $file_field) {
|
||||
if(!$file_name || !$file_field) {
|
||||
return dsq_get_query_string($postdata);
|
||||
}
|
||||
|
||||
$content = array();
|
||||
$content[] = '--' . $boundary;
|
||||
foreach($postdata as $key=>$value) {
|
||||
$content[] = 'Content-Disposition: form-data; name="' . $key . '"' . "\r\n\r\n" . $value;
|
||||
$content[] = '--' . $boundary;
|
||||
}
|
||||
$content[] = 'Content-Disposition: form-data; name="' . $file_field . '"; filename="' . $file_name . '"';
|
||||
// HACK: We only need to handle text/plain files right now.
|
||||
$content[] = "Content-Type: text/plain\r\n";
|
||||
$content[] = file_get_contents($file_name);
|
||||
$content[] = '--' . $boundary . '--';
|
||||
$content = implode("\r\n", $content);
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
function dsq_get_http_headers_for_request($boundary, $content, $file_name, $file_field) {
|
||||
$headers = array();
|
||||
$headers[] = 'User-Agent: ' . USER_AGENT;
|
||||
$headers[] = 'Connection: close';
|
||||
if($content) {
|
||||
$headers[] = 'Content-Length: ' . strlen($content);
|
||||
if($file_name && $file_field) {
|
||||
$headers[] = 'Content-Type: multipart/form-data; boundary=' . $boundary;
|
||||
} else {
|
||||
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
|
||||
}
|
||||
}
|
||||
return implode("\r\n", $headers);
|
||||
}
|
||||
|
||||
|
||||
function _dsq_curl_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
||||
$c = curl_init($url);
|
||||
$postdata_str = dsq_get_query_string($postdata);
|
||||
|
||||
$c_options = array(
|
||||
CURLOPT_USERAGENT => USER_AGENT,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => ($postdata_str ? 1 : 0),
|
||||
CURLOPT_HTTPHEADER => array('Expect:')
|
||||
);
|
||||
if($postdata) {
|
||||
$c_options[CURLOPT_POSTFIELDS] = $postdata_str;
|
||||
}
|
||||
if($file_name && $file_field) {
|
||||
$postdata[$file_field] = '@' . $file_name;
|
||||
$c_options[CURLOPT_POSTFIELDS] = $postdata;
|
||||
$c_options[CURLOPT_RETURNTRANSFER] = 1;
|
||||
}
|
||||
curl_setopt_array($c, $c_options);
|
||||
|
||||
$response['data'] = curl_exec($c);
|
||||
$response['code'] = curl_getinfo($c, CURLINFO_HTTP_CODE);
|
||||
}
|
||||
|
||||
|
||||
function _dsq_fsockopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
||||
$buf = '';
|
||||
$req = '';
|
||||
$length = 0;
|
||||
$boundary = '----------' . md5(time());
|
||||
$postdata_str = dsq_get_post_content($boundary, $postdata, $file_name, $file_field);
|
||||
$url_pieces = parse_url($url);
|
||||
|
||||
// Set default port for supported schemes if none is provided.
|
||||
if(!isset($url_pieces['port'])) {
|
||||
switch($url_pieces['scheme']) {
|
||||
case 'http':
|
||||
$url_pieces['port'] = 80;
|
||||
break;
|
||||
case 'https':
|
||||
$url_pieces['port'] = 443;
|
||||
$url_pieces['host'] = 'ssl://' . $url_pieces['host'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Set default path if trailing slash is not provided.
|
||||
if(!isset($url_pieces['path'])) { $url_pieces['path'] = '/'; }
|
||||
|
||||
// Determine if we need to include the port in the Host header or not.
|
||||
if(($url_pieces['port'] == 80 && $url_pieces['scheme'] == 'http') ||
|
||||
($url_pieces['port'] == 443 && $url_pieces['scheme'] == 'https')) {
|
||||
$host = $url_pieces['host'];
|
||||
} else {
|
||||
$host = $url_pieces['host'] . ':' . $url_pieces['port'];
|
||||
}
|
||||
|
||||
$fp = @fsockopen($url_pieces['host'], $url_pieces['port']);
|
||||
if(!$fp) { return false; }
|
||||
$req .= ($postdata_str ? 'POST' : 'GET') . ' ' . $url_pieces['path'] . " HTTP/1.1\r\n";
|
||||
$req .= 'Host: ' . $host . "\r\n";
|
||||
$req .= dsq_get_http_headers_for_request($boundary, $postdata_str, $file_name, $file_field);
|
||||
if($postdata_str) {
|
||||
$req .= "\r\n\r\n" . $postdata_str;
|
||||
}
|
||||
$req .= "\r\n\r\n";
|
||||
|
||||
fwrite($fp, $req);
|
||||
while(!feof($fp)) {
|
||||
$buf .= fgets($fp, 4096);
|
||||
}
|
||||
|
||||
// Parse headers from the response buffers.
|
||||
list($headers, $response['data']) = explode("\r\n\r\n", $buf, 2);
|
||||
|
||||
// Get status code from headers.
|
||||
$headers = explode("\r\n", $headers);
|
||||
list($unused, $response['code'], $unused) = explode(' ', $headers[0], 3);
|
||||
$headers = array_slice($headers, 1);
|
||||
|
||||
// Convert headers into associative array.
|
||||
foreach($headers as $unused=>$header) {
|
||||
$header = explode(':', $header);
|
||||
$header[0] = trim($header[0]);
|
||||
$header[1] = trim($header[1]);
|
||||
$headers[strtolower($header[0])] = strtolower($header[1]);
|
||||
}
|
||||
|
||||
// If transfer-coding is set to chunked, we need to join the message body
|
||||
// together.
|
||||
if(isset($headers['transfer-encoding']) && 'chunked' == $headers['transfer-encoding']) {
|
||||
$chunk_data = $response['data'];
|
||||
$joined_data = '';
|
||||
while(true) {
|
||||
// Strip length from body.
|
||||
list($chunk_length, $chunk_data) = explode("\r\n", $chunk_data, 2);
|
||||
$chunk_length = hexdec($chunk_length);
|
||||
if(!$chunk_length || !strlen($chunk_data)) { break; }
|
||||
|
||||
$joined_data .= substr($chunk_data, 0, $chunk_length);
|
||||
$chunk_data = substr($chunk_data, $chunk_length + 1);
|
||||
$length += $chunk_length;
|
||||
}
|
||||
$response['data'] = $joined_data;
|
||||
} else {
|
||||
$length = $headers['content-length'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _dsq_fopen_urlopen($url, $postdata, &$response, $file_name, $file_field) {
|
||||
$params = array();
|
||||
if($file_name && $file_field) {
|
||||
$boundary = '----------' . md5(time());
|
||||
$content = dsq_get_post_content($boundary, $postdata, $file_name, $file_field);
|
||||
$header = dsq_get_http_headers_for_request($boundary, $content, $file_name, $file_field);
|
||||
|
||||
$params = array('http' => array(
|
||||
'method' => 'POST',
|
||||
'header' => $header,
|
||||
'content' => $content,
|
||||
));
|
||||
} else {
|
||||
if($postdata) {
|
||||
$params = array('http' => array(
|
||||
'method' => 'POST',
|
||||
'header' => 'Content-Type: application/x-www-form-urlencoded',
|
||||
'content' => dsq_get_query_string($postdata)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
ini_set('user_agent', USER_AGENT);
|
||||
$ctx = stream_context_create($params);
|
||||
$fp = fopen($url, 'rb', false, $ctx);
|
||||
if(!$fp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get status code from headers.
|
||||
list($unused, $response['code'], $unused) = explode(' ', $http_response_header[0], 3);
|
||||
$headers = array_slice($http_response_header, 1);
|
||||
|
||||
// Convert headers into associative array.
|
||||
foreach($headers as $unused=>$header) {
|
||||
$header = explode(':', $header);
|
||||
$header[0] = trim($header[0]);
|
||||
$header[1] = trim($header[1]);
|
||||
$headers[strtolower($header[0])] = strtolower($header[1]);
|
||||
}
|
||||
|
||||
$response['data'] = stream_get_contents($fp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Wrapper to provide a single interface for making an HTTP request.
|
||||
*
|
||||
* Attempts to use cURL, fopen(), or fsockopen(), whichever is available
|
||||
* first.
|
||||
*
|
||||
* @param string $url URL to make request to.
|
||||
* @param array $postdata (optional) If postdata is provided, the request
|
||||
* method is POST with the key/value pairs as
|
||||
* the data.
|
||||
* @param array $file (optional) Should provide associative array
|
||||
* with two keys: name and field. Name should
|
||||
* be the name of the file and field is the name
|
||||
* of the field to POST.
|
||||
*/
|
||||
function dsq_urlopen($url, $postdata=false, $file=false) {
|
||||
$response = array(
|
||||
'data' => '',
|
||||
'code' => 0
|
||||
);
|
||||
|
||||
if($file) {
|
||||
extract($file, EXTR_PREFIX_ALL, 'file');
|
||||
}
|
||||
if(!$file_name || !$file_field) {
|
||||
$file_name = false;
|
||||
$file_field = false;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
// Try curl, fsockopen, fopen + stream (PHP5 only), exec wget
|
||||
if(function_exists('curl_init')) {
|
||||
if (!function_exists('curl_setopt_array')) {
|
||||
function curl_setopt_array(&$ch, $curl_options)
|
||||
{
|
||||
foreach ($curl_options as $option => $value) {
|
||||
if (!curl_setopt($ch, $option, $value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_dsq_curl_urlopen($url, $postdata, $response, $file_name, $file_field);
|
||||
} else if(ini_get('allow_url_fopen') && function_exists('stream_get_contents')) {
|
||||
_dsq_fopen_urlopen($url, $postdata, $response, $file_name, $file_field);
|
||||
} else {
|
||||
// TODO: Find the failure condition for fsockopen() (sockets?)
|
||||
_dsq_fsockopen_urlopen($url, $postdata, $response, $file_name, $file_field);
|
||||
}
|
||||
|
||||
// returns array with keys data and code (from headers)
|
||||
|
||||
return $response;
|
||||
}
|
||||
?>
|
||||
@@ -1,272 +0,0 @@
|
||||
<?php
|
||||
global $dsq_version, $dsq_api;
|
||||
|
||||
if ( !current_user_can('manage_options') ) {
|
||||
die();
|
||||
}
|
||||
|
||||
if(isset($_POST['dsq_username'])) {
|
||||
$_POST['dsq_username'] = stripslashes($_POST['dsq_username']);
|
||||
}
|
||||
|
||||
if(isset($_POST['dsq_password'])) {
|
||||
$_POST['dsq_password'] = stripslashes($_POST['dsq_password']);
|
||||
}
|
||||
|
||||
// HACK: For old versions of WordPress
|
||||
if ( !function_exists('wp_nonce_field') ) {
|
||||
function wp_nonce_field() {}
|
||||
}
|
||||
|
||||
// Handle export function.
|
||||
if( isset($_POST['export']) ) {
|
||||
require_once(dirname(__FILE__) . '/export.php');
|
||||
dsq_export_wp();
|
||||
}
|
||||
|
||||
// Handle uninstallation.
|
||||
if ( isset($_POST['uninstall']) ) {
|
||||
update_option('disqus_forum_url', '');
|
||||
update_option('disqus_api_key', '');
|
||||
update_option('disqus_partner_key', '');
|
||||
}
|
||||
|
||||
// Clean-up POST parameters.
|
||||
foreach ( array('dsq_forum_url', 'dsq_username') as $key ) {
|
||||
if ( isset($_POST[$key]) ) { $_POST[$key] = strip_tags($_POST[$key]); }
|
||||
}
|
||||
|
||||
// Handle installation process.
|
||||
if ( isset($_POST['dsq_forum_url']) && isset($_POST['dsq_username']) && isset($_POST['dsq_password']) ) {
|
||||
$api_key = $dsq_api->get_forum_api_key($_POST['dsq_username'], $_POST['dsq_password'], $_POST['dsq_forum_url']);
|
||||
update_option('disqus_forum_url', $_POST['dsq_forum_url']);
|
||||
|
||||
if ( is_numeric($api_key) && $api_key < 0 ) {
|
||||
update_option('disqus_replace', 'replace');
|
||||
dsq_manage_dialog('There was an error completing the installation of Disqus. If you are still having issues, refer to the <a href="http://disqus.com/help/wordpress">WordPress help page</a>.', true);
|
||||
} else {
|
||||
update_option('disqus_api_key', $api_key);
|
||||
update_option('disqus_replace', 'all');
|
||||
}
|
||||
|
||||
if (!empty($_POST['disqus_partner_key'])) {
|
||||
$partner_key = trim(stripslashes($_POST['disqus_partner_key']));
|
||||
if (!empty($partner_key)) {
|
||||
update_option('disqus_partner_key', $partner_key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle advanced options.
|
||||
if ( isset($_POST['disqus_forum_url']) && isset($_POST['disqus_replace']) ) {
|
||||
$disqus_forum_url = $_POST['disqus_forum_url'];
|
||||
if ( $dot_pos = strpos($disqus_forum_url, '.') ) {
|
||||
$disqus_forum_url = substr($disqus_forum_url, 0, $dot_pos);
|
||||
}
|
||||
update_option('disqus_forum_url', $disqus_forum_url);
|
||||
update_option('disqus_partner_key', trim(stripslashes($_POST['disqus_partner_key'])));
|
||||
update_option('disqus_replace', $_POST['disqus_replace']);
|
||||
update_option('disqus_cc_fix', isset($_POST['disqus_cc_fix']));
|
||||
dsq_manage_dialog('Your settings have been changed.');
|
||||
}
|
||||
|
||||
// Get installation step process (or 0 if we're already installed).
|
||||
$step = @intval($_GET['step']);
|
||||
$step = ($step > 0 && isset($_POST['dsq_username'])) ? $step : 1;
|
||||
$step = (dsq_is_installed()) ? 0 : $step;
|
||||
|
||||
if ( 2 == $step && isset($_POST['dsq_username']) && isset($_POST['dsq_password']) ) {
|
||||
$dsq_sites = $dsq_api->get_forum_list($_POST['dsq_username'], $_POST['dsq_password']);
|
||||
if ( $dsq_sites < 0 ) {
|
||||
$step = 1;
|
||||
if ( -2 == $dsq_sites ) {
|
||||
dsq_manage_dialog('Invalid password.', true);
|
||||
} else {
|
||||
dsq_manage_dialog('Unexpected error.', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap" id="dsq-wrap">
|
||||
<ul id="dsq-tabs">
|
||||
<li class="selected" id="dsq-tab-main" rel="dsq-main"><?php echo (dsq_is_installed() ? 'Manage' : 'Install'); ?></li>
|
||||
<li id="dsq-tab-advanced" rel="dsq-advanced">Advanced Options</li>
|
||||
</ul>
|
||||
|
||||
<div id="dsq-main" class="dsq-content">
|
||||
<?php
|
||||
switch ( $step ) {
|
||||
case 2:
|
||||
?>
|
||||
<div id="dsq-step-2" class="dsq-main">
|
||||
<h2>Install Disqus Comments</h2>
|
||||
|
||||
<form method="POST" action="?page=disqus">
|
||||
<?php wp_nonce_field('dsq-install-2'); ?>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row" valign="top">Select a website</th>
|
||||
<td>
|
||||
<?php
|
||||
foreach ( $dsq_sites as $counter => $dsq_site ):
|
||||
?>
|
||||
<input name="dsq_forum_url" type="radio" id="dsq-site-<?php echo $counter; ?>" value="<?php echo $dsq_site['short_name']; ?>" />
|
||||
<label for="dsq-site-<?php echo $counter; ?>"><strong><?php echo $dsq_site['name']; ?></strong> (<u><?php echo $dsq_site['short_name']; ?>.disqus.com</u>)</label>
|
||||
<br />
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
<hr />
|
||||
<a href="http://disqus.com/comments/register/">Or register a new one on the Disqus website</a>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="submit" style="text-align: left">
|
||||
<input type="hidden" name="dsq_username" value="<?php echo $_POST['dsq_username']; ?>">
|
||||
<input type="hidden" name="dsq_password" value="<?php echo str_replace('"', '"', $_POST['dsq_password']); ?>">
|
||||
<input name="submit" type="submit" value="Next »" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 1:
|
||||
?>
|
||||
<div id="dsq-step-1" class="dsq-main">
|
||||
<h2>Install Disqus Comments</h2>
|
||||
|
||||
<form method="POST" action="?page=disqus&step=2">
|
||||
<?php wp_nonce_field('dsq-install-1'); ?>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row" valign="top">Username</th>
|
||||
<td>
|
||||
<input id="dsq-username" name="dsq_username" tabindex="1" type="text" />
|
||||
<a href="http://disqus.com/profile/">(don't have a Disqus Profile yet?)</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top">Password</th>
|
||||
<td>
|
||||
<input type="password" id="dsq-password" name="dsq_password" tabindex="2">
|
||||
<a href="http://disqus.com/forgot/">(forgot your password?)</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="submit" style="text-align: left">
|
||||
<input name="submit" type="submit" value="Next »" tabindex="3">
|
||||
</p>
|
||||
|
||||
<script type="text/javascript"> document.getElementById('dsq-username').focus(); </script>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
case 0:
|
||||
?>
|
||||
<div class="dsq-main">
|
||||
<h2>Comments</h2>
|
||||
<iframe src="<?php echo DISQUS_API_URL; ?>/comments/moderate/<?php echo get_option('disqus_forum_url'); ?>/?template=wordpress" style="width: 100%; height: 800px"></iframe>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$dsq_replace = get_option('disqus_replace');
|
||||
$dsq_forum_url = strtolower(get_option('disqus_forum_url'));
|
||||
$dsq_api_key = get_option('disqus_api_key');
|
||||
$dsq_partner_key = get_option('disqus_partner_key');
|
||||
$dsq_cc_fix = get_option('disqus_cc_fix');
|
||||
?>
|
||||
<!-- Advanced options -->
|
||||
<div id="dsq-advanced" class="dsq-content dsq-advanced" style="display:none;">
|
||||
<h2>Advanced Options</h2>
|
||||
Version: <?php echo esc_html($dsq_version); ?>
|
||||
<form method="POST">
|
||||
<?php wp_nonce_field('dsq-advanced'); ?>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row" valign="top">Disqus short name</th>
|
||||
<td>
|
||||
<input name="disqus_forum_url" value="<?php echo esc_attr($dsq_forum_url); ?>" tabindex="1" type="text" />
|
||||
<br />
|
||||
This is the unique identifier for your website on Disqus Comments.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row" valign="top">Disqus API Key</th>
|
||||
<td>
|
||||
<input type="text" name="disqus_api_key" value="<?php echo esc_attr($dsq_api_key); ?>" tabindex="2">
|
||||
<br />
|
||||
This is set for you when going through the installation steps.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row" valign="top">Disqus Partner Key</th>
|
||||
<td>
|
||||
<input type="text" name="disqus_partner_key" value="<?php echo esc_attr($dsq_partner_key); ?>" tabindex="2">
|
||||
<br />
|
||||
Advanced: Used for single sign-on (SSO) integration. (<a href="http://disqus.com/help/sso" onclick="window.open(this.href); return false">more info on SSO</a>)
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row" valign="top">Use Disqus Comments on</th>
|
||||
<td>
|
||||
<select name="disqus_replace" tabindex="3" class="disqus-replace">
|
||||
<?php if ( dsq_legacy_mode() ) : ?>
|
||||
<option value="empty" <?php if('empty'==$dsq_replace){echo 'selected';}?>>Only future blog posts and existing posts without WordPress comments.</option>
|
||||
<?php endif ; ?>
|
||||
<option value="all" <?php if('all'==$dsq_replace){echo 'selected';}?>>On all existing and future blog posts.</option>
|
||||
<option value="closed" <?php if('closed'==$dsq_replace){echo 'selected';}?>>Only on blog posts with closed comments.</option>
|
||||
</select>
|
||||
<br />
|
||||
NOTE: Your WordPress comments will never be lost.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row" valign="top">Comment Counts</th>
|
||||
<td>
|
||||
<input type="checkbox" id="disqus_comment_count" name="disqus_cc_fix" <?php if($dsq_cc_fix){echo 'checked="checked"';}?> >
|
||||
<label for="disqus_comment_count">Output JavaScript in footer</label>
|
||||
<br />NOTE: Check this if you have problems with the comment count displays including: not showing on permalinks, broken featured image carousels, or longer-than-usual homepage load times (<a href="http://disqus.com/help/wordpress" onclick="window.open(this.href); return false">more info</a>).
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<p class="submit" style="text-align: left">
|
||||
<input name="submit" type="submit" value="Save" class="button-primary button" tabindex="4">
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row" valign="top">Export comments to Disqus</th>
|
||||
<td>
|
||||
<div id="dsq_export">
|
||||
<p class="status"><a href="#" class="button">Export Comments</a> This will sync your WordPress comments with Disqus</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row" valign="top">Uninstall Disqus Comments</th>
|
||||
<td>
|
||||
<form action="?page=disqus" method="POST">
|
||||
<?php wp_nonce_field('dsq-uninstall'); ?>
|
||||
<input type="submit" value="Uninstall" name="uninstall" onclick="return confirm('Are you sure you want to uninstall Disqus?')" class="button" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,70 +0,0 @@
|
||||
=== Disqus Comment System ===
|
||||
Contributors: disqus, alexkingorg, crowdfavorite
|
||||
Tags: comments, threaded, email, notification, spam, avatars, community, profile, widget
|
||||
Requires at least: 2.8
|
||||
Tested up to: 2.9.2
|
||||
Stable tag: 2.33.8752
|
||||
|
||||
The Disqus comment system replaces your WordPress comment system with your comments hosted and powered by Disqus.
|
||||
|
||||
== Description ==
|
||||
|
||||
Disqus, pronounced "discuss", is a service and tool for web comments and
|
||||
discussions. Disqus makes commenting easier and more interactive,
|
||||
while connecting websites and commenters across a thriving discussion
|
||||
community.
|
||||
|
||||
The Disqus for WordPress plugin seamlessly integrates using the Disqus API and by syncing with WordPress comments.
|
||||
|
||||
= Disqus for WordPress =
|
||||
|
||||
* Uses the Disqus API
|
||||
* Comments indexable by search engines (SEO-friendly)
|
||||
* Support for importing existing comments
|
||||
* Auto-sync (backup) of comments with Disqus and WordPress database
|
||||
|
||||
= Disqus Features =
|
||||
|
||||
* Threaded comments and replies
|
||||
* Notifications and reply by email
|
||||
* Subscribe and RSS options
|
||||
* Aggregated comments and social mentions
|
||||
* Powerful moderation and admin tools
|
||||
* Full spam filtering, blacklists and whitelists
|
||||
* Support for Disqus community widgets
|
||||
* Connected with a large discussion community
|
||||
* Increased exposure and readership
|
||||
|
||||
== Installation ==
|
||||
|
||||
**NOTE: It is recommended that you backup your database before installing the plugin.**
|
||||
|
||||
1. Unpack archive to this archive to the 'wp-content/plugins/' directory inside
|
||||
of WordPress
|
||||
|
||||
* Maintain the directory structure of the archive (all extracted files
|
||||
should exist in 'wp-content/plugins/disqus-comment-system/'
|
||||
|
||||
2. From your blog administration, click on Comments to change settings
|
||||
(WordPress 2.0 users can find the settings under Options > Disqus.)
|
||||
|
||||
= More documentation =
|
||||
|
||||
Go to [http://disqus.com/help/wordpress](http://disqus.com/help/wordpress)
|
||||
|
||||
== Upgrading ==
|
||||
|
||||
1. Replace the old plugin with the new plugin (the plugin must stay in
|
||||
the disqus directory).
|
||||
|
||||
2. Your blog will be in legacy mode until you complete the configuration.
|
||||
This just means that it is using JavaScript to pull the comments instead
|
||||
of the API.
|
||||
|
||||
== Support ==
|
||||
|
||||
* Visit http://disqus.com/help/wordpress for help documentation.
|
||||
|
||||
* Visit http://help.disqus.com for help from our support team.
|
||||
|
||||
* Disqus also recommends the [WordPress HelpCenter](http://wphelpcenter.com/) for extended help. Disqus is not associated with the WordPress HelpCenter in any way.
|
||||
@@ -1,38 +0,0 @@
|
||||
var dsq_old_onload = window.onload;
|
||||
|
||||
function dsq_tab_func(clicked_tab) {
|
||||
function _dsq_tab_func(e) {
|
||||
var tabs = document.getElementById('dsq-tabs').getElementsByTagName('li');
|
||||
var contents = document.getElementById('dsq-wrap').getElementsByTagName('div');
|
||||
|
||||
for(var i = 0; i < tabs.length; i++) {
|
||||
tabs[i].className = '';
|
||||
}
|
||||
|
||||
for(var i = 0; i < contents.length; i++) {
|
||||
if(contents[i].className == 'dsq-content') {
|
||||
contents[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('dsq-tab-' + clicked_tab).className = 'selected';
|
||||
document.getElementById('dsq-' + clicked_tab).style.display = 'block';
|
||||
|
||||
}
|
||||
|
||||
return _dsq_tab_func;
|
||||
}
|
||||
|
||||
window.onload = function(e) {
|
||||
// Tabs have an ID prefixed with "dsq-tab-".
|
||||
// Content containers have an ID prefixed with "dsq-" and a class name of "dsq-content".
|
||||
var tabs = document.getElementById('dsq-tabs').getElementsByTagName('li');
|
||||
|
||||
for(var i = 0; i < tabs.length; i++) {
|
||||
tabs[i].onclick = dsq_tab_func(tabs[i].id.substr(tabs[i].id.lastIndexOf('-') + 1));
|
||||
}
|
||||
|
||||
if(dsq_old_onload) {
|
||||
dsq_old_onload(e);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/* Selectors required for pre-WordPress 2.5 */
|
||||
|
||||
.form-table {
|
||||
border-collapse: collapse;
|
||||
margin-top: 1em;
|
||||
width: 100%;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.form-table tr {
|
||||
background-color: #eaf3fa;
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
margin-bottom: 9px;
|
||||
padding: 10px;
|
||||
line-height: 20px;
|
||||
font-size: 11px;
|
||||
border-bottom-width: 8px;
|
||||
border-bottom-style: solid;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
vertical-align: top;
|
||||
text-align: left;
|
||||
padding: 10px;
|
||||
width: 150px;
|
||||
border-bottom-width: 8px;
|
||||
border-bottom-style: solid;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
.form-table th.th-full {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.form-table input, .form-table textarea {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.form-table div.color-option {
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.form-table input.tog {
|
||||
margin-top: 2px;
|
||||
margin-right: 2px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.form-table table.color-palette {
|
||||
vertical-align: bottom;
|
||||
float: left;
|
||||
margin: -3px 3px 8px;
|
||||
}
|
||||
|
||||
.form-table .color-palette td {
|
||||
border-bottom: none;
|
||||
border: 1px solid #fff;
|
||||
font-size: 1px;
|
||||
line-height: 1px;
|
||||
}
|
||||
|
||||
#disqus_warning{ background-color:#ff0000; }
|
||||
@@ -1,35 +0,0 @@
|
||||
ul#dsq-tabs li {
|
||||
}
|
||||
ul#dsq-tabs li.selected {
|
||||
border-bottom: 3px solid #ffa100;
|
||||
}
|
||||
ul#dsq-tabs li {
|
||||
float: left;
|
||||
color: #333;
|
||||
padding: 0.25em;
|
||||
height: 16px;
|
||||
cursor: pointer;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
ul#dsq-tabs {
|
||||
display: block;
|
||||
height: 20px;
|
||||
list-style: none;
|
||||
margin: 15px 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
}
|
||||
|
||||
select.disqus-replace {
|
||||
border-color: #C6D9E9;
|
||||
}
|
||||
|
||||
.dsq-content h2 {
|
||||
background: url(../images/logo.png) no-repeat;
|
||||
line-height: 41px;
|
||||
margin: 15px 0 10px;
|
||||
padding: 0 0 0 150px;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <body> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script> </body> </html>
|
||||
@@ -1,120 +0,0 @@
|
||||
<?php
|
||||
|
||||
if ( !class_exists('scbOptionsPage_07') )
|
||||
require_once(dirname(__FILE__) . '/inc/scbOptionsPage.php');
|
||||
|
||||
class extraFeedLinkAdmin extends scbOptionsPage_07 {
|
||||
protected function setup() {
|
||||
$this->options = $GLOBALS['EFL_options'];
|
||||
|
||||
$this->defaults = array(
|
||||
'home' => array(FALSE, '%site_title% Comments'),
|
||||
'comments' => array(TRUE, 'Comments: %title%'),
|
||||
'category' => array(TRUE, 'Category: %title%'),
|
||||
'tag' => array(TRUE, 'Tag: %title%'),
|
||||
'author' => array(TRUE, 'Author: %title%'),
|
||||
'search' => array(TRUE, 'Search: %title%')
|
||||
);
|
||||
|
||||
$this->args = array(
|
||||
'page_title' => 'Extra Feed Links',
|
||||
'short_title' => 'Extra Feed Links',
|
||||
'page_slug' => 'extra-feed-links'
|
||||
);
|
||||
|
||||
$this->nonce = 'efl-settings';
|
||||
}
|
||||
|
||||
protected function form_handler() {
|
||||
if ( empty($_POST['action']) )
|
||||
return false;
|
||||
|
||||
check_admin_referer($this->nonce);
|
||||
|
||||
// Update options
|
||||
if ( 'Save Changes' == $_POST['action'] ) {
|
||||
foreach (array_keys($this->options->get()) as $name) {
|
||||
$new_format[$name][0] = $_POST['show-' . $name];
|
||||
$new_format[$name][1] = $_POST['format-' . $name];
|
||||
}
|
||||
|
||||
$this->options->update($new_format);
|
||||
$this->admin_msg('Settings <strong>saved</strong>.');
|
||||
}
|
||||
|
||||
// Reset options
|
||||
if ( 'Reset' == $_POST['action'] ) {
|
||||
$this->options->reset();
|
||||
$this->admin_msg('Settings <strong>reset</strong>.');
|
||||
}
|
||||
}
|
||||
|
||||
public function page_head() {
|
||||
?>
|
||||
<style type="text/css">
|
||||
table input.widefat {width:250px !important}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function page_content() {
|
||||
echo $this->page_header();
|
||||
?>
|
||||
<p>The table below allows you to select which page types get an extra header link and the format of the link text.</p>
|
||||
|
||||
<div class="alignleft" style="width:auto">
|
||||
<form method="post" action="">
|
||||
<?php wp_nonce_field($this->nonce); ?>
|
||||
<table class="widefat" style="width:auto">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
||||
<th scope="col">Page type</th>
|
||||
<th scope="col">Text format</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->options->get() as $name => $value) { ?>
|
||||
<tr>
|
||||
<th scope='row' class='check-column'><?php
|
||||
echo $this->input(array(
|
||||
'type' => 'checkbox',
|
||||
'names' => 'show-'.$name,
|
||||
'desc_pos' => 'none'
|
||||
), array('show-'.$name => $value[0]));
|
||||
?></th>
|
||||
<td><?php echo ucfirst($name) ?></td>
|
||||
<td><?php
|
||||
echo $this->input(array(
|
||||
'type' => 'text',
|
||||
'names' => 'format-'.$name,
|
||||
'desc_pos' => 'none'
|
||||
), array('format-'.$name => $value[1]));
|
||||
?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="tablenav" style="width:auto">
|
||||
<div class="alignleft">
|
||||
<input name="action" type="submit" class="button-primary button" value="Save Changes" />
|
||||
<input name="action" type="submit" class="button-secondary" onClick="return confirm('Are you sure you want to reset to defaults?')" value="Reset" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div style="float:left; margin-left: 50px">
|
||||
<p>Available substitution tags:</p>
|
||||
<ul>
|
||||
<li><em>%title%</em> - displays the corresponding title for each page type</li>
|
||||
<li><em>%site_title%</em> - displays the title of the site</li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
echo $this->page_footer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,189 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Version 0.7.2
|
||||
|
||||
abstract class scbForms_07 {
|
||||
/* Generates one or more input fields, with labels
|
||||
$args = array (
|
||||
'type' => any valid <input> type
|
||||
'names' => string | array
|
||||
'values' => string | array (default: 1 or $options['name'])
|
||||
'check' => true | false (default: true)
|
||||
'extra' => string (default: class="widefat")
|
||||
'desc' => string (default: name)
|
||||
'desc_pos' => 'before' | 'after' | 'none' (default: after)
|
||||
);
|
||||
$options = array('name' => 'value'...)
|
||||
*/
|
||||
|
||||
public function input($args, $options = array()) {
|
||||
$token = '%input%';
|
||||
|
||||
extract(wp_parse_args($args, array(
|
||||
'desc_pos' => 'after',
|
||||
'check' => true,
|
||||
'extra' => 'class="widefat"'
|
||||
)));
|
||||
|
||||
// Check required fields
|
||||
if ( empty($type) )
|
||||
trigger_error('No type specified', E_USER_WARNING);
|
||||
|
||||
if ( empty($names) ) {
|
||||
trigger_error('No name specified', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for defined options
|
||||
if ( $check && 'submit' != $type && !empty($options) )
|
||||
self::check_names($names, $options);
|
||||
|
||||
$f1 = is_array($names);
|
||||
$f2 = is_array($values);
|
||||
|
||||
// Set default values
|
||||
if ( !isset($values) )
|
||||
if ( 'text' == $type && !$f1 )
|
||||
$values = stripslashes(wp_specialchars($options[$names], ENT_QUOTES));
|
||||
elseif ( in_array($type, array('checkbox', 'radio')) )
|
||||
$values = true;
|
||||
|
||||
// Expand names or values
|
||||
if ( !$f1 && !$f2 )
|
||||
$a = array($names => $values);
|
||||
elseif ( $f1 && !$f2 )
|
||||
$a = array_fill_keys($names, $values);
|
||||
elseif ( !$f1 && $f2 )
|
||||
$a = array_fill_keys($values, $names);
|
||||
else
|
||||
$a = array_combine($names, $values);
|
||||
|
||||
// Determine what goes where
|
||||
if ( !$f1 && $f2 ) {
|
||||
$i1 = 'val';
|
||||
$i2 = 'name';
|
||||
} else {
|
||||
$i1 = 'name';
|
||||
$i2 = 'val';
|
||||
}
|
||||
|
||||
if ( $f1 || $f2 )
|
||||
$l1 = 'name';
|
||||
else
|
||||
$l1 = 'desc';
|
||||
|
||||
// Generate output
|
||||
foreach ( $a as $name => $val ) {
|
||||
// Build extra string
|
||||
$extra_s = $extra;
|
||||
|
||||
if ( in_array($type, array('checkbox', 'radio')) && $options[$$i1] == $$i2)
|
||||
$extra_s .= " checked='checked'";
|
||||
|
||||
// Build the item
|
||||
$input = "<input name='{$$i1}' value='{$$i2}' type='{$type}' {$extra_s}/> ";
|
||||
|
||||
// Add description
|
||||
$desc = $$l1;
|
||||
$desc = str_replace('[]', '', $desc);
|
||||
if ( FALSE == stripos($desc, $token) )
|
||||
if ( 'before' == $desc_pos )
|
||||
$desc .= ' ' . $token;
|
||||
elseif ( 'after' == $desc_pos )
|
||||
$desc = $token . ' ' . $desc;
|
||||
$desc = str_replace($token, $input, $desc);
|
||||
$desc = trim($desc);
|
||||
|
||||
// Add label
|
||||
if ( 'none' == $desc_pos || empty($desc) )
|
||||
$output[] = $input . "\n";
|
||||
else
|
||||
$output[] = "<label for='{$$i1}'>{$desc}</label>\n";
|
||||
}
|
||||
|
||||
return implode("\n", $output);
|
||||
}
|
||||
|
||||
public static function select($args, $options) {
|
||||
extract(wp_parse_args($args, array(
|
||||
'name' => '',
|
||||
'selected' => NULL,
|
||||
'extra' => ''
|
||||
)));
|
||||
|
||||
if ( empty($name) )
|
||||
trigger_error('No name specified', E_USER_NOTICE);
|
||||
|
||||
if ( !is_array($options) ) {
|
||||
trigger_error("Second argument is expected to be an associative array", E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( $options as $key => $value ) {
|
||||
$extra_s = $extra;
|
||||
if ( $name === $selected )
|
||||
$extra_s = " selected='selected'";
|
||||
else
|
||||
$extra_s = "";
|
||||
|
||||
$opts .= "\t<option value='{$key}'{$extra_s}>{$value}</option>\n";
|
||||
}
|
||||
|
||||
return "<select name='{$name}'>\n{$opts}</select>\n";
|
||||
}
|
||||
|
||||
// Creates a textarea
|
||||
public static function textarea($args, $content) {
|
||||
extract(wp_parse_args($args, array(
|
||||
'name' => '',
|
||||
'extra' => 'class="widefat"',
|
||||
'escaped' => 'false'
|
||||
)));
|
||||
|
||||
if ( !$escaped )
|
||||
$content = stripslashes(wp_specialchars($content, ENT_QUOTES));
|
||||
|
||||
if ( empty($name) )
|
||||
trigger_error('No name specified', E_USER_NOTICE);
|
||||
|
||||
return "<textarea name='{$name}'{$extra}>\n{$content}\n</textarea>\n";
|
||||
}
|
||||
|
||||
// Adds a form around the $content, including a hidden nonce field
|
||||
public function form_wrap($content, $nonce = 'update_options') {
|
||||
$output .= "\n<form method='post' action=''>\n";
|
||||
$output .= $content;
|
||||
$output .= wp_nonce_field($action = $nonce, $name = "_wpnonce", $referer = true , $echo = false);
|
||||
$output .= "\n</form>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
//_____HELPER METHODS (SHOULD NOT BE CALLED DIRECTLY)_____
|
||||
|
||||
|
||||
// Checks if selected $names have equivalent in $options. Used by form_row()
|
||||
protected static function check_names($names, $options) {
|
||||
$names = (array) $names;
|
||||
|
||||
foreach ( $names as $i => $name )
|
||||
$names[$i] = str_replace('[]', '', $name);
|
||||
|
||||
foreach ( array_diff($names, array_keys($options)) as $key )
|
||||
trigger_error("Option not defined: {$key}", E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
// < PHP 5.2
|
||||
if ( !function_exists('array_fill_keys') ) :
|
||||
function array_fill_keys($keys, $value) {
|
||||
$r = array();
|
||||
|
||||
foreach($keys as $key)
|
||||
$r[$key] = $value;
|
||||
|
||||
return $r;
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Version 0.6
|
||||
|
||||
class scbOptions_06 {
|
||||
public $key;
|
||||
public $defaults;
|
||||
private $data;
|
||||
|
||||
public function __construct($key) {
|
||||
$this->key = $key;
|
||||
$this->data = get_option($this->key);
|
||||
}
|
||||
|
||||
public function setup($file, $defaults) {
|
||||
$this->defaults = $defaults;
|
||||
register_activation_hook($file, array($this, 'reset'), false);
|
||||
register_uninstall_hook($file, array($this, 'delete'));
|
||||
}
|
||||
|
||||
// Get all data or a certain field
|
||||
public function get($field = '') {
|
||||
if ( empty($field) === true )
|
||||
return $this->data;
|
||||
|
||||
return @$this->data[$field];
|
||||
}
|
||||
|
||||
// Update a portion of the data
|
||||
public function update_part($newdata) {
|
||||
if ( !is_array($this->data) || !is_array($newdata) )
|
||||
return false;
|
||||
|
||||
$this->update(array_merge($this->data, $newdata));
|
||||
}
|
||||
|
||||
// Update option
|
||||
public function update($newdata) {
|
||||
if ( $this->data === $newdata )
|
||||
return;
|
||||
|
||||
$this->data = $newdata;
|
||||
|
||||
add_option($this->key, $this->data) or
|
||||
update_option($this->key, $this->data);
|
||||
}
|
||||
|
||||
// Reset option to defaults
|
||||
public function reset($override = true) {
|
||||
if ( !$override && is_array($this->defaults) && is_array($this->data) )
|
||||
$newdata = array_merge($this->defaults, $this->data);
|
||||
else
|
||||
$newdata = $this->defaults;
|
||||
|
||||
$this->update($newdata);
|
||||
}
|
||||
|
||||
// Delete option
|
||||
public function delete() {
|
||||
delete_option($this->key);
|
||||
}
|
||||
}
|
||||
|
||||
// < WP 2.7
|
||||
if ( !function_exists('register_uninstall_hook') ) :
|
||||
function register_uninstall_hook() {}
|
||||
endif;
|
||||
@@ -1,195 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Version 0.7.2
|
||||
|
||||
if ( ! class_exists('scbForms_07') )
|
||||
require_once(dirname(__FILE__) . '/scbForms.php');
|
||||
|
||||
abstract class scbOptionsPage_07 extends scbForms_07 {
|
||||
// Page args
|
||||
protected $args = array(
|
||||
'page_title' => '',
|
||||
'short_title' => '',
|
||||
'page_slug' => '',
|
||||
'type' => 'settings'
|
||||
);
|
||||
|
||||
// Hook string created at page init
|
||||
protected $pagehook;
|
||||
|
||||
// Nonce string
|
||||
protected $nonce;
|
||||
|
||||
// Plugin dir url
|
||||
protected $plugin_url;
|
||||
|
||||
// scbOptions object holder
|
||||
protected $options;
|
||||
|
||||
// Form actions
|
||||
protected $actions = array();
|
||||
|
||||
|
||||
//_____MAIN METHODS_____
|
||||
|
||||
|
||||
// Main constructor
|
||||
public function __construct($file = '') {
|
||||
$this->set_url($file);
|
||||
|
||||
$this->setup();
|
||||
$this->check_args();
|
||||
|
||||
if ( isset($this->options) )
|
||||
$this->options->setup($file, $this->defaults);
|
||||
|
||||
add_action('admin_menu', array($this, 'page_init'));
|
||||
}
|
||||
|
||||
// This is where all the page args goes
|
||||
abstract protected function setup();
|
||||
|
||||
// This is where the css and js go
|
||||
public function page_head() {}
|
||||
|
||||
// This is where the page content goes
|
||||
abstract public function page_content();
|
||||
|
||||
// To be used in ::page_head()
|
||||
protected function admin_msg($msg, $class = "updated") {
|
||||
echo "<div class='$class fade'><p>$msg</p></div>\n";
|
||||
}
|
||||
|
||||
// Wraps a string in a <script> tag
|
||||
public function wrap_js($string) {
|
||||
return "\n<script language='text/javascript'>\n" . $string . "\n</script>\n";
|
||||
}
|
||||
|
||||
// Wraps a string in a <style> tag
|
||||
public function wrap_css($string) {
|
||||
return "\n<style type='text/css'>\n" . $string . "\n</style>\n";
|
||||
}
|
||||
|
||||
// Generates a standard page head
|
||||
protected function page_header() {
|
||||
$this->form_handler();
|
||||
|
||||
echo "<div class='wrap'>\n";
|
||||
echo "<h2>".$this->args['page_title']."</h2>\n";
|
||||
}
|
||||
|
||||
// Generates a standard page footer
|
||||
protected function page_footer() {
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
public function form_wrap($content) {
|
||||
return parent::form_wrap($content, $this->nonce);
|
||||
}
|
||||
|
||||
// Wrap a field in a table row
|
||||
public function form_row($args, $options) {
|
||||
return "\n<tr>\n\t<th scope='row'>{$args['title']}</th>\n\t<td>\n\t\t". parent::input($args, $options) ."\n\t</td>\n\n</tr>";
|
||||
}
|
||||
|
||||
// Generates multiple rows and wraps them in a form table
|
||||
protected function form_table($rows, $action = 'Save Changes') {
|
||||
$output .= "\n<table class='form-table'>";
|
||||
|
||||
$options = $this->options->get();
|
||||
foreach ( $rows as $row )
|
||||
$output .= $this->form_row($row, $options);
|
||||
|
||||
$output .= "\n</table>\n";
|
||||
$output .= $this->submit_button($action);
|
||||
|
||||
return parent::form_wrap($output, $this->nonce);
|
||||
}
|
||||
|
||||
// Generates a submit form button
|
||||
protected function submit_button($action = 'Save Changes', $class = "button") {
|
||||
if ( in_array($action, $this->actions) )
|
||||
trigger_error("Duplicate action for submit button: {$action}", E_USER_WARNING);
|
||||
|
||||
$args = array(
|
||||
'type' => 'submit',
|
||||
'names' => 'action',
|
||||
'values' => $action,
|
||||
'extra' => '',
|
||||
'desc_pos' => 'none'
|
||||
);
|
||||
|
||||
if ( ! empty($class) )
|
||||
$args['extra'] = "class='{$class}'";
|
||||
|
||||
$this->actions[] = $action;
|
||||
$output .= "<p class='submit'>\n";
|
||||
$output .= parent::input($args);
|
||||
$output .= "</p>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
//_____HELPER METHODS (SHOULD NOT BE CALLED DIRECTLY)_____
|
||||
|
||||
|
||||
// Checks and sets default args
|
||||
protected function check_args() {
|
||||
if ( empty($this->args['page_title']) )
|
||||
trigger_error('Page title cannot be empty', E_USER_ERROR);
|
||||
|
||||
if ( empty($this->args['type']) )
|
||||
$this->args['type'] = 'settings';
|
||||
|
||||
if ( empty($this->args['short_title']) )
|
||||
$this->args['short_title'] = $this->args['page_title'];
|
||||
|
||||
if ( empty($this->args['page_slug']) )
|
||||
$this->args['page_slug'] = sanitize_title_with_dashes($this->args['short_title']);
|
||||
|
||||
if ( empty($this->nonce) )
|
||||
$this->nonce = $this->args['page_slug'];
|
||||
}
|
||||
|
||||
// Registers a page
|
||||
public function page_init() {
|
||||
if ( !current_user_can('manage_options') )
|
||||
return false;
|
||||
|
||||
extract($this->args);
|
||||
|
||||
if ( 'settings' == $type )
|
||||
$this->pagehook = add_options_page($short_title, $short_title, 8, $page_slug, array($this, 'page_content'));
|
||||
elseif ( 'tools' == $type )
|
||||
$this->pagehook = add_management_page($short_title, $short_title, 8, $page_slug, array($this, 'page_content'));
|
||||
else
|
||||
trigger_error("Unknown page type: $page", E_USER_WARNING);
|
||||
|
||||
add_action('admin_print_styles-' . $this->pagehook, array($this, 'page_head'));
|
||||
}
|
||||
|
||||
// Update options
|
||||
protected function form_handler() {
|
||||
if ( 'Save Changes' != $_POST['action'] )
|
||||
return false;
|
||||
|
||||
check_admin_referer($this->nonce);
|
||||
|
||||
foreach ( $this->options->get() as $name => $value )
|
||||
$new_options[$name] = $_POST[$name];
|
||||
|
||||
$this->options->update($new_options);
|
||||
|
||||
$this->admin_msg('Settings <strong>saved</strong>.');
|
||||
}
|
||||
|
||||
// Set plugin_dir
|
||||
protected function set_url($file) {
|
||||
if ( function_exists('plugins_url') )
|
||||
$this->plugin_url = plugins_url(plugin_basename(dirname($file)));
|
||||
else
|
||||
// < WP 2.6
|
||||
$this->plugin_url = get_option('siteurl') . '/wp-content/plugins/' . plugin_basename(dirname($file));
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Extra Feed Links
|
||||
Version: 1.1.5.1
|
||||
Description: Adds extra feed auto-discovery links to various page types (categories, tags, search results etc.).
|
||||
Author: scribu
|
||||
Author URI: http://scribu.net/
|
||||
Plugin URI: http://scribu.net/wordpress/extra-feed-links
|
||||
|
||||
Copyright (C) 2009 scribu.net (scribu AT gmail DOT com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
class extraFeedLink {
|
||||
var $format;
|
||||
var $format_name;
|
||||
var $url;
|
||||
var $title;
|
||||
var $text;
|
||||
|
||||
function __construct() {
|
||||
$this->format = $GLOBALS['EFL_options']->get();
|
||||
add_action('wp_head', array($this, 'head_link'));
|
||||
}
|
||||
|
||||
function head_link() {
|
||||
$this->generate();
|
||||
|
||||
if( !$this->url || !$this->text )
|
||||
return;
|
||||
|
||||
echo "\n" . '<link rel="alternate" type="application/rss+xml" title="' . $this->text . '" href="' . $this->url . '" />' . "\n";
|
||||
}
|
||||
|
||||
function theme_link($input) {
|
||||
$this->generate(TRUE);
|
||||
|
||||
if( !$this->url )
|
||||
return;
|
||||
|
||||
if ( substr($input, 0, 4) == 'http' )
|
||||
echo '<a href="' . $this->url . '" title="' . $this->text . '"><img src="' . $input . '" alt="rss icon" /></a>';
|
||||
elseif ( $input == '' )
|
||||
echo '<a href="' . $this->url . '" title="' . $this->text . '">' . $this->text . '</a>';
|
||||
elseif ( $input == 'raw' )
|
||||
echo $this->url;
|
||||
else
|
||||
echo '<a href="' . $this->url . '" title="' . $this->text . '">' . $input . '</a>';
|
||||
}
|
||||
|
||||
function generate($for_theme = FALSE) {
|
||||
$this->title = $this->url = NULL;
|
||||
|
||||
if ( is_home() && ($this->format['home'][0] || $for_theme) ) {
|
||||
$this->url = get_bloginfo('comments_rss2_url');
|
||||
$this->format_name = 'home';
|
||||
}
|
||||
elseif ( (is_single() || is_page()) && ($this->format['comments'][0] || $for_theme) ) {
|
||||
global $post;
|
||||
if ( $post->comment_status == 'open' ) {
|
||||
$this->url = get_post_comments_feed_link($post->ID);
|
||||
$this->title = $post->post_title;
|
||||
$this->format_name = 'comments';
|
||||
}
|
||||
}
|
||||
elseif ( is_category() && ($this->format['category'][0] || $for_theme) ) {
|
||||
global $wp_query;
|
||||
$cat_obj = $wp_query->get_queried_object();
|
||||
|
||||
$this->url = get_category_feed_link($cat_obj->term_id);
|
||||
$this->title = $cat_obj->name;
|
||||
$this->format_name = 'category';
|
||||
}
|
||||
elseif ( is_tag() && ($this->format['tag'][0] || $for_theme) ) {
|
||||
global $wp_query;
|
||||
$tag_obj = $wp_query->get_queried_object();
|
||||
|
||||
$this->url = get_tag_feed_link($tag_obj->term_id);
|
||||
$this->title = $tag_obj->name;
|
||||
$this->format_name = 'tag';
|
||||
}
|
||||
elseif ( is_author() && ($this->format['author'][0] || $for_theme) ) {
|
||||
global $wp_query;
|
||||
$author_obj = $wp_query->get_queried_object();
|
||||
|
||||
$this->url = get_author_feed_link($author_obj->ID);
|
||||
$this->title = $author_obj->user_nicename;
|
||||
$this->format_name = 'author';
|
||||
}
|
||||
elseif ( is_search() && ($this->format['search'][0] || $for_theme) ) {
|
||||
$search = attribute_escape(get_search_query());
|
||||
|
||||
$this->url = get_search_feed_link($search);
|
||||
$this->title = $search;
|
||||
$this->format_name = 'search';
|
||||
}
|
||||
|
||||
// Set the appropriate format
|
||||
$this->text = $this->format[$this->format_name][1];
|
||||
|
||||
// Convert substitution tags
|
||||
$this->text = str_replace('%title%', $this->title, $this->text);
|
||||
$this->text = str_replace('%site_title%', get_option('blogname'), $this->text);
|
||||
}
|
||||
}
|
||||
|
||||
// Init
|
||||
function efl_init() {
|
||||
if ( !class_exists('scbOptions_06') )
|
||||
require_once(dirname(__FILE__) . '/inc/scbOptions.php');
|
||||
|
||||
$GLOBALS['EFL_options'] = new scbOptions_06('efl-format');
|
||||
$GLOBALS['extraFeedLink'] = new extraFeedLink();
|
||||
|
||||
if ( is_admin() ) {
|
||||
require_once (dirname(__FILE__) . '/admin.php');
|
||||
new extraFeedLinkAdmin(__FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
efl_init();
|
||||
|
||||
remove_action('wp_head', 'feed_links_extra', 3);
|
||||
|
||||
// Template tag
|
||||
function extra_feed_link($input = '') {
|
||||
global $extraFeedLink;
|
||||
|
||||
$extraFeedLink->theme_link($input);
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
=== Extra Feed Links ===
|
||||
Contributors: scribu
|
||||
Donate link: http://scribu.net/wordpress
|
||||
Tags: archive, comments, feed, rss, aton
|
||||
Requires at least: 2.5
|
||||
Tested up to: 2.8
|
||||
Stable tag: 1.1.5.1
|
||||
|
||||
Adds extra feed auto-discovery links to various page types (categories, tags, search results etc.)
|
||||
|
||||
== Description ==
|
||||
|
||||
This plugin adds feed auto-discovery links to any page type:
|
||||
|
||||
* Category page
|
||||
* Tag page
|
||||
* Search page
|
||||
* Author page
|
||||
* Comments feed for single articles and pages
|
||||
|
||||
It also has a template tag that you can use in your theme.
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Unzip the archive and put the folder into your plugins folder (/wp-content/plugins/).
|
||||
1. Activate the plugin from the Plugins admin menu.
|
||||
1. Customize the links in the settings page.
|
||||
|
||||
**Usage**
|
||||
|
||||
You can use `extra_feed_link()` inside your theme to display a link to the feed corresponding to the type of page:
|
||||
|
||||
* `<?php extra_feed_link(); ?>` (creates a link with the default text)
|
||||
* `<?php extra_feed_link('Link Text'); ?>` (creates a link with the text you choose)
|
||||
* `<?php extra_feed_link('http://url/of/image'); ?>` (creates an image tag linked to the feed URL)
|
||||
* `<?php extra_feed_link('raw'); ?>` (just displays the feed URL)
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= "Parse error: syntax error, unexpected T_CLASS..." Help! =
|
||||
|
||||
Make sure your new host is running PHP 5. Add this line to wp-config.php:
|
||||
|
||||
`var_dump(PHP_VERSION);`
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.1.5 =
|
||||
* WP 2.8 compatibility
|
||||
|
||||
= 1.1.1 =
|
||||
* italian translation
|
||||
|
||||
= 1.1 =
|
||||
* more flexible link text format
|
||||
* [more info](http://scribu.net/wordpress/extra-feed-links/efl-1-1.html)
|
||||
|
||||
= 1.0 =
|
||||
* added options page
|
||||
|
||||
= 0.6 =
|
||||
* extra_feed_link() template tag
|
||||
|
||||
= 0.5 =
|
||||
* initial release
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
<?php
|
||||
|
||||
class FEE_Admin extends scbBoxesPage {
|
||||
|
||||
function setup() {
|
||||
$this->textdomain = 'front-end-editor';
|
||||
|
||||
$this->args = array('page_title' => __('Front-end Editor', $this->textdomain));
|
||||
|
||||
$this->boxes = array(
|
||||
array('fields', __('Fields', $this->textdomain), 'normal'),
|
||||
array('settings', __('Settings', $this->textdomain), 'side'),
|
||||
);
|
||||
}
|
||||
|
||||
function page_head() {
|
||||
?>
|
||||
<style type="text/css">
|
||||
#fields table {
|
||||
clear: none;
|
||||
width: auto;
|
||||
float: left;
|
||||
margin-right: 1em !important;
|
||||
}
|
||||
|
||||
#fields thead th {
|
||||
background: #F1F1F1;
|
||||
padding: 5px 8px 8px;
|
||||
line-height: 1;
|
||||
font-size: 11px;
|
||||
}
|
||||
#fields .check-column, #fields th, #fields td {padding-left: 0 !important}
|
||||
|
||||
#fields .submit {
|
||||
clear: both !important;
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
function fields_handler() {
|
||||
if ( ! isset($_POST['manage_fields']) )
|
||||
return;
|
||||
|
||||
$disabled = array();
|
||||
foreach ( array_keys( FEE_Core::get_fields() ) as $field )
|
||||
if ( ! isset($_POST[$field]) )
|
||||
$disabled[] = $field;
|
||||
|
||||
$this->options->disabled = $disabled;
|
||||
|
||||
$this->admin_msg();
|
||||
}
|
||||
|
||||
function fields_box() {
|
||||
// Separate fields
|
||||
$post_fields = $other_fields = array();
|
||||
foreach ( FEE_Core::get_fields() as $field => $args )
|
||||
if ( 'post' == call_user_func(array($args['class'], 'get_object_type') ) )
|
||||
$post_fields[$field] = $args;
|
||||
else
|
||||
$other_fields[$field] = $args;
|
||||
|
||||
echo html('p', __('Enable or disable editable fields', $this->textdomain));
|
||||
|
||||
$tables = self::fields_table(__('Post fields', $this->textdomain), $post_fields);
|
||||
$tables .= self::fields_table(__('Other fields', $this->textdomain), $other_fields);
|
||||
|
||||
echo $this->form_wrap($tables, '', 'manage_fields');
|
||||
}
|
||||
|
||||
private function fields_table($title, $fields) {
|
||||
$thead =
|
||||
html('thead',
|
||||
html('tr',
|
||||
html('th scope="col" class="check-column"', '<input type="checkbox" />')
|
||||
.html('th scope="col"', $title)
|
||||
)
|
||||
);
|
||||
|
||||
$tbody = '';
|
||||
foreach ( $fields as $field => $args )
|
||||
$tbody .=
|
||||
html('tr',
|
||||
html('th scope="row" class="check-column"',
|
||||
$this->input(array(
|
||||
'type' => 'checkbox',
|
||||
'name' => $field,
|
||||
'checked' => ! @in_array($field, $this->options->disabled)
|
||||
))
|
||||
)
|
||||
.html('td', $args['title'])
|
||||
);
|
||||
|
||||
return html('table class="widefat"', $thead . $tbody);
|
||||
}
|
||||
|
||||
function settings_handler() {
|
||||
if ( !isset($_POST['save_settings']) )
|
||||
return;
|
||||
|
||||
foreach ( array('rich', 'chunks', 'reset_date', 'highlight', 'tooltip') as $key )
|
||||
$this->options->$key = (bool) @$_POST[$key];
|
||||
|
||||
$this->admin_msg();
|
||||
}
|
||||
|
||||
function settings_box() {
|
||||
$rows = array(
|
||||
array(
|
||||
'desc' => __('Enable the WYSIWYG editor', $this->textdomain),
|
||||
'type' => 'checkbox',
|
||||
'name' => 'rich',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __('Edit one paragraph at a time, instead of an entire post', $this->textdomain),
|
||||
'type' => 'checkbox',
|
||||
'name' => 'chunks',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __('Reset the post date on each edit', $this->textdomain),
|
||||
'type' => 'checkbox',
|
||||
'name' => 'reset_date',
|
||||
),
|
||||
|
||||
array(
|
||||
'desc' => __('Highlight editable elements', $this->textdomain),
|
||||
'type' => 'checkbox',
|
||||
'name' => 'highlight',
|
||||
),
|
||||
array(
|
||||
'desc' => __('Display a tooltip above editable elements', $this->textdomain),
|
||||
'type' => 'checkbox',
|
||||
'name' => 'tooltip',
|
||||
),
|
||||
);
|
||||
|
||||
$out = '';
|
||||
foreach ( $rows as $row )
|
||||
$out .= html('p', $this->input($row));
|
||||
|
||||
echo $this->form_wrap($out, '', 'save_settings');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
<?php
|
||||
|
||||
abstract class FEE_Core {
|
||||
static $options;
|
||||
|
||||
private static $fields;
|
||||
private static $active_fields;
|
||||
private static $instances = array();
|
||||
|
||||
private static $plugin_url;
|
||||
private static $version;
|
||||
private static $nonce = 'front-editor';
|
||||
|
||||
static function init($options, $version) {
|
||||
self::$options = $options;
|
||||
self::$version = $version;
|
||||
|
||||
add_action('front_end_editor_fields', array(__CLASS__, 'make_instances'), 100);
|
||||
|
||||
add_action('wp_ajax_front-editor', array(__CLASS__, 'ajax_response'));
|
||||
|
||||
add_action('template_redirect', array(__CLASS__, '_init'));
|
||||
}
|
||||
|
||||
static function _init() {
|
||||
if ( ! is_user_logged_in() || apply_filters('front_end_editor_disable', false) )
|
||||
return;
|
||||
|
||||
add_action('wp_head', array(__CLASS__, 'add_filters'), 100);
|
||||
add_action('wp_footer', array(__CLASS__, 'scripts'));
|
||||
|
||||
if ( self::$options->highlight )
|
||||
add_action('wp_head', array(__CLASS__, 'highlight'));
|
||||
}
|
||||
|
||||
static function highlight() {
|
||||
?>
|
||||
<style type='text/css'>.fee-field:hover, .fee-field:hover > * {background-color: #ffffa5}</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
static function scripts() {
|
||||
$wrapped = FEE_Field_Base::get_wrapped();
|
||||
|
||||
if ( empty($wrapped) )
|
||||
return;
|
||||
|
||||
$url = plugins_url('editor/', __FILE__);
|
||||
|
||||
$css_dev = defined('STYLE_DEBUG') && STYLE_DEBUG ? '.dev' : '';
|
||||
$js_dev = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
|
||||
|
||||
// Prepare data
|
||||
$field_types = array();
|
||||
foreach ( self::$active_fields as $name => $args )
|
||||
$field_types[$name] = $args['type'];
|
||||
|
||||
$data = array(
|
||||
'save_text' => __('Save', 'front-end-editor'),
|
||||
'cancel_text' => __('Cancel', 'front-end-editor'),
|
||||
'fields' => $field_types,
|
||||
'ajax_url' => admin_url('admin-ajax.php'),
|
||||
'spinner' => admin_url('images/loading.gif'),
|
||||
'nonce' => wp_create_nonce(self::$nonce),
|
||||
);
|
||||
|
||||
$css_dependencies = array();
|
||||
$js_dependencies = array('jquery');
|
||||
|
||||
// qTip
|
||||
if ( self::$options->tooltip ) {
|
||||
$data['tooltip'] = array(
|
||||
'icon' => $url . 'editor.png',
|
||||
'text' => __('Double-click to edit', 'front-end-editor')
|
||||
);
|
||||
|
||||
wp_register_script('jquery-qtip', $url . "jquery.qtip$js_dev.js", array(), '1.0-rc3', true);
|
||||
$js_dependencies[] = 'jquery-qtip';
|
||||
}
|
||||
|
||||
// Autosuggest
|
||||
if ( array_key_exists('terminput', $wrapped) ) {
|
||||
$js_dependencies[] = 'suggest';
|
||||
}
|
||||
|
||||
// Rich Editor
|
||||
if ( array_key_exists('rich', $wrapped) ) {
|
||||
$data['nicedit'] = apply_filters('front_end_editor_nicedit', array(
|
||||
'iconsPath' => $url . 'nicedit/nicEditorIcons.gif',
|
||||
'buttonList' => array(
|
||||
'bold', 'italic', 'strikethrough',
|
||||
'left','center', 'right',
|
||||
'fontFormat', 'fontFamily', 'forecolor',
|
||||
'removeformat',
|
||||
'ul', 'ol',
|
||||
'link', 'image',
|
||||
'xhtml'
|
||||
)
|
||||
));
|
||||
|
||||
wp_register_script('nicedit', $url . "nicedit/nicEdit$js_dev.js", array(), '0.9r23', true);
|
||||
$js_dependencies[] = 'nicedit';
|
||||
}
|
||||
|
||||
// Thickbox
|
||||
if ( array_key_exists('image', $wrapped) || array_key_exists('thumbnail', $wrapped) ) {
|
||||
$data['admin_url'] = admin_url();
|
||||
|
||||
$data['image'] = array(
|
||||
'change' => __('Change Image', 'front-end-editor'),
|
||||
'revert' => '(' . __('Clear', 'front-end-editor') . ')',
|
||||
'tb_close' => get_bloginfo('wpurl') . '/wp-includes/js/thickbox/tb-close.png',
|
||||
);
|
||||
|
||||
$css_dependencies[] = 'thickbox';
|
||||
$js_dependencies[] = 'thickbox';
|
||||
|
||||
wp_register_script('livequery', $url . 'livequery.js', array('jquery'), '1.1.0-pre', true);
|
||||
$js_dependencies[] = 'livequery';
|
||||
}
|
||||
|
||||
// Core script
|
||||
wp_register_style('front-end-editor', $url . "editor$css_dev.css", $css_dependencies, self::$version);
|
||||
wp_register_script('front-end-editor', $url . "editor$js_dev.js", $js_dependencies, self::$version, true);
|
||||
|
||||
?>
|
||||
<script type='text/javascript'>
|
||||
var FrontEndEditor = {};
|
||||
FrontEndEditor.data = <?php echo json_encode($data) ?>;
|
||||
</script>
|
||||
<?php
|
||||
scbUtil::do_scripts('front-end-editor');
|
||||
scbUtil::do_styles('front-end-editor');
|
||||
}
|
||||
|
||||
// Register a new editable field
|
||||
static function register() {
|
||||
list ( $filter, $args ) = func_get_arg(0);
|
||||
|
||||
if ( ! is_subclass_of($args['class'], 'FEE_Field_Base') ) {
|
||||
trigger_error($args['class'] . " must be a subclass of " . 'FEE_Field_Base', E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isset(self::$fields[$filter]) )
|
||||
$args = wp_parse_args($args, self::$fields[$filter]);
|
||||
else
|
||||
$args = wp_parse_args($args, array(
|
||||
'title' => ucfirst(str_replace('_', ' ', $filter)),
|
||||
'type' => 'input',
|
||||
'priority' => 11,
|
||||
'argc' => 1
|
||||
));
|
||||
|
||||
self::$fields[$filter] = $args;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static function make_instances() {
|
||||
self::$active_fields = self::get_fields();
|
||||
foreach ( (array) self::$options->disabled as $name )
|
||||
unset(self::$active_fields[$name]);
|
||||
|
||||
foreach ( self::$active_fields as $name => $args ) {
|
||||
extract($args);
|
||||
|
||||
self::$instances[$name] = new $class($name, $type);
|
||||
}
|
||||
}
|
||||
|
||||
static function add_filters() {
|
||||
foreach ( self::$active_fields as $name => $args ) {
|
||||
extract($args);
|
||||
|
||||
$instance = self::$instances[$name];
|
||||
|
||||
add_filter($name, array($instance, 'wrap'), $priority, $argc);
|
||||
}
|
||||
}
|
||||
|
||||
static function get_fields() {
|
||||
return self::$fields;
|
||||
}
|
||||
|
||||
static function get_args($filter) {
|
||||
return self::$fields[$filter];
|
||||
}
|
||||
|
||||
static function ajax_response() {
|
||||
// Is user trusted?
|
||||
check_ajax_referer(self::$nonce, 'nonce');
|
||||
|
||||
$id = $_POST['item_id'];
|
||||
$name = $_POST['name'];
|
||||
$type = $_POST['type'];
|
||||
$action = $_POST['callback'];
|
||||
|
||||
// Is the current field defined?
|
||||
if ( ! $instance = self::$instances[$name] )
|
||||
die(-1);
|
||||
|
||||
// Does the user have the right to do this?
|
||||
if ( ! $instance->check($id) || ! $instance->allow($id) )
|
||||
die(-1);
|
||||
|
||||
$args = self::get_args($name);
|
||||
|
||||
if ( $action == 'save' ) {
|
||||
$content = stripslashes_deep($_POST['content']);
|
||||
$result = $instance->save($id, $content);
|
||||
$result = @apply_filters($name, $result);
|
||||
}
|
||||
elseif ( $action == 'get' ) {
|
||||
$result = $instance->get($id);
|
||||
|
||||
if ( $type == 'rich' )
|
||||
$result = wpautop($result);
|
||||
}
|
||||
|
||||
die($result);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Registers a new editable field
|
||||
|
||||
@param string $filter
|
||||
@param array $args(
|
||||
'class' => string The name of the field handler class (mandatory)
|
||||
'title' => string The user-friendly title (optional)
|
||||
'type' => string: 'input' | 'textarea' | 'rich' | 'image' (default: input)
|
||||
'priority' => integer (default: 11)
|
||||
'argc' => integer (default: 1)
|
||||
)
|
||||
*/
|
||||
function register_fronted_field() {
|
||||
return FEE_Core::register(func_get_args());
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
.fee-field,.fee-form{margin:0!important;padding:0!important;border-width:0!important;}div.fee-form,textarea.fee-form-content{clear:both!important;width:100%!important;}.fee-form-spinner{border:0!important;width:16px!important;height:16px!important;}div.fee-form button{margin-top:5px;}span.fee-form input{margin-right:5px;}.fee-form button+button{margin-left:5px;}.fee-form button{text-decoration:none!important;line-height:14px!important;font-size:11px!important;vertical-align:middle!important;padding:2px 8px!important;cursor:pointer!important;-moz-border-radius:11px;-khtml-border-radius:11px;-webkit-border-radius:11px;border-radius:11px;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;-khtml-box-sizing:content-box;box-sizing:content-box;}button.fee-form-save{background-color:#23779f;color:#fff;border:1px solid #1c5e7f;font-weight:bold;}.fee-form-save:hover{border:1px solid #000!important;}button.fee-form-cancel{background-color:#fcfcfc;color:#808080;border:1px solid #ddd;}.fee-form-cancel:hover{border:1px solid #666!important;}.nicEdit-selected:focus{outline:none;}.fee-suggest-results{padding:0;margin:0;list-style:none;position:absolute;display:none;z-index:10000;border-width:1px;border-style:solid;}.fee-suggest-results li{padding:2px 5px;white-space:nowrap;text-align:left;}.fee-suggest-match{text-decoration:underline;}.fee-suggest-over{cursor:pointer;}.fee-suggest-results{background-color:#fff;border-color:#808080;}.fee-suggest-results li{color:#101010;}.fee-suggest-match{color:#000;}.fee-suggest-over{background-color:#f0f0b8;}#TB_window #TB_title{background-color:#222;color:#CFCFCF;height:27px;}#fee-img-revert{display:block;float:left;padding:6px 10px 0;}#fee-img-revert:link,#fee-img-revert:active,#fee-img-revert:visited{color:#21759B!important;}#fee-img-revert:hover{color:#D54E21!important;}
|
||||
@@ -1,104 +0,0 @@
|
||||
/* Main */
|
||||
.fee-field, .fee-form {
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
border-width: 0 !important;
|
||||
}
|
||||
div.fee-form, textarea.fee-form-content {
|
||||
clear: both !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
.fee-form-spinner {
|
||||
border: 0 !important;
|
||||
width: 16px !important;
|
||||
height: 16px !important;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
div.fee-form button {margin-top: 5px}
|
||||
span.fee-form input {margin-right: 5px}
|
||||
.fee-form button + button {margin-left: 5px}
|
||||
|
||||
.fee-form button {
|
||||
text-decoration: none !important;
|
||||
line-height: 14px !important;
|
||||
font-size: 11px !important;
|
||||
vertical-align: middle !important;
|
||||
padding: 2px 8px !important;
|
||||
cursor: pointer !important;
|
||||
-moz-border-radius: 11px;
|
||||
-khtml-border-radius: 11px;
|
||||
-webkit-border-radius: 11px;
|
||||
border-radius: 11px;
|
||||
-moz-box-sizing: content-box;
|
||||
-webkit-box-sizing: content-box;
|
||||
-khtml-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
button.fee-form-save {
|
||||
background-color: #23779f;
|
||||
color: #fff;
|
||||
border: 1px solid #1c5e7f;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fee-form-save:hover {
|
||||
border: 1px solid #000 !important;
|
||||
}
|
||||
|
||||
button.fee-form-cancel {
|
||||
background-color: #fcfcfc;
|
||||
color: #808080;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.fee-form-cancel:hover {
|
||||
border: 1px solid #666 !important;
|
||||
}
|
||||
|
||||
/* Rich Editor */
|
||||
.nicEdit-selected:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Suggest */
|
||||
.fee-suggest-results {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
position: absolute;
|
||||
display: none;
|
||||
z-index: 10000;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
}
|
||||
.fee-suggest-results li {padding: 2px 5px; white-space: nowrap; text-align: left}
|
||||
.fee-suggest-match {text-decoration: underline}
|
||||
.fee-suggest-over {cursor: pointer}
|
||||
|
||||
/* Suggest colors */
|
||||
.fee-suggest-results {background-color: #fff; border-color: #808080}
|
||||
.fee-suggest-results li {color: #101010}
|
||||
.fee-suggest-match {color: #000}
|
||||
.fee-suggest-over {background-color: #f0f0b8}
|
||||
|
||||
/* Image */
|
||||
#TB_window #TB_title {
|
||||
background-color: #222;
|
||||
color: #CFCFCF;
|
||||
height: 27px;
|
||||
}
|
||||
|
||||
#fee-img-revert {
|
||||
display: block;
|
||||
float: left;
|
||||
padding: 6px 10px 0;
|
||||
}
|
||||
#fee-img-revert:link, #fee-img-revert:active, #fee-img-revert:visited {
|
||||
color: #21759B !important;
|
||||
}
|
||||
#fee-img-revert:hover {
|
||||
color: #D54E21 !important;
|
||||
}
|
||||
|
||||
@@ -1,669 +0,0 @@
|
||||
(function($){
|
||||
|
||||
if ( FrontEndEditor._loaded )
|
||||
return;
|
||||
FrontEndEditor._loaded = true;
|
||||
|
||||
// http://ejohn.org/blog/simple-javascript-inheritance/
|
||||
// Inspired by base2 and Prototype
|
||||
(function(){
|
||||
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
|
||||
|
||||
// The base Class implementation (does nothing)
|
||||
this.Class = function(){};
|
||||
|
||||
// Create a new Class that inherits from this class
|
||||
Class.extend = function(prop) {
|
||||
var _super = this.prototype;
|
||||
|
||||
// Instantiate a base class (but only create the instance,
|
||||
// don't run the init constructor)
|
||||
initializing = true;
|
||||
var prototype = new this();
|
||||
initializing = false;
|
||||
|
||||
// Copy the properties over onto the new prototype
|
||||
for (var name in prop) {
|
||||
// Check if we're overwriting an existing function
|
||||
prototype[name] = ( typeof prop[name] == "function" &&
|
||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ) ?
|
||||
(function(name, fn){
|
||||
return function() {
|
||||
var tmp = this._super;
|
||||
|
||||
// Add a new ._super() method that is the same method
|
||||
// but on the super-class
|
||||
this._super = _super[name];
|
||||
|
||||
// The method only need to be bound temporarily, so we
|
||||
// remove it when we're done executing
|
||||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(name, prop[name]) :
|
||||
prop[name];
|
||||
}
|
||||
|
||||
// The dummy class constructor
|
||||
function Class() {
|
||||
// All construction is actually done in the init method
|
||||
if ( !initializing && this.init )
|
||||
this.init.apply(this, arguments);
|
||||
}
|
||||
|
||||
// Populate our constructed prototype object
|
||||
Class.prototype = prototype;
|
||||
|
||||
// Enforce the constructor to be what we expect
|
||||
Class.constructor = Class;
|
||||
|
||||
// And make this class extendable
|
||||
Class.extend = arguments.callee;
|
||||
|
||||
return Class;
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
// _____Actual code starts here_____
|
||||
|
||||
|
||||
var spinner = $('<img>').attr({
|
||||
'src': FrontEndEditor.data.spinner,
|
||||
'class': 'front-editor-spinner'
|
||||
});
|
||||
|
||||
var is_overlay = function($el) {
|
||||
var attr = [$el.attr('id'), $el.attr("class"), $el.attr("rel")];
|
||||
|
||||
var tokens = ['lightbox', 'thickbox', 'shutter', 'awppost_link'];
|
||||
|
||||
for ( var i in tokens )
|
||||
for ( var j in attr )
|
||||
if ( attr[j].indexOf(tokens[i]) != -1 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
var resume = function() {
|
||||
if ( FrontEndEditor._trap )
|
||||
return;
|
||||
|
||||
var $link = FrontEndEditor._to_click;
|
||||
|
||||
if ( typeof $link == 'undefined' )
|
||||
return;
|
||||
|
||||
/*
|
||||
var ev_reference;
|
||||
var ev_capture = function(ev) { ev_reference = ev; }
|
||||
|
||||
var onClick = $link.attr('onclick');
|
||||
|
||||
$link.bind('click', ev_capture);
|
||||
|
||||
if ( typeof onClick == 'function' )
|
||||
$link.bind('click', onClick);
|
||||
|
||||
$link.click();
|
||||
|
||||
$link.unbind('click', ev_capture);
|
||||
|
||||
if ( typeof onClick == 'function' )
|
||||
$link.unbind('click', onClick);
|
||||
|
||||
if ( ev_reference.isDefaultPrevented() )
|
||||
return;
|
||||
*/
|
||||
|
||||
if ( typeof $link.attr('href') != 'undefined' && $link.attr('href') != '#' ) {
|
||||
if ( $link.attr('target') == '_blank' )
|
||||
window.open($link.attr('href'));
|
||||
else
|
||||
window.location.href = $link.attr('href');
|
||||
}
|
||||
|
||||
delete FrontEndEditor._to_click;
|
||||
};
|
||||
|
||||
var fieldTypes = {};
|
||||
|
||||
fieldTypes['base'] = Class.extend({
|
||||
|
||||
init: function($el, type, name, id) {
|
||||
var self = this;
|
||||
|
||||
self.set_el($el);
|
||||
self.type = type;
|
||||
self.name = name;
|
||||
self.id = id;
|
||||
|
||||
self.bind(self.el, 'click', self.click);
|
||||
self.bind(self.el, 'dblclick', self.dblclick);
|
||||
},
|
||||
|
||||
set_el: function($el) {
|
||||
var self = this;
|
||||
|
||||
self.el = $el;
|
||||
|
||||
// From a > .front-ed > content
|
||||
// To .front-ed > a > content
|
||||
var $parent = self.el.parents('a');
|
||||
|
||||
if ( ! $parent.length )
|
||||
return;
|
||||
|
||||
var $link = $parent.clone(true)
|
||||
.html(self.el.html());
|
||||
|
||||
var $wrap = self.el.clone(true)
|
||||
.html($link);
|
||||
|
||||
$parent.replaceWith($wrap);
|
||||
|
||||
self.el = $wrap;
|
||||
self.switched = true;
|
||||
},
|
||||
|
||||
click: function(ev) {
|
||||
// if ( typeof FrontEndEditor._to_click != 'undefined' )
|
||||
// return;
|
||||
|
||||
var $el = $(ev.target).closest('a');
|
||||
|
||||
if ( ! $el.length )
|
||||
return;
|
||||
|
||||
if ( is_overlay($el) )
|
||||
return;
|
||||
|
||||
ev.stopImmediatePropagation();
|
||||
ev.preventDefault();
|
||||
|
||||
FrontEndEditor._to_click = $el;
|
||||
|
||||
setTimeout(resume, 300);
|
||||
},
|
||||
|
||||
dblclick: function(ev) {
|
||||
var self = this;
|
||||
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
|
||||
FrontEndEditor._trap = true;
|
||||
},
|
||||
|
||||
get_content: null /* function() */,
|
||||
set_content: null /* function(content) */,
|
||||
|
||||
ajax_get_handler: null /* function(content) */,
|
||||
ajax_set_handler: null /* function(content) */,
|
||||
|
||||
ajax_get: function() {
|
||||
var self = this;
|
||||
|
||||
var data = {
|
||||
'nonce': FrontEndEditor.data.nonce,
|
||||
'action': 'front-editor',
|
||||
'callback': 'get',
|
||||
'name': self.name,
|
||||
'type': self.type,
|
||||
'item_id': self.id
|
||||
};
|
||||
|
||||
$.post(FrontEndEditor.data.ajax_url, data, function(response){
|
||||
self.ajax_get_handler(response);
|
||||
});
|
||||
},
|
||||
|
||||
ajax_set: function(content) {
|
||||
var self = this;
|
||||
|
||||
content = content || self.get_content();
|
||||
|
||||
var data = {
|
||||
'nonce': FrontEndEditor.data.nonce,
|
||||
'action': 'front-editor',
|
||||
'callback': 'save',
|
||||
'name': self.name,
|
||||
'type': self.type,
|
||||
'item_id': self.id,
|
||||
'content': content
|
||||
};
|
||||
|
||||
$.post(FrontEndEditor.data.ajax_url, data, function(response){
|
||||
self.ajax_set_handler(response);
|
||||
});
|
||||
},
|
||||
|
||||
// Event utility: this = self
|
||||
bind: function(element, event, callback) {
|
||||
var self = this;
|
||||
|
||||
element.bind(event, function(ev) {
|
||||
callback.call(self, ev);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
fieldTypes['image'] = fieldTypes['base'].extend({
|
||||
|
||||
dblclick: function(ev) {
|
||||
var self = this;
|
||||
|
||||
self._super(ev);
|
||||
|
||||
self.open_box();
|
||||
},
|
||||
|
||||
open_box: function() {
|
||||
var self = this;
|
||||
|
||||
tb_show(FrontEndEditor.data.image.change, FrontEndEditor.data.admin_url +
|
||||
'/media-upload.php?post_id=0&type=image&TB_iframe=true&width=640&editable_image=1');
|
||||
|
||||
var $revert = $('<a id="fee-img-revert" href="#">').text(FrontEndEditor.data.image.revert);
|
||||
|
||||
$revert.click(function(ev){
|
||||
self.ajax_set(-1);
|
||||
});
|
||||
|
||||
$('#TB_ajaxWindowTitle').after($revert);
|
||||
$('#TB_closeWindowButton img').attr('src', FrontEndEditor.data.image.tb_close);
|
||||
|
||||
self.bind($('#TB_iframeContent'), 'load', self.replace_button);
|
||||
},
|
||||
|
||||
replace_button: function(ev) {
|
||||
var self = this;
|
||||
|
||||
var $frame = $(ev.target).contents();
|
||||
|
||||
$('.media-item', $frame).livequery(function(){
|
||||
var $item = $(this);
|
||||
var $button = $('<a href="#" class="button">').text(FrontEndEditor.data.image.change);
|
||||
|
||||
$button.click(function(ev){
|
||||
self.ajax_set(self.get_content($item));
|
||||
});
|
||||
|
||||
$(this).find(':submit, #go_button').replaceWith($button);
|
||||
});
|
||||
},
|
||||
|
||||
get_content: function($item) {
|
||||
var $field;
|
||||
|
||||
// Media library
|
||||
$field = $item.find('.urlfile');
|
||||
if ( $field.length )
|
||||
return $field.attr('title');
|
||||
|
||||
// From URL (embed)
|
||||
$field = $item.find('#embed-src');
|
||||
if ( $field.length )
|
||||
return $field.val();
|
||||
|
||||
// From URL
|
||||
$field = $item.find('#src');
|
||||
if ( $field.length )
|
||||
return $field.val();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
ajax_set_handler: function(url) {
|
||||
var self = this;
|
||||
|
||||
if ( url == -1 ) {
|
||||
window.location.reload(true);
|
||||
} else {
|
||||
self.el.find('img').attr('src', url);
|
||||
tb_remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
fieldTypes['thumbnail'] = fieldTypes['image'].extend({
|
||||
|
||||
replace_button: function(ev) {
|
||||
var self = this;
|
||||
|
||||
var $frame = $(ev.target).contents();
|
||||
|
||||
$frame.find('#tab-type_url').remove();
|
||||
|
||||
self._super(ev);
|
||||
},
|
||||
|
||||
get_content: function($item) {
|
||||
return $item.attr('id').replace('media-item-', '');
|
||||
}
|
||||
});
|
||||
|
||||
fieldTypes['input'] = fieldTypes['base'].extend({
|
||||
|
||||
init: function($el, type, name, id) {
|
||||
var self = this;
|
||||
|
||||
self.spinner = spinner.clone();
|
||||
|
||||
self._super($el, type, name, id);
|
||||
},
|
||||
|
||||
input_tag: '<input type="text">',
|
||||
|
||||
create_input: function() {
|
||||
var self = this;
|
||||
|
||||
self.input = $(self.input_tag);
|
||||
|
||||
self.input.attr({
|
||||
'id': 'edit_' + self.el.attr('id'),
|
||||
'class': 'fee-form-content'
|
||||
}).prependTo(self.form);
|
||||
},
|
||||
|
||||
set_input: function(content) {
|
||||
var self = this;
|
||||
|
||||
self.input.val(content);
|
||||
},
|
||||
|
||||
get_content: function() {
|
||||
var self = this;
|
||||
return self.input.val();
|
||||
},
|
||||
|
||||
set_content: function(content) {
|
||||
var self = this;
|
||||
|
||||
if ( self.switched )
|
||||
self.el.find('a').html(content);
|
||||
else
|
||||
self.el.html(content);
|
||||
},
|
||||
|
||||
ajax_get: function() {
|
||||
var self = this;
|
||||
|
||||
self.el.hide().after(self.spinner.show());
|
||||
|
||||
self.create_input();
|
||||
|
||||
self._super();
|
||||
},
|
||||
|
||||
ajax_set: function() {
|
||||
var self = this;
|
||||
|
||||
self.el.before(self.spinner.show());
|
||||
|
||||
self._super();
|
||||
},
|
||||
|
||||
ajax_get_handler: function(content) {
|
||||
var self = this;
|
||||
|
||||
self.spinner.hide().replaceWith(self.form);
|
||||
|
||||
self.set_input(content);
|
||||
|
||||
self.input.focus();
|
||||
},
|
||||
|
||||
ajax_set_handler: function(content) {
|
||||
var self = this;
|
||||
|
||||
self.set_content(content);
|
||||
|
||||
self.spinner.hide();
|
||||
self.el.show();
|
||||
},
|
||||
|
||||
dblclick: function(ev) {
|
||||
var self = this;
|
||||
|
||||
self._super(ev);
|
||||
|
||||
self.form_handler();
|
||||
},
|
||||
|
||||
form_handler: function() {
|
||||
var self = this;
|
||||
|
||||
// Button actions
|
||||
var form_remove = function(with_spinner) {
|
||||
FrontEndEditor._trap = false;
|
||||
|
||||
self.form.remove();
|
||||
|
||||
if ( with_spinner === true )
|
||||
self.el.before(self.spinner.show());
|
||||
else
|
||||
self.el.show();
|
||||
|
||||
self.el.trigger('fee_remove_form');
|
||||
};
|
||||
|
||||
var form_submit = function() {
|
||||
self.ajax_set();
|
||||
form_remove(true);
|
||||
};
|
||||
|
||||
// Button markup
|
||||
self.save_button = $('<button>').addClass('fee-form-save').text(FrontEndEditor.data.save_text).click(form_submit);
|
||||
self.cancel_button = $('<button>').addClass('fee-form-cancel').text(FrontEndEditor.data.cancel_text).click(form_remove);
|
||||
|
||||
// Create form
|
||||
var inline = self.type == 'input' || self.type == 'terminput';
|
||||
|
||||
self.form = inline ? $('<span>') : $('<div>');
|
||||
|
||||
self.form
|
||||
.addClass('fee-form')
|
||||
.addClass('fee-type-' + self.type)
|
||||
.addClass('fee-filter-' + self.name)
|
||||
.append(self.save_button)
|
||||
.append(self.cancel_button);
|
||||
|
||||
self.bind(self.form, 'keypress', self.keypress);
|
||||
|
||||
self.ajax_get();
|
||||
},
|
||||
|
||||
keypress: function(ev) {
|
||||
var self = this;
|
||||
|
||||
var keys = {ENTER: 13, ESCAPE: 27};
|
||||
var code = (ev.keyCode || ev.which || ev.charCode || 0);
|
||||
|
||||
if ( code == keys.ENTER && self.type == 'input' )
|
||||
self.save_button.click();
|
||||
|
||||
if ( code == keys.ESCAPE )
|
||||
self.cancel_button.click();
|
||||
}
|
||||
});
|
||||
|
||||
fieldTypes['terminput'] = fieldTypes['input'].extend({
|
||||
|
||||
set_input: function(content) {
|
||||
var self = this;
|
||||
|
||||
self._super(content);
|
||||
|
||||
self.input.suggest(FrontEndEditor.data.ajax_url + '?action=ajax-tag-search&tax=' + self.id.split('#')[1], {
|
||||
multiple: true,
|
||||
resultsClass: 'fee-suggest-results',
|
||||
selectClass: 'fee-suggest-over',
|
||||
matchClass: 'fee-suggest-match'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
fieldTypes['textarea'] = fieldTypes['input'].extend({
|
||||
input_tag: '<textarea rows="10">'
|
||||
});
|
||||
|
||||
fieldTypes['rich'] = fieldTypes['textarea'].extend({
|
||||
|
||||
set_input: function(content) {
|
||||
var self = this;
|
||||
|
||||
self._super(content);
|
||||
|
||||
self.editor = new nicEditor(FrontEndEditor.data.nicedit).panelInstance(self.input.attr('id'));
|
||||
|
||||
self.form.find('.nicEdit-main').focus();
|
||||
},
|
||||
|
||||
get_content: function() {
|
||||
var self = this;
|
||||
return self.pre_wpautop(self.input.val());
|
||||
},
|
||||
|
||||
// Copied from wp-admin/js/editor.dev.js
|
||||
pre_wpautop: function(content) {
|
||||
var blocklist1, blocklist2;
|
||||
|
||||
// Protect pre|script tags
|
||||
content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
|
||||
a = a.replace(/<br ?\/?>[\r\n]*/g, '<wp_temp>');
|
||||
return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '<wp_temp>');
|
||||
});
|
||||
|
||||
// Pretty it up for the source editor
|
||||
blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset';
|
||||
content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'g'), '</$1>\n');
|
||||
content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'g'), '\n<$1>');
|
||||
|
||||
// Mark </p> if it has any attributes.
|
||||
content = content.replace(/(<p [^>]+>.*?)<\/p>/g, '$1</p#>');
|
||||
|
||||
// Sepatate <div> containing <p>
|
||||
content = content.replace(/<div([^>]*)>\s*<p>/gi, '<div$1>\n\n');
|
||||
|
||||
// Remove <p> and <br />
|
||||
content = content.replace(/\s*<p>/gi, '');
|
||||
content = content.replace(/\s*<\/p>\s*/gi, '\n\n');
|
||||
content = content.replace(/\n[\s\u00a0]+\n/g, '\n\n');
|
||||
content = content.replace(/\s*<br ?\/?>\s*/gi, '\n');
|
||||
|
||||
// Fix some block element newline issues
|
||||
content = content.replace(/\s*<div/g, '\n<div');
|
||||
content = content.replace(/<\/div>\s*/g, '</div>\n');
|
||||
content = content.replace(/\s*\[caption([^\[]+)\[\/caption\]\s*/gi, '\n\n[caption$1[/caption]\n\n');
|
||||
content = content.replace(/caption\]\n\n+\[caption/g, 'caption]\n\n[caption');
|
||||
|
||||
blocklist2 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset';
|
||||
content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'g'), '\n<$1>');
|
||||
content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'g'), '</$1>\n');
|
||||
content = content.replace(/<li([^>]*)>/g, '\t<li$1>');
|
||||
|
||||
if ( content.indexOf('<object') != -1 ) {
|
||||
content = content.replace(/<object[\s\S]+?<\/object>/g, function(a){
|
||||
return a.replace(/[\r\n]+/g, '');
|
||||
});
|
||||
}
|
||||
|
||||
// Unmark special paragraph closing tags
|
||||
content = content.replace(/<\/p#>/g, '</p>\n');
|
||||
content = content.replace(/\s*(<p [^>]+>[\s\S]*?<\/p>)/g, '\n$1');
|
||||
|
||||
// Trim whitespace
|
||||
content = content.replace(/^\s+/, '');
|
||||
content = content.replace(/[\s\u00a0]+$/, '');
|
||||
|
||||
// put back the line breaks in pre|script
|
||||
content = content.replace(/<wp_temp>/g, '\n');
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
ajax_set: function() {
|
||||
var self = this;
|
||||
|
||||
self.editor.nicInstances[0].saveContent();
|
||||
|
||||
self._super();
|
||||
}
|
||||
});
|
||||
|
||||
// export
|
||||
FrontEndEditor.fieldTypes = fieldTypes;
|
||||
|
||||
$(document).ready(function($) {
|
||||
// Widget fields hack: Add data-fee attr to each element
|
||||
$('.fee-filter-widget_title, .fee-filter-widget_text').each(function() {
|
||||
var $el = $(this);
|
||||
var id = $el.parents('.widget').attr('id');
|
||||
|
||||
if ( id )
|
||||
$el.attr('data-fee', id);
|
||||
else
|
||||
// undo wrap; can't find widget id
|
||||
$el.replaceWith($el.html());
|
||||
});
|
||||
|
||||
// Create field instances
|
||||
$.each(FrontEndEditor.data.fields, function(name, type) {
|
||||
$('.fee-filter-' + name).each(function() {
|
||||
var $el = $(this);
|
||||
|
||||
var id = $el.attr('data-fee');
|
||||
|
||||
var parts = id.split('#');
|
||||
|
||||
switch (name) {
|
||||
case 'post_meta': type = parts[2]; break;
|
||||
case 'editable_option': type = parts[1]; break;
|
||||
}
|
||||
|
||||
new fieldTypes[type]($el, type, name, id);
|
||||
});
|
||||
});
|
||||
|
||||
// Tooltip init
|
||||
if ( FrontEndEditor.data.tooltip ) {
|
||||
$.fn.qtip.styles.fee = {
|
||||
height: 10,
|
||||
paddingTop: '4px',
|
||||
paddingRight: '5px',
|
||||
paddingBottom: '6px',
|
||||
paddingLeft: '25px',
|
||||
background: '#bbbebf url(' + FrontEndEditor.data.tooltip.icon + ') top left no-repeat',
|
||||
color: '#ffffff',
|
||||
textAlign: 'left',
|
||||
lineHeight: '100%',
|
||||
fontFamily: 'sans-serif',
|
||||
fontSize: '14px',
|
||||
opacity: '0.75',
|
||||
border: {
|
||||
width: 0,
|
||||
radius: 5,
|
||||
color: '#bbbebf'
|
||||
},
|
||||
tip: 'bottomLeft',
|
||||
name: 'dark'
|
||||
};
|
||||
|
||||
$('.fee-field').qtip({
|
||||
content: FrontEndEditor.data.tooltip.text,
|
||||
position: { corner: { target: 'topMiddle' }, adjust: { x: 0, y: -40 } },
|
||||
show: {
|
||||
effect: 'fade'
|
||||
},
|
||||
|
||||
style: {
|
||||
name: 'fee'
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
||||
|
Before Width: | Height: | Size: 790 B |
@@ -1,9 +0,0 @@
|
||||
/* Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
|
||||
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
||||
*
|
||||
* Version: 1.0.3
|
||||
* Requires jQuery 1.1.3+
|
||||
* Docs: http://docs.jquery.com/Plugins/livequery
|
||||
*/
|
||||
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type)){fn2=fn,fn=type,type=undefined}$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)){return(q=query)&&false}});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;q.run();return this},expire:function(type,fn,fn2){var self=this;if($.isFunction(type)){fn2=fn,fn=type,type=undefined}$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped){$.livequery.stop(query.id)}});return this}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2){fn2.$lqguid=fn2.$lqguid||$.livequery.guid++}return this};$.livequery.prototype={stop:function(){var query=this;if(this.type){this.elements.unbind(this.type,this.fn)}else{if(this.fn2){this.elements.each(function(i,el){query.fn2.apply(el)})}}this.elements=[];this.stopped=true},run:function(){if(this.stopped){return}var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0){$.each(oEls,function(i,el){if($.inArray(el,els)<0){$.event.remove(el,query.type,query.fn)}})}}else{nEls.each(function(){query.fn.apply(this)});if(this.fn2&&oEls.length>0){$.each(oEls,function(i,el){if($.inArray(el,els)<0){query.fn2.apply(el)}})}}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--){$.livequery.queries[$.livequery.queue.shift()].run()}}},pause:function(){$.livequery.running=false},play:function(){$.livequery.running=true;$.livequery.run()},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n]){return}var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r}})},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0){$.livequery.queue.push(id)}}else{$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0){$.livequery.queue.push(id)}})}if($.livequery.timeout){clearTimeout($.livequery.timeout)}$.livequery.timeout=setTimeout($.livequery.checkQueue,20)},stop:function(id){if(id!=undefined){$.livequery.queries[id].stop()}else{$.each($.livequery.queries,function(id){$.livequery.queries[id].stop()})}}});$.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove");$(function(){$.livequery.play()});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector){r.context=a.context,r.selector=a.selector}if(typeof a=="string"){r.context=c||document,r.selector=a}return r};$.prototype.init.prototype=$.prototype})(jQuery);
|
||||
|
Before Width: | Height: | Size: 3.5 KiB |
@@ -1,117 +0,0 @@
|
||||
<?php
|
||||
|
||||
// All field classes should extend from this one or one of it's descendants
|
||||
abstract class FEE_Field_Base {
|
||||
private $filter;
|
||||
private $input_type;
|
||||
|
||||
private static $wrapped = array();
|
||||
|
||||
/**
|
||||
* Constructor; nothing fancy
|
||||
* @return null
|
||||
*/
|
||||
final public function __construct($filter, $type) {
|
||||
$this->filter = $filter;
|
||||
$this->input_type = $type;
|
||||
|
||||
$this->setup();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The type of object this field operates with
|
||||
* @return string
|
||||
*/
|
||||
abstract public static function get_object_type();
|
||||
|
||||
/**
|
||||
* Optional actions to be done once per instance
|
||||
* @return null
|
||||
*/
|
||||
protected function setup() {}
|
||||
|
||||
/**
|
||||
* Mark the field as editable
|
||||
* @return string Wrapped content
|
||||
*/
|
||||
public function wrap($content, $object_id, $inline = false) {
|
||||
if ( ! $this->allow($object_id) )
|
||||
return $content;
|
||||
|
||||
self::$wrapped[$this->input_type] = true;
|
||||
|
||||
if ( is_null($content) )
|
||||
$content = '';
|
||||
|
||||
if ( ! is_scalar($content) )
|
||||
trigger_error("scalar expected. " . gettype($content) . " given", E_USER_WARNING);
|
||||
|
||||
$class = 'fee-field fee-filter-' . $this->filter;
|
||||
$object_id = esc_attr($object_id);
|
||||
|
||||
$wrap_tag = ( $inline || in_array($this->input_type, array('input', 'terminput', 'image')) ) ? 'span' : 'div';
|
||||
|
||||
return html("$wrap_tag class='{$class}' data-fee='{$object_id}'", $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the current data for the field
|
||||
* @return string Unfiltered content
|
||||
*/
|
||||
abstract public function get($object_id);
|
||||
|
||||
/**
|
||||
* Save the data retrieved from the field
|
||||
* @return string Saved content
|
||||
*/
|
||||
abstract public function save($object_id, $content);
|
||||
|
||||
/**
|
||||
* Check user permissions
|
||||
* @return bool
|
||||
*/
|
||||
abstract public function check($object_id = 0);
|
||||
|
||||
|
||||
/**
|
||||
* Generate a standard placeholder
|
||||
* @return string
|
||||
*/
|
||||
protected function placeholder() {
|
||||
return '[' . __('empty', 'front-end-editor') . ']';
|
||||
}
|
||||
|
||||
protected function placehold($content) {
|
||||
if ( empty($content) )
|
||||
$content = $this->placeholder();
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filter of the current instance
|
||||
* @return string
|
||||
*/
|
||||
final protected function get_filter() {
|
||||
return $this->filter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allow external code to block editing for certain objects
|
||||
* @return bool
|
||||
*/
|
||||
final public function allow($object_id) {
|
||||
return apply_filters('front_end_editor_allow_' . $this->get_object_type(), true, $object_id, $this->filter, $this->input_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of used input types
|
||||
* @return array
|
||||
*/
|
||||
final public static function get_wrapped() {
|
||||
return self::$wrapped;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,380 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Handles comment_text field
|
||||
class FEE_Field_Comment extends FEE_Field_Base {
|
||||
|
||||
static function get_object_type() {
|
||||
return 'comment';
|
||||
}
|
||||
|
||||
function wrap($content) {
|
||||
global $comment;
|
||||
|
||||
if ( ! $this->check($comment->comment_ID) )
|
||||
return $content;
|
||||
|
||||
return parent::wrap(wpautop($content), $comment->comment_ID);
|
||||
}
|
||||
|
||||
function get($comment_id) {
|
||||
$comment = get_comment($comment_id);
|
||||
return $comment->comment_content;
|
||||
}
|
||||
|
||||
function save($comment_id, $content) {
|
||||
wp_update_comment(array(
|
||||
'comment_ID' => $comment_id,
|
||||
'comment_content' => $content
|
||||
));
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function check($comment_id = 0) {
|
||||
if ( current_user_can('moderate_comments') )
|
||||
return true;
|
||||
|
||||
global $user_ID;
|
||||
|
||||
$comment = get_comment($comment_id);
|
||||
|
||||
return $user_ID == $comment->user_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Handles single_*_title fields
|
||||
class FEE_Field_Single_Title extends FEE_Field_Base {
|
||||
|
||||
static function get_object_type() {
|
||||
return 'term';
|
||||
}
|
||||
|
||||
private $taxonomy;
|
||||
|
||||
protected function setup() {
|
||||
remove_filter($this->get_filter(), 'strip_tags');
|
||||
|
||||
list($a, $tax, $b) = explode('_', $this->get_filter());
|
||||
|
||||
$translate = array(
|
||||
'cat' => 'category',
|
||||
'tag' => 'post_tag'
|
||||
);
|
||||
|
||||
$this->taxonomy = $translate[$tax];
|
||||
}
|
||||
|
||||
function wrap($title) {
|
||||
if ( ! $this->check() )
|
||||
return $title;
|
||||
|
||||
if ( ! $term = get_term_by('name', $title, $this->taxonomy) )
|
||||
return $title;
|
||||
|
||||
return parent::wrap($title, $term->term_id);
|
||||
}
|
||||
|
||||
function get($term_id) {
|
||||
return get_term_field('name', $term_id, $this->taxonomy, 'edit');
|
||||
}
|
||||
|
||||
function save($term_id, $title) {
|
||||
wp_update_term($term_id, $this->taxonomy, array('name' => $title));
|
||||
|
||||
return $title;
|
||||
}
|
||||
|
||||
function check($id = 0) {
|
||||
return current_user_can('manage_categories');
|
||||
}
|
||||
}
|
||||
|
||||
// Handles the_author_description field
|
||||
class FEE_Field_Author_Desc extends FEE_Field_Base {
|
||||
|
||||
static function get_object_type() {
|
||||
return 'user';
|
||||
}
|
||||
|
||||
function wrap($content, $author_id = '') {
|
||||
if ( ! $author_id )
|
||||
$author_id = $this->guess_author_id();
|
||||
|
||||
if ( ! $author_id )
|
||||
return $content;
|
||||
|
||||
if ( ! $this->check($author_id) )
|
||||
return $content;
|
||||
|
||||
$content = $this->placehold($content);
|
||||
|
||||
return parent::wrap($content, $author_id);
|
||||
}
|
||||
|
||||
// Retrieve the current data for the field
|
||||
function get($author_id) {
|
||||
return get_usermeta($author_id, 'description');
|
||||
}
|
||||
|
||||
function save($author_id, $content) {
|
||||
update_usermeta($author_id, 'description', $content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function check($author_id = 0) {
|
||||
if ( current_user_can('edit_users') )
|
||||
return true;
|
||||
|
||||
global $user_ID;
|
||||
|
||||
return $user_ID == $author_id;
|
||||
}
|
||||
|
||||
// WP < 2.9
|
||||
function guess_author_id() {
|
||||
if ( function_exists('get_the_author_meta') )
|
||||
return get_the_author_meta('id');
|
||||
|
||||
global $authordata;
|
||||
|
||||
return $authordata->ID;
|
||||
}
|
||||
}
|
||||
|
||||
// Handles widget_text and widget_title fields
|
||||
class FEE_Field_Widget extends FEE_Field_Base {
|
||||
|
||||
protected $field;
|
||||
|
||||
static function get_object_type() {
|
||||
return 'widget';
|
||||
}
|
||||
|
||||
protected function setup() {
|
||||
$this->field = str_replace('widget_', '', $this->get_filter());
|
||||
}
|
||||
|
||||
function wrap($content) {
|
||||
if ( ! $this->check() )
|
||||
return $content;
|
||||
|
||||
if ( 'text' == $this->field )
|
||||
$content = $this->placehold($content);
|
||||
|
||||
return parent::wrap($content, 0);
|
||||
}
|
||||
|
||||
function get($id) {
|
||||
return $this->do_('get', $id);
|
||||
}
|
||||
|
||||
function save($id, $content) {
|
||||
return $this->do_('save', $id, $content);
|
||||
}
|
||||
|
||||
private function do_($action, $id, $content = '') {
|
||||
list($widget_type, $widget_id) = explode('-', $id);
|
||||
|
||||
$widget_key = 'widget_' . $widget_type;
|
||||
$widgets = get_option($widget_key);
|
||||
$data =& $widgets[$widget_id][$this->field];
|
||||
|
||||
if ( 'get' == $action ) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
if ( 'save' == $action ) {
|
||||
$data = $content;
|
||||
|
||||
update_option($widget_key, $widgets);
|
||||
|
||||
if ( 'text' == $widget_type
|
||||
&& 'text' == $this->field
|
||||
&& $widgets[$widget_id]['filter'] )
|
||||
$content = wpautop($content);
|
||||
|
||||
if ( 'text' == $this->field )
|
||||
$content = $this->placehold($content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
function check($id = 0) {
|
||||
return current_user_can('edit_themes');
|
||||
}
|
||||
}
|
||||
|
||||
// Handles bloginfo fields
|
||||
class FEE_Field_Bloginfo extends FEE_Field_Base {
|
||||
|
||||
static function get_object_type() {
|
||||
return 'option';
|
||||
}
|
||||
|
||||
function wrap($content, $show) {
|
||||
if ( ! $this->check() )
|
||||
return $content;
|
||||
|
||||
if ( empty($show) && $content == get_option('blogname') )
|
||||
$show = 'name';
|
||||
|
||||
if ( $show != 'description' && $show != 'name' )
|
||||
return $content;
|
||||
|
||||
return parent::wrap($content, $show);
|
||||
}
|
||||
|
||||
function get($show) {
|
||||
return get_option('blog' . $show);
|
||||
}
|
||||
|
||||
function save($show, $content) {
|
||||
update_option('blog' . $show, $content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function check($key = 0) {
|
||||
return current_user_can('manage_options');
|
||||
}
|
||||
}
|
||||
|
||||
// Handles editable_option fields
|
||||
class FEE_Field_Option extends FEE_Field_Base {
|
||||
|
||||
static function init($file) {
|
||||
register_uninstall_hook($file, array(__CLASS__, 'uninstall'));
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'editable!_option!_%' ESCAPE '!'");
|
||||
}
|
||||
|
||||
static function get_object_type() {
|
||||
return 'option';
|
||||
}
|
||||
|
||||
function wrap($content, $key, $type) {
|
||||
if ( ! $this->check($key) )
|
||||
return $content;
|
||||
|
||||
$content = $this->placehold($content);
|
||||
|
||||
$id = implode('#', array($key, $type));
|
||||
|
||||
return parent::wrap($content, $id);
|
||||
}
|
||||
|
||||
function get($id) {
|
||||
list($key, $type) = explode('#', $id);
|
||||
|
||||
return get_option($key);
|
||||
}
|
||||
|
||||
function save($id, $content) {
|
||||
list($key, $type) = explode('#', $id);
|
||||
|
||||
update_option($key, $content);
|
||||
|
||||
$content = $this->placehold($content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function check($key = 0) {
|
||||
return current_user_can('manage_options');
|
||||
}
|
||||
}
|
||||
|
||||
function editable_option($key, $safety = true, $type = 'input', $echo = true) {
|
||||
if ( $safety )
|
||||
$key = "editable_option_$key";
|
||||
|
||||
$output = apply_filters('editable_option', get_option($key), $key, $type);
|
||||
|
||||
if ( $echo )
|
||||
echo $output;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Handles editable_image fields
|
||||
class FEE_Field_Image extends FEE_Field_Base {
|
||||
|
||||
static function init($file) {
|
||||
register_uninstall_hook($file, array(__CLASS__, 'uninstall'));
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'editable!_image!_%' ESCAPE '!'");
|
||||
}
|
||||
|
||||
static function get_object_type() {
|
||||
return 'option';
|
||||
}
|
||||
|
||||
function wrap($img, $key) {
|
||||
if ( ! $this->check() )
|
||||
return $img;
|
||||
|
||||
return parent::wrap($img, $key);
|
||||
}
|
||||
|
||||
function get($id) {
|
||||
return get_option(self::get_key($id));
|
||||
}
|
||||
|
||||
function save($id, $url) {
|
||||
if ( $url == -1 )
|
||||
delete_option(self::get_key($id));
|
||||
else
|
||||
update_option(self::get_key($id), $url);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
function check($id = 0) {
|
||||
return current_user_can('edit_themes');
|
||||
}
|
||||
|
||||
private static function get_key($key) {
|
||||
return 'editable_image_' . trim(strip_tags($key));
|
||||
}
|
||||
}
|
||||
|
||||
function editable_image($key, $default_url, $extra_attr = '', $echo = true) {
|
||||
$attr = wp_parse_args($extra_attr, array(
|
||||
'id' => $key
|
||||
));
|
||||
|
||||
if ( ! $src = FEE_Field_Image::get($key) )
|
||||
$src = $default_url;
|
||||
$attr['src'] = $src;
|
||||
|
||||
$attr_str = '';
|
||||
foreach ( $attr as $a_key => $a_value ) {
|
||||
$a_key = trim(strip_tags($a_key));
|
||||
$a_value = trim(esc_attr($a_value));
|
||||
|
||||
if ( empty($a_key) )
|
||||
continue;
|
||||
|
||||
$attr_str .= " $a_key='$a_value'";
|
||||
}
|
||||
|
||||
$attr_str = ltrim($attr_str);
|
||||
|
||||
$img = apply_filters('editable_image', "<img $attr_str />", $key, $default_url);
|
||||
|
||||
if ( $echo )
|
||||
echo $img;
|
||||
|
||||
return $img;
|
||||
}
|
||||
|
||||
@@ -1,369 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Handles the_title and the_content fields
|
||||
class FEE_Field_Post extends FEE_Field_Base {
|
||||
|
||||
protected $field;
|
||||
|
||||
protected function setup() {
|
||||
$this->field = str_replace('the_', 'post_', $this->get_filter());
|
||||
}
|
||||
|
||||
static function get_object_type() {
|
||||
return 'post';
|
||||
}
|
||||
|
||||
function wrap($content, $post_id = 0) {
|
||||
if ( ! $post_id = $this->_get_id($post_id) )
|
||||
return $content;
|
||||
|
||||
return parent::wrap($content, $post_id);
|
||||
}
|
||||
|
||||
protected function _get_id($post_id = 0, $in_loop = true ) {
|
||||
if ( $in_loop && !in_the_loop() )
|
||||
return false;
|
||||
|
||||
if ( ! $post_id )
|
||||
$post_id = get_the_ID();
|
||||
|
||||
if ( ! $post_id || ! $this->check($post_id) )
|
||||
return false;
|
||||
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
function get($post_id) {
|
||||
return get_post_field($this->field, $post_id);
|
||||
}
|
||||
|
||||
function save($post_id, $content) {
|
||||
$postdata = array(
|
||||
'ID' => $post_id,
|
||||
$this->field => $content
|
||||
);
|
||||
|
||||
if ( FEE_Core::$options->reset_date ) {
|
||||
$postdata['post_date'] = current_time('mysql');
|
||||
$postdata['post_date_gmt'] = current_time('mysql', 1);
|
||||
}
|
||||
|
||||
// reset slug
|
||||
if ( $this->field == 'post_title' ) {
|
||||
$current_slug = get_post_field('post_name', $post_id);
|
||||
$current_title = get_post_field('post_title', $post_id);
|
||||
|
||||
// update only if not explicitly set
|
||||
if ( empty($current_slug) || $current_slug == sanitize_title_with_dashes($current_title) ) {
|
||||
$new_slug = sanitize_title_with_dashes($content);
|
||||
$postdata['post_name'] = $new_slug;
|
||||
}
|
||||
}
|
||||
|
||||
wp_update_post((object) $postdata);
|
||||
|
||||
$this->set_post_global($post_id);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function check($post_id = 0) {
|
||||
return current_user_can('edit_' . get_post_type($post_id), $post_id);
|
||||
}
|
||||
|
||||
protected function set_post_global($post_id) {
|
||||
$GLOBALS['post'] = get_post($post_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Handles <p> tags in the_content
|
||||
class FEE_Field_Chunks extends FEE_Field_Post {
|
||||
|
||||
const delim = "\n\n";
|
||||
|
||||
function wrap($content, $post_id = 0) {
|
||||
if ( ! $post_id = $this->_get_id($post_id) )
|
||||
return $content;
|
||||
|
||||
$chunks = $this->split($content);
|
||||
|
||||
foreach ( $chunks as $i => $chunk )
|
||||
$content = str_replace($chunk, FEE_Field_Base::wrap($chunk, "$post_id#$i", true), $content);
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
function get($post_id) {
|
||||
list($post_id, $chunk_id) = explode('#', $post_id);
|
||||
|
||||
$field = get_post_field('post_content', $post_id);
|
||||
|
||||
$chunks = $this->split($field, true);
|
||||
|
||||
return @$chunks[$chunk_id];
|
||||
}
|
||||
|
||||
function save($post_id, $chunk_content) {
|
||||
list($post_id, $chunk_id) = explode('#', $post_id);
|
||||
|
||||
$content = get_post_field('post_content', $post_id);
|
||||
|
||||
$chunks = $this->split($content, true);
|
||||
|
||||
$chunk_content = trim($chunk_content);
|
||||
|
||||
$content = str_replace($chunks[$chunk_id], $chunk_content, $content);
|
||||
|
||||
$postdata = array(
|
||||
'ID' => $post_id,
|
||||
'post_content' => $content
|
||||
);
|
||||
|
||||
wp_update_post((object) $postdata);
|
||||
|
||||
$this->set_post_global($post_id);
|
||||
|
||||
// Refresh the page if a new chunk is added
|
||||
if ( empty($chunk_content) || FALSE !== strpos($chunk_content, self::delim) )
|
||||
$this->force_refresh();
|
||||
|
||||
die($chunk_content);
|
||||
}
|
||||
|
||||
// Split content into chunks
|
||||
protected function split($content, $autop = false) {
|
||||
if ( $autop )
|
||||
$content = wpautop($content);
|
||||
|
||||
preg_match_all("#<p>(.*?)</p>#", $content, $matches);
|
||||
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
protected function force_refresh() {
|
||||
die("<script language='javascript'>location.reload(true)</script>");
|
||||
}
|
||||
}
|
||||
|
||||
// Handles the_excerpt field
|
||||
class FEE_Field_Excerpt extends FEE_Field_Post {
|
||||
|
||||
function get($post_id) {
|
||||
$post = get_post($post_id);
|
||||
|
||||
$excerpt = $post->post_excerpt;
|
||||
|
||||
if ( empty($excerpt) ) {
|
||||
$this->set_post_global($post_id);
|
||||
$excerpt = $this->trim_excerpt($post->post_content);
|
||||
}
|
||||
|
||||
return $excerpt;
|
||||
}
|
||||
|
||||
function save($post_id, $excerpt) {
|
||||
$default_excerpt = $this->get($post_id);
|
||||
|
||||
if ( $excerpt == $default_excerpt )
|
||||
return $excerpt;
|
||||
|
||||
$postdata = array(
|
||||
'ID' => $post_id,
|
||||
'post_excerpt' => $excerpt
|
||||
);
|
||||
|
||||
wp_update_post((object) $postdata);
|
||||
|
||||
$this->set_post_global($post_id);
|
||||
|
||||
if ( empty($excerpt) )
|
||||
return $default_excerpt;
|
||||
|
||||
return $excerpt;
|
||||
}
|
||||
|
||||
// Copy-paste from wp_trim_excerpt()
|
||||
private function trim_excerpt($text) {
|
||||
$text = apply_filters('the_content', $text);
|
||||
$text = str_replace(']]>', ']]>', $text);
|
||||
$text = strip_tags($text);
|
||||
$excerpt_length = apply_filters('excerpt_length', 55);
|
||||
$words = explode(' ', $text, $excerpt_length + 1);
|
||||
if (count($words) > $excerpt_length) {
|
||||
array_pop($words);
|
||||
array_push($words, '[...]');
|
||||
$text = implode(' ', $words);
|
||||
}
|
||||
|
||||
return apply_filters('get_the_excerpt', $text);
|
||||
}
|
||||
}
|
||||
|
||||
// Handles the_terms field
|
||||
class FEE_Field_Terms extends FEE_Field_Post {
|
||||
|
||||
function wrap($content, $taxonomy, $before, $sep, $after) {
|
||||
if ( ! $post_id = $this->_get_id() )
|
||||
return $content;
|
||||
|
||||
$content = $this->placehold(str_replace(array($before, $after), '', $content));
|
||||
|
||||
$id = implode('#', array($post_id, $taxonomy));
|
||||
|
||||
return $before . FEE_Field_Base::wrap($content, $id) . $after;
|
||||
}
|
||||
|
||||
function get($id) {
|
||||
list($post_id, $taxonomy) = explode('#', $id);
|
||||
|
||||
$tags = get_terms_to_edit($post_id, $taxonomy);
|
||||
$tags = str_replace(',', ', ', $tags);
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
function save($id, $terms) {
|
||||
list($post_id, $taxonomy) = explode('#', $id);
|
||||
|
||||
wp_set_post_terms($post_id, $terms, $taxonomy);
|
||||
|
||||
$response = get_the_term_list($post_id, $taxonomy, '', ', '); // todo: store $sep somehow
|
||||
|
||||
return $this->placehold($response);
|
||||
}
|
||||
}
|
||||
|
||||
// Handles the_tags field
|
||||
class FEE_Field_Tags extends FEE_Field_Terms {
|
||||
|
||||
function wrap($content, $before, $sep, $after) {
|
||||
return parent::wrap($content, 'post_tag', $before, $sep, $after);
|
||||
}
|
||||
}
|
||||
|
||||
// Handles the_category field
|
||||
class FEE_Field_Category extends FEE_Field_Terms {
|
||||
|
||||
function wrap($content, $sep, $parents) {
|
||||
return parent::wrap($content, 'category', '', $sep, '');
|
||||
}
|
||||
|
||||
function save($id, $categories) {
|
||||
list($post_id, $taxonomy) = explode('#', $id);
|
||||
|
||||
$cat_ids = array();
|
||||
foreach ( explode(',', $categories) as $cat_name ) {
|
||||
if ( ! $cat = get_cat_ID(trim($cat_name)) ) {
|
||||
$args = wp_insert_term($cat_name, $taxonomy);
|
||||
|
||||
if ( is_wp_error($args) )
|
||||
continue;
|
||||
|
||||
$cat = $args['term_id'];
|
||||
}
|
||||
|
||||
$cat_ids[] = $cat;
|
||||
}
|
||||
|
||||
wp_set_post_categories($post_id, $cat_ids);
|
||||
|
||||
$response = get_the_term_list($post_id, $taxonomy, '', ', ');
|
||||
|
||||
return $this->placehold($response);
|
||||
}
|
||||
}
|
||||
|
||||
// Handles the post thumbnail
|
||||
class FEE_Field_Thumbnail extends FEE_Field_Post {
|
||||
|
||||
function wrap($html, $post_id, $post_thumbnail_id, $size) {
|
||||
if ( ! $post_id = $this->_get_id($post_id, false) )
|
||||
return $content;
|
||||
|
||||
$id = implode('#', array($post_id, $size));
|
||||
|
||||
return FEE_Field_Base::wrap($html, $id);
|
||||
}
|
||||
|
||||
function get($id) {
|
||||
list($post_id, $size) = explode('#', $id);
|
||||
|
||||
return get_post_thumbnail_id($post_id);
|
||||
}
|
||||
|
||||
function save($id, $thumbnail_id) {
|
||||
list($post_id, $size) = explode('#', $id);
|
||||
|
||||
if ( -1 == $thumbnail_id ) {
|
||||
delete_post_meta($post_id, '_thumbnail_id');
|
||||
return -1;
|
||||
}
|
||||
|
||||
update_post_meta($post_id, '_thumbnail_id', $thumbnail_id);
|
||||
|
||||
list($url) = image_downsize($thumbnail_id, $size);
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
// Handles post_meta field
|
||||
class FEE_Field_Meta extends FEE_Field_Post {
|
||||
|
||||
function wrap($data, $post_id, $key, $type, $single) {
|
||||
if ( $this->check($post_id) ) {
|
||||
if ( $single )
|
||||
$data = array($this->placehold($data));
|
||||
|
||||
$r = array();
|
||||
foreach ( $data as $i => $val ) {
|
||||
$id = implode('#', array($post_id, $key, $type, $i));
|
||||
$r[$i] = FEE_Field_Base::wrap($val, $id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$r = (array) $data;
|
||||
}
|
||||
|
||||
if ( $single )
|
||||
return $r[0];
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
function get($id) {
|
||||
list($post_id, $key, $type, $i) = explode('#', $id);
|
||||
|
||||
$data = get_post_meta($post_id, $key);
|
||||
|
||||
return @$data[$i];
|
||||
}
|
||||
|
||||
function save($id, $new_value) {
|
||||
list($post_id, $key, $type, $i) = explode('#', $id);
|
||||
|
||||
$data = get_post_meta($post_id, $key);
|
||||
|
||||
$old_value = @$data[$i];
|
||||
|
||||
update_post_meta($post_id, $key, $new_value, $old_value);
|
||||
|
||||
return $new_value;
|
||||
}
|
||||
}
|
||||
|
||||
function editable_post_meta($post_id, $key, $type = 'input', $echo = true) {
|
||||
$data = get_editable_post_meta($post_id, $key, $type, true);
|
||||
|
||||
if ( ! $echo )
|
||||
return $data;
|
||||
|
||||
echo $data;
|
||||
}
|
||||
|
||||
function get_editable_post_meta($post_id, $key, $type = 'input', $single = false) {
|
||||
$data = get_post_meta($post_id, $key, $single);
|
||||
|
||||
return apply_filters('post_meta', $data, $post_id, $key, $type, $single);
|
||||
}
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Front-end Editor
|
||||
Version: 1.8
|
||||
Description: Allows you to edit your posts without going through the admin interface
|
||||
Author: scribu
|
||||
Author URI: http://scribu.net/
|
||||
Plugin URI: http://scribu.net/wordpress/front-end-editor
|
||||
Text Domain: front-end-editor
|
||||
Domain Path: /lang
|
||||
|
||||
Copyright (C) 2010 scribu.net (scribu@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Load scbFramework
|
||||
require dirname(__FILE__) . '/scb/load.php';
|
||||
|
||||
function _fee_init() {
|
||||
$dir = dirname(__FILE__);
|
||||
|
||||
// Load translations
|
||||
load_plugin_textdomain('front-end-editor', '', basename($dir) . '/lang');
|
||||
|
||||
// Load files
|
||||
require_once $dir . '/core.php';
|
||||
|
||||
foreach ( array('base', 'post', 'other') as $name )
|
||||
require_once "$dir/fields/$name.php";
|
||||
|
||||
// Load options
|
||||
$options = new scbOptions('front-end-editor', __FILE__, array(
|
||||
'disabled' => array(),
|
||||
'highlight' => true,
|
||||
'tooltip' => true,
|
||||
'rich' => true,
|
||||
'chunks' => false,
|
||||
'reset_date' => false
|
||||
));
|
||||
|
||||
FEE_Core::init($options, '1.8');
|
||||
FEE_Field_Image::init(__FILE__);
|
||||
|
||||
if ( is_admin() ) {
|
||||
require_once $dir . '/admin.php';
|
||||
scbAdminPage::register('Fee_Admin', __FILE__, $options);
|
||||
}
|
||||
}
|
||||
_fee_init();
|
||||
|
||||
function fee_register_defaults() {
|
||||
$fields = array(
|
||||
'the_title' => array(
|
||||
'title' => __('Post title', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Post',
|
||||
'type' => 'input',
|
||||
),
|
||||
|
||||
'the_content' => array(
|
||||
'title' => __('Post content', 'front-end-editor'),
|
||||
'class' => FEE_Core::$options->chunks ? 'FEE_Field_Chunks' : 'FEE_Field_Post',
|
||||
'type' => FEE_Core::$options->rich ? 'rich' : 'textarea',
|
||||
),
|
||||
|
||||
'the_excerpt' => array(
|
||||
'title' => __('Post excerpt', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Excerpt',
|
||||
'type' => 'textarea',
|
||||
),
|
||||
|
||||
'the_category' => array(
|
||||
'title' => __('Post categories', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Category',
|
||||
'argc' => 3,
|
||||
'type' => 'terminput',
|
||||
),
|
||||
|
||||
'the_tags' => array(
|
||||
'title' => __('Post tags', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Tags',
|
||||
'argc' => 4,
|
||||
'type' => 'terminput',
|
||||
),
|
||||
|
||||
'the_terms' => array(
|
||||
'title' => __('Post terms', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Terms',
|
||||
'argc' => 5,
|
||||
'type' => 'terminput',
|
||||
),
|
||||
|
||||
'post_meta' => array(
|
||||
'title' => __('Post custom fields', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Meta',
|
||||
'argc' => 5,
|
||||
),
|
||||
|
||||
'post_thumbnail_html' => array(
|
||||
'title' => __('Post thumbnail', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Thumbnail',
|
||||
'argc' => 4,
|
||||
'type' => 'thumbnail',
|
||||
),
|
||||
|
||||
'comment_text' => array(
|
||||
'title' => __('Comment text', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Comment',
|
||||
'type' => 'textarea',
|
||||
),
|
||||
|
||||
'single_cat_title' => array(
|
||||
'title' => __('Category title', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Single_Title',
|
||||
),
|
||||
|
||||
'single_tag_title' => array(
|
||||
'title' => __('Tag title', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Single_Title',
|
||||
),
|
||||
|
||||
'the_author_description' => array(
|
||||
'title' => __('Author description', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Author_Desc',
|
||||
'type' => 'textarea',
|
||||
'argc' => 2,
|
||||
),
|
||||
|
||||
'widget_title' => array(
|
||||
'title' => __('Widget title', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Widget',
|
||||
),
|
||||
|
||||
'widget_text' => array(
|
||||
'title' => __('Text widget content', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Widget',
|
||||
'type' => FEE_Core::$options->rich ? 'rich' : 'textarea',
|
||||
),
|
||||
|
||||
'bloginfo' => array(
|
||||
'title' => __('Site title and description', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Bloginfo',
|
||||
'argc' => 2,
|
||||
),
|
||||
|
||||
'editable_option' => array(
|
||||
'title' => __('Site options', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Option',
|
||||
'argc' => 3,
|
||||
),
|
||||
|
||||
'editable_image' => array(
|
||||
'title' => __('Theme images', 'front-end-editor'),
|
||||
'class' => 'FEE_Field_Image',
|
||||
'type' => 'image',
|
||||
'argc' => 2,
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( $fields as $filter => $args )
|
||||
register_fronted_field($filter, $args);
|
||||
|
||||
// Safe hook for new editable fields to be registered
|
||||
do_action('front_end_editor_fields');
|
||||
}
|
||||
add_action('init', 'fee_register_defaults');
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
"Project-Id-Version: Clean Options\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-08-15 15:41+0300\n"
|
||||
"PO-Revision-Date: 2009-08-17 02:11+0300\n"
|
||||
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
||||
"Language-Team: Fat Cow <zhr@tut.by>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Belarusian\n"
|
||||
"X-Poedit-Country: BELARUS\n"
|
||||
"X-Poedit-KeywordsList: __\n"
|
||||
"X-Poedit-Basepath: .\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
"X-Poedit-SearchPath-0: ..\n"
|
||||
|
||||
#: admin.php:10
|
||||
msgid "Fields"
|
||||
msgstr "Палі"
|
||||
|
||||
#: admin.php:11
|
||||
#: scb/AdminPage.php:275
|
||||
msgid "Settings"
|
||||
msgstr "Налады"
|
||||
|
||||
#: admin.php:41
|
||||
#: admin.php:85
|
||||
#: scb/AdminPage.php:107
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Налады <strong>захаваны</strong>."
|
||||
|
||||
#: admin.php:47
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Уключыць ці адключыць рэдагуемыя палі"
|
||||
|
||||
#: admin.php:53
|
||||
msgid "Field name"
|
||||
msgstr "Імя поля"
|
||||
|
||||
#: admin.php:74
|
||||
#: admin.php:106
|
||||
msgid "Save changes"
|
||||
msgstr "Захаваць налады"
|
||||
|
||||
#: admin.php:92
|
||||
msgid "Rich text editor"
|
||||
msgstr "RTE-рэдактар"
|
||||
|
||||
#: admin.php:93
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Уключыць WYSIWYG рэдактар"
|
||||
|
||||
#: admin.php:99
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Рэдагаваць абзацы"
|
||||
|
||||
#: admin.php:100
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Рэдагаваць абзац замест цэлага паста"
|
||||
|
||||
#: core.php:98
|
||||
msgid "Save"
|
||||
msgstr "Захаваць"
|
||||
|
||||
#: core.php:99
|
||||
msgid "Cancel"
|
||||
msgstr "Адмена"
|
||||
|
||||
#: fields.php:42
|
||||
msgid "empty"
|
||||
msgstr "ачыціць"
|
||||
|
||||
#: fields.php:442
|
||||
msgid "Post/page title"
|
||||
msgstr "Загаловак паста/старонкі"
|
||||
|
||||
#: fields.php:448
|
||||
msgid "Post/page content"
|
||||
msgstr "Утрыманне паста/старонкі"
|
||||
|
||||
#: fields.php:454
|
||||
msgid "Post/page excerpt"
|
||||
msgstr "Вытрымка паста/старонкі"
|
||||
|
||||
#: fields.php:460
|
||||
msgid "Post tags"
|
||||
msgstr "Тэгі паста"
|
||||
|
||||
#: fields.php:466
|
||||
#, fuzzy
|
||||
msgid "Post terms"
|
||||
msgstr "Тэгі паста"
|
||||
|
||||
#: fields.php:472
|
||||
msgid "Post/page custom fields"
|
||||
msgstr "Карыстацкія палі паста/старонкі"
|
||||
|
||||
#: fields.php:478
|
||||
msgid "Comment text"
|
||||
msgstr "Тэкст каментара"
|
||||
|
||||
#: fields.php:484
|
||||
msgid "Text widget content"
|
||||
msgstr "Утрыманне тэкставага виджета"
|
||||
|
||||
#: fields.php:489
|
||||
msgid "Text widget title"
|
||||
msgstr "Загаловак тэкставага виджета"
|
||||
|
||||
#. Plugin Name of an extension
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end рэдактар"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Дазволіць вам рэдагаваць пост без выкарыстання адміністратарскай панэлі"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
#~ msgid "[none]"
|
||||
#~ msgstr "[не]"
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor 1.6.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2010-01-07 18:18+0100\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Team Blogos <wordpress@blogos.dk>\n"
|
||||
"Language-Team: Team Blogos <wordpress@blogos.dk>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2;plural=n != 1;\n"
|
||||
"X-Poedit-Language: Danish\n"
|
||||
"X-Poedit-Country: DENMARK\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
"X-Poedit-KeywordsList: __;_c;_e;__ngettext:1,2;__ngettext_noop:1,2;_n:1,2;_nc:1,2;_n_noop:1,2\n"
|
||||
"X-Poedit-Basepath: d:\\wordpress\\plugins\\front-end-editor\n"
|
||||
"X-Poedit-SearchPath-0: d:\\wordpress\\plugins\\front-end-editor\n"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:7
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:10
|
||||
msgid "Fields"
|
||||
msgstr "Feltnavne"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:11
|
||||
#: d:\wordpress\plugins\front-end-editor/scb/AdminPage.php:329
|
||||
msgid "Settings"
|
||||
msgstr "Indstillinger"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:51
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:104
|
||||
#: d:\wordpress\plugins\front-end-editor/scb/AdminPage.php:101
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Indstillingerne <strong>gemt</strong>."
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:63
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Aktivér eller deaktivér redigerbare felter"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:65
|
||||
msgid "Post fields"
|
||||
msgstr "Indlægsfelter"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:66
|
||||
msgid "Other fields"
|
||||
msgstr "Andre felter"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:110
|
||||
msgid "Rich text editor"
|
||||
msgstr "Rich text editor"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:111
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Aktivér WYSIWYG-editoren"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:117
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Redigér afsnit"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:118
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Redigér et afsnit ad gangen, i stedet for et helt indlæg"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:124
|
||||
msgid "Highlighting"
|
||||
msgstr "Fremhævelser"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/admin.php:125
|
||||
msgid "Highlight editable elements"
|
||||
msgstr "Fremhæv redigerbare elementer"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/core.php:58
|
||||
msgid "Save"
|
||||
msgstr "Gem"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/core.php:59
|
||||
msgid "Cancel"
|
||||
msgstr "Annullér"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/core.php:90
|
||||
msgid "Change Image"
|
||||
msgstr "Ændr billede"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/core.php:91
|
||||
msgid "Use default"
|
||||
msgstr "Brug standard"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:68
|
||||
msgid "Post title"
|
||||
msgstr "Titel på indlæg"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:74
|
||||
msgid "Post content"
|
||||
msgstr "Indhold af indlæg"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:80
|
||||
msgid "Post excerpt"
|
||||
msgstr "Indlægsuddrag"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:86
|
||||
msgid "Post category"
|
||||
msgstr "Indlægskategori"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:93
|
||||
msgid "Post tags"
|
||||
msgstr "Indlægs-tags"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:100
|
||||
msgid "Post terms"
|
||||
msgstr "Indlægs-terms"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:107
|
||||
msgid "Post custom fields"
|
||||
msgstr "Brugerdefinerede indlægsfelter"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:113
|
||||
msgid "Comment text"
|
||||
msgstr "Kommentartekst"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:119
|
||||
msgid "Category title"
|
||||
msgstr "Titel på kategori"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:124
|
||||
msgid "Tag title"
|
||||
msgstr "Titel på tag"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:129
|
||||
msgid "Author description"
|
||||
msgstr "Forfatterbeskrivelse"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:136
|
||||
msgid "Widget title"
|
||||
msgstr "Widgettitel"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:141
|
||||
msgid "Text widget content"
|
||||
msgstr "Indhold af tekst-widgets"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:147
|
||||
msgid "Site title and description"
|
||||
msgstr "Sitetitel og -beskrivelse"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/front-end-editor.php:153
|
||||
msgid "Theme images"
|
||||
msgstr "Tema-billeder"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/fields/base.php:79
|
||||
msgid "empty"
|
||||
msgstr "tom"
|
||||
|
||||
#: d:\wordpress\plugins\front-end-editor/scb/AdminPage.php:112
|
||||
#: d:\wordpress\plugins\front-end-editor/scb/AdminPage.php:123
|
||||
msgid "Save Changes"
|
||||
msgstr "Gem ændringer"
|
||||
|
||||
#~ msgid "Field name"
|
||||
#~ msgstr "Feltnavn"
|
||||
#~ msgid "[none]"
|
||||
#~ msgstr "[ingen]"
|
||||
#~ msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
#~ msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
#~ msgid ""
|
||||
#~ "Allows you to edit your posts without going through the admin interface"
|
||||
#~ msgstr ""
|
||||
#~ "Lader dig redigere dine indlæg uden at skulle gøre gennem "
|
||||
#~ "administrationspanelet"
|
||||
#~ msgid "scribu"
|
||||
#~ msgstr "scribu"
|
||||
#~ msgid "http://scribu.net/"
|
||||
#~ msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR scribu
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor 1.5a\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-11-28 16:53+0200\n"
|
||||
"PO-Revision-Date: 2009-11-29 17:36+0100\n"
|
||||
"Last-Translator: G F <gottfried@pips.at>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. #-#-#-#-# front-end-editor.pot (Front-end Editor 1.5a) #-#-#-#-#
|
||||
#. Plugin Name of an extension
|
||||
#: admin.php:7
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#: admin.php:10
|
||||
msgid "Fields"
|
||||
msgstr "Felder"
|
||||
|
||||
#: admin.php:11
|
||||
#: scb/AdminPage.php:310
|
||||
msgid "Settings"
|
||||
msgstr "Einstellungen"
|
||||
|
||||
#: admin.php:51
|
||||
#: admin.php:105
|
||||
#: scb/AdminPage.php:101
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Einstellungen <strong>gespeichert</strong>."
|
||||
|
||||
#: admin.php:63
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Editierbare Felder aktivieren"
|
||||
|
||||
#: admin.php:66
|
||||
msgid "Post fields"
|
||||
msgstr "Post Felder"
|
||||
|
||||
#: admin.php:67
|
||||
msgid "Other fields"
|
||||
msgstr "Andere Felder"
|
||||
|
||||
#: admin.php:111
|
||||
msgid "Rich text editor"
|
||||
msgstr "Rich Text Editor"
|
||||
|
||||
#: admin.php:112
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "WYSIWYG-Editor aktivieren"
|
||||
|
||||
#: admin.php:118
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Absätze editieren"
|
||||
|
||||
#: admin.php:119
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Nur einen Absatz editieren statt den ganzen Text"
|
||||
|
||||
#: admin.php:125
|
||||
msgid "Highlighting"
|
||||
msgstr "Hervorheben"
|
||||
|
||||
#: admin.php:126
|
||||
msgid "Highlight editable elements"
|
||||
msgstr "Editierbare Elemente hervorheben"
|
||||
|
||||
#: core.php:96
|
||||
msgid "Save"
|
||||
msgstr "OK"
|
||||
|
||||
#: core.php:97
|
||||
msgid "Cancel"
|
||||
msgstr "abbrechen"
|
||||
|
||||
#: core.php:105
|
||||
msgid "Use default"
|
||||
msgstr "Standardeinsetllungen verwenden"
|
||||
|
||||
#: core.php:108
|
||||
msgid "Change Image"
|
||||
msgstr "Bild ändern"
|
||||
|
||||
#: core.php:273
|
||||
msgid "empty"
|
||||
msgstr "leer"
|
||||
|
||||
#: front-end-editor.php:69
|
||||
msgid "Post title"
|
||||
msgstr "Post Titel"
|
||||
|
||||
#: front-end-editor.php:75
|
||||
msgid "Post content"
|
||||
msgstr "Post Inhalt"
|
||||
|
||||
#: front-end-editor.php:81
|
||||
msgid "Post excerpt"
|
||||
msgstr "Post Exzerpt"
|
||||
|
||||
#: front-end-editor.php:87
|
||||
msgid "Post tags"
|
||||
msgstr "Post Tags"
|
||||
|
||||
#: front-end-editor.php:93
|
||||
msgid "Post terms"
|
||||
msgstr "Post Terms"
|
||||
|
||||
#: front-end-editor.php:99
|
||||
msgid "Post custom fields"
|
||||
msgstr "Post Custom Felder"
|
||||
|
||||
#: front-end-editor.php:105
|
||||
msgid "Comment text"
|
||||
msgstr "Kommentartext"
|
||||
|
||||
#: front-end-editor.php:111
|
||||
msgid "Category title"
|
||||
msgstr "Kategorie"
|
||||
|
||||
#: front-end-editor.php:116
|
||||
msgid "Tag title"
|
||||
msgstr "Tag"
|
||||
|
||||
#: front-end-editor.php:121
|
||||
msgid "Author description"
|
||||
msgstr "Autor"
|
||||
|
||||
#: front-end-editor.php:128
|
||||
msgid "Text widget content"
|
||||
msgstr "Text Widget Inhalt"
|
||||
|
||||
#: front-end-editor.php:134
|
||||
msgid "Text widget title"
|
||||
msgstr "Text Widget Titel"
|
||||
|
||||
#: front-end-editor.php:139
|
||||
msgid "Site title and description"
|
||||
msgstr "Titel und Beschreibung der Seite"
|
||||
|
||||
#: front-end-editor.php:145
|
||||
msgid "Theme images"
|
||||
msgstr "Themen Bilder"
|
||||
|
||||
#: scb/AdminPage.php:111
|
||||
msgid "Save Changes"
|
||||
msgstr "Änderungen speichern"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Erlaubt Posts und Seiten direkt zu ändern ohne Dashboard"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-04-07 17:11+0300\n"
|
||||
"PO-Revision-Date: 2009-04-08 17:40+0200\n"
|
||||
"Last-Translator: scribu <scribu@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: admin.php:35
|
||||
msgid "Settings saved"
|
||||
msgstr "Opciones guardadas"
|
||||
|
||||
#: admin.php:41
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Active o desactive los campos editables"
|
||||
|
||||
#: admin.php:47
|
||||
msgid "Field name"
|
||||
msgstr "Campos"
|
||||
|
||||
#: admin.php:64
|
||||
#: admin.php:77
|
||||
msgid "Save changes"
|
||||
msgstr "Guardar cambios"
|
||||
|
||||
#: admin.php:69
|
||||
msgid "Rich text editor"
|
||||
msgstr "Editor de texto visual"
|
||||
|
||||
#: admin.php:70
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Activar editor WYSIWYG"
|
||||
|
||||
#: admin.php:76
|
||||
msgid "Settings"
|
||||
msgstr "Opciones"
|
||||
|
||||
#: front-end-editor.php:106
|
||||
msgid "Save"
|
||||
msgstr "Guardar"
|
||||
|
||||
#: front-end-editor.php:107
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#. Plugin Name of an extension
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
# Descripción de una extensión
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Permite editar sus entradas y páginas sin necesidad de entrar en la administración de Wordpress"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
"Project-Id-Version: Front-end Editor 0.8\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-04-07 17:11+0300\n"
|
||||
"PO-Revision-Date: 2009-04-08 11:23-0300\n"
|
||||
"Last-Translator: Esteban <etruel@gmail.com>\n"
|
||||
"Language-Team: ROMANIAN <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Spanish\n"
|
||||
"X-Poedit-Country: SPAIN\n"
|
||||
|
||||
#: admin.php:35
|
||||
msgid "Settings saved"
|
||||
msgstr "Opciones guardadas"
|
||||
|
||||
#: admin.php:41
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Active o desactive los campos editables"
|
||||
|
||||
#: admin.php:47
|
||||
msgid "Field name"
|
||||
msgstr "Campos"
|
||||
|
||||
#: admin.php:64
|
||||
#: admin.php:77
|
||||
msgid "Save changes"
|
||||
msgstr "Guardar cambios"
|
||||
|
||||
#: admin.php:69
|
||||
msgid "Rich text editor"
|
||||
msgstr "Editor de texto visual"
|
||||
|
||||
#: admin.php:70
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Activar editor WYSIWYG"
|
||||
|
||||
#: admin.php:76
|
||||
msgid "Settings"
|
||||
msgstr "Opciones"
|
||||
|
||||
#: front-end-editor.php:106
|
||||
msgid "Save"
|
||||
msgstr "Guardar"
|
||||
|
||||
#: front-end-editor.php:107
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#. Plugin Name of an extension
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
# Descripción de una extensión
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Permite editar sus entradas y páginas sin necesidad de entrar en la administración de Wordpress"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,156 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR scribu
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor 1.4 / Estonian\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-11-06 16:58+0200\n"
|
||||
"PO-Revision-Date: 2009-11-11 21:31+0200\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: Aivar Luht <aivarluht@planet.ee>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Estonian\n"
|
||||
"X-Poedit-Country: ESTONIA\n"
|
||||
|
||||
#. #-#-#-#-# front-end-editor.pot (Front-end Editor 1.4) #-#-#-#-#
|
||||
#. Plugin Name of an extension
|
||||
#: admin.php:9
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#: admin.php:12
|
||||
msgid "Fields"
|
||||
msgstr "Väljad"
|
||||
|
||||
#: admin.php:13
|
||||
#: scb/AdminPage.php:338
|
||||
msgid "Settings"
|
||||
msgstr "Seaded"
|
||||
|
||||
#: admin.php:44
|
||||
#: admin.php:88
|
||||
#: scb/AdminPage.php:105
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Seaded <strong>salvestatud</strong>."
|
||||
|
||||
#: admin.php:50
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Luba või keela muudetavad väljad"
|
||||
|
||||
#: admin.php:56
|
||||
msgid "Field name"
|
||||
msgstr "Välja nimi"
|
||||
|
||||
#: admin.php:95
|
||||
msgid "Rich text editor"
|
||||
msgstr "Visuaalredaktor"
|
||||
|
||||
#: admin.php:96
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Aktiveeri WYSIWYG redaktor"
|
||||
|
||||
#: admin.php:102
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Lõikude toimetamine"
|
||||
|
||||
#: admin.php:103
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Toimeta üks lõik korraga, mitte kogu postitus"
|
||||
|
||||
#: admin.php:109
|
||||
msgid "Highlighting"
|
||||
msgstr "Esile tõstmine"
|
||||
|
||||
#: admin.php:110
|
||||
msgid "Highlight editable elements"
|
||||
msgstr "Tõsta muudetavad osad esile"
|
||||
|
||||
#: core.php:146
|
||||
msgid "Save"
|
||||
msgstr "Salvesta"
|
||||
|
||||
#: core.php:147
|
||||
msgid "Cancel"
|
||||
msgstr "Tühista"
|
||||
|
||||
#: core.php:272
|
||||
msgid "empty"
|
||||
msgstr "tühjenda"
|
||||
|
||||
#: fields.php:591
|
||||
msgid "Post title"
|
||||
msgstr "Postituse pealkiri"
|
||||
|
||||
#: fields.php:597
|
||||
msgid "Post content"
|
||||
msgstr "Postituse sisu"
|
||||
|
||||
#: fields.php:603
|
||||
msgid "Post excerpt"
|
||||
msgstr "Postituse väljavõte"
|
||||
|
||||
#: fields.php:609
|
||||
msgid "Post tags"
|
||||
msgstr "Postituse sildid"
|
||||
|
||||
#: fields.php:615
|
||||
msgid "Post terms"
|
||||
msgstr "Postituse tingimused"
|
||||
|
||||
#: fields.php:621
|
||||
msgid "Post custom fields"
|
||||
msgstr "Postituse lisaväljad"
|
||||
|
||||
#: fields.php:627
|
||||
msgid "Comment text"
|
||||
msgstr "Kommentaari tekst"
|
||||
|
||||
#: fields.php:633
|
||||
msgid "Category title"
|
||||
msgstr "Rubriigi pealkiri"
|
||||
|
||||
#: fields.php:638
|
||||
msgid "Tag title"
|
||||
msgstr "Sildi pealkiri"
|
||||
|
||||
#: fields.php:643
|
||||
msgid "Author description"
|
||||
msgstr "Autori kirjeldus"
|
||||
|
||||
#: fields.php:650
|
||||
msgid "Text widget content"
|
||||
msgstr "Tekstmooduli sisu"
|
||||
|
||||
#: fields.php:656
|
||||
msgid "Text widget title"
|
||||
msgstr "Tekstmooduli pealkiri"
|
||||
|
||||
#: fields.php:661
|
||||
msgid "Site title and description"
|
||||
msgstr "Veebilehe pealkiri ja kirjeldus"
|
||||
|
||||
#: scb/AdminPage.php:163
|
||||
msgid "Save Changes"
|
||||
msgstr "Salvesta Muudatused"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Lubab postituste toimetamist haldusliidesest läbi käimata"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,203 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor v0.8\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-04-16 17:41+0300\n"
|
||||
"PO-Revision-Date: 2009-04-16 17:42+0200\n"
|
||||
"Last-Translator: scribu <scribu@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Poedit-Language: French\n"
|
||||
"X-Poedit-Country: FRANCE\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
||||
"X-Poedit-Basepath: ../\n"
|
||||
"X-Poedit-Bookmarks: \n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
"X-Textdomain-Support: yes"
|
||||
|
||||
#: admin.php:64
|
||||
#@ front-end-editor
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Activer ou désactiver les champs éditables"
|
||||
|
||||
#: admin.php:111
|
||||
#@ front-end-editor
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Activer l'éditeur WYSIWYG"
|
||||
|
||||
#: admin.php:12
|
||||
#: scb/AdminPage.php:329
|
||||
#@ front-end-editor
|
||||
msgid "Settings"
|
||||
msgstr "Réglages"
|
||||
|
||||
#: front-end-editor.php:91
|
||||
#@ front-end-editor
|
||||
msgid "Post tags"
|
||||
msgstr "Tags du billet"
|
||||
|
||||
#: front-end-editor.php:118
|
||||
#@ front-end-editor
|
||||
msgid "Comment text"
|
||||
msgstr "Commentaires"
|
||||
|
||||
#: front-end-editor.php:146
|
||||
#@ front-end-editor
|
||||
msgid "Text widget content"
|
||||
msgstr "Contenu des widgets texte"
|
||||
|
||||
#: core.php:59
|
||||
#@ front-end-editor
|
||||
msgid "Save"
|
||||
msgstr "Sauvegarder"
|
||||
|
||||
#: core.php:60
|
||||
#@ front-end-editor
|
||||
msgid "Cancel"
|
||||
msgstr "Annuler"
|
||||
|
||||
#: admin.php:11
|
||||
#@ front-end-editor
|
||||
msgid "Fields"
|
||||
msgstr "Champs"
|
||||
|
||||
#: scb/AdminPage.php:272
|
||||
#@ front-end-editor
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Réglages <strong>sauvegardés</strong>."
|
||||
|
||||
#: admin.php:117
|
||||
#@ front-end-editor
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Éditer paragraphe par paragraphe plutôt que le contenu entier du billet."
|
||||
|
||||
#: admin.php:8
|
||||
#@ front-end-editor
|
||||
msgid "Front-end Editor"
|
||||
msgstr ""
|
||||
|
||||
#: fields/base.php:82
|
||||
#@ front-end-editor
|
||||
msgid "empty"
|
||||
msgstr "vide "
|
||||
|
||||
#: front-end-editor.php:98
|
||||
#@ front-end-editor
|
||||
msgid "Post terms"
|
||||
msgstr "Termes du billet "
|
||||
|
||||
#: front-end-editor.php:134
|
||||
#@ front-end-editor
|
||||
msgid "Author description"
|
||||
msgstr "Description de l'auteur "
|
||||
|
||||
#: scb/AdminPage.php:158
|
||||
#: scb/AdminPage.php:169
|
||||
#@ front-end-editor
|
||||
msgid "Save Changes"
|
||||
msgstr "Sauvegarder les modifications"
|
||||
|
||||
#: admin.php:129
|
||||
#@ front-end-editor
|
||||
msgid "Highlight editable elements"
|
||||
msgstr "Surlignage des éléments éditables"
|
||||
|
||||
#: front-end-editor.php:152
|
||||
#@ front-end-editor
|
||||
msgid "Site title and description"
|
||||
msgstr "Titre du site et description"
|
||||
|
||||
#: front-end-editor.php:66
|
||||
#@ front-end-editor
|
||||
msgid "Post title"
|
||||
msgstr "Titre du billet"
|
||||
|
||||
#: front-end-editor.php:72
|
||||
#@ front-end-editor
|
||||
msgid "Post content"
|
||||
msgstr "Contenu du billet"
|
||||
|
||||
#: front-end-editor.php:78
|
||||
#@ front-end-editor
|
||||
msgid "Post excerpt"
|
||||
msgstr "Extrait du billet"
|
||||
|
||||
#: front-end-editor.php:105
|
||||
#@ front-end-editor
|
||||
msgid "Post custom fields"
|
||||
msgstr "Champs personnalisés du billet"
|
||||
|
||||
#: front-end-editor.php:124
|
||||
#@ front-end-editor
|
||||
msgid "Category title"
|
||||
msgstr "Titre de catégorie"
|
||||
|
||||
#: front-end-editor.php:129
|
||||
#@ front-end-editor
|
||||
msgid "Tag title"
|
||||
msgstr "Titre de tag"
|
||||
|
||||
#: admin.php:66
|
||||
#@ front-end-editor
|
||||
msgid "Post fields"
|
||||
msgstr "Champs des billets"
|
||||
|
||||
#: admin.php:67
|
||||
#@ front-end-editor
|
||||
msgid "Other fields"
|
||||
msgstr "Autres champs"
|
||||
|
||||
#: core.php:110
|
||||
#@ front-end-editor
|
||||
msgid "Change Image"
|
||||
msgstr "Changer d'image"
|
||||
|
||||
#: front-end-editor.php:164
|
||||
#@ front-end-editor
|
||||
msgid "Theme images"
|
||||
msgstr "Images du thème"
|
||||
|
||||
#: front-end-editor.php:141
|
||||
#@ front-end-editor
|
||||
msgid "Widget title"
|
||||
msgstr "Titre de widget"
|
||||
|
||||
#: admin.php:123
|
||||
#@ front-end-editor
|
||||
msgid "Reset the post date on each edit"
|
||||
msgstr "Réinitialiser la date de billet pour chaque édition "
|
||||
|
||||
#: core.php:111
|
||||
#@ front-end-editor
|
||||
msgid "Clear"
|
||||
msgstr "Nettoyer"
|
||||
|
||||
#: front-end-editor.php:84
|
||||
#@ front-end-editor
|
||||
msgid "Post categories"
|
||||
msgstr "Catégories de billet"
|
||||
|
||||
#: front-end-editor.php:111
|
||||
#@ front-end-editor
|
||||
msgid "Post thumbnail"
|
||||
msgstr "Miniature de billet "
|
||||
|
||||
#: front-end-editor.php:158
|
||||
#@ front-end-editor
|
||||
msgid "Site options"
|
||||
msgstr "Options du site"
|
||||
|
||||
#: admin.php:134
|
||||
#@ front-end-editor
|
||||
msgid "Display a tooltip above editable elements"
|
||||
msgstr "Afficher une info bulle au dessus des éléments éditables"
|
||||
|
||||
#: core.php:74
|
||||
#@ front-end-editor
|
||||
msgid "Double-click to edit"
|
||||
msgstr "Double cliquer pour éditer"
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor Georgian\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2010-01-01 19:11+0200\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Levani <levani9191@gmail.com>\n"
|
||||
"Language-Team: Georgianisation.site88.net <levani9191@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Poedit-Language: Georgian\n"
|
||||
"X-Poedit-Country: GEORGIA\n"
|
||||
|
||||
#. #-#-#-#-# front-end-editor.pot (Front-end Editor 1.6) #-#-#-#-#
|
||||
#. Plugin Name of an extension
|
||||
#: admin.php:7
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#: admin.php:10
|
||||
msgid "Fields"
|
||||
msgstr "ველები"
|
||||
|
||||
#: admin.php:11
|
||||
#: scb/AdminPage.php:314
|
||||
msgid "Settings"
|
||||
msgstr "პარამეტრები"
|
||||
|
||||
#: admin.php:51
|
||||
#: admin.php:104
|
||||
#: scb/AdminPage.php:101
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "პარამეტრები <strong>დამახსოვრებულია</strong>."
|
||||
|
||||
#: admin.php:63
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "რედაქტირებადი ველების ჩართვა გამორთვა"
|
||||
|
||||
#: admin.php:65
|
||||
msgid "Post fields"
|
||||
msgstr "პოსტის ველები"
|
||||
|
||||
#: admin.php:66
|
||||
msgid "Other fields"
|
||||
msgstr "სხვა ველები"
|
||||
|
||||
#: admin.php:110
|
||||
msgid "Rich text editor"
|
||||
msgstr "ტექსტური რედაქტორი"
|
||||
|
||||
#: admin.php:111
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "WYSIWYG რედაქტორის ჩართვა"
|
||||
|
||||
#: admin.php:117
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "პარაგრაფების რედაქტირება"
|
||||
|
||||
#: admin.php:118
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "ერთ ჯერზე შეცვალე მხოლოდ ერთი პარაგრაფი, მთელი პოსტის ნაცვლად."
|
||||
|
||||
#: admin.php:124
|
||||
msgid "Highlighting"
|
||||
msgstr "გამოყოფა"
|
||||
|
||||
#: admin.php:125
|
||||
msgid "Highlight editable elements"
|
||||
msgstr "გამოყავი რედაქტირებადი ველები"
|
||||
|
||||
#: core.php:58
|
||||
msgid "Save"
|
||||
msgstr "დამახსოვრება"
|
||||
|
||||
#: core.php:59
|
||||
msgid "Cancel"
|
||||
msgstr "გაუქმება"
|
||||
|
||||
#: core.php:90
|
||||
msgid "Change Image"
|
||||
msgstr "სურათის შეცვლა"
|
||||
|
||||
#: core.php:91
|
||||
msgid "Use default"
|
||||
msgstr "სტანდარტულის გამოყენება"
|
||||
|
||||
#: fields/base.php:79
|
||||
msgid "empty"
|
||||
msgstr "ცარიელი"
|
||||
|
||||
#: front-end-editor.php:68
|
||||
msgid "Post title"
|
||||
msgstr "პოსტის სათაური"
|
||||
|
||||
#: front-end-editor.php:74
|
||||
msgid "Post content"
|
||||
msgstr "პოსტის შენაარსი"
|
||||
|
||||
#: front-end-editor.php:80
|
||||
msgid "Post excerpt"
|
||||
msgstr "პოსტის ამონაწერი"
|
||||
|
||||
#: front-end-editor.php:86
|
||||
msgid "Post category"
|
||||
msgstr "პოსტის კატეგორია"
|
||||
|
||||
#: front-end-editor.php:93
|
||||
msgid "Post tags"
|
||||
msgstr "პოსტის ტეგები"
|
||||
|
||||
#: front-end-editor.php:100
|
||||
msgid "Post terms"
|
||||
msgstr "პოსტის term-ები."
|
||||
|
||||
#: front-end-editor.php:107
|
||||
msgid "Post custom fields"
|
||||
msgstr "პოსტის დამატებითი ველები"
|
||||
|
||||
#: front-end-editor.php:113
|
||||
msgid "Comment text"
|
||||
msgstr "კომენტარის ტექსტი"
|
||||
|
||||
#: front-end-editor.php:119
|
||||
msgid "Category title"
|
||||
msgstr "კატეგორიის სათაური"
|
||||
|
||||
#: front-end-editor.php:124
|
||||
msgid "Tag title"
|
||||
msgstr "ტეგის სათაური"
|
||||
|
||||
#: front-end-editor.php:129
|
||||
msgid "Author description"
|
||||
msgstr "ავტორის აღწერა"
|
||||
|
||||
#: front-end-editor.php:136
|
||||
msgid "Widget title"
|
||||
msgstr "ვიდგეტის სათაური"
|
||||
|
||||
#: front-end-editor.php:141
|
||||
msgid "Text widget content"
|
||||
msgstr "ტექსტური ვიდგეტის შინაარსი"
|
||||
|
||||
#: front-end-editor.php:147
|
||||
msgid "Site title and description"
|
||||
msgstr "საიტის სათაური და აღწერა"
|
||||
|
||||
#: front-end-editor.php:153
|
||||
msgid "Theme images"
|
||||
msgstr "დიზაინის სურათები"
|
||||
|
||||
#: scb/AdminPage.php:111
|
||||
msgid "Save Changes"
|
||||
msgstr "ცვლილებების დამახსოვრება"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "საშუალებას გაძლევთ განახორციელოთ ცვლილებები ადმინ პანელში შეუსვლელად"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
#~ msgid "Field name"
|
||||
#~ msgstr "ველის სახელი"
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor in italiano\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2010-04-01 04:57+0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Gianni Diurno (aka gidibao) <gidibao[at]gmail[dot]com>\n"
|
||||
"Language-Team: Gianni Diurno | gidibao.net <gidibao[at]gmail[dot]com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Italian\n"
|
||||
"X-Poedit-Country: ITALY\n"
|
||||
|
||||
#. #-#-#-#-# front-end-editor.pot (Front-end Editor 1.8a5) #-#-#-#-#
|
||||
#. Plugin Name of an extension
|
||||
#: admin.php:8
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#: admin.php:11
|
||||
msgid "Fields"
|
||||
msgstr "Campi"
|
||||
|
||||
#: admin.php:12
|
||||
#: scb/AdminPage.php:329
|
||||
msgid "Settings"
|
||||
msgstr "Impostazioni"
|
||||
|
||||
#: admin.php:64
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Attiva o disattiva i campi modificabili"
|
||||
|
||||
#: admin.php:66
|
||||
msgid "Post fields"
|
||||
msgstr "Campi articolo"
|
||||
|
||||
#: admin.php:67
|
||||
msgid "Other fields"
|
||||
msgstr "Altri campi"
|
||||
|
||||
#: admin.php:111
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Attiva l'editor WYSIWYG"
|
||||
|
||||
#: admin.php:117
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Modifica un paragrafo alla volta invece di operare su tutto l'articolo"
|
||||
|
||||
#: admin.php:123
|
||||
msgid "Reset the post date on each edit"
|
||||
msgstr "Ripristina la data dell'articolo ad ogni modifica"
|
||||
|
||||
#: admin.php:129
|
||||
msgid "Highlight editable elements"
|
||||
msgstr "Evidenzia gli elementi modificabili"
|
||||
|
||||
#: admin.php:134
|
||||
msgid "Display a tooltip above editable elements"
|
||||
msgstr "Mostra un tooltip sopra gli elementi modificabili"
|
||||
|
||||
#: core.php:59
|
||||
msgid "Save"
|
||||
msgstr "Salva"
|
||||
|
||||
#: core.php:60
|
||||
msgid "Cancel"
|
||||
msgstr "Annulla"
|
||||
|
||||
#: core.php:74
|
||||
msgid "Double-click to edit"
|
||||
msgstr "Doppio click per modificare"
|
||||
|
||||
#: core.php:110
|
||||
msgid "Change Image"
|
||||
msgstr "Cambia immagine"
|
||||
|
||||
#: core.php:111
|
||||
msgid "Clear"
|
||||
msgstr "Svuota"
|
||||
|
||||
#: fields/base.php:82
|
||||
msgid "empty"
|
||||
msgstr "vuoto"
|
||||
|
||||
#: front-end-editor.php:66
|
||||
msgid "Post title"
|
||||
msgstr "Titolo articolo"
|
||||
|
||||
#: front-end-editor.php:72
|
||||
msgid "Post content"
|
||||
msgstr "Contenuto articolo"
|
||||
|
||||
#: front-end-editor.php:78
|
||||
msgid "Post excerpt"
|
||||
msgstr "Riassunto articolo"
|
||||
|
||||
#: front-end-editor.php:84
|
||||
msgid "Post categories"
|
||||
msgstr "Categorie articolo"
|
||||
|
||||
#: front-end-editor.php:91
|
||||
msgid "Post tags"
|
||||
msgstr "Tag articolo"
|
||||
|
||||
#: front-end-editor.php:98
|
||||
msgid "Post terms"
|
||||
msgstr "Termini articolo"
|
||||
|
||||
#: front-end-editor.php:105
|
||||
msgid "Post custom fields"
|
||||
msgstr "Campi personalizzati articolo"
|
||||
|
||||
#: front-end-editor.php:111
|
||||
msgid "Post thumbnail"
|
||||
msgstr "Miniatura articolo"
|
||||
|
||||
#: front-end-editor.php:118
|
||||
msgid "Comment text"
|
||||
msgstr "Testo commenti"
|
||||
|
||||
#: front-end-editor.php:124
|
||||
msgid "Category title"
|
||||
msgstr "Titolo categoria"
|
||||
|
||||
#: front-end-editor.php:129
|
||||
msgid "Tag title"
|
||||
msgstr "Titolo tag"
|
||||
|
||||
#: front-end-editor.php:134
|
||||
msgid "Author description"
|
||||
msgstr "Descrizione autore"
|
||||
|
||||
#: front-end-editor.php:141
|
||||
msgid "Widget title"
|
||||
msgstr "Titolo widget"
|
||||
|
||||
#: front-end-editor.php:146
|
||||
msgid "Text widget content"
|
||||
msgstr "Contenuto widget di testo"
|
||||
|
||||
#: front-end-editor.php:152
|
||||
msgid "Site title and description"
|
||||
msgstr "Nome e descrizione del sito"
|
||||
|
||||
#: front-end-editor.php:158
|
||||
msgid "Site options"
|
||||
msgstr "Opzioni sito"
|
||||
|
||||
#: front-end-editor.php:164
|
||||
msgid "Theme images"
|
||||
msgstr "Immagini tema"
|
||||
|
||||
#: scb/AdminPage.php:158
|
||||
#: scb/AdminPage.php:169
|
||||
msgid "Save Changes"
|
||||
msgstr "Salva le modifiche"
|
||||
|
||||
#: scb/AdminPage.php:272
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Le impostazioni sono state <strong>salvate</strong>."
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Ti permette la modifica dei tuoi articoli senza utilizzare l'interfaccia di amministrazione"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
#~ msgid "Rich text editor"
|
||||
#~ msgstr "Editor avanzato"
|
||||
#~ msgid "Edit paragraphs"
|
||||
#~ msgstr "Modifica paragrafi"
|
||||
#~ msgid "Date reset"
|
||||
#~ msgstr "Ripristina la data"
|
||||
#~ msgid "Highlighting"
|
||||
#~ msgstr "Evidenziatore"
|
||||
#~ msgid "Use default"
|
||||
#~ msgstr "Utilizza predefinito"
|
||||
#~ msgid "Field name"
|
||||
#~ msgstr "Nome campo"
|
||||
#~ msgid "[none]"
|
||||
#~ msgstr "[nessuno]"
|
||||
#~ msgid "Install now"
|
||||
#~ msgstr "Installa subito"
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
"Project-Id-Version: front end editor\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-04-12 13:43+0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: tapsu <tapsu@fiptips.com>\n"
|
||||
"Language-Team: kzh <kzh.v.soonic@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Japanese\n"
|
||||
"X-Poedit-Country: JAPAN\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
|
||||
#: admin.php:27
|
||||
msgid "Settings saved"
|
||||
msgstr "設定は保存されました"
|
||||
|
||||
#: admin.php:33
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "編集できるフィールドを切り替えます"
|
||||
|
||||
#: admin.php:39
|
||||
msgid "Field name"
|
||||
msgstr "フィールド名"
|
||||
|
||||
#: admin.php:56
|
||||
#: admin.php:69
|
||||
msgid "Save changes"
|
||||
msgstr "設定を更新する"
|
||||
|
||||
#: admin.php:61
|
||||
msgid "Rich text editor"
|
||||
msgstr "リッチテキストエディタ"
|
||||
|
||||
#: admin.php:62
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "WYSIWYGエディタを有効にする"
|
||||
|
||||
#: admin.php:68
|
||||
msgid "Settings"
|
||||
msgstr "設定"
|
||||
|
||||
#: fields.php:211
|
||||
msgid "Post/page title"
|
||||
msgstr "投稿またはページのタイトル"
|
||||
|
||||
#: fields.php:216
|
||||
msgid "Post/page content"
|
||||
msgstr "投稿またはページの本文"
|
||||
|
||||
#: fields.php:221
|
||||
msgid "Post tags"
|
||||
msgstr "タグ"
|
||||
|
||||
#: fields.php:226
|
||||
msgid "Post/page custom fields"
|
||||
msgstr "カスタムフィールド"
|
||||
|
||||
#: fields.php:231
|
||||
msgid "Comment text"
|
||||
msgstr "コメント本文"
|
||||
|
||||
#: fields.php:236
|
||||
msgid "Text widget content"
|
||||
msgstr "テキストウィジェットの内容"
|
||||
|
||||
#: fields.php:240
|
||||
msgid "Text widget title"
|
||||
msgstr "テキストウィジェットタイトル"
|
||||
|
||||
#: front-end-editor.php:114
|
||||
msgid "Save"
|
||||
msgstr "保存"
|
||||
|
||||
#: front-end-editor.php:115
|
||||
msgid "Cancel"
|
||||
msgstr "キャンセル"
|
||||
|
||||
#. Plugin Name of an extension
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "管理画面を使わずに、投稿を直接編集できます"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor v0.8.4\n"
|
||||
"PO-Revision-Date: 2009-04-10 23:37+0200\n"
|
||||
"Last-Translator: admin <ron@fr-fanatic.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Poedit-Language: Dutch\n"
|
||||
"X-Poedit-Country: NETHERLANDS\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;__ngettext_noop:1,2;_c\n"
|
||||
"X-Poedit-Basepath: ../\n"
|
||||
"X-Poedit-SearchPath-0: ."
|
||||
|
||||
#: admin.php:27
|
||||
msgid "Settings saved"
|
||||
msgstr "Instellingen opgeslagen"
|
||||
|
||||
#: admin.php:33
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Inschakelen of uitschakelen bewerkbare velden"
|
||||
|
||||
#: admin.php:39
|
||||
msgid "Field name"
|
||||
msgstr "Veldnaam"
|
||||
|
||||
#: admin.php:56
|
||||
#: admin.php:69
|
||||
msgid "Save changes"
|
||||
msgstr "Sla de wijzigingen op"
|
||||
|
||||
#: admin.php:61
|
||||
msgid "Rich text editor"
|
||||
msgstr "Rich text editor"
|
||||
|
||||
#: admin.php:62
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Schakel de WYSIWYG-editor in"
|
||||
|
||||
#: admin.php:68
|
||||
msgid "Settings"
|
||||
msgstr "Instellingen"
|
||||
|
||||
#: fields.php:176
|
||||
msgid "Post/page title"
|
||||
msgstr "Artikel/pagina titel"
|
||||
|
||||
#: fields.php:181
|
||||
msgid "Post/page content"
|
||||
msgstr "Artikel/pagina inhoud"
|
||||
|
||||
#: fields.php:186
|
||||
msgid "Post tags"
|
||||
msgstr "Artikel tags"
|
||||
|
||||
#: fields.php:191
|
||||
msgid "Comment text"
|
||||
msgstr "Commentaar tekst"
|
||||
|
||||
#: fields.php:196
|
||||
msgid "Text widget content"
|
||||
msgstr "Tekst widget inhoud"
|
||||
|
||||
#: fields.php:200
|
||||
msgid "Text widget title"
|
||||
msgstr "Tekst widget titel"
|
||||
|
||||
#: front-end-editor.php:111
|
||||
msgid "Save"
|
||||
msgstr "Bewaar"
|
||||
|
||||
#: front-end-editor.php:112
|
||||
msgid "Cancel"
|
||||
msgstr "Annuleren"
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor v0.8.2\n"
|
||||
"PO-Revision-Date: 2009-04-09 13:40-0500\n"
|
||||
"Last-Translator: admin <john.ivar.myrstad@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Poedit-Language: Norwegian-Nynorsk\n"
|
||||
"X-Poedit-Country: NORWAY\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;__ngettext_noop:1,2;_c\n"
|
||||
"X-Poedit-Basepath: ../\n"
|
||||
"X-Poedit-SearchPath-0: ."
|
||||
|
||||
#: admin.php:27
|
||||
msgid "Settings saved"
|
||||
msgstr "Innstillinger lagret"
|
||||
|
||||
#: admin.php:33
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Aktivere eller deaktivere redigerbart felt"
|
||||
|
||||
#: admin.php:39
|
||||
msgid "Field name"
|
||||
msgstr "Feltnavn"
|
||||
|
||||
#: admin.php:56
|
||||
#: admin.php:69
|
||||
msgid "Save changes"
|
||||
msgstr "Lagre endringer"
|
||||
|
||||
#: admin.php:61
|
||||
msgid "Rich text editor"
|
||||
msgstr "Rik tekst-editor"
|
||||
|
||||
#: admin.php:62
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Aktiver WYSIWYG-editor"
|
||||
|
||||
#: admin.php:68
|
||||
msgid "Settings"
|
||||
msgstr "Innstillinger"
|
||||
|
||||
#: front-end-editor.php:109
|
||||
msgid "Save"
|
||||
msgstr "Lagre"
|
||||
|
||||
#: front-end-editor.php:110
|
||||
msgid "Cancel"
|
||||
msgstr "Avbryt"
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-08-25 19:18+0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: BoreS <BoreSer@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Russian\n"
|
||||
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
||||
|
||||
#. #-#-#-#-# front-end-editor.pot (Front-end Editor 1.2b) #-#-#-#-#
|
||||
#. Plugin Name of an extension
|
||||
#: admin.php:9
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Edytor bezpośredni"
|
||||
|
||||
#: admin.php:12
|
||||
msgid "Fields"
|
||||
msgstr "Pola"
|
||||
|
||||
#: admin.php:13
|
||||
#: scb/AdminPage.php:338
|
||||
msgid "Settings"
|
||||
msgstr "Ustawienia"
|
||||
|
||||
#: admin.php:43
|
||||
#: admin.php:87
|
||||
#: scb/AdminPage.php:105
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Ustawienia <strong>zapisane</strong>."
|
||||
|
||||
#: admin.php:49
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Włącz lub wyłącz edytowalne pola"
|
||||
|
||||
#: admin.php:55
|
||||
msgid "Field name"
|
||||
msgstr "Nazw apola"
|
||||
|
||||
#: admin.php:94
|
||||
msgid "Rich text editor"
|
||||
msgstr "Pełny edytor tekstowy"
|
||||
|
||||
#: admin.php:95
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Włącz edytor WYSIWYG"
|
||||
|
||||
#: admin.php:101
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Edytuj paragrafy"
|
||||
|
||||
#: admin.php:102
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Jednorazowo edytuj jeden paragraf zamiast całego wpisu"
|
||||
|
||||
#: core.php:109
|
||||
msgid "Save"
|
||||
msgstr "Zapisz"
|
||||
|
||||
#: core.php:110
|
||||
msgid "Cancel"
|
||||
msgstr "Anuluj"
|
||||
|
||||
#: core.php:235
|
||||
msgid "empty"
|
||||
msgstr "pusty"
|
||||
|
||||
#: fields.php:453
|
||||
msgid "Post/page title"
|
||||
msgstr "Tytuł strony/wpisu"
|
||||
|
||||
#: fields.php:459
|
||||
msgid "Post/page content"
|
||||
msgstr "Treść strony/wpisu"
|
||||
|
||||
#: fields.php:465
|
||||
msgid "Post/page excerpt"
|
||||
msgstr "Opis skrócony strony/wpisu"
|
||||
|
||||
#: fields.php:471
|
||||
msgid "Post tags"
|
||||
msgstr "Tagi wpisu"
|
||||
|
||||
#: fields.php:477
|
||||
msgid "Post terms"
|
||||
msgstr "Regulamin wpisu"
|
||||
|
||||
#: fields.php:483
|
||||
msgid "Post/page custom fields"
|
||||
msgstr "Dodatkowe pola wpisu/strony"
|
||||
|
||||
#: fields.php:489
|
||||
msgid "Comment text"
|
||||
msgstr "Treść komentarzy"
|
||||
|
||||
#: fields.php:495
|
||||
msgid "Author description"
|
||||
msgstr "Opis autora"
|
||||
|
||||
#: fields.php:502
|
||||
msgid "Text widget content"
|
||||
msgstr "Treść widgetów tekstowych"
|
||||
|
||||
#: fields.php:508
|
||||
msgid "Text widget title"
|
||||
msgstr "Tytuł widgetów tekstowych"
|
||||
|
||||
#: scb/AdminPage.php:163
|
||||
msgid "Save Changes"
|
||||
msgstr "Zapisz zmiany"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://www.expromo.pl"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Pozwala na edycję stron i wpisów bez przechodzenia do panelu administracji."
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "expromo"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://www.expromo.pl"
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-08-15 15:41+0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: Fernanda Foertter <foertter@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: admin.php:10
|
||||
msgid "Fields"
|
||||
msgstr "Campos "
|
||||
|
||||
#: admin.php:11
|
||||
#: scb/AdminPage.php:275
|
||||
msgid "Settings"
|
||||
msgstr "Opçoes"
|
||||
|
||||
#: admin.php:41
|
||||
#: admin.php:85
|
||||
#: scb/AdminPage.php:107
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Opcões <strong>guardadas</strong>."
|
||||
|
||||
#: admin.php:47
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Ativar ou desativar os campos editaveis"
|
||||
|
||||
#: admin.php:53
|
||||
msgid "Field name"
|
||||
msgstr "Campos"
|
||||
|
||||
#: admin.php:74
|
||||
#: admin.php:106
|
||||
msgid "Save changes"
|
||||
msgstr "Guardar mudanças"
|
||||
|
||||
#: admin.php:92
|
||||
msgid "Rich text editor"
|
||||
msgstr "Editor de texto visual"
|
||||
|
||||
#: admin.php:93
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Ativar editor WYSIWYG"
|
||||
|
||||
#: admin.php:99
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Editar Paragrafos"
|
||||
|
||||
#: admin.php:100
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Editar cada paragrafo de cada vez, nao somente o texto inteiro."
|
||||
|
||||
#: core.php:98
|
||||
msgid "Save"
|
||||
msgstr "Guardar"
|
||||
|
||||
#: core.php:99
|
||||
msgid "Cancel"
|
||||
msgstr "Cancelar"
|
||||
|
||||
#: fields.php:42
|
||||
msgid "empty"
|
||||
msgstr "vazio"
|
||||
|
||||
#: fields.php:442
|
||||
msgid "Post/page title"
|
||||
msgstr "Titulo do(a) post/pagina"
|
||||
|
||||
#: fields.php:448
|
||||
msgid "Post/page content"
|
||||
msgstr "Conteùdo do(a) post/pagina"
|
||||
|
||||
#: fields.php:454
|
||||
msgid "Post/page excerpt"
|
||||
msgstr "Trecho do(a) post/pagina"
|
||||
|
||||
#: fields.php:460
|
||||
msgid "Post tags"
|
||||
msgstr "Tags do Post"
|
||||
|
||||
#: fields.php:466
|
||||
msgid "Post terms"
|
||||
msgstr "Categorias do Post"
|
||||
|
||||
#: fields.php:472
|
||||
msgid "Post/page custom fields"
|
||||
msgstr "Campos costumizados do(a) post/pagina"
|
||||
|
||||
#: fields.php:478
|
||||
msgid "Comment text"
|
||||
msgstr "Texto de comentarios"
|
||||
|
||||
#: fields.php:484
|
||||
msgid "Text widget content"
|
||||
msgstr "Conteùdo do widget de texto"
|
||||
|
||||
#: fields.php:489
|
||||
msgid "Text widget title"
|
||||
msgstr "Titulo do widget de texto"
|
||||
|
||||
#. Plugin Name of an extension
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Editor de Frente"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
# Descripción de una extensión
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Permite editar o texto em suas paginas sem entrar no painel de administracão do Wordpress"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR scribu
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor 0.7.0.1\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2010-04-01 04:57+0300\n"
|
||||
"PO-Revision-Date: 2010-04-01 04:58+0200\n"
|
||||
"Last-Translator: scribu <scribu@gmail.com>\n"
|
||||
"Language-Team: ROMANIAN <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. #-#-#-#-# front-end-editor.pot (Front-end Editor 1.8a5) #-#-#-#-#
|
||||
#. Plugin Name of an extension
|
||||
#: admin.php:8
|
||||
msgid "Front-end Editor"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:11
|
||||
msgid "Fields"
|
||||
msgstr "Câmpuri"
|
||||
|
||||
#: admin.php:12
|
||||
#: scb/AdminPage.php:329
|
||||
msgid "Settings"
|
||||
msgstr "Setări"
|
||||
|
||||
#: admin.php:64
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Activează sau dezactivează câmpurile editabile"
|
||||
|
||||
#: admin.php:66
|
||||
msgid "Post fields"
|
||||
msgstr "Câmpuri articol"
|
||||
|
||||
#: admin.php:67
|
||||
msgid "Other fields"
|
||||
msgstr "Alte câmpuri"
|
||||
|
||||
#: admin.php:111
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Activează editorul WYSIWYG"
|
||||
|
||||
#: admin.php:117
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Editează câte un singur paragraf, în loc de articolul întreg"
|
||||
|
||||
#: admin.php:123
|
||||
msgid "Reset the post date on each edit"
|
||||
msgstr "Resetează data postului la fiecare editare"
|
||||
|
||||
#: admin.php:129
|
||||
msgid "Highlight editable elements"
|
||||
msgstr "Scoate în evidență elementele editabile"
|
||||
|
||||
#: admin.php:134
|
||||
msgid "Display a tooltip above editable elements"
|
||||
msgstr "Afișează un tooltip deasupra elementelor editabile"
|
||||
|
||||
#: core.php:59
|
||||
msgid "Save"
|
||||
msgstr "Salvează"
|
||||
|
||||
#: core.php:60
|
||||
msgid "Cancel"
|
||||
msgstr "Anulează"
|
||||
|
||||
#: core.php:74
|
||||
msgid "Double-click to edit"
|
||||
msgstr "Fă dublu-click pentru a edita"
|
||||
|
||||
#: core.php:110
|
||||
msgid "Change Image"
|
||||
msgstr "Schimbă imaginea"
|
||||
|
||||
#: core.php:111
|
||||
msgid "Clear"
|
||||
msgstr "Golește"
|
||||
|
||||
#: fields/base.php:82
|
||||
msgid "empty"
|
||||
msgstr "gol"
|
||||
|
||||
#: front-end-editor.php:66
|
||||
msgid "Post title"
|
||||
msgstr "Titlu articol"
|
||||
|
||||
#: front-end-editor.php:72
|
||||
msgid "Post content"
|
||||
msgstr "Conținut articol"
|
||||
|
||||
#: front-end-editor.php:78
|
||||
msgid "Post excerpt"
|
||||
msgstr "Extras articol"
|
||||
|
||||
#: front-end-editor.php:84
|
||||
msgid "Post categories"
|
||||
msgstr "Categorii articol"
|
||||
|
||||
#: front-end-editor.php:91
|
||||
msgid "Post tags"
|
||||
msgstr "Etichete articol"
|
||||
|
||||
#: front-end-editor.php:98
|
||||
msgid "Post terms"
|
||||
msgstr "Termeni articol"
|
||||
|
||||
#: front-end-editor.php:105
|
||||
msgid "Post custom fields"
|
||||
msgstr "Câmpuri personalizate articol"
|
||||
|
||||
#: front-end-editor.php:111
|
||||
msgid "Post thumbnail"
|
||||
msgstr "Miniatură articol"
|
||||
|
||||
#: front-end-editor.php:118
|
||||
msgid "Comment text"
|
||||
msgstr "Text comentariu"
|
||||
|
||||
#: front-end-editor.php:124
|
||||
msgid "Category title"
|
||||
msgstr "Titlu categorie"
|
||||
|
||||
#: front-end-editor.php:129
|
||||
msgid "Tag title"
|
||||
msgstr "Titlu etichetă"
|
||||
|
||||
#: front-end-editor.php:134
|
||||
msgid "Author description"
|
||||
msgstr "Descriere autor"
|
||||
|
||||
#: front-end-editor.php:141
|
||||
msgid "Widget title"
|
||||
msgstr "Titlu widget"
|
||||
|
||||
#: front-end-editor.php:146
|
||||
msgid "Text widget content"
|
||||
msgstr "Conținut widget text"
|
||||
|
||||
#: front-end-editor.php:152
|
||||
msgid "Site title and description"
|
||||
msgstr "Titlu și descriere site"
|
||||
|
||||
#: front-end-editor.php:158
|
||||
msgid "Site options"
|
||||
msgstr "Setări site"
|
||||
|
||||
#: front-end-editor.php:164
|
||||
msgid "Theme images"
|
||||
msgstr "Imagini temă"
|
||||
|
||||
#: scb/AdminPage.php:158
|
||||
#: scb/AdminPage.php:169
|
||||
msgid "Save Changes"
|
||||
msgstr "Salvează schimbările"
|
||||
|
||||
#: scb/AdminPage.php:272
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Setări <strong>salvate</strong>."
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr ""
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Permite editarea articolelor fără a merge în interfața de administrare"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "Rich text editor"
|
||||
#~ msgstr "Editor de text avansat"
|
||||
#~ msgid "Edit paragraphs"
|
||||
#~ msgstr "Editează paragrafe"
|
||||
#~ msgid "Date reset"
|
||||
#~ msgstr "Resetare dată"
|
||||
#~ msgid "Highlighting"
|
||||
#~ msgstr "Evidențiere"
|
||||
#~ msgid "Use default"
|
||||
#~ msgstr "Folosește imaginea implicită"
|
||||
#~ msgid "Field name"
|
||||
#~ msgstr "Nume câmp"
|
||||
#~ msgid "Save changes"
|
||||
#~ msgstr "Salvează schimbările"
|
||||
#~ msgid "[none]"
|
||||
#~ msgstr "[niciuna]"
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-08-25 19:18+0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: BoreS <BoreSer@gmail.com>\n"
|
||||
"Language-Team: BoreS <BoreSer@gmail.com>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Russian\n"
|
||||
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
||||
|
||||
#. #-#-#-#-# front-end-editor.pot (Front-end Editor 1.2b) #-#-#-#-#
|
||||
#. Plugin Name of an extension
|
||||
#: admin.php:9
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#: admin.php:12
|
||||
msgid "Fields"
|
||||
msgstr "Поля"
|
||||
|
||||
#: admin.php:13
|
||||
#: scb/AdminPage.php:338
|
||||
msgid "Settings"
|
||||
msgstr "Настройки"
|
||||
|
||||
#: admin.php:43
|
||||
#: admin.php:87
|
||||
#: scb/AdminPage.php:105
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Настройки <strong>сохранены</strong>."
|
||||
|
||||
#: admin.php:49
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Включить или отключить редактируемые поля"
|
||||
|
||||
#: admin.php:55
|
||||
msgid "Field name"
|
||||
msgstr "Название поля"
|
||||
|
||||
#: admin.php:94
|
||||
msgid "Rich text editor"
|
||||
msgstr "Расширенный редактор текста"
|
||||
|
||||
#: admin.php:95
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Включить визуальный редактор"
|
||||
|
||||
#: admin.php:101
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Редактирвать абзацы"
|
||||
|
||||
#: admin.php:102
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Редактировать абзац вместо целого поста"
|
||||
|
||||
#: core.php:109
|
||||
msgid "Save"
|
||||
msgstr "Сохранить"
|
||||
|
||||
#: core.php:110
|
||||
msgid "Cancel"
|
||||
msgstr "Отменить"
|
||||
|
||||
#: core.php:235
|
||||
msgid "empty"
|
||||
msgstr "пусто"
|
||||
|
||||
#: fields.php:453
|
||||
msgid "Post/page title"
|
||||
msgstr "Заголовок сообщения/страницы"
|
||||
|
||||
#: fields.php:459
|
||||
msgid "Post/page content"
|
||||
msgstr "Содержимое сообщения/страницы"
|
||||
|
||||
#: fields.php:465
|
||||
msgid "Post/page excerpt"
|
||||
msgstr "Выдержка сообщения/страницы"
|
||||
|
||||
#: fields.php:471
|
||||
msgid "Post tags"
|
||||
msgstr "Метки сообщения"
|
||||
|
||||
#: fields.php:477
|
||||
msgid "Post terms"
|
||||
msgstr "Термины сообщения"
|
||||
|
||||
#: fields.php:483
|
||||
msgid "Post/page custom fields"
|
||||
msgstr "Настраиваемые поля сообщения/страницы"
|
||||
|
||||
#: fields.php:489
|
||||
msgid "Comment text"
|
||||
msgstr "Текст комментария"
|
||||
|
||||
#: fields.php:495
|
||||
msgid "Author description"
|
||||
msgstr "Описание автора"
|
||||
|
||||
#: fields.php:502
|
||||
msgid "Text widget content"
|
||||
msgstr "Содержимое текстового виджета"
|
||||
|
||||
#: fields.php:508
|
||||
msgid "Text widget title"
|
||||
msgstr "Заголовок текстового виджета"
|
||||
|
||||
#: scb/AdminPage.php:163
|
||||
msgid "Save Changes"
|
||||
msgstr "Сохранить изменения"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Позволяет редактировать сообщения без использования администраторской панели"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR scribu
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
"Project-Id-Version: Front-end Editor 1.0a\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-06-14 18:58+0300\n"
|
||||
"PO-Revision-Date: 2009-06-16 19:40+0100\n"
|
||||
"Last-Translator: Müfit Kiper <kontakt@kitkonsult.se>\n"
|
||||
"Language-Team: Swedish - Svenska <kontakt@kitkonsult.se>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Poedit-Language: Swedish\n"
|
||||
"X-Poedit-Country: SWEDEN\n"
|
||||
"X-Poedit-SourceCharset: utf-8\n"
|
||||
|
||||
#: admin.php:32
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Inställningar <strong>sparade</strong>."
|
||||
|
||||
#: admin.php:38
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Aktivera eller inaktivera redigerbara fält"
|
||||
|
||||
#: admin.php:44
|
||||
msgid "Field name"
|
||||
msgstr "Fältnamn"
|
||||
|
||||
#: admin.php:65
|
||||
#: admin.php:85
|
||||
msgid "Save changes"
|
||||
msgstr "Spara ändringar"
|
||||
|
||||
#: admin.php:67
|
||||
msgid "Settings"
|
||||
msgstr "Inställningar"
|
||||
|
||||
#: admin.php:71
|
||||
msgid "Rich text editor"
|
||||
msgstr "Avancerad textredigerare"
|
||||
|
||||
#: admin.php:72
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "Aktivera WYSIWYG-redigeraren"
|
||||
|
||||
#: admin.php:78
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Redigera stycken (paragrafer)"
|
||||
|
||||
#: admin.php:79
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Redigera ett stycke (paragraf) åt gången istället för hela inlägget"
|
||||
|
||||
#: core.php:98
|
||||
msgid "Save"
|
||||
msgstr "Spara"
|
||||
|
||||
#: core.php:99
|
||||
msgid "Cancel"
|
||||
msgstr "Avbryt"
|
||||
|
||||
#: fields.php:391
|
||||
msgid "Post/page title"
|
||||
msgstr "Sidans/Inläggets rubrik"
|
||||
|
||||
#: fields.php:397
|
||||
msgid "Post/page content"
|
||||
msgstr "Sidans/Inläggets brödtext"
|
||||
|
||||
#: fields.php:403
|
||||
msgid "Post/page excerpt"
|
||||
msgstr "Sidans/Inläggets ingress"
|
||||
|
||||
#: fields.php:409
|
||||
msgid "Post tags"
|
||||
msgstr "Sidans etiketter"
|
||||
|
||||
#: fields.php:415
|
||||
msgid "Post/page custom fields"
|
||||
msgstr "Sidans/Inläggets speciella fält"
|
||||
|
||||
#: fields.php:421
|
||||
msgid "Comment text"
|
||||
msgstr "Kommentartext"
|
||||
|
||||
#: fields.php:427
|
||||
msgid "Text widget content"
|
||||
msgstr "Text widgets innehåll"
|
||||
|
||||
#: fields.php:432
|
||||
msgid "Text widget title"
|
||||
msgstr "Text widgets rubrik"
|
||||
|
||||
#: inc/scb-check.php:45
|
||||
msgid "Install now"
|
||||
msgstr "Installera nu"
|
||||
|
||||
#. Plugin Name of an extension
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Gör det möjligt att redigera dina inlägg och sidor utan att behöva gå bakvägen via administrationsgränssnittet"
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2009-07-04 19:18+0300\n"
|
||||
"PO-Revision-Date: \n"
|
||||
"Last-Translator: scribu <scribu@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: admin.php:10
|
||||
msgid "Fields"
|
||||
msgstr "Alanlar"
|
||||
|
||||
#: admin.php:11
|
||||
#: inc/scb/AdminPage.php:275
|
||||
msgid "Settings"
|
||||
msgstr "Ayarlar"
|
||||
|
||||
#: admin.php:41
|
||||
#: admin.php:85
|
||||
#: inc/scb/AdminPage.php:107
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr "Ayarlar <strong>kaydedildi</strong>."
|
||||
|
||||
#: admin.php:47
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr "Düzenlenebilecek alanları etkinleştir veya pasifleştir"
|
||||
|
||||
#: admin.php:53
|
||||
msgid "Field name"
|
||||
msgstr "Alan adı"
|
||||
|
||||
#: admin.php:74
|
||||
#: admin.php:106
|
||||
msgid "Save changes"
|
||||
msgstr "Değişiklikleri kaydet"
|
||||
|
||||
#: admin.php:92
|
||||
msgid "Rich text editor"
|
||||
msgstr "Görsel metin düzenleyicisi "
|
||||
|
||||
#: admin.php:93
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr "WYSIWYG'yi etkinleştir"
|
||||
|
||||
#: admin.php:99
|
||||
msgid "Edit paragraphs"
|
||||
msgstr "Paragraflari düzenle"
|
||||
|
||||
#: admin.php:100
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr "Bütün bir yazıyı düzenlemek yerine, paragrafları birer birer düzenle"
|
||||
|
||||
#: core.php:98
|
||||
msgid "Save"
|
||||
msgstr "Kaydet"
|
||||
|
||||
#: core.php:99
|
||||
msgid "Cancel"
|
||||
msgstr "İptal"
|
||||
|
||||
#: fields.php:241
|
||||
msgid "[none]"
|
||||
msgstr "[hiçbiri]"
|
||||
|
||||
#: fields.php:397
|
||||
msgid "Post/page title"
|
||||
msgstr "Yazı/sayfa başlığı"
|
||||
|
||||
#: fields.php:403
|
||||
msgid "Post/page content"
|
||||
msgstr "Yazı/sayfa içeriği"
|
||||
|
||||
#: fields.php:409
|
||||
msgid "Post/page excerpt"
|
||||
msgstr "Yazı/sayfa özeti"
|
||||
|
||||
#: fields.php:415
|
||||
msgid "Post tags"
|
||||
msgstr "Yazı etiketleri"
|
||||
|
||||
#: fields.php:421
|
||||
msgid "Post/page custom fields"
|
||||
msgstr "Yazı/sayfa özel alanları"
|
||||
|
||||
#: fields.php:427
|
||||
msgid "Comment text"
|
||||
msgstr "Yorum metni"
|
||||
|
||||
#: fields.php:433
|
||||
msgid "Text widget content"
|
||||
msgstr "Metin widget içeriği"
|
||||
|
||||
#: fields.php:438
|
||||
msgid "Text widget title"
|
||||
msgstr "Metin widget başlığı"
|
||||
|
||||
#. Plugin Name of an extension
|
||||
msgid "Front-end Editor"
|
||||
msgstr "Front-end Editor"
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr "http://scribu.net/wordpress/front-end-editor"
|
||||
|
||||
# Descripción de una extensión
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr "Admin ekranına girmeden yazılarınızı değiştirmenizi sağlar. "
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr "scribu"
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr "http://scribu.net/"
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
# Translation of the WordPress plugin Front-end Editor 1.8a5 by scribu.
|
||||
# Copyright (C) 2010 scribu
|
||||
# This file is distributed under the same license as the Front-end Editor package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Front-end Editor 1.8a5\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/front-end-editor\n"
|
||||
"POT-Creation-Date: 2010-04-01 04:57+0300\n"
|
||||
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#. #-#-#-#-# front-end-editor.pot (Front-end Editor 1.8a5) #-#-#-#-#
|
||||
#. Plugin Name of an extension
|
||||
#: admin.php:8
|
||||
msgid "Front-end Editor"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:11
|
||||
msgid "Fields"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:12 scb/AdminPage.php:329
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:64
|
||||
msgid "Enable or disable editable fields"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:66
|
||||
msgid "Post fields"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:67
|
||||
msgid "Other fields"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:111
|
||||
msgid "Enable the WYSIWYG editor"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:117
|
||||
msgid "Edit one paragraph at a time, instead of an entire post"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:123
|
||||
msgid "Reset the post date on each edit"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:129
|
||||
msgid "Highlight editable elements"
|
||||
msgstr ""
|
||||
|
||||
#: admin.php:134
|
||||
msgid "Display a tooltip above editable elements"
|
||||
msgstr ""
|
||||
|
||||
#: core.php:59
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
#: core.php:60
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#: core.php:74
|
||||
msgid "Double-click to edit"
|
||||
msgstr ""
|
||||
|
||||
#: core.php:110
|
||||
msgid "Change Image"
|
||||
msgstr ""
|
||||
|
||||
#: core.php:111
|
||||
msgid "Clear"
|
||||
msgstr ""
|
||||
|
||||
#: fields/base.php:82
|
||||
msgid "empty"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:66
|
||||
msgid "Post title"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:72
|
||||
msgid "Post content"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:78
|
||||
msgid "Post excerpt"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:84
|
||||
msgid "Post categories"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:91
|
||||
msgid "Post tags"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:98
|
||||
msgid "Post terms"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:105
|
||||
msgid "Post custom fields"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:111
|
||||
msgid "Post thumbnail"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:118
|
||||
msgid "Comment text"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:124
|
||||
msgid "Category title"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:129
|
||||
msgid "Tag title"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:134
|
||||
msgid "Author description"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:141
|
||||
msgid "Widget title"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:146
|
||||
msgid "Text widget content"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:152
|
||||
msgid "Site title and description"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:158
|
||||
msgid "Site options"
|
||||
msgstr ""
|
||||
|
||||
#: front-end-editor.php:164
|
||||
msgid "Theme images"
|
||||
msgstr ""
|
||||
|
||||
#: scb/AdminPage.php:158 scb/AdminPage.php:169
|
||||
msgid "Save Changes"
|
||||
msgstr ""
|
||||
|
||||
#: scb/AdminPage.php:272
|
||||
msgid "Settings <strong>saved</strong>."
|
||||
msgstr ""
|
||||
|
||||
#. Plugin URI of an extension
|
||||
msgid "http://scribu.net/wordpress/front-end-editor"
|
||||
msgstr ""
|
||||
|
||||
#. Description of an extension
|
||||
msgid "Allows you to edit your posts without going through the admin interface"
|
||||
msgstr ""
|
||||
|
||||
#. Author of an extension
|
||||
msgid "scribu"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of an extension
|
||||
msgid "http://scribu.net/"
|
||||
msgstr ""
|
||||
@@ -1,319 +0,0 @@
|
||||
=== Front-end Editor ===
|
||||
Contributors: scribu
|
||||
Donate link: http://scribu.net/paypal
|
||||
Tags: inline, editor, edit-in-place, visual, wysiwyg
|
||||
Requires at least: 2.8
|
||||
Tested up to: 3.0
|
||||
Stable tag: trunk
|
||||
|
||||
Want to edit something? Just double-click it!
|
||||
|
||||
== Description ==
|
||||
|
||||
Front-end Editor is a plugin that lets you make changes to your content *directly* from your site. No need to load the admin backend just to correct a typo.
|
||||
|
||||
To edit something, just double-click it!
|
||||
|
||||
The main goals are to be as *fast* as possible and to be *compatible with any theme*.
|
||||
|
||||
**Editable fields:**
|
||||
|
||||
<ul>
|
||||
<li><strong>posts & pages</strong>
|
||||
<ul>
|
||||
<li>title</li>
|
||||
<li>content</li>
|
||||
<li>excerpt</li>
|
||||
<li>categories</li>
|
||||
<li>tags</li>
|
||||
<li>custom taxonomies</li>
|
||||
<li>custom fields</li>
|
||||
<li>thumbnail</li>
|
||||
</ul></li>
|
||||
<li><strong>comments</strong>
|
||||
<ul>
|
||||
<li>content</li>
|
||||
</ul></li>
|
||||
<li><strong>authors</strong>
|
||||
<ul>
|
||||
<li>description</li>
|
||||
</ul></li>
|
||||
<li><strong>widgets</strong>
|
||||
<ul>
|
||||
<li>title</li>
|
||||
<li>text widget content</li>
|
||||
</ul></li>
|
||||
<li><strong>titles</strong>
|
||||
<ul>
|
||||
<li>category</li>
|
||||
<li>tag</li>
|
||||
</ul></li>
|
||||
<li><strong>site info</strong>
|
||||
<ul>
|
||||
<li>title</li>
|
||||
<li>description</li>
|
||||
<li>options</li>
|
||||
</ul></li>
|
||||
<li><strong>theme images</strong>
|
||||
</ul>
|
||||
|
||||
There is a settings page where you can disable editable fields that you don't want.
|
||||
|
||||
**Translations:**
|
||||
|
||||
* Danish - [Georg](http://wordpress.blogos.dk/)
|
||||
* Dutch - [Ron Hartman](http://www.fr-fanatic.com/)
|
||||
* French - [Li-An](http://www.li-an.fr)
|
||||
* Italian - [Gianni Diurno](http://gidibao.net)
|
||||
* Georgian - Levani Melikishvili
|
||||
* German - Gottfried
|
||||
* Japaneze - kzh
|
||||
* Norwegian - John Myrstad
|
||||
* Polish - [Expromo](http://expromo.pl)
|
||||
* Portuguese - [Fernanda Foertter](http://www.hpcprogrammer.com)
|
||||
* Belarusian - [M. Comfi](http://www.comfi.com)
|
||||
* Russian - BoreS
|
||||
* Spanish - [Esteban](http://netmdp.com/)
|
||||
* Swedish - [Müfit Kiper](http://kitkonsult.se/)
|
||||
* Turkish - [Burak Gulbahce](http://www.saylangoz.com/wordpress/)
|
||||
|
||||
If you want to translate this plugin, please read [this](http://scribu.net/wordpress/translating-plugins.html).
|
||||
|
||||
|
||||
== Installation ==
|
||||
|
||||
You can either install it automatically from the WordPress admin, or do it manually:
|
||||
|
||||
1. Unzip "Front-end Editor" archive and put the folder into your plugins folder (/wp-content/plugins/).
|
||||
1. Activate the plugin from the Plugins menu.
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= Error on activation: "Parse error: syntax error, unexpected T_CLASS..." =
|
||||
|
||||
Make sure your host is running PHP 5. Add this line to wp-config.php to check:
|
||||
|
||||
`var_dump(PHP_VERSION);`
|
||||
|
||||
= Why doesn't it work with my theme? =
|
||||
|
||||
See [Common Mistakes in Themes](http://scribu.net/wordpress/front-end-editor/common-mistakes-in-themes.html).
|
||||
|
||||
= Does it work with WP Super Cache? =
|
||||
|
||||
To avoid problems with WP Super Cache or W3 Total Cache, you have to disable caching for logged-in users.
|
||||
|
||||
= If I use this plugin, won't everybody be able to edit my content? =
|
||||
|
||||
No. To edit a field, a user must be logged in and have the right permissions. For example, to edit the post content from the front-end, a user must be able to edit the post content from the regular back-end editor.
|
||||
|
||||
= How can I change the hover color? =
|
||||
|
||||
You can add this line to *style.css* in your theme directory:
|
||||
|
||||
`.fee-field:hover, .fee-field:hover * {background-color: mycolor !important}`
|
||||
|
||||
where *mycolor* is one of these values: [CSS colors](http://www.w3schools.com/CSS/css_colors.asp).
|
||||
|
||||
= How can I edit custom fields? =
|
||||
|
||||
Since custom fields can be used in so many ways, you have to make some code replacements in your theme:
|
||||
|
||||
Replace something like this:
|
||||
|
||||
`<?php echo get_post_meta($post->ID, 'my_key', true); ?>`
|
||||
|
||||
with this:
|
||||
|
||||
`<?php editable_post_meta(get_the_ID(), 'my_key', 'textarea'); ?>`
|
||||
|
||||
The third parameter is optional and allows you to pick which type of field you want: *input*, *textarea* or *rich*.
|
||||
|
||||
If you have a custom field with multiple values, you can use `get_editable_post_meta()`. For example:
|
||||
|
||||
`
|
||||
<ul>
|
||||
<?php
|
||||
$values = get_editable_post_meta(get_the_ID(), 'my_key');
|
||||
foreach ( $values as $value )
|
||||
echo '<li>' . $value . '</li>';
|
||||
?>
|
||||
</ul>
|
||||
`
|
||||
|
||||
= How can I make theme images editable? =
|
||||
|
||||
Again, you have to modify your theme's code. Replace something like this:
|
||||
|
||||
`<img src="<?php bloginfo('template_url'); ?>/images/header_1.jpg" width="970" height="140" alt="<?php bloginfo('name'); ?> header image 1" title="<?php bloginfo('name'); ?> header image 1" />`
|
||||
|
||||
with this:
|
||||
|
||||
`<?php editable_image('header-1',
|
||||
get_bloginfo('template_url') . '/images/header_1.jpg',
|
||||
array('width' => 970, 'height' => 140, 'alt' => get_bloginfo('name')));
|
||||
?>`
|
||||
|
||||
The editable_image() template tag is located in fields/other.php.
|
||||
|
||||
= Can I make my own editable fields? =
|
||||
|
||||
Yes, but you have to know your way around WordPress' internals. Here is the [developer guide](http://scribu.net/wordpress/front-end-editor/developer-guide.html) to get you started.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. The tooltip
|
||||
2. Editing the post content
|
||||
3. Editing the post title
|
||||
4. Changing a theme image
|
||||
5. The settings page
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 1.8 =
|
||||
* added tooltip
|
||||
* restyled buttons
|
||||
* fixed widget editing
|
||||
* exposed JavaScript field types
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-8.html)
|
||||
|
||||
= 1.7.2 =
|
||||
* fixed narrow textarea problem
|
||||
* fixed IE8 error
|
||||
* included nicEdit upload plugin
|
||||
|
||||
= 1.7.1 =
|
||||
* made date reset optional
|
||||
* better lightbox detection
|
||||
|
||||
= 1.7 =
|
||||
* new editable fields: post thumbnails & arbitrary options
|
||||
* added font-family and font-color buttons to nicEdit
|
||||
* made the nicEdit configuration filterable
|
||||
* dropped Growfield from textareas
|
||||
* load CSS only when needed
|
||||
* standardized CSS ids and classes
|
||||
* renamed hooks from 'front_ed_*' to 'front_end_editor_*'
|
||||
* fixed: when editing the post content, the post date isn't updated
|
||||
* fixed: when editing tags, the input bounces to a new line
|
||||
* fixed: after editing linked post title, the title is not linked anymore
|
||||
* fixed: editable_post_meta() doesn't work outside The Loop
|
||||
* fixed: warning when a NULL is passed to FEE_Field_Base::wrap()
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-7.html)
|
||||
|
||||
= 1.6.1 =
|
||||
* fixed escaping issues
|
||||
|
||||
= 1.6 =
|
||||
* new editable field: post categories
|
||||
* added editing of custom fields with multiple values
|
||||
* added editing of any widget title
|
||||
* improved script loading
|
||||
* added placeholder to editable_post_meta
|
||||
* fixed issue with comment paragraphs
|
||||
* fixed issues with the $post global
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-6.html)
|
||||
|
||||
= 1.5.1 =
|
||||
* fixed auto-upgrade error
|
||||
* added German translation
|
||||
|
||||
= 1.5 =
|
||||
* new editable field: theme images
|
||||
* switched to NicEdit
|
||||
* don't remove blockquotes when editing a single paragraph
|
||||
* better handling of text widgets
|
||||
* compress JS & CSS
|
||||
* compatibility with Ajaxed WordPress plugin
|
||||
* added ES translation
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-5.html)
|
||||
|
||||
= 1.4 =
|
||||
* new editable fields: category title and tag title
|
||||
* added $echo parameter to editable_post_meta()
|
||||
* easier way to restrict editable content
|
||||
* don't load CSS & JS if the current user can't edit any of the fields
|
||||
* switched from Autogrow to Growfield (fixes IE compatibility)
|
||||
* added Georgian translation
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-4.html)
|
||||
|
||||
= 1.3.3 =
|
||||
* fixed duplicate header error
|
||||
|
||||
= 1.3.2 =
|
||||
* site title bugfix
|
||||
|
||||
= 1.3.1 =
|
||||
* settings page bugfix
|
||||
* updated translations
|
||||
|
||||
= 1.3 =
|
||||
* new editable fields: site title & site description
|
||||
* the rich editor respects .alignleft etc.
|
||||
* ability to add extra css to the rich editor via front-end-editor.css
|
||||
* added Polish translation
|
||||
* use id="" instead of rel=""
|
||||
* postThumbs compatibility
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-3.html)
|
||||
|
||||
= 1.2.1 =
|
||||
* widget bugfix
|
||||
|
||||
= 1.2 =
|
||||
* made author description editable
|
||||
* yellow background while hovering over editable field
|
||||
* experimental wysiwyg autogrow
|
||||
* hopefully valid xHTML
|
||||
* HTML code is cleaned up before saving
|
||||
* added Portuguese translation
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-2.html)
|
||||
|
||||
= 1.1.4 =
|
||||
* fix white screen error for non-admins
|
||||
|
||||
= 1.1.3 =
|
||||
* css bugfix
|
||||
* added Belarusian translation
|
||||
* updated italian translation
|
||||
|
||||
= 1.1 =
|
||||
* new editable field: post terms
|
||||
* usability improvements
|
||||
* added Turkish translation
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-1.html)
|
||||
|
||||
= 1.0.6 =
|
||||
* fixed links with target="_blank"
|
||||
* inputs and textareas are focused after double-clicking
|
||||
* added Russian translation
|
||||
|
||||
= 1.0.5 =
|
||||
* added align buttons, fixed autogrow issue
|
||||
* the_title and the_tags improvements
|
||||
* added Swedish translation
|
||||
|
||||
= 1.0 =
|
||||
* single paragraph editing
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-1-0.html)
|
||||
|
||||
= 0.9 =
|
||||
* new editable field: post custom fields
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-0-9.html)
|
||||
|
||||
= 0.8 =
|
||||
* rich text editor (jWYSIWYG)
|
||||
* l10n
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-0-8.html)
|
||||
|
||||
= 0.7 =
|
||||
* settings page
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-0-7.html)
|
||||
|
||||
= 0.6 =
|
||||
* new editable field: post tags
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-0-6.html)
|
||||
|
||||
= 0.5 =
|
||||
* initial release
|
||||
* [more info](http://scribu.net/wordpress/front-end-editor/fee-0-5.html)
|
||||
|
||||
@@ -1,418 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Creates an admin page
|
||||
|
||||
You must set $this->args and define the page_content() method
|
||||
*/
|
||||
|
||||
abstract class scbAdminPage {
|
||||
/** Page args
|
||||
* $toplevel string If not empty, will create a new top level menu
|
||||
* $icon string Path to an icon for the top level menu
|
||||
* $parent string (default: options-general.php)
|
||||
* $capability string (default: 'manage_options')
|
||||
* $page_title string (mandatory)
|
||||
* $menu_title string (default: $page_title)
|
||||
* $page_slug string (default: sanitized $page_title)
|
||||
* $nonce string (default: $page_slug)
|
||||
* $action_link string|bool Text of the action link on the Plugins page (default: 'Settings')
|
||||
*/
|
||||
protected $args;
|
||||
|
||||
// URL to the current plugin directory.
|
||||
// Useful for adding css and js files
|
||||
protected $plugin_url;
|
||||
|
||||
// Created at page init
|
||||
protected $pagehook;
|
||||
|
||||
// scbOptions object holder
|
||||
// Normally, it's used for storing formdata
|
||||
protected $options;
|
||||
|
||||
// l10n
|
||||
protected $textdomain;
|
||||
|
||||
// Formdata used for filling the form elements
|
||||
protected $formdata = array();
|
||||
|
||||
// Registration component
|
||||
private static $registered = array();
|
||||
|
||||
static function register($class, $file, $options = null) {
|
||||
if ( isset(self::$registered[$class]) )
|
||||
return false;
|
||||
|
||||
self::$registered[$class] = array($file, $options);
|
||||
|
||||
add_action('_admin_menu', array(__CLASS__, '_pages_init'));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static function replace($old_class, $new_class) {
|
||||
if ( ! isset(self::$registered[$old_class]) )
|
||||
return false;
|
||||
|
||||
self::$registered[$new_class] = self::$registered[$old_class];
|
||||
unset(self::$registered[$old_class]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static function remove($class) {
|
||||
if ( ! isset(self::$registered[$class]) )
|
||||
return false;
|
||||
|
||||
unset(self::$registered[$class]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static function _pages_init() {
|
||||
foreach ( self::$registered as $class => $args )
|
||||
new $class($args[0], $args[1]);
|
||||
}
|
||||
|
||||
// ____________MAIN METHODS____________
|
||||
|
||||
|
||||
// Constructor
|
||||
function __construct($file, $options = NULL) {
|
||||
if ( $options !== NULL ) {
|
||||
$this->options = $options;
|
||||
$this->formdata = $this->options->get();
|
||||
}
|
||||
|
||||
$this->file = $file;
|
||||
$this->plugin_url = plugin_dir_url($file);
|
||||
|
||||
$this->setup();
|
||||
$this->check_args();
|
||||
|
||||
add_action('admin_menu', array($this, 'page_init'));
|
||||
add_filter('contextual_help', array($this, '_contextual_help'), 10, 2);
|
||||
|
||||
if ( $this->args['action_link'] )
|
||||
add_filter('plugin_action_links_' . plugin_basename($file), array($this, '_action_link'));
|
||||
}
|
||||
|
||||
// This is where all the page args can be set
|
||||
function setup(){}
|
||||
|
||||
// This is where the css and js go
|
||||
// Both wp_enqueue_*() and inline code can be added
|
||||
function page_head(){}
|
||||
|
||||
// This is where the contextual help goes
|
||||
// @return string
|
||||
function page_help(){}
|
||||
|
||||
// A generic page header
|
||||
function page_header() {
|
||||
echo "<div class='wrap'>\n";
|
||||
screen_icon();
|
||||
echo "<h2>" . $this->args['page_title'] . "</h2>\n";
|
||||
}
|
||||
|
||||
// This is where the page content goes
|
||||
abstract function page_content();
|
||||
|
||||
// A generic page footer
|
||||
function page_footer() {
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
// This is where the form data should be validated
|
||||
function validate($new_data, $old_data) {
|
||||
return $new_data;
|
||||
}
|
||||
|
||||
// A generic form handler
|
||||
function form_handler() {
|
||||
if ( empty($_POST['action']) )
|
||||
return false;
|
||||
|
||||
check_admin_referer($this->nonce);
|
||||
|
||||
foreach ( $this->formdata as $name => $value )
|
||||
$new_data[$name] = @$_POST[$name];
|
||||
|
||||
$this->formdata = $this->validate($new_data, $this->formdata);
|
||||
|
||||
if ( isset($this->options) )
|
||||
$this->options->update($this->formdata);
|
||||
|
||||
$this->admin_msg();
|
||||
}
|
||||
|
||||
|
||||
// ____________UTILITIES____________
|
||||
|
||||
|
||||
// Generates a form submit button
|
||||
function submit_button($value = '', $action = 'action', $class = "button") {
|
||||
if ( is_array($value) ) {
|
||||
extract(wp_parse_args($value, array(
|
||||
'value' => __('Save Changes', $this->textdomain),
|
||||
'action' => 'action',
|
||||
'class' => 'button',
|
||||
'ajax' => true
|
||||
)));
|
||||
|
||||
if ( ! $ajax )
|
||||
$class .= ' no-ajax';
|
||||
}
|
||||
else {
|
||||
if ( empty($value) )
|
||||
$value = __('Save Changes', $this->textdomain);
|
||||
}
|
||||
|
||||
$input_args = array(
|
||||
'type' => 'submit',
|
||||
'names' => $action,
|
||||
'values' => $value,
|
||||
'extra' => '',
|
||||
'desc' => false
|
||||
);
|
||||
|
||||
if ( ! empty($class) )
|
||||
$input_args['extra'] = "class='{$class}'";
|
||||
|
||||
$output = "<p class='submit'>\n" . scbForms::input($input_args) . "</p>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*
|
||||
Mimics scbForms::form_wrap()
|
||||
|
||||
$this->form_wrap($content); // generates a form with a default submit button
|
||||
|
||||
$this->form_wrap($content, false); // generates a form with no submit button
|
||||
|
||||
// the second argument is sent to submit_button()
|
||||
$this->form_wrap($content, array(
|
||||
'text' => 'Save changes',
|
||||
'name' => 'action',
|
||||
'ajax' => true,
|
||||
));
|
||||
*/
|
||||
function form_wrap($content, $submit_button = true) {
|
||||
if ( is_array($submit_button) ) {
|
||||
$content .= call_user_func(array($this, 'submit_button'), $submit_button);
|
||||
} elseif ( true === $submit_button ) {
|
||||
$content .= $this->submit_button();
|
||||
} elseif ( false !== strpos($submit_button, '<input') ) {
|
||||
$content .= $submit_button;
|
||||
} elseif ( false !== $submit_button ) {
|
||||
$button_args = array_slice(func_get_args(), 1);
|
||||
$content .= call_user_func_array(array($this, 'submit_button'), $button_args);
|
||||
}
|
||||
|
||||
return scbForms::form_wrap($content, $this->nonce);
|
||||
}
|
||||
|
||||
// See scbForms::input()
|
||||
function input($args, $options = NULL) {
|
||||
if ( $options === NULL )
|
||||
$options = $this->formdata;
|
||||
|
||||
return scbForms::input($args, $options);
|
||||
}
|
||||
|
||||
// See scbForms::form()
|
||||
function form($rows, $options = NULL) {
|
||||
if ( $options === NULL )
|
||||
$options = $this->formdata;
|
||||
|
||||
return scbForms::form($rows, $options, $this->nonce);
|
||||
}
|
||||
|
||||
// See scbForms::table()
|
||||
function table($rows, $options = NULL) {
|
||||
if ( $options === NULL )
|
||||
$options = $this->formdata;
|
||||
|
||||
return scbForms::table($rows, $options);
|
||||
}
|
||||
|
||||
// See scbForms::table_row()
|
||||
function table_row($row, $options = NULL) {
|
||||
if ( $options === NULL )
|
||||
$options = $this->formdata;
|
||||
|
||||
return scbForms::table_row($row, $options);
|
||||
}
|
||||
|
||||
// Mimics scbForms::form_table()
|
||||
function form_table($rows, $options = NULL) {
|
||||
$output = $this->table($rows, $options);
|
||||
|
||||
$args = array_slice(func_get_args(), 2);
|
||||
array_unshift($args, $output);
|
||||
|
||||
return call_user_func_array(array($this, 'form_wrap'), $args);
|
||||
}
|
||||
|
||||
// Mimics scbForms::form_table_wrap()
|
||||
function form_table_wrap($content) {
|
||||
$output = self::table_wrap($content);
|
||||
|
||||
$args = array_slice(func_get_args(), 1);
|
||||
array_unshift($args, $output);
|
||||
|
||||
return call_user_func_array(array($this, 'form_wrap'), $args);
|
||||
}
|
||||
|
||||
// Generates a standard admin notice
|
||||
function admin_msg($msg = '', $class = "updated") {
|
||||
if ( empty($msg) )
|
||||
$msg = __('Settings <strong>saved</strong>.', $this->textdomain);
|
||||
|
||||
echo "<div class='$class fade'><p>$msg</p></div>\n";
|
||||
}
|
||||
|
||||
// Wraps a string in a <script> tag
|
||||
function js_wrap($string) {
|
||||
return "\n<script type='text/javascript'>\n" . $string . "\n</script>\n";
|
||||
}
|
||||
|
||||
// Wraps a string in a <style> tag
|
||||
function css_wrap($string) {
|
||||
return "\n<style type='text/css'>\n" . $string . "\n</style>\n";
|
||||
}
|
||||
|
||||
|
||||
// ____________INTERNAL METHODS____________
|
||||
|
||||
function __call($method, $args) {
|
||||
return call_user_func_array(array('scbForms', $method), $args);
|
||||
}
|
||||
|
||||
|
||||
// Registers a page
|
||||
function page_init() {
|
||||
extract($this->args);
|
||||
|
||||
if ( ! $toplevel ) {
|
||||
$this->pagehook = add_submenu_page($parent, $page_title, $menu_title, $capability, $page_slug, array($this, '_page_content_hook'));
|
||||
} else {
|
||||
$func = 'add_' . $toplevel . '_page';
|
||||
$this->pagehook = $func($page_title, $menu_title, $capability, $page_slug, array($this, '_page_content_hook'), $icon_url);
|
||||
}
|
||||
|
||||
if ( ! $this->pagehook )
|
||||
return;
|
||||
|
||||
if ( $ajax_submit ) {
|
||||
$this->ajax_response();
|
||||
add_action('admin_footer', array($this, 'ajax_submit'), 20);
|
||||
}
|
||||
|
||||
add_action('admin_print_styles-' . $this->pagehook, array($this, 'page_head'));
|
||||
}
|
||||
|
||||
private function check_args() {
|
||||
if ( empty($this->args['page_title']) )
|
||||
trigger_error('Page title cannot be empty', E_USER_WARNING);
|
||||
|
||||
$this->args = wp_parse_args($this->args, array(
|
||||
'toplevel' => '',
|
||||
'icon' => '',
|
||||
'parent' => 'options-general.php',
|
||||
'capability' => 'manage_options',
|
||||
'menu_title' => $this->args['page_title'],
|
||||
'page_slug' => '',
|
||||
'nonce' => '',
|
||||
'action_link' => __('Settings', $this->textdomain),
|
||||
'ajax_submit' => false,
|
||||
));
|
||||
|
||||
if ( empty($this->args['page_slug']) )
|
||||
$this->args['page_slug'] = sanitize_title_with_dashes($this->args['menu_title']);
|
||||
|
||||
if ( empty($this->args['nonce']) )
|
||||
$this->nonce = $this->args['page_slug'];
|
||||
}
|
||||
|
||||
function _contextual_help($help, $screen) {
|
||||
if ( is_object($screen) )
|
||||
$screen = $screen->id;
|
||||
|
||||
if ( $screen == $this->pagehook && $actual_help = $this->page_help() )
|
||||
return $actual_help;
|
||||
|
||||
return $help;
|
||||
}
|
||||
|
||||
function ajax_response() {
|
||||
if ( ! isset($_POST['_ajax_submit']) || $_POST['_ajax_submit'] != $this->pagehook )
|
||||
return;
|
||||
|
||||
$this->form_handler();
|
||||
die;
|
||||
}
|
||||
|
||||
function ajax_submit() {
|
||||
global $page_hook;
|
||||
|
||||
if ( $page_hook != $this->pagehook )
|
||||
return;
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
var $spinner = $(new Image()).attr('src', '<?php echo admin_url("images/wpspin_light.gif"); ?>');
|
||||
|
||||
$(':submit').click(function(ev){
|
||||
var $submit = $(this);
|
||||
var $form = $submit.parents('form');
|
||||
|
||||
if ( $submit.hasClass('no-ajax') || $form.attr('method').toLowerCase() != 'post' )
|
||||
return true;
|
||||
|
||||
var $this_spinner = $spinner.clone();
|
||||
|
||||
$submit.before($this_spinner).hide();
|
||||
|
||||
var data = $form.serializeArray();
|
||||
data.push({name: $submit.attr('name'), value: $submit.val()});
|
||||
data.push({name: '_ajax_submit', value: '<?php echo $this->pagehook; ?>'});
|
||||
|
||||
$.post(location.href, data, function(response){
|
||||
var $prev = $('.wrap > .updated, .wrap > .error');
|
||||
var $msg = $(response).hide().insertAfter($('.wrap h2'));
|
||||
if ( $prev.length > 0 )
|
||||
$prev.fadeOut('slow', function(){ $msg.fadeIn('slow'); });
|
||||
else
|
||||
$msg.fadeIn('slow');
|
||||
|
||||
$this_spinner.hide();
|
||||
$submit.show();
|
||||
});
|
||||
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
function _page_content_hook() {
|
||||
$this->form_handler();
|
||||
|
||||
$this->page_header();
|
||||
$this->page_content();
|
||||
$this->page_footer();
|
||||
}
|
||||
|
||||
function _action_link($links) {
|
||||
$url = add_query_arg('page', $this->args['page_slug'], admin_url($this->args['parent']));
|
||||
$links[] = "<a href='$url'>" . $this->args['action_link'] . "</a>";
|
||||
|
||||
return $links;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,226 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Creates an admin page with widgets, similar to the dashboard
|
||||
|
||||
For example, if you defined the boxes like this:
|
||||
|
||||
$this->boxes = array(
|
||||
array('settings', 'Settings box', 'normal')
|
||||
...
|
||||
);
|
||||
|
||||
You must also define two methods in your class for each box:
|
||||
|
||||
function settings_box() - this is where the box content is echoed
|
||||
function settings_handler() - this is where the box settings are saved
|
||||
...
|
||||
*/
|
||||
abstract class scbBoxesPage extends scbAdminPage {
|
||||
/*
|
||||
A box definition looks like this:
|
||||
array($slug, $title, $column);
|
||||
|
||||
Available columns: normal, side, column3, column4
|
||||
*/
|
||||
protected $boxes = array();
|
||||
|
||||
function __construct($file, $options = null) {
|
||||
parent::__construct($file, $options);
|
||||
|
||||
// too late
|
||||
scbUtil::add_uninstall_hook($this->file, array($this, 'uninstall'));
|
||||
}
|
||||
|
||||
function page_init() {
|
||||
if ( !isset($this->args['columns']) )
|
||||
$this->args['columns'] = 2;
|
||||
|
||||
parent::page_init();
|
||||
|
||||
add_action('load-' . $this->pagehook, array($this, 'boxes_init'));
|
||||
add_filter('screen_layout_columns', array($this, 'columns'));
|
||||
}
|
||||
|
||||
function default_css() {
|
||||
?>
|
||||
<style type="text/css">
|
||||
.meta-box-sortables {margin: 0 5px !important}
|
||||
.inside {clear:both; overflow:hidden; padding: 10px 10px 0 10px !important}
|
||||
.inside table {margin: 0 !important; padding: 0 !important}
|
||||
.inside table td {vertical-align: middle !important}
|
||||
.inside table .regular-text {width: 100% !important}
|
||||
.inside .form-table th {width: 30%; max-width: 200px; padding: 10px 0 !important}
|
||||
.inside .widefat .check-column {padding-bottom: 7px !important}
|
||||
.inside p, .inside table {margin: 0 0 10px 0 !important}
|
||||
.inside p.submit {float:left !important; padding: 0 !important}
|
||||
</style>
|
||||
<?php
|
||||
}
|
||||
|
||||
function page_content() {
|
||||
$this->default_css();
|
||||
|
||||
global $screen_layout_columns;
|
||||
|
||||
if ( isset($screen_layout_columns) ) {
|
||||
$hide2 = $hide3 = $hide4 = '';
|
||||
switch ( $screen_layout_columns ) {
|
||||
case 4:
|
||||
$width = 'width:24.5%;';
|
||||
break;
|
||||
case 3:
|
||||
$width = 'width:32.67%;';
|
||||
$hide4 = 'display:none;';
|
||||
break;
|
||||
case 2:
|
||||
$width = 'width:49%;';
|
||||
$hide3 = $hide4 = 'display:none;';
|
||||
break;
|
||||
default:
|
||||
$width = 'width:98%;';
|
||||
$hide2 = $hide3 = $hide4 = 'display:none;';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div id='<?php echo $this->pagehook ?>-widgets' class='metabox-holder'>
|
||||
<?php
|
||||
echo "\t<div class='postbox-container' style='$width'>\n";
|
||||
do_meta_boxes( $this->pagehook, 'normal', '' );
|
||||
|
||||
echo "\t</div><div class='postbox-container' style='{$hide2}$width'>\n";
|
||||
do_meta_boxes( $this->pagehook, 'side', '' );
|
||||
|
||||
echo "\t</div><div class='postbox-container' style='{$hide3}$width'>\n";
|
||||
do_meta_boxes( $this->pagehook, 'column3', '' );
|
||||
|
||||
echo "\t</div><div class='postbox-container' style='{$hide4}$width'>\n";
|
||||
do_meta_boxes( $this->pagehook, 'column4', '' );
|
||||
?>
|
||||
</div></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function page_footer() {
|
||||
$this->_boxes_js_init();
|
||||
parent::page_footer();
|
||||
}
|
||||
|
||||
function form_handler() {
|
||||
if ( empty($_POST) )
|
||||
return;
|
||||
|
||||
check_admin_referer($this->nonce);
|
||||
|
||||
// Box handler
|
||||
foreach ( $this->boxes as $box ) {
|
||||
$args = isset($box[4]) ? $box[4] : array();
|
||||
|
||||
$handler = $box[0] . '_handler';
|
||||
|
||||
if ( method_exists($this, $handler) )
|
||||
call_user_func_array(array($this, $handler), $args);
|
||||
}
|
||||
|
||||
if ( $this->options )
|
||||
$this->formdata = $this->options->get();
|
||||
}
|
||||
|
||||
function columns($columns) {
|
||||
$columns[$this->pagehook] = $this->args['columns'];
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
function uninstall() {
|
||||
global $wpdb;
|
||||
|
||||
$hook = str_replace('-', '', $this->pagehook);
|
||||
|
||||
foreach ( array('metaboxhidden', 'closedpostboxes', 'wp_metaboxorder', 'screen_layout') as $option )
|
||||
$keys[] = "'{$option}_{$hook}'";
|
||||
|
||||
$keys = '(' . implode(', ', $keys) . ')';
|
||||
|
||||
$wpdb->query("
|
||||
DELETE FROM {$wpdb->usermeta}
|
||||
WHERE meta_key IN {$keys}
|
||||
");
|
||||
}
|
||||
|
||||
function boxes_init() {
|
||||
wp_enqueue_script('common');
|
||||
wp_enqueue_script('wp-lists');
|
||||
wp_enqueue_script('postbox');
|
||||
|
||||
$registered = array();
|
||||
foreach($this->boxes as $box_args) {
|
||||
@list($name, $title, $context, $priority, $args) = $box_args;
|
||||
|
||||
if ( empty($title) )
|
||||
$title = ucfirst($name);
|
||||
if ( empty($context) )
|
||||
$context = 'normal';
|
||||
if ( empty($priority) )
|
||||
$priority = 'default';
|
||||
if ( empty($args) )
|
||||
$args = array();
|
||||
|
||||
if ( isset($registered[$name]) ) {
|
||||
if ( empty($args) )
|
||||
trigger_error("Duplicate box name: $name", E_USER_NOTICE);
|
||||
|
||||
$name = $this->_increment($name);
|
||||
} else {
|
||||
$registered[$name] = true;
|
||||
}
|
||||
|
||||
add_meta_box($name, $title, array($this, '_intermediate_callback'), $this->pagehook, $context, $priority, $args);
|
||||
}
|
||||
}
|
||||
|
||||
// Make it so that $args is actually what's passed to the callback
|
||||
function _intermediate_callback($_, $box) {
|
||||
list($name) = explode('-', $box['id']);
|
||||
|
||||
call_user_func_array(array($this, $name . '_box'), $box['args']);
|
||||
}
|
||||
|
||||
private function _increment($name) {
|
||||
$parts = explode('-', $name);
|
||||
if ( isset($parts[1]) )
|
||||
$parts[1]++;
|
||||
else
|
||||
$parts[1] = 2;
|
||||
|
||||
return implode('-', $parts);
|
||||
}
|
||||
|
||||
// Adds necesary code for JS to work
|
||||
function _boxes_js_init() {
|
||||
echo $this->js_wrap(
|
||||
<<<EOT
|
||||
//<![CDATA[
|
||||
jQuery(document).ready( function($){
|
||||
// close postboxes that should be closed
|
||||
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
||||
// postboxes setup
|
||||
postboxes.add_postbox_toggles('$this->pagehook');
|
||||
});
|
||||
//]]>
|
||||
EOT
|
||||
);
|
||||
?>
|
||||
|
||||
<form style='display: none' method='get' action=''>
|
||||
<p>
|
||||
<?php
|
||||
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
||||
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
||||
?>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,464 +0,0 @@
|
||||
<?php
|
||||
|
||||
class scbForms {
|
||||
const token = '%input%';
|
||||
|
||||
/* Generates one or more form elements of the same type,
|
||||
including <select>s and <textarea>s.
|
||||
|
||||
$args = array (
|
||||
'type' => string (mandatory)
|
||||
'name' => string | array (mandatory)
|
||||
'value' => string | array
|
||||
'desc' => string | array | false
|
||||
'desc_pos' => 'before' | 'after' | 'foo %input% bar' (default: after)
|
||||
'extra' => string (default: class="regular-text")
|
||||
);
|
||||
|
||||
$formdata = associative array with the formdata with which to fill the elements
|
||||
*/
|
||||
|
||||
protected static $args;
|
||||
protected static $formdata = array();
|
||||
|
||||
static function input($args, $formdata = array()) {
|
||||
$args = self::validate_data($args);
|
||||
|
||||
$error = false;
|
||||
foreach ( array('name', 'value') as $key ) {
|
||||
$old = $key . 's';
|
||||
|
||||
if ( isset($args[$old]) ) {
|
||||
$args[$key] = $args[$old];
|
||||
unset($args[$old]);
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isset($args['name']) || empty($args['name']) )
|
||||
return trigger_error("Empty name", E_USER_WARNING);
|
||||
|
||||
self::$args = $args;
|
||||
self::$formdata = self::validate_data($formdata);
|
||||
|
||||
switch ( $args['type'] ) {
|
||||
case 'select': return self::_select();
|
||||
case 'textarea': return self::_textarea();
|
||||
default: return self::_input();
|
||||
}
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
static function select($args, $options = array()) {
|
||||
if ( !empty($options) )
|
||||
$args['value'] = $options;
|
||||
|
||||
self::$args = $args;
|
||||
|
||||
return self::_select();
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
static function textarea($args, $content = '') {
|
||||
if ( !empty($content) )
|
||||
$args['value'] = $content;
|
||||
|
||||
self::$args = $args;
|
||||
|
||||
return self::_textarea();
|
||||
}
|
||||
|
||||
|
||||
// ____________UTILITIES____________
|
||||
|
||||
|
||||
// Generates a table wrapped in a form
|
||||
static function form_table($rows, $formdata = NULL) {
|
||||
$output = '';
|
||||
foreach ( $rows as $row )
|
||||
$output .= self::table_row($row, $formdata);
|
||||
|
||||
$output = self::form_table_wrap($output);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Generates a form
|
||||
static function form($inputs, $formdata = NULL, $nonce) {
|
||||
$output = '';
|
||||
foreach ( $inputs as $input )
|
||||
$output .= self::input($input, $formdata);
|
||||
|
||||
$output = self::form_wrap($output, $nonce);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Generates a table
|
||||
static function table($rows, $formdata = NULL) {
|
||||
$output = '';
|
||||
foreach ( $rows as $row )
|
||||
$output .= self::table_row($row, $formdata);
|
||||
|
||||
$output = self::table_wrap($output);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Generates a table row
|
||||
static function table_row($args, $formdata = NULL) {
|
||||
return self::row_wrap($args['title'], self::input($args, $formdata));
|
||||
}
|
||||
|
||||
|
||||
// ____________WRAPPERS____________
|
||||
|
||||
|
||||
// Wraps the given content in a <form><table>
|
||||
static function form_table_wrap($content, $nonce = 'update_options') {
|
||||
$output = self::table_wrap($content);
|
||||
$output = self::form_wrap($output, $nonce);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Wraps the given content in a <form>
|
||||
static function form_wrap($content, $nonce = 'update_options') {
|
||||
$output = "\n<form method='post' action=''>\n";
|
||||
$output .= $content;
|
||||
$output .= wp_nonce_field($action = $nonce, $name = "_wpnonce", $referer = true , $echo = false);
|
||||
$output .= "\n</form>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Wraps the given content in a <table>
|
||||
static function table_wrap($content) {
|
||||
$output = "\n<table class='form-table'>\n" . $content . "\n</table>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
// Wraps the given content in a <tr><td>
|
||||
static function row_wrap($title, $content) {
|
||||
return "\n<tr>\n\t<th scope='row'>" . $title . "</th>\n\t<td>\n\t\t" . $content . "\t</td>\n\n</tr>";
|
||||
}
|
||||
|
||||
|
||||
// ____________PRIVATE METHODS____________
|
||||
|
||||
|
||||
// Recursivly transform empty arrays to ''
|
||||
private static function validate_data($data) {
|
||||
if ( ! is_array($data) )
|
||||
return $data;
|
||||
|
||||
if ( empty($data) )
|
||||
return '';
|
||||
|
||||
foreach ( $data as $key => &$value )
|
||||
$value = self::validate_data($value);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// From multiple inputs to single inputs
|
||||
private static function _input() {
|
||||
extract(wp_parse_args(self::$args, array(
|
||||
'name' => NULL,
|
||||
'value' => NULL,
|
||||
'desc' => NULL,
|
||||
'checked' => NULL,
|
||||
)));
|
||||
|
||||
$m_name = is_array($name);
|
||||
$m_value = is_array($value);
|
||||
$m_desc = is_array($desc);
|
||||
|
||||
// Correct name
|
||||
if ( !$m_name && $m_value
|
||||
&& 'checkbox' == $type
|
||||
&& false === strpos($name, '[')
|
||||
)
|
||||
$args['name'] = $name = $name . '[]';
|
||||
|
||||
// Expand names or values
|
||||
if ( !$m_name && !$m_value ) {
|
||||
$a = array($name => $value);
|
||||
}
|
||||
elseif ( $m_name && !$m_value ) {
|
||||
$a = array_fill_keys($name, $value);
|
||||
}
|
||||
elseif ( !$m_name && $m_value ) {
|
||||
$a = array_fill_keys($value, $name);
|
||||
}
|
||||
else {
|
||||
$a = array_combine($name, $value);
|
||||
}
|
||||
|
||||
// Correct descriptions
|
||||
$_after = '';
|
||||
if ( isset($desc) && !$m_desc && false === strpos($desc, self::token) ) {
|
||||
if ( $m_value ) {
|
||||
$_after = $desc;
|
||||
$args['desc'] = $desc = $value;
|
||||
}
|
||||
elseif ( $m_name ) {
|
||||
$_after = $desc;
|
||||
$args['desc'] = $desc = $name;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine what goes where
|
||||
if ( !$m_name && $m_value ) {
|
||||
$i1 = 'val';
|
||||
$i2 = 'name';
|
||||
} else {
|
||||
$i1 = 'name';
|
||||
$i2 = 'val';
|
||||
}
|
||||
|
||||
$func = in_array($type, array('checkbox', 'radio')) ? '_checkbox_single' : '_input_single';
|
||||
|
||||
// Set constant args
|
||||
$const_args = self::array_extract(self::$args, array('type', 'desc_pos', 'checked'));
|
||||
if ( isset($extra) )
|
||||
$const_args['extra'] = explode(' ', $extra);
|
||||
|
||||
$i = 0;
|
||||
foreach ( $a as $name => $val ) {
|
||||
$cur_args = $const_args;
|
||||
|
||||
if ( $$i1 !== NULL )
|
||||
$cur_args['name'] = $$i1;
|
||||
|
||||
if ( $$i2 !== NULL )
|
||||
$cur_args['value'] = $$i2;
|
||||
|
||||
// Set desc
|
||||
if ( is_array($desc) )
|
||||
$cur_args['desc'] = $desc[$i];
|
||||
elseif ( isset($desc) )
|
||||
$cur_args['desc'] = $desc;
|
||||
|
||||
// Find relevant formdata
|
||||
$match = NULL;
|
||||
if ( $checked === NULL ) {
|
||||
$match = @self::$formdata[str_replace('[]', '', $$i1)];
|
||||
if ( is_array($match) ) {
|
||||
$match = $match[$i];
|
||||
}
|
||||
} else if ( is_array($checked) ) {
|
||||
$cur_args['checked'] = isset($checked[$i]) && $checked[$i];
|
||||
}
|
||||
|
||||
$output[] = self::$func($cur_args, $match);
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
return implode("\n", $output) . $_after;
|
||||
}
|
||||
|
||||
// Handle args for checkboxes and radio inputs
|
||||
private static function _checkbox_single($args, $data) {
|
||||
$args = wp_parse_args($args, array(
|
||||
'name' => NULL,
|
||||
'value' => true,
|
||||
'desc_pos' => 'after',
|
||||
'desc' => NULL,
|
||||
'checked' => NULL,
|
||||
'extra' => array(),
|
||||
));
|
||||
|
||||
foreach ( $args as $key => &$val )
|
||||
$$key = &$val;
|
||||
unset($val);
|
||||
|
||||
if ( $checked === NULL && $value == $data )
|
||||
$checked = true;
|
||||
|
||||
if ( $checked )
|
||||
$extra[] = 'checked="checked"';
|
||||
|
||||
if ( $desc === NULL && !is_bool($value) )
|
||||
$desc = str_replace('[]', '', $value);
|
||||
|
||||
return self::_input_gen($args);
|
||||
}
|
||||
|
||||
// Handle args for text inputs
|
||||
private static function _input_single($args, $data) {
|
||||
$args = wp_parse_args($args, array(
|
||||
'value' => stripslashes($data),
|
||||
'desc_pos' => 'after',
|
||||
'extra' => array('class="regular-text"'),
|
||||
));
|
||||
|
||||
foreach ( $args as $key => &$val )
|
||||
$$key = &$val;
|
||||
unset($val);
|
||||
|
||||
if ( FALSE === strpos($name, '[') )
|
||||
$extra[] = "id='{$name}'";
|
||||
|
||||
return self::_input_gen($args);
|
||||
}
|
||||
|
||||
// Generate html with the final args
|
||||
private static function _input_gen($args) {
|
||||
extract(wp_parse_args($args, array(
|
||||
'name' => NULL,
|
||||
'value' => NULL,
|
||||
'desc' => NULL,
|
||||
'extra' => array()
|
||||
)));
|
||||
|
||||
$extra = self::validate_extra($extra, $name);
|
||||
|
||||
$value = esc_attr($value);
|
||||
|
||||
$input = "<input name='{$name}' value='{$value}' type='{$type}'{$extra} /> ";
|
||||
|
||||
return self::add_label($input, $desc, $desc_pos);
|
||||
}
|
||||
|
||||
private static function _select() {
|
||||
extract(wp_parse_args(self::$args, array(
|
||||
'name' => '',
|
||||
'value' => array(),
|
||||
'text' => '',
|
||||
'selected' => array('foo'), // hack to make default blank
|
||||
'extra' => '',
|
||||
'numeric' => false, // use numeric array instead of associative
|
||||
'desc' => '',
|
||||
'desc_pos' => '',
|
||||
)), EXTR_SKIP);
|
||||
|
||||
if ( empty($value) )
|
||||
$value = array('' => '');
|
||||
|
||||
if ( !is_array($value) )
|
||||
return trigger_error("'value' argument is expected to be an array", E_USER_WARNING);
|
||||
|
||||
if ( !self::is_associative($value) && !$numeric )
|
||||
$value = array_combine($value, $value);
|
||||
|
||||
if ( isset(self::$formdata[$name]) )
|
||||
$cur_val = self::$formdata[$name];
|
||||
else
|
||||
$cur_val = $selected;
|
||||
|
||||
if ( false === $text ) {
|
||||
$opts = '';
|
||||
} else {
|
||||
$opts = "\t<option value=''";
|
||||
if ( $cur_val === array('foo') )
|
||||
$opts .= " selected='selected'";
|
||||
$opts .= ">{$text}</option>\n";
|
||||
}
|
||||
|
||||
foreach ( $value as $key => $value ) {
|
||||
if ( empty($key) || empty($value) )
|
||||
continue;
|
||||
|
||||
$cur_extra = array();
|
||||
if ( (string) $key == (string) $cur_val )
|
||||
$cur_extra[] = "selected='selected'";
|
||||
|
||||
$cur_extra = self::validate_extra($cur_extra, $key);
|
||||
|
||||
$opts .= "\t<option value='{$key}'{$cur_extra}>{$value}</option>\n";
|
||||
}
|
||||
|
||||
$extra = self::validate_extra($extra, $name);
|
||||
|
||||
$input = "<select name='{$name}'$extra>\n{$opts}</select>";
|
||||
|
||||
return self::add_label($input, $desc, $desc_pos);
|
||||
}
|
||||
|
||||
private static function _textarea() {
|
||||
extract(wp_parse_args(self::$args, array(
|
||||
'name' => '',
|
||||
'extra' => 'class="widefat"',
|
||||
'value' => '',
|
||||
'escaped' => false,
|
||||
)), EXTR_SKIP);
|
||||
|
||||
if ( !$escaped )
|
||||
$value = wp_htmledit_pre(stripslashes($value));
|
||||
|
||||
$extra = self::validate_extra($extra, $name);
|
||||
|
||||
return "<textarea name='{$name}'{$extra}>\n{$value}\n</textarea>\n";
|
||||
}
|
||||
|
||||
private static function add_label($input, $desc, $desc_pos) {
|
||||
if ( empty($desc_pos) )
|
||||
$desc_pos = 'after';
|
||||
|
||||
$label = '';
|
||||
if ( false === strpos($desc, self::token) ) {
|
||||
switch ($desc_pos) {
|
||||
case 'before': $label = $desc . ' ' . self::token; break;
|
||||
case 'after': $label = self::token . ' ' . $desc;
|
||||
}
|
||||
} else {
|
||||
$label = $desc;
|
||||
}
|
||||
|
||||
$label = trim(str_replace(self::token, $input, $label));
|
||||
|
||||
if ( empty($desc) )
|
||||
$output = $input . "\n";
|
||||
else
|
||||
$output = "<label>{$label}</label>\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
private static function validate_extra($extra, $name, $implode = true) {
|
||||
if ( !is_array($extra) )
|
||||
$extra = explode(' ', $extra);
|
||||
|
||||
if ( empty($extra) )
|
||||
return '';
|
||||
|
||||
return ' ' . ltrim(implode(' ', $extra));
|
||||
}
|
||||
|
||||
// Utilities
|
||||
|
||||
private static function is_associative($array) {
|
||||
if ( !is_array($array) || empty($array) )
|
||||
return false;
|
||||
|
||||
$keys = array_keys($array);
|
||||
|
||||
return array_keys($keys) !== $keys;
|
||||
}
|
||||
|
||||
private static function array_extract($array, $keys) {
|
||||
$r = array();
|
||||
foreach ( $keys as $key )
|
||||
if ( isset($array[$key]) )
|
||||
$r[$key] = $array[$key];
|
||||
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
|
||||
// PHP < 5.2
|
||||
if ( !function_exists('array_fill_keys') ) :
|
||||
function array_fill_keys($keys, $value) {
|
||||
if ( !is_array($keys) )
|
||||
trigger_error('First argument is expected to be an array.' . gettype($keys) . 'given', E_USER_WARNING);
|
||||
|
||||
$r = array();
|
||||
foreach ( $keys as $key )
|
||||
$r[$key] = $value;
|
||||
|
||||
return $r;
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Usage: http://scribu.net/wordpress/scb-framework/scb-options.html
|
||||
|
||||
class scbOptions {
|
||||
protected $defaults; // the default value(s)
|
||||
|
||||
protected $key; // the option name
|
||||
protected $data; // the option value
|
||||
|
||||
public $wp_filter_id; // used by WP hooks
|
||||
|
||||
/**
|
||||
* Create a new set of options
|
||||
*
|
||||
* @param key Option name
|
||||
* @param string Reference to main plugin file
|
||||
* @param array An associative array of default values
|
||||
*/
|
||||
function __construct($key, $file, $defaults = '') {
|
||||
$this->key = $key;
|
||||
$this->defaults = $defaults;
|
||||
$this->data = get_option($this->key);
|
||||
|
||||
if ( is_array($this->defaults) ) {
|
||||
$this->data = (array) $this->data;
|
||||
|
||||
register_activation_hook($file, array($this, '_update_reset'));
|
||||
}
|
||||
|
||||
scbUtil::add_uninstall_hook($file, array($this, '_delete'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all data fields, certain fields or a single field
|
||||
*
|
||||
* @param string|array $field The field(s) to get
|
||||
* @return mixed Whatever is in those fields
|
||||
*/
|
||||
function get($field = '') {
|
||||
return $this->_get($field, $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all default fields, certain fields or a single field
|
||||
*
|
||||
* @param string|array $field The field(s) to get
|
||||
* @return mixed Whatever is in those fields
|
||||
*/
|
||||
function get_defaults($field = '') {
|
||||
return $this->_get($field, $this->defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set all data fields, certain fields or a single field
|
||||
*
|
||||
* @param string|array $field The field to update or an associative array
|
||||
* @param mixed $value The new value (ignored if $field is array)
|
||||
* @return null
|
||||
*/
|
||||
function set($field, $value = '') {
|
||||
if ( is_array($field) )
|
||||
$newdata = $field;
|
||||
else
|
||||
$newdata = array($field => $value);
|
||||
|
||||
$this->update(array_merge($this->data, $newdata));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove any keys that are not in the defaults array
|
||||
*/
|
||||
function cleanup() {
|
||||
$r = array();
|
||||
|
||||
if ( ! is_array($this->defaults) )
|
||||
return false;
|
||||
|
||||
foreach ( array_keys($this->defaults) as $key )
|
||||
$r[$key] = $this->data[$key];
|
||||
|
||||
$this->update($r);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update raw data
|
||||
*
|
||||
* @param mixed $newdata
|
||||
* @return null
|
||||
*/
|
||||
function update($newdata) {
|
||||
if ( $this->data === $newdata )
|
||||
return;
|
||||
|
||||
$this->data = $newdata;
|
||||
|
||||
update_option($this->key, $this->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset option to defaults
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function reset() {
|
||||
$this->update($this->defaults);
|
||||
}
|
||||
|
||||
|
||||
//_____INTERNAL METHODS_____
|
||||
|
||||
|
||||
// Get one, more or all fields from an array
|
||||
private function _get($field, $data) {
|
||||
if ( empty($field) )
|
||||
return $data;
|
||||
|
||||
if ( is_string($field) )
|
||||
return $data[$field];
|
||||
|
||||
foreach ( $field as $key )
|
||||
if ( isset($data[$key]) )
|
||||
$result[] = $data[$key];
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Magic method: $options->field
|
||||
function __get($field) {
|
||||
return $this->data[$field];
|
||||
}
|
||||
|
||||
// Magic method: $options->field = $value
|
||||
function __set($field, $value) {
|
||||
$this->set($field, $value);
|
||||
}
|
||||
|
||||
// Magic method: isset($options->field)
|
||||
function __isset($field) {
|
||||
return isset($this->data[$field]);
|
||||
}
|
||||
|
||||
// Add new fields with their default values
|
||||
function _update_reset() {
|
||||
$this->update(array_merge($this->defaults, $this->data));
|
||||
}
|
||||
|
||||
// Delete option
|
||||
function _delete() {
|
||||
delete_option($this->key);
|
||||
}
|
||||
|
||||
// DEPRECATED
|
||||
function update_part($data) {
|
||||
$this->set($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
<?php
|
||||
|
||||
class scbUtil {
|
||||
// Force script enqueue
|
||||
static function do_scripts($handles) {
|
||||
global $wp_scripts;
|
||||
|
||||
if ( ! is_a($wp_scripts, 'WP_Scripts') )
|
||||
$wp_scripts = new WP_Scripts();
|
||||
|
||||
$wp_scripts->do_items((array) $handles);
|
||||
}
|
||||
|
||||
// Force style enqueue
|
||||
static function do_styles($handles) {
|
||||
self::do_scripts('jquery');
|
||||
|
||||
global $wp_styles;
|
||||
|
||||
if ( ! is_a($wp_styles, 'WP_Styles') )
|
||||
$wp_styles = new WP_Styles();
|
||||
|
||||
ob_start();
|
||||
$wp_styles->do_items((array) $handles);
|
||||
$content = str_replace(array('"', "\n"), array("'", ''), ob_get_clean());
|
||||
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo "jQuery(document).ready(function($) {\n";
|
||||
echo "$('head').prepend(\"$content\");\n";
|
||||
echo "});\n";
|
||||
echo "</script>";
|
||||
}
|
||||
|
||||
// Extract $keys from $array
|
||||
static function array_extract($array, $keys) {
|
||||
$r = array();
|
||||
foreach ( $keys as $key )
|
||||
if ( array_key_exists($key, $array) )
|
||||
$r[$key] = $array[$key];
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
// Prepare an array for an IN statement
|
||||
static function array_to_sql($values) {
|
||||
foreach ( $values as &$val )
|
||||
$val = "'" . esc_sql(trim($val)) . "'";
|
||||
|
||||
return implode(',', $values);
|
||||
}
|
||||
|
||||
// Have more than one uninstall hooks; also prevents an UPDATE query on each page load
|
||||
static function add_uninstall_hook($plugin, $callback) {
|
||||
register_uninstall_hook($plugin, '__return_false'); // dummy
|
||||
|
||||
add_action('uninstall_' . plugin_basename($plugin), $callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// _____Simple debug utility_____
|
||||
|
||||
if ( ! class_exists('scbDebug') ):
|
||||
class scbDebug {
|
||||
private $args;
|
||||
|
||||
function __construct($args) {
|
||||
$this->args = $args;
|
||||
|
||||
register_shutdown_function(array($this, '_delayed'));
|
||||
}
|
||||
|
||||
function _delayed() {
|
||||
if ( !current_user_can('administrator') )
|
||||
return;
|
||||
|
||||
$this->raw($this->args);
|
||||
}
|
||||
|
||||
static function raw($args) {
|
||||
echo "<pre>";
|
||||
foreach ( $args as $arg )
|
||||
if ( is_array($arg) || is_object($arg) )
|
||||
print_r($arg);
|
||||
else
|
||||
var_dump($arg);
|
||||
echo "</pre>";
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists('debug') ):
|
||||
function debug() {
|
||||
$args = func_get_args();
|
||||
|
||||
// integrate with FirePHP
|
||||
if ( class_exists('FirePHP') ) {
|
||||
$firephp = FirePHP::getInstance(true);
|
||||
$firephp->group('debug');
|
||||
foreach ( $args as $arg )
|
||||
$firephp->log($arg);
|
||||
$firephp->groupEnd();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
new scbDebug($args);
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists('debug_raw') ):
|
||||
function debug_raw() {
|
||||
$args = func_get_args();
|
||||
|
||||
scbDebug::raw($args);
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
// _____Minimalist HTML framework_____
|
||||
|
||||
if ( ! function_exists('html') ):
|
||||
function html($tag, $content = '') {
|
||||
list($closing) = explode(' ', $tag, 2);
|
||||
|
||||
return "<{$tag}>{$content}</{$closing}>";
|
||||
}
|
||||
endif;
|
||||
|
||||
// Generate an <a> tag
|
||||
if ( ! function_exists('html_link') ):
|
||||
function html_link($url, $title = '') {
|
||||
if ( empty($title) )
|
||||
$title = $url;
|
||||
|
||||
return sprintf("<a href='%s'>%s</a>", $url, $title);
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
// _____Compatibility layer_____
|
||||
|
||||
// WP < 3.0
|
||||
if ( ! function_exists('__return_false') ) :
|
||||
function __return_false() {
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
|
||||
// WP < ?
|
||||
if ( ! function_exists('__return_true') ) :
|
||||
function __return_true() {
|
||||
return true;
|
||||
}
|
||||
endif;
|
||||
|
||||
// WP < ?
|
||||
if ( ! function_exists('set_post_field') ) :
|
||||
function set_post_field($field, $value, $post_id) {
|
||||
global $wpdb;
|
||||
|
||||
$post_id = absint($post_id);
|
||||
$value = sanitize_post_field($field, $value, $post_id, 'db');
|
||||
|
||||
return $wpdb->update($wpdb->posts, array($field => $value), array('ID' => $post_id));
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
To load scbFramework, you just need to add this line at the beginning of your plugin:
|
||||
|
||||
require_once dirname(__FILE__) . '/scb/load.php';
|
||||
*/
|
||||
|
||||
if ( !class_exists('scbLoad3') ) :
|
||||
class scbLoad3 {
|
||||
|
||||
private static $candidates;
|
||||
|
||||
static function init($rev, $file, $classes) {
|
||||
$dir = dirname($file);
|
||||
|
||||
self::$candidates[$rev] = $dir;
|
||||
|
||||
self::load($dir . '/', $classes);
|
||||
|
||||
add_action('activated_plugin', array(__CLASS__, 'reorder'));
|
||||
}
|
||||
|
||||
static function reorder() {
|
||||
krsort(self::$candidates);
|
||||
|
||||
$dir = dirname(plugin_basename(reset(self::$candidates)));
|
||||
|
||||
$current = get_option('active_plugins', array());
|
||||
|
||||
$found = false;
|
||||
foreach ( $current as $i => $plugin ) {
|
||||
$plugin_dir = dirname($plugin);
|
||||
|
||||
if ( $plugin_dir == $dir ) {
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$found || 0 == $i )
|
||||
return;
|
||||
|
||||
unset($current[$i]);
|
||||
array_unshift($current, $plugin);
|
||||
|
||||
update_option('active_plugins', $current);
|
||||
}
|
||||
|
||||
private static function load($path, $classes) {
|
||||
foreach ( $classes as $class_name ) {
|
||||
if ( class_exists($class_name) )
|
||||
continue;
|
||||
|
||||
$fpath = $path . substr($class_name, 3) . '.php';
|
||||
|
||||
@include $fpath;
|
||||
}
|
||||
}
|
||||
|
||||
static function get_candidates() {
|
||||
return self::$candidates;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
scbLoad3::init(1, __FILE__, array(
|
||||
'scbOptions', 'scbForms', 'scbAdminPage', 'scbBoxesPage',
|
||||
'scbWidget', 'scbCron', 'scbTable', 'scbUtil', 'scbRewrite',
|
||||
));
|
||||
|
||||
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 44 KiB |
@@ -0,0 +1,49 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #464646;
|
||||
}
|
||||
|
||||
html,body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
body,input {
|
||||
font-family: "Lucida Grande", Verdana, Arial;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #21759B;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #D54E21;
|
||||
}
|
||||
|
||||
.button,input[type="button"],input[type="submit"] {
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
background: #f2f2f2 url(../../../../../wp-admin/images/white-grad.png) repeat-x scroll left top;
|
||||
border: 1px solid #bbb;
|
||||
color: #464646;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
cursor: pointer;
|
||||
padding: 2px 8px;
|
||||
border-radius: 11px;
|
||||
-webkit-border-radius: 11px;
|
||||
-moz-border-radius: 11px;
|
||||
}
|
||||
|
||||
.button:hover,input[type="button"]:hover,input[type="submit"]:hover {
|
||||
border-color: #666;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.button:active,input[type="button"]:active,input[type="submit"]:active {
|
||||
background: #f2f2f2 url(../../../../../images/white-grad-active.png) repeat-x scroll left top;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
#overlay {
|
||||
background: #666;
|
||||
}
|
||||
|
||||
.lightbox {
|
||||
background: #f9f9f9;
|
||||
padding: 10px 20px;
|
||||
border: 1px solid #bbb;
|
||||
border-radius: 11px;
|
||||
-webkit-border-radius: 11px;
|
||||
-moz-border-radius: 11px;
|
||||
}
|
||||
|
||||
.lightbox-close {
|
||||
cursor: hand;
|
||||
cursor: pointer;
|
||||
text-decoration: underline;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.lightbox-loader {
|
||||
background-image: url(../images/loader.gif);
|
||||
background-position: center center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.lightbox th {
|
||||
width: 80px;
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
#icon-w3tc-logo {
|
||||
background: url(../images/logo.png) no-repeat;
|
||||
float: left;
|
||||
height: 36px;
|
||||
width: 36px
|
||||
}
|
||||
|
||||
.w3tc-options-menu-selected {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
.w3tc-enabled {
|
||||
color: #090;
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
.w3tc-disabled {
|
||||
color: #f00;
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
.w3tc-empty {
|
||||
font-weight: 700;
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
.w3tc-success {
|
||||
background: #bfb
|
||||
}
|
||||
|
||||
.w3tc-error {
|
||||
background: #f99
|
||||
}
|
||||
|
||||
.w3tc-status {
|
||||
padding: 5px
|
||||
}
|
||||
|
||||
#w3tc acronym {
|
||||
border-bottom: 1px dotted #666
|
||||
}
|
||||
|
||||
#w3tc ul {
|
||||
list-style-type: disc;
|
||||
list-style-position: inside
|
||||
}
|
||||
|
||||
#w3tc blockquote {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#w3tc blockquote cite {
|
||||
font-style: 400
|
||||
}
|
||||
|
||||
#w3tc h5 {
|
||||
margin: 0
|
||||
}
|
||||
|
||||
#w3tc hr {
|
||||
clear: both;
|
||||
margin-top: 10px
|
||||
}
|
||||
|
||||
#w3tc ul {
|
||||
list-style-position: inside
|
||||
}
|
||||
|
||||
#w3tc #toc a,#qa a {
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
#w3tc #toc a:hover,#qa a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
#w3tc #toc ul {
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
#w3tc #toc li {
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
#w3tc #toc li.col {
|
||||
float: left;
|
||||
list-style: none;
|
||||
margin: 0 30px 0 0;
|
||||
width: 30%
|
||||
}
|
||||
|
||||
#w3tc #toc li.col ul {
|
||||
margin-left: 20px
|
||||
}
|
||||
|
||||
#w3tc #toc li.col ul li {
|
||||
list-style: disc
|
||||
}
|
||||
|
||||
#w3tc #qa {
|
||||
clear: both;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#w3tc #qa,#w3tc #about,#w3tc #install {
|
||||
width: 760px;
|
||||
}
|
||||
|
||||
#w3tc fieldset {
|
||||
margin: 1em 0;
|
||||
padding: 0 1em 1em 1em;
|
||||
border: 1px solid #bbb;
|
||||
border-radius: 11px;
|
||||
-webkit-border-radius: 11px;
|
||||
-moz-border-radius: 11px;
|
||||
}
|
||||
|
||||
#w3tc fieldset .submit {
|
||||
margin: 1em 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#w3tc legend {
|
||||
color: #999;
|
||||
padding: 0 5px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#cdn-general th {
|
||||
width: 400px;
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #464646;
|
||||
}
|
||||
|
||||
html,body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
line-height: 1em;
|
||||
background: #f9f9f9;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
body,td,textarea,input,select {
|
||||
font-family: "Lucida Grande", Verdana, Arial;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: Georgia, "Times New Roman", "Bitstream Charter";
|
||||
font-size: 24px;
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
line-height: 35px;
|
||||
margin: 0 0 0.8em 0;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #21759B;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #D54E21;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: 10px 50px;
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.button,input[type="button"],input[type="submit"] {
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
background: #f2f2f2 url(../../../../../wp-admin/images/white-grad.png) repeat-x scroll left top;
|
||||
border: 1px solid #bbb;
|
||||
color: #464646;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
cursor: pointer;
|
||||
padding: 2px 8px;
|
||||
border-radius: 11px;
|
||||
-webkit-border-radius: 11px;
|
||||
-moz-border-radius: 11px;
|
||||
}
|
||||
|
||||
.button:hover,input[type="button"]:hover,input[type="submit"]:hover {
|
||||
border-color: #666;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.button:active,input[type="button"]:active,input[type="submit"]:active {
|
||||
background: #F2F2F2 url(../../../../../wp-admin/images/white-grad-active.png) repeat-x scroll left top;
|
||||
}
|
||||
|
||||
.progress {
|
||||
background: #fff;
|
||||
border: 1px solid #464646;
|
||||
padding: 1px;
|
||||
margin: 1em 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.progress-value {
|
||||
position: absolute;
|
||||
line-height: 30px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
float: left;
|
||||
width: 0;
|
||||
height: 30px;
|
||||
background: #fc2;
|
||||
}
|
||||
|
||||
.log {
|
||||
border: 1px solid #464646;
|
||||
height: 279px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.log div {
|
||||
padding: 3px;
|
||||
border-bottom: 1px solid #464646;
|
||||
}
|
||||
|
||||
.log-success {
|
||||
background: #bfb;
|
||||
}
|
||||
|
||||
.log-error {
|
||||
background: #f99;
|
||||
}
|
||||
|
||||
.empty {
|
||||
font-weight: 700;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table td,th {
|
||||
border: 1px solid #ccc;
|
||||
padding: 3px 2px;
|
||||
}
|
||||
|
||||
.table th {
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
.queue td {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.updated,.error {
|
||||
-moz-border-radius-bottomleft: 3px;
|
||||
-moz-border-radius-bottomright: 3px;
|
||||
-moz-border-radius-topleft: 3px;
|
||||
-moz-border-radius-topright: 3px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
padding: 0 0.6em;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
.updated {
|
||||
background: #ffffe0;
|
||||
border-color: #e6db55;
|
||||
}
|
||||
|
||||
.error {
|
||||
background-color: #ffebe8;
|
||||
border-color: #cc0000;
|
||||
}
|
||||
|
||||
.updated p,.error p {
|
||||
line-height: 1;
|
||||
margin: 0.5em 0;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.tab-selected {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.rules {
|
||||
width: 100%;
|
||||
font-size: 9px;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<!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" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo WP_PLUGIN_URL; ?>/w3-total-cache/inc/css/error.css"></link>
|
||||
<title>Error</title>
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<?php echo $error; ?>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,251 @@
|
||||
var Lightbox = {
|
||||
window: jQuery(window),
|
||||
container: null,
|
||||
options: null,
|
||||
|
||||
create: function() {
|
||||
var me = this;
|
||||
|
||||
this.container = jQuery('<div class="lightbox lightbox-loading"><div class="lightbox-close">Close window</div><div class="lightbox-content"></div></div>').css( {
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
position: 'absolute',
|
||||
'z-index': 9991,
|
||||
display: 'none'
|
||||
});
|
||||
|
||||
jQuery('#w3tc').append(this.container);
|
||||
|
||||
this.window.resize(function() {
|
||||
me.resize();
|
||||
});
|
||||
|
||||
this.window.scroll(function() {
|
||||
me.resize();
|
||||
});
|
||||
|
||||
this.container.find('.lightbox-close').click(function() {
|
||||
me.close();
|
||||
});
|
||||
},
|
||||
|
||||
open: function(options) {
|
||||
var me = this;
|
||||
|
||||
this.options = jQuery.extend( {
|
||||
width: 400,
|
||||
height: 300,
|
||||
offsetTop: 100,
|
||||
content: null,
|
||||
url: null,
|
||||
callback: null
|
||||
}, options);
|
||||
|
||||
if (!this.container) {
|
||||
this.create();
|
||||
}
|
||||
|
||||
this.container.css( {
|
||||
width: this.options.width,
|
||||
height: this.options.height
|
||||
});
|
||||
|
||||
if (this.options.content) {
|
||||
this.content(options.content);
|
||||
} else if (this.options.url) {
|
||||
this.load(this.options.url, this.options.callback);
|
||||
}
|
||||
|
||||
Overlay.show(this);
|
||||
|
||||
this.resize();
|
||||
this.container.show();
|
||||
currentLightbox = this;
|
||||
},
|
||||
|
||||
close: function() {
|
||||
this.container.hide();
|
||||
Overlay.hide();
|
||||
currentLightbox = null;
|
||||
},
|
||||
|
||||
resize: function() {
|
||||
this.container.css( {
|
||||
top: this.window.scrollTop() + this.options.offsetTop,
|
||||
left: this.window.scrollLeft() + this.window.width() / 2 - this.container.width() / 2
|
||||
});
|
||||
},
|
||||
|
||||
load: function(url, callback) {
|
||||
this.content('');
|
||||
this.loading(true);
|
||||
var me = this;
|
||||
jQuery.get(url, {}, function(content) {
|
||||
me.loading(false);
|
||||
me.content(content);
|
||||
if (callback) {
|
||||
callback.call(this, me);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
content: function(content) {
|
||||
return this.container.find('.lightbox-content').html(content);
|
||||
},
|
||||
|
||||
width: function(width) {
|
||||
if (width === undefined) {
|
||||
return this.container.width();
|
||||
} else {
|
||||
return this.container.css( {
|
||||
width: width,
|
||||
left: this.window.scrollLeft() + this.window.width() / 2 - width / 2
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
height: function(height) {
|
||||
if (height === undefined) {
|
||||
return this.container.height();
|
||||
} else {
|
||||
return this.container.css( {
|
||||
height: height,
|
||||
top: this.window.scrollTop() + this.options.offsetTop
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
loading: function(loading) {
|
||||
return (loading === undefined ? this.container.hasClass('lightbox-loader') : (loading ? this.container.addClass('lightbox-loader') : this.container.removeClass('lightbox-loader')));
|
||||
}
|
||||
};
|
||||
|
||||
var Overlay = {
|
||||
window: jQuery(window),
|
||||
container: null,
|
||||
|
||||
create: function() {
|
||||
var me = this;
|
||||
|
||||
this.container = jQuery('<div id="overlay" />').css( {
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: 0,
|
||||
height: 0,
|
||||
position: 'absolute',
|
||||
'z-index': 9990,
|
||||
display: 'none',
|
||||
opacity: 0.6
|
||||
});
|
||||
|
||||
jQuery('#w3tc').append(this.container);
|
||||
|
||||
this.window.resize(function() {
|
||||
me.resize();
|
||||
});
|
||||
|
||||
this.window.scroll(function() {
|
||||
me.resize();
|
||||
});
|
||||
},
|
||||
|
||||
show: function() {
|
||||
if (!this.container) {
|
||||
this.create();
|
||||
}
|
||||
|
||||
this.resize();
|
||||
this.container.show();
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
this.container.hide();
|
||||
},
|
||||
|
||||
resize: function() {
|
||||
this.container.css( {
|
||||
top: this.window.scrollTop(),
|
||||
left: this.window.scrollLeft(),
|
||||
width: this.window.width(),
|
||||
height: this.window.height()
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function w3tc_lightbox_support_us() {
|
||||
Lightbox.open( {
|
||||
width: 590,
|
||||
height: 200,
|
||||
url: 'options-general.php?page=w3-total-cache/w3-total-cache.php&w3tc_action=support_us',
|
||||
callback: function(lightbox) {
|
||||
jQuery('.button-tweet', lightbox.container).click(function(event) {
|
||||
lightbox.close();
|
||||
w3tc_lightbox_tweet();
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery('.button-rating', lightbox.container).click(function() {
|
||||
window.open('http://wordpress.org/extend/plugins/w3-total-cache/', '_blank');
|
||||
});
|
||||
|
||||
jQuery('form').submit(function() {
|
||||
if (jQuery('select :selected', this).val() == '') {
|
||||
alert('Please select link location!');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function w3tc_lightbox_tweet() {
|
||||
Lightbox.open( {
|
||||
width: 550,
|
||||
height: 340,
|
||||
url: 'options-general.php?page=w3-total-cache/w3-total-cache.php&w3tc_action=tweet',
|
||||
callback: function(lightbox) {
|
||||
jQuery('form', lightbox.container).submit(function() {
|
||||
var me = this, username = jQuery('#tweet_username').val(), password = jQuery('#tweet_password').val();
|
||||
|
||||
if (username == '') {
|
||||
alert('Please enter your twitter.com username.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (password == '') {
|
||||
alert('Please enter your twitter.com password.');
|
||||
return false;
|
||||
}
|
||||
|
||||
jQuery('input', this).attr('disabled', 'disabled');
|
||||
|
||||
jQuery.post('options-general.php?page=w3-total-cache/w3-total-cache.php', {
|
||||
w3tc_action: 'twitter_status_update',
|
||||
username: username,
|
||||
password: password
|
||||
}, function(data) {
|
||||
jQuery('input', me).attr('disabled', '');
|
||||
|
||||
if (data.result) {
|
||||
lightbox.close();
|
||||
alert('Nice! Thanks for telling your friends about us!');
|
||||
} else {
|
||||
alert('Uh oh, seems that that #failed. Please try again.');
|
||||
}
|
||||
}, 'json');
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
jQuery(function($) {
|
||||
$('.button-tweet').click(function() {
|
||||
w3tc_lightbox_tweet();
|
||||
return false;
|
||||
});
|
||||
});
|
||||