Refactored PHP codes as follows
* `$util->esc_attr()` did not return a value before, but now returns * Removed unnecessary calls for `esc_attr()` * Moved `plugins_url()` from auto-thickbox.php to auto-thickbox-utils.php * Refined translation texts * `$texts[]`, 'Font Family', 'Font Size' * Defined `ATBP_NAME`, `ATBP_SLUG`, `ATBP_VER` constants * Inlined/Extracted some variables * Maintained comments, etc.
This commit is contained in:
1 parent
9d71afa823
commit
359cb42a4c
3 files changed
+108
-126
No files matched your search
+68
-69
@@ -10,33 +10,33 @@ class auto_thickbox_options {
|
||||
|
||||
// Auto ThickBox Plus Options
|
||||
function register_options_page() {
|
||||
add_options_page($this->texts['options'], AUTO_THICKBOX_PLUS, 'manage_options', $this->base_dir, array(&$this, 'options_page'));
|
||||
add_meta_box( 'general-box', $this->util->__('General'), array(&$this, 'general_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
|
||||
add_meta_box( 'action-box', $this->texts['action'], array(&$this, 'action_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
|
||||
add_meta_box( 'view-box', $this->texts['view'], array(&$this, 'view_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
|
||||
add_meta_box( 'text-box', $this->util->__('Text'), array(&$this, 'text_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
|
||||
add_meta_box( 'image-box', $this->texts['image'], array(&$this, 'image_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
|
||||
add_meta_box( 'effect-box', $this->util->__('Effect') . ' (' . $this->util->__('beta') . ')', array(&$this, 'effect_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
|
||||
add_meta_box( 'about-box', $this->texts['about'], array(&$this, 'about_metabox'), 'settings_page_auto-thickbox-plus', 'normal' );
|
||||
add_options_page($this->texts['options'], ATBP_NAME, 'manage_options', ATBP_SLUG, array(&$this, 'options_page'));
|
||||
add_meta_box( 'general-box', $this->util->__('General'), array(&$this, 'general_metabox'), $this->settings_page_type, 'normal' );
|
||||
add_meta_box( 'action-box', $this->util->_s(array('Action', 'Actions')), array(&$this, 'action_metabox'), $this->settings_page_type, 'normal' );
|
||||
add_meta_box( 'view-box', ucfirst($this->util->_s(array('View', 'view'))), array(&$this, 'view_metabox'), $this->settings_page_type, 'normal' );
|
||||
add_meta_box( 'text-box', $this->util->__('Text'), array(&$this, 'text_metabox'), $this->settings_page_type, 'normal' );
|
||||
add_meta_box( 'image-box', $this->texts['image'], array(&$this, 'image_metabox'), $this->settings_page_type, 'normal' );
|
||||
add_meta_box( 'effect-box', $this->util->__('Effect') . ' (' . $this->util->__('beta') . ')', array(&$this, 'effect_metabox'), $this->settings_page_type, 'normal' );
|
||||
add_meta_box( 'about-box', $this->util->__('About'), array(&$this, 'about_metabox'), $this->settings_page_type, 'normal' );
|
||||
if (isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], 'post_id=' . $this->options['post_id']) !== false) {
|
||||
add_filter('gettext', array(&$this, 'replace_insert_button'), 20, 3);
|
||||
register_post_type('auto-thickbox-plus', array('label' => AUTO_THICKBOX_PLUS));
|
||||
register_post_type(ATBP_SLUG, array('label' => ATBP_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
function replace_insert_button($translated_text, $text, $domain) {
|
||||
return $text == 'Insert into Post' ? $this->texts['insert'] : $translated_text;
|
||||
return $text == 'Insert into Post' ? $this->util->_s(array('Insert Image', 'Insert an Image', 'Insert')) : $translated_text;
|
||||
}
|
||||
|
||||
function register_scripts() {
|
||||
$this->has_slider = function_exists('wp_script_is') && wp_script_is('jquery-ui-slider', 'registered');
|
||||
$deps = array('postbox', 'farbtastic', 'media-upload');
|
||||
if ($this->has_slider) $deps[] = 'jquery-ui-slider';
|
||||
wp_enqueue_script('auto-thickbox', $this->base->plugins_url('auto-thickbox.js', __FILE__), $deps, AUTO_THICKBOX_PLUS_VERSION, true);
|
||||
wp_enqueue_script('auto-thickbox', $this->util->plugins_url('auto-thickbox.js'), $deps, ATBP_VER, true);
|
||||
}
|
||||
|
||||
function register_styles() {
|
||||
wp_enqueue_style('auto-thickbox', $this->base->plugins_url('auto-thickbox.css', __FILE__), array('farbtastic', 'thickbox'), AUTO_THICKBOX_PLUS_VERSION);
|
||||
wp_enqueue_style('auto-thickbox', $this->util->plugins_url('auto-thickbox.css'), array('farbtastic', 'thickbox'), ATBP_VER);
|
||||
}
|
||||
|
||||
function options_page() {
|
||||
@@ -45,12 +45,12 @@ class auto_thickbox_options {
|
||||
<?php screen_icon(); ?>
|
||||
<h2><?php echo $this->texts['options']; ?></h2>
|
||||
<form method="post" action="options.php" name="form">
|
||||
<?php settings_fields( 'auto-thickbox-plus-options' ); ?>
|
||||
<?php settings_fields( $this->option_group ); ?>
|
||||
<div id="poststuff" class="metabox-holder">
|
||||
<?php
|
||||
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
||||
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
||||
do_meta_boxes( 'settings_page_auto-thickbox-plus', 'normal', null );
|
||||
do_meta_boxes( $this->settings_page_type, 'normal', null );
|
||||
?>
|
||||
</div>
|
||||
<p class="submit">
|
||||
@@ -94,7 +94,7 @@ class auto_thickbox_options {
|
||||
<tr>
|
||||
<th scope="row"><?php $this->util->_e('No ThickBox'); ?></th>
|
||||
<td>
|
||||
<label><input type="text" name="auto-thickbox-plus[no_thickbox]" value="<?php $this->util->esc_attr($this->options['no_thickbox']); ?>" class="regular-text" /><br />
|
||||
<label><input type="text" name="auto-thickbox-plus[no_thickbox]" value="<?php echo $this->options['no_thickbox']; ?>" class="regular-text" /><br />
|
||||
<?php $this->util->_e('* Input class attribute values separated by spaces'); ?> (<code><a class="nothickbox"></code>)</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -153,7 +153,7 @@ class auto_thickbox_options {
|
||||
<label class="item"><input type="radio" name="auto-thickbox-plus[click_end]" value="none"<?php $this->util->checked($this->options['click_end'], 'none'); $this->util->disabled($click_end_disabled); ?> />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
<label class="item"><input type="radio" name="auto-thickbox-plus[click_end]" value="loop"<?php $this->util->checked($this->options['click_end'], 'loop'); $this->util->disabled($click_end_disabled); ?> />
|
||||
<?php echo $this->texts['loop']; ?></label>
|
||||
<?php $this->util->_e('Loop'); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -213,7 +213,7 @@ class auto_thickbox_options {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['shortcuts']; ?></th>
|
||||
<th scope="row"><?php $this->util->_es(array('Keyboard Shortcuts', 'Keyboard shortcuts')); ?></th>
|
||||
<th scope="row"><?php echo $this->texts['close']; ?></th>
|
||||
<td>
|
||||
<label class="item"><input type="checkbox" name="auto-thickbox-plus[key_close_esc]"<?php $this->util->checked($this->options['key_close_esc'], 'on'); ?> />
|
||||
@@ -277,6 +277,7 @@ class auto_thickbox_options {
|
||||
$box_shadow_win_none = $this->options['box_shadow_win'] == 'none';
|
||||
$txt_shadow_title_none = $this->options['txt_shadow_title'] == 'none';
|
||||
$txt_shadow_cap_none = $this->options['txt_shadow_cap'] == 'none';
|
||||
$text_sel_color = $this->util->_s(array('Select a Color', 'Select a color'));
|
||||
?>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
@@ -304,7 +305,7 @@ class auto_thickbox_options {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/position'); ?>" target="_blank"><?php $this->util->_e('Position'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/position'); ?>" target="_blank"><?php $this->util->_e('Position'); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Window'); ?></th>
|
||||
<td>
|
||||
<label class="item"><input type="radio" name="auto-thickbox-plus[position_win]" value="fixed"<?php $this->util->checked($this->options['position_win'], 'fixed'); ?> />
|
||||
@@ -314,10 +315,10 @@ class auto_thickbox_options {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/font-family'); ?>" target="_blank"><?php echo ucwords($this->util->__('Font family')); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/font-family'); ?>" target="_blank"><?php echo ucwords($this->util->_s(array('Font Family', 'Font family'))); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Title'); ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[font_title]" value="<?php $this->util->esc_attr($this->options['font_title']); ?>" style="width:70%" />
|
||||
<input type="text" name="auto-thickbox-plus[font_title]" value="<?php echo $this->util->esc_attr($this->options['font_title']); ?>" style="width:70%" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[font_weight_title]" value="bold"<?php $this->util->checked($this->options['font_weight_title'], 'bold'); ?> />
|
||||
<?php $this->util->_e('Bold'); ?></label>
|
||||
</td>
|
||||
@@ -326,13 +327,13 @@ class auto_thickbox_options {
|
||||
<th scope="row"></th>
|
||||
<th scope="row"><?php $this->util->_e('Caption'); ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[font_cap]" value="<?php $this->util->esc_attr($this->options['font_cap']); ?>" style="width:70%" />
|
||||
<input type="text" name="auto-thickbox-plus[font_cap]" value="<?php echo $this->util->esc_attr($this->options['font_cap']); ?>" style="width:70%" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[font_weight_cap]" value="bold"<?php $this->util->checked($this->options['font_weight_cap'], 'bold'); ?> />
|
||||
<?php $this->util->_e('Bold'); ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/font-size'); ?>" target="_blank"><?php echo ucwords($this->util->__('Font size')); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/font-size'); ?>" target="_blank"><?php echo ucwords($this->util->_s(array('Font Size', 'Font size'))); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Title'); ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[font_size_title]" value="<?php echo $this->options['font_size_title']; ?>" class="small-text" /> px
|
||||
@@ -353,12 +354,12 @@ class auto_thickbox_options {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/color'); ?>" target="_blank"><?php $this->util->_e('Text Color'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/color'); ?>" target="_blank"><?php $this->util->_e('Text Color'); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Title'); ?></th>
|
||||
<td>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[color_title]" value="<?php echo $this->options['color_title']; ?>" />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<br /><div class="colorpicker"></div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -368,7 +369,7 @@ class auto_thickbox_options {
|
||||
<td>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[color_cap]" value="<?php echo $this->options['color_cap']; ?>" />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<br /><div class="colorpicker"></div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -378,17 +379,17 @@ class auto_thickbox_options {
|
||||
<td>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[color_nav]" value="<?php echo $this->options['color_nav']; ?>" />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<br /><div class="colorpicker"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/background-color'); ?>" target="_blank"><?php $this->util->_e('Background Color'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/background-color'); ?>" target="_blank"><?php $this->util->_e('Background Color'); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Title'); ?></th>
|
||||
<td>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[bgcolor_title]" value="<?php echo $this->options['bgcolor_title']; ?>"<?php $this->util->disabled($bgcolor_title_trans); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[bgcolor_title]" value="transparent"<?php $this->util->checked($bgcolor_title_trans); ?> onclick="disableOption(this)" />
|
||||
<?php $this->util->_e('Transparent'); ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
@@ -400,7 +401,7 @@ class auto_thickbox_options {
|
||||
<td>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[bgcolor_cap]" value="<?php echo $this->options['bgcolor_cap']; ?>"<?php $this->util->disabled($bgcolor_cap_trans); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[bgcolor_cap]" value="transparent"<?php $this->util->checked($bgcolor_cap_trans); ?> onclick="disableOption(this)" />
|
||||
<?php $this->util->_e('Transparent'); ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
@@ -412,7 +413,7 @@ class auto_thickbox_options {
|
||||
<td>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[bgcolor_img]" value="<?php echo $this->options['bgcolor_img']; ?>"<?php $this->util->disabled($bgcolor_img_trans); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[bgcolor_img]" value="transparent"<?php $this->util->checked($bgcolor_img_trans); ?> onclick="disableOption(this)" />
|
||||
<?php $this->util->_e('Transparent'); ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
@@ -424,7 +425,7 @@ class auto_thickbox_options {
|
||||
<td>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[bgcolor_content]" value="<?php echo $this->options['bgcolor_content']; ?>"<?php $this->util->disabled($bgcolor_content_trans); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[bgcolor_content]" value="transparent"<?php $this->util->checked($bgcolor_content_trans); ?> onclick="disableOption(this)" />
|
||||
<?php $this->util->_e('Transparent'); ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
@@ -436,21 +437,21 @@ class auto_thickbox_options {
|
||||
<td>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[bgcolor_bg]" value="<?php echo $this->options['bgcolor_bg']; ?>"<?php $this->util->disabled($bgcolor_bg_trans); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[bgcolor_bg]" value="transparent"<?php $this->util->checked($bgcolor_bg_trans); ?> onclick="disableOption(this)" />
|
||||
<?php $this->util->_e('Transparent'); ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/margin'); ?>" target="_blank"><?php $this->util->_e('Margin'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/margin'); ?>" target="_blank"><?php $this->util->_e('Margin'); ?></a></th>
|
||||
<th scope="row"><?php echo $this->texts['image']; ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[margin_img]" value="<?php echo $this->options['margin_img']; ?>" class="small-text" /> px
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/border'); ?>" target="_blank"><?php $this->util->_e('Border'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/border'); ?>" target="_blank"><?php $this->util->_e('Border'); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Window'); ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[border_width_win]" value="<?php echo $this->options['border_width_win']; ?>" class="small-text"<?php $this->util->disabled($border_win_none); ?> /> px
|
||||
@@ -459,7 +460,7 @@ class auto_thickbox_options {
|
||||
</select>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[border_color_win]" value="<?php echo $this->options['border_color_win']; ?>"<?php $this->util->disabled($border_win_none); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[border_win]" value="none"<?php $this->util->checked($border_win_none); ?> onclick="disableBorderOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
@@ -475,7 +476,7 @@ class auto_thickbox_options {
|
||||
</select>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[border_color_img_tl]" value="<?php echo $this->options['border_color_img_tl']; ?>"<?php $this->util->disabled($border_img_tl_none); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[border_img_tl]" value="none"<?php $this->util->checked($border_img_tl_none); ?> onclick="disableBorderOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
@@ -491,7 +492,7 @@ class auto_thickbox_options {
|
||||
</select>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[border_color_img_br]" value="<?php echo $this->options['border_color_img_br']; ?>"<?php $this->util->disabled($border_img_br_none); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[border_img_br]" value="none"<?php $this->util->checked($border_img_br_none); ?> onclick="disableBorderOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
@@ -507,14 +508,14 @@ class auto_thickbox_options {
|
||||
</select>
|
||||
<input type="text" class="colortext" name="auto-thickbox-plus[border_color_gallery]" value="<?php echo $this->options['border_color_gallery']; ?>"<?php $this->util->disabled($border_gallery_none); ?> />
|
||||
<a href="#" class="pickcolor colorpreview hide-if-no-js"></a>
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php $this->util->esc_attr($this->texts['sel_color']); ?>" />
|
||||
<input type="button" class="pickcolor button hide-if-no-js" value="<?php echo $text_sel_color; ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[border_gallery]" value="none"<?php $this->util->checked($border_gallery_none); ?> onclick="disableBorderOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
<br /><div class="colorpicker"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/border-radius'); ?>" target="_blank"><?php $this->util->_e('Border Radius'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/border-radius'); ?>" target="_blank"><?php $this->util->_e('Border Radius'); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Window'); ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[radius_win]" value="<?php echo $this->options['radius_win']; ?>" class="small-text" /> px
|
||||
@@ -528,7 +529,7 @@ class auto_thickbox_options {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/opacity'); ?>" target="_blank"><?php $this->util->_e('Opacity'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/opacity'); ?>" target="_blank"><?php $this->util->_e('Opacity'); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Background'); ?></th>
|
||||
<td class="slider">
|
||||
<input type="text" name="auto-thickbox-plus[opacity_bg]" value="<?php echo $this->options['opacity_bg']; ?>" class="small-text" />
|
||||
@@ -558,7 +559,7 @@ class auto_thickbox_options {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/box-shadow'); ?>" target="_blank"><?php $this->util->_e('Box Shadow'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/box-shadow'); ?>" target="_blank"><?php $this->util->_e('Box Shadow'); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Window'); ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[box_shadow_win]" value="<?php echo $this->options['box_shadow_win']; ?>" size="27"<?php $this->util->disabled($box_shadow_win_none); ?> />
|
||||
@@ -567,7 +568,7 @@ class auto_thickbox_options {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><a href="<?php $this->util->esc_attr_e('https://developer.mozilla.org/en/CSS/text-shadow'); ?>" target="_blank"><?php $this->util->_e('Text Shadow'); ?></a></th>
|
||||
<th scope="row"><a href="<?php $this->util->_e('https://developer.mozilla.org/en/CSS/text-shadow'); ?>" target="_blank"><?php $this->util->_e('Text Shadow'); ?></a></th>
|
||||
<th scope="row"><?php $this->util->_e('Title'); ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[txt_shadow_title]" value="<?php echo $this->options['txt_shadow_title']; ?>" size="27"<?php $this->util->disabled($txt_shadow_title_none); ?> />
|
||||
@@ -622,10 +623,11 @@ class auto_thickbox_options {
|
||||
}
|
||||
|
||||
function sortable_items($refs) {
|
||||
$text_link = ucfirst($this->util->_s(array('Link', 'Links')));
|
||||
foreach (explode(',', $refs) as $ref) {
|
||||
switch (trim($ref, "'")) {
|
||||
case "link-title": echo "<li class='ui-state-default' id='link-title'>{$this->texts['link']} - " . $this->util->__('Title') . " (<code>a@title</code>)</li>"; break;
|
||||
case "link-name": echo "<li class='ui-state-default' id='link-name'>{$this->texts['link']} - " . $this->util->__('Name') . " (<code>a@name</code>)</li>"; break;
|
||||
case "link-title": echo "<li class='ui-state-default' id='link-title'>{$text_link} - " . $this->util->__('Title') . " (<code>a@title</code>)</li>"; break;
|
||||
case "link-name": echo "<li class='ui-state-default' id='link-name'>{$text_link} - " . $this->util->__('Name') . " (<code>a@name</code>)</li>"; break;
|
||||
case "blank": echo "<li class='ui-state-default' id='blank'>" . $this->util->__('Blank') . "</li>"; break;
|
||||
case "img-title": echo "<li class='ui-state-default' id='img-title'>{$this->texts['image']} - " . $this->util->__('Title') . " (<code>img@title</code>)</li>"; break;
|
||||
case "img-alt": echo "<li class='ui-state-default' id='img-alt'>{$this->texts['image']} - " . $this->util->__('Alternate Text') . " (<code>img@alt</code>)</li>"; break;
|
||||
@@ -657,8 +659,8 @@ class auto_thickbox_options {
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['prev2']; ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[img_prev]" value="<?php $this->util->esc_attr($img_prev); ?>" style="width:70%"<?php $this->util->disabled($img_prev_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php $this->util->esc_attr_e('Select a File'); ?>" />
|
||||
<input type="text" name="auto-thickbox-plus[img_prev]" value="<?php echo $img_prev; ?>" style="width:70%"<?php $this->util->disabled($img_prev_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php _e('Select a File'); ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[img_prev]" value="none"<?php $this->util->checked($img_prev_none); ?> onclick="disableOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
</td>
|
||||
@@ -666,8 +668,8 @@ class auto_thickbox_options {
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['next2']; ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[img_next]" value="<?php $this->util->esc_attr($img_next); ?>" style="width:70%"<?php $this->util->disabled($img_next_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php $this->util->esc_attr_e('Select a File'); ?>" />
|
||||
<input type="text" name="auto-thickbox-plus[img_next]" value="<?php echo $img_next; ?>" style="width:70%"<?php $this->util->disabled($img_next_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php _e('Select a File'); ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[img_next]" value="none"<?php $this->util->checked($img_next_none); ?> onclick="disableOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
</td>
|
||||
@@ -675,8 +677,8 @@ class auto_thickbox_options {
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['first2']; ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[img_first]" value="<?php $this->util->esc_attr($img_first); ?>" style="width:70%"<?php $this->util->disabled($img_first_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php $this->util->esc_attr_e('Select a File'); ?>" />
|
||||
<input type="text" name="auto-thickbox-plus[img_first]" value="<?php echo $img_first; ?>" style="width:70%"<?php $this->util->disabled($img_first_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php _e('Select a File'); ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[img_first]" value="none"<?php $this->util->checked($img_first_none); ?> onclick="disableOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
</td>
|
||||
@@ -684,8 +686,8 @@ class auto_thickbox_options {
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['last2']; ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[img_last]" value="<?php $this->util->esc_attr($img_last); ?>" style="width:70%"<?php $this->util->disabled($img_last_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php $this->util->esc_attr_e('Select a File'); ?>" />
|
||||
<input type="text" name="auto-thickbox-plus[img_last]" value="<?php echo $img_last; ?>" style="width:70%"<?php $this->util->disabled($img_last_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php _e('Select a File'); ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[img_last]" value="none"<?php $this->util->checked($img_last_none); ?> onclick="disableOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
</td>
|
||||
@@ -693,8 +695,8 @@ class auto_thickbox_options {
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['close']; ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[img_close]" value="<?php $this->util->esc_attr($img_close); ?>" style="width:70%"<?php $this->util->disabled($img_close_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php $this->util->esc_attr_e('Select a File'); ?>" />
|
||||
<input type="text" name="auto-thickbox-plus[img_close]" value="<?php echo $img_close; ?>" style="width:70%"<?php $this->util->disabled($img_close_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php _e('Select a File'); ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[img_close]" value="none"<?php $this->util->checked($img_close_none); ?> onclick="disableOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
</td>
|
||||
@@ -702,17 +704,17 @@ class auto_thickbox_options {
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['close']; ?> (<?php $this->util->_e('Button'); ?>)</th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[img_close_btn]" value="<?php $this->util->esc_attr($img_close_btn); ?>" style="width:70%"<?php $this->util->disabled($img_close_btn_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php $this->util->esc_attr_e('Select a File'); ?>" />
|
||||
<input type="text" name="auto-thickbox-plus[img_close_btn]" value="<?php echo $img_close_btn; ?>" style="width:70%"<?php $this->util->disabled($img_close_btn_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php _e('Select a File'); ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[img_close_btn]" value="none"<?php $this->util->checked($img_close_btn_none); ?> onclick="disableOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['load']; ?></th>
|
||||
<th scope="row"><?php $this->util->_es(array('Loading…', 'Loading...')); ?></th>
|
||||
<td>
|
||||
<input type="text" name="auto-thickbox-plus[img_load]" value="<?php $this->util->esc_attr($img_load); ?>" style="width:70%"<?php $this->util->disabled($img_load_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php $this->util->esc_attr_e('Select a File'); ?>" />
|
||||
<input type="text" name="auto-thickbox-plus[img_load]" value="<?php echo $img_load; ?>" style="width:70%"<?php $this->util->disabled($img_load_none); ?> />
|
||||
<input type="button" class="media-uploader button" value="<?php _e('Select a File'); ?>" />
|
||||
<label><input type="checkbox" name="auto-thickbox-plus[img_load]" value="none"<?php $this->util->checked($img_load_none); ?> onclick="disableOption(this)" />
|
||||
<?php echo $this->texts['none']; ?></label>
|
||||
</td>
|
||||
@@ -734,7 +736,7 @@ class auto_thickbox_options {
|
||||
?>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th scope="row"><?php echo $this->texts['open']; ?></th>
|
||||
<th scope="row"><?php echo ucfirst($this->util->_s(array('Open', 'open'))); ?></th>
|
||||
<td>
|
||||
<label class="item"><input type="radio" name="auto-thickbox-plus[effect_open]" value="zoom"<?php $this->util->checked($this->options['effect_open'], 'zoom'); ?> />
|
||||
<?php $this->util->_e('Zoom'); ?></label>
|
||||
@@ -822,7 +824,7 @@ class auto_thickbox_options {
|
||||
function about_metabox() {
|
||||
?>
|
||||
<ul class="about">
|
||||
<li class="wp"><a href="http://wordpress.org/extend/plugins/auto-thickbox-plus/" target="_blank"><?php echo $this->texts['visit']; ?></a></li>
|
||||
<li class="wp"><a href="http://attosoft.info/en/blog/auto-thickbox-plus/" target="_blank"><?php $this->util->_es(array('Visit plugin site', 'Visit plugin homepage')); ?></a></li>
|
||||
<li class="star"><a href="http://wordpress.org/extend/plugins/auto-thickbox-plus/" target="_blank"><?php $this->util->_e('Put rating stars or vote compatibility (works/broken)'); ?></a></li>
|
||||
<li class="forum"><a href="http://wordpress.org/support/plugin/auto-thickbox-plus" target="_blank"><?php $this->util->_e('View support forum or post a new topic'); ?></a></li>
|
||||
<li class="l10n"><a href="http://wordpress.org/extend/plugins/auto-thickbox-plus/other_notes/#Localization" target="_blank"><?php $this->util->_e('Translate the plugin into your language'); ?></a></li>
|
||||
@@ -832,12 +834,12 @@ class auto_thickbox_options {
|
||||
<?php
|
||||
}
|
||||
|
||||
var $base;
|
||||
var $util;
|
||||
var $base_dir;
|
||||
var $options, $options_def;
|
||||
var $texts;
|
||||
var $has_slider;
|
||||
var $settings_page_type = 'settings_page_auto-thickbox-plus';
|
||||
var $option_group = 'auto-thickbox-plus-options';
|
||||
|
||||
function auto_thickbox_options(&$auto_thickbox) {
|
||||
$this->__construct($auto_thickbox); // for PHP4
|
||||
@@ -846,20 +848,17 @@ class auto_thickbox_options {
|
||||
function __construct(&$auto_thickbox) {
|
||||
add_action('admin_menu', array(&$this, 'register_options_page'));
|
||||
add_action('admin_init', array(&$this, 'register_options'));
|
||||
add_action('admin_print_scripts-settings_page_auto-thickbox-plus', array(&$this, 'register_scripts'));
|
||||
add_action('admin_print_styles-settings_page_auto-thickbox-plus', array(&$this, 'register_styles'));
|
||||
add_action('admin_print_scripts-' . $this->settings_page_type, array(&$this, 'register_scripts'));
|
||||
add_action('admin_print_styles-' . $this->settings_page_type, array(&$this, 'register_styles'));
|
||||
|
||||
$this->base = &$auto_thickbox;
|
||||
$this->util = &$auto_thickbox->util;
|
||||
$this->base_dir = &$auto_thickbox->base_dir;
|
||||
|
||||
$this->options_def = &$auto_thickbox->options_def;
|
||||
$this->options = &$auto_thickbox->options;
|
||||
$this->texts = &$auto_thickbox->texts;
|
||||
}
|
||||
|
||||
function register_options() {
|
||||
register_setting( 'auto-thickbox-plus-options', 'auto-thickbox-plus', array(&$this, 'options_callback') );
|
||||
register_setting( $this->option_group, ATBP_SLUG, array(&$this, 'options_callback') );
|
||||
}
|
||||
|
||||
var $checkboxes_on = array('wp_gallery', 'thickbox_text', 'auto_resize',
|
||||
|
||||
+13
-7
@@ -9,7 +9,7 @@
|
||||
class auto_thickbox_utils {
|
||||
|
||||
/*
|
||||
* search for translation in 'auto-thickbox' amd default (WordPress)
|
||||
* Retrieves the translated string from both 'auto-thickbox' and 'default' domain
|
||||
*/
|
||||
function __( $text ) {
|
||||
$ret = __($text, 'auto-thickbox');
|
||||
@@ -20,9 +20,9 @@ function _e( $text ) {
|
||||
echo $this->__($text);
|
||||
}
|
||||
|
||||
// @return void (echo esc_attr())
|
||||
// @since 2.8.0
|
||||
function esc_attr( $text ) {
|
||||
echo function_exists( 'esc_attr' ) ? esc_attr( $text ) : attribute_escape( $text );
|
||||
return function_exists( 'esc_attr' ) ? esc_attr( $text ) : attribute_escape( $text );
|
||||
}
|
||||
|
||||
function esc_attr__( $text ) {
|
||||
@@ -33,6 +33,7 @@ function esc_attr_e( $text ) {
|
||||
echo $this->esc_attr__($text);
|
||||
}
|
||||
|
||||
// @param array $texts msgid keys
|
||||
function _s( $texts ) {
|
||||
foreach ($texts as $text) {
|
||||
$ret = $this->__($text);
|
||||
@@ -42,12 +43,13 @@ function _s( $texts ) {
|
||||
return $texts[0];
|
||||
}
|
||||
|
||||
// @param array $texts msgid keys
|
||||
function _es( $texts ) {
|
||||
echo $this->_s($texts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.0XXX: disabled() function is defined from WordPress 3.0
|
||||
* @since 3.0
|
||||
* @see /wp-includes/general-template.php
|
||||
*/
|
||||
function disabled( $disabled, $current = true, $echo = true ) {
|
||||
@@ -62,9 +64,8 @@ function disabled( $disabled, $current = true, $echo = true ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* XXX: $current with default value and $echo is defined from WordPress 2.8
|
||||
* @see /wp-admin/includes/template.php
|
||||
* @see /wp-includes/general-template.php (since 3.0)
|
||||
* @see /wp-admin/includes/template.php or /wp-includes/general-template.php
|
||||
* @note '$current = true' and '$echo' is defined since WordPress 2.8
|
||||
*/
|
||||
function checked( $checked, $current = true, $echo = true ) {
|
||||
if ( version_compare('2.8', get_bloginfo('version')) > 0 )
|
||||
@@ -73,5 +74,10 @@ function checked( $checked, $current = true, $echo = true ) {
|
||||
return checked( $checked, $current, $echo );
|
||||
}
|
||||
|
||||
function plugins_url( $path, $plugin = '' ) {
|
||||
if (!$plugin) $plugin = __FILE__;
|
||||
return version_compare('2.8', get_bloginfo('version')) > 0 ? plugins_url( ATBP_SLUG . '/' . $path ) : plugins_url( $path, $plugin );
|
||||
}
|
||||
|
||||
} # auto_thickbox_options
|
||||
?>
|
||||
+27
-50
@@ -32,8 +32,9 @@ Domain Path: /languages
|
||||
http://www.semiologic.com/software/auto-thickbox/
|
||||
*/
|
||||
|
||||
define('AUTO_THICKBOX_PLUS', 'Auto ThickBox Plus');
|
||||
define('AUTO_THICKBOX_PLUS_VERSION', '1.6');
|
||||
define('ATBP_NAME', 'Auto ThickBox Plus');
|
||||
define('ATBP_SLUG', 'auto-thickbox-plus');
|
||||
define('ATBP_VER', '1.6');
|
||||
|
||||
/**
|
||||
* auto_thickbox
|
||||
@@ -133,7 +134,7 @@ class auto_thickbox {
|
||||
if ( $this->options['builtin_res'] == 'off' ) {
|
||||
wp_deregister_script('thickbox');
|
||||
$in_footer = $this->options['script_place'] == 'footer';
|
||||
wp_register_script('thickbox', $this->plugins_url($this->thickbox_js, __FILE__), array('jquery'), AUTO_THICKBOX_PLUS_VERSION, $in_footer);
|
||||
wp_register_script('thickbox', $this->util->plugins_url(WP_DEBUG ? 'thickbox.js' :'thickbox.min.js'), array('jquery'), ATBP_VER, $in_footer);
|
||||
}
|
||||
wp_enqueue_script('thickbox');
|
||||
if ( $this->options['builtin_res'] == 'off' ) {
|
||||
@@ -160,7 +161,7 @@ class auto_thickbox {
|
||||
function styles() {
|
||||
if ( $this->options['builtin_res'] == 'off' ) {
|
||||
wp_deregister_style('thickbox');
|
||||
wp_register_style('thickbox', $this->plugins_url($this->thickbox_css, __FILE__), false, AUTO_THICKBOX_PLUS_VERSION);
|
||||
wp_register_style('thickbox', $this->util->plugins_url(WP_DEBUG ? 'thickbox.css' : 'thickbox.min.css'), false, ATBP_VER);
|
||||
}
|
||||
wp_enqueue_style('thickbox');
|
||||
} # styles()
|
||||
@@ -430,25 +431,22 @@ SCRIPT;
|
||||
|
||||
function add_auto_thickbox_action_links($links, $file) {
|
||||
if ( $file == plugin_basename(__FILE__) )
|
||||
$links[] = '<a href="options-general.php?page=' . $this->base_dir .'">' . $this->util->__('Settings') . '</a>';
|
||||
$links[] = '<a href="options-general.php?page=' . ATBP_SLUG . '">' . $this->util->__('Settings') . '</a>';
|
||||
return $links;
|
||||
}
|
||||
|
||||
// Additional links on the Plugins page
|
||||
function add_auto_thickbox_links($links, $file) {
|
||||
if ( $file == plugin_basename(__FILE__) ) {
|
||||
$links[] = '<a href="plugin-install.php?tab=plugin-information&plugin=auto-thickbox-plus&TB_iframe" class="thickbox" title="' . AUTO_THICKBOX_PLUS . '">' . $this->texts['details'] . '</a>';
|
||||
$links[] = '<a href="plugin-install.php?tab=plugin-information&plugin=' . ATBP_SLUG . '&TB_iframe" class="thickbox" title="' . ATBP_NAME . '">' . $this->util->_s(array('Show Details', 'Details')) . '</a>';
|
||||
$links[] = '<a href="http://wordpress.org/support/plugin/auto-thickbox-plus" target="_blank">' . $this->util->__('Support') . '</a>';
|
||||
$links[] = '<a href="' . $this->util->__('http://attosoft.info/en/') . 'contact/" target="_blank">' . $this->texts['contact'] . '</a>';
|
||||
$links[] = '<a href="' . $this->util->__('http://attosoft.info/en/') . 'contact/" target="_blank">' . ucfirst($this->util->_s(array('Contact', 'contact'))) . '</a>';
|
||||
$links[] = '<a href="' . $this->util->__('https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=D2DLJNSUFBU4U') . '" target="_blank">' . $this->util->__('Donate') . '</a>';
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
|
||||
var $base_dir;
|
||||
var $thickbox_js, $thickbox_css;
|
||||
var $options, $options_def;
|
||||
var $is_en_locale;
|
||||
var $texts;
|
||||
var $util;
|
||||
|
||||
@@ -457,11 +455,7 @@ SCRIPT;
|
||||
}
|
||||
|
||||
function __construct() {
|
||||
$this->base_dir = basename(dirname(__FILE__));
|
||||
load_plugin_textdomain('auto-thickbox', false, $this->base_dir . '/languages');
|
||||
|
||||
$this->thickbox_js = WP_DEBUG ? 'thickbox.js' :'thickbox.min.js';
|
||||
$this->thickbox_css = WP_DEBUG ? 'thickbox.css' : 'thickbox.min.css';
|
||||
load_plugin_textdomain('auto-thickbox', false, ATBP_SLUG . '/languages');
|
||||
|
||||
if ( !is_admin() && isset($_SERVER['HTTP_USER_AGENT']) &&
|
||||
strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') === false) {
|
||||
@@ -570,15 +564,15 @@ SCRIPT;
|
||||
'ref_title' => "'link-title','link-name','blank','img-title','img-alt','img-desc','img-name'",
|
||||
'ref_cap' => "'link-title','link-name','blank','img-title','img-alt','img-desc','img-name','img-cap'",
|
||||
'post_id' => '0',
|
||||
'img_prev' => $this->plugins_url('images/tb-prev.png', __FILE__),
|
||||
'img_next' => $this->plugins_url('images/tb-next.png', __FILE__),
|
||||
'img_first' => $this->plugins_url('images/tb-first.png', __FILE__),
|
||||
'img_last' => $this->plugins_url('images/tb-last.png', __FILE__),
|
||||
'img_close' => $this->plugins_url('images/tb-close.png', __FILE__),
|
||||
'img_close_btn' => $this->plugins_url('images/tb-close.png', __FILE__),
|
||||
'img_load' => $this->plugins_url('images/loadingAnimation.gif', __FILE__)
|
||||
'img_prev' => $this->util->plugins_url('images/tb-prev.png'),
|
||||
'img_next' => $this->util->plugins_url('images/tb-next.png'),
|
||||
'img_first' => $this->util->plugins_url('images/tb-first.png'),
|
||||
'img_last' => $this->util->plugins_url('images/tb-last.png'),
|
||||
'img_close' => $this->util->plugins_url('images/tb-close.png'),
|
||||
'img_close_btn' => $this->util->plugins_url('images/tb-close.png'),
|
||||
'img_load' => $this->util->plugins_url('images/loadingAnimation.gif')
|
||||
);
|
||||
$this->options = get_option('auto-thickbox-plus');
|
||||
$this->options = get_option(ATBP_SLUG);
|
||||
$this->options = $this->options ? wp_parse_args($this->options, $this->options_def) : $this->options_def;
|
||||
|
||||
// XXX: transition code for v0.5 or earlier
|
||||
@@ -657,58 +651,41 @@ SCRIPT;
|
||||
if ($this->is_default_options('post_id')) {
|
||||
$args = array(
|
||||
'post_status' => 'draft',
|
||||
'post_type' => 'auto-thickbox-plus'
|
||||
'post_type' => ATBP_SLUG
|
||||
);
|
||||
$posts = get_posts($args);
|
||||
if (count($posts))
|
||||
$this->options['post_id'] = $posts[0]->ID;
|
||||
else {
|
||||
$args['post_title'] = AUTO_THICKBOX_PLUS;
|
||||
$args['post_title'] = ATBP_NAME;
|
||||
$this->options['post_id'] = wp_insert_post($args);
|
||||
}
|
||||
$updateOption = true;
|
||||
}
|
||||
|
||||
if ($updateOption)
|
||||
update_option('auto-thickbox-plus', $this->options);
|
||||
update_option(ATBP_SLUG, $this->options);
|
||||
|
||||
$this->is_en_locale = strpos(get_locale(), 'en') !== false;
|
||||
$this->texts['next'] = $this->util->_s(array('Next >', 'Next »'));
|
||||
$this->texts['next2'] = trim(str_replace(array('>', '»'), '', $this->texts['next']));
|
||||
$this->texts['prev'] = $this->util->_s(array('< Prev', '« Previous'));
|
||||
$this->texts['prev2'] = trim(str_replace(array('<', '«'), '', $this->texts['prev']));
|
||||
$this->texts['image'] = $this->util->_s(array('Image', 'Images', 'File', 'Files'));
|
||||
$this->texts['of'] = $this->util->__('of');
|
||||
if (trim($this->texts['of']) == '' || ($this->texts['of'] == 'of' && !$this->is_en_locale))
|
||||
if (trim($this->texts['of']) == '' || ($this->texts['of'] == 'of' && strpos(get_locale(), 'en') === false))
|
||||
$this->texts['of'] = '/';
|
||||
$this->texts['close'] = ucfirst($this->util->_s(array('Close', 'close')));
|
||||
$full_colon = html_entity_decode(':', ENT_NOQUOTES, 'UTF-8');
|
||||
$this->texts['options'] = $this->util->_s(array('Options:', 'Options', 'Settings'));
|
||||
$this->texts['options'] = AUTO_THICKBOX_PLUS . ' ' . str_replace(array(':', $full_colon), '', $this->texts['options']);
|
||||
$this->texts['action'] = $this->util->_s(array('Action', 'Actions'));
|
||||
$this->texts['load'] = $this->util->_s(array('Loading…', 'Loading...'));
|
||||
|
||||
$this->texts['first2'] = ucfirst($this->util->_s(array('first', 'First')));
|
||||
$full_colon = html_entity_decode(':', ENT_NOQUOTES, 'UTF-8');
|
||||
$this->texts['options'] = $this->util->_s(array('Options', 'Options:', 'Settings'));
|
||||
$this->texts['options'] = ATBP_NAME . ' ' . str_replace(array(':', $full_colon), '', $this->texts['options']);
|
||||
|
||||
$this->texts['first2'] = ucfirst($this->util->_s(array('First', 'first')));
|
||||
$this->texts['first'] = '« ' . $this->texts['first2'];
|
||||
$this->texts['last2'] = ucfirst($this->util->_s(array('last', 'Last')));
|
||||
$this->texts['last2'] = ucfirst($this->util->_s(array('Last', 'last')));
|
||||
$this->texts['last'] = $this->texts['last2'] . ' »';
|
||||
|
||||
$this->texts['view'] = ucfirst($this->util->_s(array('View', 'view')));
|
||||
$this->texts['none'] = ucfirst($this->util->_s(array('None', 'none')));
|
||||
$this->texts['loop'] = $this->util->__('Loop');
|
||||
$this->texts['shortcuts'] = $this->util->_s(array('Keyboard Shortcuts', 'Keyboard shortcuts'));
|
||||
$this->texts['sel_color'] = $this->util->_s(array('Select a Color', 'Select a color'));
|
||||
$this->texts['open'] = ucfirst($this->util->_s(array('Open', 'open')));
|
||||
$this->texts['details'] = $this->util->_s(array('Show Details', 'Details'));
|
||||
$this->texts['contact'] = ucfirst($this->util->_s(array('Contact', 'contact')));
|
||||
$this->texts['link'] = ucfirst($this->util->_s(array('Link', 'Links')));
|
||||
$this->texts['insert'] = $this->util->_s(array('Insert Image', 'Insert an Image', 'Insert'));
|
||||
$this->texts['about'] = $this->util->__('About');
|
||||
$this->texts['visit'] = $this->util->_s(array('Visit plugin site', 'Visit plugin homepage'));
|
||||
}
|
||||
|
||||
function plugins_url( $path, $plugin ) {
|
||||
return version_compare('2.8', get_bloginfo('version')) > 0 ? plugins_url( 'auto-thickbox-plus/' . $path ) : plugins_url ( $path, $plugin );
|
||||
}
|
||||
|
||||
} # auto_thickbox
|
||||
|
||||
Reference in new issue
Block a user