gpi_register_scripts

The WordPress Core gpi register scripts function.

Description

gpi_register_scripts( $hook ); 

Parameters (1)

0. $hook
The hook.

Usage

  1. if ( !function_exists( 'gpi_register_scripts' ) ) { 
  2. require_once '/core/admin.php'; 
  3.  
  4. // The hook. 
  5. $hook = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gpi_register_scripts($hook); 
  9.  

Defined (1)

The function is defined in the following location(s).

/core/admin.php  
  1. function gpi_register_scripts($hook) { 
  2.  
  3. global $gpi_management_page; 
  4. if($hook != $gpi_management_page) return; 
  5.  
  6. wp_enqueue_script( 'gpi-status-ajax', GPI_PUBLIC_PATH . '/js/ajax.js', array( 'jquery' ));  
  7. wp_localize_script( 'gpi-status-ajax', 'GPI_Ajax', array( 
  8. 'ajaxurl' => admin_url( 'admin-ajax.php' ),  
  9. 'gpiNonce' => wp_create_nonce( 'gpiNonce' ),  
  10. 'report_page' => '?page=' . $_REQUEST['page'] . '&render=list' 
  11. ); 
  12.  
  13. $gpi_options = get_option('gpagespeedi_options'); 
  14.  
  15. if($gpi_options['scan_method'] == "ajax") { 
  16. if(!$gpi_options['first_run_complete'] && $gpi_options['google_developer_key'] != '' || isset($_POST['check_new_pages']) || isset($_POST['recheck_all_pages'])) { 
  17. if( isset( $_POST['recheck_all_pages'] ) ) { 
  18. $recheck = 'true'; 
  19. } else { 
  20. $recheck = 'false'; 
  21.  
  22. wp_enqueue_script( 'gpi-worker-ajax', GPI_PUBLIC_PATH . '/js/run_worker.js', array( 'jquery' ));  
  23. wp_localize_script( 'gpi-worker-ajax', 'GPI_WorkerAjax', array( 
  24. 'ajaxurl' => admin_url( 'admin-ajax.php' ),  
  25. 'gpiNonce' => wp_create_nonce( 'gpiNonce' ),  
  26. 'recheck' => $recheck 
  27. ); 
  28.