Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Modified function in class - START->END HASH
- * admin-page-class.php#L448
- */
- public function panel_script() {
- /* ... */
- echo '
- //bind click on menu action to show the right tab.
- jQuery(".panel_menu li").bind("click", function(event){
- event.preventDefault()
- if (!jQuery(this).hasClass("active_tab")){
- //hide all
- jQuery(".setingstab").hide("slow");
- jQuery(".panel_menu li").removeClass("active_tab");
- tab = jQuery(this).find("a").attr("href");
- jQuery(this).addClass("active_tab");
- jQuery(tab).show("fast");
- /* START HASH */
- hash = tab.replace( "#", "" );
- location.hash = "btn_"+hash;
- /* END HASH */
- }
- });'
- /* ... */
- }
- /**
- * Manipulate first active tab according to URL hash
- * my-plugin.php
- */
- add_action( 'admin_init', 'mtt_temp_plugin_init' );
- function mtt_temp_plugin_init()
- {
- global $mtt_class_admin_instance;
- $page = $mtt_class_admin_instance->options_class->_Slug;
- add_action('load-'.$page, 'print_header_footer_scripts' );
- }
- function print_header_footer_scripts()
- {
- global $mtt_class_admin_instance;
- $page = $mtt_class_admin_instance->options_class->_Slug;
- add_action('admin_head-'.$page, 'my_custom_css');
- add_action('admin_footer-'.$page, 'manipulate_options_hashes', 15 );
- }
- function my_custom_css() {}
- function manipulate_options_hashes()
- {
- ?>
- <script type="text/javascript">
- jQuery(document).ready( function($)
- {
- if( location.hash )
- {
- // get our hash
- hash = location.hash.substring(1);
- hash = hash.replace( "btn_", "" );
- // prevent modifications on first page
- if( "login_logout" != hash )
- {
- // toggle active menu items
- $('.panel_menu li:first').removeClass('active_tab');
- $(".panel_menu li."+hash).addClass('active_tab');
- // show content
- $(".setingstab").hide("slow");
- var tab = $(".panel_menu li."+hash+" a").attr("href");
- $(tab).show();
- }
- }
- });
- </script>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement