@@ -22,15 +22,15 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $instructions = array_reduce( $this->getInstructionGroups(), function( $html, $metabox ) { |
| 24 | 24 | $fields = $this->getInstructionFields( $metabox ); |
| 25 | - if( empty( $fields )) { |
|
| 25 | + if( empty($fields) ) { |
|
| 26 | 26 | return $html; |
| 27 | 27 | } |
| 28 | - return $html . sprintf( '<p><strong>%s</strong></p><pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
|
| 28 | + return $html.sprintf( '<p><strong>%s</strong></p><pre class="my-sites nav-tab-active misc-pub-section">%s</pre>', |
|
| 29 | 29 | $metabox['title'], |
| 30 | 30 | $fields |
| 31 | 31 | ); |
| 32 | 32 | }); |
| 33 | - return $this->filter( 'before/instructions', '' ) . $instructions . $this->filter( 'after/instructions', '' ); |
|
| 33 | + return $this->filter( 'before/instructions', '' ).$instructions.$this->filter( 'after/instructions', '' ); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | protected function getInstructionFields( $metabox ) |
| 40 | 40 | { |
| 41 | 41 | $skipFields = ['custom_html', 'divider', 'heading', 'taxonomy']; |
| 42 | - return array_reduce( $metabox['fields'], function( $html, $field ) use( $metabox, $skipFields ) { |
|
| 42 | + return array_reduce( $metabox['fields'], function( $html, $field ) use($metabox, $skipFields) { |
|
| 43 | 43 | return $this->validate( $field['condition'] ) && !in_array( $field['type'], $skipFields ) |
| 44 | - ? $html . $this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ) . PHP_EOL |
|
| 44 | + ? $html.$this->filter( 'instruction', "PostMeta::get('{$field['slug']}');", $field, $metabox ).PHP_EOL |
|
| 45 | 45 | : $html; |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | return $this->filter( 'show/instructions', count( array_filter( $this->metaboxes, function( $metabox ) { |
| 87 | 87 | return $this->show( false, $metabox ); |
| 88 | - })) > 0 ); |
|
| 88 | + }) ) > 0 ); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -62,7 +62,9 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | protected function initInstructions() |
| 64 | 64 | { |
| 65 | - if( !$this->showInstructions() )return; |
|
| 65 | + if( !$this->showInstructions() ) { |
|
| 66 | + return; |
|
| 67 | + } |
|
| 66 | 68 | return [ |
| 67 | 69 | 'infodiv' => [ |
| 68 | 70 | 'context' => 'side', |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $method = strtolower( $name ); |
| 31 | 31 | $status = substr( $method, 3 ); |
| 32 | - if( 'add' == substr( $method, 0, 3 ) && in_array( $status, ['error', 'info', 'success', 'warning'] )) { |
|
| 33 | - return call_user_func_array( [$this, 'addNotice'], array_merge( [$status], $args )); |
|
| 32 | + if( 'add' == substr( $method, 0, 3 ) && in_array( $status, ['error', 'info', 'success', 'warning'] ) ) { |
|
| 33 | + return call_user_func_array( [$this, 'addNotice'], array_merge( [$status], $args ) ); |
|
| 34 | 34 | } |
| 35 | - throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name )); |
|
| 35 | + throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name ) ); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function __get( $property ) |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | if( $property == 'all' ) { |
| 41 | 41 | return $this->app->notices; |
| 42 | 42 | } |
| 43 | - throw new Exception( sprintf( 'Not a valid property: %s', $property )); |
|
| 43 | + throw new Exception( sprintf( 'Not a valid property: %s', $property ) ); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function activateButton( array $plugin ) |
| 50 | 50 | { |
| 51 | - $actionUrl = self_admin_url( sprintf( 'options-general.php?page=%s&action=activate&plugin=%s', $this->app->id, $plugin['plugin'] )); |
|
| 51 | + $actionUrl = self_admin_url( sprintf( 'options-general.php?page=%s&action=activate&plugin=%s', $this->app->id, $plugin['plugin'] ) ); |
|
| 52 | 52 | return $this->button( sprintf( '%s %s', __( 'Activate', 'pollux' ), $plugin['name'] ), [ |
| 53 | 53 | 'data-name' => $plugin['name'], |
| 54 | 54 | 'data-plugin' => $plugin['plugin'], |
| 55 | 55 | 'data-slug' => $plugin['slug'], |
| 56 | - 'href' => wp_nonce_url( $actionUrl, sprintf( 'activate-plugin_%s', $plugin['plugin'] )), |
|
| 57 | - ]); |
|
| 56 | + 'href' => wp_nonce_url( $actionUrl, sprintf( 'activate-plugin_%s', $plugin['plugin'] ) ), |
|
| 57 | + ] ); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | $atts = wp_parse_args( $atts, [ |
| 67 | 67 | 'class' => '', |
| 68 | 68 | 'href' => '', |
| 69 | - ]); |
|
| 70 | - $atts['class'] = trim( $atts['class'] . ' button button-small' ); |
|
| 71 | - $attributes = array_reduce( array_keys( $atts ), function( $carry, $key ) use( $atts ) { |
|
| 72 | - return $carry . sprintf( ' %s="%s"', $key, $atts[$key] ); |
|
| 69 | + ] ); |
|
| 70 | + $atts['class'] = trim( $atts['class'].' button button-small' ); |
|
| 71 | + $attributes = array_reduce( array_keys( $atts ), function( $carry, $key ) use($atts) { |
|
| 72 | + return $carry.sprintf( ' %s="%s"', $key, $atts[$key] ); |
|
| 73 | 73 | }); |
| 74 | 74 | return sprintf( '<a%s>%s</a>', $attributes, $title ); |
| 75 | 75 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | if( $unset ) { |
| 83 | 83 | $index = array_search( $notice, $this->app->notices ); |
| 84 | 84 | if( $index !== false ) { |
| 85 | - unset( $this->app->notices[$index] ); |
|
| 85 | + unset($this->app->notices[$index]); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | return $this->buildNotice( $notice ); |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function installButton( array $plugin ) |
| 95 | 95 | { |
| 96 | - $actionUrl = self_admin_url( sprintf( 'update.php?action=install-plugin&plugin=%s', $plugin['slug'] )); |
|
| 96 | + $actionUrl = self_admin_url( sprintf( 'update.php?action=install-plugin&plugin=%s', $plugin['slug'] ) ); |
|
| 97 | 97 | return $this->button( sprintf( '%s %s', __( 'Install', 'pollux' ), $plugin['name'] ), [ |
| 98 | 98 | 'data-name' => $plugin['name'], |
| 99 | 99 | 'data-plugin' => $plugin['plugin'], |
| 100 | 100 | 'data-slug' => $plugin['slug'], |
| 101 | - 'href' => wp_nonce_url( $actionUrl, sprintf( 'install-plugin_%s', $plugin['slug'] )), |
|
| 102 | - ]); |
|
| 101 | + 'href' => wp_nonce_url( $actionUrl, sprintf( 'install-plugin_%s', $plugin['slug'] ) ), |
|
| 102 | + ] ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -107,13 +107,13 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function updateButton( array $plugin ) |
| 109 | 109 | { |
| 110 | - $actionUrl = self_admin_url( sprintf( 'update.php?action=upgrade-plugin&plugin=%s', $plugin['plugin'] )); |
|
| 110 | + $actionUrl = self_admin_url( sprintf( 'update.php?action=upgrade-plugin&plugin=%s', $plugin['plugin'] ) ); |
|
| 111 | 111 | return $this->button( sprintf( '%s %s', __( 'Update', 'pollux' ), $plugin['name'] ), [ |
| 112 | 112 | 'data-name' => $plugin['name'], |
| 113 | 113 | 'data-plugin' => $plugin['plugin'], |
| 114 | 114 | 'data-slug' => $plugin['slug'], |
| 115 | - 'href' => wp_nonce_url( $actionUrl, sprintf( 'upgrade-plugin_%s', $plugin['plugin'] )), |
|
| 116 | - ]); |
|
| 115 | + 'href' => wp_nonce_url( $actionUrl, sprintf( 'upgrade-plugin_%s', $plugin['plugin'] ) ), |
|
| 116 | + ] ); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $this->app->notices[] = [ |
| 137 | 137 | 'dismissible' => $dismissible, |
| 138 | - 'message' => $this->buildMessage( array_filter( (array) $messages )), |
|
| 138 | + 'message' => $this->buildMessage( array_filter( (array)$messages ) ), |
|
| 139 | 139 | 'type' => $type, |
| 140 | 140 | ]; |
| 141 | 141 | $this->app->notices = array_unique( $this->app->notices, SORT_REGULAR ); |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | protected function buildMessage( array $messages ) |
| 148 | 148 | { |
| 149 | 149 | foreach( $messages as $key => &$message ) { |
| 150 | - if( !is_wp_error( $message ))continue; |
|
| 150 | + if( !is_wp_error( $message ) )continue; |
|
| 151 | 151 | $message = $message->get_error_message(); |
| 152 | 152 | } |
| 153 | - return wpautop( implode( PHP_EOL . PHP_EOL, $messages )); |
|
| 153 | + return wpautop( implode( PHP_EOL.PHP_EOL, $messages ) ); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -147,7 +147,9 @@ |
||
| 147 | 147 | protected function buildMessage( array $messages ) |
| 148 | 148 | { |
| 149 | 149 | foreach( $messages as $key => &$message ) { |
| 150 | - if( !is_wp_error( $message ))continue; |
|
| 150 | + if( !is_wp_error( $message )) { |
|
| 151 | + continue; |
|
| 152 | + } |
|
| 151 | 153 | $message = $message->get_error_message(); |
| 152 | 154 | } |
| 153 | 155 | return wpautop( implode( PHP_EOL . PHP_EOL, $messages )); |
@@ -100,7 +100,9 @@ discard block |
||
| 100 | 100 | trailingslashit( dirname( dirname( ABSPATH ))), |
| 101 | 101 | ]); |
| 102 | 102 | foreach( (array) $locations as $location ) { |
| 103 | - if( !file_exists( $location . $filename ))continue; |
|
| 103 | + if( !file_exists( $location . $filename )) { |
|
| 104 | + continue; |
|
| 105 | + } |
|
| 104 | 106 | return $location . $filename; |
| 105 | 107 | } |
| 106 | 108 | return null; |
@@ -140,7 +142,9 @@ discard block |
||
| 140 | 142 | $view, |
| 141 | 143 | $data |
| 142 | 144 | ); |
| 143 | - if( !file_exists( $file ))return; |
|
| 145 | + if( !file_exists( $file )) { |
|
| 146 | + return; |
|
| 147 | + } |
|
| 144 | 148 | extract( $data ); |
| 145 | 149 | include $file; |
| 146 | 150 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function __construct() |
| 33 | 33 | { |
| 34 | - $this->file = realpath( dirname( dirname( __FILE__ )) . '/pollux.php' ); |
|
| 34 | + $this->file = realpath( dirname( dirname( __FILE__ ) ).'/pollux.php' ); |
|
| 35 | 35 | |
| 36 | 36 | $data = get_file_data( $this->file, array( |
| 37 | 37 | 'id' => 'Text Domain', |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | add_action( 'plugins_loaded', function() { |
| 60 | 60 | $this->bootstrap(); |
| 61 | 61 | }); |
| 62 | - add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' )); |
|
| 63 | - add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' )); |
|
| 64 | - add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' )); |
|
| 65 | - add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' )); |
|
| 66 | - add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' )); |
|
| 62 | + add_action( 'admin_enqueue_scripts', array( $controller, 'registerAssets' ) ); |
|
| 63 | + add_action( 'admin_init', array( $controller, 'removeDashboardWidgets' ) ); |
|
| 64 | + add_action( 'wp_before_admin_bar_render', array( $controller, 'removeWordPressMenu' ) ); |
|
| 65 | + add_filter( "plugin_action_links_{$basename}", array( $controller, 'filterPluginLinks' ) ); |
|
| 66 | + add_filter( 'admin_footer_text', array( $controller, 'filterWordPressFooter' ) ); |
|
| 67 | 67 | |
| 68 | 68 | // Disallow indexing of the site on non-production environments |
| 69 | 69 | if( !$this->environment( 'production' ) && !is_admin() ) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function environment( $checkFor = '' ) |
| 79 | 79 | { |
| 80 | 80 | $environment = defined( 'WP_ENV' ) ? WP_ENV : 'production'; |
| 81 | - if( !empty( $checkFor )) { |
|
| 81 | + if( !empty($checkFor) ) { |
|
| 82 | 82 | return $environment == $checkFor; |
| 83 | 83 | } |
| 84 | 84 | return $environment; |
@@ -93,16 +93,16 @@ discard block |
||
| 93 | 93 | $theme = wp_get_theme(); |
| 94 | 94 | $filename = apply_filters( 'pollux/file', $filename ); |
| 95 | 95 | $locations = apply_filters( 'pollux/file/locations', [ |
| 96 | - trailingslashit( trailingslashit( $theme->theme_root ) . $theme->stylesheet ), |
|
| 97 | - trailingslashit( trailingslashit( $theme->theme_root ) . $theme->template ), |
|
| 96 | + trailingslashit( trailingslashit( $theme->theme_root ).$theme->stylesheet ), |
|
| 97 | + trailingslashit( trailingslashit( $theme->theme_root ).$theme->template ), |
|
| 98 | 98 | trailingslashit( WP_CONTENT_DIR ), |
| 99 | 99 | trailingslashit( ABSPATH ), |
| 100 | - trailingslashit( dirname( ABSPATH )), |
|
| 101 | - trailingslashit( dirname( dirname( ABSPATH ))), |
|
| 102 | - ]); |
|
| 103 | - foreach( (array) $locations as $location ) { |
|
| 104 | - if( !file_exists( $location . $filename ))continue; |
|
| 105 | - return $location . $filename; |
|
| 100 | + trailingslashit( dirname( ABSPATH ) ), |
|
| 101 | + trailingslashit( dirname( dirname( ABSPATH ) ) ), |
|
| 102 | + ] ); |
|
| 103 | + foreach( (array)$locations as $location ) { |
|
| 104 | + if( !file_exists( $location.$filename ) )continue; |
|
| 105 | + return $location.$filename; |
|
| 106 | 106 | } |
| 107 | 107 | return null; |
| 108 | 108 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function path( $file = '' ) |
| 129 | 129 | { |
| 130 | - return plugin_dir_path( $this->file ) . ltrim( trim( $file ), '/' ); |
|
| 130 | + return plugin_dir_path( $this->file ).ltrim( trim( $file ), '/' ); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | public function render( $view, array $data = [] ) |
| 138 | 138 | { |
| 139 | 139 | $file = apply_filters( 'pollux/views/file', |
| 140 | - $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ))), |
|
| 140 | + $this->path( sprintf( 'views/%s.php', str_replace( '.php', '', $view ) ) ), |
|
| 141 | 141 | $view, |
| 142 | 142 | $data |
| 143 | 143 | ); |
| 144 | - if( !file_exists( $file ))return; |
|
| 144 | + if( !file_exists( $file ) )return; |
|
| 145 | 145 | extract( $data ); |
| 146 | 146 | include $file; |
| 147 | 147 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function url( $path = '' ) |
| 154 | 154 | { |
| 155 | - return esc_url( plugin_dir_url( $this->file ) . ltrim( trim( $path ), '/' )); |
|
| 155 | + return esc_url( plugin_dir_url( $this->file ).ltrim( trim( $path ), '/' ) ); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | protected function loadHooks() |
| 187 | 187 | { |
| 188 | - if( $file = $this->getFile( 'pollux-hooks.php' )) { |
|
| 188 | + if( $file = $this->getFile( 'pollux-hooks.php' ) ) { |
|
| 189 | 189 | include_once $file; |
| 190 | 190 | } |
| 191 | 191 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | */ |
| 196 | 196 | protected function loadTextdomain() |
| 197 | 197 | { |
| 198 | - load_plugin_textdomain( $this->id, false, plugin_basename( $this->path() ) . '/languages/' ); |
|
| 198 | + load_plugin_textdomain( $this->id, false, plugin_basename( $this->path() ).'/languages/' ); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -207,6 +207,6 @@ discard block |
||
| 207 | 207 | 'ArchiveMeta' => 'GeminiLabs\Pollux\Facades\ArchiveMeta', |
| 208 | 208 | 'PostMeta' => 'GeminiLabs\Pollux\Facades\PostMeta', |
| 209 | 209 | 'SiteMeta' => 'GeminiLabs\Pollux\Facades\SiteMeta', |
| 210 | - )))->register(); |
|
| 210 | + ) ) )->register(); |
|
| 211 | 211 | } |
| 212 | 212 | } |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | $yamlFile = $this->getYamlFile(); |
| 43 | 43 | $yaml = $this->normalizeYamlValues( $this->normalize( |
| 44 | 44 | $this->parseYaml( file_get_contents( $yamlFile ), $yamlFile ) |
| 45 | - )); |
|
| 45 | + ) ); |
|
| 46 | 46 | if( !$yaml['disable_config'] ) { |
| 47 | - $config = array_filter( (array) get_option( Config::id(), [] )); |
|
| 47 | + $config = array_filter( (array)get_option( Config::id(), [] ) ); |
|
| 48 | 48 | } |
| 49 | - return empty( $config ) |
|
| 50 | - ? $this->setTimestamp( $yaml, filemtime( $yamlFile )) |
|
| 51 | - : $this->normalizeYamlValues( $this->normalize( $config )); |
|
| 49 | + return empty($config) |
|
| 50 | + ? $this->setTimestamp( $yaml, filemtime( $yamlFile ) ) |
|
| 51 | + : $this->normalizeYamlValues( $this->normalize( $config ) ); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -58,15 +58,15 @@ discard block |
||
| 58 | 58 | public function compile( $force = false ) |
| 59 | 59 | { |
| 60 | 60 | $configFile = $this->getCompileDestination(); |
| 61 | - if( $force || $this->shouldCompile( $configFile )) { |
|
| 61 | + if( $force || $this->shouldCompile( $configFile ) ) { |
|
| 62 | 62 | $config = $this->normalizeArray( $this->options ); |
| 63 | 63 | if( $this->parseError ) { |
| 64 | - return (object) $config; |
|
| 64 | + return (object)$config; |
|
| 65 | 65 | } |
| 66 | 66 | file_put_contents( $configFile, sprintf( '<?php // DO NOT MODIFY THIS FILE DIRECTLY!%sreturn (object) %s;', |
| 67 | 67 | PHP_EOL, |
| 68 | - $this->parseRawStrings( var_export( $this->setTimestamp( $config ), true )) |
|
| 69 | - )); |
|
| 68 | + $this->parseRawStrings( var_export( $this->setTimestamp( $config ), true ) ) |
|
| 69 | + ) ); |
|
| 70 | 70 | } |
| 71 | 71 | return include $configFile; |
| 72 | 72 | } |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function convertArrayToYaml( array $array ) |
| 78 | 78 | { |
| 79 | - return !empty( $array ) |
|
| 80 | - ? trim( $this->parseRawStrings( $this->dumpYaml( $array ))) |
|
| 79 | + return !empty($array) |
|
| 80 | + ? trim( $this->parseRawStrings( $this->dumpYaml( $array ) ) ) |
|
| 81 | 81 | : ''; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | */ |
| 98 | 98 | public function getYamlFile() |
| 99 | 99 | { |
| 100 | - if( $file = $this->app->getFile( 'pollux.yml' )) { |
|
| 100 | + if( $file = $this->app->getFile( 'pollux.yml' ) ) { |
|
| 101 | 101 | return $file; |
| 102 | 102 | } |
| 103 | 103 | return $this->app->path( 'defaults.yml' ); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public function normalizeArray( array $array ) |
| 110 | 110 | { |
| 111 | 111 | array_walk( $array, function( &$value, $key ) { |
| 112 | - if( !is_numeric( $value ) && is_string( $value )) { |
|
| 112 | + if( !is_numeric( $value ) && is_string( $value ) ) { |
|
| 113 | 113 | $value = $this->parseYaml( $value, $key ); |
| 114 | 114 | if( $this->parseError == $key ) { |
| 115 | 115 | $value = []; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | return wp_parse_args( |
| 163 | 163 | $config, |
| 164 | 164 | $this->parseYaml( |
| 165 | - file_get_contents( $this->app->path( 'defaults.yml' )), |
|
| 165 | + file_get_contents( $this->app->path( 'defaults.yml' ) ), |
|
| 166 | 166 | $this->app->path( 'defaults.yml' ) |
| 167 | 167 | ) |
| 168 | 168 | ); |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | protected function parseRawStrings( $configString ) |
| 177 | 177 | { |
| 178 | 178 | $strings = apply_filters( 'pollux/config/raw_strings', static::RAW_STRINGS ); |
| 179 | - if( empty( $strings )) { |
|
| 179 | + if( empty($strings) ) { |
|
| 180 | 180 | return $configString; |
| 181 | 181 | } |
| 182 | - $pattern = '/(\')((' . implode( '|', $strings ) . ')\(?.+\))(\')/'; |
|
| 182 | + $pattern = '/(\')(('.implode( '|', $strings ).')\(?.+\))(\')/'; |
|
| 183 | 183 | return stripslashes( |
| 184 | 184 | preg_replace_callback( $pattern, function( $matches ) { |
| 185 | 185 | return str_replace( "''", "'", $matches[2] ); |
@@ -194,20 +194,20 @@ discard block |
||
| 194 | 194 | protected function parseYaml( $value, $file = null ) |
| 195 | 195 | { |
| 196 | 196 | try { |
| 197 | - return (array) Yaml::parse( $value ); |
|
| 197 | + return (array)Yaml::parse( $value ); |
|
| 198 | 198 | } |
| 199 | 199 | catch( ParseException $e ) { |
| 200 | 200 | $this->parseError = $file; |
| 201 | 201 | if( $file ) { |
| 202 | 202 | $file = sprintf( '<code>%s</code>', $file ); |
| 203 | 203 | } |
| 204 | - $this->app->make( 'Notice' )->addError([ |
|
| 204 | + $this->app->make( 'Notice' )->addError( [ |
|
| 205 | 205 | sprintf( '<strong>Pollux Error:</strong> Unable to parse config at line %s (near "%s").', |
| 206 | 206 | $e->getParsedLine(), |
| 207 | 207 | $e->getSnippet() |
| 208 | 208 | ), |
| 209 | 209 | $file |
| 210 | - ]); |
|
| 210 | + ] ); |
|
| 211 | 211 | return $value; |
| 212 | 212 | } |
| 213 | 213 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | protected function shouldCompile( $configFile ) |
| 220 | 220 | { |
| 221 | - if( !file_exists( $configFile )) { |
|
| 221 | + if( !file_exists( $configFile ) ) { |
|
| 222 | 222 | return true; |
| 223 | 223 | } |
| 224 | 224 | $config = include $configFile; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function init() |
| 46 | 46 | { |
| 47 | - if( empty( $this->app->config->post_types ))return; |
|
| 47 | + if( empty($this->app->config->post_types) )return; |
|
| 48 | 48 | |
| 49 | 49 | $this->setColumns(); |
| 50 | 50 | $this->normalize(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | get_post_types( ['_builtin' => true] ) |
| 65 | 65 | ); |
| 66 | 66 | array_walk( $types, function( $args, $type ) { |
| 67 | - register_post_type( $type, array_diff_key( $args, array_flip( static::CUSTOM_KEYS ))); |
|
| 67 | + register_post_type( $type, array_diff_key( $args, array_flip( static::CUSTOM_KEYS ) ) ); |
|
| 68 | 68 | }); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | protected function normalizeLabels( $labels, array $args ) |
| 89 | 89 | { |
| 90 | - return wp_parse_args( $labels, $this->setLabels( $args )); |
|
| 90 | + return wp_parse_args( $labels, $this->setLabels( $args ) ); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | protected function normalizeMenuName( $menuname, array $args ) |
| 98 | 98 | { |
| 99 | - return empty( $menuname ) |
|
| 99 | + return empty($menuname) |
|
| 100 | 100 | ? $args['plural'] |
| 101 | 101 | : $menuname; |
| 102 | 102 | } |
@@ -44,7 +44,9 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function init() |
| 46 | 46 | { |
| 47 | - if( empty( $this->app->config->post_types ))return; |
|
| 47 | + if( empty( $this->app->config->post_types )) { |
|
| 48 | + return; |
|
| 49 | + } |
|
| 48 | 50 | |
| 49 | 51 | $this->setColumns(); |
| 50 | 52 | $this->normalize(); |
@@ -102,11 +102,11 @@ |
||
| 102 | 102 | */ |
| 103 | 103 | protected static function resolveFacadeInstance( $name ) |
| 104 | 104 | { |
| 105 | - if( is_object( $name )) { |
|
| 105 | + if( is_object( $name ) ) { |
|
| 106 | 106 | return $name; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if( isset( static::$resolvedInstance[$name] )) { |
|
| 109 | + if( isset(static::$resolvedInstance[$name]) ) { |
|
| 110 | 110 | return static::$resolvedInstance[$name]; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -3,7 +3,9 @@ |
||
| 3 | 3 | defined( 'WP_UNINSTALL_PLUGIN' ) || die; |
| 4 | 4 | |
| 5 | 5 | require_once __DIR__.'/pollux.php'; |
| 6 | -if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() )return; |
|
| 6 | +if( !(new GL_Plugin_Check_v3( __FILE__ ))->isValid() ) { |
|
| 7 | + return; |
|
| 8 | +} |
|
| 7 | 9 | |
| 8 | 10 | delete_option( GeminiLabs\Pollux\Config\Config::id() ); |
| 9 | 11 | delete_option( GeminiLabs\Pollux\PostType\Archive::id() ); |
@@ -21,7 +21,9 @@ |
||
| 21 | 21 | if( !class_exists( 'GL_Plugin_Check_v3' )) { |
| 22 | 22 | require_once __DIR__.'/activate.php'; |
| 23 | 23 | } |
| 24 | -if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
|
| 24 | +if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() ) { |
|
| 25 | + return; |
|
| 26 | +} |
|
| 25 | 27 | require_once __DIR__.'/autoload.php'; |
| 26 | 28 | require_once __DIR__.'/helpers.php'; |
| 27 | 29 | require_once __DIR__.'/thirdparty.php'; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | defined( 'WPINC' ) || die; |
| 20 | 20 | |
| 21 | -if( !class_exists( 'GL_Plugin_Check_v3' )) { |
|
| 21 | +if( !class_exists( 'GL_Plugin_Check_v3' ) ) { |
|
| 22 | 22 | require_once __DIR__.'/activate.php'; |
| 23 | 23 | } |
| 24 | 24 | if( !(new GL_Plugin_Check_v3( __FILE__ ))->canProceed() )return; |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $app = GeminiLabs\Pollux\Application::getInstance(); |
| 30 | 30 | |
| 31 | -register_activation_hook( __FILE__, array( $app, 'onActivation' )); |
|
| 32 | -register_deactivation_hook( __FILE__, array( $app, 'onDeactivation' )); |
|
| 31 | +register_activation_hook( __FILE__, array( $app, 'onActivation' ) ); |
|
| 32 | +register_deactivation_hook( __FILE__, array( $app, 'onDeactivation' ) ); |
|
| 33 | 33 | |
| 34 | 34 | $app->register( new GeminiLabs\Pollux\Provider ); |
| 35 | -$app->init([ |
|
| 35 | +$app->init( [ |
|
| 36 | 36 | 'meta-box/meta-box.php' => 'Meta Box|5.0.1|https://wordpress.org/plugins/meta-box/', |
| 37 | -]); |
|
| 37 | +] ); |
|
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | spl_autoload_register( function( $class ) |
| 9 | 9 | { |
| 10 | 10 | $namespaces = [ |
| 11 | - 'GeminiLabs\\Pollux\\' => __DIR__ . '/src/', |
|
| 12 | - 'GeminiLabs\\Pollux\\Tests\\' => __DIR__ . '/tests/', |
|
| 13 | - 'Symfony\\Component\\Yaml\\' => __DIR__ . '/vendor/symfony/yaml/', |
|
| 11 | + 'GeminiLabs\\Pollux\\' => __DIR__.'/src/', |
|
| 12 | + 'GeminiLabs\\Pollux\\Tests\\' => __DIR__.'/tests/', |
|
| 13 | + 'Symfony\\Component\\Yaml\\' => __DIR__.'/vendor/symfony/yaml/', |
|
| 14 | 14 | ]; |
| 15 | 15 | foreach( $namespaces as $prefix => $base_dir ) { |
| 16 | 16 | $len = strlen( $prefix ); |
| 17 | 17 | if( strncmp( $prefix, $class, $len ) !== 0 )continue; |
| 18 | - $file = $base_dir . str_replace( '\\', '/', substr( $class, $len ) ) . '.php'; |
|
| 18 | + $file = $base_dir.str_replace( '\\', '/', substr( $class, $len ) ).'.php'; |
|
| 19 | 19 | if( !file_exists( $file ) )continue; |
| 20 | 20 | require $file; |
| 21 | 21 | break; |
@@ -5,8 +5,7 @@ discard block |
||
| 5 | 5 | /** |
| 6 | 6 | * PSR-4 autoloader |
| 7 | 7 | */ |
| 8 | -spl_autoload_register( function( $class ) |
|
| 9 | -{ |
|
| 8 | +spl_autoload_register( function( $class ) { |
|
| 10 | 9 | $namespaces = [ |
| 11 | 10 | 'GeminiLabs\\Pollux\\' => __DIR__ . '/src/', |
| 12 | 11 | 'GeminiLabs\\Pollux\\Tests\\' => __DIR__ . '/tests/', |
@@ -14,9 +13,13 @@ discard block |
||
| 14 | 13 | ]; |
| 15 | 14 | foreach( $namespaces as $prefix => $base_dir ) { |
| 16 | 15 | $len = strlen( $prefix ); |
| 17 | - if( strncmp( $prefix, $class, $len ) !== 0 )continue; |
|
| 16 | + if( strncmp( $prefix, $class, $len ) !== 0 ) { |
|
| 17 | + continue; |
|
| 18 | + } |
|
| 18 | 19 | $file = $base_dir . str_replace( '\\', '/', substr( $class, $len ) ) . '.php'; |
| 19 | - if( !file_exists( $file ) )continue; |
|
| 20 | + if( !file_exists( $file ) ) { |
|
| 21 | + continue; |
|
| 22 | + } |
|
| 20 | 23 | require $file; |
| 21 | 24 | break; |
| 22 | 25 | } |