Skip to content

Commit

Permalink
Merge branch 'javascript-cleanup' of github.com:Automattic/Ad-Code-Ma…
Browse files Browse the repository at this point in the history
…nager into javascript-cleanup

Conflicts:
	ad-code-manager.php
  • Loading branch information
danielbachhuber committed Mar 11, 2013
2 parents 3879fb6 + cd59824 commit 589c776
Show file tree
Hide file tree
Showing 3 changed files with 398 additions and 165 deletions.
28 changes: 2 additions & 26 deletions ad-code-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ function __construct() {
// Incorporate the link to our admin menu
add_action( 'admin_menu' , array( $this, 'action_admin_menu' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'register_scripts_and_styles' ) );
add_action( 'admin_print_scripts', array( $this, 'post_admin_header' ) );
add_action( 'wp_ajax_acm_admin_action', array( $this, 'handle_admin_action' ) );

add_action( 'current_screen', array( $this, 'contextual_help' ) );
Expand Down Expand Up @@ -368,8 +367,6 @@ function handle_admin_action() {
*
*/
function get_ad_codes( $query_args = array() ) {

$ad_codes_formatted = array();
$allowed_query_params = apply_filters( 'acm_allowed_get_posts_args', array( 'offset' ) );


Expand Down Expand Up @@ -593,27 +590,6 @@ function edit_conditionals( $ad_code_id, $conditionals = array() ) {
}
}

/**
* Print our vars as JS
*/
function post_admin_header() {

if ( !isset( $_GET['page'] ) || $_GET['page'] != $this->plugin_slug )
return;

$conditionals_parsed = array();
foreach ( $this->whitelisted_conditionals as $conditional )
$conditionals_parsed[] = $conditional . ':' . ucfirst( str_replace( '_', ' ', $conditional ) );
?>
<script type="text/javascript">
var acm_url = '<?php echo esc_js( admin_url( 'admin.php?page=' . $this->plugin_slug ) ) ?>';
var acm_conditionals = '<?php echo esc_js( implode( ';', $conditionals_parsed ) )?>';
var acm_ajax_nonce = '<?php echo esc_js( wp_create_nonce( 'acm_nonce' ) ) ?>';
var acm_conditionals_index = 0;
</script>
<?php
}

/**
* Hook in our submenu page to the navigation
*/
Expand Down Expand Up @@ -753,8 +729,8 @@ function register_scripts_and_styles() {
if ( 'tools.php' != $pagenow || !isset( $_GET['page'] ) || $_GET['page'] != $this->plugin_slug )
return;

wp_enqueue_style( 'acm-style', AD_CODE_MANAGER_URL . 'common/css/acm.css' );
wp_enqueue_script( 'acm', AD_CODE_MANAGER_URL . 'common/js/acm.js', array( 'jquery', 'jquery-ui-core' ) );
wp_enqueue_style( 'acm-style', AD_CODE_MANAGER_URL . '/common/css/acm.css' );
wp_enqueue_script( 'acm', AD_CODE_MANAGER_URL . '/common/js/acm.js', array( 'jquery' ), false, true );
}

/**
Expand Down
Loading

0 comments on commit 589c776

Please sign in to comment.