@@ -8,8 +8,9 @@ |
||
| 8 | 8 | $plugin = basename(\PodloveSubscribeButton\PLUGIN_DIR) . '/' . \PodloveSubscribeButton\PLUGIN_FILE_NAME; |
| 9 | 9 | $blogids = $wpdb->get_col("SELECT blog_id FROM " . $wpdb->blogs); |
| 10 | 10 | |
| 11 | - if (!is_array($blogids)) |
|
| 12 | - return; |
|
| 11 | + if (!is_array($blogids)) { |
|
| 12 | + return; |
|
| 13 | + } |
|
| 13 | 14 | |
| 14 | 15 | foreach ($blogids as $blog_id) { |
| 15 | 16 | switch_to_blog($blog_id); |
@@ -389,14 +389,14 @@ discard block |
||
| 389 | 389 | $this->set_defaults(); |
| 390 | 390 | |
| 391 | 391 | $sql = 'INSERT INTO ' |
| 392 | - . static::table_name() |
|
| 393 | - . ' ( ' |
|
| 394 | - . implode( ',', static::property_names() ) |
|
| 395 | - . ' ) ' |
|
| 396 | - . 'VALUES' |
|
| 397 | - . ' ( ' |
|
| 398 | - . implode( ',', array_map( array( $this, 'property_name_to_sql_value' ), static::property_names() ) ) |
|
| 399 | - . ' );' |
|
| 392 | + . static::table_name() |
|
| 393 | + . ' ( ' |
|
| 394 | + . implode( ',', static::property_names() ) |
|
| 395 | + . ' ) ' |
|
| 396 | + . 'VALUES' |
|
| 397 | + . ' ( ' |
|
| 398 | + . implode( ',', array_map( array( $this, 'property_name_to_sql_value' ), static::property_names() ) ) |
|
| 399 | + . ' );' |
|
| 400 | 400 | ; |
| 401 | 401 | $success = $wpdb->query( $sql ); |
| 402 | 402 | if ( $success ) { |
@@ -404,9 +404,9 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | } else { |
| 406 | 406 | $sql = 'UPDATE ' . static::table_name() |
| 407 | - . ' SET ' |
|
| 408 | - . implode( ',', array_map( array( $this, 'property_name_to_sql_update_statement' ), static::property_names() ) ) |
|
| 409 | - . ' WHERE id = ' . $this->id |
|
| 407 | + . ' SET ' |
|
| 408 | + . implode( ',', array_map( array( $this, 'property_name_to_sql_update_statement' ), static::property_names() ) ) |
|
| 409 | + . ' WHERE id = ' . $this->id |
|
| 410 | 410 | ; |
| 411 | 411 | |
| 412 | 412 | $success = $wpdb->query( $sql ); |
@@ -454,13 +454,13 @@ discard block |
||
| 454 | 454 | global $wpdb; |
| 455 | 455 | |
| 456 | 456 | $sql = 'DELETE FROM ' |
| 457 | - . static::table_name() |
|
| 458 | - . ' WHERE id = ' . $this->id; |
|
| 457 | + . static::table_name() |
|
| 458 | + . ' WHERE id = ' . $this->id; |
|
| 459 | 459 | |
| 460 | 460 | $rows_affected = $wpdb->query( $sql ); |
| 461 | 461 | |
| 462 | - do_action('podlove_model_delete', $this); |
|
| 463 | - do_action('podlove_model_change', $this); |
|
| 462 | + do_action('podlove_model_delete', $this); |
|
| 463 | + do_action('podlove_model_change', $this); |
|
| 464 | 464 | |
| 465 | 465 | return $rows_affected !== false; |
| 466 | 466 | } |
@@ -499,10 +499,10 @@ discard block |
||
| 499 | 499 | $property_sql[] = "`{$property['name']}` {$property['type']}"; |
| 500 | 500 | |
| 501 | 501 | $sql = 'CREATE TABLE IF NOT EXISTS ' |
| 502 | - . static::table_name() |
|
| 503 | - . ' (' |
|
| 504 | - . implode( ',', $property_sql ) |
|
| 505 | - . ' ) CHARACTER SET utf8;' |
|
| 502 | + . static::table_name() |
|
| 503 | + . ' (' |
|
| 504 | + . implode( ',', $property_sql ) |
|
| 505 | + . ' ) CHARACTER SET utf8;' |
|
| 506 | 506 | ; |
| 507 | 507 | |
| 508 | 508 | $wpdb->query( $sql ); |
@@ -45,11 +45,13 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | private static function unserialize_property($property) { |
| 48 | - if ( ! isset($property) ) |
|
| 49 | - return; |
|
| 48 | + if ( ! isset($property) ) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | - if ( $unserialized_string = is_serialized($property) ) |
|
| 52 | - return unserialize($property); |
|
| 52 | + if ( $unserialized_string = is_serialized($property) ) { |
|
| 53 | + return unserialize($property); |
|
| 54 | + } |
|
| 53 | 55 | |
| 54 | 56 | return $property; |
| 55 | 57 | } |
@@ -319,8 +321,9 @@ discard block |
||
| 319 | 321 | */ |
| 320 | 322 | public function update_attributes( $attributes ) { |
| 321 | 323 | |
| 322 | - if ( ! is_array( $attributes ) ) |
|
| 323 | - return false; |
|
| 324 | + if ( ! is_array( $attributes ) ) { |
|
| 325 | + return false; |
|
| 326 | + } |
|
| 324 | 327 | |
| 325 | 328 | $request = filter_input_array(INPUT_POST); // Do this for security reasons |
| 326 | 329 | |
@@ -429,12 +432,14 @@ discard block |
||
| 429 | 432 | |
| 430 | 433 | $defaults = $this->default_values(); |
| 431 | 434 | |
| 432 | - if ( ! is_array( $defaults ) || empty( $defaults ) ) |
|
| 433 | - return; |
|
| 435 | + if ( ! is_array( $defaults ) || empty( $defaults ) ) { |
|
| 436 | + return; |
|
| 437 | + } |
|
| 434 | 438 | |
| 435 | 439 | foreach ( $defaults as $property => $value ) { |
| 436 | - if ( $this->$property === null ) |
|
| 437 | - $this->$property = $value; |
|
| 440 | + if ( $this->$property === null ) { |
|
| 441 | + $this->$property = $value; |
|
| 442 | + } |
|
| 438 | 443 | } |
| 439 | 444 | |
| 440 | 445 | } |
@@ -495,8 +500,9 @@ discard block |
||
| 495 | 500 | global $wpdb; |
| 496 | 501 | |
| 497 | 502 | $property_sql = array(); |
| 498 | - foreach ( static::properties() as $property ) |
|
| 499 | - $property_sql[] = "`{$property['name']}` {$property['type']}"; |
|
| 503 | + foreach ( static::properties() as $property ) { |
|
| 504 | + $property_sql[] = "`{$property['name']}` {$property['type']}"; |
|
| 505 | + } |
|
| 500 | 506 | |
| 501 | 507 | $sql = 'CREATE TABLE IF NOT EXISTS ' |
| 502 | 508 | . static::table_name() |
@@ -55,8 +55,9 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | function run_database_migrations() { |
| 58 | - if (get_option('podlove_subscribe_button_plugin_database_version') >= DATABASE_VERSION) |
|
| 59 | - return; |
|
| 58 | + if (get_option('podlove_subscribe_button_plugin_database_version') >= DATABASE_VERSION) { |
|
| 59 | + return; |
|
| 60 | + } |
|
| 60 | 61 | |
| 61 | 62 | if (is_multisite()) { |
| 62 | 63 | set_time_limit(0); // may take a while, depending on network size |
@@ -74,7 +75,7 @@ discard block |
||
| 74 | 75 | function migrate_for_current_blog() { |
| 75 | 76 | $database_version = get_option('podlove_subscribe_button_plugin_database_version'); |
| 76 | 77 | |
| 77 | - for ($i = $database_version+1; $i <= DATABASE_VERSION; $i++) { |
|
| 78 | + for ($i = $database_version+1; $i <= DATABASE_VERSION; $i++) { |
|
| 78 | 79 | \PodloveSubscribeButton\run_migrations_for_version($i); |
| 79 | 80 | update_option('podlove_subscribe_button_plugin_database_version', $i); |
| 80 | 81 | } |
@@ -39,8 +39,9 @@ discard block |
||
| 39 | 39 | require('helper.php'); |
| 40 | 40 | |
| 41 | 41 | add_action( 'admin_menu', array( 'PodloveSubscribeButton', 'admin_menu') ); |
| 42 | -if ( is_multisite() ) |
|
| 42 | +if ( is_multisite() ) { |
|
| 43 | 43 | add_action( 'network_admin_menu', array( 'PodloveSubscribeButton', 'admin_network_menu') ); |
| 44 | +} |
|
| 44 | 45 | |
| 45 | 46 | add_action( 'admin_init', array( 'PodloveSubscribeButton\Settings\Buttons', 'process_form' ) ); |
| 46 | 47 | register_activation_hook( __FILE__, array( 'PodloveSubscribeButton', 'build_models' ) ); |
@@ -121,8 +122,9 @@ discard block |
||
| 121 | 122 | public static function build_models() { |
| 122 | 123 | // Build Databases |
| 123 | 124 | \PodloveSubscribeButton\Model\Button::build(); |
| 124 | - if ( is_multisite() ) |
|
| 125 | - \PodloveSubscribeButton\Model\NetworkButton::build(); |
|
| 125 | + if ( is_multisite() ) { |
|
| 126 | + \PodloveSubscribeButton\Model\NetworkButton::build(); |
|
| 127 | + } |
|
| 126 | 128 | |
| 127 | 129 | // Set Button "default" values |
| 128 | 130 | $default_values = array( |
@@ -148,8 +150,9 @@ discard block |
||
| 148 | 150 | } |
| 149 | 151 | |
| 150 | 152 | // Fetch the (network)button by it's name |
| 151 | - if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) ) |
|
| 152 | - return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] ); |
|
| 153 | + if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($args['button']) ) { |
|
| 154 | + return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] ); |
|
| 155 | + } |
|
| 153 | 156 | |
| 154 | 157 | // Get button styling and options |
| 155 | 158 | $autowidth = self::interpret_width_attribute( self::get_array_value_with_fallback($args, 'width') ); |
@@ -181,8 +184,9 @@ discard block |
||
| 181 | 184 | } |
| 182 | 185 | |
| 183 | 186 | public static function get_array_value_with_fallback($args, $key) { |
| 184 | - if ( isset($args[$key]) ) |
|
| 185 | - return $args[$key]; |
|
| 187 | + if ( isset($args[$key]) ) { |
|
| 188 | + return $args[$key]; |
|
| 189 | + } |
|
| 186 | 190 | |
| 187 | 191 | return false; |
| 188 | 192 | } |
@@ -206,10 +210,12 @@ discard block |
||
| 206 | 210 | * @return string |
| 207 | 211 | */ |
| 208 | 212 | private static function interpret_width_attribute( $width_attribute = null ) { |
| 209 | - if ( $width_attribute == 'auto' ) |
|
| 210 | - return 'on'; |
|
| 211 | - if ( $width_attribute && $width_attribute !== 'auto' ) |
|
| 212 | - return 'off'; |
|
| 213 | + if ( $width_attribute == 'auto' ) { |
|
| 214 | + return 'on'; |
|
| 215 | + } |
|
| 216 | + if ( $width_attribute && $width_attribute !== 'auto' ) { |
|
| 217 | + return 'off'; |
|
| 218 | + } |
|
| 213 | 219 | |
| 214 | 220 | return get_option('podlove_subscribe_button_default_autowidth', 'on'); |
| 215 | 221 | } |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public function form( $instance ) { |
| 50 | 50 | |
| 51 | - $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : ''; |
|
| 52 | - $button = isset( $instance[ 'button' ] ) ? $instance[ 'button' ] : ''; |
|
| 53 | - $size = isset( $instance[ 'size' ] ) ? $instance[ 'size' ] : 'big'; |
|
| 54 | - $style = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : 'filled'; |
|
| 55 | - $format = isset( $instance[ 'format' ] ) ? $instance[ 'format' ] : 'cover'; |
|
| 56 | - $autowidth = isset( $instance[ 'autowidth' ] ) ? $instance[ 'autowidth' ] : true; |
|
| 57 | - $infotext = isset( $instance[ 'infotext' ] ) ? $instance[ 'infotext' ] : ''; |
|
| 58 | - $color = isset( $instance[ 'color' ] ) ? $instance[ 'color' ] : '#75ad91'; |
|
| 51 | + $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : ''; |
|
| 52 | + $button = isset( $instance[ 'button' ] ) ? $instance[ 'button' ] : ''; |
|
| 53 | + $size = isset( $instance[ 'size' ] ) ? $instance[ 'size' ] : 'big'; |
|
| 54 | + $style = isset( $instance[ 'style' ] ) ? $instance[ 'style' ] : 'filled'; |
|
| 55 | + $format = isset( $instance[ 'format' ] ) ? $instance[ 'format' ] : 'cover'; |
|
| 56 | + $autowidth = isset( $instance[ 'autowidth' ] ) ? $instance[ 'autowidth' ] : true; |
|
| 57 | + $infotext = isset( $instance[ 'infotext' ] ) ? $instance[ 'infotext' ] : ''; |
|
| 58 | + $color = isset( $instance[ 'color' ] ) ? $instance[ 'color' ] : '#75ad91'; |
|
| 59 | 59 | |
| 60 | 60 | $buttons = \PodloveSubscribeButton\Model\Button::all(); |
| 61 | 61 | if ( is_multisite() ) |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | foreach ($buttons as $subscribebutton) { |
| 86 | 86 | echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>"; |
| 87 | 87 | } |
| 88 | - ?> |
|
| 88 | + ?> |
|
| 89 | 89 | </optgroup> |
| 90 | 90 | <optgroup label="<?php _e('Network', 'podlove'); ?>"> |
| 91 | 91 | <?php |
| 92 | 92 | foreach ($network_buttons as $subscribebutton) { |
| 93 | 93 | echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>"; |
| 94 | 94 | } |
| 95 | - ?> |
|
| 95 | + ?> |
|
| 96 | 96 | </optgroup> |
| 97 | 97 | <?php else : |
| 98 | 98 | foreach ($buttons as $subscribebutton) { |
@@ -150,5 +150,5 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | add_action( 'widgets_init', function(){ |
| 153 | - register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' ); |
|
| 153 | + register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' ); |
|
| 154 | 154 | }); |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function widget( $args, $instance ) { |
| 28 | 28 | // Fetch the (network)button by it's name |
| 29 | - if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) ) |
|
| 30 | - return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] ); |
|
| 29 | + if ( ! $button = \PodloveSubscribeButton\Model\Button::get_button_by_name($instance['button']) ) { |
|
| 30 | + return sprintf( __('Oops. There is no button with the ID "%s".', 'podlove-subscribe-button'), $args['button'] ); |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | 33 | echo $args['before_widget']; |
| 33 | 34 | echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title']; |
@@ -40,8 +41,9 @@ discard block |
||
| 40 | 41 | \PodloveSubscribeButton::get_array_value_with_fallback($instance, 'color') |
| 41 | 42 | ); |
| 42 | 43 | |
| 43 | - if ( strlen($instance['infotext']) ) |
|
| 44 | - echo wpautop($instance['infotext']); |
|
| 44 | + if ( strlen($instance['infotext']) ) { |
|
| 45 | + echo wpautop($instance['infotext']); |
|
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | echo $args['after_widget']; |
| 47 | 49 | } |
@@ -58,8 +60,9 @@ discard block |
||
| 58 | 60 | $color = isset( $instance[ 'color' ] ) ? $instance[ 'color' ] : '#75ad91'; |
| 59 | 61 | |
| 60 | 62 | $buttons = \PodloveSubscribeButton\Model\Button::all(); |
| 61 | - if ( is_multisite() ) |
|
| 62 | - $network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all(); |
|
| 63 | + if ( is_multisite() ) { |
|
| 64 | + $network_buttons = \PodloveSubscribeButton\Model\NetworkButton::all(); |
|
| 65 | + } |
|
| 63 | 66 | ?> |
| 64 | 67 | <p> |
| 65 | 68 | <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'podlove-subscribe-button' ); ?></label> |
@@ -94,9 +97,11 @@ discard block |
||
| 94 | 97 | } |
| 95 | 98 | ?> |
| 96 | 99 | </optgroup> |
| 97 | - <?php else : |
|
| 100 | + <?php else { |
|
| 101 | + : |
|
| 98 | 102 | foreach ($buttons as $subscribebutton) { |
| 99 | 103 | echo "<option value='" . sanitize_title($subscribebutton->name) . "' " . selected( sanitize_title($subscribebutton->name), $button ) . " >" . sanitize_title($subscribebutton->title) . " (" . sanitize_title($subscribebutton->name) . ")</option>"; |
| 104 | +} |
|
| 100 | 105 | } |
| 101 | 106 | endif; ?> |
| 102 | 107 | </select> |
@@ -149,6 +154,6 @@ discard block |
||
| 149 | 154 | return $instance; |
| 150 | 155 | } |
| 151 | 156 | } |
| 152 | -add_action( 'widgets_init', function(){ |
|
| 157 | +add_action( 'widgets_init', function() { |
|
| 153 | 158 | register_widget( '\PodloveSubscribeButton\Podlove_Subscribe_Button_Widget' ); |
| 154 | 159 | }); |
@@ -105,8 +105,9 @@ discard block |
||
| 105 | 105 | private function get_feeds_as_array( $feeds=array() ) { |
| 106 | 106 | $returnedFeeds = array(); |
| 107 | 107 | |
| 108 | - if (! $feeds) |
|
| 109 | - return $returnedFeeds; |
|
| 108 | + if (! $feeds) { |
|
| 109 | + return $returnedFeeds; |
|
| 110 | + } |
|
| 110 | 111 | |
| 111 | 112 | foreach ($feeds as $feed) { |
| 112 | 113 | if ( isset(\PodloveSubscribeButton\MediaTypes::$audio[$feed['format']]['extension']) ) { |
@@ -117,8 +118,9 @@ discard block |
||
| 117 | 118 | 'variant' => 'high' |
| 118 | 119 | ); |
| 119 | 120 | |
| 120 | - if ( isset($feed['itunesfeedid']) && $feed['itunesfeedid'] > 0 ) |
|
| 121 | - $new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid']; |
|
| 121 | + if ( isset($feed['itunesfeedid']) && $feed['itunesfeedid'] > 0 ) { |
|
| 122 | + $new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid']; |
|
| 123 | + } |
|
| 122 | 124 | |
| 123 | 125 | $returnedFeeds[] = $new_feed; |
| 124 | 126 | } |
@@ -179,11 +181,13 @@ discard block |
||
| 179 | 181 | * @return string |
| 180 | 182 | */ |
| 181 | 183 | private static function interpret_autowidth_attribute($autowidth) { |
| 182 | - if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' ) |
|
| 183 | - return ''; |
|
| 184 | + if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' ) { |
|
| 185 | + return ''; |
|
| 186 | + } |
|
| 184 | 187 | |
| 185 | - if ( $autowidth !== 'default' && $autowidth !== 'on' ) |
|
| 186 | - return ''; |
|
| 188 | + if ( $autowidth !== 'default' && $autowidth !== 'on' ) { |
|
| 189 | + return ''; |
|
| 190 | + } |
|
| 187 | 191 | |
| 188 | 192 | return ' auto'; |
| 189 | 193 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | namespace PodloveSubscribeButton; |
| 3 | 3 | |
| 4 | 4 | if( ! class_exists( 'WP_List_Table' ) ){ |
| 5 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 5 | + require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
|
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | class Button_List_Table extends \WP_List_Table { |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // Set parent defaults |
| 14 | 14 | parent::__construct( array( |
| 15 | - 'singular' => 'feed', // singular name of the listed records |
|
| 16 | - 'plural' => 'feeds', // plural name of the listed records |
|
| 17 | - 'ajax' => false // does this table support ajax? |
|
| 15 | + 'singular' => 'feed', // singular name of the listed records |
|
| 16 | + 'plural' => 'feeds', // plural name of the listed records |
|
| 17 | + 'ajax' => false // does this table support ajax? |
|
| 18 | 18 | ) ); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | ); |
| 27 | 27 | |
| 28 | 28 | return sprintf('%1$s %2$s', |
| 29 | - /*$1%s*/ sanitize_title($button->title) . '<br><code>[podlove-subscribe-button button="' . sanitize_text_field($button->name) . '"]</code>', |
|
| 30 | - /*$3%s*/ $this->row_actions( $actions ) |
|
| 29 | + /*$1%s*/ sanitize_title($button->title) . '<br><code>[podlove-subscribe-button button="' . sanitize_text_field($button->name) . '"]</code>', |
|
| 30 | + /*$3%s*/ $this->row_actions( $actions ) |
|
| 31 | 31 | ); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // register pagination options & calculations |
| 91 | 91 | $this->set_pagination_args( array( |
| 92 | - 'total_items' => $total_items, |
|
| 93 | - 'per_page' => $per_page, |
|
| 94 | - 'total_pages' => ceil( $total_items / $per_page ) |
|
| 92 | + 'total_items' => $total_items, |
|
| 93 | + 'per_page' => $per_page, |
|
| 94 | + 'total_pages' => ceil( $total_items / $per_page ) |
|
| 95 | 95 | ) ); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace PodloveSubscribeButton; |
| 3 | 3 | |
| 4 | -if( ! class_exists( 'WP_List_Table' ) ){ |
|
| 4 | +if( ! class_exists( 'WP_List_Table' ) ) { |
|
| 5 | 5 | require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | class Button_List_Table extends \WP_List_Table { |
| 9 | 9 | |
| 10 | - function __construct(){ |
|
| 10 | + function __construct() { |
|
| 11 | 11 | global $status, $page; |
| 12 | 12 | |
| 13 | 13 | // Set parent defaults |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | return $button->id; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - function get_columns(){ |
|
| 60 | + function get_columns() { |
|
| 61 | 61 | return array( |
| 62 | 62 | 'name' => __( 'Title & Shortcode', 'podlove-subscribe-button' ), |
| 63 | 63 | 'button_preview' => __( 'Preview', 'podlove-subscribe-button' ), |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | if ( null == filter_input(INPUT_GET, 'button') ) |
| 49 | 49 | return; |
| 50 | 50 | |
| 51 | - if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) { |
|
| 52 | - return; |
|
| 53 | - } |
|
| 51 | + if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | $post = filter_input_array(INPUT_POST); |
| 56 | 56 | |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | if ( null === filter_input(INPUT_GET, 'button') ) |
| 112 | 112 | return; |
| 113 | 113 | |
| 114 | - $action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null ); |
|
| 114 | + $action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null ); |
|
| 115 | 115 | |
| 116 | - if (!in_array($action, ['save', 'create', 'delete'])) { |
|
| 117 | - return; |
|
| 118 | - } |
|
| 116 | + if (!in_array($action, ['save', 'create', 'delete'])) { |
|
| 117 | + return; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) { |
|
| 121 | - return; |
|
| 122 | - } |
|
| 120 | + if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) { |
|
| 121 | + return; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | 124 | if ( $action === 'save' ) { |
| 125 | 125 | self::save(); |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | filter_input(INPUT_GET, 'page'), |
| 345 | 345 | $action, |
| 346 | 346 | $button->id, |
| 347 | - wp_create_nonce(), |
|
| 347 | + wp_create_nonce(), |
|
| 348 | 348 | $type == 'button' ? ' class="button"' : '' |
| 349 | 349 | ); |
| 350 | 350 | } |
@@ -45,8 +45,9 @@ discard block |
||
| 45 | 45 | * Process form: save/update a format |
| 46 | 46 | */ |
| 47 | 47 | public static function save() { |
| 48 | - if ( null == filter_input(INPUT_GET, 'button') ) |
|
| 49 | - return; |
|
| 48 | + if ( null == filter_input(INPUT_GET, 'button') ) { |
|
| 49 | + return; |
|
| 50 | + } |
|
| 50 | 51 | |
| 51 | 52 | if (!wp_verify_nonce($_REQUEST['_psb_nonce'])) { |
| 52 | 53 | return; |
@@ -85,8 +86,9 @@ discard block |
||
| 85 | 86 | * Process form: delete a format |
| 86 | 87 | */ |
| 87 | 88 | public static function delete() { |
| 88 | - if ( null == filter_input(INPUT_GET, 'button') ) |
|
| 89 | - return; |
|
| 89 | + if ( null == filter_input(INPUT_GET, 'button') ) { |
|
| 90 | + return; |
|
| 91 | + } |
|
| 90 | 92 | |
| 91 | 93 | $button = ( filter_input(INPUT_GET, 'network') === '1' ? \PodloveSubscribeButton\Model\NetworkButton::find_by_id( filter_input(INPUT_GET, 'button') ) : \PodloveSubscribeButton\Model\Button::find_by_id( filter_input(INPUT_GET, 'button') ) ); |
| 92 | 94 | $button->delete(); |
@@ -108,8 +110,9 @@ discard block |
||
| 108 | 110 | } |
| 109 | 111 | |
| 110 | 112 | public static function process_form() { |
| 111 | - if ( null === filter_input(INPUT_GET, 'button') ) |
|
| 112 | - return; |
|
| 113 | + if ( null === filter_input(INPUT_GET, 'button') ) { |
|
| 114 | + return; |
|
| 115 | + } |
|
| 113 | 116 | |
| 114 | 117 | $action = ( null !== filter_input(INPUT_GET, 'action') ? filter_input(INPUT_GET, 'action') : null ); |
| 115 | 118 | |