| @@ -4,9 +4,9 @@ | ||
| 4 | 4 | * Description: Hide/Remove Metadata is a free, simple yet extremely handy WordPress plugin that helps you hide author and published date either by CSS or PHP from your website effortlessly. |
| 5 | 5 | * Plugin URI: http://catchplugins.com/plugins/hide-metadata |
| 6 | 6 | * Author: Catch Plugins |
| 7 | 7 | * Author URI: http://catchplugins.com/ |
| 8 | - * Version: 1.1 | |
| 8 | + * Version: 1.2 | |
| 9 | 9 | * License: GPL2 |
| 10 | 10 | * Text Domain: hide-metadata |
| 11 | 11 | * Domain Path: /languages |
| 12 | 12 | */ |
| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | along with this program; if not, write to the Free Software |
| 28 | 28 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | -define( 'HIDE_METADATA_VERSION', '1.1' ); | |
| 31 | +define( 'HIDE_METADATA_VERSION', '1.2' ); | |
| 32 | 32 | |
| 33 | 33 | class Hide_Metadata { |
| 34 | 34 | private $plugin_name; |
| 35 | 35 | private $version; |
| @@ -48,9 +48,9 @@ | ||
| 48 | 48 | add_filter( 'plugin_row_meta', array( $this, 'add_plugin_meta_links' ), 10, 2 ); |
| 49 | 49 | |
| 50 | 50 | add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 2 ); |
| 51 | 51 | |
| 52 | - if ( 'php' == $this->options['hide_by'] ) { | |
| 52 | + if ( 'php' === $this->options['hide_by'] ) { | |
| 53 | 53 | add_action( 'loop_start', array( $this, 'remove_php' ) ); |
| 54 | 54 | } |
| 55 | 55 | add_action( 'wp_head', array( $this, 'css_filter_option' ) ); |
| 56 | 56 | } |
| @@ -60,9 +60,9 @@ | ||
| 60 | 60 | * |
| 61 | 61 | * @since 1.0.0 |
| 62 | 62 | */ |
| 63 | 63 | function enqueue_styles() { |
| 64 | - if ( isset( $_GET['page'] ) && 'hide-metadata' == $_GET['page'] ) { | |
| 64 | + if ( isset( $_GET['page'] ) && 'hide-metadata' === $_GET['page'] ) { | |
| 65 | 65 | wp_enqueue_style( $this->plugin_name . '-display-dashboard', plugin_dir_url( __FILE__ ) . 'css/admin-dashboard.css', array(), $this->version, 'all' ); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
| @@ -71,9 +71,9 @@ | ||
| 71 | 71 | * |
| 72 | 72 | * @since 1.0.0 |
| 73 | 73 | */ |
| 74 | 74 | function enqueue_scripts() { |
| 75 | - if ( isset( $_GET['page'] ) && 'hide-metadata' == $_GET['page'] ) { | |
| 75 | + if ( isset( $_GET['page'] ) && 'hide-metadata' === $_GET['page'] ) { | |
| 76 | 76 | wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/hide-metadata-admin.js', array( 'jquery', 'matchHeight', 'jquery-ui-tooltip' ), $this->version, false ); |
| 77 | 77 | |
| 78 | 78 | wp_enqueue_script( 'matchHeight', plugin_dir_url( __FILE__ ) . 'js/jquery-matchHeight.min.js', array( 'jquery' ), $this->version, false ); |
| 79 | 79 | |
| @@ -163,50 +163,50 @@ | ||
| 163 | 163 | $css = ''; |
| 164 | 164 | $options = hide_metadata_get_options(); |
| 165 | 165 | |
| 166 | 166 | // Hide author CSS |
| 167 | - if ( 1 == $options['hide_author'] && 'css' == $options['hide_by'] ) { | |
| 168 | - $css .= '.entry-meta .byline, | |
| 169 | - .entry-header .entry-meta > span.byline { | |
| 170 | - display: none; | |
| 171 | - }'; | |
| 167 | + if ( 1 == $options['hide_author'] && 'css' === $options['hide_by'] ) { | |
| 168 | + $css .= ".entry-meta .byline, | |
| 169 | +.entry-header .entry-meta > span.byline { | |
| 170 | + display: none; | |
| 171 | +}\n"; | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Hide date CSS |
| 175 | - if ( 1 == $options['hide_date'] && 'css' == $options['hide_by'] ) { | |
| 176 | - $css .= '.entry-meta .posted-on, | |
| 177 | - .entry-header .entry-meta > span.posted-on { | |
| 178 | - display: none; | |
| 179 | - }'; | |
| 175 | + if ( 1 == $options['hide_date'] && 'css' === $options['hide_by'] ) { | |
| 176 | + $css .= ".entry-meta .posted-on, | |
| 177 | +.entry-header .entry-meta > span.posted-on { | |
| 178 | + display: none; | |
| 179 | +}\n"; | |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | // Hide author |
| 183 | - if ( 1 == $options['hide_author'] && 'php' == $options['hide_by'] ) { | |
| 184 | - $css .= '.entry-meta .byline:before, | |
| 185 | - .entry-header .entry-meta span.byline:before, | |
| 186 | - .entry-meta .byline:after, | |
| 187 | - .entry-header .entry-meta span.byline:after, | |
| 188 | - .single .byline, .group-blog .byline, | |
| 189 | - .entry-meta .byline, | |
| 190 | - .entry-header .entry-meta > span.byline { | |
| 191 | - content: ""; | |
| 192 | - display: none; | |
| 193 | - margin: 0; | |
| 194 | - }'; | |
| 183 | + if ( 1 == $options['hide_author'] && 'php' === $options['hide_by'] ) { | |
| 184 | + $css .= ".entry-meta .byline:before, | |
| 185 | +.entry-header .entry-meta span.byline:before, | |
| 186 | +.entry-meta .byline:after, | |
| 187 | +.entry-header .entry-meta span.byline:after, | |
| 188 | +.single .byline, .group-blog .byline, | |
| 189 | +.entry-meta .byline, | |
| 190 | +.entry-header .entry-meta > span.byline { | |
| 191 | + content: ''; | |
| 192 | + display: none; | |
| 193 | + margin: 0; | |
| 194 | +}\n"; | |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | // Hide date |
| 198 | - if ( 1 == $options['hide_date'] && 'php' == $options['hide_by'] ) { | |
| 199 | - $css .= '.entry-meta .posted-on:before, | |
| 200 | - .entry-header .entry-meta > span.posted-on:before, | |
| 201 | - .entry-meta .posted-on:after, | |
| 202 | - .entry-header .entry-meta > span.posted-on:after, | |
| 203 | - .entry-meta .posted-on, | |
| 204 | - .entry-header .entry-meta > span.posted-on { | |
| 205 | - content: ""; | |
| 206 | - display: none; | |
| 207 | - margin: 0; | |
| 208 | - }'; | |
| 198 | + if ( 1 == $options['hide_date'] && 'php' === $options['hide_by'] ) { | |
| 199 | + $css .= ".entry-meta .posted-on:before, | |
| 200 | +.entry-header .entry-meta > span.posted-on:before, | |
| 201 | +.entry-meta .posted-on:after, | |
| 202 | +.entry-header .entry-meta > span.posted-on:after, | |
| 203 | +.entry-meta .posted-on, | |
| 204 | +.entry-header .entry-meta > span.posted-on { | |
| 205 | + content: ''; | |
| 206 | + display: none; | |
| 207 | + margin: 0; | |
| 208 | +}\n"; | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | return $css; |
| 212 | 212 | } |
| @@ -213,10 +213,11 @@ | ||
| 213 | 213 | |
| 214 | 214 | //Removal using css |
| 215 | 215 | |
| 216 | 216 | function inline_style() { |
| 217 | - if ( ! empty( $this->hide_by_css() ) ) { | |
| 218 | - echo '<style>/* CSS added by Hide Metadata Plugin */' . $this->hide_by_css() . '</style>'; | |
| 217 | + $css = $this->hide_by_css(); | |
| 218 | + if ( ! empty( $css ) ) { | |
| 219 | + echo "<style>\n\n/* CSS added by Hide Metadata Plugin */\n\n" . wp_strip_all_tags( $css ) . "</style>\n"; | |
| 219 | 220 | } |
| 220 | 221 | } |
| 221 | 222 | |
| 222 | 223 | function remove_php() { |
| @@ -244,9 +245,9 @@ | ||
| 244 | 245 | } |
| 245 | 246 | |
| 246 | 247 | function add_plugin_meta_links( $meta_fields, $file ) { |
| 247 | 248 | |
| 248 | - if ( $file == plugin_basename( __FILE__ ) ) { | |
| 249 | + if ( $file === plugin_basename( __FILE__ ) ) { | |
| 249 | 250 | |
| 250 | 251 | $meta_fields[] = "<a href='https://catchplugins.com/support-forum/forum/hide-metadata/' target='_blank'>Support Forum</a>"; |
| 251 | 252 | $meta_fields[] = "<a href='https://wordpress.org/support/plugin/hide-metadata/reviews#new-post' target='_blank' title='Rate'> |
| 252 | 253 | <i class='ct-rate-stars'>" |
| @@ -281,9 +282,9 @@ | ||
| 281 | 282 | 'hide_author' => 0, |
| 282 | 283 | 'hide_date' => 0, |
| 283 | 284 | ); |
| 284 | 285 | |
| 285 | - if ( null == $option ) { | |
| 286 | + if ( null === $option ) { | |
| 286 | 287 | return apply_filters( 'hide_metadata_options', $default_options ); |
| 287 | 288 | } else { |
| 288 | 289 | return $default_options[ $option ]; |
| 289 | 290 | } |