Más cambios

git-svn-id: https://192.168.0.254/svn/Proyectos.AdemasProyectosSolidarios_Web/trunk@11 dac18aa3-6f68-5b46-b19f-13bb96c8fe2c
This commit is contained in:
David Arranz 2011-06-14 12:00:22 +00:00
parent c88b68c53d
commit c6338fe0cf
457 changed files with 30271 additions and 3871 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
google-site-verification: google077e733445535533.html

View File

@ -26,12 +26,15 @@ else return;
* Plugin Name: AddThis Social Bookmarking Widget
* Plugin URI: http://www.addthis.com
* Description: Help your visitor promote your site! The AddThis Social Bookmarking Widget allows any visitor to bookmark your site easily with many popular services. Sign up for an AddThis.com account to see how your visitors are sharing your content--which services they're using for sharing, which content is shared the most, and more. It's all free--even the pretty charts and graphs.
* Version: 2.1.0
* Version: 2.1.3
*
* Author: The AddThis Team
* Author URI: http://www.addthis.com/blog
*/
define( 'addthis_style_default' , 'small_toolbox_with_share');
define( 'ADDTHIS_PLUGIN_VERSION', '2.1.3');
$addthis_settings = array();
$addthis_settings['isdropdown'] = 'true';
$addthis_settings['customization'] = '';
@ -57,7 +60,7 @@ $addthis_new_styles = array(
'small_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-small.png', 'name' => 'Small Toolbox', 'above' => 'hidden ', 'below' => ''
), // 32x32
'plus_one_share_counter' => array( 'src' => '<div class="addthis_toolbox addthis_default_style" %s ><a class="addthis_button_google_plusone"></a><a class="addthis_counter addthis_pill_style"></a></div>', 'img' => 'plusone-share.gif', 'name' => 'Plus One and Share Counter', 'above'=> 'hidden', 'below'=>'hidden'), // +1
'small_toolbox_with_share' => array( 'src' => '<div class="addthis_toolbox addthis_default_style " %s ><a href="//addthis.com/bookmark.php?v=250&amp;username=xa-4d2b47597ad291fb" class="addthis_button_compact">Share</a><span class="addthis_separator">|</span><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a></div>', 'img' => 'small-toolbox.jpg', 'name' => 'Small Toolbox with Share first', 'above' => '', 'below' => 'hidden'
), // Plus sign share | four buttons
'large_toolbox' => array( 'src' => '<div class="addthis_toolbox addthis_default_style addthis_32x32_style" %s ><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a></div>', 'img' => 'toolbox-large.png', 'name' => 'Large Toolbox', 'above' => 'hidden ', 'below' => ''
@ -112,13 +115,11 @@ function addthis_script_to_content($content)
return $content ;
}
define( 'addthis_style_default' , 'small_toolbox_with_share');
define( 'ADDTHIS_PLUGIN_VERSION', '2.1.0');
/**
* Converts our old many options in to one beautiful array
*
*/
if ( apply_filters( 'at_do_options_upgrades', '__return_true') )
if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
{
function addthis_options_200()
{
@ -245,8 +246,15 @@ function addthis_get_wp_version() {
* For templates, we need a wrapper for printing out the code on demand.
*/
function addthis_print_widget($url=null, $title=null, $style = addthis_style_default ) {
global $addthis_new_styles ;
global $addthis_styles, $addthis_new_styles;
$styles = array_merge($addthis_styles, $addthis_new_styles);
if ( isset($_GET['preview']) && $_GET['preview'] == 1 && $options = get_transient('addthis_settings') )
$preview = true;
else
$options = get_option('addthis_settings');
$identifier = addthis_get_identifier($url, $title);
echo "\n<!-- AddThis Custom -->\n";
@ -255,7 +263,16 @@ echo "\n<!-- AddThis Custom -->\n";
if ( ! is_array($style) && isset($addthis_new_styles[$style]) ){
echo sprintf($addthis_new_styles[$style]['src'], $identifier);
}
elseif ($style == 'above')
{
if ( isset ($styles[$options['above']]['src'] ))
echo sprintf($styles[$options['above']]['src'], $identifier);
}
elseif ($style == 'below')
{
if ( isset ($styles[$options['below']]['src'] ))
echo sprintf($styles[$options['below']]['src'], $identifier);
}
elseif (is_array($style))
echo addthis_custom_toolbox($style, $url, $title);
echo "\n<!-- End AddThis Custom -->\n";
@ -776,8 +793,9 @@ if ( isset($data['addthis_profile']) )
if ( isset($data['addthis_password']) )
$options['password'] = sanitize_text_field($data['addthis_password']);
if ( isset ($data['show_above']) )
if (! isset($data['above']) ){
}
elseif ( isset ($data['show_above']) )
$options['above'] = 'none';
elseif ( isset($styles[$data['above']]) )
$options['above'] = $data['above'];
@ -797,8 +815,9 @@ elseif ($data['above'] = 'custom')
$options['above_custom_preferred'] = (int) $data['above_custom_preferred'] ;
$options['above_custom_more'] = isset($data['above_custom_more']);
}
if ( isset ($data['show_below']) )
if ( ! isset($data['below'] )){
}
elseif ( isset ($data['show_below']) )
$options['below'] = 'none';
elseif ( isset($styles[$data['below']]) )
$options['below'] = $data['below'];
@ -821,7 +840,7 @@ elseif ($data['below'] = 'custom')
// All the checkbox fields
foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_addressbar') as $field)
foreach (array('addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats', 'addthis_showonexcerpts', 'addthis_addressbar','addthis_508' ) as $field)
{
if ( isset($data[$field]) && $data[$field] == true)
$options[$field] = true;
@ -908,7 +927,7 @@ function addthis_init()
add_action( 'wp_head', 'addthis_add_content_filters');
if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', '__return_false') ) {
if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) {
if ( is_admin() ) {
add_action( 'admin_init', 'register_addthis_settings' );
}
@ -918,7 +937,11 @@ function addthis_init()
$script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
$script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/addthis.js' ;
$style_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
$style_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) .'/addthis/css/addthis.css' ;
wp_register_style( 'addthis', $style_location );
wp_register_script( 'addthis', $script_location , array('jquery-ui-tabs') );
@ -928,7 +951,7 @@ function addthis_init()
add_filter('admin_menu', 'addthis_admin_menu');
if ( apply_filters( 'at_do_options_upgrades', '__return_true') )
if ( apply_filters( 'at_do_options_upgrades', '__return_true') || apply_filters( 'addthis_do_options_upgrades', '__return_true') )
{
if ( get_option('addthis_product') !== false && ! is_array( $options ) )
addthis_options_200();
@ -1004,9 +1027,13 @@ function addthis_remove_tag($content, $text = '')
$text = get_the_content('');
$text = strip_shortcodes( $text );
remove_filter('the_content', 'addthis_display_social_widget', 15);
$text = apply_filters('the_content', $text);
add_filter('the_content', 'addthis_display_social_widget', 15);
$text = str_replace(']]>', ']]&gt;', $text);
$text = strip_tags($text);
$excerpt_length = apply_filters('excerpt_length', 55);
@ -1225,7 +1252,7 @@ function addthis_output_script($return = false )
$script = "\n<!-- AddThis Button Begin -->\n"
.'<script type="text/javascript">'
."var addthis_product = 'wpp-257';\n";
."var addthis_product = 'wpp-260';\n";
$pub = (isset($options['profile'])) ? $options['profile'] : false ;
@ -1261,6 +1288,8 @@ function addthis_output_script($return = false )
if ( isset($options['addthis_brand']) )
$addthis_config['ui_cobrand'] = $options['addthis_brand'];
if (isset($options['addthis_508']) && $options['addthis_508'] == true)
$addthis_config['ui_508_compliant'] = true;
$addthis_config = apply_filters('addthis_config_js_var', $addthis_config);
@ -1272,11 +1301,17 @@ function addthis_output_script($return = false )
$script .= 'var addthis_options = "'.$options['addthis_options'].'";';
if (isset($options['addthis_twitter_template'])){
$script .= 'if (typeof(addthis_share) == "undefined"){
var addthis_share = { templates: { twitter: "' . esc_js($options['addthis_twitter_template']) . '" } };
}';
$addthis_share['templates']['twitter'] = esc_js($options['addthis_twitter_template']);
}
if (isset($options['addthis_bitly_login']) && isset($options['addthis_bitly_key']) ){
$addthis_share['url_transforms']['shorten']['twitter'] = 'bitly';
$addthis_share['shorteners']['bitly']['login'] = esc_js($options['addthis_bitly_login']);
$addthis_share['shorteners']['bitly']['apiKey'] = esc_js($options['addthis_bitly_key']);
}
if (isset($addthis_share))
$script .= 'if (typeof(addthis_share) == "undefined"){ addthis_share = ' . json_encode( apply_filters('addthis_share_js_var', $addthis_share ) ) .';}';
$script .= '</script>';
@ -1418,13 +1453,18 @@ EOF;
function addthis_options_page_scripts()
{
$script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/options-page.js' ;
$script = (addthis_get_wp_version() >= 3.2 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) ? 'options-page.32.js' : 'options-page.js';
$script_location = apply_filters( 'at_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
$script_location = apply_filters( 'addthis_files_uri', plugins_url( '', basename(dirname(__FILE__)) ) ) . '/addthis/js/'.$script ;
wp_enqueue_script( 'addthis_options_page_script', $script_location , array('jquery-ui-tabs', 'thickbox' ));
}
function addthis_options_page_style()
{
$style_location = apply_filters( 'at_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
$style_location = apply_filters( 'addthis_files_uri' , plugins_url('', basename(dirname(__FILE__)) ) ) . '/addthis/css/options-page.css' ;
wp_enqueue_style( 'addthis_options_page_style', $style_location);
wp_enqueue_style( 'thickbox' );
}
@ -1467,6 +1507,9 @@ function addthis_admin_menu()
'below_custom_preferred' => '',
'below_custom_more' => '',
'addthis_twitter_template' => '',
'addthis_508' => '',
'addthis_bitly_login' => '',
'addthis_bitly_key' => '',
);
function addthis_plugin_options_php4() {
@ -1489,13 +1532,16 @@ function addthis_plugin_options_php4() {
<form id="addthis_settings" method="post" action="options.php">
<?php
// use the old-school settings style in older versions of wordpress
if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', '__return_false') ) {
if (addthis_get_wp_version() >= 2.7 || apply_filters('at_assume_latest', __return_false() ) || apply_filters('addthis_assume_latest', __return_false() ) ) {
settings_fields('addthis');
} else {
wp_nonce_field('update-options');
}
$addthis_options = get_option('addthis_settings');
$addthis_options = get_option('addthis_settings');
if ($addthis_options == false)
add_option('addthis_settings', array() );
foreach ( array( 'addthis_show_stats', 'addthis_append_data', 'addthis_showonhome', 'addthis_showonpages', 'addthis_showonarchives', 'addthis_showoncats' ) as $option)
{
if ( $addthis_options && ! isset($addthis_options[$option]) )
@ -1521,6 +1567,7 @@ function addthis_plugin_options_php4() {
<td id="above" colspan="2">
<p><?php _e("Above the post", 'addthis_trans_domain') ?>&nbsp;&nbsp;<span class="description"><input type="checkbox" name="addthis_settings[show_above]" <?php echo ('none' == $above) ? 'checked="checked"' : '';?> />&nbsp;none</span></p>
<?php $imgLocationBase = apply_filters( 'at_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
$imgLocationBase = apply_filters( 'addthis_files_uri', plugins_url( '' , basename(dirname(__FILE__)))) . '/addthis/img/' ;
foreach ($addthis_new_styles as $k => $v)
{
$class = 'hidden';
@ -1654,12 +1701,10 @@ function addthis_plugin_options_php4() {
<th scope="row"><?php _e("Track <a href=\"//www.addthis.com/blog/2010/03/11/clickback-analytics-measure-traffic-back-to-your-site-from-addthis/\" target=\"_blank\">clickbacks</a>:", 'addthis_trans_domain' ); ?></th>
<td><input type="checkbox" name="addthis_settings[addthis_append_data]" value="true" <?php echo $addthis_append_data == true ? 'checked="checked"' : ''; ?>/></td>
</tr>
<?php /* ?>
<tr>
<th scope="row"><?php _e("Track Address Bar Shares", 'addthis_trans_domain' ); ?></th>
<td><input type="checkbox" name="addthis_settings[addthis_addressbar]" value="true" <?php echo ($addthis_addressbar == true ? 'checked="checked"' : ''); ?>/></td>
</tr>
<?php //*/ ?>
<tr>
<th scope="row"><?php _e("Show on homepage:", 'addthis_trans_domain' ); ?></th>
<td><input type="checkbox" name="addthis_settings[addthis_showonhome]" value="true" <?php echo ($addthis_showonhome == true ? 'checked="checked"' : ''); ?>/></td>
@ -1680,6 +1725,10 @@ function addthis_plugin_options_php4() {
<th scope="row"><?php _e("Show on excerpts:", 'addthis_trans_domain' ); ?></th>
<td><input type="checkbox" name="addthis_settings[addthis_showonexcerpts]" value="true" <?php echo ( $addthis_showonexcerpts == true ? 'checked="checked"' : ''); ?>/></td>
</tr>
<tr>
<th scope="row"><?php _e("Enable Enhanced Accessibility", 'addthis_trans_domain' ); ?></th>
<td><input type="checkbox" name="addthis_settings[addthis_508]" value="true" <?php echo ( $addthis_508 == true ? 'checked="checked"' : ''); ?>/></td>
</tr>
<tr valign="top">
<td colspan="2"></td>
</tr>
@ -1700,7 +1749,7 @@ function addthis_plugin_options_php4() {
<td><input type="text" name="addthis_settings[addthis_brand]" value="<?php echo $addthis_brand; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e("<a href='http://www.addthis.com/help/client-api#configuration-sharing-templates'>Twitter Template</a>:", 'addthis_trans_domain' ); ?></th>
<th scope="row"><?php _e("<a href='http://www.addthis.com/help/client-api#configuration-sharing-templates'>Twitter Template</a>( not for tweet button) :", 'addthis_trans_domain' ); ?></th>
<td><input type="text" name="addthis_settings[addthis_twitter_template]" value="<?php echo $addthis_twitter_template; ?>" /></td>
</tr>
<tr valign="top">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,139 @@
jQuery(document).ready(function($) {
$( "#tabs" ).tabs();
var thickDims, tbWidth, tbHeight;
thickDims = function() {
var tbWindow = $('#TB_window'), H = $(window).height(), W = $(window).width(), w, h;
w = (tbWidth && tbWidth < W - 90) ? tbWidth : W - 90;
h = (tbHeight && tbHeight < H - 60) ? tbHeight : H - 60;
if ( tbWindow.size() ) {
tbWindow.width(w).height(h);
$('#TB_iframeContent').width(w).height(h - 27);
tbWindow.css({'margin-left': '-' + parseInt((w / 2),10) + 'px'});
if ( typeof document.body.style.maxWidth != 'undefined' )
tbWindow.css({'top':'30px','margin-top':'0'});
}
};
$('a.thickbox-preview').click( function() {
var previewLink = this;
var $inputs = $('#addthis_settings :input');
var values = {};
$.each($('#addthis_settings').serializeArray(), function(i, field) {
var thisName = field.name
if (thisName.indexOf("addthis_settings[") != -1 )
{
thisName = thisName.replace("addthis_settings[", '');
thisName = thisName.replace("]", '');
}
values[thisName] = field.value;
});
var stuff = $.param(values, true);
var data = {
action: 'at_save_transient',
value : stuff
};
jQuery.post(ajaxurl, data, function(response) {
// Fix for WP 2.9's version of lightbox
if ( typeof tb_click != 'undefined' && $.isFunction(tb_click.call))
{
tb_click.call(previewLink);
}
var href = $(previewLink).attr('href');
var link = '';
if ( tbWidth = href.match(/&tbWidth=[0-9]+/) )
tbWidth = parseInt(tbWidth[0].replace(/[^0-9]+/g, ''), 10);
else
tbWidth = $(window).width() - 90;
if ( tbHeight = href.match(/&tbHeight=[0-9]+/) )
tbHeight = parseInt(tbHeight[0].replace(/[^0-9]+/g, ''), 10);
else
tbHeight = $(window).height() - 60;
$('#TB_title').css({'background-color':'#222','color':'#dfdfdf'});
$('#TB_closeAjaxWindow').css({'float':'left'});
$('#TB_ajaxWindowTitle').css({'float':'right'}).html(link);
$('#TB_iframeContent').width('100%');
thickDims();
});
return false;
});
$('#above_more').click( function() {
$('#above .select_row').removeClass('hidden');
$(this).hide();
return false;
});
$('#below_more').click( function() {
$('#below .select_row').removeClass('hidden');
$(this).hide();
return false;
});
var show_above = $('input[name="addthis_settings[show_above]"]');
var show_below = $('input[name="addthis_settings[show_below]"]');
if ( show_above.prop('checked') != "undefined" && show_above.prop('checked') == true)
{
$('.above_option').toggleClass('hide');
}
if ( show_below.prop('checked') != "undefined" && show_below.prop('checked') == true)
{
$('.below_option').toggleClass('hide');
}
$('input[name="addthis_settings[show_above]"]').change( function() {
$('.above_option').toggleClass('hide');
});
$('input[name="addthis_settings[show_below]"]').change( function() {
$('.below_option').toggleClass('hide');
});
var aboveCustom = $('#above_custom_button');
var aboveCustomShow = function(){
if ( aboveCustom.prop('checked') != 'undefined' && aboveCustom.prop('checked') == true)
{
$('.above_option_custom').removeClass('hidden');
}
else
{
$('.above_option_custom').addClass('hidden');
}
};
var belowCustom = $('#below_custom_button');
var belowCustomShow = function(){
if ( belowCustom.prop('checked') != 'undefined' && belowCustom.prop('checked') == true)
{
$('.below_option_custom').removeClass('hidden');
}
else
{
$('.below_option_custom').addClass('hidden');
}
};
aboveCustomShow();
belowCustomShow();
$('input[name="addthis_settings[above]"]').change( function(){aboveCustomShow();} );
$('input[name="addthis_settings[below]"]').change( function(){belowCustomShow();} );
});

View File

@ -1,9 +1,9 @@
=== AddThis featuring Sharing Buttons / Facebook Like / Tweet Button ===
=== AddThis featuring Sharing Buttons / Facebook Like / Tweet Button / Google + 1 ===
Contributors: _mjk_, jorbin
Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz
Tags: share, addthis, social, bookmark, sharing, bookmarking, widget,AddThis, addtoany, aim, bookmark, buzz, del.icio.us, Digg,e-mail, email, Facebook, google bookmarks, google buzz, myspace,network, NewsVine, Reddit, Share, share this, sharethis, social, socialize, stumbleupon, twitter, windows live, yahoo buzz, plus one, google plus one, plus 1, + one, + 1, address bar sharing
Requires at least: 2.9
Tested up to: 3.1.1
Stable tag: 2.1.0
Tested up to: 3.1.3
Stable tag: 2.1.3
The AddThis Social Bookmarking Widget allows any visitor to bookmark and share your site easily with many popular services.
@ -12,6 +12,8 @@ Get more traffic back to your site by installing the AddThis WordPress plugin. W
Optionally, sign up for a free AddThis.com account to see how your visitors are sharing your content: which services they're using for sharing, which content is shared the most, and more.
Another options feature is Address Bar sharing. <a title="Address Bar Sharing Information" href="http://www.addthis.com/help/address-bar-sharing-analytics">Address Bar sharing analytics</a> give you the ability to track URLs that have been sent via emails, IMs and to forums using copy/paste. This captures a whole new segment of sharing that we have found to be up to 10x that of using social buttons. You now get a larger picture of where your direct traffic is coming from and how your users are really sharing your content.
<a href="http://www.addthis.com/blog">AddThis Blog</a> | <a href="http://www.addthis.com/privacy">Privacy Policy</a>
== Installation ==
@ -31,8 +33,6 @@ To upload the plugin through WordPress, instead of FTP:
1. Upload the downloaded zip file on the 'Add New' plugins screen (see the 'Upload' tab) in your WordPress admin area and activate.
Note: due to confusion, there are no longer separate versions for PHP4 and PHP5.
== Frequently Asked Questions ==
= Is AddThis free? =
@ -75,6 +75,15 @@ In the screen options you can enable the AddThis meta box. Check the box and sa
PHP 5+ is preferred; PHP 4 is supported.
== Changelog ==
= 2.1.3 =
Fix bugs
= 2.1.2 =
Add Address Bar sharing
= 2.1.1 =
* Add Google +1
= 2.1.0 =
* Add Twitter Template Option
* Add Post Meta Box
@ -157,6 +166,15 @@ Fixed nondeterministic bug with the_title(), causing the title to occasionally a
== Upgrade Notice ==
= 2.1.3 =
Fix JS bugs in versions less the 3.2
= 2.1.2 =
Add Addresss Bar Sharing
= 2.1.1 =
Add +1 to the button options
= 2.1.0 =
More Features, More Filters, More Social Goodness

View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -0,0 +1,70 @@
// Advanced Excerpt options script
jQuery(function($)
{
var plugin_prefix = 'advancedexcerpt';
var tag_cols = $('#' + plugin_prefix + '_tags_table tr:eq(1) td').length;
var tag_list = new Array();
$('#' + plugin_prefix + '_tags_table input').each(function(i, el)
{
tag_list.push($(el).val());
});
// Add a tag to the checkbox table
$('#' + plugin_prefix + '_add_tag').click(function(event)
{
event.preventDefault();
var tag = $('#' + plugin_prefix + '_more_tags option:selected').val();
// No duplicate tags in the table
if($.inArray(tag, tag_list) > -1)
{
return;
}
tag_list.push(tag);
var last_row = $('#' + plugin_prefix + '_tags_table tr:last-child');
var tag_count = last_row.find('input').length;
var tag_cell = $(
'<td>' +
'<input name="' + plugin_prefix + '_allowed_tags[]" type="checkbox" value="' + tag + '" checked="checked" />' +
'<code>' + tag + '</code>' +
'</td>'
);
if(tag_count < tag_cols)
{
// Add to last row
var span = last_row.find('td[colspan]');
if(span.attr('colspan') > 1)
{
span.attr('colspan', span.attr('colspan') - 1);
tag_cell.insertBefore(span);
}
else
{
span.replaceWith(tag_cell);
}
}
else
{
// New row
$('<tr><td colspan="' + (tag_cols - 1) + '">&nbsp;</td></tr>').insertAfter(last_row).prepend(tag_cell);
}
});
// Check all boxes
$('#' + plugin_prefix + '_select_all').click(function(event)
{
event.preventDefault();
$('input[name="' + plugin_prefix + '_allowed_tags[]"]:gt(0)').attr('checked', 'checked');
});
// Uncheck all boxes
$('#' + plugin_prefix + '_select_none').click(function(event)
{
event.preventDefault();
$('input[name="' + plugin_prefix + '_allowed_tags[]"]:gt(0)').removeAttr('checked');
});
});

View File

@ -0,0 +1,513 @@
<?php
/*
Plugin Name: Advanced Excerpt
Plugin URI: http://sparepencil.com/code/advanced-excerpt/
Description: Several improvements over WP's default excerpt. The size of the excerpt can be limited using character or word count, and HTML markup is not removed.
Version: 3.1
Author: Bas van Doren
Author URI: http://sparepencil.com/
Copyright 2007 Bas van Doren
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/>.
*/
if(!class_exists('AdvancedExcerpt')) :
class AdvancedExcerpt
{
// Plugin configuration
var $name;
var $text_domain;
var $mb;
var $default_options;
var $custom_options;
// Tricky variable
var $skip_next_call;
// Reference arrays
// Basic HTML tags (determines which tags are in the checklist)
var $options_basic_tags = array(
'a', 'abbr', 'acronym',
'b', 'big', 'blockquote', 'br',
'center', 'cite', 'code',
'dd', 'del', 'div', 'dl', 'dt',
'em',
'form',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr',
'i', 'img', 'ins',
'li',
'ol',
'p', 'pre',
'q',
's', 'small', 'span', 'strike', 'strong', 'sub', 'sup',
'table', 'td', 'th', 'tr',
'u', 'ul'
);
// HTML tags allowed in <body>
// <style> is <head>-only, but usage is often non-standard, so it's included here
var $options_body_tags = array(
'a', 'abbr', 'acronym', 'address', 'applet', 'area',
'b', 'bdo', 'big', 'blockquote', 'br', 'button',
'caption', 'center', 'cite', 'code', 'col', 'colgroup',
'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt',
'em',
'fieldset', 'font', 'form', 'frame', 'frameset',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr',
'i', 'iframe', 'img', 'input', 'ins', 'isindex',
'kbd',
'label', 'legend', 'li',
'map', 'menu',
'noframes', 'noscript',
'object', 'ol', 'optgroup', 'option',
'p', 'param', 'pre',
'q',
's', 'samp', 'script', 'select', 'small', 'span', 'strike', 'strong', 'style', 'sub', 'sup',
'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'tr', 'tt',
'u', 'ul',
'var'
);
// (not used) HTML tags which may have content that should not be considered actual text
// TODO: Implement a way to remove tag + content if tag is not allowed (low priority)
var $non_text_tags = array(
'applet', 'noframes', 'noscript', 'object', 'select', 'script', 'style'
);
function AdvancedExcerpt()
{
$this->name = strtolower(get_class($this));
$this->text_domain = $this->name;
$this->skip_next_call = false;
$this->charset = get_bloginfo('charset');
$this->load_options();
// Carefully support multibyte languages
if(extension_loaded('mbstring') && function_exists('mb_list_encodings'))
$this->mb = in_array($this->charset, mb_list_encodings());
load_plugin_textdomain($this->text_domain, PLUGINDIR . '/advanced-excerpt/');
register_activation_hook(__FILE__, array(&$this, 'install'));
//register_deactivation_hook(__FILE__, array(&$this, 'uninstall'));
add_action('admin_menu', array(&$this, 'add_pages'));
// Replace the default filter (see /wp-includes/default-filters.php)
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', array(&$this, 'filter'));
}
function __construct()
{
self::AdvancedExcerpt();
}
function filter($text)
{
// Merge custom parameters
if(is_array($this->custom_options))
$r = array_merge($this->default_options, $this->custom_options);
else
$r = $this->default_options;
extract($r, EXTR_SKIP);
// Only make the excerpt if it does not exist or 'No Custom Excerpt' is set to true
if('' == $text || $no_custom)
{
// Get the full content and filter it
$text = get_the_content('');
if(1 == $no_shortcode)
$text = strip_shortcodes($text);
$text = apply_filters('the_content', $text);
// From the default wp_trim_excerpt():
// Some kind of precaution against malformed CDATA in RSS feeds I suppose
$text = str_replace(']]>', ']]&gt;', $text);
// Strip HTML if allow-all is not set
if(!in_array('_all', $allowed_tags))
{
if(count($allowed_tags) > 0)
$tag_string = '<' . implode('><', $allowed_tags) . '>';
else
$tag_string = '';
$text = strip_tags($text, $tag_string);
}
if(1 == $use_words)
{
// Words
// Skip if text is already within limit
if($length >= count(preg_split('/[\s]+/', strip_tags($text))))
return $text;
// Split on whitespace and start counting (for real)
$text_bits = preg_split('/([\s]+)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
$in_tag = false;
$n_words = 0;
$text = '';
foreach($text_bits as $chunk)
{
if(!in_tag || strpos($chunk, '>') !== false)
$in_tag = (strrpos($chunk, '>') < strrpos($chunk, '<'));
// Whitespace outside tags is word separator
if(!$in_tag && '' == trim($chunk))
$n_words++;
if($n_words >= $length && !$in_tag)
break;
$text .= $chunk;
}
}
else
{
// Characters
// Count characters, not whitespace, not those belonging to HTML tags
if($length >= $this->strlen(preg_replace('/[\s]+/', '', strip_tags($text))))
return $text;
$in_tag = false;
$n_chars = 0;
for($i = 0; $n_chars < $length || $in_tag; $i++)
{
$char = $this->substr($text, $i, 1);
// Is the character worth counting (ie. not part of an HTML tag)
if($char == '<')
{
$in_tag = true;
if(($pos = strpos($text, '>', $i)) !== false)
{
$i = $pos - 1;
continue;
}
}
elseif($char == '>')
$in_tag = false;
elseif(!$in_tag && '' != trim($char))
$n_chars++;
// Prevent eternal loops (this could happen with incomplete HTML tags)
if($i >= $this->strlen($text) - 1)
break;
}
$text = $this->substr($text, 0, $i);
}
$text = trim(force_balance_tags($text));
// New filter in WP2.9, seems unnecessary for now
//$ellipsis = apply_filters('excerpt_more', $ellipsis);
// Read more
if(1 == $add_link)
{
$ellipsis = $ellipsis . sprintf(' <a href="%s" class="read_more">%s</a>', get_permalink(), $read_more);
}
// Adding the ellipsis
if(($pos = strpos($text, '</p>', strlen($text) - 7)) !== false)
{
// Stay inside the last paragraph (if it's in the last 6 characters)
$text = substr_replace($text, $ellipsis, $pos, 0);
}
else
{
// If <p> is an allowed tag,
// wrap the ellipsis for consistency with excerpt markup
if(in_array('_all', $allowed_tags) || in_array('p', $allowed_tags))
$ellipsis = '<p>' . $ellipsis . '</p>';
$text = $text . $ellipsis;
}
}
return $text;
}
function install()
{
add_option($this->name . '_length', 40);
add_option($this->name . '_use_words', 1);
add_option($this->name . '_no_custom', 0);
add_option($this->name . '_no_shortcode', 1);
add_option($this->name . '_ellipsis', '&hellip;');
add_option($this->name . '_read_more', 'Read the rest');
add_option($this->name . '_add_link', 0);
add_option($this->name . '_allowed_tags', $this->options_basic_tags);
//$this->load_options();
}
function uninstall()
{
// Nothing to do (note: deactivation hook is also disabled)
}
function load_options()
{
$this->default_options = array(
'length' => get_option($this->name . '_length'),
'use_words' => get_option($this->name . '_use_words'),
'no_custom' => get_option($this->name . '_no_custom'),
'no_shortcode' => get_option($this->name . '_no_shortcode'),
'ellipsis' => get_option($this->name . '_ellipsis'),
'read_more' => get_option($this->name . '_read_more'),
'add_link' => get_option($this->name . '_add_link'),
'allowed_tags' => get_option($this->name . '_allowed_tags')
);
}
function update_options()
{
$length = (int) $_POST[$this->name . '_length'];
$use_words = ('on' == $_POST[$this->name . '_use_words']) ? 1 : 0 ;
$no_custom = ('on' == $_POST[$this->name . '_no_custom']) ? 1 : 0 ;
$no_shortcode = ('on' == $_POST[$this->name . '_no_shortcode']) ? 1 : 0 ;
$add_link = ('on' == $_POST[$this->name . '_add_link']) ? 1 : 0 ;
$ellipsis = (get_magic_quotes_gpc() == 1) ? stripslashes($_POST[$this->name . '_ellipsis']) : $_POST[$this->name . '_ellipsis'];
$read_more = (get_magic_quotes_gpc() == 1) ? stripslashes($_POST[$this->name . '_read_more']) : $_POST[$this->name . '_read_more'];
$allowed_tags = array_unique((array) $_POST[$this->name . '_allowed_tags']);
update_option($this->name . '_length', $length);
update_option($this->name . '_use_words', $use_words);
update_option($this->name . '_no_custom', $no_custom);
update_option($this->name . '_no_shortcode', $no_shortcode);
update_option($this->name . '_ellipsis', $ellipsis);
update_option($this->name . '_read_more', $read_more);
update_option($this->name . '_add_link', $add_link);
update_option($this->name . '_allowed_tags', $allowed_tags);
$this->load_options();
?>
<div id="message" class="updated fade"><p>Options saved.</p></div>
<?php
}
function page_options()
{
if ('POST' == $_SERVER['REQUEST_METHOD'])
{
check_admin_referer($this->name . '_update_options');
$this->update_options();
}
extract($this->default_options, EXTR_SKIP);
// HTML entities for textbox
$ellipsis = htmlentities($ellipsis);
$read_more = htmlentities($read_more);
// Basic tags + enabled tags
$tag_list = $this->set_union($this->options_basic_tags, $allowed_tags);
sort($tag_list);
$tag_cols = 5;
?>
<div class="wrap">
<div id="icon-options-general" class="icon32"><br /></div>
<h2><?php _e("Advanced Excerpt Options", $this->text_domain); ?></h2>
<form method="post" action="">
<?php
if ( function_exists('wp_nonce_field') )
wp_nonce_field($this->name . '_update_options'); ?>
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="<?php echo $this->name ?>_length"><?php _e("Excerpt Length:", $this->text_domain); ?></label></th>
<td>
<input name="<?php echo $this->name ?>_length" type="text" id="<?php echo $this->name ?>_length" value="<?php echo $length; ?>" size="2" />
<input name="<?php echo $this->name ?>_use_words" type="checkbox" id="<?php echo $this->name ?>_use_words" value="on" <?php echo (1 == $use_words) ? 'checked="checked" ': ''; ?>/> <?php _e("Use words?", $this->text_domain); ?>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="<?php echo $this->name ?>_ellipsis"><?php _e("Ellipsis:", $this->text_domain); ?></label></th>
<td>
<input name="<?php echo $this->name ?>_ellipsis" type="text" id="<?php echo $this->name ?>_ellipsis" value="<?php echo $ellipsis; ?>" size="5" /> <?php _e('(use <a href="http://www.w3schools.com/tags/ref_entities.asp">HTML entities</a>)', $this->text_domain); ?>
<br />
<?php _e("Will substitute the part of the post that is omitted in the excerpt.", $this->text_domain); ?>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="<?php echo $this->name ?>_read_more"><?php _e("&lsquo;Read-more&rsquo; Text:", $this->text_domain); ?></label></th>
<td>
<input name="<?php echo $this->name ?>_read_more" type="text" id="<?php echo $this->name ?>_read_more" value="<?php echo $read_more; ?>" />
<input name="<?php echo $this->name ?>_add_link" type="checkbox" id="<?php echo $this->name ?>_add_link" value="on" <?php echo (1 == $add_link) ? 'checked="checked" ': ''; ?>/> <?php _e("Add link to excerpt", $this->text_domain); ?>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="<?php echo $this->name ?>_no_custom"><?php _e("No Custom Excerpts:", $this->text_domain); ?></label></th>
<td>
<input name="<?php echo $this->name ?>_no_custom" type="checkbox" id="<?php echo $this->name ?>_no_custom" value="on" <?php echo (1 == $no_custom) ? 'checked="checked" ': ''; ?>/>
<?php _e("Generate excerpts even if a post has a custom excerpt attached.", $this->text_domain); ?>
</td>
</tr>
<tr valign="top">
<th scope="row"><label for="<?php echo $this->name ?>_no_shortcode"><?php _e("Strip Shortcodes:", $this->text_domain); ?></label></th>
<td>
<input name="<?php echo $this->name ?>_no_shortcode" type="checkbox" id="<?php echo $this->name ?>_no_shortcode" value="on" <?php echo (1 == $no_shortcode) ? 'checked="checked" ': ''; ?>/>
<?php _e("Remove shortcodes from the excerpt. <em>(recommended)</em>", $this->text_domain); ?>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php _e("Keep Markup:", $this->text_domain); ?></th>
<td>
<table id="<?php echo $this->name ?>_tags_table">
<tr>
<td colspan="<?php echo $tag_cols; ?>">
<input name="<?php echo $this->name ?>_allowed_tags[]" type="checkbox" value="_all" <?php echo (in_array('_all', $allowed_tags)) ? 'checked="checked" ': ''; ?>/>
<?php _e("Don't remove any markup", $this->text_domain); ?>
</td>
</tr>
<?php
$i = 0;
foreach($tag_list as $tag) :
if($tag == '_all') continue;
if(0 == $i % $tag_cols) : ?>
<tr>
<?php
endif;
$i++;
?>
<td>
<input name="<?php echo $this->name ?>_allowed_tags[]" type="checkbox" value="<?php echo $tag; ?>" <?php echo (in_array($tag, $allowed_tags)) ? 'checked="checked" ': ''; ?>/>
<code><?php echo $tag; ?></code>
</td>
<?php
if(0 == $i % $tag_cols) : $i = 0; ?>
</tr>
<?php
endif;
endforeach;
if(0 != $i % $tag_cols) : ?><td colspan="<?php echo ($tag_cols - $i); ?>">&nbsp;</td></tr><?php endif;?>
</table>
<a href="" id="<?php echo $this->name ?>_select_all">Select all</a> / <a href="" id="<?php echo $this->name ?>_select_none">Select none</a><br />
More tags:
<select name="<?php echo $this->name ?>_more_tags" id="<?php echo $this->name ?>_more_tags">
<?php
foreach($this->options_body_tags as $tag) :
?>
<option value="<?php echo $tag; ?>"><?php echo $tag; ?></option>
<?php
endforeach;
?>
</select>
<input type="button" name="<?php echo $this->name ?>_add_tag" id="<?php echo $this->name ?>_add_tag" class="button" value="Add tag" />
</td>
</tr>
</table>
<p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e("Save Changes", $this->text_domain); ?>" /></p>
</form>
</div>
<?php
}
function page_script()
{
wp_enqueue_script($this->name . '_script', WP_PLUGIN_URL . '/advanced-excerpt/advanced-excerpt.js', array('jquery'));
}
function add_pages()
{
$options_page = add_options_page(__("Advanced Excerpt Options", $this->text_domain), __("Excerpt", $this->text_domain), 'manage_options', 'options-' . $this->name, array(&$this, 'page_options'));
// Scripts
add_action('admin_print_scripts-' . $options_page, array(&$this, 'page_script'));
}
// Careful multibyte support (fallback to normal functions if not available)
function substr($str, $start, $length = null)
{
$length = (is_null($length)) ? $this->strlen($str) : $length;
if($this->mb)
return mb_substr($str, $start, $length, $this->charset);
else
return substr($str, $start, $length);
}
function strlen($str)
{
if($this->mb)
return mb_strlen($str, $this->charset);
else
return strlen($str);
}
// Some utility functions
function set_complement($a, $b)
{
$c = array_diff($a, $b);
return array_unique($c);
}
function set_union($a, $b)
{
$c = array_merge($a, $b);
return array_unique($c);
}
}
$advancedexcerpt = new AdvancedExcerpt();
// Do not use outside the Loop!
function the_advanced_excerpt($args = '', $get = true)
{
global $advancedexcerpt;
$r = wp_parse_args($args);
if(isset($r['ellipsis']))
$r['ellipsis'] = urldecode($r['ellipsis']);
// TODO: Switch to 'allowed_tags' (compatibility code)
if(isset($r['allow_tags']))
{
$r['allowed_tags'] = $r['allow_tags'];
unset($r['allow_tags']);
}
if(isset($r['allowed_tags']))
$r['allowed_tags'] = preg_split('/[\s,]+/', $r['allow_tags']);
if(isset($r['exclude_tags']))
{
$r['exclude_tags'] = preg_split('/[\s,]+/', $r['exclude_tags']);
// {all_tags} - {exclude_tags}
$r['allowed_tags'] = $advancedexcerpt->set_complement($advancedexcerpt->options_body_tags, $r['exclude_tags']);
unset($r['exclude_tags']);
}
// Set custom options (discard after use)
$advancedexcerpt->custom_options = $r;
if($get)
echo get_the_excerpt();
else
the_excerpt();
$advancedexcerpt->custom_options = null;
}
endif;

View File

@ -0,0 +1,64 @@
msgid ""
msgstr ""
"Project-Id-Version: Advanced Excerpt\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-01-14 16:33+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Bas van Doren\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: _e;__\n"
"X-Poedit-Basepath: .\n"
"X-Poedit-SearchPath-0: .\n"
#: advanced-excerpt.php:223
#: advanced-excerpt.php:279
msgid "Advanced Excerpt Options"
msgstr "Verbeterde Uittreksel Opties"
#: advanced-excerpt.php:231
msgid "Excerpt Length:"
msgstr "Lengte van uittreksel:"
#: advanced-excerpt.php:234
msgid "Use words?"
msgstr "Gebruik woorden?"
#: advanced-excerpt.php:238
msgid "Ellipsis:"
msgstr "Weglating:"
#: advanced-excerpt.php:240
msgid "(use <a href=\"http://www.w3schools.com/tags/ref_entities.asp\">HTML entities</a>)"
msgstr "(gebruik <a href=\"http://www.w3schools.com/tags/ref_entities.asp\">HTML entiteiten</a>)"
#: advanced-excerpt.php:242
msgid "Will substitute the part of the post that is omitted in the excerpt."
msgstr "Vervangt het deel van het bericht dat weggelaten wordt in de uittreksel."
#: advanced-excerpt.php:246
msgid "No Custom Excerpts:"
msgstr "Negeer gebruikers uittreksels:"
#: advanced-excerpt.php:249
msgid "Generate excerpts even if a post has a custom excerpt attached."
msgstr "Genereer altijd een uittreksel, ook als er al een bij het bericht gevoegd is."
#: advanced-excerpt.php:253
msgid "Keep Markup:"
msgstr "Behoud opmaak:"
#: advanced-excerpt.php:267
msgid "See <a href=\"http://xref.redalt.com/wptrunk/nav.htm?wp-includes/kses.php.source.htm\"><code>wp-includes/kses.php</code></a> if you want to control more tags."
msgstr "Zie <a href=\"http://xref.redalt.com/wptrunk/nav.htm?wp-includes/kses.php.source.htm\"><code>wp-includes/kses.php</code></a> als je meer controle wil over deze tags."
#: advanced-excerpt.php:271
msgid "Save Changes"
msgstr "Wijzigingen opslaan"
#: advanced-excerpt.php:279
msgid "Excerpt"
msgstr "Uittreksel"

View File

@ -0,0 +1,105 @@
=== Advanced Excerpt ===
Contributors: basvd
Tags: excerpt, advanced, post, posts, template, formatting
Donate link: http://sparepencil.com/code/advanced-excerpt/
Requires at least: 2.2
Tested up to: 2.9
Stable tag: 3.1
Several improvements over WP's default excerpt. The size of the excerpt can be limited using character or word count, and HTML markup is not removed.
== Description ==
This plugin adds several improvements to WordPress' default way of creating excerpts.
1. It can keep HTML markup in the excerpt (and you get to choose which tags are included)
2. It trims the excerpt to a given length using either character count or word count
3. You can customize the excerpt length and the ellipsis character that will be used when trimming
4. A read-more link can be added automatically
4. The excerpt length is *real* (everything belonging to HTML tags is not counted)
5. Can ignore custom excerpts and use the generated one instead
6. Theme developers can use `the_advanced_excerpt()` for even more control (see the FAQ)
In addition to keeping HTML markup in the excerpt, the plugin also corrects HTML that might have been broken due to the trimming process.
This plugin is also compatible with Shortcodes.
Version 3.0 may not be backwards compatible. Check and re-apply the settings after you upgrade to make sure everything works correctly.
Version 0.2.1 adds support for multibyte characters (e.g. Chinese and Japanese). This is slightly experimental, more details in the FAQ.
Plugin translations are fully supported and language files are included for translation. The FAQ provides more info on this, also.
== Installation ==
After you've downloaded and extracted the files:
1. Upload the complete `advanced-excerpt` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Go to 'Excerpt' under the 'Options' tab and configure the plugin
== Frequently Asked Questions ==
= Why do I need this plugin? =
The default excerpt created by WordPress removes all HTML. If your theme uses `the_excerpt()` to view excerpts, they might look weird because of this (smilies are removed, lists are flattened, etc.) This plugin fixes that and also gives you more control over excerpts.
= Does it work for WordPress version x.x.x? =
I haven't had the chance to test the plugin on many versions of WordPress. It has recently been tested on 2.9, but it might work on other versions, too. You can safely try it yourself, because the plugin is unlikely to break anything (it's only an output filter). Please let me know if you successfully tested it on another version of WordPress.
= Is this plugin available in my language? / How do I translate this plugin? =
The plugin comes bundled with a few languages. The correct language will automatically be selected to match your [WordPress locale](http://codex.wordpress.org/WordPress_in_Your_Language).
More information on translation will be added in the future.
= Does this plugin support multibyte characters, such as Chinese? =
First of all, it should be noted that word-based excerpt length only works if your language uses normal whitespace as a word separator. If you use another language, you have to uncheck the *Use words?* option.
PHP's support for multibyte characters is not perfect. The plugin provides support for these characters to the best of its ability, but there are no guarantees that everything will work.
Your best bet is to use UTF-8 encoding (which WordPress uses by default). If you still encounter problems, check with your host if the *mbstring* PHP extension is enabled on your server.
= Can I manually call the filter in my WP templates, for example? =
The plugin automatically hooks on `the_excerpt()` function and uses the parameters specified in the options panel.
If you want to call the filter with different options, you can use `the_advanced_excerpt()` template tag provided by this plugin. This tag accepts [query-string-style parameters](http://codex.wordpress.org/Template_Tags/How_to_Pass_Tag_Parameters#Tags_with_query-string-style_parameters) (theme developers will be familiar with this notation).
The following parameters can be set:
* `length`, an integer that determines the length of the excerpt
* `use_words`, if set to `1`, the excerpt length will be in words; if set to `0`, characters will be used for the count
* `no_custom`, if set to `1`, an excerpt will be generated even if the post has a custom excerpt; if set to `0`, the custom excerpt will be used
* `no_shortcode`, if set to `1`, shortcodes are removed from the excerpt; if set to `0`, shortcodes will be parsed
* `ellipsis`, the string that will substitute the omitted part of the post; if you want to use HTML entities in the string, use `%26` instead of the `&` prefix to avoid breaking the query
* `read_more`, the text used in the read-more link
* `add_link`, if set to `1`, the read-more link will be appended; if `0`, no link will be added
* `allowed_tags`, a comma-separated list of HTML tags that are allowed in the excerpt. Entering `_all` will preserve all tags.
* `exclude_tags`, a comma-separated list of HTML tags that must be removed from the excerpt. Using this setting in combination with `allowed_tags` makes no sense
A custom advanced excerpt call could look like this:
`the_advanced_excerpt('length=320&use_words=0&no_custom=1&ellipsis=%26hellip;&exclude_tags=img,p,strong');`
= Does this plugin work outside the Loop? =
No, this plugin fetches the post from The Loop and there is currently no way to pass a post ID or anything custom of that kind to it.
You can, however, consider to [start The Loop manually](http://codex.wordpress.org/The_Loop#Multiple_Loops).
== Changelog ==
= 3.1 =
* Fix: A few bugs with custom and character-based excerpts
= 3.0 =
* First major release since 0.2.2 (also removed the `0.` prefix from the version number)
* Feature: Shortcodes can be removed from the excerpt
* Feature: Virtually any HTML tag may now be stripped
* Feature: A read-more link with custom text can be added
* Fix: Word-based excerpt speed improved
* Fix: Template tag function improved
* Fix: Better ellipsis placement

View File

@ -0,0 +1,149 @@
<?php
/*
Plugin Name: Delete Spam Daily
Plugin URI: http://brockangelo.com/wordpress/plugins/delete-spam-daily/
Description: Uses wp_cron to delete comments each day that are marked "spam" in the database.
Version: 1.0.2
Author: Brock Angelo
Author URI: http://brockangelo.com
Copyright 2009 Brock Angelo (email : email@brockangelo.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 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
# uncomment the next line if you want it to delete spam upon activation.
# register_activation_hook(__FILE__, 'delete_spam_daily');
add_action('delete_spam_daily', 'delete_spam_now');
function dsd_start_schedule() {
wp_schedule_event(time(), 'daily', 'delete_spam_daily');
}
function delete_spam_now() {
global $wpdb;
$wpdb->query("delete from $wpdb->comments where comment_approved='spam';");
$wpdb->query("OPTIMIZE TABLE $wpdb->comments;");
}
function get_spam_count() {
global $wpdb;
$dsd_spam_count = $wpdb->get_var("SELECT COUNT(*) from $wpdb->comments where comment_approved='spam';");
echo $dsd_spam_count;
}
function reschedule_delete_spam() {
wp_reschedule_event( (time()+60), 'daily', 'delete_spam_daily');
}
add_action('admin_menu', 'dsd_menu');
function dsd_menu() {
add_options_page('Delete Spam Daily Options', 'Delete Spam Daily', 8, __FILE__, 'dsd_options');
}
function dsd_options() {
$valid_nonce = wp_verify_nonce($_REQUEST['_wpnonce'],'delete_spam_daily');
if ( $valid_nonce ) {
if(isset($_REQUEST['delete_spam_now_button'])) {
delete_spam_now();
}
if(isset($_REQUEST['delete_spam_daily_button'])) {
dsd_start_schedule();
}
if(isset($_REQUEST['stop_deleting_spam_button'])) {
dsd_stop_schedule();
}
if(isset($_REQUEST['reschedule_delete_spam_button'])) {
reschedule_delete_spam();
}
}
if ( !empty($_POST ) ) : ?>
<div id="message" class="updated fade">
<strong>Settings updated</strong>
</div>
<?php endif; ?>
<div class="wrap">
<h2>Delete Spam Daily Options</h2>
<p><?php if (wp_next_scheduled('delete_spam_daily') == NULL)
{
echo "The schedule has not been started.";
}
else
{ ?>
Next Spam Delete: <?php echo date("l, F j, Y @ h:i a",(wp_next_scheduled('delete_spam_daily'))); ?></p>
<?php
} ?>
<p>Current Spam Count: <?php get_spam_count(); ?></p><br /><br />
<?php
echo '<form name="delete_spam_now_button" action="" method="post">';
if ( function_exists('wp_nonce_field') )
wp_nonce_field('delete_spam_daily');
echo '<input type="hidden" name="delete_spam_now_button" value="update" />';
echo '<div><input id="delete_spam_now_button" type="submit" value="Delete spam now &raquo;" /></div>';
echo "</form>\n<br />";
if (wp_next_scheduled('delete_spam_daily') == NULL)
{
echo '<form name="delete_spam_daily_button" action="" method="post">';
if ( function_exists('wp_nonce_field') )
wp_nonce_field('delete_spam_daily');
echo '<input type="hidden" name="delete_spam_daily_button" value="update" />';
echo '<div><input id="delete_spam_daily_button" type="submit" value="Delete spam daily &raquo;" /></div>';
echo "</form>\n";
}
else
{
echo '<form name="stop_deleting_spam_button" action="" method="post">';
if ( function_exists('wp_nonce_field') )
wp_nonce_field('delete_spam_daily');
echo '<input type="hidden" name="stop_deleting_spam_button" value="update" />';
echo '<div><input id="stop_deleting_spam_button" type="submit" value="Stop Deleting Spam &raquo;" /></div>';
echo "</form>\n";
echo '<form name="reschedule_delete_spam_button" action="" method="post">';
if ( function_exists('wp_nonce_field') )
wp_nonce_field('delete_spam_daily');
echo '<input type="hidden" name="reschedule_delete_spam_button" value="update" />';
echo '<div><input id="reschedule_delete_spam_button" type="submit" value="Reschedule to start in 1 minute &raquo;" /> <i>Helpful for testing cron</i></div>';
echo "</form>\n<br />";
}
?>
<br />
<br />
Deactivating this plugin will stop the schedule. <br />
</div>
<?php
}
register_deactivation_hook(__FILE__, 'dsd_stop_schedule');
function dsd_stop_schedule() {
wp_clear_scheduled_hook('delete_spam_daily');
}
?>

View File

@ -0,0 +1,57 @@
=== Delete Spam Daily ===
Contributors: brockangelo
Donate link: http://brockangelo.com/wordpress/plugins/delete-spam-daily
Tags: comments, spam, cron, delete, database
Requires at least: 2.1.0
Tested up to: 2.7.1
Stable tag: 1.0.2
Uses wp_cron to delete comments each day that are marked "spam" in the database.
== Description ==
This plugin schedules a daily event using wp_cron that deletes all comments marked "spam" in the database, then optimizes the comments table.
Brief reason why I made such a low-tech plugin:
Akismet catches all the spam, but when I was looking at the size of my backups one day,
I noticed that there were large numbers of comment spam across several sites that were undeleted and they
made the databases fairly large. So I setup a cron job on my server that deletes the spam.
Since I had never written a plugin, I thought this might be helpful for those who do not have
a dedicated server, shell access to their site, or the knowledge of (or interest in ) cron to set this up.
Spam is not deleted until you start the schedule after the plugin is activated. I created buttons
to start and stop the schedule if you need that layer of control. There is also a button for deleting all spam manually.
== Installation ==
1. Upload the `delete-spam-daily` folder to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Look under "Settings" --> "Delete Spam Daily" to activate the schedule.
1. You can start and stop the schedule from the "Delete Spam Daily" menu.
== Frequently Asked Questions ==
= What time does comment spam get deleted? =
The first time you start the schedule, spam gets deleted.
Subsequent spam will be scheduled to delete every 24 hours after the first activation.
= If I de-activate this plugin, will it continue to delete spam daily? =
No. The cron job is cleared upon deactivation.
== Screenshots ==
1. Pretty simple.
== Changelog ==
* Version 1.0.2 - 5.28.09: Now optimizes the `wp_comments` table after spam is deleted. Updated DB call to allow for alternate wordpress table prefix.
* Version 1.0.1 - 5.26.09: Minor update. `add_action` was added to the "Delete Spam Daily" button so it would actually delete spam once a day. :-) In addition to a "Stop Deleting Spam" button, a button was added that reschedules the cron to happen in 1 minute so you can be sure your crons are working right away.
* Version 1.0 - 5.25.09: Initial Release. Included button to start deleting spam daily, and a button to delete spam immediately. Once the schedule was activated, it provided a button to stop the schedule. Shows current spam count and next scheduled delete.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -1,20 +1,20 @@
<?php
/**
* @package MimeTypeLinkImages
* @version 1.0.6
* @version 1.0.7
*/
/*
Plugin Name: Mime Type Link Images
Plugin URI: http://blog.eagerterrier.co.uk/2010/10/holy-cow-ive-gone-and-made-a-mime-type-wordpress-plugin/
Description: This will add file type icons next to links automatically
Author: Toby Cox
Version: 1.0.6
Version: 1.0.7
Author URI: http://eagerterrier.co.uk
*/
// constants
define('mtli_version', '1.0.4', true);
define('mtli_version', '1.0.7', true);
$mtli_options = get_option('mimetype_link_icon_options');
@ -58,6 +58,7 @@ function mtli_get_option($option_name) {
}
$mtli_default_options['image_size'] = '48';
$mtli_default_options['image_type'] = 'gif';
$mtli_default_options['show_file_size'] = false;
$mtli_default_options['enable_pdf'] = true;
$mtli_default_options['enable_doc'] = false;
$mtli_default_options['enable_docx'] = false;
@ -127,6 +128,7 @@ function mtli_options() {
$mtli_options = get_option('mimetype_link_icon_options');
$mtli_options['image_size'] = $_POST['image_size'];
$mtli_options['image_type'] = $_POST['image_type'];
$mtli_options['show_file_size'] = ($_POST['show_file_size']=="true" ? true : false);
$mtli_options['enable_pdf'] = ($_POST['enable_pdf']=="true" ? true : false);
$mtli_options['enable_doc'] = ($_POST['enable_doc']=="true" ? true : false);
$mtli_options['enable_docx'] = ($_POST['enable_docx']=="true" ? true : false);
@ -160,9 +162,9 @@ function mtli_options() {
</th>
<td>
<select name="image_size" id="image_size">
<?php foreach($mtli_available_sizes as $k => $v){ ?>
<? foreach($mtli_available_sizes as $k=> $v){ ?>
<option value="<?php echo $v; ?>" <?php if(mtli_get_option('image_size')==$v) echo ' selected'; ?>><?php echo $v."x".$v; ?></option>
<?php } ?>
<? } ?>
</select>
<br />
</td>
@ -173,9 +175,9 @@ function mtli_options() {
</th>
<td>
<select name="image_type" id="image_type">
<?php foreach($mtli_available_image_types as $k=>$v){ ?>
<? foreach($mtli_available_image_types as $k=>$v){ ?>
<option value="<?php echo $v;?>" <?php if($v==mtli_get_option('image_type')) echo ' selected';?>><?php echo $v;?></option>
<?php } ?>
<? } ?>
</select>
</td>
</tr>
@ -184,7 +186,7 @@ function mtli_options() {
<fieldset class="options" name="general">
<legend><?php _e('Image settings', 'mtli') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
<?php foreach($mtli_available_mime_types as $k=>$mime_type){ ?>
<? foreach($mtli_available_mime_types as $k=>$mime_type){ ?>
<tr>
<th nowrap valign="top" width="33%">
<?php _e('Add images to '.$mime_type.' uploads', 'mtli') ?>
@ -194,7 +196,18 @@ function mtli_options() {
<br />
</td>
</tr>
<?php } ?>
<? } ?>
</table>
</fieldset>
<fieldset class="options" name="general">
<legend><?php _e('Show file size of attachment?', 'mtli') ?></legend>
<table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
<tr>
<td>If you want to have the file size of the attachment written in brackets next to the file size, tick this box</td>
</tr>
<tr>
<td><input type="checkbox" name="show_file_size" id="show_file_size" value="true" <?php if (mtli_get_option('show_file_size')) echo "checked"; ?> /> </td>
</tr>
</table>
</fieldset>
<fieldset class="options" name="general">
@ -253,17 +266,21 @@ function mimetype_to_icon($content) {
foreach($mtli_available_mime_types as $k=>$mime_type){
if(mtli_get_option('enable_'.$mime_type)){
//if($content = preg_replace('/href="([^"]+\.pdf)"/','href="\1" class="mtli_attachment mtli_'.$mime_type.'"',$content, -1, $howmany))
if(mtli_get_option('show_file_size')===true){
$extrabit = ' getfilesize';
} else {
$extrabit = '';
}
if(strpos($content, '.'.$mime_type.'"')!==false){
$howmany=0;
$content = preg_replace('/href="([^"]+\.'.$mime_type.')"/','href="\\1" class="mtli_attachment mtli_'.$mime_type.'"',$content, -1, $howmany);
$content = preg_replace('/href="([^"#]+\.'.$mime_type.')#?[^" ]*"/','href="\\1" class="mtli_attachment mtli_'.$mime_type.'"',$content, -1, $howmany);
if($howmany>0){
$add_attachment_style = true;
$mtli_css .= '.mtli_'.$mime_type.' { background-image: url('.$wp_content_url.'/plugins/mimetypes-link-icons/images/'.$mime_type.'-icon-'.mtli_get_option('image_size').'x'.mtli_get_option('image_size').'.'.mtli_get_option('image_type').'); }';
}
} elseif(strpos($content, '.'.$mime_type.'\'')!==false){
$howmany=0;
$content = preg_replace("/href='([^']+\.".$mime_type.")'/","href='\\1' class='mtli_attachment mtli_".$mime_type."'",$content, -1, $howmany);
$content = preg_replace("/href='([^'#]+\.".$mime_type.")#?[^' ]*'/","href='\\1' class='mtli_attachment mtli_".$mime_type."'",$content, -1, $howmany);
if($howmany>0){
$add_attachment_style = true;
$mtli_css .= '.mtli_'.$mime_type.' { background-image: url('.$wp_content_url.'/plugins/mimetypes-link-icons/images/'.$mime_type.'-icon-'.mtli_get_option('image_size').'x'.mtli_get_option('image_size').'.'.mtli_get_option('image_type').'); }';
@ -276,6 +293,16 @@ function mimetype_to_icon($content) {
return $content;
}
function mtli_get_size($filePath){
if(!$filePath){
return false;
}
$internal_domains = mtli_get_option('internal_domains');
$fileSize = filesize();
return $fileSize;
}
// Now we set that function up to execute when the the_content action is called
//add_action('load_template', 'mimetype_to_icon');
@ -297,13 +324,10 @@ function mtli_display_css($content){
}
$mtli_css.="</style>";
if($add_attachment_style===true || mtli_get_option('enable_async')){
echo $mtli_css.$content;
}
/*if($add_attachment_style===true || mtli_get_option('enable_async')){
return $mtli_css.$content;
return $content.$mtli_css;
} else {
return $content;
}*/
}
}
function mtli_add_async_replace($content){
@ -320,7 +344,7 @@ function mtli_add_async_replace($content){
echo '<script type="text/javascript" src="'.$wp_content_url.'/plugins/mimetypes-link-icons/js/mtli_str_replace.js"></script>';
}
add_action('wp_head', 'mtli_display_css');
add_action('the_content', 'mtli_display_css');
if(mtli_get_option('enable_async')){
add_action('get_header', 'mtli_add_jquery');

View File

@ -3,7 +3,7 @@ Contributors: eagerterrier
Donate link: http://blog.eagerterrier.co.uk/2010/10/holy-cow-ive-gone-and-made-a-mime-type-wordpress-plugin/
Tags: mime-type, icons, PDF, xls, xlsx, doc, docx, mime, type, mimetype, zip, csv, ppt, skp, dwg, dwf, jpg
Requires at least: 1.5.1.3
Tested up to: 3.1.1
Tested up to: 3.1.3
Stable tag: trunk
Adds icons automatically to any uploads inserted into your blog posts.
@ -55,6 +55,9 @@ No. It searches your post for any links containing the mimetype extensions you h
== Changelog ==
= 1.0.7 =
* Adding ability for users to use anchor tags in the PDF URL - ie http://example.com/wp-content/uploads/myfile.pdf#page9
= 1.0.6 =
* Turns out some themes don't use get_header OR get_footer. Had to put the hook into the_content instead.
@ -75,5 +78,23 @@ No. It searches your post for any links containing the mimetype extensions you h
== Upgrade Notice ==
= 1.0.7 =
* Adding ability for users to use anchor tags in the PDF URL - ie http://example.com/wp-content/uploads/myfile.pdf#page9
= 1.0.6 =
* Bug fix
= 1.0.5 =
* Adding optional asynchronous method for users with conflicting plugins (for example the infocus theme's fancy_box)
= 1.0.4 =
* Bug fix
= 1.0.3 =
* Added new file type icons - ppt, skp, dwg, dwf, jpg
= 1.0.2 =
* Bug fix
= 1.0.1 =
Typo in CSS caused some images not to show. Recommended for all users

View File

@ -3,7 +3,7 @@
Plugin Name: qTranslate
Plugin URI: http://www.qianqin.de/qtranslate/
Description: Adds userfriendly multilingual content support into Wordpress. For Problems visit the <a href="http://www.qianqin.de/qtranslate/forum/">Support Forum</a>.
Version: 2.5.20
Version: 2.5.21
Author: Qian Qin
Author URI: http://www.qianqin.de
Tags: multilingual, multi, language, admin, tinymce, qTranslate, Polyglot, bilingual, widget, switcher, professional, human, translation, service

View File

@ -79,10 +79,10 @@ function qtrans_generateLanguageSelectCode($style='', $id='') {
case 'dropdown':
echo '<ul class="qtrans_language_chooser" id="'.$id.'">';
foreach(qtrans_getSortedLanguages() as $language) {
echo '<li';
$classes = array('lang-'.$language);
if($language == $q_config['language'])
echo ' class="active"';
echo '><a href="'.qtrans_convertURL($url, $language).'"';
$classes[] = 'active';
echo '<li class='. implode(' ', $classes) .'><a href="'.qtrans_convertURL($url, $language).'"';
// set hreflang
echo ' hreflang="'.$language.'" title="'.$q_config['language_name'][$language].'"';
if($style=='image')

View File

@ -1,9 +1,9 @@
=== qTranslate ===
Contributors: chineseleper
Tags: multilingual, language, admin, tinymce, bilingual, widget, switcher, i18n, l10n, multilanguage, professional, translation, service, human
Requires at least: 3.1.2
Tested up to: 3.1.2
Stable tag: 2.5.20
Requires at least: 3.1.3
Tested up to: 3.1.3
Stable tag: 2.5.21
Donate Link: http://www.qianqin.de/qtranslate/contribute/
Adds userfriendly multilingual content management and translation support into Wordpress.

View File

@ -6,3 +6,23 @@
display: block;
padding: 2em 0 0;
}
.slb_option_item .block {
display: inline-block;
}
.slb_option_item label.title {
width: 200px;
padding: 10px;
}
.slb_option_item .input {
font-size: 11px;
line-height: 20px;
margin-bottom: 9px;
padding: 8px 10px;
}
.slb_option_item .input select {
min-width: 12em;
}

View File

@ -10,6 +10,12 @@ require_once 'class.utilities.php';
*/
class SLB_Base {
/**
* Variable name of base object in global scope
* @var string
*/
var $base = 'slb';
/**
* Prefix for Cornerstone-related data (attributes, DB tables, etc.)
* @var string
@ -33,18 +39,19 @@ class SLB_Base {
* Constructor
*/
function __construct() {
$this->util =& new SLB_Utilities();
$this->util =& new SLB_Utilities($this);
}
/*-** Init **-*/
/**
* Default initialization method
* To be overriden by child classes
*/
function init() {
$func = 'register_hooks';
if ( isset($this) ) {
if ( method_exists($this, $func) )
call_user_method($func, $this);
if ( isset($this) && method_exists($this, $func) ) {
call_user_method($func, $this);
}
}
@ -59,6 +66,16 @@ class SLB_Base {
register_deactivation_hook($this->util->get_plugin_base_file(), $this->m($func_deactivate));
}
/*-** Reflection **-*/
/**
* Retrieve base object
* @return object|bool Base object (FALSE if object does not exist)
*/
function &get_base() {
return ( isset($GLOBALS[$this->base]) ) ? $GLOBALS[$this->base] : false;
}
/*-** Method/Function calling **-*/
/**
@ -70,106 +87,7 @@ class SLB_Base {
return $this->util->m($this, $method);
}
/*-** Hooks **-*/
function do_action($tag, $arg = '') {
do_action($this->add_prefix($tag), $arg);
}
function apply_filters($tag, $value) {
apply_filters($this->add_prefix($tag), $value);
}
function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
return add_action($this->add_prefix($tag), $function_to_add, $priority, $accepted_args);
}
function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
return add_filter($this->add_prefix(tag), $function_to_add, $priority, $accepted_args);
}
/**
* Retrieves post metadata for internal methods
* Metadata set internally is wrapped in an array so it is unwrapped before returned the retrieved value
* @see get_post_meta()
* @param int $post_id Post ID
* @param string $key Name of metadata to retrieve
* @param boolean $single Whether or not to retrieve single value or not
* @return mixed Retrieved post metadata
*/
function post_meta_get($post_id, $key, $single = false) {
$meta_value = get_post_meta($post_id, $this->post_meta_get_key($key), $single);
if (is_array($meta_value) && count($meta_value) == 1)
$meta_value = $meta_value[0];
return $meta_value;
}
/**
* Wraps metadata in array for storage in database
* @param mixed $meta_value Value to be set as metadata
* @return array Wrapped metadata value
*/
function post_meta_prepare_value($meta_value) {
return array($meta_value);
}
/**
* Adds Metadata for a post to database
* For internal methods
* @see add_post_meta
* @param $post_id
* @param $meta_key
* @param $meta_value
* @param $unique
* @return boolean Result of operation
*/
function post_meta_add($post_id, $meta_key, $meta_value, $unique = false) {
$meta_value = $this->post_meta_value_prepare($meta_value);
return add_post_meta($post_id, $meta_key, $meta_value, $unique);
}
/**
* Updates post metadata for internal data/methods
* @see update_post_meta()
* @param $post_id
* @param $meta_key
* @param $meta_value
* @param $prev_value
* @return boolean Result of operation
*/
function post_meta_update($post_id, $meta_key, $meta_value, $prev_value = '') {
$meta_value = $this->post_meta_prepare_value($meta_value);
return update_post_meta($post_id, $meta_key, $meta_value, $prev_value);
}
/**
* Builds postmeta key for custom data set by plugin
* @param string $key Base key name
* @return string Formatted postmeta key
*/
function post_meta_get_key($key) {
$sep = '_';
if ( strpos($key, $sep . $this->prefix) !== 0 ) {
$key_base = func_get_args();
if ( !empty($key_base) ) {
$key = array_merge((array)$this->prefix, $key_base);
return $sep . implode($sep, $key);
}
}
return $key;
}
/**
* Get valid separator
* @param string $sep (optional) Separator supplied
* @return string Separator
*/
function get_sep($sep = null) {
if ( !is_string($sep) )
$default = '_';
return ( is_string($sep) ) ? $sep : $default;
}
/*-** Prefix **-*/
/**
* Retrieve class prefix (with separator if set)
@ -177,9 +95,8 @@ class SLB_Base {
* @return string Class prefix
*/
function get_prefix($sep = null) {
$sep = $this->get_sep($sep);
$prefix = ( !empty($this->prefix) ) ? $this->prefix . $sep : '';
return $prefix;
$args = func_get_args();
return call_user_func_array($this->util->m($this->util, 'get_prefix'), $args);
}
/**
@ -188,7 +105,8 @@ class SLB_Base {
* @param string $sep (optional) Separator used
*/
function has_prefix($text, $sep = null) {
return ( !empty($text) && strpos($text, $this->get_prefix($sep)) === 0 );
$args = func_get_args();
return call_user_func_array($this->util->m($this->util, 'has_prefix'), $args);
}
/**
@ -199,9 +117,8 @@ class SLB_Base {
* @return string Text with prefix prepended
*/
function add_prefix($text, $sep = null, $once = true) {
if ( $this->has_prefix($text, $sep) )
return $text;
return $this->get_prefix($sep) . $text;
$args = func_get_args();
return call_user_func_array($this->util->m($this->util, 'add_prefix'), $args);
}
/**
@ -210,28 +127,8 @@ class SLB_Base {
* @param string $sep (optional) Separator used with prefix
*/
function remove_prefix($text, $sep = null) {
if ( $this->has_prefix($text,$sep) )
$text = substr($text, strlen($this->get_prefix($sep)));
return $text;
}
/**
* Creates a meta key for storing post meta data
* Prefixes standard prefixed text with underscore to hide meta data on post edit forms
* @param string $text Text to use as base of meta key
* @return string Formatted meta key
*/
function make_meta_key($text = '') {
return '_' . $this->add_prefix($text);
}
/**
* Returns Database prefix for Cornerstone-related DB Tables
* @return string Database prefix
*/
function get_db_prefix() {
global $wpdb;
return $wpdb->prefix . $this->get_prefix('_');
$args = func_get_args();
return call_user_func_array($this->util->m($this->util, 'remove_prefix'), $args);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,394 @@
<?php
require_once 'class.fields.php';
/**
* Option object
* @package Simple Lightbox
* @subpackage Options
* @author SM
*/
class SLB_Option extends SLB_Field {
/**
* Child mapping
* @see SLB_Field_Base::map
* @var array
*/
var $map = array(
'default' => 'data',
'attr' => 'properties'
);
/* Init */
function SLB_Option($id, $title = '', $default = '') {
$args = func_get_args();
call_user_func_array(array(&$this, '__construct'), $args);
}
/**
* @see SLB_Field::__construct()
* @uses parent::__construct() to initialize instance
* @param $id
* @param $title
* @param $default
*/
function __construct($id, $title = '', $default = '') {
//Normalize properties
$args = func_get_args();
$props = SLB_Utilities::func_get_options($args);
$props = wp_parse_args($props, array ('id' => $id, 'title' => $title, 'default' => $default));
//Send to parent constructor
parent::__construct($props);
}
/* Getters/Setters */
/**
* Retrieve default value for option
* @return mixed Default option value
*/
function get_default($context = '') {
return $this->get_data($context, false);
}
/**
* Sets parent based on default value
*/
function set_parent($parent = null) {
$p =& $this->get_parent();
if ( empty($parent) && empty($p) ) {
$parent = 'text';
$d = $this->get_default();
if ( is_bool($d) )
$parent = 'checkbox';
$parent = 'option_' . $parent;
} elseif ( !empty($p) && !is_object($p) ) {
$parent =& $p;
}
parent::set_parent($parent);
}
/* Formatting */
/**
* Format data as string for browser output
* @see SLB_Field_Base::format()
* @param mixed $value Data to format
* @param string $context (optional) Current context
* @return string Formatted value
*/
function format_display($value, $context = '') {
if ( !is_string($value) ) {
if ( is_bool($value) )
$value = ( $value ) ? 'Enabled' : 'Disabled';
elseif ( is_null($value) )
$value = '';
else
$value = strval($value);
}
return htmlentities($value);
}
}
/**
* Options collection
* @package Simple Lightbox
* @subpackage Options
* @author SM
* @uses SLB_Field_Collection
*/
class SLB_Options extends SLB_Field_Collection {
/* Properties */
var $item_type = 'SLB_Option';
/* Init */
function SLB_Options($id, $props = array()) {
$args = func_get_args();
call_user_func_array(array(&$this, '__construct'), $args);
}
function __construct($id, $props = array()) {
parent::__construct($id, $props);
}
function register_hooks() {
parent::register_hooks();
//Register fields
add_action($this->add_prefix('register_fields'), $this->m('register_fields'));
//Set option parents
add_action($this->add_prefix('fields_registered'), $this->m('set_parents'));
}
/**
* Migrate options from old versions to current version
*/
function migrate() {
//Legacy options
$oid = 'enabled_single';
$d = null;
$this->load_data();
if ( ($o = get_option($oid, $d)) && $o !== $d ) {
$this->set_data('enabled_post', $o, false);
$this->set_data('enabled_page', $o, false);
}
//Migrate separate options to unified option
$items =& $this->get_items();
foreach ( $items as $id => $opt ) {
$oid = $this->add_prefix($id);
$o = get_option($oid, $d);
if ( $o !== $d ) {
//Migrate value to data array
$this->set_data($id, $o, false);
//Delete legacy option
delete_option($oid);
}
}
//Remove any remaining legacy items
if ( is_array($this->properties_init) && isset($this->properties_init['legacy']) && is_array($this->properties_init['legacy']) ) {
foreach( $this->properties_init['legacy'] as $opt )
delete_option($this->add_prefix($opt));
}
//Save changes
$this->save();
}
/* Option setup */
/**
* Register option-specific fields
* @param SLB_Fields $fields Reference to global fields object
* @return void
*/
function register_fields(&$fields) {
//Layouts
$layout_label = '<label for="{field_id}" class="title block">{label}</label>';
$label_ref = '{label ref_base="layout"}';
$field_pre = '<div class="input block">';
$field_post = '</div>';
$opt_pre = '<div class="' . $this->add_prefix('option_item') . '">';
$opt_post = '</div>';
$layout_form = '<{form_attr ref_base="layout"} /> (Default: {data context="display" top="0"})';
//Text input
$otxt =& new SLB_Field_Type('option_text', 'text');
$otxt->set_property('class', '{inherit} code');
$otxt->set_property('size', null);
$otxt->set_property('value', '{data context="form"}');
$otxt->set_layout('label', $layout_label);
$otxt->set_layout('form', $opt_pre . $label_ref . $field_pre . $layout_form . $field_post . $opt_post);
$fields->add($otxt);
//Checkbox
$ocb =& new SLB_Field_Type('option_checkbox', 'checkbox');
$ocb->set_layout('label', $layout_label);
$ocb->set_layout('form', $opt_pre . $label_ref . $field_pre . $layout_form . $field_post . $opt_post);
$fields->add($ocb);
//Theme
$othm =& new SLB_Field_Type('option_theme', 'select');
$othm->set_layout('label', $layout_label);
$othm->set_layout('form_start', $field_pre . '{inherit}');
$othm->set_layout('form_end', '{inherit}' . $field_post);
$othm->set_layout('form', $opt_pre . '{inherit}' . $opt_post);
$fields->add($othm);
}
/**
* Set parent field types for options
* Parent only set for Admin pages
* @uses SLB_Option::set_parent() to set parent field for each option item
* @uses is_admin() to determine if current request is admin page
* @param object $fields Collection of default field types
* @return void
*/
function set_parents(&$fields) {
if ( !is_admin() )
return false;
$items =& $this->get_items();
foreach ( array_keys($items) as $opt ) {
$items[$opt]->set_parent();
}
foreach ( $this->items as $opt ) {
$p = $opt->parent;
if ( is_object($p) )
$p = 'o:' . $p->id;
}
}
/* Processing */
function validate($values) {
if ( is_array($values) ) {
//Get option group being validated
/*
$group = '';
$filter = 'sanitize_option_';
$option = str_replace($filter, '', current_filter());
if ( $this->get_id() == $this->remove_prefix($option) ) {
$group = '';
} else {
$group = substr($option, strlen($this->add_prefix($this->get_id())) + 1);
}
*/
//Format data based on option type (bool, string, etc.)
foreach ( $values as $id => $val ) {
//Get default
$d = $this->get_default($id);
if ( is_bool($d) && !empty($val) )
$values[$id] = true;
}
//Merge in additional options that are not in post data
//Missing options (e.g. disabled checkboxes) & defaults
$items =& $this->get_items();
foreach ( $items as $id => $opt ) {
//Add options that were not included in form submission
if ( !array_key_exists($id, $values) ) {
if ( is_bool($opt->get_default()) )
$values[$id] = false;
else
$values[$id] = $opt->get_default();
}
}
}
//Return value
return $values;
}
/* Data */
/**
* Retrieve options from database
* @return array Options data
*/
function fetch_data($sanitize = true) {
$data = get_option($this->get_key(), null);
if ( $sanitize && is_array($data) ) {
//Sanitize loaded data based on default values
foreach ( $data as $id => $val ) {
if ( $this->has($id) ) {
$opt = $this->get($id);
if ( is_bool($opt->get_default()) )
$data[$id] = !!$val;
} else {
unset($data[$id]);
}
}
}
return $data;
}
/**
* Retrieves option data for collection
* @see SLB_Field_Collection::load_data()
*/
function load_data() {
static $fetched = false;
if ( !$fetched ) {
$fetched = true;
//Retrieve data
$this->data = $this->fetch_data();
}
}
/**
* Resets option values to their default values
* @param bool $hard Reset all options if TRUE (default), Reset only unset options if FALSE
*/
function reset($hard = true) {
$this->load_data();
//Reset data
if ( $hard ) {
$this->data = null;
}
//Save
$this->save();
}
/**
* Save options data to database
*/
function save() {
$opts =& $this->get_items();
$data = array();
foreach ( $opts as $id => $opt ) {
$data[$id] = $opt->get_data();
}
$this->data = $data;
update_option($this->get_key(), $data);
}
/* Collection */
/**
* Build key for saving/retrieving data to options table
* @return string Key
*/
function get_key() {
return $this->add_prefix($this->get_id());
}
/**
* Add option to collection
* @uses SLB_Field_Collection::add() to add item
* @param string $id Unique item ID
* @param string $title Item title
* @param mixed $default Default value
* @param string $group (optional) Group ID to add item to
* @return SLB_Option Option instance reference
*/
function &add($id, $title = '', $default = '', $group = null) {
//Build properties array
$properties = $this->make_properties($title, array('title' => $title, 'group' => $group, 'default' => $default));
//Create item
/**
* @var SLB_Option
*/
$item =& parent::add($id, $properties);
return $item;
}
/**
* Retrieve option value
* @uses get_data() to retrieve option data
* @param string $option Option ID to retrieve value for
* @param string $context (optional) Context for formatting data
* @return mixed Option value
*/
function get_value($option, $context = '') {
return $this->get_data($option, $context);
}
/**
* Retrieve option's default value
* @uses get_data() to retrieve option data
* @param string $option Option ID to retrieve value for
* @param string $context (optional) Context for formatting data
* @return mixed Option's default value
*/
function get_default($option, $context = '') {
return $this->get_data($option, $context, false);
}
/* Output */
function build_group($group) {
if ( !$this->group_exists($group) )
return false;
$group =& $this->get_group($group);
//Stop processing if group contains no items
if ( !count($this->get_items($group)) )
return false;
//Group header
echo '<h4 class="subhead">' . $group->title . '</h4>';
//Build items
echo $this->build_items($group);
}
}

View File

@ -10,12 +10,39 @@
*/
class SLB_Utilities {
function SLB_Utilities() {
$this->__construct();
/* Properties */
/**
* Instance parent
* @var object
*/
var $parent = null;
/**
* Default plugin headers
* @var array
*/
var $plugin_headers = array (
'Name' => 'Plugin Name',
'PluginURI' => 'Plugin URI',
'Version' => 'Version',
'Description' => 'Description',
'Author' => 'Author',
'AuthorURI' => 'Author URI',
'TextDomain' => 'Text Domain',
'DomainPath' => 'Domain Path',
'Network' => 'Network',
);
/* Constructors */
function SLB_Utilities(&$obj) {
$this->__construct(&$obj);
}
function __construct() {
function __construct(&$obj) {
if ( is_object($obj) )
$this->parent =& $obj;
}
/**
@ -33,6 +60,74 @@ class SLB_Utilities {
/* Helper Functions */
/*-** Prefix **-*/
/**
* Get valid separator
* @param string $sep (optional) Separator supplied
* @return string Separator
*/
function get_sep($sep = false) {
if ( is_null($sep) )
$sep = '';
if ( !is_string($sep) )
$default = '_';
return ( is_string($sep) ) ? $sep : $default;
}
/**
* Retrieve class prefix (with separator if set)
* @param bool|string $sep Separator to append to class prefix (Default: no separator)
* @return string Class prefix
*/
function get_prefix($sep = null) {
$sep = $this->get_sep($sep);
$prefix = ( !empty($this->parent->prefix) ) ? $this->parent->prefix . $sep : '';
return $prefix;
}
/**
* Check if a string is prefixed
* @param string $text Text to check for prefix
* @param string $sep (optional) Separator used
*/
function has_prefix($text, $sep = null) {
return ( !empty($text) && strpos($text, $this->get_prefix($sep)) === 0 );
}
/**
* Prepend plugin prefix to some text
* @param string $text Text to add to prefix
* @param string $sep (optional) Text used to separate prefix and text
* @param bool $once (optional) Whether to add prefix to text that already contains a prefix or not
* @return string Text with prefix prepended
*/
function add_prefix($text, $sep = '_', $once = true) {
if ( $this->has_prefix($text, $sep) )
return $text;
return $this->get_prefix($sep) . $text;
}
/**
* Remove prefix from specified string
* @param string $text String to remove prefix from
* @param string $sep (optional) Separator used with prefix
*/
function remove_prefix($text, $sep = '_') {
if ( $this->has_prefix($text,$sep) )
$text = substr($text, strlen($this->get_prefix($sep)));
return $text;
}
/**
* Returns Database prefix for Cornerstone-related DB Tables
* @return string Database prefix
*/
function get_db_prefix() {
global $wpdb;
return $wpdb->prefix . $this->get_prefix('_');
}
/*-** WP **-*/
/**
@ -59,6 +154,108 @@ class SLB_Utilities {
return true;
}
/* Hooks */
function do_action($tag, $arg = '') {
do_action($this->add_prefix($tag), $arg);
}
function apply_filters($tag, $value) {
apply_filters($this->add_prefix($tag), $value);
}
function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
return add_action($this->add_prefix($tag), $function_to_add, $priority, $accepted_args);
}
function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
return add_filter($this->add_prefix(tag), $function_to_add, $priority, $accepted_args);
}
/* Meta */
/**
* Retrieves post metadata for internal methods
* Metadata set internally is wrapped in an array so it is unwrapped before returned the retrieved value
* @see get_post_meta()
* @param int $post_id Post ID
* @param string $key Name of metadata to retrieve
* @param boolean $single Whether or not to retrieve single value or not
* @return mixed Retrieved post metadata
*/
function post_meta_get($post_id, $key, $single = false) {
$meta_value = get_post_meta($post_id, $this->post_meta_get_key($key), $single);
if (is_array($meta_value) && count($meta_value) == 1)
$meta_value = $meta_value[0];
return $meta_value;
}
/**
* Wraps metadata in array for storage in database
* @param mixed $meta_value Value to be set as metadata
* @return array Wrapped metadata value
*/
function post_meta_prepare_value($meta_value) {
return array($meta_value);
}
/**
* Adds Metadata for a post to database
* For internal methods
* @see add_post_meta
* @param $post_id
* @param $meta_key
* @param $meta_value
* @param $unique
* @return boolean Result of operation
*/
function post_meta_add($post_id, $meta_key, $meta_value, $unique = false) {
$meta_value = $this->post_meta_value_prepare($meta_value);
return add_post_meta($post_id, $meta_key, $meta_value, $unique);
}
/**
* Updates post metadata for internal data/methods
* @see update_post_meta()
* @param $post_id
* @param $meta_key
* @param $meta_value
* @param $prev_value
* @return boolean Result of operation
*/
function post_meta_update($post_id, $meta_key, $meta_value, $prev_value = '') {
$meta_value = $this->post_meta_prepare_value($meta_value);
return update_post_meta($post_id, $meta_key, $meta_value, $prev_value);
}
/**
* Builds postmeta key for custom data set by plugin
* @param string $key Base key name
* @return string Formatted postmeta key
*/
function post_meta_get_key($key) {
$sep = '_';
if ( strpos($key, $sep . $this->prefix) !== 0 ) {
$key_base = func_get_args();
if ( !empty($key_base) ) {
$key = array_merge((array)$this->prefix, $key_base);
return $sep . implode($sep, $key);
}
}
return $key;
}
/**
* Creates a meta key for storing post meta data
* Prefixes standard prefixed text with underscore to hide meta data on post edit forms
* @param string $text Text to use as base of meta key
* @return string Formatted meta key
*/
function make_meta_key($text = '') {
return '_' . $this->add_prefix($text);
}
/*-** Request **-*/
/**
@ -133,16 +330,28 @@ class SLB_Utilities {
if ( $trailing_slash )
$parts .= $sl_f;
return $parts;
}
}
/**
* Returns URL of file (assumes that it is in plugin directory)
* @param string $file name of file get URL
* @return string File path
* @return string File URL
*/
function get_file_url($file) {
if ( is_string($file) && '' != trim($file) ) {
$file = $this->normalize_path($this->get_url_base(), $file);
$file = str_replace(' ', '%20', $this->normalize_path($this->get_url_base(), $file));
}
return $file;
}
/**
* Returns path to plugin file
* @param string $file file name
* @return string File path
*/
function get_file_path($file) {
if ( is_string($file) && '' != trim($file) ) {
$file = $this->normalize_path($this->get_path_base(), $file);
}
return $file;
}
@ -155,13 +364,14 @@ class SLB_Utilities {
function get_file_extension($file) {
$ret = '';
$sep = '.';
if ( is_string($icon) && ( $rpos = strrpos($file, $sep) ) !== false )
if ( ( $rpos = strrpos($file, $sep) ) !== false )
$ret = substr($file, $rpos + 1);
return $ret;
}
/**
* Checks if file has specified extension
* @uses get_file_extension()
* @param string $file File name/path
* @param string $extension File ending to check $file for
* @return bool TRUE if file has extension
@ -172,6 +382,8 @@ class SLB_Utilities {
/**
* Retrieve base URL for plugin-specific files
* @uses get_plugin_base()
* @uses normalize_path()
* @return string Base URL
*/
function get_url_base() {
@ -182,6 +394,13 @@ class SLB_Utilities {
return $url_base;
}
/**
* Retrieve plugin's base path
* @uses WP_PLUGIN_DIR
* @uses get_plugin_base()
* @uses normalize_path()
* @return string Base path
*/
function get_path_base() {
static $path_base = '';
if ( '' == $path_base ) {
@ -190,6 +409,12 @@ class SLB_Utilities {
return $path_base;
}
/**
* Retrieve plugin's base directory
* @uses WP_PLUGIN_DIR
* @uses normalize_path()
* @return string Base directory
*/
function get_plugin_base() {
static $plugin_dir = '';
if ( '' == $plugin_dir ) {
@ -198,16 +423,96 @@ class SLB_Utilities {
return $plugin_dir;
}
/**
* Retrieve plugin's base file path
* @uses get_path_base()
* @uses get_file_path()
* @return string Base file path
*/
function get_plugin_base_file() {
$file = 'main.php';
return $this->get_path_base() . '/' . $file;
static $file = '';
global $cnr;
if ( empty($file) ) {
$dir = @ opendir($this->get_path_base());
if ( $dir ) {
while ( ($ftemp = readdir($dir)) !== false ) {
//Only process PHP files
$ftemp = $this->get_file_path($ftemp);
if ( !$this->has_file_extension($ftemp, 'php') || !is_readable($ftemp) )
continue;
//Check for data
$data = get_file_data($ftemp, $this->plugin_headers);
if ( !empty($data['Name']) ) {
//Set base file
$file = $ftemp;
break;
}
}
}
@closedir($dir);
}
//Return
return $file;
}
/**
* Retrieve plugin's internal name
* Internal name is used by WP core
* @uses get_plugin_base_file()
* @uses plugin_basename()
* @return string Internal plugin name
*/
function get_plugin_base_name() {
$file = $this->get_plugin_base_file();
return plugin_basename($file);
}
/**
* Retrieve plugin info
* Parses info comment in main plugin file
* @uses get_plugin_base_file()
*/
function get_plugin_info($field = '') {
static $data = array();
$ret = '';
//Get plugin data
if ( empty($data) ) {
$file = $this->get_plugin_base_file();
$data = get_file_data($file, $this->plugin_headers);
}
//Return specified field
if ( !empty($field) ) {
if ( isset($data[$field]) )
$ret = $data[$field];
} else {
$ret = $data;
}
return $ret;
}
/**
* Retrieve plugin version
* @uses get_plugin_info()
* @param bool $strip_desc Strip any additional version text
* @return string Plugin version
*/
function get_plugin_version($strip_desc = true) {
static $v = '';
//Retrieve version
if ( empty($v) ) {
$field = 'Version';
$v = $this->get_plugin_info($field);
}
//Format
$ret = $v;
if ( $strip_desc ) {
$ret = explode(' ', $ret, 2);
$ret = $ret[0];
}
//Return
return $ret;
}
/**
* Retrieve current action based on URL query variables
* @param mixed $default (optional) Default action if no action exists
@ -246,6 +551,22 @@ class SLB_Utilities {
/*-** General **-*/
/**
* Checks if last parameter sent to a function is an array of options and returns it
* Calling function should use `func_get_args()` and pass the value to this method
* @param array $args Parameters passed to calling function
* @return array Options array (Default: empty array)
*/
function func_get_options($args) {
$r = array();
if ( is_array($args) && !empty($args) ) {
$last = count($args) - 1;
if ( is_array($args[$last]) )
$r = $args[$last];
}
return $r;
}
/**
* Checks if a property exists in a class or object
* (Compatibility method for PHP 4
@ -284,6 +605,60 @@ class SLB_Utilities {
}
}
/**
* Remap array members based on a
* mapping of source/destination keys
* @param array $properties Associative array of properties
* @param array $map Source/Destination mapping
* > Key: Source member
* > Val: Destination member
* @param bool $overwrite If TRUE, source value will be set in destination regardless of whether member already exists or not
* @return array Remapped properties
*/
function array_remap($arr, $map = array(), $overwrite = false) {
if ( !empty($map) && is_array($map) ) {
//Iterate through mappings
foreach ( $map as $from => $to ) {
if ( !array_key_exists($from, $arr) )
continue;
$move = $overwrite;
//Only remap if parent property doesn't already exist in array
if ( !array_key_exists($to, $arr) )
$move = true;
if ( $move ) {
//Move member value to new key
$arr[$to] = $arr[$from];
//Remove source member
unset($arr[$from]);
}
}
}
//Return remapped properties
return $arr;
}
function array_filter_keys($arr, $keys) {
if ( is_array($arr) && !empty($arr) && is_array($keys) && !empty($keys) ) {
foreach ( $keys as $rem ) {
if ( array_key_exists($rem, $arr) )
unset($arr[$rem]);
}
}
return $arr;
}
/**
* Insert an item into an array at the specified position
* @param mixed $item Item to insert into array
* @param int $pos Index position to insert item into array
* @return array Modified array
*/
function array_insert($array, $item, $pos = null) {
array_splice($array, $pos, 0, $item);
return $array;
}
/**
* Merges 1 or more arrays together
* Methodology
@ -383,6 +758,13 @@ class SLB_Utilities {
return $item;
}
/**
* Build formatted string based on array values
* Array values in formatted string will be ordered by index order
* @param array $attribute Values to build string with
* @param string $format (optional) Format name (Default: Multidimensional array representation > ['value1']['value2']['value3'], etc.)
* @return string Formatted string based on array values
*/
function get_array_path($attribute = '', $format = null) {
//Formatted value
$fmtd = '';

View File

@ -4,7 +4,7 @@
// by Archetyped - http://archetyped.com/tools/simple-lightbox/
// Updated: 2011-01-27
//
// Largely based on Lightbox Slideshow v1.1
// Originally based on Lightbox Slideshow v1.1
// by Justin Barkhuff - http://www.justinbarkhuff.com/lab/lightbox_slideshow/
// 2007/08/15
//
@ -21,7 +21,7 @@
/**
* Lightbox object
*/
var SLB = null;
//var SLB = null;
(function($) {
SLB = {
activeImage : null,
@ -34,7 +34,7 @@ SLB = {
overlayDuration : null,
overlayOpacity : null,
playSlides : null,
refTags : ['a','area'],
refTags : ['a'],
relAttribute : null,
resizeDuration : null,
slideShowTimer : null,
@ -42,6 +42,7 @@ SLB = {
prefix : 'slb',
checkedUrls : {},
/**
* Initialize lightbox instance
* @param object options Instance options
@ -66,6 +67,7 @@ SLB = {
resizeSpeed : 400, // controls the speed of the image resizing (milliseconds)
showGroupName : false, // show group name of images in image details
slideTime : 4, // time to display images during slideshow
altsrc : 'src',
strings : { // allows for localization
closeLink : 'close',
loadingMsg : 'loading',
@ -93,6 +95,7 @@ SLB = {
if (!this.options.layout || this.options.layout.toString().length == 0)
this.end();
//Validate options
if ( this.options.animate ) {
this.overlayDuration = Math.max(this.options.overlayDuration,0);
this.resizeDuration = this.options.resizeSpeed;
@ -100,7 +103,6 @@ SLB = {
this.overlayDuration = 0;
this.resizeDuration = 0;
}
this.enableSlideshow = this.options.enableSlideshow;
this.overlayOpacity = Math.max(Math.min(this.options.overlayOpacity,1),0);
this.playSlides = this.options.autoPlay;
@ -218,19 +220,23 @@ SLB = {
*/
updateImageList: function() {
var el, els, rel, t = this;
for(var i=0; i < this.refTags.length; i++) {
els = $(this.container).find(this.refTags[i]);
for(var j=0; j < els.length; j++) {
el = els[j];
rel = $(el).attr('rel');
if ($(el).attr('href') && (rel.toLowerCase().match(this.relAttribute))) {
$(el).click(function() {
t.start(this);
return false;
});
}
}
sel = [], selBase = '[href][rel*="' + this.relAttribute + '"]';
//Define event handler
var handler = function() {
//Check if element is valid for lightbox
t.start(this);
return false;
};
//Build selector
for (var i = 0; i < this.refTags.length; i++) {
sel.push(this.refTags[i] + selBase);
}
sel = sel.join(',');
//Add event handler to links
$(sel, $(this.container)).live('click', handler);
},
/**
@ -271,12 +277,11 @@ SLB = {
this.imageArray = [];
this.groupName = this.getGroup(imageLink);
var rel = $(imageLink).attr('rel');
var rel = $(imageLink).attr('rel') || '';
var imageTitle = '';
var t = this;
var groupTemp = {};
this.fileExists($(imageLink).attr('href'),
this.fileExists(this.getSourceFile(imageLink),
function() { //File exists
// Stretch overlay to fill page and fade in
t.get('overlay')
@ -304,7 +309,7 @@ SLB = {
if ($(el).get(0) == $(imageLink).get(0)) {
t.startImage = x;
}
t.imageArray.push({'link':$(el).attr('href'), 'title':t.getCaption(el)});
t.imageArray.push({'link':t.getSourceFile($(el)), 'title':t.getCaption(el)});
}
// Calculate top offset for the lightbox and display
var lightboxTop = $(document).scrollTop() + ($(window).height() / 15);
@ -327,7 +332,7 @@ SLB = {
var i, el;
for (i = 0; i < els.length; i++) {
el = $(els[i]);
if (el.attr('href') && (t.getGroup(el) == t.groupName)) {
if (t.getSourceFile(el) && (t.getGroup(el) == t.groupName)) {
//Add links in same group to temp array
grpLinks.push(el);
}
@ -337,7 +342,7 @@ SLB = {
var processed = 0;
for (i = 0; i < grpLinks.length; i++) {
el = grpLinks[i];
t.fileExists($(el).attr('href'),
t.fileExists(t.getSourceFile($(el)),
function(args) { //File exists
var el = args.els[args.idx];
var il = addLink(el, args.idx);
@ -359,6 +364,21 @@ SLB = {
});
},
/**
* Retrieve source URI in link
* @param {Object} el
* @return string Source file URI
*/
getSourceFile: function(el) {
var src = $(el).attr('href');
var rel = $(el).attr('rel') || '';
var reSrc = new RegExp('\\b' + this.options.altsrc + '\\[(.+?)\\](?:\\b|$)');
if ( reSrc.test(rel) ) {
src = reSrc.exec(rel)[1];
}
return src;
},
/**
* Extract group name from
* @param obj el Element to extract group name from
@ -367,31 +387,34 @@ SLB = {
getGroup: function(el) {
//Get full attribute value
var g = null;
var gTmp = '';
var gSt = '[';
var gEnd = ']';
var rel = $(el).attr('rel');
var search = this.relAttribute;
var searching = true;
var idx;
var prefix = ' ';
while (searching) {
idx = rel.indexOf(search);
//Stop processing if value is not found
if (idx == -1)
return g;
//Prefix with space to find whole word
if (prefix != search.charAt(0) && idx > 0) {
search = prefix + search;
} else {
searching = false;
var rel = $(el).attr('rel') || '';
if (rel != '') {
var gTmp = '';
var gSt = '[';
var gEnd = ']';
var search = this.relAttribute;
var searching = true;
var idx;
var prefix = ' ';
while (searching) {
idx = rel.indexOf(search);
//Stop processing if value is not found
if (idx == -1)
return g;
//Prefix with space to find whole word
if (prefix != search.charAt(0) && idx > 0) {
search = prefix + search;
}
else {
searching = false;
}
}
gTmp = $.trim(rel.substring(idx).replace(search, ''));
//Check if group defined
if (gTmp.length && gSt == gTmp.charAt(0) && gTmp.indexOf(gEnd) != -1) {
//Extract group name
g = gTmp.substring(1, gTmp.indexOf(gEnd));
}
}
gTmp = $.trim(rel.substring(idx).replace(search, ''));
//Check if group defined
if (gTmp.length && gSt == gTmp.charAt(0) && gTmp.indexOf(gEnd) != -1) {
//Extract group name
g = gTmp.substring(1, gTmp.indexOf(gEnd));
}
return g;
},

View File

@ -1,22 +1,21 @@
var SLB=null;
(function(d){SLB={activeImage:null,badObjects:["select","object","embed"],container:null,enableSlideshow:null,groupName:null,imageArray:[],options:null,overlayDuration:null,overlayOpacity:null,playSlides:null,refTags:["a","area"],relAttribute:null,resizeDuration:null,slideShowTimer:null,startImage:null,prefix:"slb",checkedUrls:{},initialize:function(a){this.options=d.extend(true,{animate:true,validateLinks:false,captionEnabled:true,captionSrc:true,autoPlay:true,borderSize:10,containerID:document,enableSlideshow:true,
googleAnalytics:false,imageDataLocation:"south",initImage:"",loop:true,overlayDuration:0.2,overlayOpacity:0.8,relAttribute:"lightbox",resizeSpeed:400,showGroupName:false,slideTime:4,strings:{closeLink:"close",loadingMsg:"loading",nextLink:"next &raquo;",prevLink:"&laquo; prev",startSlideshow:"start slideshow",stopSlideshow:"stop slideshow",numDisplayPrefix:"Image",numDisplaySeparator:"of"},placeholders:{slbContent:'<img id="slb_slbContent" />',slbLoading:'<span id="slb_slbLoading">loading</span>',
(function(d){SLB={activeImage:null,badObjects:["select","object","embed"],container:null,enableSlideshow:null,groupName:null,imageArray:[],options:null,overlayDuration:null,overlayOpacity:null,playSlides:null,refTags:["a"],relAttribute:null,resizeDuration:null,slideShowTimer:null,startImage:null,prefix:"slb",checkedUrls:{},initialize:function(a){this.options=d.extend(true,{animate:true,validateLinks:false,captionEnabled:true,captionSrc:true,autoPlay:true,borderSize:10,containerID:document,enableSlideshow:true,
googleAnalytics:false,imageDataLocation:"south",initImage:"",loop:true,overlayDuration:0.2,overlayOpacity:0.8,relAttribute:"lightbox",resizeSpeed:400,showGroupName:false,slideTime:4,altsrc:"src",strings:{closeLink:"close",loadingMsg:"loading",nextLink:"next &raquo;",prevLink:"&laquo; prev",startSlideshow:"start slideshow",stopSlideshow:"stop slideshow",numDisplayPrefix:"Image",numDisplaySeparator:"of"},placeholders:{slbContent:'<img id="slb_slbContent" />',slbLoading:'<span id="slb_slbLoading">loading</span>',
slbClose:'<a class="slb_slbClose" href="#">close</a>',navPrev:'<a class="slb_navPrev slb_nav" href="#">&laquo; prev</a>',navNext:'<a class="slb_navNext slb_nav" href="#">&raquo; next</a>',navSlideControl:'<a class="slb_navSlideControl" href="#">Stop</a>',dataCaption:'<span class="slb_dataCaption"></span>',dataNumber:'<span class="slb_dataNumber"></span>'},layout:null},a);if(!this.options.layout||this.options.layout.toString().length==0)this.end();if(this.options.animate){this.overlayDuration=Math.max(this.options.overlayDuration,
0);this.resizeDuration=this.options.resizeSpeed}else this.resizeDuration=this.overlayDuration=0;this.enableSlideshow=this.options.enableSlideshow;this.overlayOpacity=Math.max(Math.min(this.options.overlayOpacity,1),0);this.playSlides=this.options.autoPlay;this.container=d(this.options.containerID);this.relAttribute=this.options.relAttribute;this.updateImageList();var b=this;a=d(this.container).get(0)!=document?this.container:d("body");d("<div/>",{id:this.getID("overlay"),css:{display:"none"}}).appendTo(a).click(function(){b.end()});
a=d("<div/>",{id:this.getID("lightbox"),css:{display:"none"}}).appendTo(a).click(function(){b.end()});var c=this.getLayout();d(c).appendTo(a);this.setUI();this.setEvents();this.options.initImage!=""&&this.start(d(this.options.initImage))},getLayout:function(){var a=this.options.layout,b,c;for(b in this.options.placeholders){c="{"+b+"}";if(a.indexOf(c)!=-1){c=new RegExp(c,"g");a=a.replace(c,this.options.placeholders[b])}}return a},setUI:function(){var a=this.options.strings;this.get("slbClose").html(a.closeLink);
this.get("navNext").html(a.nextLink);this.get("navPrev").html(a.prevLink);this.get("navSlideControl").html(this.playSlides?a.stopSlideshow:a.startSlideshow)},setEvents:function(){var a=this;this.get("container,details").click(function(e){e.stopPropagation()});var b=function(){a.get("navPrev").unbind("click").click(false);setTimeout(function(){a.get("navPrev").click(b)},500);a.showPrev();return false};this.get("navPrev").click(function(){return b()});var c=function(){a.get("navNext").unbind("click").click(false);
setTimeout(function(){a.get("navNext").click(c)},500);a.showNext();return false};this.get("navNext").click(function(){return c()});this.get("navSlideControl").click(function(){a.toggleSlideShow();return false});this.get("slbClose").click(function(){a.end();return false})},updateImageList:function(){for(var a,b,c,e=this,g=0;g<this.refTags.length;g++){b=d(this.container).find(this.refTags[g]);for(var i=0;i<b.length;i++){a=b[i];c=d(a).attr("rel");d(a).attr("href")&&c.toLowerCase().match(this.relAttribute)&&
d(a).click(function(){e.start(this);return false})}}},getCaption:function(a){a=d(a);var b="";if(this.options.captionEnabled){b=a.attr("title")||"";if(b==""){var c=d(a).find("img").first();if(d(c).length)b=d(c).attr("title")||d(c).attr("alt");if(!b)if(a.text().length)b=a.text();else if(this.options.captionSrc)b=a.attr("href");b||(b="")}}return b},start:function(a){a=d(a);this.hideBadObjects();this.imageArray=[];this.groupName=this.getGroup(a);d(a).attr("rel");var b=this,c={};this.fileExists(d(a).attr("href"),
function(){b.get("overlay").height(d(document).height()).fadeTo(b.overlayDuration,b.overlayOpacity);var e=function(){b.startImage=0;var f=[],l;for(var k in c)f.push(k);f.sort(function(n,o){return n-o});for(k=0;k<f.length;k++){l=c[f[k]];if(d(l).get(0)==d(a).get(0))b.startImage=k;b.imageArray.push({link:d(l).attr("href"),title:b.getCaption(l)})}f=d(document).scrollTop()+d(window).height()/15;b.get("lightbox").css("top",f+"px").show();b.changeImage(b.startImage)};if(null==b.groupName){c[0]=a;b.startImage=
0;e()}else{var g=d(b.container).find(d(a).get(0).tagName.toLowerCase()),i=[],h,j;for(h=0;h<g.length;h++){j=d(g[h]);j.attr("href")&&b.getGroup(j)==b.groupName&&i.push(j)}var m=0;for(h=0;h<i.length;h++){j=i[h];b.fileExists(d(j).attr("href"),function(f){c[f.idx]=f.els[f.idx];m++;m==f.els.length&&e()},function(f){m++;f.idx==f.els.length&&e()},{idx:h,els:i})}}},function(){b.end()})},getGroup:function(a){var b=null,c="";a=d(a).attr("rel");c=this.relAttribute;for(var e=true,g;e;){g=a.indexOf(c);if(g==-1)return b;
if(" "!=c.charAt(0)&&g>0)c=" "+c;else e=false}c=d.trim(a.substring(g).replace(c,""));if(c.length&&"["==c.charAt(0)&&c.indexOf("]")!=-1)b=c.substring(1,c.indexOf("]"));return b},changeImage:function(a){this.activeImage=a;this.disableKeyboardNav();this.pauseSlideShow();this.get("slbLoading").show();this.get("slbContent").hide();this.get("details").hide();var b=new Image,c=this;d(b).bind("load",function(){c.get("slbContent").attr("src",b.src);c.resizeImageContainer(b.width,b.height);c.isSlideShowActive()&&
c.startSlideShow()});b.src=this.imageArray[this.activeImage].link},resizeImageContainer:function(a,b){this.get("container");var c=this.options.borderSize*2;this.get("container").animate({width:a+c,height:b+c},this.resizeDuration);this.showImage()},showImage:function(){this.get("slbLoading").hide();var a=this;this.get("slbContent").fadeIn(500,function(){a.updateDetails()});this.preloadNeighborImages()},updateDetails:function(){if(this.options.captionEnabled){this.get("dataCaption").text(this.imageArray[this.activeImage].title);
this.get("dataCaption").show()}else this.get("dataCaption").hide();if(this.hasImages()){var a=this.options.strings.numDisplayPrefix+" "+(this.activeImage+1)+" "+this.options.strings.numDisplaySeparator+" "+this.imageArray.length;if(this.options.showGroupName&&this.groupName!="")a+=" "+this.options.strings.numDisplaySeparator+" "+this.groupName;this.get("dataNumber").text(a).show()}this.get("details").width(this.get("slbContent").width()+this.options.borderSize*2);this.updateNav();this.get("details").animate({height:"show",
opacity:"show"},650)},updateNav:function(){if(this.hasImages()){this.get("navPrev").show();this.get("navNext").show();if(this.enableSlideshow){this.get("navSlideControl").show();this.playSlides?this.startSlideShow():this.stopSlideShow()}else this.get("navSlideControl").hide()}else{this.get("dataNumber").hide();this.get("navPrev").hide();this.get("navNext").hide();this.get("navSlideControl").hide()}this.enableKeyboardNav()},isSlideShowActive:function(){return this.playSlides},startSlideShow:function(){this.playSlides=
true;var a=this;clearInterval(this.slideShowTimer);this.slideShowTimer=setInterval(function(){a.showNext();a.pauseSlideShow()},this.options.slideTime*1E3);this.get("navSlideControl").text(this.options.strings.stopSlideshow)},stopSlideShow:function(){this.playSlides=false;this.slideShowTimer&&clearInterval(this.slideShowTimer);this.get("navSlideControl").text(this.options.strings.startSlideshow)},toggleSlideShow:function(){this.playSlides?this.stopSlideShow():this.startSlideShow()},pauseSlideShow:function(){this.slideShowTimer&&
clearInterval(this.slideShowTimer)},hasImage:function(){return this.imageArray.length>0},hasImages:function(){return this.imageArray.length>1},isFirstImage:function(){return this.activeImage==0},isLastImage:function(){return this.activeImage==this.imageArray.length-1},showNext:function(){if(this.hasImages()){if(!this.options.loop&&this.isLastImage())return this.end();this.isLastImage()?this.showFirst():this.changeImage(this.activeImage+1)}},showPrev:function(){if(this.hasImages()){if(!this.options.loop&&
this.isFirstImage())return this.end();this.activeImage==0?this.showLast():this.changeImage(this.activeImage-1)}},showFirst:function(){this.hasImages()&&this.changeImage(0)},showLast:function(){this.hasImages()&&this.changeImage(this.imageArray.length-1)},enableKeyboardNav:function(){var a=this;d(document).keydown(function(b){a.keyboardAction(b)})},disableKeyboardNav:function(){d(document).unbind("keydown")},keyboardAction:function(a){keycode=a==null?event.keyCode:a.which;key=String.fromCharCode(keycode).toLowerCase();
if(keycode==27||key=="x"||key=="o"||key=="c")this.end();else if(key=="p"||key=="%")this.showPrev();else if(key=="n"||key=="'")this.showNext();else if(key=="f")this.showFirst();else if(key=="l")this.showLast();else key=="s"&&this.hasImage()&&this.options.enableSlideshow&&this.toggleSlideShow()},preloadNeighborImages:function(){var a=this.imageArray.length-1==this.activeImage?0:this.activeImage+1;nextImage=new Image;nextImage.src=this.imageArray[a].link;a=this.activeImage==0?this.imageArray.length-
1:this.activeImage-1;prevImage=new Image;prevImage.src=this.imageArray[a].link},end:function(){this.disableKeyboardNav();this.pauseSlideShow();this.get("lightbox").hide();this.get("overlay").fadeOut(this.overlayDuration);this.showBadObjects()},showBadObjects:function(a){d(this.badObjects.join(",")).css("visibility",(typeof a=="undefined"?true:!!a)?"visible":"hidden")},hideBadObjects:function(){this.showBadObjects(false)},addPrefix:function(a){return this.prefix+"_"+a},getID:function(a){return this.addPrefix(a)},
getSel:function(a){var b="#";if(a.toString().indexOf(",")!=-1){a=a.toString().split(",");for(b=0;b<a.length;b++)a[b]=this.getSel(d.trim(a[b]));a=a.join(",")}else{if(a in this.options.placeholders)d(this.options.placeholders[a]).attr("id")||(b=".");a=b+this.getID(a)}return a},get:function(a){return d(this.getSel(a))},fileExists:function(a,b,c,e){if(!this.options.validateLinks)return b(e);var g=this,i=function(j){if(j.status<400)d.isFunction(b)&&b(e);else d.isFunction(c)&&c(e)};if(a in this.checkedUrls)i(this.checkedUrls[a]);
else{var h=new XMLHttpRequest;h.open("HEAD",a,true);h.onreadystatechange=function(){if(4==this.readyState){g.addUrl(a,this);i(this)}};h.send()}},addUrl:function(a,b){a in this.checkedUrls||(this.checkedUrls[a]=b)}}})(jQuery);
this.get("navNext").html(a.nextLink);this.get("navPrev").html(a.prevLink);this.get("navSlideControl").html(this.playSlides?a.stopSlideshow:a.startSlideshow)},setEvents:function(){var a=this;this.get("container,details").click(function(g){g.stopPropagation()});var b=function(){a.get("navPrev").unbind("click").click(false);setTimeout(function(){a.get("navPrev").click(b)},500);a.showPrev();return false};this.get("navPrev").click(function(){return b()});var c=function(){a.get("navNext").unbind("click").click(false);
setTimeout(function(){a.get("navNext").click(c)},500);a.showNext();return false};this.get("navNext").click(function(){return c()});this.get("navSlideControl").click(function(){a.toggleSlideShow();return false});this.get("slbClose").click(function(){a.end();return false})},updateImageList:function(){var a=this;sel=[];selBase='[href][rel*="'+this.relAttribute+'"]';for(var b=0;b<this.refTags.length;b++)sel.push(this.refTags[b]+selBase);sel=sel.join(",");d(sel,d(this.container)).live("click",function(){a.start(this);
return false})},getCaption:function(a){a=d(a);var b="";if(this.options.captionEnabled){b=a.attr("title")||"";if(b==""){var c=d(a).find("img").first();if(d(c).length)b=d(c).attr("title")||d(c).attr("alt");if(!b)if(a.text().length)b=a.text();else if(this.options.captionSrc)b=a.attr("href");b||(b="")}}return b},start:function(a){a=d(a);this.hideBadObjects();this.imageArray=[];this.groupName=this.getGroup(a);d(a).attr("rel");var b=this,c={};this.fileExists(this.getSourceFile(a),function(){b.get("overlay").height(d(document).height()).fadeTo(b.overlayDuration,
b.overlayOpacity);var g=function(){b.startImage=0;var e=[],l;for(var k in c)e.push(k);e.sort(function(n,o){return n-o});for(k=0;k<e.length;k++){l=c[e[k]];if(d(l).get(0)==d(a).get(0))b.startImage=k;b.imageArray.push({link:b.getSourceFile(d(l)),title:b.getCaption(l)})}e=d(document).scrollTop()+d(window).height()/15;b.get("lightbox").css("top",e+"px").show();b.changeImage(b.startImage)};if(null==b.groupName){c[0]=a;b.startImage=0;g()}else{var h=d(b.container).find(d(a).get(0).tagName.toLowerCase()),
j=[],f,i;for(f=0;f<h.length;f++){i=d(h[f]);b.getSourceFile(i)&&b.getGroup(i)==b.groupName&&j.push(i)}var m=0;for(f=0;f<j.length;f++){i=j[f];b.fileExists(b.getSourceFile(d(i)),function(e){c[e.idx]=e.els[e.idx];m++;m==e.els.length&&g()},function(e){m++;e.idx==e.els.length&&g()},{idx:f,els:j})}}},function(){b.end()})},getSourceFile:function(a){var b=d(a).attr("href");a=d(a).attr("rel")||"";var c=new RegExp("\\b"+this.options.altsrc+"\\[(.+?)\\](?:\\b|$)");if(c.test(a))b=c.exec(a)[1];return b},getGroup:function(a){var b=
null;a=d(a).attr("rel")||"";if(a!=""){var c="";c=this.relAttribute;for(var g=true,h;g;){h=a.indexOf(c);if(h==-1)return b;if(" "!=c.charAt(0)&&h>0)c=" "+c;else g=false}c=d.trim(a.substring(h).replace(c,""));if(c.length&&"["==c.charAt(0)&&c.indexOf("]")!=-1)b=c.substring(1,c.indexOf("]"))}return b},changeImage:function(a){this.activeImage=a;this.disableKeyboardNav();this.pauseSlideShow();this.get("slbLoading").show();this.get("slbContent").hide();this.get("details").hide();var b=new Image,c=this;d(b).bind("load",
function(){c.get("slbContent").attr("src",b.src);c.resizeImageContainer(b.width,b.height);c.isSlideShowActive()&&c.startSlideShow()});b.src=this.imageArray[this.activeImage].link},resizeImageContainer:function(a,b){this.get("container");var c=this.options.borderSize*2;this.get("container").animate({width:a+c,height:b+c},this.resizeDuration);this.showImage()},showImage:function(){this.get("slbLoading").hide();var a=this;this.get("slbContent").fadeIn(500,function(){a.updateDetails()});this.preloadNeighborImages()},
updateDetails:function(){if(this.options.captionEnabled){this.get("dataCaption").text(this.imageArray[this.activeImage].title);this.get("dataCaption").show()}else this.get("dataCaption").hide();if(this.hasImages()){var a=this.options.strings.numDisplayPrefix+" "+(this.activeImage+1)+" "+this.options.strings.numDisplaySeparator+" "+this.imageArray.length;if(this.options.showGroupName&&this.groupName!="")a+=" "+this.options.strings.numDisplaySeparator+" "+this.groupName;this.get("dataNumber").text(a).show()}this.get("details").width(this.get("slbContent").width()+
this.options.borderSize*2);this.updateNav();this.get("details").animate({height:"show",opacity:"show"},650)},updateNav:function(){if(this.hasImages()){this.get("navPrev").show();this.get("navNext").show();if(this.enableSlideshow){this.get("navSlideControl").show();this.playSlides?this.startSlideShow():this.stopSlideShow()}else this.get("navSlideControl").hide()}else{this.get("dataNumber").hide();this.get("navPrev").hide();this.get("navNext").hide();this.get("navSlideControl").hide()}this.enableKeyboardNav()},
isSlideShowActive:function(){return this.playSlides},startSlideShow:function(){this.playSlides=true;var a=this;clearInterval(this.slideShowTimer);this.slideShowTimer=setInterval(function(){a.showNext();a.pauseSlideShow()},this.options.slideTime*1E3);this.get("navSlideControl").text(this.options.strings.stopSlideshow)},stopSlideShow:function(){this.playSlides=false;this.slideShowTimer&&clearInterval(this.slideShowTimer);this.get("navSlideControl").text(this.options.strings.startSlideshow)},toggleSlideShow:function(){this.playSlides?
this.stopSlideShow():this.startSlideShow()},pauseSlideShow:function(){this.slideShowTimer&&clearInterval(this.slideShowTimer)},hasImage:function(){return this.imageArray.length>0},hasImages:function(){return this.imageArray.length>1},isFirstImage:function(){return this.activeImage==0},isLastImage:function(){return this.activeImage==this.imageArray.length-1},showNext:function(){if(this.hasImages()){if(!this.options.loop&&this.isLastImage())return this.end();this.isLastImage()?this.showFirst():this.changeImage(this.activeImage+
1)}},showPrev:function(){if(this.hasImages()){if(!this.options.loop&&this.isFirstImage())return this.end();this.activeImage==0?this.showLast():this.changeImage(this.activeImage-1)}},showFirst:function(){this.hasImages()&&this.changeImage(0)},showLast:function(){this.hasImages()&&this.changeImage(this.imageArray.length-1)},enableKeyboardNav:function(){var a=this;d(document).keydown(function(b){a.keyboardAction(b)})},disableKeyboardNav:function(){d(document).unbind("keydown")},keyboardAction:function(a){keycode=
a==null?event.keyCode:a.which;key=String.fromCharCode(keycode).toLowerCase();if(keycode==27||key=="x"||key=="o"||key=="c")this.end();else if(key=="p"||key=="%")this.showPrev();else if(key=="n"||key=="'")this.showNext();else if(key=="f")this.showFirst();else if(key=="l")this.showLast();else key=="s"&&this.hasImage()&&this.options.enableSlideshow&&this.toggleSlideShow()},preloadNeighborImages:function(){var a=this.imageArray.length-1==this.activeImage?0:this.activeImage+1;nextImage=new Image;nextImage.src=
this.imageArray[a].link;a=this.activeImage==0?this.imageArray.length-1:this.activeImage-1;prevImage=new Image;prevImage.src=this.imageArray[a].link},end:function(){this.disableKeyboardNav();this.pauseSlideShow();this.get("lightbox").hide();this.get("overlay").fadeOut(this.overlayDuration);this.showBadObjects()},showBadObjects:function(a){d(this.badObjects.join(",")).css("visibility",(typeof a=="undefined"?true:!!a)?"visible":"hidden")},hideBadObjects:function(){this.showBadObjects(false)},addPrefix:function(a){return this.prefix+
"_"+a},getID:function(a){return this.addPrefix(a)},getSel:function(a){var b="#";if(a.toString().indexOf(",")!=-1){a=a.toString().split(",");for(b=0;b<a.length;b++)a[b]=this.getSel(d.trim(a[b]));a=a.join(",")}else{if(a in this.options.placeholders)d(this.options.placeholders[a]).attr("id")||(b=".");a=b+this.getID(a)}return a},get:function(a){return d(this.getSel(a))},fileExists:function(a,b,c,g){if(!this.options.validateLinks)return b(g);var h=this,j=function(i){if(i.status<400)d.isFunction(b)&&b(g);
else d.isFunction(c)&&c(g)};if(a in this.checkedUrls)j(this.checkedUrls[a]);else{var f=new XMLHttpRequest;f.open("HEAD",a,true);f.onreadystatechange=function(){if(4==this.readyState){h.addUrl(a,this);j(this)}};f.send()}},addUrl:function(a,b){a in this.checkedUrls||(this.checkedUrls[a]=b)}}})(jQuery);

View File

@ -1,14 +1,14 @@
<?php
/*
Plugin Name: Simple Lightbox
Plugin URI: http://archetyped.com/tools/simple-lightbox/
Plugin URI: http://archetyped.com/lab/slb-1-5-5-beta/
Description: Customizable Lightbox for Wordpress
Version: 1.5.4
Version: 1.5.5b5 (BETA TESTING)
Author: Archetyped
Author URI: http://archetyped.com
*/
/*
Copyright 2010 Solomon Marchessault (wp@archetyped.com)
Copyright 2010 Solomon Marchessault (contact@archetyped.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License

View File

@ -1,6 +1,8 @@
<?php
require_once 'includes/class.base.php';
require_once 'includes/class.fields.php';
require_once 'includes/class.options.php';
/**
* Lightbox functionality class
@ -11,12 +13,6 @@ class SLB_Lightbox extends SLB_Base {
/*-** Properties **-*/
/**
* Version number
* @var string
*/
var $version = '1.5.4';
/**
* Themes
* @var array
@ -38,43 +34,67 @@ class SLB_Lightbox extends SLB_Base {
var $options_admin_form = 'options.php';
/**
* Default options
* 0: Value
* 1: Label
* Options Configuration
* @var array
*/
var $options_default = array (
'header_enabled' => 'Activation',
'enabled' => array(true, 'Enable Lightbox Functionality'),
'enabled_home' => array(true, 'Enable on Home page'),
'enabled_post' => array(true, 'Enable on Posts'),
'enabled_page' => array(true, 'Enable on Pages'),
'enabled_archive' => array(true, 'Enable on Archive Pages (tags, categories, etc.)'),
'activate_links' => array(true, 'Activate all image links in item content'),
'validate_links' => array(false, 'Validate links'),
'header_activation' => 'Grouping',
'group_links' => array(true, 'Group automatically activated links (for displaying as a slideshow)'),
'group_post' => array(true, 'Group image links by Post (e.g. on pages with multiple posts)'),
'header_ui' => 'UI',
'theme' => array('default', 'Theme'),
'animate' => array(true, 'Animate lightbox resizing'),
'autostart' => array(true, 'Automatically Start Slideshow'),
'duration' => array(6, 'Slide Duration (Seconds)', array('size' => 3, 'maxlength' => 3)),
'loop' => array(true, 'Loop through images'),
'overlay_opacity' => array(0.8, 'Overlay Opacity (0 - 1)', array('size' => 3, 'maxlength' => 3)),
'enabled_caption' => array(true, 'Enable caption'),
'caption_src' => array(true, 'Use image URI as caption when link title not set'),
'header_strings' => 'Labels',
'txt_closeLink' => array('close', 'Close link (for accessibility only, image used for button)'),
'txt_loadingMsg' => array('loading', 'Loading indicator'),
'txt_nextLink' => array('next &raquo;', 'Next Image link'),
'txt_prevLink' => array('&laquo; prev', 'Previous Image link'),
'txt_startSlideshow' => array('start slideshow', 'Start Slideshow link'),
'txt_stopSlideshow' => array('stop slideshow', 'Stop Slideshow link'),
'txt_numDisplayPrefix' => array('Image', 'Image number prefix (e.g. <strong>Image</strong> x of y)'),
'txt_numDisplaySeparator' => array('of', 'Image number separator (e.g. Image x <strong>of</strong> y)')
var $options_config = array (
'groups' => array (
'activation' => 'Activation',
'grouping' => 'Grouping',
'ui' => 'UI',
'labels' => 'Labels'
),
'items' => array (
'enabled' => array('title' => 'Enable Lightbox Functionality', 'default' => true, 'group' => 'activation'),
'enabled_home' => array('title' => 'Enable on Home page', 'default' => true, 'group' => 'activation'),
'enabled_post' => array('title' => 'Enable on Posts', 'default' => true, 'group' => 'activation'),
'enabled_page' => array('title' => 'Enable on Pages', 'default' => true, 'group' => 'activation'),
'enabled_archive' => array('title' => 'Enable on Archive Pages (tags, categories, etc.)', 'default' => true, 'group' => 'activation'),
'activate_links' => array('title' => 'Activate all image links in item content', 'default' => true, 'group' => 'activation'),
'activate_attachments' => array('title' => 'Activate all image attachment links', 'default' => true, 'group' => 'activation'),
'validate_links' => array('title' => 'Validate links', 'default' => false, 'group' => 'activation'),
'group_links' => array('title' => 'Group automatically activated links (for displaying as a slideshow)', 'default' => true, 'group' => 'grouping'),
'group_post' => array('title' => 'Group image links by Post (e.g. on pages with multiple posts)', 'default' => true, 'group' => 'grouping'),
'theme' => array('title' => 'Theme', 'default' => 'default', 'group' => 'ui', 'parent' => 'option_theme'),
'animate' => array('title' => 'Animate lightbox resizing', 'default' => true, 'group' => 'ui'),
'autostart' => array('title' => 'Automatically Start Slideshow', 'default' => true, 'group' => 'ui'),
'duration' => array('title' => 'Slide Duration (Seconds)', 'default' => '6', 'attr' => array('size' => 3, 'maxlength' => 3), 'group' => 'ui'),
'loop' => array('title' => 'Loop through images', 'default' => true, 'group' => 'ui'),
'overlay_opacity' => array('title' => 'Overlay Opacity (0 - 1)', 'default' => '0.8', 'attr' => array('size' => 3, 'maxlength' => 3), 'group' => 'ui'),
'enabled_caption' => array('title' => 'Enable caption', 'default' => true, 'group' => 'ui'),
'caption_src' => array('title' => 'Use image URI as caption when link title not set', 'default' => true, 'group' => 'ui'),
'txt_closeLink' => array('title' => 'Close link (for accessibility only, image used for button)', 'default' => 'close', 'group' => 'labels'),
'txt_loadingMsg' => array('title' => 'Loading indicator', 'default' => 'loading', 'group' => 'labels'),
'txt_nextLink' => array('title' => 'Next Image link', 'default' => 'next &raquo;', 'group' => 'labels'),
'txt_prevLink' => array('title' => 'Previous Image link', 'default' => '&laquo; prev', 'group' => 'labels'),
'txt_startSlideshow' => array('title' => 'Start Slideshow link', 'default' => 'start slideshow', 'group' => 'labels'),
'txt_stopSlideshow' => array('title' => 'Stop Slideshow link', 'default' => 'stop slideshow', 'group' => 'labels'),
'txt_numDisplayPrefix' => array('title' => 'Image number prefix (e.g. <strong>Image</strong> x of y)', 'default' => 'Image', 'group' => 'labels'),
'txt_numDisplaySeparator' => array('title' => 'Image number separator (e.g. Image x <strong>of</strong> y)', 'default' => 'of', 'group' => 'labels')
),
'legacy' => array (
'header_activation',
'header_enabled',
'header_strings',
'header_ui',
'enabled_single'
)
);
/* Instance members */
/**
* Options instance
* @var SLB_Options
*/
var $options = null;
/**
* Fields
* @var SLB_Fields
*/
var $fields = null;
/*-** Init **-*/
function SLB_Lightbox() {
@ -84,10 +104,15 @@ class SLB_Lightbox extends SLB_Base {
function __construct() {
parent::__construct();
$this->init();
//Setup options
$opt_theme =& $this->options_config['items']['theme'];
$opt_theme['default'] = $this->theme_default = $this->add_prefix($this->theme_default);
$opt_theme['options'] = $this->m('get_theme_options');
//Setup variables
$this->theme_default = $this->add_prefix($this->theme_default);
$this->options_default['theme'][0] = $this->theme_default;
//Init objects
$this->fields =& new SLB_Fields();
$this->options =& new SLB_Options('options', $this->options_config);
}
function register_hooks() {
@ -113,34 +138,13 @@ class SLB_Lightbox extends SLB_Base {
add_filter('the_content', $this->m('activate_post_links'), 99);
/* Themes */
$this->add_action('init_themes', $this->m('init_default_themes'));
$this->util->add_action('init_themes', $this->m('init_default_themes'));
}
function activate() {
//Set default options (if not yet set)
$this->reset_options(false);
//Options migration
$opt = 'enabled_single';
if ( $this->option_isset($opt) ) {
$val = $this->get_option_value($opt);
$this->update_option('enabled_post', $val);
$this->update_option('enabled_page', $val);
$this->delete_option($opt);
}
}
/**
* Resets option values to their default values
* @param bool $hard Reset all options if TRUE (default), Reset only unset options if FALSE
*/
function reset_options($hard = true) {
foreach ( $this->options_default as $id => $data ) {
$opt = $this->get_option_id($id);
if ( !is_array($data) || ( !$hard && !is_null(get_option($opt, null)) ) ) {
continue;
}
update_option($opt, $data[0]);
}
$this->options->reset(false);
$this->options->migrate();
}
/*-** Helpers **-*/
@ -150,7 +154,7 @@ class SLB_Lightbox extends SLB_Base {
* @return bool TRUE if lightbox is currently enabled, FALSE otherwise
*/
function is_enabled($check_request = true) {
$ret = ( get_option($this->add_prefix('enabled')) ) ? true : false;
$ret = ( $this->options->get_value('enabled') ) ? true : false;
if ( $ret && $check_request ) {
$opt = '';
//Determine option to check
@ -162,107 +166,13 @@ class SLB_Lightbox extends SLB_Base {
elseif ( is_archive() || is_search() )
$opt = 'archive';
//Check option
if ( ! empty($opt) && ( $opt = 'enabled_' . $opt ) && isset($this->options_default[$opt]) ) {
$ret = ( get_option($this->add_prefix($opt)) ) ? true : false;
if ( !empty($opt) && ( $opt = 'enabled_' . $opt ) && $this->options->has($opt) ) {
$ret = ( $this->options->get_value($opt) ) ? true : false;
}
}
return $ret;
}
/**
* Generate option ID for saving in DB
* Prefixes option name with plugin prefix
* @param string $option Option to generate ID for
* @return string Option ID
*/
function get_option_id($option) {
return $this->add_prefix($option);
}
function option_isset($option) {
return !is_null(get_option($this->get_option_id($option), null));
}
/**
* Builds object of option data
* Properties:
* > id: Option ID
* > value: Option's value (uses default value if option not yet set)
* > value_default: Option's default value (formatted)
*
* @param string $option Option name
* @return object Option data
*/
function get_option($option) {
$ret = new stdClass();
$ret->id = $this->get_option_id($option);
$ret->value = get_option($ret->id, $this->get_default_value($option, false));
$ret->value_default = $this->get_default_value($option, false);
$ret->value_default_formatted = $this->get_default_value($option);
$ret->attr = $this->get_default_attr($option);
return $ret;
}
/**
* Delete plugin-specific option
* @uses delete_option() to perform DB operations
* @param string $option Option name
* @return bool TRUE if option deleted from DB
*/
function delete_option($option) {
return delete_option($this->get_option_id($option));
}
/**
* Retrieve an option's value
* @param string $option Option name
* @return mixed Option value
*/
function get_option_value($option) {
$opt = $this->get_option($option);
return $opt->value;
}
function update_option($option, $newvalue) {
update_option($this->get_option_id($option), $newvalue);
}
/**
* Retrieve default attributes for an option
* @param string $option Option name
* @return array Default attributes
*/
function get_default_attr($option) {
$ret = array();
if ( isset($this->options_default[$option][2]) )
$ret = $this->options_default[$option][2];
return $ret;
}
/**
* Retrieve default value for specified option
* @param string $option Option name
* @param bool $formatted Whether to return formatted value (e.g. for use in admin UI)
* @return mixed Option default value
*/
function get_default_value($option, $formatted = true) {
$ret = '';
if ( isset($this->options_default[$option][0]) ) {
$ret = $this->options_default[$option][0];
//Format value (if required)
if ( $formatted ) {
if ( is_bool($ret) || ( is_string($ret) && 'on' == $ret ) )
$ret = ( $ret ) ? 'Enabled' : 'Disabled';
if ( is_numeric($ret) )
$ret = strval($ret);
$ret = htmlentities($ret);
}
} elseif ( ! is_array($this->options_default[$option]) ) {
$ret = $this->options_default[$option];
}
return $ret;
}
/*-** Theme **-*/
/**
@ -275,10 +185,9 @@ class SLB_Lightbox extends SLB_Base {
static $fetched = false;
if ( !$fetched ) {
$this->themes = array();
$this->do_action('init_themes');
$this->util->do_action('init_themes');
$fetched = true;
}
return $this->themes;
}
@ -292,7 +201,7 @@ class SLB_Lightbox extends SLB_Base {
$name = strval($name);
//Default: Get current theme if no theme specified
if ( empty($name) ) {
$name = $this->get_option_value('theme');
$name = $this->options->get_value('theme');
}
if ( !$this->theme_exists($name) )
$name = $this->theme_default;
@ -331,7 +240,7 @@ class SLB_Lightbox extends SLB_Base {
function get_theme_layout($name = '', $filter = true) {
$l = $this->get_theme_data($name, 'layout');
//Filter
if ( !$this->get_option_value('enabled_caption') )
if ( !$this->options->get_value('enabled_caption') )
$l = str_replace($this->get_theme_placeholder('dataCaption'), '', $l);
return $l;
}
@ -426,45 +335,87 @@ class SLB_Lightbox extends SLB_Base {
*/
function activate_post_links($content) {
//Check option
if ( ! is_feed() && $this->is_enabled() && $this->get_option_value('activate_links') ) {
//Scan for links
$matches = array();
if ( preg_match_all("/\<a[^\>]*href=[^\s]+\.(?:jp[e]*g|gif|png).*?\>/i", $content, $matches) ) {
if ( ! is_feed() && $this->is_enabled() && $this->options->get_value('activate_links') ) {
$links = array();
//Get all links on page
$rgx = "/\<a[^\>]+href=.*?\>/i";
preg_match_all($rgx, $content, $links);
$links = $links[0];
$domain = str_replace(array('http://', 'https://'), '', get_bloginfo('url'));
//Process links
if ( count($links) > 0 ) {
global $post;
$types = (object) array('img' => 'image', 'att' => 'attachment');
$img_types = array('jpg', 'jpeg', 'gif', 'png');
$rgx = "/\b(\w+.*?)=([\"'])(.*?)\\2(?:\s|$)/i";
//Iterate through links & add lightbox if necessary
foreach ($matches[0] as $link) {
foreach ( $links as $link ) {
//Check if rel attribute exists
$link_new = $link;
$rel = '';
if ( strpos(strtolower($link_new), ' rel=') !== false && preg_match("/\s+rel=(?:\"|')(.*?)(?:\"|')(\s|\>)/i", $link_new, $rel) ) {
//Check if lightbox is already set in rel attribute
$rel = $rel[1];
//Parse link
$link_attr = substr($link_new, 2, strlen($link_new) - 3);
$attr_matches = $attr = array();
preg_match_all($rgx, $link_attr, $attr_matches);
foreach ( $attr_matches[1] as $key => $val ) {
if ( isset($attr_matches[3][$key]) )
$attr[trim($val)] = trim($attr_matches[3][$key]);
}
//Destroy parsing vars
unset($link_attr, $attr_matches);
//Set default attributes
$attr = array_merge(array('rel' => '', 'href' => ''), $attr);
$h =& $attr['href'];
$r =& $attr['rel'];
if ( strpos($rel, 'lightbox') !== false || strpos($rel, $this->add_prefix('off')) )
//Stop processing link if lightbox attribute has already been set
$lb = 'lightbox';
if ( empty($h) || '#' == $h || ( !empty($r) && ( strpos($r, $lb) !== false || strpos($r, $this->add_prefix('off')) !== false ) ) )
continue;
//Determine link type
$type = false;
if ( in_array($this->util->get_file_extension($h), $img_types) )
$type = $types->img;
elseif ( strpos($h, $domain) !== false && is_local_attachment($h) && ( $pid = url_to_postid($h) ) && wp_attachment_is_image($pid) )
$type = $types->att;
if ( !$type ) {
continue;
$lb = '';
if ( !empty($rel) )
$lb .= ' ';
//Add rel attribute to link
$lb .= 'lightbox';
$group = '';
//Check if links should be grouped
if ( $this->get_option_value('group_links') ) {
$group = $this->get_prefix();
//Check if groups should be separated by post
if ( $this->get_option_value('group_post') )
$group = $this->add_prefix($post->ID);
}
if ( !empty($group) )
if ( $type == $types->att && !$this->options->get_value('activate_attachments') )
continue;
//Process link
if ( empty($r) )
$r = array();
else
$r = array($r);
//Check if links should be grouped
if ( $this->options->get_value('group_links') ) {
$group = ( $this->options->get_value('group_post') ) ? $this->add_prefix($post->ID) : $this->get_prefix();
$lb .= '[' . $group . ']';
$rel .= $lb;
$link_new = '<a rel="' . $rel . '"' . substr($link_new,2);
}
$r[] = $lb;
//Type specific processing
switch ($type) {
case $types->att:
//Get attachment URL
$src = wp_get_attachment_url($pid);
if ( !empty($src) )
$r[] = $this->add_prefix('src[' . $src . ']');
break;
}
//Convert rel attribute to string
$r = implode(' ', $r);
$link_new = '<a ' . $this->util->build_attribute_string($attr) . '>';
//Insert modified link
$content = str_replace($link, $link_new, $content);
unset($h, $r);
}
}
}
@ -477,8 +428,8 @@ class SLB_Lightbox extends SLB_Base {
function enqueue_files() {
if ( ! $this->is_enabled() )
return;
wp_enqueue_script($this->add_prefix('lib'), $this->util->get_file_url('js/lib.js'), array('jquery'), $this->version);
wp_enqueue_style($this->add_prefix('style'), $this->get_theme_style(), array(), $this->version);
wp_enqueue_script($this->add_prefix('lib'), $this->util->get_file_url('js/lib.js'), array('jquery'), $this->util->get_plugin_version());
wp_enqueue_style($this->add_prefix('style'), $this->get_theme_style(), array(), $this->util->get_plugin_version());
}
/**
@ -491,36 +442,28 @@ class SLB_Lightbox extends SLB_Base {
$options = array();
$out = array();
$out['script_start'] = '<script type="text/javascript">(function($){$(document).ready(function(){';
$out['script_end'] = '})})(jQuery);</script>';
$out['script_start'] = '<script type="text/javascript">/* <![CDATA[ */(function($){$(document).ready(function(){';
$out['script_end'] = '})})(jQuery);/* ]]> */</script>';
$js_code = array();
//Activate links on page
if ( $this->get_option_value('activate_links') ) {
$rel = ( $this->get_option_value('group_links') ) ? 'lightbox[' . $this->get_prefix() . ']' : 'lightbox';
ob_start();
?>
$('a[href$=".jpg"]:not([rel~="lightbox"])','a[href$=".jpeg"]:not([rel~="lightbox"])','a[href$=".gif"]:not([rel~="lightbox"])','a[href$=".png"]:not([rel~="lightbox"])').each(function(i, el){if (! /(^|\b)lightbox\[.+\]($|\b)/i.test($(el).attr('rel'))){var rel=($(el).attr('rel').length > 0) ? $(el).attr('rel') + ' ' : '';$(el).attr('rel', =rel + '<?php echo $rel; ?>');}});
<?php
$test = ob_get_clean();
}
//Get options
$options = array(
'validateLinks' => $this->get_option_value('validate_links'),
'autoPlay' => $this->get_option_value('autostart'),
'slideTime' => $this->get_option_value('duration'),
'loop' => $this->get_option_value('loop'),
'overlayOpacity' => $this->get_option_value('overlay_opacity'),
'animate' => $this->get_option_value('animate'),
'captionEnabled' => $this->get_option_value('enabled_caption'),
'captionSrc' => $this->get_option_value('caption_src'),
'layout' => $this->get_theme_layout()
'validateLinks' => $this->options->get_value('validate_links'),
'autoPlay' => $this->options->get_value('autostart'),
'slideTime' => $this->options->get_value('duration'),
'loop' => $this->options->get_value('loop'),
'overlayOpacity' => $this->options->get_value('overlay_opacity'),
'animate' => $this->options->get_value('animate'),
'captionEnabled' => $this->options->get_value('enabled_caption'),
'captionSrc' => $this->options->get_value('caption_src'),
'layout' => $this->get_theme_layout(),
'altsrc' => $this->add_prefix('src')
);
$lb_obj = array();
foreach ($options as $option => $val) {
if ($val === TRUE || $val == 'on')
$val = 'true';
elseif ($val === FALSE || empty($val))
$val = 'false';
if ( is_bool($val) )
$val = ( $val ) ? 'true' : 'false';
elseif ( is_string($val) && "'" != $val[0] )
$val = "'" . $val . "'";
$lb_obj[] = "'{$option}':{$val}";
}
//Load UI Strings
@ -537,12 +480,12 @@ class SLB_Lightbox extends SLB_Base {
function build_strings() {
$ret = '';
$prefix = 'txt_';
$opt_strings = array_filter(array_keys($this->options_default), create_function('$opt', 'return ( strpos($opt, "' . $prefix . '") === 0 );'));
$opt_strings = array_filter(array_keys($this->options->get_items()), create_function('$opt', 'return ( strpos($opt, "' . $prefix . '") === 0 );'));
if ( $opt_strings ) {
$strings = array();
foreach ( $opt_strings as $key ) {
$name = substr($key, strlen($prefix));
$strings[] = "'" . $name . "':'" . $this->get_option_value($key) . "'";
$strings[] = "'" . $name . "':'" . $this->options->get_value($key) . "'";
}
$ret = "'strings':{" . implode(',', $strings) . "}";
}
@ -583,7 +526,7 @@ class SLB_Lightbox extends SLB_Base {
$action = 'reset';
if ( isset($_REQUEST['action']) && $this->add_prefix($action) == $_REQUEST['action'] ) {
//Reset settings
$this->reset_options(true);
$this->options->reset(true);
$uri = remove_query_arg(array('_wpnonce', 'action'), add_query_arg(array($this->add_prefix('action') => $action), $_SERVER['REQUEST_URI']));
//Redirect user
wp_redirect($uri);
@ -616,6 +559,7 @@ class SLB_Lightbox extends SLB_Base {
/**
* Adds settings section for Lightbox functionality
* Section is added to Settings > Media Admin menu
* @todo Move appropriate code to options class
*/
function admin_settings() {
$page = $this->options_admin_page;
@ -629,36 +573,25 @@ class SLB_Lightbox extends SLB_Base {
$section = $this->get_prefix();
//Section
add_settings_section($section, '<span id="' . $this->admin_get_settings_section() . '">' . __('Lightbox Settings') . '</span>', $this->m('admin_section'), $page);
//Fields
foreach ($this->options_default as $key => $defaults) {
$id = $this->add_prefix($key);
$func = 'admin_field_' . $key;
$label = ( isset($defaults[1]) ) ? $defaults[1] : '';
$callback = ( method_exists($this, $func) ) ? $this->m($func) : $this->m('admin_field_default');
$args = array('opt' => $key);
//Check if option is a section header
if ( ! is_array($defaults) ) {
$label = '<h4 class="subhead">' . $defaults . '</h4>';
$callback = $this->m('admin_field_header');
} elseif ( is_null(get_option($id, null)) ) {
//Add option to DB if not yet set
$args['label_for'] = $id;
update_option($id, htmlentities2($defaults[0]));
}
add_settings_field($id, __($label), $callback, $page, $section, $args);
register_setting($page, $id);
}
}
//Register settings container
register_setting($page, $this->add_prefix('options'), $this->options->m('validate'));
}
/**
* Enqueues header files for admin pages
* @todo Separate and move options CSS to options class
*/
function admin_enqueue_files() {
//Enqueue custom CSS for options page
if ( is_admin() && basename($_SERVER['SCRIPT_NAME']) == $this->options_admin_page ) {
wp_enqueue_style($this->add_prefix('admin_styles'), $this->util->get_file_url('css/admin.css'));
wp_enqueue_style($this->add_prefix('admin'), $this->util->get_file_url('css/admin.css'), array(), $this->util->get_plugin_version());
}
}
/**
* Get ID of settings section on admin page
* @return string ID of settings section
* @todo Eval for moving to options class
*/
function admin_get_settings_section() {
return $this->add_prefix('settings');
@ -667,89 +600,18 @@ class SLB_Lightbox extends SLB_Base {
/**
* Placeholder function for lightbox admin settings
* Required because setting init function requires a callback
* @todo Evaluate for moving to options class
*/
function admin_section() { }
/**
* General field builder
* @param string $option Option name to build field for
* @param string $format Field markup (using sprintf specifiers)
* @param string $type (optional) Type of field being build (e.g. checkbox, text, etc.)
* Specifiers:
* 1. Field ID
* 2. Field Value
* 3. Field Default Value (formatted)
* 4. Field Type
*/
function admin_the_field($option, $format = '', $type = '') {
$opt = $this->get_option($option);
$format_default = '<input id="%1$s" name="%1$s" %4$s class="code" /> (Default: %3$s)';
if ( empty($format) && $format !== false )
$format = $format_default;
if ( empty($type) || !is_string($type) ) {
$type_default = 'text';
$type = ( is_bool($opt->value_default) ) ? 'checkbox' : $type_default;
}
//Adjust type and value formatting based on type
switch ( $type ) {
case 'checkbox' :
if ( $opt->value )
$opt->attr['checked'] = 'checked';
break;
case 'text' :
if ( $format == $format_default )
$format = str_replace('%4$s', '%4$s value="%2$s"', $format);
break;
}
$opt->attr['type'] = $type;
//Build attribute string
$attr = '';
if ( ! empty($opt->attr) ) {
$attr = $this->util->build_attribute_string($opt->attr);
}
echo sprintf($format, $opt->id, htmlentities($opt->value), $opt->value_default_formatted, $attr);
}
/**
* Builds header for settings subsection
* @param array $args Arguments set in admin_settings
*/
function admin_field_header($args) {
$opt = ( isset($args['opt']) ) ? $args['opt'] : '';
$this->admin_the_field($opt, false, 'header');
}
/**
* Default field output generator
* @param array $args Arguments set in admin_settings
*/
function admin_field_default($args = array()) {
$opt = ( isset($args['opt']) ) ? $args['opt'] : '';
$this->admin_the_field($opt);
function admin_section() {
$this->options->build();
}
/* Custom fields */
/**
* Builds field for theme selection
* @param array $args Arguments set in admin_settings
*/
function admin_field_theme($args = array()) {
//Get option data
$option = $this->get_option($args['opt']);
function get_theme_options() {
//Get themes
$themes = $this->get_themes();
//Get current theme
$theme = $this->get_theme();
//Build field
$start = sprintf('<select id="%1$s" name="%1$s">', esc_attr($option->id));
$end = '</select>';
$option_format = '<option value="%1$s"%3$s>%2$s</option>';
//Pop out default theme
$theme_default = $themes[$this->theme_default];
unset($themes[$this->theme_default]);
@ -761,15 +623,10 @@ class SLB_Lightbox extends SLB_Base {
$themes = array($this->theme_default => $theme_default) + $themes;
//Build options
$options = array();
foreach ( $themes as $name => $props ) {
//Check if current them and set as selected if so
$attr = ( $theme['name'] == $name ) ? ' selected="selected"' : '';
$options[] = sprintf($option_format, $name, $props['title'], $attr);
$themes[$name] = $props['title'];
}
//Output field
echo $start . join('', $options) . $end;
return $themes;
}
}

View File

@ -1,8 +1,9 @@
=== Plugin Name ===
Contributors: archetyped
Contributors: Archetyped
Donate link: http://archetyped.com/tools/simple-lightbox/#donate
Tags: lightbox, gallery, photography, images, theme, template, style
Requires at least: 3.0
Tested up to: 3.1.2
Requires at least: 3.1.2
Tested up to: 3.2
Stable tag: trunk
A simple, themeable, and customizable Lightbox for Wordpress
@ -10,6 +11,34 @@ A simple, themeable, and customizable Lightbox for Wordpress
== Description ==
Simple Lightbox is a very simple and customizable lightbox that is easy to add to your Wordpress website. It also [supports themes](http://archetyped.com/lab/slb-registering-themes/), so it can be fully integrated with your site's theme.
### BETA NOTES
The current release is a beta version. Please test and [provide feedback on the beta release page](http://archetyped.com/lab/slb-1-5-5-beta/).
Main changes
#### Beta 5
* Update: Additional WordPress 3.2 support (Gallery)
* Fix: Improved options migration from old versions (Hutchison Migration)
#### Beta 4
* Add: Support for WordPress 3.2
* Add: Support for links added after page load (e.g. via AJAX, etc.)
* Add: Admin option to enable/disable attachment links
* Optimize: Improved compatibility for older versions of PHP
#### Beta 3
* Add: Support for image attachment links
* Optimize: Improved compatibility for older versions of PHP
* Optimize: Internal optimizations
#### Beta 2
* Fix: Debug code removed (Fatal Seb)
* Update: Improved URL handling
* Update: Cache-management for enqueued files
#### Beta 1
* Update: Options management overhaul
* Fix: XHTML Validation (Hajo Validation)
#### Customization
Options for customizing the lightbox behavior are located in the **Settings > Media** admin menu in the **Lightbox Settings** section (or just click the **Settings** link below the plugin's name when viewing the list of installed plugins)
@ -44,7 +73,7 @@ No upgrade notices
== Frequently Asked Questions ==
Post your questions and comments on [Simple Lightbox's official page](http://archetyped.com/tools/simple-lightbox/)
Post your questions and comments on [Simple Lightbox's beta release page](http://archetyped.com/lab/slb-1-5-5-beta/)
== Screenshots ==

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

View File

@ -0,0 +1,14 @@
If a translation file for your language does not come bundled with this plugin, then check out this URL:
http://codex.wordpress.org/Translating_WordPress
It will walk you through how to translate the plugin using the provided template file, "_vipers-video-quicktags-template.po".
Once you're done and have the plugin translated, please send me your translation file so that I can
bundle it with my plugin: http://www.viper007bond.com/contact/
I will give you credit and it will help others who speak your language.
Thanks!
-Viper

View File

@ -0,0 +1,477 @@
=== Viper's Video Quicktags ===
Contributors: Viper007Bond
Donate link: http://www.viper007bond.com/donate/
Tags: video, quicktags, wysiwyg, tinymce, youtube, google video, dailymotion, vimeo, veoh, viddler, metacafe, blip.tv, flickr, ifilm, myspace, flv, quicktime
Requires at least: 2.8
Tested up to: 3.0.1
Stable tag: trunk
Allows easy and XHTML valid posting of videos from various websites such as YouTube, DailyMotion, Vimeo, and more.
== Description ==
Tired of copying and pasting the embed HTML from sites like YouTube? Then this plugin is for you.
Just simply click one of the [new buttons](http://wordpress.org/extend/plugins/vipers-video-quicktags/screenshots/) that this plugin adds to the write screen (rich editor included) and then paste the URL that the video is located at into the prompt box -- easy as that. You can fully configure how the videos are displayed (width, height, colors, alignment on the page) and much more. Your site will even stay (X)HTML valid unlike with the code provided by most video sites.
Currently supports these video sites:
* [YouTube](http://www.youtube.com/) (including playlists)
* [Google Video](http://video.google.com/)
* [DailyMotion](http://www.dailymotion.com/)
* [Vimeo](http://www.vimeo.com/)
* [Veoh](http://www.veoh.com/)
* [Viddler](http://www.viddler.com/)
* [Metacafe](http://www.metacafe.com/)
* [Blip.tv](http://blip.tv/)
* [VideoPress aka WordPress.com Video](http://videopress.com/) **NEW!**
* [Flickr](http://www.flickr.com/) videos
* [Spike.com/IFILM](http://www.spike.com/)
* [MySpaceTV](http://vids.myspace.com/)
As well as these file types:
* Flash Video Files (FLV)
* QuickTime (MOV, etc.)
* Generic video files (AVI, MPEG, WMV, etc.)
You can also use the `[flash]` shortcode to Flash-based video from **any** website (see Help section after installing for details).
If your favorite video site is not supported, please see [the FAQ](http://wordpress.org/extend/plugins/vipers-video-quicktags/faq/) for details on how to get me to include it.
== Installation ==
###Updgrading From A Previous Version###
To upgrade from a previous version of this plugin, delete the entire folder and files from the previous version of the plugin and then follow the installation instructions below.
###Installing The Plugin###
Extract all files from the ZIP file, **making sure to keep the file structure intact**, and then upload it to `/wp-content/plugins/`. This should result in multiple subfolders and files.
Then just visit your admin area and activate the plugin.
**See Also:** ["Installing Plugins" article on the WP Codex](http://codex.wordpress.org/Managing_Plugins#Installing_Plugins)
###Installing For [WordPress MU](http://mu.wordpress.org/)###
Install as stated above to `plugins`, but place `vipers-video-quicktags.php` in the `mu-plugins` folder. Just that file, nothing else.
###Plugin Configuration###
To configure this plugin, visit it's settings page. It can be found under the "Settings" tab in your admin area, titled "Video Quicktags".
== Frequently Asked Questions ==
= The videos won't show up. Only a YouTube image or a link to the video does. =
Your theme lacks the `<?php wp_head(); ?>` hook. Please add it right before `</head>` in your theme's `header.php` file.
= I have the plugin running, but I have some questions about how to use it. =
A help section is now included with this plugin. Please visit your admin area -> Settings -> Video Quicktags -> Help.
= Why doesn't this plugin support such-and-such site? =
There are few possible reasons for this:
* I may have never heard of the site and simply linking it to me on [my WordPress plugin forums](http://www.viper007bond.com/wordpress-plugins/forums/viewforum.php?id=23) may make me include it in a future release.
* The URL at which the video can be viewed has nothing in common with the embed URL. This means my plugin can't do anything with the URL you give it. Support for fetching the emded URL from the website may be added in a future version though, we'll see.
* I have deemed the site not popular enough to warrant being added to my plugin. I don't wish to bloat my plugin with tiny little sites that only one or two people will use.
= Does this plugin support other languages? =
Yes, it does. Included in the `localization` folder is the translation template you can use to translate the plugin. See the [WordPress Codex](http://codex.wordpress.org/Translating_WordPress) for details. When you're done translating it, please [send me](http://www.viper007bond.com/contact/) the translation file so I can include it with the plugin.
= Where can I get additional support for this plugin? =
This is a free plugin and as such, you aren't guaranteed support. However I do my best to answer support questions. Just post on the [WordPress.org support forums](http://wordpress.org/tags/vipers-video-quicktags).
= I love your plugin! Can I donate to you? =
Sure! I do this in my free time and I appreciate all donations that I get. It makes me want to continue to update this plugin. You can find more details on [my donate page](http://www.viper007bond.com/donate/).
== Screenshots ==
1. TinyMCE, the plugin's buttons, and the plugin's dialog window.
2. YouTube configuration page.
2. DailyMotion configuration page with Farbtastic color picker showing.
== Changelog ==
= v6.3.0 =
* **Vimeo:** Implement their new `iframe`-based embed since they seem to have broken my previous embed method.
= v6.2.19 =
* **General:** Remove potentially buggy SWFObject registration.
= v6.2.18 =
* **VideoPress:** If the [official VideoPress plugin](http://wordpress.org/extend/plugins/video/) is installed, don't take over it's shortcode.
= v6.2.17 =
* **TinyMCE:** Re-enable the third button row as not everyone was having issues with it. Default to the first row though.
= v6.2.16 =
* Default to less buttons being enabled by default due to not being able to put them on their own line anymore.
= v6.2.15 =
* **TinyMCE:** Trying to inject the buttons onto the third button line completely breaks TinyMCE. Only allow them to be added to the first or second line, and even then they may not show up even then. I have no idea why (I hate TinyMCE) and I frankly don't care at this point (they're going away in v7.0).
= v6.2.14 =
* **FLV:** Fix automatic images and make them work better.
= v6.2.13 =
* **FLV:** Make MP3's stream properly by not setting the image value to the MP3. Props [tranified](http://wordpress.org/support/topic/327598).
= v6.2.12 =
* **VideoPress:** Width/height parameter improvements.
= v6.2.11 =
* **FLV:** Allow periods in Flashvar names. See [http://wordpress.org/support/topic/316159](http://wordpress.org/support/topic/316159).
= v6.2.10 =
* **General:** Change default feed link text. Always wrap in paragraph tags regardless. Props [andrewpaulbiss](http://wordpress.org/support/topic/314764).
* **General:** Fiddle with how settings are created.
= v6.2.9 =
* **General:** SWFObject issue was likely WordPress version related. I'm tired of dealing with older versions of WordPress anyway, not to mention they're insecure. Make VVQ only support WordPress 2.8+. It's for their own good.
= v6.2.8 =
* **General:** Revert SWFObject enqueue hack as it's failing for some users.
= v6.2.7 =
* **General:** Update SWFObject to version 2.2.
* **General:** Update JW Player to version 4.5.
* **Localization:** Added Chinese translation thanks to [Dreamcolor](http://dreamcolor.net/).
* **Localization:** Added Spanish translation thanks to [Omi](http://equipajedemano.info/).
= v6.2.6 =
* **General:** Fixed an issue with pingback sending failing. The remote XML-RPC would check the referring site (your site) for the ping-to URL and due to an apostrophe in an HTML comment, it'd fail. Very, very weird. Thanks to Robert Windisch of [Inpsyde](http://inpsyde.com/)!
= v6.2.5 =
* **Localization:** Added Hungarian translation thanks to [jamesb](http://filmhirek.com/).
= v6.2.4 =
* **VideoPress:** Rebrand everything in the plugin to VideoPress rather than like WordPress.com video.
= v6.2.3 =
* **Localization:** Added Belorussian translation thanks to Fat Cow.
= v6.2.2 =
* **Localization:** Added Brazilian Portuguese translation thanks to Ricardo Martins.
* **General:** Change `wmode` from `opaque` to `transparent` to allow transparency in FLV skins as well as other embeds.
* **General:** Enable `allowscriptaccess` so Javascript can interact with the embeds.
* **FLV:** Fix an upgrade bug with custom colors.
= v6.2.1 =
* **General:** Fix broken image URLs. Props marian.
= v6.2.0 =
* **WordPress.com Video:** Added support for [WordPress.com Video shortcodes](http://support.wordpress.com/videos/).
* **FLV:** Reorder Flashvar building to properly allow overriding.
* **FLV:** New skins.
* **General:** Pass the non-defaulted attributes (i.e. those directly passed to the shortcode function) to the `vvq_shortcodeatts` filter.
= v6.1.25 =
* **General:** Fix bug introduced in v6.1.24 that made it impossible to post multiple videos in one post.
= v6.1.24 =
* **General:** Improvements to avoid object ID collisions.
* **Dailymotion:** Update preview video as old one was removed.
= v6.1.23 =
* **YouTube:** Add the ability to enable "HD" by default. This does not affect the "HQ" button as I don't know of a way to enable that by default. Also remember that not all videos support HD (few do actually, most only support nothing or HQ).
* **YouTube:** Changed the default preview video to one that supports HD.
* **General:** Remove many bundled jQuery UI libraries, Farbtastic, and other items that are now bundled with WordPress.
* **General:** Code improvements and bugfixes.
= v6.1.22 =
* **General:** Wrap the default feed placeholder text in paragraph tags (the vast majority of people place videos on their own line).
= v6.1.21 =
* **General:** Use a predictable ID for the placeholders and videos rather than a randomly generated one.
* **General:** PHP notice fixes.
= v6.1.20 =
* **Localization:** Added Danish transation thanks to Georg.
* **Localization:** Updated Italian translation thanks to Gianni Diurno.
= v6.1.19 =
* **Quicktime:** Added "scale=aspect" setting as apparently it's best to have.
= v6.1.18 =
* **YouTube:** Added support for the URL format used in the YouTube RSS feed: http://youtube.com/?v=XXXXXXXXXX
= v6.1.17 =
* **YouTube:** Removed all quality related features/options. YouTube now natively supports a high quality toggle in it's embed allowing the user to toggle (if the video supports it). Haven't found a way to make high quality the default yet though.
= v6.1.16 =
* **YouTube:** Add option to disable the video title and ratings display.
* **Veoh:** Add support for the new URL format.
* **General:** Additional styling updates for WordPress 2.7.
= v6.1.15 =
* **FLV:** Support (and detect) RTMP streams. Props axelseaa.
* **General:** Tweak the redirect that occurs after saving the settings.
= v6.1.14 =
* **Google Video:** Show the fullscreen button by default, add option to disable it.
= v6.1.13 =
* **YouTube:** Remove the new search box by default. Option to enable it is on the settings page.
= v6.1.12 =
* **General:** Fix a PHP parse error that slipped into 6.1.11. Whoops!
= v6.1.11 =
* **General:** Don't hijack the `kml_flashembed` shortcode if it's already being processed by other plugin.
= v6.1.10 =
* **General:** Icon for WordPress 2.7.
* **General:** Translation and notice bugfixes from Laurent Duretz.
* **Localization:** French translation thanks to Laurent Duretz.
* **Localization:** Dutch translation thanks to Sypie.
= v6.1.9 =
* **YouTube:** Add support for YouTube's new experimental HD-ish video.
* **General:** Don't right-position the PayPal button as it covers up the "Help" tab in WordPress 2.7.
= v6.1.8 =
* **Metacafe:** Update regex to match new URL format. Props penalty.
= v6.1.7 =
* **General:** CSS tweak for WordPress 2.7. Probably will need more updating, but I'll wait for 2.7 to be done first.
* **YouTube:** Remove MP4 option from settings page (you can't seek properly with it it seems), plus it's meant for the iPhone.
= v6.1.6 =
* **YouTube:** Default to low quality videos (what YouTube's standard embed code does). The high quality video "hack" can result in "This video is not available" on certain videos.
= v6.1.5 =
* **Veoh:** Support for a default image in the `[flv]` shortcode when using a `.mp4` video file.
= v6.1.4 =
* **Veoh:** Fix broken embeds.
= v6.1.3 =
* **General:** Actually remove the `wp_head()` check (I failed to do it properly in 6.1.2).
* **General:** Don't show the binary FTP warning for WordPress 2.7 (the bug should be fixed).
= v6.1.2 =
* **General:** Remove `wp_head()` warning for admins. Doesn't work in themes like K2. Plugin's FAQ should cover this.
* **General:** Add a filter to the shortcode attributes. This means plugins/themes can adjust things like the width automatically.
* **Localization:** Russian translation thanks to [Dennis Bri](http://handynotes.ru/)
* **General:** Properly hide some images in the admin that are there for pre-loading.
= v6.1.1 =
* **Vimeo:** Fixed embeds. Vimeo apparently doesn't like having `&amp;`s in it's embed URLs, so I've switched to using Flashvars.
* **Viddler:** Decode TinyMCE's `&` to `&amp;` conversions which were breaking the embeds.
* **Flash:** Decode TinyMCE's `&` to `&amp;` conversions which were breaking the embeds.
= v6.1.0 =
* **YouTube:** Can now choose between high quality FLV and high quality MP4 formats.
* **FLV:** Bundled skins.
* **FLV:** Improvements on how custom colors are set.
* **TinyMCE:** Can now choose what line number to display the buttons on.
* **TinyMCE:** Automatic browser cache breaking when the plugin is (de)activated or the line number is changed.
* **General:** SWFObject calls moved to bottom of posts rather than theme footer.
* **General:** Admin notice warning about automatic plugin upgrade breaking SWF files, etc. (ASCII vs. binary).
* **General:** Ability to set custom feed text via settings page.
* **General:** Image pre-cache URL fix.
* **General:** Settings page improvements for users without Javascript.
* **General:** More Localization and translators added to credits page.
* **General:** Redid admin warning message for users without the head hook.
* **Flash:** Aliased "kml_flashembed" shortcode and "movie" parameter now used if it's there. This is to support Anarchy Media Player.
* Other various bug fixes.
= v6.0.3 =
* Undo formatting applied by `wptexturize()` to the URLs of videos. Props to [nukerojo](http://freddiemercury.com.ar/) for reporting.
= v6.0.2 =
* Fix Write -> Page (forgot to hook in)
* Remove FLV notice from WPMU.
* Add help item about the red in YouTube (hovering over icons).
= v6.0.1 =
* Fixed a PHP error.
= v6.0.0 =
Complete recode literally from scratch (all new code):
* Support for new video sites.
* Settings page greatly expanded.
* Video configuration abilities greatly expanded (colors, etc.)
* YouTube playlists
* And so very, very much more.
= v5.4.4 =
* Add the Quicktime and generic video buttons back to TinyMCE for users who prefer them over the native TinyMCE embedder.
= v5.4.3 =
* More code changes to try and fix hard-to-reproduce bugs under WordPress 2.5. Thanks to everyone that helped me debug including [Maciek](http://ibex.pl).
= v5.4.2 =
* Some code to hopefully fix some seemingly random bugs under WordPress 2.5.
* Other minor code improvements.
= v5.4.1 =
* Video alignment wasn't working due to the switch to SWFObject. This has been fixed. Props to [zerocrash](http://www.zerocrash.dk/) for the bug report.
= v5.4.0 =
This is a hotfix version to address WordPress 2.5 plus some bugfixes and such. A minor recode of this plugin is planned to improve it, mainly the video file support.
* Updated to support WordPress 2.5 and it's TinyMCE 3 (required a whole new TinyMCE plugin to be written).
* Switched from UFO to SWFObject for the embedding of Flash video (YouTube, etc.) since UFO is deprecated.
* Update of FLV player SWF file.
* Removed Stage6 due to site shutdown. BBCode usage now displays an error message.
= v5.3.1 =
* Replace BBCode with the video in the excerpt.
= v5.3.0 =
* Manjor and multiple Stage6 improvements. Props Randy A. for pointing out that it wasn't working in some cases.
* The regex can now be filtered via `vvq_searchpatterns`. This means plugins can add in new BBCodes without having to edit the plugin. See plugin source for format.
* Other minor improvements.
= v5.2.3 =
* When a custom width is entered into the prompt, use math to suggest a matching height value.
= v5.2.2 =
* Support for the `http://www.youtube.com/w/?v=JzqumbhfxRo` URL format for YouTube due to popular request.
= v5.2.1 =
* Support for new Vimeo URL format (no `/clip:XXX`). Thanks to texasellis.
= v5.2.0 =
* [Stage6](http://stage6.divx.com/) support.
* Regex fix for Metacafe.
= v5.1.6 =
* The default height for YouTube videos has changed, so plugin updated to match.
= v5.1.5 =
* Plugin now parses the code inside text widges, i.e. you can embed videos in your sidebar!
= v5.1.4 =
* Missed a regex expression for the international YouTube handling, whoops!
= v5.1.3 =
* YouTube.com regional support (uk.youtube.com, etc.)
* WPMU support hopefully
* Support for v2.x (old!) style placeholders
* Updated FLV player file to latest version
* Another attempt at stopping autoplaying self-hosted videos
* Other minor fixes
= v5.1.2 =
* Spelling mistake ("video" instead of "vimeo") made the Vimeo button in the rich editor never be hidden. Thanks to [giuseppe](http://www.soveratonews.com/) for [pointing it out](http://www.viper007bond.com/wordpress-plugins/forums/viewtopic.php?id=527).
= v5.1.1 =
* Buttons weren't working in the rich editor due to a stupid mistake on my part (I forgot to replace some debug code with the correct code). Fixed with thanks to [nhdriver4](http://onovia.com/) for [pointing it out](http://www.viper007bond.com/wordpress-plugins/forums/viewtopic.php?id=526).
= v5.1.0 =
* Renamed the plugin file and Javascript file to match the plugin's folder name.
* Forgot to code in FLV file BBCode->HTML (whoops!). Thanks to [Jack](http://jackcorto.dyndns.org/) for pointing this out.
* Due to using the wrong variable on my part, you were unable to change the default width and height of videos. Now fixed and the boxes on the options page actually work.
* Quicktime and generic video files are now inserted via Javascript in order to get around the annoying IE click-to-activate thing.
* Default width/heights for non-Flash files can now be set. Plugin will now not prompt you for width/height by default for those. Admin area Javascript completely recoded as a result.
* You can now opt to have the plugin always prompt you for a width and height. Option configuration via the options page.
* Added support for [Vimeo](http://www.vimeo.com/)
* Fixed the layering issue with Flash for things like Lightbox. Thanks to [timjohns](http://timdotnet.net/wiggumdaily/) for pointing out that I forgot to handle this. I can't figure out a way to fix it for non-Flash videos though. :(
* Fixed buttons in TinyMCE in Internet Explorer. Issue was caused by tiny Javascript issue. Man I **HATE** that browser!
* Due to WP 2.0.x being old and crappy, it'd add `<br />`'s inside `<script>` tags. Worked around it by adding the Javascript after `wpautop()` runs.
* Fixed title text for buttons in TinyMCE.
* Updated Flash Video Player (FLV player) to v3.7.
* Other various bug fixes that I can't remember.
= v5.0.0 =
* Complete recode once again featuring UFO for Flash objects and lots of other stuff. Basically v4.0.0 without all the bugs.
= v4.0.0 =
* Once again, completely recoded from the ground up. Too many changes to even begin to list.
= v3.0.0 =
* Completely recoded again. This time added a bunch more buttons and switched to regex replacement rather than the stupid method I was using before (woo hoo!).
= v2.0.0 =
* Plugin completely recoded in order to make buttons for the WYSIWYG editor.
= v1.0.1 =
* Transparency mode parameter set on the Flash. This makes it so that other items (such as menus or positioned items) appear in front of the videos rather than behind them.
= v1.0.0 =
* Inital release.

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Some files were not shown because too many files have changed in this diff Show More