A
alexsaporta
Gamma
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Error en la linea 1 del siguiente documento. Alguien ve de que error se trata?
<?phpfunction optionsframework_admin_init() { // Rev up the Options Machine global $of_options_treebeard, $treebeard_options_machine; $treebeard_options_machine = new Options_Machine($of_options_treebeard); //if reset is pressed->replace options with defaults if ( isset($_REQUEST['page']) && $_REQUEST['page'] == 'optionsframework' ) { if (isset($_REQUEST['of_reset']) && 'reset' == $_REQUEST['of_reset']) { $nonce=$_POST['security']; if (!wp_verify_nonce($nonce, 'of_ajax_nonce') ) { header('Location: themes.php?page=optionsframework&reset=error'); die('Security Check'); } else { $defaults = (array) $treebeard_options_machine->Defaults; update_option(OPTIONS,$defaults); generate_options_css($defaults); //generate static css file header('Location: themes.php?page=optionsframework&reset=true'); die($treebeard_options_machine->Defaults); } } }}add_action('admin_init','optionsframework_admin_init');/*-----------------------------------------------------------------------------------*//* Options Framework Admin Interface - optionsframework_add_admin *//*-----------------------------------------------------------------------------------*/function optionsframework_add_admin() { if ( !is_plugin_active( 'page-builder-pmc/page-builder-pmc.php' ) ) { //plugin is activated $of_page = add_theme_page('Theme Options','Theme Options','edit_theme_options','optionsframework','optionsframework_options_page') ; // Add framework functionaily to the head individually add_action("admin_print_scripts-$of_page", 'of_load_only'); add_action("admin_print_styles-$of_page",'of_style_only'); add_action( "admin_print_styles-$of_page", 'optionsframework_mlu_css', 0 ); add_action( "admin_print_scripts-$of_page", 'optionsframework_mlu_js', 0 ); } } add_action('admin_menu', 'optionsframework_add_admin');function pmc_add_admin_bar(){ global $wp_admin_bar; $wp_admin_bar->add_menu( array( 'id' => 'pmc_theme_options', 'parent' => 'appearance', 'title' => 'PMC Theme options', 'href' => admin_url('admin.php?page=optionsframework') ) ); }add_action('admin_bar_menu', 'pmc_add_admin_bar', 1000);/*-----------------------------------------------------------------------------------*//* Build the Options Page - optionsframework_options_page *//*-----------------------------------------------------------------------------------*/function optionsframework_options_page(){global $treebeard_options_machine; /* //for debugging $treebeard_data = get_option(OPTIONS); print_r($treebeard_data); */ ?><div class="wrap" id="of_container"> <div id="of-popup-save" class="of-save-popup"> <div class="of-save-save">Options Updated</div> </div> <div id="of-popup-reset" class="of-save-popup"> <div class="of-save-reset">Options Reset</div> </div> <div id="of-popup-fail" class="of-save-popup"> <div class="of-save-fail">Error!</div> </div> <form id="of_form" method="post" action="<?php echo esc_attr( $_SERVER['REQUEST_URI'] ) ?>" enctype="multipart/form-data" > <div id="header"> <div class="logo"> <h2></h2> </div> <div id="js-warning">Warning- This options panel will not work properly without javascript!</div> <div class="fa fa-option"> </div> <div class="clear"></div> </div> <div id="info_bar"> <a><div id="expand_options" class="expand">Expand</div></a> <img style="display:none" src="<?php echo ADMIN_DIR; ?>images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." /> <input type="hidden" id="security" name="security" value="<?php echo wp_create_nonce('of_ajax_nonce'); ?>" /> <button id ="of_save" type="button" class="button-primary">Save All Changes</button> </div><!--.info_bar--> <div id="main"> <div id="of-nav"> <ul> <?php echo $treebeard_options_machine->Menu ?> </ul> </div> <div id="content"> <?php echo $treebeard_options_machine->Inputs /* Settings */ ?> </div> <div class="clear"></div> </div> <div class="save_bar"> <img style="display:none" src="<?php echo ADMIN_DIR; ?>images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." /> <input type="hidden" id="security" name="security" value="<?php echo wp_create_nonce('of_ajax_nonce'); ?>" /> <input type="hidden" name="of_reset" value="reset" /> <button id ="of_save" type="submit" class="button-primary">Save All Changes</button> <button id ="of_reset" type="submit" class="button submit-button reset-button" >Options Reset</button> </div><!--.save_bar--> </form> <?php if (!empty($update_message)) echo $update_message; ?><div style="clear:both;"></div></div><!--wrap--><?php}/*-----------------------------------------------------------------------------------*//* Load required styles for Options Page - of_style_only *//*-----------------------------------------------------------------------------------*/function of_style_only(){ wp_enqueue_style('admin-style', ADMIN_DIR . 'admin-style.css'); wp_enqueue_style('color-picker', ADMIN_DIR . 'css/colorpicker.css');} /*-----------------------------------------------------------------------------------*//* Load required javascripts for Options Page - of_load_only *//*-----------------------------------------------------------------------------------*/function of_load_only() { add_action('admin_head', 'of_admin_head'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-sortable'); wp_register_script('jquery-input-mask', ADMIN_DIR .'js/jquery.maskedinput-1.2.2.js', array( 'jquery' )); wp_enqueue_script('jquery-input-mask'); wp_enqueue_script('color-picker', ADMIN_DIR .'js/colorpicker.js', array('jquery')); wp_enqueue_script('ajaxupload', ADMIN_DIR .'js/ajaxupload.js', array('jquery')); wp_enqueue_script('cookie', ADMIN_DIR . '/js/cookie.js', 'jquery'); // Registers custom scripts for the Media Library AJAX uploader.}function of_admin_head() { global $treebeard_data; ?> <script type="text/javascript" language="javascript"> jQuery.noConflict(); jQuery(document).ready(function($){ //delays until AjaxUpload is finished loading //fixes bug in Safari and Mac Chrome if (typeof AjaxUpload != 'function') { return ++counter < 6 && window.setTimeout(init, counter * 500); } //hides warning if js is enabled $('#js-warning').hide(); //Tabify Options $('.group').hide(); // Display last current tab if ($.cookie("of_current_opt") === null) { $('.group:first').fadeIn(); $('#of-nav li:first').addClass('current'); } else { var hooks = {<?php $h = 0; $hooks = of_get_header_classes_array(); foreach ($hooks as $hook) { $h++; echo '\''.$h.'\' : \''.$hook.'\','; } ?>}; $.each(hooks, function(key, value) { if ($.cookie("of_current_opt") == '#of-option-'+ value) { $('.group#of-option-' + value).fadeIn(); $('#of-nav li.' + value).addClass('current'); } }); } $('.group .collapsed').each(function(){ $(this).find('input:checked').parent().parent().parent().nextAll().each( function(){ if ($(this).hasClass('last')) { $(this).removeClass('hidden'); return false; } $(this).filter('.hidden').removeClass('hidden'); }); }); $('.group .collapsed input:checkbox').click(unhideHidden); function unhideHidden(){ // event.preventDefault(); if ($(this).attr('checked')) { $(this).parent().parent().parent().nextAll().removeClass('hidden'); } else { $(this).parent().parent().parent().nextAll().each( function(){ if ($(this).filter('.last').length) { $(this).addClass('hidden'); return false; } $(this).addClass('hidden'); }); } } //Current Menu Class $('#of-nav li a').click(function(evt){ // event.preventDefault(); $('#of-nav li').removeClass('current'); $(this).parent().addClass('current'); var clicked_group = $(this).attr('href'); $.cookie('of_current_opt', clicked_group, { expires: 7, path: '<?php echo get_stylesheet_directory() . '/admin/' ?>' }); $('.group').hide(); $(clicked_group).fadeIn(); return false; }); //Expand Options var flip = 0; $('#expand_options').click(function(){ if(flip == 0){ flip = 1; $('#of_container #of-nav').hide(); $('#of_container #content').width(755); $('#of_container .group').add('#of_container .group h2').show(); $(this).removeClass('expand'); $(this).addClass('close'); $(this).text('Close'); } else { flip = 0; $('#of_container #of-nav').show(); $('#of_container #content').width(595); $('#of_container .group').add('#of_container .group h2').hide(); $('#of_container .group:first').show(); $('#of_container #of-nav li').removeClass('current'); $('#of_container #of-nav li:first').addClass('current'); $(this).removeClass('close'); $(this).addClass('expand'); $(this).text('Expand'); } }); // Reset Message Popup var reset = "<?php if(isset($_REQUEST['reset'])) echo $_REQUEST['reset']; ?>"; if ( reset.length ){ if ( reset == 'true') { var message_popup = $('#of-popup-reset'); } else { var message_popup = $('#of-popup-fail'); } message_popup.fadeIn(); window.setTimeout(function(){ message_popup.fadeOut(); }, 2000); } //Update Message popup $.fn.center = function () { this.animate({"top"🙁 $(window).height() - this.height() - 200 ) / 2+$(window).scrollTop() + "px"},100); this.css("left", 250 ); return this; } $('#of-popup-save').center(); $('#of-popup-reset').center(); $('#of-popup-fail').center(); $(window).scroll(function() { $('#of-popup-save').center(); $('#of-popup-reset').center(); $('#of-popup-fail').center(); }); //Masked Inputs (images as radio buttons) $('.of-radio-img-img').click(function(){ $(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected'); $(this).addClass('of-radio-img-selected'); }); $('.of-radio-img-label').hide(); $('.of-radio-img-img').show(); $('.of-radio-img-radio').hide(); //Masked Inputs (background images as radio buttons) $('.of-radio-tile-img').click(function(){ $(this).parent().parent().find('.of-radio-tile-img').removeClass('of-radio-tile-selected'); $(this).addClass('of-radio-tile-selected'); }); $('.of-radio-tile-label').hide(); $('.of-radio-tile-img').show(); $('.of-radio-tile-radio').hide(); // COLOR Picker $('.colorSelector').each(function(){ var Othis = this; //cache a copy of the this variable for use inside nested function $(this).ColorPicker({ color: '<?php if(isset($color)) echo $color; ?>', onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { $(colpkr).fadeOut(500); return false; }, onChange: function (hsb, hex, rgb) { $(Othis).children('div').css('backgroundColor', '#' + hex); $(Othis).next('input').attr('value','#' + hex); } }); }); //end color picker //AJAX Upload function of_image_upload() { $('.image_upload_button').each(function(){ var clickedObject = $(this); var clickedID = $(this).attr('id'); var nonce = $('#security').val(); new AjaxUpload(clickedID, { action: ajaxurl, name: clickedID, // File upload name data: { // Additional data to send action: 'of_ajax_post_action', type: 'upload', security: nonce, data: clickedID }, autoSubmit: true, // Submit file after selection responseType: false, onChange: function(file, extension){}, onSubmit: function(file, extension){ clickedObject.text('Uploading'); // change button text, when user selects file this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button interval = window.setInterval(function(){ var text = clickedObject.text(); if (text.length < 13){ clickedObject.text(text + '.'); } else { clickedObject.text('Uploading'); } }, 200); }, onComplete: function(file, response) { window.clearInterval(interval); clickedObject.text('Upload Image'); this.enable(); // enable upload button // If nonce fails if(response==-1){ var fail_popup = $('#of-popup-fail'); fail_popup.fadeIn(); window.setTimeout(function(){ fail_popup.fadeOut(); }, 2000); } // If there was an error else if(response.search('Upload Error') > -1){ var buildReturn = '<span class="upload-error">' + response + '</span>'; $(".upload-error").remove(); clickedObject.parent().after(buildReturn); } else{ var buildReturn = '<img class="hide of-option-image" id="image_'+clickedID+'" src="'+response+'" alt="" />'; $(".upload-error").remove(); $("#image_" + clickedID).remove(); clickedObject.parent().after(buildReturn); $('img#image_'+clickedID).fadeIn(); clickedObject.next('span').fadeIn(); clickedObject.parent().prev('input').val(response); } } }); }); } of_image_upload(); //AJAX Remove (clear option value) $('.image_reset_button').live('click', function(){ var clickedObject = $(this); var clickedID = $(this).attr('id'); var theID = $(this).attr('title'); var nonce = $('#security').val(); var data = { action: 'of_ajax_post_action', type: 'image_reset', security: nonce, data: theID }; $.post(ajaxurl, data, function(response) { //check nonce if(response==-1){ //failed var fail_popup = $('#of-popup-fail'); fail_popup.fadeIn(); window.setTimeout(function(){ fail_popup.fadeOut(); }, 2000); } else { var image_to_remove = $('#image_' + theID); var button_to_hide = $('#reset_' + theID); image_to_remove.fadeOut(500,function(){ $(this).remove(); }); button_to_hide.fadeOut(); clickedObject.parent().prev('input').val(''); } }); }); /* Style Select */ (function ($) { styleSelect = { init: function () { $('.select_wrapper').each(function () { $(this).prepend('<span>' + $(this).find('.select option:selected').text() + '</span>'); }); $('.select').live('change', function () { $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>'); }); $('.select').bind($.browser.msie ? 'click' : 'change', function(event) { $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>'); }); } }; $(document).ready(function () { styleSelect.init() }) })(jQuery); //----------------------------------------------------------------*/ // Aquagraphite SliderSlider MOD //----------------------------------------------------------------*/ /* Slider Interface */ //Hide (Collapse) the toggle containers on load $(".slide_body").hide(); //Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state) $(".slide_edit_button").live( 'click', function(){ $(this).parent().toggleClass("active").next().slideToggle("fast"); return false; //Prevent the browser jump to the link anchor }); // Update slide title upon typing function update_slider_title(e) { var element = e; if ( this.timer ) { clearTimeout( element.timer ); } this.timer = setTimeout( function() { $(element).parent().prev().find('strong').text( element.value ); }, 100); return true; } $('.of-slider-title').live('keyup', function(){ update_slider_title(this); }); /* Remove individual slide */ $('.slide_delete_button').live('click', function(){ // event.preventDefault(); var agree = confirm("Are you sure you wish to delete this slide?"); if (agree) { var $trash = $(this).parents('li'); //$trash.slideUp('slow', function(){ $trash.remove(); }); //chrome + confirm bug made slideUp not working... $trash.remove(); return false; //Prevent the browser jump to the link anchor } else { return false; } }); /* Add new slide */ $(".slide_add_button").live('click', function(){ var slidesContainer = $(this).prev(); var sliderId = slidesContainer.attr('id'); var sliderInt = $('#'+sliderId).attr('rel'); var numArr = $('#'+sliderId +' li').find('.order').map(function() { var str = this.id; str = str.replace(/\D/g,''); str = parseFloat(str); return str; }).get(); var maxNum = Math.max.apply(Math, numArr); var newNum = maxNum + 1; var iconid =sliderId+1; slidesContainer.append('<li><div class="slide_header"><strong>Client ' + newNum + '</strong><input type="hidden" class="slide of-input order" name="' + sliderId + '[' + newNum + '][order]" id="' + sliderId + '_slide_order-' + newNum + '" value="' + newNum + '"><a class="slide_edit_button" href="#">Edit</a></div><div class="slide_body" style="display: none; "><label>Title</label><input class="slide of-input of-slider-title" name="' + sliderId + '[' + newNum + '][title]" id="' + sliderId + '_' + newNum + '_slide_title" value=""><label>Image URL</label><input class="slide of-input" name="' + sliderId + '[' + newNum + ']" id="' + sliderId + '_' + newNum +...eturn false; //prevent jumps, as always.. });
<?phpfunction optionsframework_admin_init() { // Rev up the Options Machine global $of_options_treebeard, $treebeard_options_machine; $treebeard_options_machine = new Options_Machine($of_options_treebeard); //if reset is pressed->replace options with defaults if ( isset($_REQUEST['page']) && $_REQUEST['page'] == 'optionsframework' ) { if (isset($_REQUEST['of_reset']) && 'reset' == $_REQUEST['of_reset']) { $nonce=$_POST['security']; if (!wp_verify_nonce($nonce, 'of_ajax_nonce') ) { header('Location: themes.php?page=optionsframework&reset=error'); die('Security Check'); } else { $defaults = (array) $treebeard_options_machine->Defaults; update_option(OPTIONS,$defaults); generate_options_css($defaults); //generate static css file header('Location: themes.php?page=optionsframework&reset=true'); die($treebeard_options_machine->Defaults); } } }}add_action('admin_init','optionsframework_admin_init');/*-----------------------------------------------------------------------------------*//* Options Framework Admin Interface - optionsframework_add_admin *//*-----------------------------------------------------------------------------------*/function optionsframework_add_admin() { if ( !is_plugin_active( 'page-builder-pmc/page-builder-pmc.php' ) ) { //plugin is activated $of_page = add_theme_page('Theme Options','Theme Options','edit_theme_options','optionsframework','optionsframework_options_page') ; // Add framework functionaily to the head individually add_action("admin_print_scripts-$of_page", 'of_load_only'); add_action("admin_print_styles-$of_page",'of_style_only'); add_action( "admin_print_styles-$of_page", 'optionsframework_mlu_css', 0 ); add_action( "admin_print_scripts-$of_page", 'optionsframework_mlu_js', 0 ); } } add_action('admin_menu', 'optionsframework_add_admin');function pmc_add_admin_bar(){ global $wp_admin_bar; $wp_admin_bar->add_menu( array( 'id' => 'pmc_theme_options', 'parent' => 'appearance', 'title' => 'PMC Theme options', 'href' => admin_url('admin.php?page=optionsframework') ) ); }add_action('admin_bar_menu', 'pmc_add_admin_bar', 1000);/*-----------------------------------------------------------------------------------*//* Build the Options Page - optionsframework_options_page *//*-----------------------------------------------------------------------------------*/function optionsframework_options_page(){global $treebeard_options_machine; /* //for debugging $treebeard_data = get_option(OPTIONS); print_r($treebeard_data); */ ?><div class="wrap" id="of_container"> <div id="of-popup-save" class="of-save-popup"> <div class="of-save-save">Options Updated</div> </div> <div id="of-popup-reset" class="of-save-popup"> <div class="of-save-reset">Options Reset</div> </div> <div id="of-popup-fail" class="of-save-popup"> <div class="of-save-fail">Error!</div> </div> <form id="of_form" method="post" action="<?php echo esc_attr( $_SERVER['REQUEST_URI'] ) ?>" enctype="multipart/form-data" > <div id="header"> <div class="logo"> <h2></h2> </div> <div id="js-warning">Warning- This options panel will not work properly without javascript!</div> <div class="fa fa-option"> </div> <div class="clear"></div> </div> <div id="info_bar"> <a><div id="expand_options" class="expand">Expand</div></a> <img style="display:none" src="<?php echo ADMIN_DIR; ?>images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." /> <input type="hidden" id="security" name="security" value="<?php echo wp_create_nonce('of_ajax_nonce'); ?>" /> <button id ="of_save" type="button" class="button-primary">Save All Changes</button> </div><!--.info_bar--> <div id="main"> <div id="of-nav"> <ul> <?php echo $treebeard_options_machine->Menu ?> </ul> </div> <div id="content"> <?php echo $treebeard_options_machine->Inputs /* Settings */ ?> </div> <div class="clear"></div> </div> <div class="save_bar"> <img style="display:none" src="<?php echo ADMIN_DIR; ?>images/loading-bottom.gif" class="ajax-loading-img ajax-loading-img-bottom" alt="Working..." /> <input type="hidden" id="security" name="security" value="<?php echo wp_create_nonce('of_ajax_nonce'); ?>" /> <input type="hidden" name="of_reset" value="reset" /> <button id ="of_save" type="submit" class="button-primary">Save All Changes</button> <button id ="of_reset" type="submit" class="button submit-button reset-button" >Options Reset</button> </div><!--.save_bar--> </form> <?php if (!empty($update_message)) echo $update_message; ?><div style="clear:both;"></div></div><!--wrap--><?php}/*-----------------------------------------------------------------------------------*//* Load required styles for Options Page - of_style_only *//*-----------------------------------------------------------------------------------*/function of_style_only(){ wp_enqueue_style('admin-style', ADMIN_DIR . 'admin-style.css'); wp_enqueue_style('color-picker', ADMIN_DIR . 'css/colorpicker.css');} /*-----------------------------------------------------------------------------------*//* Load required javascripts for Options Page - of_load_only *//*-----------------------------------------------------------------------------------*/function of_load_only() { add_action('admin_head', 'of_admin_head'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-sortable'); wp_register_script('jquery-input-mask', ADMIN_DIR .'js/jquery.maskedinput-1.2.2.js', array( 'jquery' )); wp_enqueue_script('jquery-input-mask'); wp_enqueue_script('color-picker', ADMIN_DIR .'js/colorpicker.js', array('jquery')); wp_enqueue_script('ajaxupload', ADMIN_DIR .'js/ajaxupload.js', array('jquery')); wp_enqueue_script('cookie', ADMIN_DIR . '/js/cookie.js', 'jquery'); // Registers custom scripts for the Media Library AJAX uploader.}function of_admin_head() { global $treebeard_data; ?> <script type="text/javascript" language="javascript"> jQuery.noConflict(); jQuery(document).ready(function($){ //delays until AjaxUpload is finished loading //fixes bug in Safari and Mac Chrome if (typeof AjaxUpload != 'function') { return ++counter < 6 && window.setTimeout(init, counter * 500); } //hides warning if js is enabled $('#js-warning').hide(); //Tabify Options $('.group').hide(); // Display last current tab if ($.cookie("of_current_opt") === null) { $('.group:first').fadeIn(); $('#of-nav li:first').addClass('current'); } else { var hooks = {<?php $h = 0; $hooks = of_get_header_classes_array(); foreach ($hooks as $hook) { $h++; echo '\''.$h.'\' : \''.$hook.'\','; } ?>}; $.each(hooks, function(key, value) { if ($.cookie("of_current_opt") == '#of-option-'+ value) { $('.group#of-option-' + value).fadeIn(); $('#of-nav li.' + value).addClass('current'); } }); } $('.group .collapsed').each(function(){ $(this).find('input:checked').parent().parent().parent().nextAll().each( function(){ if ($(this).hasClass('last')) { $(this).removeClass('hidden'); return false; } $(this).filter('.hidden').removeClass('hidden'); }); }); $('.group .collapsed input:checkbox').click(unhideHidden); function unhideHidden(){ // event.preventDefault(); if ($(this).attr('checked')) { $(this).parent().parent().parent().nextAll().removeClass('hidden'); } else { $(this).parent().parent().parent().nextAll().each( function(){ if ($(this).filter('.last').length) { $(this).addClass('hidden'); return false; } $(this).addClass('hidden'); }); } } //Current Menu Class $('#of-nav li a').click(function(evt){ // event.preventDefault(); $('#of-nav li').removeClass('current'); $(this).parent().addClass('current'); var clicked_group = $(this).attr('href'); $.cookie('of_current_opt', clicked_group, { expires: 7, path: '<?php echo get_stylesheet_directory() . '/admin/' ?>' }); $('.group').hide(); $(clicked_group).fadeIn(); return false; }); //Expand Options var flip = 0; $('#expand_options').click(function(){ if(flip == 0){ flip = 1; $('#of_container #of-nav').hide(); $('#of_container #content').width(755); $('#of_container .group').add('#of_container .group h2').show(); $(this).removeClass('expand'); $(this).addClass('close'); $(this).text('Close'); } else { flip = 0; $('#of_container #of-nav').show(); $('#of_container #content').width(595); $('#of_container .group').add('#of_container .group h2').hide(); $('#of_container .group:first').show(); $('#of_container #of-nav li').removeClass('current'); $('#of_container #of-nav li:first').addClass('current'); $(this).removeClass('close'); $(this).addClass('expand'); $(this).text('Expand'); } }); // Reset Message Popup var reset = "<?php if(isset($_REQUEST['reset'])) echo $_REQUEST['reset']; ?>"; if ( reset.length ){ if ( reset == 'true') { var message_popup = $('#of-popup-reset'); } else { var message_popup = $('#of-popup-fail'); } message_popup.fadeIn(); window.setTimeout(function(){ message_popup.fadeOut(); }, 2000); } //Update Message popup $.fn.center = function () { this.animate({"top"🙁 $(window).height() - this.height() - 200 ) / 2+$(window).scrollTop() + "px"},100); this.css("left", 250 ); return this; } $('#of-popup-save').center(); $('#of-popup-reset').center(); $('#of-popup-fail').center(); $(window).scroll(function() { $('#of-popup-save').center(); $('#of-popup-reset').center(); $('#of-popup-fail').center(); }); //Masked Inputs (images as radio buttons) $('.of-radio-img-img').click(function(){ $(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected'); $(this).addClass('of-radio-img-selected'); }); $('.of-radio-img-label').hide(); $('.of-radio-img-img').show(); $('.of-radio-img-radio').hide(); //Masked Inputs (background images as radio buttons) $('.of-radio-tile-img').click(function(){ $(this).parent().parent().find('.of-radio-tile-img').removeClass('of-radio-tile-selected'); $(this).addClass('of-radio-tile-selected'); }); $('.of-radio-tile-label').hide(); $('.of-radio-tile-img').show(); $('.of-radio-tile-radio').hide(); // COLOR Picker $('.colorSelector').each(function(){ var Othis = this; //cache a copy of the this variable for use inside nested function $(this).ColorPicker({ color: '<?php if(isset($color)) echo $color; ?>', onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { $(colpkr).fadeOut(500); return false; }, onChange: function (hsb, hex, rgb) { $(Othis).children('div').css('backgroundColor', '#' + hex); $(Othis).next('input').attr('value','#' + hex); } }); }); //end color picker //AJAX Upload function of_image_upload() { $('.image_upload_button').each(function(){ var clickedObject = $(this); var clickedID = $(this).attr('id'); var nonce = $('#security').val(); new AjaxUpload(clickedID, { action: ajaxurl, name: clickedID, // File upload name data: { // Additional data to send action: 'of_ajax_post_action', type: 'upload', security: nonce, data: clickedID }, autoSubmit: true, // Submit file after selection responseType: false, onChange: function(file, extension){}, onSubmit: function(file, extension){ clickedObject.text('Uploading'); // change button text, when user selects file this.disable(); // If you want to allow uploading only 1 file at time, you can disable upload button interval = window.setInterval(function(){ var text = clickedObject.text(); if (text.length < 13){ clickedObject.text(text + '.'); } else { clickedObject.text('Uploading'); } }, 200); }, onComplete: function(file, response) { window.clearInterval(interval); clickedObject.text('Upload Image'); this.enable(); // enable upload button // If nonce fails if(response==-1){ var fail_popup = $('#of-popup-fail'); fail_popup.fadeIn(); window.setTimeout(function(){ fail_popup.fadeOut(); }, 2000); } // If there was an error else if(response.search('Upload Error') > -1){ var buildReturn = '<span class="upload-error">' + response + '</span>'; $(".upload-error").remove(); clickedObject.parent().after(buildReturn); } else{ var buildReturn = '<img class="hide of-option-image" id="image_'+clickedID+'" src="'+response+'" alt="" />'; $(".upload-error").remove(); $("#image_" + clickedID).remove(); clickedObject.parent().after(buildReturn); $('img#image_'+clickedID).fadeIn(); clickedObject.next('span').fadeIn(); clickedObject.parent().prev('input').val(response); } } }); }); } of_image_upload(); //AJAX Remove (clear option value) $('.image_reset_button').live('click', function(){ var clickedObject = $(this); var clickedID = $(this).attr('id'); var theID = $(this).attr('title'); var nonce = $('#security').val(); var data = { action: 'of_ajax_post_action', type: 'image_reset', security: nonce, data: theID }; $.post(ajaxurl, data, function(response) { //check nonce if(response==-1){ //failed var fail_popup = $('#of-popup-fail'); fail_popup.fadeIn(); window.setTimeout(function(){ fail_popup.fadeOut(); }, 2000); } else { var image_to_remove = $('#image_' + theID); var button_to_hide = $('#reset_' + theID); image_to_remove.fadeOut(500,function(){ $(this).remove(); }); button_to_hide.fadeOut(); clickedObject.parent().prev('input').val(''); } }); }); /* Style Select */ (function ($) { styleSelect = { init: function () { $('.select_wrapper').each(function () { $(this).prepend('<span>' + $(this).find('.select option:selected').text() + '</span>'); }); $('.select').live('change', function () { $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>'); }); $('.select').bind($.browser.msie ? 'click' : 'change', function(event) { $(this).prev('span').replaceWith('<span>' + $(this).find('option:selected').text() + '</span>'); }); } }; $(document).ready(function () { styleSelect.init() }) })(jQuery); //----------------------------------------------------------------*/ // Aquagraphite SliderSlider MOD //----------------------------------------------------------------*/ /* Slider Interface */ //Hide (Collapse) the toggle containers on load $(".slide_body").hide(); //Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state) $(".slide_edit_button").live( 'click', function(){ $(this).parent().toggleClass("active").next().slideToggle("fast"); return false; //Prevent the browser jump to the link anchor }); // Update slide title upon typing function update_slider_title(e) { var element = e; if ( this.timer ) { clearTimeout( element.timer ); } this.timer = setTimeout( function() { $(element).parent().prev().find('strong').text( element.value ); }, 100); return true; } $('.of-slider-title').live('keyup', function(){ update_slider_title(this); }); /* Remove individual slide */ $('.slide_delete_button').live('click', function(){ // event.preventDefault(); var agree = confirm("Are you sure you wish to delete this slide?"); if (agree) { var $trash = $(this).parents('li'); //$trash.slideUp('slow', function(){ $trash.remove(); }); //chrome + confirm bug made slideUp not working... $trash.remove(); return false; //Prevent the browser jump to the link anchor } else { return false; } }); /* Add new slide */ $(".slide_add_button").live('click', function(){ var slidesContainer = $(this).prev(); var sliderId = slidesContainer.attr('id'); var sliderInt = $('#'+sliderId).attr('rel'); var numArr = $('#'+sliderId +' li').find('.order').map(function() { var str = this.id; str = str.replace(/\D/g,''); str = parseFloat(str); return str; }).get(); var maxNum = Math.max.apply(Math, numArr); var newNum = maxNum + 1; var iconid =sliderId+1; slidesContainer.append('<li><div class="slide_header"><strong>Client ' + newNum + '</strong><input type="hidden" class="slide of-input order" name="' + sliderId + '[' + newNum + '][order]" id="' + sliderId + '_slide_order-' + newNum + '" value="' + newNum + '"><a class="slide_edit_button" href="#">Edit</a></div><div class="slide_body" style="display: none; "><label>Title</label><input class="slide of-input of-slider-title" name="' + sliderId + '[' + newNum + '][title]" id="' + sliderId + '_' + newNum + '_slide_title" value=""><label>Image URL</label><input class="slide of-input" name="' + sliderId + '[' + newNum + ']" id="' + sliderId + '_' + newNum +...eturn false; //prevent jumps, as always.. });
Última edición: