コード例 #1
0
 /**
  * Enqueue compiled wp scripts.
  */
 public function compile_page_scripts()
 {
     if (!beans_get_component_support('wp_scripts_compiler') || !get_option('beans_compile_all_scripts', false) || BEANS_COMPILER_DEV_MODE) {
         return;
     }
     if ($scripts = $this->compile_enqueued('script')) {
         beans_compile_js_fragments('beans', $scripts, array('in_footer' => true, 'version' => null));
     }
 }
コード例 #2
0
 /**
  * Enqueue compiled wp scripts.
  */
 public function compile_page_scripts()
 {
     if (!beans_get_component_support('wp_scripts_compiler') || !get_option('beans_compile_all_scripts', false) || _beans_is_compiler_dev_mode()) {
         return;
     }
     if ($scripts = $this->compile_enqueued('script')) {
         beans_compile_js_fragments('beans', $scripts, array('in_footer' => 'aggressive' === get_option('beans_compile_all_scripts_mode', 'aggressive') ? true : false, 'version' => null));
     }
 }
コード例 #3
0
 /**
  * Register options.
  */
 public function register()
 {
     $fields = array(array('id' => 'beans_compiler_items', 'type' => 'flush_cache', 'description' => 'Clear CSS and Javascript cached files. New cached versions will be compiled on page load.'));
     // Add styles compiler option only if supported
     if (beans_get_component_support('wp_styles_compiler')) {
         $fields = array_merge($fields, array(array('id' => 'beans_compile_all_styles', 'label' => false, 'checkbox_label' => __('Compile all WordPress styles', 'tm-beans'), 'type' => 'checkbox', 'default' => false, 'description' => 'Compile and cache all the CSS files that have been enqueued to the WordPress head.')));
     }
     // Add scripts compiler option only if supported
     if (beans_get_component_support('wp_scripts_compiler')) {
         $fields = array_merge($fields, array(array('id' => 'beans_compile_all_scripts', 'label' => false, 'checkbox_label' => __('Compile all WordPress scripts', 'tm-beans'), 'type' => 'checkbox', 'default' => false, 'description' => 'Compile and cache all the Javascript files that have been enqueued to the WordPress head.')));
     }
     beans_register_options($fields, 'beans_settings', 'compiler_options', array('title' => __('Compiler options', 'tm-beans'), 'context' => 'normal'));
 }
コード例 #4
0
ファイル: class-options.php プロジェクト: Getbeans/Beans
 /**
  * Register options.
  */
 public function register()
 {
     $fields = array(array('id' => 'beans_compiler_items', 'type' => 'flush_cache', 'description' => __('Clear CSS and Javascript cached files. New cached versions will be compiled on page load.', 'tm-beans')));
     // Add styles compiler option only if supported
     if (beans_get_component_support('wp_styles_compiler')) {
         $fields = array_merge($fields, array(array('id' => 'beans_compile_all_styles', 'label' => false, 'checkbox_label' => __('Compile all WordPress styles', 'tm-beans'), 'type' => 'checkbox', 'default' => false, 'description' => __('Compile and cache all the CSS files that have been enqueued to the WordPress head.', 'tm-beans'))));
     }
     // Add scripts compiler option only if supported
     if (beans_get_component_support('wp_scripts_compiler')) {
         $fields = array_merge($fields, array(array('id' => 'beans_compile_all_scripts_group', 'label' => __('Compile all WordPress scripts', 'tm-beans'), 'type' => 'group', 'fields' => array(array('id' => 'beans_compile_all_scripts', 'type' => 'activation', 'default' => false), array('id' => 'beans_compile_all_scripts_mode', 'type' => 'select', 'default' => 'aggressive', 'attributes' => array('style' => 'margin: -3px 0 0 -8px;'), 'options' => array('aggressive' => __('Aggressive', 'tm-beans'), 'standard' => __('Standard', 'tm-beans')))), 'description' => __('Compile and cache all the Javascript files that have been enqueued to the WordPress head.<!--more-->JavaSript is outputted in the footer if the level is set to <strong>Aggressive</strong> and might conflict with some third party plugins which are not following WordPress standards.', 'tm-beans'))));
     }
     beans_register_options($fields, 'beans_settings', 'compiler_options', array('title' => __('Compiler options', 'tm-beans'), 'context' => 'normal'));
 }