Skip to content

Commit

Permalink
Improved API array indentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThierryA committed Jul 28, 2016
1 parent ac151f9 commit fe6bce3
Show file tree
Hide file tree
Showing 20 changed files with 137 additions and 135 deletions.
16 changes: 8 additions & 8 deletions lib/api/actions/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
function beans_add_action( $id, $hook, $callback, $priority = 10, $args = 1 ) {

$action = array(
'hook' => $hook,
'hook' => $hook,
'callback' => $callback,
'priority' => $priority,
'args' => $args
'args' => $args
);

// Replace original if set.
Expand Down Expand Up @@ -120,10 +120,10 @@ function beans_modify_action( $id, $hook = null, $callback = null, $priority = n
}

$action = array_filter( array(
'hook' => $hook,
'hook' => $hook,
'callback' => $callback,
'priority' => $priority,
'args' => $args
'args' => $args
) );

// Merge modified.
Expand Down Expand Up @@ -250,10 +250,10 @@ function beans_modify_action_arguments( $id, $args ) {
function beans_replace_action( $id, $hook = null, $callback = null, $priority = null, $args = null ) {

$action = array(
'hook' => $hook,
'hook' => $hook,
'callback' => $callback,
'priority' => $priority,
'args' => $args
'args' => $args
);

// Set and get the latest replaced.
Expand Down Expand Up @@ -414,9 +414,9 @@ function beans_reset_action( $id ) {

if ( ! isset( $_beans_registered_actions ) ) {
$_beans_registered_actions = array(
'added' => array(),
'added' => array(),
'modified' => array(),
'removed' => array(),
'removed' => array(),
'replaced' => array()
);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/api/admin-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public function register() {

$fields = array(
array(
'id' => 'beans_dev_mode',
'id' => 'beans_dev_mode',
'checkbox_label' => __( 'Enable development mode', 'tm-beans' ),
'type' => 'checkbox',
'description' => __( 'This option should be enabled while your website is in development.', 'tm-beans' )
'type' => 'checkbox',
'description' => __( 'This option should be enabled while your website is in development.', 'tm-beans' )
)
);

beans_register_options( $fields, 'beans_settings', 'mode_options', array(
'title' => __( 'Mode options', 'tm-beans' ),
'title' => __( 'Mode options', 'tm-beans' ),
'context' => beans_get( 'beans_settings', $wp_meta_boxes ) ? 'column' : 'normal' // Check for other beans boxes.
) );

Expand Down
16 changes: 8 additions & 8 deletions lib/api/compiler/class-compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public function __construct( $args ) {
add_filter( 'filesystem_method', array( $this, 'filesystem_method' ) );

$defaults = array(
'id' => false,
'type' => false,
'format' => false,
'fragments' => array(),
'id' => false,
'type' => false,
'format' => false,
'fragments' => array(),
'depedencies' => false,
'in_footer' => false,
'minify_js' => false,
'version' => false
'in_footer' => false,
'minify_js' => false,
'version' => false
);

$this->compiler = array_merge( $defaults, $args );
Expand Down Expand Up @@ -563,7 +563,7 @@ public function strip_whitespace( $content ) {
",\n" => ",", // Don't wrap multiple selectors.
"\n}" => "}", // Don't wrap closing braces.
"} " => "}\n", // Put each rule on it's own line.
"\n" => "" // Take out all line breaks
"\n" => "" // Take out all line breaks
);

$search = array_keys( $replace );
Expand Down
36 changes: 18 additions & 18 deletions lib/api/compiler/class-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function register() {

$fields = array(
array(
'id' => 'beans_compiler_items',
'type' => 'flush_cache',
'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' )
)
);
Expand All @@ -40,12 +40,12 @@ public function register() {
if ( beans_get_component_support( 'wp_styles_compiler' ) ) {
$fields = array_merge( $fields, array(
array(
'id' => 'beans_compile_all_styles',
'label' => false,
'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' )
'type' => 'checkbox',
'default' => false,
'description' => __( 'Compile and cache all the CSS files that have been enqueued to the WordPress head.', 'tm-beans' )
)
) );
}
Expand All @@ -54,23 +54,23 @@ public function register() {
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',
'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',
'id' => 'beans_compile_all_scripts',
'type' => 'activation',
'default' => false
),
array(
'id' => 'beans_compile_all_scripts_mode',
'type' => 'select',
'default' => 'aggressive',
'id' => 'beans_compile_all_scripts_mode',
'type' => 'select',
'default' => 'aggressive',
'attributes' => array( 'style' => 'margin: -3px 0 0 -8px;' ),
'options' => array(
'options' => array(
'aggressive' => __( 'Aggressive', 'tm-beans' ),
'standard' => __( 'Standard', 'tm-beans' )
'standard' => __( 'Standard', 'tm-beans' )
)
),
),
Expand All @@ -80,7 +80,7 @@ public function register() {
}

beans_register_options( $fields, 'beans_settings', 'compiler_options', array(
'title' => __( 'Compiler options', 'tm-beans' ),
'title' => __( 'Compiler options', 'tm-beans' ),
'context' => 'normal'
) );

Expand Down
2 changes: 1 addition & 1 deletion lib/api/compiler/class-page-compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function compile_page_scripts() {
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
'version' => null
) );
}

Expand Down
22 changes: 11 additions & 11 deletions lib/api/compiler/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ function beans_compile_css_fragments( $id, $fragments, $args = array() ) {
}

$params = array(
'id' => $id,
'type' => 'style',
'format' => 'css',
'id' => $id,
'type' => 'style',
'format' => 'css',
'fragments' => (array) $fragments
);

Expand Down Expand Up @@ -73,9 +73,9 @@ function beans_compile_less_fragments( $id, $fragments, $args = array() ) {
}

$params = array(
'id' => $id,
'type' => 'style',
'format' => 'less',
'id' => $id,
'type' => 'style',
'format' => 'less',
'fragments' => (array) $fragments
);

Expand Down Expand Up @@ -113,9 +113,9 @@ function beans_compile_js_fragments( $id, $fragments, $args = array() ) {
}

$params = array(
'id' => $id,
'type' => 'script',
'format' => 'js',
'id' => $id,
'type' => 'script',
'format' => 'js',
'fragments' => (array) $fragments
);

Expand Down Expand Up @@ -312,8 +312,8 @@ function _beans_is_compiler_dev_mode() {

if ( ! isset( $_beans_compiler_added_fragments ) ) {
$_beans_compiler_added_fragments = array(
'css' => array(),
'css' => array(),
'less' => array(),
'js' => array()
'js' => array()
);
}
54 changes: 27 additions & 27 deletions lib/api/components.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,39 @@ function beans_load_api_components( $components ) {
$root = BEANS_API_PATH;

$common = array(
'html' => array(
'html' => array(
$root . 'html/functions.php',
$root . 'html/class.php'
),
'actions' => $root . 'actions/functions.php',
'filters' => $root . 'filters/functions.php',
'actions' => $root . 'actions/functions.php',
'filters' => $root . 'filters/functions.php',
'wp-customize' => $root . 'wp-customize/functions.php',
'post-meta' => $root . 'post-meta/functions.php',
'term-meta' => $root . 'term-meta/functions.php',
'fields' => $root . 'fields/functions.php',
'image' => $root . 'image/functions.php',
'compiler' => array(
'post-meta' => $root . 'post-meta/functions.php',
'term-meta' => $root . 'term-meta/functions.php',
'fields' => $root . 'fields/functions.php',
'image' => $root . 'image/functions.php',
'compiler' => array(
$root . 'compiler/functions.php',
$root . 'compiler/class-compiler.php',
$root . 'compiler/class-page-compiler.php'
),
'uikit' => array(
'uikit' => array(
$root . 'uikit/functions.php',
$root . 'uikit/class.php',
),
'layout' => $root . 'layout/functions.php',
'template' => $root . 'template/functions.php',
'widget' => $root . 'widget/functions.php'
'layout' => $root . 'layout/functions.php',
'template' => $root . 'template/functions.php',
'widget' => $root . 'widget/functions.php'
);

// Only load admin fragments if is_admin() is true.
if ( is_admin() ) {
$admin = array(
'options' => $root . 'options/functions.php',
'post-meta' => $root . 'post-meta/functions-admin.php',
'term-meta' => $root . 'term-meta/functions-admin.php',
'compiler' => $root . 'compiler/class-options.php',
'image' => $root . 'image/class-options.php',
'options' => $root . 'options/functions.php',
'post-meta' => $root . 'post-meta/functions-admin.php',
'term-meta' => $root . 'term-meta/functions-admin.php',
'compiler' => $root . 'compiler/class-options.php',
'image' => $root . 'image/class-options.php',
'_admin_menu' => $root . 'admin-menu.php'// Internal use.
);
} else {
Expand All @@ -69,23 +69,23 @@ function beans_load_api_components( $components ) {

// Set dependencies.
$dependencies = array(
'html' => array(
'html' => array(
'_admin_menu',
'filters'
),
'fields' => array(
'fields' => array(
'actions',
'html'
),
'options' => 'fields',
'post-meta' => 'fields',
'term-meta' => 'fields',
'options' => 'fields',
'post-meta' => 'fields',
'term-meta' => 'fields',
'wp-customize' => 'fields',
'layout' => 'fields',
'image' => '_admin_menu',
'compiler' => '_admin_menu',
'uikit' => 'compiler',
'_admin_menu' => 'options'
'layout' => 'fields',
'image' => '_admin_menu',
'compiler' => '_admin_menu',
'uikit' => 'compiler',
'_admin_menu' => 'options'
);

foreach ( (array) $components as $component ) {
Expand Down
16 changes: 8 additions & 8 deletions lib/api/fields/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ final class _Beans_Fields {
* @type array
*/
private static $registered = array(
'option' => array(),
'post_meta' => array(),
'term_meta' => array(),
'option' => array(),
'post_meta' => array(),
'term_meta' => array(),
'wp_customize' => array(),
);

Expand Down Expand Up @@ -107,12 +107,12 @@ private function standardize_field( $field ) {

// Set defaults.
$defaults = array(
'label' => false,
'label' => false,
'description' => false,
'default' => false,
'context' => $this->context,
'attributes' => array(),
'db_group' => false
'default' => false,
'context' => $this->context,
'attributes' => array(),
'db_group' => false
);

$field = array_merge( $defaults, $field );
Expand Down
4 changes: 2 additions & 2 deletions lib/api/fields/types/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ function beans_field_image( $field ) {

$attributes = array_merge( array(
'class' => 'image-id',
'type' => 'hidden',
'name' => $multiple ? $field['name'] . '[]' : $field['name'], // Return single value if not multiple.
'type' => 'hidden',
'name' => $multiple ? $field['name'] . '[]' : $field['name'], // Return single value if not multiple.
'value' => $id
), $field['attributes'] );

Expand Down
6 changes: 3 additions & 3 deletions lib/api/fields/types/slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ function beans_field_slider_assets() {
function beans_field_slider( $field ) {

$defaults = array(
'min' => 0,
'max' => 100,
'min' => 0,
'max' => 100,
'interval' => 1,
'unit' => null,
'unit' => null,
);

$field = array_merge( $defaults, $field );
Expand Down
Loading

0 comments on commit fe6bce3

Please sign in to comment.