CHANGED: Places not only thidkbox.js but also custom <script>/<style> tags depending on "General - ThickBox Resources - Header/Footer" option. And outputs <!-- Auto ThickBox Plus --> comment before the custom tags for readability.
This commit is contained in:
1 parent
1b8d9df41d
commit
f9953dab7e
1 file changed
+19
-7
+19
-7
@@ -166,7 +166,13 @@ class auto_thickbox {
|
||||
wp_enqueue_style('thickbox');
|
||||
} # styles()
|
||||
|
||||
function footer_scripts() {
|
||||
function print_resources() {
|
||||
echo '<!-- Auto ThickBox Plus by attosoft (' . $this->util->__('http://attosoft.info/en/') . ') -->' . "\n";
|
||||
$this->custom_scripts();
|
||||
$this->custom_styles();
|
||||
}
|
||||
|
||||
function custom_scripts() {
|
||||
if ( $this->options['wp_gallery'] == 'on') {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
@@ -274,7 +280,7 @@ SCRIPT;
|
||||
echo "<script type='text/javascript'>\n/* <![CDATA[ */\njQuery(function() {\n$script});\n/* ]]> */\n</script>\n";
|
||||
}
|
||||
|
||||
function footer_styles() {
|
||||
function custom_styles() {
|
||||
$style = '';
|
||||
|
||||
if ( !$this->is_default_options('click_range') )
|
||||
@@ -457,6 +463,11 @@ SCRIPT;
|
||||
function __construct() {
|
||||
load_plugin_textdomain('auto-thickbox', false, ATBP_SLUG . '/languages');
|
||||
|
||||
if (require_once dirname(__FILE__) . '/auto-thickbox-utils.php')
|
||||
$this->util = new auto_thickbox_utils();
|
||||
$this->init_options();
|
||||
$this->init_texts();
|
||||
|
||||
if ( !is_admin() && isset($_SERVER['HTTP_USER_AGENT']) &&
|
||||
strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') === false) {
|
||||
if ( !class_exists('anchor_utils') )
|
||||
@@ -465,22 +476,21 @@ SCRIPT;
|
||||
add_action('wp_print_scripts', array(&$this, 'scripts'));
|
||||
add_action('wp_print_styles', array(&$this, 'styles'));
|
||||
|
||||
add_action('wp_footer', array(&$this, 'footer_scripts'), 20);
|
||||
add_action('wp_footer', array(&$this, 'footer_styles'), 20);
|
||||
$res_hook = $this->options['script_place'] == 'header' ? 'wp_head' : 'wp_footer';
|
||||
add_action($res_hook, array(&$this, 'print_resources'), 20);
|
||||
|
||||
add_filter('filter_anchor', array(&$this, 'filter'));
|
||||
}
|
||||
|
||||
if (require_once dirname(__FILE__) . '/auto-thickbox-utils.php')
|
||||
$this->util = new auto_thickbox_utils();
|
||||
|
||||
if ( is_admin() ) {
|
||||
if (include_once dirname(__FILE__) . '/auto-thickbox-options.php')
|
||||
new auto_thickbox_options($this);
|
||||
add_filter('plugin_action_links', array(&$this, 'add_auto_thickbox_action_links'), 10, 2);
|
||||
add_filter('plugin_row_meta', array(&$this, 'add_auto_thickbox_links'), 10, 2);
|
||||
}
|
||||
}
|
||||
|
||||
function init_options() {
|
||||
$this->options_def = array(
|
||||
'thickbox_style' => 'single',
|
||||
'wp_gallery' => 'on',
|
||||
@@ -670,7 +680,9 @@ SCRIPT;
|
||||
|
||||
if ($updateOption)
|
||||
update_option(ATBP_SLUG, $this->options);
|
||||
}
|
||||
|
||||
function init_texts() {
|
||||
$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'));
|
||||
|
||||
Reference in new issue
Block a user