gpi_register_scripts
The WordPress Core gpi register scripts function.
Description
gpi_register_scripts( $hook );
Parameters (1)
- 0. $hook
- The hook.
Usage
if ( !function_exists( 'gpi_register_scripts' ) ) { require_once '/core/admin.php'; } // The hook. $hook = null; // NOTICE! Understand what this does before running. $result = gpi_register_scripts($hook);
Defined (1)
The function is defined in the following location(s).
- /core/admin.php
- function gpi_register_scripts($hook) {
- global $gpi_management_page;
- if($hook != $gpi_management_page) return;
- wp_enqueue_script( 'gpi-status-ajax', GPI_PUBLIC_PATH . '/js/ajax.js', array( 'jquery' ));
- wp_localize_script( 'gpi-status-ajax', 'GPI_Ajax', array(
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
- 'gpiNonce' => wp_create_nonce( 'gpiNonce' ),
- 'report_page' => '?page=' . $_REQUEST['page'] . '&render=list'
- )
- );
- $gpi_options = get_option('gpagespeedi_options');
- if($gpi_options['scan_method'] == "ajax") {
- if(!$gpi_options['first_run_complete'] && $gpi_options['google_developer_key'] != '' || isset($_POST['check_new_pages']) || isset($_POST['recheck_all_pages'])) {
- if( isset( $_POST['recheck_all_pages'] ) ) {
- $recheck = 'true';
- } else {
- $recheck = 'false';
- }
- wp_enqueue_script( 'gpi-worker-ajax', GPI_PUBLIC_PATH . '/js/run_worker.js', array( 'jquery' ));
- wp_localize_script( 'gpi-worker-ajax', 'GPI_WorkerAjax', array(
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
- 'gpiNonce' => wp_create_nonce( 'gpiNonce' ),
- 'recheck' => $recheck
- )
- );
- }
- }
- }