@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * @var array |
| 12 | 12 | */ |
| 13 | - public $columns = []; |
|
| 13 | + public $columns = [ ]; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * @var array |
| 17 | 17 | */ |
| 18 | - public $types = []; |
|
| 18 | + public $types = [ ]; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var Application |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | public function initColumns() |
| 29 | 29 | { |
| 30 | 30 | foreach( $this->types as $type => $args ) { |
| 31 | - add_action( "manage_{$type}_posts_custom_column", [$this, 'printColumnValue'], 10, 2 ); |
|
| 31 | + add_action( "manage_{$type}_posts_custom_column", [ $this, 'printColumnValue' ], 10, 2 ); |
|
| 32 | 32 | add_filter( "manage_{$type}_posts_columns", function( $columns ) use( $args ) { |
| 33 | - return count( $args['columns'] ) > 1 |
|
| 34 | - ? $args['columns'] |
|
| 33 | + return count( $args[ 'columns' ] ) > 1 |
|
| 34 | + ? $args[ 'columns' ] |
|
| 35 | 35 | : $columns; |
| 36 | 36 | }); |
| 37 | 37 | } |
@@ -58,10 +58,10 @@ discard block |
||
| 58 | 58 | protected function getColumnImage( $postId ) |
| 59 | 59 | { |
| 60 | 60 | if( has_post_thumbnail( $postId ) ) { |
| 61 | - list( $src, $width, $height ) = wp_get_attachment_image_src( get_post_thumbnail_id( $postId ), [96, 48] ); |
|
| 61 | + list( $src, $width, $height ) = wp_get_attachment_image_src( get_post_thumbnail_id( $postId ), [ 96, 48 ] ); |
|
| 62 | 62 | $image = sprintf( '<img src="%s" alt="%s" width="%s" height="%s">', |
| 63 | - esc_url( set_url_scheme( $src )), |
|
| 64 | - esc_attr( get_the_title( $postId )), |
|
| 63 | + esc_url( set_url_scheme( $src ) ), |
|
| 64 | + esc_attr( get_the_title( $postId ) ), |
|
| 65 | 65 | $width, |
| 66 | 66 | $height |
| 67 | 67 | ); |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | protected function getColumnMedia() |
| 78 | 78 | { |
| 79 | 79 | return count( PostMeta::get( 'media', [ |
| 80 | - 'fallback' => [], |
|
| 80 | + 'fallback' => [ ], |
|
| 81 | 81 | 'single' => false, |
| 82 | - ])); |
|
| 82 | + ] ) ); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | protected function normalizeColumns( array $columns ) |
| 98 | 98 | { |
| 99 | 99 | $columns = array_flip( $columns ); |
| 100 | - $columns = array_merge( $columns, array_intersect_key( $this->columns, $columns )); |
|
| 101 | - return ['cb' => '<input type="checkbox">'] + $columns; |
|
| 100 | + $columns = array_merge( $columns, array_intersect_key( $this->columns, $columns ) ); |
|
| 101 | + return [ 'cb' => '<input type="checkbox">' ] + $columns; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $comments = sprintf( |
| 110 | 110 | '<span class="vers comment-grey-bubble" title="%1$s"><span class="screen-reader-text">%1$s</span></span>', |
| 111 | - $this->app->config['columns']['comments'] |
|
| 111 | + $this->app->config[ 'columns' ][ 'comments' ] |
|
| 112 | 112 | ); |
| 113 | - $columns = wp_parse_args( $this->app->config['columns'], [ |
|
| 113 | + $columns = wp_parse_args( $this->app->config[ 'columns' ], [ |
|
| 114 | 114 | 'comments' => $comments, |
| 115 | - ]); |
|
| 115 | + ] ); |
|
| 116 | 116 | $this->columns = apply_filters( 'pollux/post_type/columns', $columns ); |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public static function conditions() |
| 23 | 23 | { |
| 24 | - return apply_filters( 'pollux/conditions', static::$conditions, strtolower(( new Helper )->getClassname( static::class ))); |
|
| 24 | + return apply_filters( 'pollux/conditions', static::$conditions, strtolower( ( new Helper )->getClassname( static::class ) ) ); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -45,18 +45,18 @@ discard block |
||
| 45 | 45 | protected function normalizeCondition( $conditions ) |
| 46 | 46 | { |
| 47 | 47 | $conditions = ( new Helper )->toArray( $conditions ); |
| 48 | - if( count( array_filter( array_keys( $conditions ), 'is_string' )) == 0 ) { |
|
| 48 | + if( count( array_filter( array_keys( $conditions ), 'is_string' ) ) == 0 ) { |
|
| 49 | 49 | foreach( $conditions as $key ) { |
| 50 | - $conditions[str_replace( '!', '', $key )] = substr( $key, 0, 1 ) == '!' ? 0 : 1; |
|
| 50 | + $conditions[ str_replace( '!', '', $key ) ] = substr( $key, 0, 1 ) == '!' ? 0 : 1; |
|
| 51 | 51 | } |
| 52 | 52 | $conditions = array_filter( $conditions, function( $key ) { |
| 53 | 53 | return !is_numeric( $key ); |
| 54 | 54 | }, ARRAY_FILTER_USE_KEY ); |
| 55 | 55 | } |
| 56 | - $hook = sprintf( 'pollux/%s/conditions', strtolower(( new Helper )->getClassname( $this ))); |
|
| 56 | + $hook = sprintf( 'pollux/%s/conditions', strtolower( ( new Helper )->getClassname( $this ) ) ); |
|
| 57 | 57 | return array_intersect_key( |
| 58 | 58 | $conditions, |
| 59 | - array_flip( apply_filters( $hook, static::conditions() )) |
|
| 59 | + array_flip( apply_filters( $hook, static::conditions() ) ) |
|
| 60 | 60 | ); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function validateIsFrontPage( $value ) |
| 104 | 104 | { |
| 105 | - return $value == ( $this->getPostId() == get_option( 'page_on_front' )); |
|
| 105 | + return $value == ( $this->getPostId() == get_option( 'page_on_front' ) ); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | protected function validateIsHome( $value ) |
| 113 | 113 | { |
| 114 | - return $value == ( $this->getPostId() == get_option( 'page_for_posts' )); |
|
| 114 | + return $value == ( $this->getPostId() == get_option( 'page_for_posts' ) ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | protected function validateIsPageTemplate( $value ) |
| 122 | 122 | { |
| 123 | - return basename( get_page_template_slug( $this->getPostId() )) == $value; |
|
| 123 | + return basename( get_page_template_slug( $this->getPostId() ) ) == $value; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | public function __construct() |
| 32 | 32 | { |
| 33 | - $this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' ); |
|
| 34 | - $this->gatekeeper = new GateKeeper( plugin_basename( $this->file )); |
|
| 33 | + $this->file = realpath( dirname( dirname( __FILE__ ) ) . '/pollux.php' ); |
|
| 34 | + $this->gatekeeper = new GateKeeper( plugin_basename( $this->file ) ); |
|
| 35 | 35 | |
| 36 | 36 | $data = get_file_data( $this->file, array( |
| 37 | 37 | 'id' => 'Text Domain', |
@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $controller = $this->make( 'Controller' ); |
| 56 | 56 | |
| 57 | - add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' )); |
|
| 58 | - add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' )); |
|
| 59 | - add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' )); |
|
| 60 | - add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' )); |
|
| 57 | + add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) ); |
|
| 58 | + add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) ); |
|
| 59 | + add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) ); |
|
| 60 | + add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) ); |
|
| 61 | 61 | |
| 62 | 62 | // Disallow indexing of the site on non-production environments |
| 63 | 63 | if( !$this->environment( 'production' ) && !is_admin() ) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | public function environment( $checkFor = '' ) |
| 73 | 73 | { |
| 74 | 74 | $environment = defined( 'WP_ENV' ) ? WP_ENV : 'production'; |
| 75 | - if( !empty( $checkFor )) { |
|
| 75 | + if( !empty( $checkFor ) ) { |
|
| 76 | 76 | return $environment == $checkFor; |
| 77 | 77 | } |
| 78 | 78 | return $environment; |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function onActivation() |
| 85 | 85 | { |
| 86 | - if( !get_option( Settings::id() )) { |
|
| 87 | - update_option( Settings::id(), [] ); |
|
| 86 | + if( !get_option( Settings::id() ) ) { |
|
| 87 | + update_option( Settings::id(), [ ] ); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | public function url( $path = '' ) |
| 112 | 112 | { |
| 113 | - return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' )); |
|
| 113 | + return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' ) ); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | Facade::clearResolvedInstances(); |
| 122 | 122 | Facade::setFacadeApplication( $this ); |
| 123 | - $this->config = ( new Config( $this ))->get(); |
|
| 123 | + $this->config = ( new Config( $this ) )->get(); |
|
| 124 | 124 | $this->registerAliases(); |
| 125 | 125 | $classNames = array( |
| 126 | 126 | 'MetaBox\MetaBox', |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | CONST ID = 'archives'; |
| 16 | 16 | |
| 17 | - public $hooks = []; |
|
| 17 | + public $hooks = [ ]; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * {@inheritdoc} |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | parent::init(); |
| 25 | 25 | |
| 26 | - add_action( 'pollux/archives/init', [$this, 'registerFeaturedImageMetaBox'] ); |
|
| 27 | - add_action( 'pollux/archives/editor', [$this, 'renderEditor'], 10, 2 ); |
|
| 28 | - add_filter( 'pollux/archives/metabox/submit', [$this, 'filterSubmitMetaBox'] ); |
|
| 26 | + add_action( 'pollux/archives/init', [ $this, 'registerFeaturedImageMetaBox' ] ); |
|
| 27 | + add_action( 'pollux/archives/editor', [ $this, 'renderEditor' ], 10, 2 ); |
|
| 28 | + add_filter( 'pollux/archives/metabox/submit', [ $this, 'filterSubmitMetaBox' ] ); |
|
| 29 | 29 | add_filter( 'pollux/archives/show/instructions', '__return_true' ); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | public function addPage() |
| 37 | 37 | { |
| 38 | 38 | foreach( $this->getPostTypesWithArchive() as $type => $page ) { |
| 39 | - $labels = get_post_type_labels( get_post_type_object( $type )); |
|
| 40 | - $this->hooks[$type] = call_user_func_array( 'add_submenu_page', $this->filter( 'page', [ |
|
| 39 | + $labels = get_post_type_labels( get_post_type_object( $type ) ); |
|
| 40 | + $this->hooks[ $type ] = call_user_func_array( 'add_submenu_page', $this->filter( 'page', [ |
|
| 41 | 41 | $page, |
| 42 | 42 | sprintf( _x( '%s Archive', 'post archive', 'pollux' ), $labels->singular_name ), |
| 43 | 43 | __( 'Archive', 'pollux' ), |
| 44 | 44 | 'edit_theme_options', |
| 45 | 45 | sprintf( '%s_archive', $type ), |
| 46 | - [$this, 'renderPage'], |
|
| 47 | - ])); |
|
| 46 | + [ $this, 'renderPage' ], |
|
| 47 | + ] ) ); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | public function filterBeforeInstructions() |
| 56 | 56 | { |
| 57 | 57 | return sprintf( '<pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
| 58 | - array_reduce( ['title', 'content', 'featured'], function( $instructions, $id ) { |
|
| 59 | - return $instructions . $this->filterInstruction( null, ['slug' => $id], ['slug' => $this->getPostType()] ) . PHP_EOL; |
|
| 58 | + array_reduce( [ 'title', 'content', 'featured' ], function( $instructions, $id ) { |
|
| 59 | + return $instructions . $this->filterInstruction( null, [ 'slug' => $id ], [ 'slug' => $this->getPostType() ] ) . PHP_EOL; |
|
| 60 | 60 | }) |
| 61 | 61 | ); |
| 62 | 62 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function filterInstruction( $instruction, array $field, array $metabox ) |
| 70 | 70 | { |
| 71 | - return sprintf( "ArchiveMeta::%s('%s');", $metabox['slug'], $field['slug'] ); |
|
| 71 | + return sprintf( "ArchiveMeta::%s('%s');", $metabox[ 'slug' ], $field[ 'slug' ] ); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function filterSubmitMetaBox( array $args ) |
| 79 | 79 | { |
| 80 | - $args[1] = __( 'Save Archive', 'pollux' ); |
|
| 80 | + $args[ 1 ] = __( 'Save Archive', 'pollux' ); |
|
| 81 | 81 | return $args; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | public function register() |
| 89 | 89 | { |
| 90 | 90 | $screenId = ( new Helper )->getCurrentScreen()->id; |
| 91 | - if( in_array( $screenId, $this->hooks )) { |
|
| 91 | + if( in_array( $screenId, $this->hooks ) ) { |
|
| 92 | 92 | $this->hook = $screenId; |
| 93 | 93 | } |
| 94 | 94 | parent::register(); |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function registerFeaturedImageMetaBox() |
| 102 | 102 | { |
| 103 | - if( !current_user_can( 'upload_files' ))return; |
|
| 104 | - add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [$this, 'renderFeaturedImageMetaBox'], null, 'side', 'low' ); |
|
| 103 | + if( !current_user_can( 'upload_files' ) )return; |
|
| 104 | + add_meta_box( 'postimagediv', __( 'Featured Image', 'pollux' ), [ $this, 'renderFeaturedImageMetaBox' ], null, 'side', 'low' ); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | 'resize' => false, |
| 122 | 122 | 'wp_autoresize_on' => true, |
| 123 | 123 | ], |
| 124 | - ]); |
|
| 124 | + ] ); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | public function renderFeaturedImageMetaBox() |
| 132 | 132 | { |
| 133 | 133 | $imageId = ArchiveMeta::get( 'featured', -1, $this->getPostType() ); |
| 134 | - $imageSize = isset( wp_get_additional_image_sizes()['post-thumbnail'] ) |
|
| 134 | + $imageSize = isset( wp_get_additional_image_sizes()[ 'post-thumbnail' ] ) |
|
| 135 | 135 | ? 'post-thumbnail' |
| 136 | - : [266, 266]; |
|
| 136 | + : [ 266, 266 ]; |
|
| 137 | 137 | $thumbnail = get_post( $imageId ) |
| 138 | 138 | ? wp_get_attachment_image( $imageId, $imageSize ) |
| 139 | 139 | : __( 'Set Featured Image', 'pollux' ); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | 'remove_image' => __( 'Remove featured image', 'pollux' ), |
| 147 | 147 | 'thickbox_url' => '', |
| 148 | 148 | 'thumbnail' => $thumbnail, |
| 149 | - ]); |
|
| 149 | + ] ); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | public function renderPage() |
| 157 | 157 | { |
| 158 | 158 | $type = $this->getPostType(); |
| 159 | - if( empty( $type ))return; |
|
| 160 | - $labels = get_post_type_labels( get_post_type_object( $type )); |
|
| 159 | + if( empty( $type ) )return; |
|
| 160 | + $labels = get_post_type_labels( get_post_type_object( $type ) ); |
|
| 161 | 161 | $this->render( 'archive/index', [ |
| 162 | 162 | 'columns' => get_current_screen()->get_columns(), |
| 163 | 163 | 'content' => ArchiveMeta::get( 'content', '', $type ), |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | 'id' => static::id(), |
| 166 | 166 | 'post_type' => $type, |
| 167 | 167 | 'title' => ArchiveMeta::get( 'title', '', $type ), |
| 168 | - ]); |
|
| 168 | + ] ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | protected function getDefaults() |
| 175 | 175 | { |
| 176 | - return []; |
|
| 176 | + return [ ]; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | $types = array_map( function( $value ) { |
| 196 | 196 | return sprintf( 'edit.php?post_type=%s', $value ); |
| 197 | - }, get_post_types( ['has_archive' => 1] )); |
|
| 198 | - return array_merge( $types, ['post' => 'edit.php'] ); |
|
| 197 | + }, get_post_types( [ 'has_archive' => 1 ] ) ); |
|
| 198 | + return array_merge( $types, [ 'post' => 'edit.php' ] ); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -16,19 +16,19 @@ discard block |
||
| 16 | 16 | * @param string $metaKey |
| 17 | 17 | * @return mixed |
| 18 | 18 | */ |
| 19 | - public function get( $metaKey, array $args = [] ) |
|
| 19 | + public function get( $metaKey, array $args = [ ] ) |
|
| 20 | 20 | { |
| 21 | - if( empty( $metaKey ))return; |
|
| 21 | + if( empty( $metaKey ) )return; |
|
| 22 | 22 | |
| 23 | 23 | $args = $this->normalize( $args ); |
| 24 | - $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
|
| 25 | - $metaValue = get_post_meta( $args['id'], $metaKey, $args['single'] ); |
|
| 24 | + $metaKey = $this->buildMetaKey( $metaKey, $args[ 'prefix' ] ); |
|
| 25 | + $metaValue = get_post_meta( $args[ 'id' ], $metaKey, $args[ 'single' ] ); |
|
| 26 | 26 | |
| 27 | - if( is_string( $metaValue )) { |
|
| 27 | + if( is_string( $metaValue ) ) { |
|
| 28 | 28 | $metaValue = trim( $metaValue ); |
| 29 | 29 | } |
| 30 | 30 | return empty( $metaValue ) |
| 31 | - ? $args['fallback'] |
|
| 31 | + ? $args[ 'fallback' ] |
|
| 32 | 32 | : $metaValue; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | protected function buildMetaKey( $metaKey, $prefix ) |
| 41 | 41 | { |
| 42 | - return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix )) |
|
| 42 | + return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix ) ) |
|
| 43 | 43 | ? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey ) |
| 44 | 44 | : $prefix . $metaKey; |
| 45 | 45 | } |
@@ -55,6 +55,6 @@ discard block |
||
| 55 | 55 | 'single' => true, |
| 56 | 56 | 'prefix' => Application::prefix(), |
| 57 | 57 | ]; |
| 58 | - return shortcode_atts( $defaults, array_change_key_case( $args )); |
|
| 58 | + return shortcode_atts( $defaults, array_change_key_case( $args ) ); |
|
| 59 | 59 | } |
| 60 | 60 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public function __construct() |
| 19 | 19 | { |
| 20 | - $this->options = get_option( Settings::id(), [] ); |
|
| 20 | + $this->options = get_option( Settings::id(), [ ] ); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $args = array_pad( $args, 2, null ); |
| 30 | 30 | $group = $this->$group; |
| 31 | - if( is_object( $group )) { |
|
| 31 | + if( is_object( $group ) ) { |
|
| 32 | 32 | return $group; |
| 33 | 33 | } |
| 34 | - return $this->get( $group, $args[0], $args[1] ); |
|
| 34 | + return $this->get( $group, $args[ 0 ], $args[ 1 ] ); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | if( $group == 'all' ) { |
| 44 | 44 | return (object) $this->options; |
| 45 | 45 | } |
| 46 | - if( empty( $group )) { |
|
| 46 | + if( empty( $group ) ) { |
|
| 47 | 47 | $group = $this->getDefaultGroup(); |
| 48 | 48 | } |
| 49 | - return isset( $this->options[$group] ) |
|
| 50 | - ? $this->options[$group] |
|
| 49 | + return isset( $this->options[ $group ] ) |
|
| 50 | + ? $this->options[ $group ] |
|
| 51 | 51 | : null; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | if( func_num_args() < 1 ) { |
| 63 | 63 | return $this->all; |
| 64 | 64 | } |
| 65 | - if( is_string( $group )) { |
|
| 65 | + if( is_string( $group ) ) { |
|
| 66 | 66 | $group = $this->$group; |
| 67 | 67 | } |
| 68 | - if( !is_array( $group )) { |
|
| 68 | + if( !is_array( $group ) ) { |
|
| 69 | 69 | return $fallback; |
| 70 | 70 | } |
| 71 | - if( is_null( $key )) { |
|
| 71 | + if( is_null( $key ) ) { |
|
| 72 | 72 | return $group; |
| 73 | 73 | } |
| 74 | 74 | return $this->getValue( $group, $key, $fallback ); |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | protected function getValue( array $group, $key, $fallback ) |
| 91 | 91 | { |
| 92 | - if( !array_key_exists( $key, $group )) { |
|
| 92 | + if( !array_key_exists( $key, $group ) ) { |
|
| 93 | 93 | return $fallback; |
| 94 | 94 | } |
| 95 | - return empty( $group[$key] ) && !is_null( $fallback ) |
|
| 95 | + return empty( $group[ $key ] ) && !is_null( $fallback ) |
|
| 96 | 96 | ? $fallback |
| 97 | - : $group[$key]; |
|
| 97 | + : $group[ $key ]; |
|
| 98 | 98 | } |
| 99 | 99 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | { |
| 17 | 17 | public function __construct() |
| 18 | 18 | { |
| 19 | - $this->options = get_option( Archive::id(), [] ); |
|
| 19 | + $this->options = get_option( Archive::id(), [ ] ); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | <a href="<?= $thickbox_url; ?>" id="set-post-thumbnail" class="thickbox"><?= $thumbnail; ?></a> |
| 5 | 5 | </p> |
| 6 | 6 | |
| 7 | -<?php if( get_post( $image_id )) : ?> |
|
| 7 | +<?php if( get_post( $image_id ) ) : ?> |
|
| 8 | 8 | |
| 9 | 9 | <p class="hide-if-no-js howto" id="set-post-thumbnail-desc"><?= $edit_image; ?></p> |
| 10 | 10 | <p class="hide-if-no-js"> |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function buildClassName( $name, $path = '' ) |
| 15 | 15 | { |
| 16 | - $className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ))); |
|
| 16 | + $className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ) ) ); |
|
| 17 | 17 | $className = implode( '', $className ); |
| 18 | 18 | return !empty( $path ) |
| 19 | - ? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className )) |
|
| 19 | + ? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className ) ) |
|
| 20 | 20 | : $className; |
| 21 | 21 | } |
| 22 | 22 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function buildMethodName( $name, $prefix = 'get' ) |
| 29 | 29 | { |
| 30 | - return lcfirst( $this->buildClassName( $prefix . '-' . $name )); |
|
| 30 | + return lcfirst( $this->buildClassName( $prefix . '-' . $name ) ); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function getCurrentScreen() |
| 64 | 64 | { |
| 65 | 65 | global $current_screen, $pagenow; |
| 66 | - if( isset( $current_screen )) { |
|
| 66 | + if( isset( $current_screen ) ) { |
|
| 67 | 67 | $current_screen->pagenow = $pagenow; |
| 68 | 68 | return $current_screen; |
| 69 | 69 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function startsWith( $needle, $haystack ) |
| 83 | 83 | { |
| 84 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
| 84 | + return substr( $haystack, 0, strlen( $needle ) ) === $needle; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |