'beans_compiler_items', 'type' => 'flush_cache', 'description' => __( 'Clear CSS and Javascript cached files. New cached versions will be compiled on page load.', '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', 'beans' ), 'type' => 'checkbox', 'default' => false, 'description' => __( 'Compile and cache all the CSS files that have been enqueued to the WordPress head.', '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', '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' => array( '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.JavaSript is outputted in the footer if the level is set to Aggressive and might conflict with some third party plugins which are not following WordPress standards.', 'beans' ) ) ) ); beans_register_options( $fields, 'beans_settings', 'compiler_options', array( 'title' => __( 'Compiler options', 'beans' ), 'context' => 'normal' ) ); } /** * Flush images for all folders set. */ public function flush() { if ( !beans_post( 'beans_flush_compiler_cache' ) ) return; beans_remove_dir( beans_get_compiler_dir() ); } /** * Cache cleaner notice. */ public function admin_notice() { if ( !beans_post( 'beans_flush_compiler_cache' ) ) return; echo '

' . __( 'Cache flushed successfully!', 'beans' ) . '

' . "\n"; } /** * Add button used to flush cache. */ public function option( $field ) { if ( $field['id'] !== 'beans_compiler_items' ) return; echo ''; } /** * Maybe show disabled notice. */ public function maybe_disable_style_notice() { if ( get_option( 'beans_compile_all_styles' ) && _beans_is_compiler_dev_mode() ) echo '
' . __( 'Styles are not compiled in development mode.', 'beans' ) . ''; } /** * Maybe show disabled notice. */ public function maybe_disable_scripts_notice() { if ( get_option( 'beans_compile_all_scripts' ) && _beans_is_compiler_dev_mode() ) echo '
' . __( 'Scripts are not compiled in development mode.', 'beans' ) . ''; } } new _Beans_Compiler_Options();