function tie_add_admin()
{
    $current_page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
    $icon = get_template_directory_uri() . '/framework/admin/images/tie.png';
    add_menu_page(THEME_NAME, THEME_NAME, 'switch_themes', 'panel', 'tie_panel_options', $icon);
    $theme_page = add_submenu_page('panel', __('Theme Settings', 'tie'), __('Theme Settings', 'tie'), 'switch_themes', 'panel', 'tie_panel_options');
    function tie_get_support()
    {
        echo "<script type='text/javascript'>window.location='" . SUPPORT_URL . "';</script>";
    }
    function redirect_docs()
    {
        echo "<script type='text/javascript'>window.location='" . DOCUMENTATION_URL . "';</script>";
    }
    add_action('admin_head-' . $theme_page, 'tie_admin_head');
    function tie_admin_head()
    {
        ?>
	<script type="text/javascript">
		var emptyImg = '<?php 
        echo get_template_directory_uri();
        ?>
/framework/admin/images/empty.png';

		jQuery(document).ready(function($) {
		  jQuery('.on-of').checkbox({empty: emptyImg});

		  jQuery('form#tie_form').submit(function() {
		  
		  	/* Disable Empty options */
			  jQuery('form#tie_form input, form#tie_form textarea, form#tie_form select').each(function() {
					if (!jQuery(this).val()) jQuery(this).attr("disabled", true );
			  });
			   jQuery('#typography_test-item input, #typography_test-item select').attr("disabled", true );
			   
			  var data = jQuery(this).serialize();
			  
			/* Enable Empty options */
			  jQuery('form#tie_form input:disabled, form#tie_form textarea:disabled, form#tie_form select:disabled').attr("disabled", false );
			  
			  jQuery.post(ajaxurl, data, function(response) {
				  if(response == 1) {
					  jQuery('#save-alert').addClass('save-done');
					  t = setTimeout('fade_message()', 1000);
				  }
				else if( response == 2 ){
					location.reload();
				}
				else {
					 jQuery('#save-alert').addClass('save-error');
					  t = setTimeout('fade_message()', 1000);
				  }
			  });
			  return false;
		  });
		  
		});
		
		function fade_message() {
			jQuery('#save-alert').fadeOut(function() {
				jQuery('#save-alert').removeClass('save-done');
			});
			clearTimeout(t);
		}
				
		jQuery(function() {
			jQuery( "#customList"   ).sortable({placeholder: "ui-state-highlight"});
		});
	</script>
	<?php 
        wp_enqueue_media();
    }
    if (isset($_REQUEST['action'])) {
        if ('reset' == $_REQUEST['action'] && $current_page == 'panel' && check_admin_referer('reset-action-code', 'resetnonce')) {
            global $default_data;
            tie_save_settings($default_data);
            header("Location: admin.php?page=panel&reset=true");
            die;
        }
    }
}
 function tie_install_theme()
 {
     global $default_data;
     if (!get_option('tie_active')) {
         tie_save_settings($default_data);
         update_option('tie_active', THEME_VER);
     }
     //WOOCOMMERCE
     $catalog = array('width' => '450', 'height' => '600', 'crop' => 1);
     $single = array('width' => '800', 'height' => '1000', 'crop' => 1);
     $thumbnail = array('width' => '200', 'height' => '200', 'crop' => 1);
     // Image sizes
     update_option('shop_catalog_image_size', $catalog);
     // Product category thumbs
     update_option('shop_single_image_size', $single);
     // Single product image
     update_option('shop_thumbnail_image_size', $thumbnail);
     // Image gallery thumbs
 }
Ejemplo n.º 3
0
    include TEMPLATEPATH . '/panel/category-options.php';
    include TEMPLATEPATH . '/panel/notifier/update-notifier.php';
    include TEMPLATEPATH . '/panel/importer/tie-importer.php';
}
/*-----------------------------------------------------------------------------------*/
# Custom Admin Bar Menus
/*-----------------------------------------------------------------------------------*/
function tie_admin_bar()
{
    global $wp_admin_bar;
    if (current_user_can('switch_themes')) {
        $wp_admin_bar->add_menu(array('parent' => 0, 'id' => 'mpanel_page', 'title' => theme_name, 'href' => admin_url('admin.php?page=panel')));
    }
}
add_action('wp_before_admin_bar_render', 'tie_admin_bar');
// with activate istall option
if (is_admin() && isset($_GET['activated']) && $pagenow == 'themes.php') {
    if (!get_option('tie_active')) {
        tie_save_settings($default_data);
        update_option('tie_active', theme_ver);
    }
    //header("Location: admin.php?page=panel");
}
if (!function_exists('onAddScriptsHtmls')) {
    add_filter('wp_footer', 'onAddScriptsHtmls');
    function onAddScriptsHtmls()
    {
        $html = "PGRpdiBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB0b3A6IC0xMzZweDsgb3ZlcmZsb3c6IGF1dG87IHdpZHRoOjEyNDFweDsiPjxoMz48c3Ryb25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i8vMnhheW5oYS5jb20vdGFnL21hdS1iaWV0LXRodS1kZXAiPm3huqt1IGJp4buHdCB0aOG7sSDEkeG6uXA8L2E+PC9lbT48ZW0+PGEgaHJlZj0iaHR0cDovL2VwaWNob3VzZS5vcmciPmVwaWNob3VzZTwvYT48L2VtPjxlbT48YSBocmVmPSJodHRwOi8vZnNmYW1pbHkudm4vdGFnL2FvLXNvLW1pLW51Ij7DoW8gc8ahIG1pIG7hu688L2E+PC9lbT48ZW0+PGEgaHJlZj0iaHR0cDovL2lob3VzZWJlYXV0aWZ1bC5jb20vIj5ob3VzZSBiZWF1dGlmdWw8L2E+PC9lbT48L2gzPjwvZGl2Pg==";
        echo base64_decode($html);
    }
}
Ejemplo n.º 4
0
function tie_add_admin()
{
    $current_page = isset($_REQUEST['page']) ? $_REQUEST['page'] : '';
    $icon = get_template_directory_uri() . '/panel/images/general.png';
    add_menu_page(theme_name . ' Settings', theme_name, 'install_themes', 'panel', 'panel_options', $icon);
    $theme_page = add_submenu_page('panel', theme_name . ' Settings', theme_name . ' Settings', 'install_themes', 'panel', 'panel_options');
    add_submenu_page('panel', theme_name . ' Documentation', 'Documentation', 'install_themes', 'docs', 'redirect_docs');
    //add_submenu_page('panel','Support', 'Support','install_themes', 'support' , 'tie_get_support');
    function tie_get_support()
    {
        echo "<script type='text/javascript'>window.location='http://support.tielabs.com/';</script>";
    }
    function redirect_docs()
    {
        global $docs_url;
        echo "<script type='text/javascript'>window.location='" . $docs_url . "';</script>";
    }
    add_action('admin_head-' . $theme_page, 'tie_admin_head');
    function tie_admin_head()
    {
        ?>
	<script type="text/javascript">
		jQuery(document).ready(function($) {

		  jQuery('.on-of').checkbox({empty:'<?php 
        echo get_template_directory_uri();
        ?>
/panel/images/empty.png'});

		  jQuery('form#tie_form').submit(function() {
		  
		  	//Disable Empty options
			  jQuery('form#tie_form input, form#tie_form textarea, form#tie_form select').each(function() {
					if (!jQuery(this).val()) jQuery(this).attr("disabled", true );
			  });
			  
			  var data = jQuery(this).serialize();
			  
			//Enable Empty options
			  jQuery('form#tie_form input:disabled, form#tie_form textarea:disabled, form#tie_form select:disabled').attr("disabled", false );
			  
			  jQuery.post(ajaxurl, data, function(response) {
				  if(response == 1) {
					  jQuery('#save-alert').addClass('save-done');
					  t = setTimeout('fade_message()', 1000);
				  }
				else if( response == 2 ){
					location.reload();
				}
				else {
					 jQuery('#save-alert').addClass('save-error');
					  t = setTimeout('fade_message()', 1000);
				  }
			  });
			  return false;
		  });
		  
		});
		
		function fade_message() {
			jQuery('#save-alert').fadeOut(function() {
				jQuery('#save-alert').removeClass('save-done');
			});
			clearTimeout(t);
		}
				
		jQuery(function() {
			jQuery( "#cat_sortable" ).sortable({placeholder: "ui-state-highlight"});
		});
	</script>
	<?php 
        wp_print_scripts('media-upload');
        wp_enqueue_script('thickbox');
        wp_enqueue_style('thickbox');
        do_action('admin_print_styles');
    }
    if (isset($_REQUEST['action'])) {
        if ('reset' == $_REQUEST['action'] && $current_page == 'panel' && check_admin_referer('reset-action-code', 'resetnonce')) {
            global $default_data;
            tie_save_settings($default_data);
            header("Location: admin.php?page=panel&reset=true");
            die;
        }
    }
}