コード例 #1
0
ファイル: admin.php プロジェクト: designomx/DMXFrmwrk
/**
 * Add JS and CSS to admin header.
 *
 * @since	1.6
 */
function tptn_adminhead()
{
    wp_enqueue_script('common');
    wp_enqueue_script('wp-lists');
    wp_enqueue_script('postbox');
    wp_enqueue_script('plugin-install');
    add_thickbox();
    ?>
	<style type="text/css">
		.postbox .handlediv:before {
			right:12px;
			font:400 20px/1 dashicons;
			speak:none;
			display:inline-block;
			top:0;
			position:relative;
			-webkit-font-smoothing:antialiased;
			-moz-osx-font-smoothing:grayscale;
			text-decoration:none!important;
			content:'\f142';
			padding:8px 10px;
		}
		.postbox.closed .handlediv:before {
			content: '\f140';
		}
		.wrap h2:before {
		    content: "\f204";
		    display: inline-block;
		    -webkit-font-smoothing: antialiased;
		    font: normal 29px/1 'dashicons';
		    vertical-align: middle;
		    margin-right: 0.3em;
		}
	</style>

	<script type="text/javascript">
		//<![CDATA[
		jQuery(document).ready( function($) {
			// close postboxes that should be closed
			$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
			// postboxes setup
			postboxes.add_postbox_toggles('tptn_options');
		});
		//]]>
	</script>

	<script type="text/javascript" language="JavaScript">
		//<![CDATA[
		function checkForm() {
			answer = true;
			if (siw && siw.selectingSomething)
				answer = false;
			return answer;
		}//
		//]]>
	</script>

	<link rel="stylesheet" type="text/css" href="<?php 
    echo TOP_TEN_PLUGIN_URL;
    ?>
/admin/wick/wick.css" />
	<script type="text/javascript" language="JavaScript">
		//<![CDATA[
		function clearCache() {
			/**** since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php ****/
			jQuery.post(ajaxurl, {action: 'tptn_clear_cache'}, function(response, textStatus, jqXHR) {
				alert( response.message );
			}, 'json');
		}

		<?php 
    function wick_data()
    {
        $categories = get_categories('hide_empty=0');
        $str = 'collection = [';
        foreach ($categories as $cat) {
            $str .= "'" . $cat->slug . "',";
        }
        $str = substr($str, 0, -1);
        // Remove trailing comma
        $str .= '];';
        echo $str;
    }
    wick_data();
    ?>
		//]]>
	</script>

	<script type="text/javascript" src="<?php 
    echo TOP_TEN_PLUGIN_URL;
    ?>
/admin/wick/wick.js"></script>

<?php 
}
コード例 #2
0
ファイル: sample_data.js.php プロジェクト: nil-vn/pan-pan
<?php

//"sample_data.js.php" List of categories
Header("content-type: application/x-javascript");
if (!function_exists('add_action')) {
    $wp_root = '../../../..';
    if (file_exists($wp_root . '/wp-load.php')) {
        require_once $wp_root . '/wp-load.php';
    } else {
        require_once $wp_root . '/wp-config.php';
    }
}
// Ajax Increment Counter
wick_data();
function wick_data()
{
    global $wpdb;
    $categories = get_categories('hide_empty=0');
    $str = 'collection = [';
    foreach ($categories as $cat) {
        $str .= "'" . $cat->slug . "',";
    }
    $str = substr($str, 0, -1);
    // Remove trailing comma
    $str .= '];';
    echo $str;
}