@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * @copyright 2018 Julien Liabeuf |
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | -if ( ! class_exists( 'Dismissible_Notices_Handler' ) ) { |
|
| 22 | +if ( ! class_exists('Dismissible_Notices_Handler')) { |
|
| 23 | 23 | |
| 24 | 24 | final class Dismissible_Notices_Handler { |
| 25 | 25 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public static function instance() { |
| 69 | 69 | |
| 70 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Dismissible_Notices_Handler ) ) { |
|
| 70 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Dismissible_Notices_Handler)) { |
|
| 71 | 71 | self::$instance = new Dismissible_Notices_Handler; |
| 72 | 72 | self::$instance->init(); |
| 73 | 73 | } |
@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | private function init() { |
| 86 | 86 | |
| 87 | 87 | // Make sure WordPress is compatible |
| 88 | - if ( ! self::$instance->is_wp_compatible() ) { |
|
| 88 | + if ( ! self::$instance->is_wp_compatible()) { |
|
| 89 | 89 | self::$instance->spit_error( |
| 90 | 90 | sprintf( |
| 91 | 91 | /* translators: %s: required wordpress version */ |
| 92 | - esc_html__( 'The library can not be used because your version of WordPress is too old. You need version %s at least.', 'wp-dismissible-notices-handler' ), |
|
| 92 | + esc_html__('The library can not be used because your version of WordPress is too old. You need version %s at least.', 'wp-dismissible-notices-handler'), |
|
| 93 | 93 | self::$instance->wordpress_version_required |
| 94 | 94 | ) |
| 95 | 95 | ); |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Make sure PHP is compatible |
| 101 | - if ( ! self::$instance->is_php_compatible() ) { |
|
| 101 | + if ( ! self::$instance->is_php_compatible()) { |
|
| 102 | 102 | self::$instance->spit_error( |
| 103 | 103 | sprintf( |
| 104 | 104 | /* translators: %s: required php version */ |
| 105 | - esc_html__( 'The library can not be used because your version of PHP is too old. You need version %s at least.', 'wp-dismissible-notices-handler' ), |
|
| 105 | + esc_html__('The library can not be used because your version of PHP is too old. You need version %s at least.', 'wp-dismissible-notices-handler'), |
|
| 106 | 106 | self::$instance->php_version_required |
| 107 | 107 | ) |
| 108 | 108 | ); |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - add_action( 'admin_notices', array( self::$instance, 'display' ) ); |
|
| 114 | - add_action( 'admin_print_scripts', array( self::$instance, 'load_script' ) ); |
|
| 115 | - add_action( 'wp_ajax_dnh_dismiss_notice', array( self::$instance, 'dismiss_notice_ajax' ) ); |
|
| 113 | + add_action('admin_notices', array(self::$instance, 'display')); |
|
| 114 | + add_action('admin_print_scripts', array(self::$instance, 'load_script')); |
|
| 115 | + add_action('wp_ajax_dnh_dismiss_notice', array(self::$instance, 'dismiss_notice_ajax')); |
|
| 116 | 116 | |
| 117 | 117 | } |
| 118 | 118 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | private function is_wp_compatible() { |
| 126 | 126 | |
| 127 | - if ( version_compare( get_bloginfo( 'version' ), self::$instance->wordpress_version_required, '<' ) ) { |
|
| 127 | + if (version_compare(get_bloginfo('version'), self::$instance->wordpress_version_required, '<')) { |
|
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | private function is_php_compatible() { |
| 142 | 142 | |
| 143 | - if ( version_compare( phpversion(), self::$instance->php_version_required, '<' ) ) { |
|
| 143 | + if (version_compare(phpversion(), self::$instance->php_version_required, '<')) { |
|
| 144 | 144 | return false; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * @return void |
| 156 | 156 | */ |
| 157 | 157 | public function load_script() { |
| 158 | - wp_register_script( 'dnh', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/js/main.js', array( 'jquery' ), self::$instance->version, true ); |
|
| 159 | - wp_enqueue_script( 'dnh' ); |
|
| 158 | + wp_register_script('dnh', trailingslashit(plugin_dir_url(__FILE__)).'assets/js/main.js', array('jquery'), self::$instance->version, true); |
|
| 159 | + wp_enqueue_script('dnh'); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -167,21 +167,21 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | public function display() { |
| 169 | 169 | |
| 170 | - if ( is_null( self::$instance->notices ) || empty( self::$instance->notices ) ) { |
|
| 170 | + if (is_null(self::$instance->notices) || empty(self::$instance->notices)) { |
|
| 171 | 171 | return; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - foreach ( self::$instance->notices as $id => $notice ) { |
|
| 174 | + foreach (self::$instance->notices as $id => $notice) { |
|
| 175 | 175 | |
| 176 | - $id = self::$instance->get_id( $id ); |
|
| 176 | + $id = self::$instance->get_id($id); |
|
| 177 | 177 | |
| 178 | 178 | // Check if the notice was dismissed |
| 179 | - if ( self::$instance->is_dismissed( $id ) ) { |
|
| 179 | + if (self::$instance->is_dismissed($id)) { |
|
| 180 | 180 | continue; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // Check if the current user has required capability |
| 184 | - if ( ! empty( $notice['cap'] ) && ! current_user_can( $notice['cap'] ) ) { |
|
| 184 | + if ( ! empty($notice['cap']) && ! current_user_can($notice['cap'])) { |
|
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $notice['class'], |
| 193 | 193 | ); |
| 194 | 194 | |
| 195 | - printf( '<div id="%3$s" class="%1$s"><p>%2$s</p></div>', trim( implode( ' ', $class ) ), $notice['content'], "dnh-$id" ); |
|
| 195 | + printf('<div id="%3$s" class="%1$s"><p>%2$s</p></div>', trim(implode(' ', $class)), $notice['content'], "dnh-$id"); |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -207,11 +207,11 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @return void |
| 209 | 209 | */ |
| 210 | - protected function spit_error( $error ) { |
|
| 210 | + protected function spit_error($error) { |
|
| 211 | 211 | printf( |
| 212 | 212 | '<div style="margin: 20px; text-align: center;"><strong>%1$s</strong> %2$s</pre></div>', |
| 213 | - esc_html__( 'Dismissible Notices Handler Error:', 'wp-dismissible-notices-handler' ), |
|
| 214 | - wp_kses_post( $error ) |
|
| 213 | + esc_html__('Dismissible Notices Handler Error:', 'wp-dismissible-notices-handler'), |
|
| 214 | + wp_kses_post($error) |
|
| 215 | 215 | ); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -224,8 +224,8 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | * @return string |
| 226 | 226 | */ |
| 227 | - public function get_id( $id ) { |
|
| 228 | - return sanitize_key( $id ); |
|
| 227 | + public function get_id($id) { |
|
| 228 | + return sanitize_key($id); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | /** |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | 'notice-info', |
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | - return apply_filters( 'dnh_notice_types', $types ); |
|
| 249 | + return apply_filters('dnh_notice_types', $types); |
|
| 250 | 250 | |
| 251 | 251 | } |
| 252 | 252 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | 'class' => '', // Additional class to add to the notice |
| 266 | 266 | ); |
| 267 | 267 | |
| 268 | - return apply_filters( 'dnh_default_args', $args ); |
|
| 268 | + return apply_filters('dnh_default_args', $args); |
|
| 269 | 269 | |
| 270 | 270 | } |
| 271 | 271 | |
@@ -281,23 +281,23 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @return bool |
| 283 | 283 | */ |
| 284 | - public function register_notice( $id, $type, $content, $args = array() ) { |
|
| 284 | + public function register_notice($id, $type, $content, $args = array()) { |
|
| 285 | 285 | |
| 286 | - if ( is_null( self::$instance->notices ) ) { |
|
| 286 | + if (is_null(self::$instance->notices)) { |
|
| 287 | 287 | self::$instance->notices = array(); |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - $id = self::$instance->get_id( $id ); |
|
| 291 | - $type = in_array( $t = sanitize_text_field( $type ), self::$instance->get_types() ) ? $t : 'updated'; |
|
| 292 | - $content = wp_kses_post( $content ); |
|
| 293 | - $args = wp_parse_args( $args, self::$instance->default_args() ); |
|
| 290 | + $id = self::$instance->get_id($id); |
|
| 291 | + $type = in_array($t = sanitize_text_field($type), self::$instance->get_types()) ? $t : 'updated'; |
|
| 292 | + $content = wp_kses_post($content); |
|
| 293 | + $args = wp_parse_args($args, self::$instance->default_args()); |
|
| 294 | 294 | |
| 295 | - if ( array_key_exists( $id, self::$instance->notices ) ) { |
|
| 295 | + if (array_key_exists($id, self::$instance->notices)) { |
|
| 296 | 296 | |
| 297 | 297 | self::$instance->spit_error( |
| 298 | 298 | sprintf( |
| 299 | 299 | /* translators: %s: required php version */ |
| 300 | - esc_html__( 'A notice with the ID %s has already been registered.', 'wp-dismissible-notices-handler' ), |
|
| 300 | + esc_html__('A notice with the ID %s has already been registered.', 'wp-dismissible-notices-handler'), |
|
| 301 | 301 | "<code>$id</code>" |
| 302 | 302 | ) |
| 303 | 303 | ); |
@@ -310,9 +310,9 @@ discard block |
||
| 310 | 310 | 'content' => $content, |
| 311 | 311 | ); |
| 312 | 312 | |
| 313 | - $notice = array_merge( $notice, $args ); |
|
| 313 | + $notice = array_merge($notice, $args); |
|
| 314 | 314 | |
| 315 | - self::$instance->notices[ $id ] = $notice; |
|
| 315 | + self::$instance->notices[$id] = $notice; |
|
| 316 | 316 | |
| 317 | 317 | return true; |
| 318 | 318 | |
@@ -326,19 +326,19 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | public function dismiss_notice_ajax() { |
| 328 | 328 | |
| 329 | - if ( ! isset( $_POST['id'] ) ) { |
|
| 329 | + if ( ! isset($_POST['id'])) { |
|
| 330 | 330 | echo 0; |
| 331 | 331 | exit; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if ( empty( $_POST['id'] ) || false === strpos( $_POST['id'], 'dnh-' ) ) { |
|
| 334 | + if (empty($_POST['id']) || false === strpos($_POST['id'], 'dnh-')) { |
|
| 335 | 335 | echo 0; |
| 336 | 336 | exit; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $id = self::$instance->get_id( str_replace( 'dnh-', '', $_POST['id'] ) ); |
|
| 339 | + $id = self::$instance->get_id(str_replace('dnh-', '', $_POST['id'])); |
|
| 340 | 340 | |
| 341 | - echo self::$instance->dismiss_notice( $id ); |
|
| 341 | + echo self::$instance->dismiss_notice($id); |
|
| 342 | 342 | exit; |
| 343 | 343 | |
| 344 | 344 | } |
@@ -352,19 +352,19 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @return bool |
| 354 | 354 | */ |
| 355 | - public function dismiss_notice( $id ) { |
|
| 355 | + public function dismiss_notice($id) { |
|
| 356 | 356 | |
| 357 | - $notice = self::$instance->get_notice( self::$instance->get_id( $id ) ); |
|
| 357 | + $notice = self::$instance->get_notice(self::$instance->get_id($id)); |
|
| 358 | 358 | |
| 359 | - if ( false === $notice ) { |
|
| 359 | + if (false === $notice) { |
|
| 360 | 360 | return false; |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - if ( self::$instance->is_dismissed( $id ) ) { |
|
| 363 | + if (self::$instance->is_dismissed($id)) { |
|
| 364 | 364 | return false; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - return 'user' === $notice['scope'] ? self::$instance->dismiss_user( $id ) : self::$instance->dismiss_global( $id ); |
|
| 367 | + return 'user' === $notice['scope'] ? self::$instance->dismiss_user($id) : self::$instance->dismiss_global($id); |
|
| 368 | 368 | |
| 369 | 369 | } |
| 370 | 370 | |
@@ -377,17 +377,17 @@ discard block |
||
| 377 | 377 | * |
| 378 | 378 | * @return int|bool |
| 379 | 379 | */ |
| 380 | - private function dismiss_user( $id ) { |
|
| 380 | + private function dismiss_user($id) { |
|
| 381 | 381 | |
| 382 | 382 | $dismissed = self::$instance->dismissed_user(); |
| 383 | 383 | |
| 384 | - if ( in_array( $id, $dismissed ) ) { |
|
| 384 | + if (in_array($id, $dismissed)) { |
|
| 385 | 385 | return false; |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | - array_push( $dismissed, $id ); |
|
| 388 | + array_push($dismissed, $id); |
|
| 389 | 389 | |
| 390 | - return update_user_meta( get_current_user_id(), 'dnh_dismissed_notices', $dismissed ); |
|
| 390 | + return update_user_meta(get_current_user_id(), 'dnh_dismissed_notices', $dismissed); |
|
| 391 | 391 | |
| 392 | 392 | } |
| 393 | 393 | |
@@ -400,17 +400,17 @@ discard block |
||
| 400 | 400 | * |
| 401 | 401 | * @return bool |
| 402 | 402 | */ |
| 403 | - private function dismiss_global( $id ) { |
|
| 403 | + private function dismiss_global($id) { |
|
| 404 | 404 | |
| 405 | 405 | $dismissed = self::$instance->dismissed_global(); |
| 406 | 406 | |
| 407 | - if ( in_array( $id, $dismissed ) ) { |
|
| 407 | + if (in_array($id, $dismissed)) { |
|
| 408 | 408 | return false; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - array_push( $dismissed, $id ); |
|
| 411 | + array_push($dismissed, $id); |
|
| 412 | 412 | |
| 413 | - return update_option( 'dnh_dismissed_notices', $dismissed ); |
|
| 413 | + return update_option('dnh_dismissed_notices', $dismissed); |
|
| 414 | 414 | |
| 415 | 415 | } |
| 416 | 416 | |
@@ -423,16 +423,16 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @return bool |
| 425 | 425 | */ |
| 426 | - public function restore_notice( $id ) { |
|
| 426 | + public function restore_notice($id) { |
|
| 427 | 427 | |
| 428 | - $id = self::$instance->get_id( $id ); |
|
| 429 | - $notice = self::$instance->get_notice( $id ); |
|
| 428 | + $id = self::$instance->get_id($id); |
|
| 429 | + $notice = self::$instance->get_notice($id); |
|
| 430 | 430 | |
| 431 | - if ( false === $notice ) { |
|
| 431 | + if (false === $notice) { |
|
| 432 | 432 | return false; |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - return 'user' === $notice['scope'] ? self::$instance->restore_user( $id ) : self::$instance->restore_global( $id ); |
|
| 435 | + return 'user' === $notice['scope'] ? self::$instance->restore_user($id) : self::$instance->restore_global($id); |
|
| 436 | 436 | |
| 437 | 437 | } |
| 438 | 438 | |
@@ -445,27 +445,27 @@ discard block |
||
| 445 | 445 | * |
| 446 | 446 | * @return bool |
| 447 | 447 | */ |
| 448 | - private function restore_user( $id ) { |
|
| 448 | + private function restore_user($id) { |
|
| 449 | 449 | |
| 450 | - $id = self::$instance->get_id( $id ); |
|
| 451 | - $notice = self::$instance->get_notice( $id ); |
|
| 450 | + $id = self::$instance->get_id($id); |
|
| 451 | + $notice = self::$instance->get_notice($id); |
|
| 452 | 452 | |
| 453 | - if ( false === $notice ) { |
|
| 453 | + if (false === $notice) { |
|
| 454 | 454 | return false; |
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | $dismissed = self::$instance->dismissed_user(); |
| 458 | 458 | |
| 459 | - if ( ! in_array( $id, $dismissed ) ) { |
|
| 459 | + if ( ! in_array($id, $dismissed)) { |
|
| 460 | 460 | return false; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - $flip = array_flip( $dismissed ); |
|
| 464 | - $key = $flip[ $id ]; |
|
| 463 | + $flip = array_flip($dismissed); |
|
| 464 | + $key = $flip[$id]; |
|
| 465 | 465 | |
| 466 | - unset( $dismissed[ $key ] ); |
|
| 466 | + unset($dismissed[$key]); |
|
| 467 | 467 | |
| 468 | - return update_user_meta( get_current_user_id(), 'dnh_dismissed_notices', $dismissed ); |
|
| 468 | + return update_user_meta(get_current_user_id(), 'dnh_dismissed_notices', $dismissed); |
|
| 469 | 469 | |
| 470 | 470 | } |
| 471 | 471 | |
@@ -478,27 +478,27 @@ discard block |
||
| 478 | 478 | * |
| 479 | 479 | * @return bool |
| 480 | 480 | */ |
| 481 | - private function restore_global( $id ) { |
|
| 481 | + private function restore_global($id) { |
|
| 482 | 482 | |
| 483 | - $id = self::$instance->get_id( $id ); |
|
| 484 | - $notice = self::$instance->get_notice( $id ); |
|
| 483 | + $id = self::$instance->get_id($id); |
|
| 484 | + $notice = self::$instance->get_notice($id); |
|
| 485 | 485 | |
| 486 | - if ( false === $notice ) { |
|
| 486 | + if (false === $notice) { |
|
| 487 | 487 | return false; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | $dismissed = self::$instance->dismissed_global(); |
| 491 | 491 | |
| 492 | - if ( ! in_array( $id, $dismissed ) ) { |
|
| 492 | + if ( ! in_array($id, $dismissed)) { |
|
| 493 | 493 | return false; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - $flip = array_flip( $dismissed ); |
|
| 497 | - $key = $flip[ $id ]; |
|
| 496 | + $flip = array_flip($dismissed); |
|
| 497 | + $key = $flip[$id]; |
|
| 498 | 498 | |
| 499 | - unset( $dismissed[ $key ] ); |
|
| 499 | + unset($dismissed[$key]); |
|
| 500 | 500 | |
| 501 | - return update_option( 'dnh_dismissed_notices', $dismissed ); |
|
| 501 | + return update_option('dnh_dismissed_notices', $dismissed); |
|
| 502 | 502 | |
| 503 | 503 | } |
| 504 | 504 | |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | $user = self::$instance->dismissed_user(); |
| 516 | 516 | $global = self::$instance->dismissed_global(); |
| 517 | 517 | |
| 518 | - return array_merge( $user, $global ); |
|
| 518 | + return array_merge($user, $global); |
|
| 519 | 519 | |
| 520 | 520 | } |
| 521 | 521 | |
@@ -527,9 +527,9 @@ discard block |
||
| 527 | 527 | */ |
| 528 | 528 | private function dismissed_user() { |
| 529 | 529 | |
| 530 | - $dismissed = get_user_meta( get_current_user_id(), 'dnh_dismissed_notices', true ); |
|
| 530 | + $dismissed = get_user_meta(get_current_user_id(), 'dnh_dismissed_notices', true); |
|
| 531 | 531 | |
| 532 | - if ( '' === $dismissed ) { |
|
| 532 | + if ('' === $dismissed) { |
|
| 533 | 533 | $dismissed = array(); |
| 534 | 534 | } |
| 535 | 535 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | * @return array |
| 545 | 545 | */ |
| 546 | 546 | private function dismissed_global() { |
| 547 | - return get_option( 'dnh_dismissed_notices', array() ); |
|
| 547 | + return get_option('dnh_dismissed_notices', array()); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /** |
@@ -556,11 +556,11 @@ discard block |
||
| 556 | 556 | * |
| 557 | 557 | * @return bool |
| 558 | 558 | */ |
| 559 | - public function is_dismissed( $id ) { |
|
| 559 | + public function is_dismissed($id) { |
|
| 560 | 560 | |
| 561 | 561 | $dismissed = self::$instance->dismissed_notices(); |
| 562 | 562 | |
| 563 | - if ( ! in_array( self::$instance->get_id( $id ), $dismissed ) ) { |
|
| 563 | + if ( ! in_array(self::$instance->get_id($id), $dismissed)) { |
|
| 564 | 564 | return false; |
| 565 | 565 | } |
| 566 | 566 | |
@@ -587,15 +587,15 @@ discard block |
||
| 587 | 587 | * |
| 588 | 588 | * @return array|false |
| 589 | 589 | */ |
| 590 | - public function get_notice( $id ) { |
|
| 590 | + public function get_notice($id) { |
|
| 591 | 591 | |
| 592 | - $id = self::$instance->get_id( $id ); |
|
| 592 | + $id = self::$instance->get_id($id); |
|
| 593 | 593 | |
| 594 | - if ( ! is_array( self::$instance->notices ) || ! array_key_exists( $id, self::$instance->notices ) ) { |
|
| 594 | + if ( ! is_array(self::$instance->notices) || ! array_key_exists($id, self::$instance->notices)) { |
|
| 595 | 595 | return false; |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - return self::$instance->notices[ $id ]; |
|
| 598 | + return self::$instance->notices[$id]; |
|
| 599 | 599 | |
| 600 | 600 | } |
| 601 | 601 | |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return bool |
| 44 | 44 | */ |
| 45 | -function dnh_register_notice( $id, $type, $content, $args = array() ) { |
|
| 45 | +function dnh_register_notice($id, $type, $content, $args = array()) { |
|
| 46 | 46 | |
| 47 | - if ( ! function_exists( 'DNH' ) ) { |
|
| 47 | + if ( ! function_exists('DNH')) { |
|
| 48 | 48 | return false; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | DNH(); |
| 55 | 55 | |
| 56 | - return DNH()->register_notice( $id, $type, $content, $args ); |
|
| 56 | + return DNH()->register_notice($id, $type, $content, $args); |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return bool |
| 68 | 68 | */ |
| 69 | -function dnh_restore_notice( $id ) { |
|
| 69 | +function dnh_restore_notice($id) { |
|
| 70 | 70 | |
| 71 | - if ( ! function_exists( 'DNH' ) ) { |
|
| 71 | + if ( ! function_exists('DNH')) { |
|
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | DNH(); |
| 79 | 79 | |
| 80 | - return DNH()->restore_notice( $id ); |
|
| 80 | + return DNH()->restore_notice($id); |
|
| 81 | 81 | |
| 82 | 82 | } |
| 83 | 83 | |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return bool |
| 92 | 92 | */ |
| 93 | -function dnh_is_dismissed( $id ) { |
|
| 93 | +function dnh_is_dismissed($id) { |
|
| 94 | 94 | |
| 95 | - if ( ! function_exists( 'DNH' ) ) { |
|
| 95 | + if ( ! function_exists('DNH')) { |
|
| 96 | 96 | return false; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,6 +101,6 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | DNH(); |
| 103 | 103 | |
| 104 | - return DNH()->is_dismissed( $id ); |
|
| 104 | + return DNH()->is_dismissed($id); |
|
| 105 | 105 | |
| 106 | 106 | } |