Enqueue scripts & styles

@since   0.1.0
@wp_hook action admin_enqueue_scripts
@return  void
194318
public function _enqueue_assets() {
		$icon_picker = Icon_Picker::instance();

		wp_localize_script(
			'icon-picker',
			'iconPicker',
			array(
				'types' => $icon_picker->registry->get_types_for_js(),
			)
		);

		// Some pages don't call this by default, so let's make sure.
		wp_enqueue_media();

		foreach ( $this->script_ids as $script_id ) {
			wp_enqueue_script( $script_id );
		}

		foreach ( $this->style_ids as $style_id ) {
			wp_enqueue_style( $style_id );
		}

		/**
		 * Fires when admin functionality is loaded
		 *
		 * @since 0.1.0
		 * @param Icon_Picker $icon_picker Icon_Picker instance.
		 */
		do_action( 'icon_picker_admin_loaded', $icon_picker );
	}
755043
public function enqueue_styles() {

		$args = [
			'action' => apply_filters( 'kirki_styles_action_handle', 'kirki-styles' ),
		];
		if ( is_admin() && ! is_customize_preview() ) {
			$args['editor'] = '1';
		}

		// Enqueue the dynamic stylesheet.
		wp_enqueue_style(
			'kirki-styles',
			add_query_arg( $args, site_url() ),
			[],
			KIRKI_VERSION
		);

		// Enqueue FA if needed (I hope not, this FA version is pretty old, only kept here for backwards-compatibility purposes).
		if ( self::$enqueue_fa && apply_filters( 'kirki_load_fontawesome', true ) ) {
			wp_enqueue_script( 'kirki-fontawesome-font', 'https://use.fontawesome.com/30858dc40a.js', [], '4.0.7', true );
		}
	}
963772
public function enqueue()
    {
        // Script
        wp_register_script('modularity-thickbox', MODULARITY_URL . '/dist/js/modularity-editor-modal.' . \Modularity\App::$assetSuffix . '.js', false, '1.0.0', true);
        wp_enqueue_script('modularity-thickbox');

        // Style
        wp_register_style(
            'modularity-thickbox',
            MODULARITY_URL . '/dist/css/modularity-thickbox-edit.' . \Modularity\App::$assetSuffix . '.css',
            false,
            '1.0.0'
        );

        wp_enqueue_style('modularity-thickbox');
    }
1209890
public static function enqueue() {
		wp_enqueue_style(
			'bglib-api-notice-css',
			Library\Configs::get( 'libraryUrl' ) .  'src/assets/css/api-notice.css'
		);

		$handle = 'bglib-api-notice-js';
		wp_register_script(
			$handle,
			Library\Configs::get( 'libraryUrl' ) .  'src/assets/js/api-notice.js'
		);
		wp_localize_script(
			$handle,
			'BoldGridLibraryApiNotice',
			array(
				'clickEnterKey'       => esc_html__( 'Click here to enter your BoldGrid Connect Key.', 'boldgrid-library' ),
				'emailRequired'       => esc_html__( 'Please enter a valid e-mail address.', 'boldgrid-library' ),
				'errorCommunicating'  => esc_html__( 'There was an error communicating with the BoldGrid Connect Key server.  Please try again.', 'boldgrid-library' ),
				'firstRequired'       => esc_html__( 'First name is required.', 'boldgrid-library' ),
				'keyRequired'         => esc_html__( 'You must enter a valid BoldGrid Connect Key.', 'boldgrid-library' ),
				'lastRequired'        => esc_html__( 'Last name is required.', 'boldgrid-library' ),
				'tosRequired'         => esc_html__( 'You must agree to the Terms of Service before continuing.', 'boldgrid-library' ),
				'unexpectedError'     => esc_html__( 'An unexpected error occured. Please try again later.', 'boldgrid-library' ),
			)
		);
		wp_enqueue_script( $handle );
	}
1224715
protected function listScripts($scripts)
    {
        if (!$scripts) {
            $this->out()->out('No custom scripts.');

            return;
        }

        $this->out()->out('<comment>Available Scripts</comment>')
            ->out('-----------------------------');

        foreach ($scripts as $name => $script) {
            $this->out(sprintf('<info>%s</info>', $name));

            foreach ($script as $cmd) {
                if (!is_array($cmd)) {
                    $cmd = ['cmd' => $cmd, 'in' => null];
                }

                $input = Arr::get($cmd, 'in');
                $cmd   = Arr::get($cmd, 'cmd');

                $this->out('    <comment>$</comment> ' . $cmd, false);

                if ($input !== null) {
                    $this->out(sprintf('  <option>(Input: %s)</option>', preg_replace('/\s+/', ' ', $input)), false);
                }

                $this->out();
            }

            $this->out();
        }
    }
533743
public function adminStyle()
    {
        wp_register_style('helsingborg-se-admin', get_template_directory_uri(). '/assets/dist/' . \Municipio\Helper\CacheBust::name('css/admin.min.css'));
        wp_enqueue_style('helsingborg-se-admin');

        wp_register_script('helsingborg-se-admin', get_template_directory_uri() . '/assets/dist/' . \Municipio\Helper\CacheBust::name('js/admin.js'));
        wp_enqueue_script('helsingborg-se-admin');
    }
685293
protected function enqueue_style( $style, $hook = null ) {
		if ( $style['condition']( $hook ) ) {
			wp_enqueue_style(
				$style['handle'],
				$this->url . $style['src'] . $this->min . '.css',
				isset( $style['deps'] ) ? $style['deps'] : array(),
				$this->version,
				isset( $style['media'] ) ? $style['media'] : 'all'
			);
		}
	}
1187438
public function init()
    {
        add_action('admin_head', array($this, 'addJsVariables'));
        add_action('admin_enqueue_scripts', array($this, 'enqueue'));
        add_action('current_screen', function ($current_screen) {
            add_action('views_edit-' . $current_screen->post_type, array($this, 'addFilterUrlParams'));
        });
    }
470879
public function init()
    {
        // Works only on frontend site
        if (OL_ZEUS_ISADMIN) {
            return;
        }

        // Check filepath
        if (empty($this->filepath)) {
            return;
        }

        // Get configurations
        $configs = include $this->filepath;

        // Check
        if (empty($configs) || in_array($GLOBALS['pagenow'], ['wp-login.php'])) {
            return;
        }

        // Enqueue scripts and styles
        add_action('wp_enqueue_scripts', function () use ($configs) {
            // Iterate on configs
            foreach ($configs as $key => $props) {
                $props = !is_array($props) && !is_bool($props) ? [$props] : $props;

                if ('scripts' === $key) {
                    // Enqueue scripts
                    $this->enqueueScripts($props);
                } else if ('styles' === $key) {
                    // Enqueue styles
                    $this->enqueueStyles($props);
                }
            }
        });
    }
426446
public function hook()
    {
        wp_enqueue_script('jquery');

        add_action('wp_head', array($this, 'printToken'));
        add_action('admin_head', array($this, 'printToken'));

        add_action('wp_footer', array($this, 'printAjaxHeader'));
        add_action('admin_footer', array($this, 'printAjaxHeader'));
    }
897109
private function enqueue_actions() {
		/**
		 * Do object initilisation.
		 *
		 * @param object current uix instance
		 */
		do_action( 'uix_admin_enqueue_scripts_' . $this->type, $this );

		/**
		 * Do object initilisation for specific slug.
		 *
		 * @param object current uix instance
		 */
		do_action( 'uix_admin_enqueue_scripts_' . $this->type . '_' . $this->slug, $this );
	}
61386
public function _wp_enqueue_scripts() {
		if ( ! $this->_is_async_attachment_images() && ! $this->_is_async_content_images() ) {
			return;
		}

		$relative_path = '/vendor/inc2734/wp-page-speed-optimization/src/assets/js/app.min.js';
		wp_enqueue_script(
			'wp-page-speed-optimization',
			get_template_directory_uri() . $relative_path,
			[],
			filemtime( get_template_directory() . $relative_path ),
			true
		);
	}
676687
public function enqueue_scripts( $page = '' ) {

		// Bail if not a network page.
		if ( ! in_array( $page, array( 'toplevel_page_networks', 'networks_page_add-new-network' ), true ) ) {
			return;
		}

		wp_register_style( 'wp-multi-network', wpmn()->plugin_url . 'assets/css/wp-multi-network.css', array(), wpmn()->asset_version, false );
		wp_register_script( 'wp-multi-network', wpmn()->plugin_url . 'assets/js/wp-multi-network.js', array( 'jquery', 'post' ), wpmn()->asset_version, true );

		wp_enqueue_style( 'wp-multi-network' );
		wp_enqueue_script( 'wp-multi-network' );
	}
1283219
public function init()
    {
        // Requires WordPress 4.1
        if (version_compare($GLOBALS['wp_version'], self::MIN_WP_VER, '<')) {
            Compat::loadNotices();
        }

        // core actions
        add_action('after_setup_theme', [$this->theme, 'addThemeSupports']);
        add_action('widgets_init', [$this->theme, 'registerWidgets']);
        add_action('wp_enqueue_scripts', [$this->assets, 'loadSiteScripts']);
        add_action('wp_enqueue_scripts', [$this->assets, 'loadSiteStyles']);
        add_action('admin_enqueue_scripts', [$this->assets, 'loadAdminScripts']);
        add_action('admin_enqueue_scripts', [$this->assets, 'loadAdminStyles']);
        add_action('login_enqueue_scripts', [$this->assets, 'loadLoginScripts']);
        add_action('login_enqueue_scripts', [$this->assets, 'loadLoginStyles']);

        // meta elements
        add_action('wp_head', [$this->viewMeta, 'render'], 1);

        // theme customizations
        add_action('customize_register', [$this->customizer, 'register']);
        add_action('customize_preview_init', [$this->assets, 'loadCustomizeScript']);
    }
359984
public function enqueue_current_post_modules_assets() {

		global $more, $post;

		if ( $this->is_current_post_flexible( $post, $more ) ) {
			$layouts = $this->get_current_post_layouts( $post );

			foreach ( $layouts as $layout ) {

				if ( ! isset( $layout['acf_fc_layout'] ) || empty( $layout['acf_fc_layout'] ) ) {
					continue;
				}

				// Enqueue assets.
				$this->enqueue_module_assets( $layout['acf_fc_layout'] );
			}
		}
	}
817363
public function enqueue_admin_stylescripts() {

		$screen = get_current_screen();

		if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
			return;
		}

		if ( in_array( $screen->id, $this->plugin_screen_hook_suffix, true ) ) {
			$slug = array_search( $screen->id, $this->plugin_screen_hook_suffix );
			// $configfiles = glob( $this->get_path( __FILE__ ) .'configs/'.$slug.'-*.php' );
			if ( file_exists( $this->get_path( __FILE__ ) . 'configs/fieldgroups-' . $slug . '.php' ) ) {
				include $this->get_path( __FILE__ ) . 'configs/fieldgroups-' . $slug . '.php';
			}

			if ( ! empty( $configfiles ) ) {

				foreach ( $configfiles as $key => $fieldfile ) {
					include $fieldfile;
					if ( ! empty( $group['scripts'] ) ) {
						foreach ( $group['scripts'] as $script ) {
							wp_enqueue_script( $this->plugin_slug . '-' . strtok( $script, '.' ), $this->get_url( 'assets/js/' . $script, __FILE__ ), array( 'jquery' ) );
						}
					}
					if ( ! empty( $group['styles'] ) ) {
						foreach ( $group['styles'] as $style ) {
							wp_enqueue_style( $this->plugin_slug . '-' . strtok( $style, '.' ), $this->get_url( 'assets/css/' . $style, __FILE__ ) );
						}
					}
				}
			}
			wp_enqueue_style( $this->plugin_slug . '-admin-styles', $this->get_url( 'assets/css/panel.css', __FILE__ ), array(), self::VERSION );
			wp_enqueue_style( 'pods-codemirror' );
			wp_enqueue_script( $this->plugin_slug . '-admin-scripts', $this->get_url( 'assets/js/panel.js', __FILE__ ), array(), self::VERSION );
			wp_enqueue_script( 'pods_codemirror' );
			wp_enqueue_script( 'pods-codemirror-overlay' );
			wp_enqueue_script( 'pods-codemirror-hints' );
			wp_enqueue_script( $this->plugin_slug . '-cm-editor', $this->get_url( 'assets/js/editor1.js', __FILE__ ), array( 'jquery' ), self::VERSION, true );
			wp_enqueue_script( 'pods-codemirror-mode-xml' );
			wp_enqueue_script( 'pods-codemirror-mode-html' );
			wp_enqueue_script( 'pods-codemirror-mode-css' );
		}//end if

	}
1234262
public function enqueue_admin_scripts( $hook ) {
		foreach ( $this->scripts as $script ) {
			if ( in_array( $script['type'], array( 'admin', 'shared' ) ) ) {
				$this->enqueue_script( $script, $hook );
			}
		}
	}