@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 14 | +if ( ! defined('ABSPATH')) { |
|
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_do_ajax_export() { |
| 27 | 27 | |
| 28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/export/class-batch-export.php'; |
|
| 28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/export/class-batch-export.php'; |
|
| 29 | 29 | |
| 30 | - parse_str( $_POST['form'], $form ); |
|
| 30 | + parse_str($_POST['form'], $form); |
|
| 31 | 31 | |
| 32 | 32 | $_REQUEST = $form = (array) $form; |
| 33 | 33 | |
| 34 | - if ( ! wp_verify_nonce( $_REQUEST['give_ajax_export'], 'give_ajax_export' ) ) { |
|
| 35 | - die( '-2' ); |
|
| 34 | + if ( ! wp_verify_nonce($_REQUEST['give_ajax_export'], 'give_ajax_export')) { |
|
| 35 | + die('-2'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -42,28 +42,28 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @param string $class Export class. |
| 44 | 44 | */ |
| 45 | - do_action( 'give_batch_export_class_include', $form['give-export-class'] ); |
|
| 45 | + do_action('give_batch_export_class_include', $form['give-export-class']); |
|
| 46 | 46 | |
| 47 | - $step = absint( $_POST['step'] ); |
|
| 48 | - $class = sanitize_text_field( $form['give-export-class'] ); |
|
| 47 | + $step = absint($_POST['step']); |
|
| 48 | + $class = sanitize_text_field($form['give-export-class']); |
|
| 49 | 49 | |
| 50 | 50 | /* @var Give_Batch_Export $export */ |
| 51 | - $export = new $class( $step ); |
|
| 51 | + $export = new $class($step); |
|
| 52 | 52 | |
| 53 | - if ( ! $export->can_export() ) { |
|
| 54 | - die( '-1' ); |
|
| 53 | + if ( ! $export->can_export()) { |
|
| 54 | + die('-1'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if ( ! $export->is_writable ) { |
|
| 57 | + if ( ! $export->is_writable) { |
|
| 58 | 58 | $json_args = array( |
| 59 | 59 | 'error' => true, |
| 60 | - 'message' => esc_html__( 'Export location or file not writable.', 'give' ) |
|
| 60 | + 'message' => esc_html__('Export location or file not writable.', 'give') |
|
| 61 | 61 | ); |
| 62 | 62 | echo json_encode($json_args); |
| 63 | 63 | exit; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $export->set_properties( give_clean( $_REQUEST ) ); |
|
| 66 | + $export->set_properties(give_clean($_REQUEST)); |
|
| 67 | 67 | |
| 68 | 68 | $export->pre_fetch(); |
| 69 | 69 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $percentage = $export->get_percentage_complete(); |
| 73 | 73 | |
| 74 | - if ( $ret ) { |
|
| 74 | + if ($ret) { |
|
| 75 | 75 | |
| 76 | 76 | $step += 1; |
| 77 | 77 | $json_data = array( |
@@ -79,18 +79,17 @@ discard block |
||
| 79 | 79 | 'percentage' => $percentage |
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | - } elseif ( true === $export->is_empty ) { |
|
| 82 | + } elseif (true === $export->is_empty) { |
|
| 83 | 83 | |
| 84 | 84 | $json_data = array( |
| 85 | 85 | 'error' => true, |
| 86 | - 'message' => esc_html__( 'No data found for export parameters.', 'give' ) |
|
| 86 | + 'message' => esc_html__('No data found for export parameters.', 'give') |
|
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | - } elseif ( true === $export->done && true === $export->is_void ) { |
|
| 89 | + } elseif (true === $export->done && true === $export->is_void) { |
|
| 90 | 90 | |
| 91 | - $message = ! empty( $export->message ) ? |
|
| 92 | - $export->message : |
|
| 93 | - esc_html__( 'Batch Processing Complete', 'give' ); |
|
| 91 | + $message = ! empty($export->message) ? |
|
| 92 | + $export->message : esc_html__('Batch Processing Complete', 'give'); |
|
| 94 | 93 | |
| 95 | 94 | $json_data = array( |
| 96 | 95 | 'success' => true, |
@@ -99,23 +98,23 @@ discard block |
||
| 99 | 98 | |
| 100 | 99 | } else { |
| 101 | 100 | |
| 102 | - $args = array_merge( $_REQUEST, array( |
|
| 101 | + $args = array_merge($_REQUEST, array( |
|
| 103 | 102 | 'step' => $step, |
| 104 | 103 | 'class' => $class, |
| 105 | - 'nonce' => wp_create_nonce( 'give-batch-export' ), |
|
| 104 | + 'nonce' => wp_create_nonce('give-batch-export'), |
|
| 106 | 105 | 'give_action' => 'form_batch_export', |
| 107 | - ) ); |
|
| 106 | + )); |
|
| 108 | 107 | |
| 109 | 108 | $json_data = array( |
| 110 | 109 | 'step' => 'done', |
| 111 | - 'url' => add_query_arg( $args, admin_url() ) |
|
| 110 | + 'url' => add_query_arg($args, admin_url()) |
|
| 112 | 111 | ); |
| 113 | 112 | |
| 114 | 113 | } |
| 115 | 114 | |
| 116 | - $export->unset_properties( give_clean( $_REQUEST ), $export ); |
|
| 117 | - echo json_encode( $json_data ); |
|
| 115 | + $export->unset_properties(give_clean($_REQUEST), $export); |
|
| 116 | + echo json_encode($json_data); |
|
| 118 | 117 | exit; |
| 119 | 118 | } |
| 120 | 119 | |
| 121 | -add_action( 'wp_ajax_give_do_ajax_export', 'give_do_ajax_export' ); |
|
| 120 | +add_action('wp_ajax_give_do_ajax_export', 'give_do_ajax_export'); |
|
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -118,14 +118,14 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @param int $_step |
| 120 | 120 | */ |
| 121 | - public function __construct( $_step = 1 ) { |
|
| 121 | + public function __construct($_step = 1) { |
|
| 122 | 122 | |
| 123 | 123 | $upload_dir = wp_upload_dir(); |
| 124 | 124 | $this->filetype = '.csv'; |
| 125 | - $this->filename = 'give-' . $this->export_type . $this->filetype; |
|
| 126 | - $this->file = trailingslashit( $upload_dir['basedir'] ) . $this->filename; |
|
| 125 | + $this->filename = 'give-'.$this->export_type.$this->filetype; |
|
| 126 | + $this->file = trailingslashit($upload_dir['basedir']).$this->filename; |
|
| 127 | 127 | |
| 128 | - if ( ! is_writeable( $upload_dir['basedir'] ) ) { |
|
| 128 | + if ( ! is_writeable($upload_dir['basedir'])) { |
|
| 129 | 129 | $this->is_writable = false; |
| 130 | 130 | } |
| 131 | 131 | |
@@ -141,22 +141,22 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | public function process_step() { |
| 143 | 143 | |
| 144 | - if ( ! $this->can_export() ) { |
|
| 145 | - wp_die( esc_html__( 'You do not have permission to export data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 144 | + if ( ! $this->can_export()) { |
|
| 145 | + wp_die(esc_html__('You do not have permission to export data.', 'give'), esc_html__('Error', 'give'), array( |
|
| 146 | 146 | 'response' => 403, |
| 147 | - ) ); |
|
| 147 | + )); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if ( $this->step < 2 ) { |
|
| 150 | + if ($this->step < 2) { |
|
| 151 | 151 | |
| 152 | 152 | // Make sure we start with a fresh file on step 1. |
| 153 | - @unlink( $this->file ); |
|
| 153 | + @unlink($this->file); |
|
| 154 | 154 | $this->print_csv_cols(); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $rows = $this->print_csv_rows(); |
| 158 | 158 | |
| 159 | - if ( $rows ) { |
|
| 159 | + if ($rows) { |
|
| 160 | 160 | return true; |
| 161 | 161 | } else { |
| 162 | 162 | return false; |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | $col_data = ''; |
| 177 | 177 | $cols = $this->get_csv_cols(); |
| 178 | 178 | $i = 1; |
| 179 | - foreach ( $cols as $col_id => $column ) { |
|
| 180 | - $col_data .= '"' . addslashes( $column ) . '"'; |
|
| 181 | - $col_data .= $i == count( $cols ) ? '' : ','; |
|
| 182 | - $i ++; |
|
| 179 | + foreach ($cols as $col_id => $column) { |
|
| 180 | + $col_data .= '"'.addslashes($column).'"'; |
|
| 181 | + $col_data .= $i == count($cols) ? '' : ','; |
|
| 182 | + $i++; |
|
| 183 | 183 | } |
| 184 | 184 | $col_data .= "\r\n"; |
| 185 | 185 | |
| 186 | - $this->stash_step_data( $col_data ); |
|
| 186 | + $this->stash_step_data($col_data); |
|
| 187 | 187 | |
| 188 | 188 | return $col_data; |
| 189 | 189 | |
@@ -202,23 +202,23 @@ discard block |
||
| 202 | 202 | $data = $this->get_data(); |
| 203 | 203 | $cols = $this->get_csv_cols(); |
| 204 | 204 | |
| 205 | - if ( $data ) { |
|
| 205 | + if ($data) { |
|
| 206 | 206 | |
| 207 | 207 | // Output each row |
| 208 | - foreach ( $data as $row ) { |
|
| 208 | + foreach ($data as $row) { |
|
| 209 | 209 | $i = 1; |
| 210 | - foreach ( $row as $col_id => $column ) { |
|
| 210 | + foreach ($row as $col_id => $column) { |
|
| 211 | 211 | // Make sure the column is valid |
| 212 | - if ( array_key_exists( $col_id, $cols ) ) { |
|
| 213 | - $row_data .= '"' . addslashes( preg_replace( '/"/', "'", $column ) ) . '"'; |
|
| 214 | - $row_data .= $i == count( $cols ) ? '' : ','; |
|
| 215 | - $i ++; |
|
| 212 | + if (array_key_exists($col_id, $cols)) { |
|
| 213 | + $row_data .= '"'.addslashes(preg_replace('/"/', "'", $column)).'"'; |
|
| 214 | + $row_data .= $i == count($cols) ? '' : ','; |
|
| 215 | + $i++; |
|
| 216 | 216 | } |
| 217 | 217 | } |
| 218 | 218 | $row_data .= "\r\n"; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $this->stash_step_data( $row_data ); |
|
| 221 | + $this->stash_step_data($row_data); |
|
| 222 | 222 | |
| 223 | 223 | return $row_data; |
| 224 | 224 | } |
@@ -246,18 +246,18 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | $file = ''; |
| 248 | 248 | |
| 249 | - if ( @file_exists( $this->file ) ) { |
|
| 249 | + if (@file_exists($this->file)) { |
|
| 250 | 250 | |
| 251 | - if ( ! is_writeable( $this->file ) ) { |
|
| 251 | + if ( ! is_writeable($this->file)) { |
|
| 252 | 252 | $this->is_writable = false; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $file = @file_get_contents( $this->file ); |
|
| 255 | + $file = @file_get_contents($this->file); |
|
| 256 | 256 | |
| 257 | 257 | } else { |
| 258 | 258 | |
| 259 | - @file_put_contents( $this->file, '' ); |
|
| 260 | - @chmod( $this->file, 0664 ); |
|
| 259 | + @file_put_contents($this->file, ''); |
|
| 260 | + @chmod($this->file, 0664); |
|
| 261 | 261 | |
| 262 | 262 | } |
| 263 | 263 | |
@@ -273,18 +273,18 @@ discard block |
||
| 273 | 273 | * |
| 274 | 274 | * @return void |
| 275 | 275 | */ |
| 276 | - protected function stash_step_data( $data = '' ) { |
|
| 276 | + protected function stash_step_data($data = '') { |
|
| 277 | 277 | |
| 278 | 278 | $file = $this->get_file(); |
| 279 | 279 | $file .= $data; |
| 280 | - @file_put_contents( $this->file, $file ); |
|
| 280 | + @file_put_contents($this->file, $file); |
|
| 281 | 281 | |
| 282 | 282 | // If we have no rows after this step, mark it as an empty export. |
| 283 | - $file_rows = file( $this->file, FILE_SKIP_EMPTY_LINES ); |
|
| 283 | + $file_rows = file($this->file, FILE_SKIP_EMPTY_LINES); |
|
| 284 | 284 | $default_cols = $this->get_csv_cols(); |
| 285 | - $default_cols = empty( $default_cols ) ? 0 : 1; |
|
| 285 | + $default_cols = empty($default_cols) ? 0 : 1; |
|
| 286 | 286 | |
| 287 | - $this->is_empty = count( $file_rows ) == $default_cols ? true : false; |
|
| 287 | + $this->is_empty = count($file_rows) == $default_cols ? true : false; |
|
| 288 | 288 | |
| 289 | 289 | } |
| 290 | 290 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | $file = $this->get_file(); |
| 304 | 304 | |
| 305 | - @unlink( $this->file ); |
|
| 305 | + @unlink($this->file); |
|
| 306 | 306 | |
| 307 | 307 | echo $file; |
| 308 | 308 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * |
| 312 | 312 | * @since 1.8 |
| 313 | 313 | */ |
| 314 | - do_action( 'give_file_export_complete', $_REQUEST ); |
|
| 314 | + do_action('give_file_export_complete', $_REQUEST); |
|
| 315 | 315 | |
| 316 | 316 | give_die(); |
| 317 | 317 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * |
| 324 | 324 | * @param array $request The Form Data passed into the batch processing. |
| 325 | 325 | */ |
| 326 | - public function set_properties( $request ) { |
|
| 326 | + public function set_properties($request) { |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @param array $request The Form Data passed into the batch processing. |
| 335 | 335 | * @param Give_Batch_Export $export |
| 336 | 336 | */ |
| 337 | - public function unset_properties( $request, $export ) { |
|
| 337 | + public function unset_properties($request, $export) { |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | /** |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Exit if accessed directly |
| 4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 4 | +if ( ! defined('ABSPATH')) exit; |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * Allows plugins to use their own update API. |
@@ -29,20 +29,20 @@ discard block |
||
| 29 | 29 | * @param string $_plugin_file Path to the plugin file. |
| 30 | 30 | * @param array $_api_data Optional data to send with API calls. |
| 31 | 31 | */ |
| 32 | - public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
| 32 | + public function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
| 33 | 33 | |
| 34 | 34 | global $edd_plugin_data; |
| 35 | 35 | |
| 36 | - $this->api_url = trailingslashit( $_api_url ); |
|
| 36 | + $this->api_url = trailingslashit($_api_url); |
|
| 37 | 37 | $this->api_data = $_api_data; |
| 38 | - $this->name = plugin_basename( $_plugin_file ); |
|
| 39 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
| 38 | + $this->name = plugin_basename($_plugin_file); |
|
| 39 | + $this->slug = basename($_plugin_file, '.php'); |
|
| 40 | 40 | $this->version = $_api_data['version']; |
| 41 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
| 42 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
| 43 | - $this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
| 41 | + $this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false; |
|
| 42 | + $this->beta = ! empty($this->api_data['beta']) ? true : false; |
|
| 43 | + $this->cache_key = md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
| 44 | 44 | |
| 45 | - $edd_plugin_data[ $this->slug ] = $this->api_data; |
|
| 45 | + $edd_plugin_data[$this->slug] = $this->api_data; |
|
| 46 | 46 | |
| 47 | 47 | // Set up hooks. |
| 48 | 48 | $this->init(); |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function init() { |
| 60 | 60 | |
| 61 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
| 62 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
| 63 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 ); |
|
| 64 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
| 65 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
| 61 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
| 62 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
| 63 | + remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10); |
|
| 64 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
| 65 | + add_action('admin_init', array($this, 'show_changelog')); |
|
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
@@ -79,41 +79,41 @@ discard block |
||
| 79 | 79 | * @param array $_transient_data Update array build by WordPress. |
| 80 | 80 | * @return array Modified update array with custom plugin data. |
| 81 | 81 | */ |
| 82 | - public function check_update( $_transient_data ) { |
|
| 82 | + public function check_update($_transient_data) { |
|
| 83 | 83 | |
| 84 | 84 | global $pagenow; |
| 85 | 85 | |
| 86 | - if ( ! is_object( $_transient_data ) ) { |
|
| 86 | + if ( ! is_object($_transient_data)) { |
|
| 87 | 87 | $_transient_data = new stdClass; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( 'plugins.php' == $pagenow && is_multisite() ) { |
|
| 90 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
| 91 | 91 | return $_transient_data; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
| 94 | + if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) { |
|
| 95 | 95 | return $_transient_data; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $version_info = $this->get_cached_version_info(); |
| 99 | 99 | |
| 100 | - if ( false === $version_info ) { |
|
| 101 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
|
| 100 | + if (false === $version_info) { |
|
| 101 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta)); |
|
| 102 | 102 | |
| 103 | - $this->set_version_info_cache( $version_info ); |
|
| 103 | + $this->set_version_info_cache($version_info); |
|
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
| 107 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
| 108 | 108 | |
| 109 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 109 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
| 110 | 110 | |
| 111 | - $_transient_data->response[ $this->name ] = $version_info; |
|
| 111 | + $_transient_data->response[$this->name] = $version_info; |
|
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - $_transient_data->last_checked = current_time( 'timestamp' ); |
|
| 116 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
| 115 | + $_transient_data->last_checked = current_time('timestamp'); |
|
| 116 | + $_transient_data->checked[$this->name] = $this->version; |
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | |
@@ -126,97 +126,97 @@ discard block |
||
| 126 | 126 | * @param string $file |
| 127 | 127 | * @param array $plugin |
| 128 | 128 | */ |
| 129 | - public function show_update_notification( $file, $plugin ) { |
|
| 129 | + public function show_update_notification($file, $plugin) { |
|
| 130 | 130 | |
| 131 | - if ( is_network_admin() ) { |
|
| 131 | + if (is_network_admin()) { |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
| 135 | + if ( ! current_user_can('update_plugins')) { |
|
| 136 | 136 | return; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if( ! is_multisite() ) { |
|
| 139 | + if ( ! is_multisite()) { |
|
| 140 | 140 | return; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - if ( $this->name != $file ) { |
|
| 143 | + if ($this->name != $file) { |
|
| 144 | 144 | return; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Remove our filter on the site transient |
| 148 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
| 148 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
| 149 | 149 | |
| 150 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
| 150 | + $update_cache = get_site_transient('update_plugins'); |
|
| 151 | 151 | |
| 152 | - $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass(); |
|
| 152 | + $update_cache = is_object($update_cache) ? $update_cache : new stdClass(); |
|
| 153 | 153 | |
| 154 | - if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
| 154 | + if (empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
| 155 | 155 | |
| 156 | 156 | $version_info = $this->get_cached_version_info(); |
| 157 | 157 | |
| 158 | - if ( false === $version_info ) { |
|
| 159 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
|
| 158 | + if (false === $version_info) { |
|
| 159 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta)); |
|
| 160 | 160 | |
| 161 | - $this->set_version_info_cache( $version_info ); |
|
| 161 | + $this->set_version_info_cache($version_info); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if ( ! is_object( $version_info ) ) { |
|
| 164 | + if ( ! is_object($version_info)) { |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 168 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
| 169 | 169 | |
| 170 | - $update_cache->response[ $this->name ] = $version_info; |
|
| 170 | + $update_cache->response[$this->name] = $version_info; |
|
| 171 | 171 | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - $update_cache->last_checked = current_time( 'timestamp' ); |
|
| 175 | - $update_cache->checked[ $this->name ] = $this->version; |
|
| 174 | + $update_cache->last_checked = current_time('timestamp'); |
|
| 175 | + $update_cache->checked[$this->name] = $this->version; |
|
| 176 | 176 | |
| 177 | - set_site_transient( 'update_plugins', $update_cache ); |
|
| 177 | + set_site_transient('update_plugins', $update_cache); |
|
| 178 | 178 | |
| 179 | 179 | } else { |
| 180 | 180 | |
| 181 | - $version_info = $update_cache->response[ $this->name ]; |
|
| 181 | + $version_info = $update_cache->response[$this->name]; |
|
| 182 | 182 | |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | // Restore our filter |
| 186 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
| 186 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
| 187 | 187 | |
| 188 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 188 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
| 189 | 189 | |
| 190 | 190 | // build a plugin list row, with update notification |
| 191 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
| 191 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
| 192 | 192 | # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"> |
| 193 | - echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">'; |
|
| 193 | + echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">'; |
|
| 194 | 194 | echo '<td colspan="3" class="plugin-update colspanchange">'; |
| 195 | 195 | echo '<div class="update-message notice inline notice-warning notice-alt">'; |
| 196 | 196 | |
| 197 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
| 197 | + $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911'); |
|
| 198 | 198 | |
| 199 | - if ( empty( $version_info->download_link ) ) { |
|
| 199 | + if (empty($version_info->download_link)) { |
|
| 200 | 200 | printf( |
| 201 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ), |
|
| 202 | - esc_html( $version_info->name ), |
|
| 203 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
| 204 | - esc_html( $version_info->new_version ), |
|
| 201 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give'), |
|
| 202 | + esc_html($version_info->name), |
|
| 203 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
| 204 | + esc_html($version_info->new_version), |
|
| 205 | 205 | '</a>' |
| 206 | 206 | ); |
| 207 | 207 | } else { |
| 208 | 208 | printf( |
| 209 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ), |
|
| 210 | - esc_html( $version_info->name ), |
|
| 211 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
| 212 | - esc_html( $version_info->new_version ), |
|
| 209 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give'), |
|
| 210 | + esc_html($version_info->name), |
|
| 211 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
| 212 | + esc_html($version_info->new_version), |
|
| 213 | 213 | '</a>', |
| 214 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
| 214 | + '<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">', |
|
| 215 | 215 | '</a>' |
| 216 | 216 | ); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - do_action( "in_plugin_update_message-{$file}", $plugin, $version_info ); |
|
| 219 | + do_action("in_plugin_update_message-{$file}", $plugin, $version_info); |
|
| 220 | 220 | |
| 221 | 221 | echo '</div></td></tr>'; |
| 222 | 222 | } |
@@ -232,15 +232,15 @@ discard block |
||
| 232 | 232 | * @param object $_args |
| 233 | 233 | * @return object $_data |
| 234 | 234 | */ |
| 235 | - public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
| 235 | + public function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
| 236 | 236 | |
| 237 | - if ( $_action != 'plugin_information' ) { |
|
| 237 | + if ($_action != 'plugin_information') { |
|
| 238 | 238 | |
| 239 | 239 | return $_data; |
| 240 | 240 | |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
| 243 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
| 244 | 244 | |
| 245 | 245 | return $_data; |
| 246 | 246 | |
@@ -255,20 +255,20 @@ discard block |
||
| 255 | 255 | ) |
| 256 | 256 | ); |
| 257 | 257 | |
| 258 | - $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
| 258 | + $cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
| 259 | 259 | |
| 260 | 260 | // Get the transient where we store the api request for this plugin for 24 hours |
| 261 | - $edd_api_request_transient = $this->get_cached_version_info( $cache_key ); |
|
| 261 | + $edd_api_request_transient = $this->get_cached_version_info($cache_key); |
|
| 262 | 262 | |
| 263 | 263 | //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now. |
| 264 | - if ( empty( $edd_api_request_transient ) ) { |
|
| 264 | + if (empty($edd_api_request_transient)) { |
|
| 265 | 265 | |
| 266 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
| 266 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
| 267 | 267 | |
| 268 | 268 | // Expires in 3 hours |
| 269 | - $this->set_version_info_cache( $api_response, $cache_key ); |
|
| 269 | + $this->set_version_info_cache($api_response, $cache_key); |
|
| 270 | 270 | |
| 271 | - if ( false !== $api_response ) { |
|
| 271 | + if (false !== $api_response) { |
|
| 272 | 272 | $_data = $api_response; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -277,20 +277,20 @@ discard block |
||
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // Convert sections into an associative array, since we're getting an object, but Core expects an array. |
| 280 | - if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
|
| 280 | + if (isset($_data->sections) && ! is_array($_data->sections)) { |
|
| 281 | 281 | $new_sections = array(); |
| 282 | - foreach ( $_data->sections as $key => $value ) { |
|
| 283 | - $new_sections[ $key ] = $value; |
|
| 282 | + foreach ($_data->sections as $key => $value) { |
|
| 283 | + $new_sections[$key] = $value; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | $_data->sections = $new_sections; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // Convert banners into an associative array, since we're getting an object, but Core expects an array. |
| 290 | - if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
|
| 290 | + if (isset($_data->banners) && ! is_array($_data->banners)) { |
|
| 291 | 291 | $new_banners = array(); |
| 292 | - foreach ( $_data->banners as $key => $value ) { |
|
| 293 | - $new_banners[ $key ] = $value; |
|
| 292 | + foreach ($_data->banners as $key => $value) { |
|
| 293 | + $new_banners[$key] = $value; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $_data->banners = $new_banners; |
@@ -306,9 +306,9 @@ discard block |
||
| 306 | 306 | * @param string $url |
| 307 | 307 | * @return object $array |
| 308 | 308 | */ |
| 309 | - public function http_request_args( $args, $url ) { |
|
| 309 | + public function http_request_args($args, $url) { |
|
| 310 | 310 | // If it is an https request and we are performing a package download, disable ssl verification |
| 311 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
| 311 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
| 312 | 312 | $args['sslverify'] = false; |
| 313 | 313 | } |
| 314 | 314 | return $args; |
@@ -325,50 +325,50 @@ discard block |
||
| 325 | 325 | * @param array $_data Parameters for the API action. |
| 326 | 326 | * @return false|object |
| 327 | 327 | */ |
| 328 | - private function api_request( $_action, $_data ) { |
|
| 328 | + private function api_request($_action, $_data) { |
|
| 329 | 329 | |
| 330 | 330 | global $wp_version; |
| 331 | 331 | |
| 332 | - $data = array_merge( $this->api_data, $_data ); |
|
| 332 | + $data = array_merge($this->api_data, $_data); |
|
| 333 | 333 | |
| 334 | - if ( $data['slug'] != $this->slug ) { |
|
| 334 | + if ($data['slug'] != $this->slug) { |
|
| 335 | 335 | return; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if( $this->api_url == trailingslashit (home_url() ) ) { |
|
| 338 | + if ($this->api_url == trailingslashit(home_url())) { |
|
| 339 | 339 | return false; // Don't allow a plugin to ping itself |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | $api_params = array( |
| 343 | 343 | 'edd_action' => 'get_version', |
| 344 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
| 345 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
| 346 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
| 347 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
| 344 | + 'license' => ! empty($data['license']) ? $data['license'] : '', |
|
| 345 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
| 346 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
| 347 | + 'version' => isset($data['version']) ? $data['version'] : false, |
|
| 348 | 348 | 'slug' => $data['slug'], |
| 349 | 349 | 'author' => $data['author'], |
| 350 | 350 | 'url' => home_url(), |
| 351 | - 'beta' => ! empty( $data['beta'] ), |
|
| 351 | + 'beta' => ! empty($data['beta']), |
|
| 352 | 352 | ); |
| 353 | 353 | |
| 354 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
| 354 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
| 355 | 355 | |
| 356 | - if ( ! is_wp_error( $request ) ) { |
|
| 357 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
| 356 | + if ( ! is_wp_error($request)) { |
|
| 357 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - if ( $request && isset( $request->sections ) ) { |
|
| 361 | - $request->sections = maybe_unserialize( $request->sections ); |
|
| 360 | + if ($request && isset($request->sections)) { |
|
| 361 | + $request->sections = maybe_unserialize($request->sections); |
|
| 362 | 362 | } else { |
| 363 | 363 | $request = false; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if ( $request && isset( $request->banners ) ) { |
|
| 367 | - $request->banners = maybe_unserialize( $request->banners ); |
|
| 366 | + if ($request && isset($request->banners)) { |
|
| 367 | + $request->banners = maybe_unserialize($request->banners); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if( ! empty( $request->sections ) ) { |
|
| 371 | - foreach( $request->sections as $key => $section ) { |
|
| 370 | + if ( ! empty($request->sections)) { |
|
| 371 | + foreach ($request->sections as $key => $section) { |
|
| 372 | 372 | $request->$key = (array) $section; |
| 373 | 373 | } |
| 374 | 374 | } |
@@ -380,97 +380,97 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | global $edd_plugin_data; |
| 382 | 382 | |
| 383 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
| 383 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
| 384 | 384 | return; |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
| 387 | + if (empty($_REQUEST['plugin'])) { |
|
| 388 | 388 | return; |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - if( empty( $_REQUEST['slug'] ) ) { |
|
| 391 | + if (empty($_REQUEST['slug'])) { |
|
| 392 | 392 | return; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
| 396 | - wp_die( __( 'You do not have permission to install plugin updates', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
| 395 | + if ( ! current_user_can('update_plugins')) { |
|
| 396 | + wp_die(__('You do not have permission to install plugin updates', 'give'), __('Error', 'give'), array('response' => 403)); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
| 400 | - $beta = ! empty( $data['beta'] ) ? true : false; |
|
| 401 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); |
|
| 402 | - $version_info = $this->get_cached_version_info( $cache_key ); |
|
| 399 | + $data = $edd_plugin_data[$_REQUEST['slug']]; |
|
| 400 | + $beta = ! empty($data['beta']) ? true : false; |
|
| 401 | + $cache_key = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info'); |
|
| 402 | + $version_info = $this->get_cached_version_info($cache_key); |
|
| 403 | 403 | |
| 404 | - if( false === $version_info ) { |
|
| 404 | + if (false === $version_info) { |
|
| 405 | 405 | |
| 406 | 406 | $api_params = array( |
| 407 | 407 | 'edd_action' => 'get_version', |
| 408 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
| 409 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
| 408 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
| 409 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
| 410 | 410 | 'slug' => $_REQUEST['slug'], |
| 411 | 411 | 'author' => $data['author'], |
| 412 | 412 | 'url' => home_url(), |
| 413 | - 'beta' => ! empty( $data['beta'] ) |
|
| 413 | + 'beta' => ! empty($data['beta']) |
|
| 414 | 414 | ); |
| 415 | 415 | |
| 416 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
| 416 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
| 417 | 417 | |
| 418 | - if ( ! is_wp_error( $request ) ) { |
|
| 419 | - $version_info = json_decode( wp_remote_retrieve_body( $request ) ); |
|
| 418 | + if ( ! is_wp_error($request)) { |
|
| 419 | + $version_info = json_decode(wp_remote_retrieve_body($request)); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | |
| 423 | - if ( ! empty( $version_info ) && isset( $version_info->sections ) ) { |
|
| 424 | - $version_info->sections = maybe_unserialize( $version_info->sections ); |
|
| 423 | + if ( ! empty($version_info) && isset($version_info->sections)) { |
|
| 424 | + $version_info->sections = maybe_unserialize($version_info->sections); |
|
| 425 | 425 | } else { |
| 426 | 426 | $version_info = false; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - if( ! empty( $version_info ) ) { |
|
| 430 | - foreach( $version_info->sections as $key => $section ) { |
|
| 429 | + if ( ! empty($version_info)) { |
|
| 430 | + foreach ($version_info->sections as $key => $section) { |
|
| 431 | 431 | $version_info->$key = (array) $section; |
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - $this->set_version_info_cache( $version_info, $cache_key ); |
|
| 435 | + $this->set_version_info_cache($version_info, $cache_key); |
|
| 436 | 436 | |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
| 440 | - echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; |
|
| 439 | + if ( ! empty($version_info) && isset($version_info->sections['changelog'])) { |
|
| 440 | + echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>'; |
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | exit; |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - public function get_cached_version_info( $cache_key = '' ) { |
|
| 446 | + public function get_cached_version_info($cache_key = '') { |
|
| 447 | 447 | |
| 448 | - if( empty( $cache_key ) ) { |
|
| 448 | + if (empty($cache_key)) { |
|
| 449 | 449 | $cache_key = $this->cache_key; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - $cache = get_option( $cache_key ); |
|
| 452 | + $cache = get_option($cache_key); |
|
| 453 | 453 | |
| 454 | - if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) { |
|
| 454 | + if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) { |
|
| 455 | 455 | return false; // Cache is expired |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - return json_decode( $cache['value'] ); |
|
| 458 | + return json_decode($cache['value']); |
|
| 459 | 459 | |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - public function set_version_info_cache( $value = '', $cache_key = '' ) { |
|
| 462 | + public function set_version_info_cache($value = '', $cache_key = '') { |
|
| 463 | 463 | |
| 464 | - if( empty( $cache_key ) ) { |
|
| 464 | + if (empty($cache_key)) { |
|
| 465 | 465 | $cache_key = $this->cache_key; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | $data = array( |
| 469 | - 'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ), |
|
| 470 | - 'value' => json_encode( $value ) |
|
| 469 | + 'timeout' => strtotime('+3 hours', current_time('timestamp')), |
|
| 470 | + 'value' => json_encode($value) |
|
| 471 | 471 | ); |
| 472 | 472 | |
| 473 | - update_option( $cache_key, $data ); |
|
| 473 | + update_option($cache_key, $data); |
|
| 474 | 474 | |
| 475 | 475 | } |
| 476 | 476 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly. |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function __construct() { |
| 25 | 25 | |
| 26 | - $this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
| 27 | - $this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
| 26 | + $this->shortcode['title'] = esc_html__('Donation Form Goal', 'give'); |
|
| 27 | + $this->shortcode['label'] = esc_html__('Donation Form Goal', 'give'); |
|
| 28 | 28 | |
| 29 | - parent::__construct( 'give_goal' ); |
|
| 29 | + parent::__construct('give_goal'); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $create_form_link = sprintf( |
| 40 | 40 | /* translators: %s: create new form URL */ |
| 41 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
| 42 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
| 41 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
| 42 | + admin_url('post-new.php?post_type=give_forms') |
|
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | 45 | return array( |
@@ -51,35 +51,35 @@ discard block |
||
| 51 | 51 | 'meta_value' => 'enabled', |
| 52 | 52 | ), |
| 53 | 53 | 'name' => 'id', |
| 54 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
| 55 | - 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', |
|
| 54 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
| 55 | + 'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -', |
|
| 56 | 56 | 'required' => array( |
| 57 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
| 58 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ), |
|
| 57 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
| 58 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link), |
|
| 59 | 59 | ), |
| 60 | 60 | ), |
| 61 | 61 | array( |
| 62 | 62 | 'type' => 'container', |
| 63 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
| 63 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
| 64 | 64 | ), |
| 65 | 65 | array( |
| 66 | 66 | 'type' => 'listbox', |
| 67 | 67 | 'name' => 'show_text', |
| 68 | - 'label' => esc_attr__( 'Show Text:', 'give' ), |
|
| 69 | - 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
| 68 | + 'label' => esc_attr__('Show Text:', 'give'), |
|
| 69 | + 'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'), |
|
| 70 | 70 | 'options' => array( |
| 71 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 72 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 71 | + 'true' => esc_html__('Show', 'give'), |
|
| 72 | + 'false' => esc_html__('Hide', 'give'), |
|
| 73 | 73 | ), |
| 74 | 74 | ), |
| 75 | 75 | array( |
| 76 | 76 | 'type' => 'listbox', |
| 77 | 77 | 'name' => 'show_bar', |
| 78 | - 'label' => esc_attr__( 'Show Progress Bar:', 'give' ), |
|
| 79 | - 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
| 78 | + 'label' => esc_attr__('Show Progress Bar:', 'give'), |
|
| 79 | + 'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'), |
|
| 80 | 80 | 'options' => array( |
| 81 | - 'true' => esc_html__( 'Show', 'give' ), |
|
| 82 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
| 81 | + 'true' => esc_html__('Show', 'give'), |
|
| 82 | + 'false' => esc_html__('Hide', 'give'), |
|
| 83 | 83 | ), |
| 84 | 84 | ), |
| 85 | 85 | ); |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * This template is used to display the registration form with [give_register] |
| 4 | 4 | */ |
| 5 | -Give()->notices->render_frontend_notices( 0 ); ?> |
|
| 5 | +Give()->notices->render_frontend_notices(0); ?> |
|
| 6 | 6 | |
| 7 | 7 | <form id="give-register-form" class="give-form" action="" method="post"> |
| 8 | 8 | <?php |
@@ -13,11 +13,11 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | * @since 1.0 |
| 15 | 15 | */ |
| 16 | - do_action( 'give_register_form_fields_top' ); |
|
| 16 | + do_action('give_register_form_fields_top'); |
|
| 17 | 17 | ?> |
| 18 | 18 | |
| 19 | 19 | <fieldset> |
| 20 | - <legend><?php esc_html_e( 'Register a New Account', 'give' ); ?></legend> |
|
| 20 | + <legend><?php esc_html_e('Register a New Account', 'give'); ?></legend> |
|
| 21 | 21 | |
| 22 | 22 | <?php |
| 23 | 23 | /** |
@@ -27,26 +27,26 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @since 1.0 |
| 29 | 29 | */ |
| 30 | - do_action( 'give_register_form_fields_before' ); |
|
| 30 | + do_action('give_register_form_fields_before'); |
|
| 31 | 31 | ?> |
| 32 | 32 | |
| 33 | 33 | <div class="form-row form-row-first form-row-responsive"> |
| 34 | - <label for="give-user-login"><?php esc_html_e( 'Username', 'give' ); ?></label> |
|
| 34 | + <label for="give-user-login"><?php esc_html_e('Username', 'give'); ?></label> |
|
| 35 | 35 | <input id="give-user-login" class="required give-input" type="text" name="give_user_login" required aria-required="true" /> |
| 36 | 36 | </div> |
| 37 | 37 | |
| 38 | 38 | <div class="form-row form-row-last form-row-responsive"> |
| 39 | - <label for="give-user-email"><?php esc_html_e( 'Email', 'give' ); ?></label> |
|
| 39 | + <label for="give-user-email"><?php esc_html_e('Email', 'give'); ?></label> |
|
| 40 | 40 | <input id="give-user-email" class="required give-input" type="email" name="give_user_email" required aria-required="true" /> |
| 41 | 41 | </div> |
| 42 | 42 | |
| 43 | 43 | <div class="form-row form-row-first form-row-responsive"> |
| 44 | - <label for="give-user-pass"><?php esc_html_e( 'Password', 'give' ); ?></label> |
|
| 44 | + <label for="give-user-pass"><?php esc_html_e('Password', 'give'); ?></label> |
|
| 45 | 45 | <input id="give-user-pass" class="password required give-input" type="password" name="give_user_pass" required aria-required="true" /> |
| 46 | 46 | </div> |
| 47 | 47 | |
| 48 | 48 | <div class="form-row form-row-last form-row-responsive"> |
| 49 | - <label for="give-user-pass2"><?php esc_html_e( 'Confirm PW', 'give' ); ?></label> |
|
| 49 | + <label for="give-user-pass2"><?php esc_html_e('Confirm PW', 'give'); ?></label> |
|
| 50 | 50 | <input id="give-user-pass2" class="password required give-input" type="password" name="give_user_pass2" required aria-required="true" /> |
| 51 | 51 | </div> |
| 52 | 52 | |
@@ -58,17 +58,17 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @since 1.0 |
| 60 | 60 | */ |
| 61 | - do_action( 'give_register_form_fields_before_submit' ); |
|
| 61 | + do_action('give_register_form_fields_before_submit'); |
|
| 62 | 62 | ?> |
| 63 | 63 | |
| 64 | 64 | <div class="give-hidden"> |
| 65 | 65 | <input type="hidden" name="give_honeypot" value="" /> |
| 66 | 66 | <input type="hidden" name="give_action" value="user_register" /> |
| 67 | - <input type="hidden" name="give_redirect" value="<?php echo esc_url( $give_register_redirect ); ?>" /> |
|
| 67 | + <input type="hidden" name="give_redirect" value="<?php echo esc_url($give_register_redirect); ?>" /> |
|
| 68 | 68 | </div> |
| 69 | 69 | |
| 70 | 70 | <div class="form-row"> |
| 71 | - <input class="button" name="give_register_submit" type="submit" value="<?php esc_attr_e( 'Register', 'give' ); ?>" /> |
|
| 71 | + <input class="button" name="give_register_submit" type="submit" value="<?php esc_attr_e('Register', 'give'); ?>" /> |
|
| 72 | 72 | </div> |
| 73 | 73 | |
| 74 | 74 | <?php |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0 |
| 81 | 81 | */ |
| 82 | - do_action( 'give_register_form_fields_after' ); |
|
| 82 | + do_action('give_register_form_fields_after'); |
|
| 83 | 83 | ?> |
| 84 | 84 | |
| 85 | 85 | </fieldset> |
@@ -92,6 +92,6 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @since 1.0 |
| 94 | 94 | */ |
| 95 | - do_action( 'give_register_form_fields_bottom' ); |
|
| 95 | + do_action('give_register_form_fields_bottom'); |
|
| 96 | 96 | ?> |
| 97 | 97 | </form> |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | * @since 1.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 12 | +if ( ! defined('ABSPATH')) {
|
|
| 13 | 13 | exit; // Exit if accessed directly. |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -$template = strtolower( get_option( 'template' ) ); |
|
| 16 | +$template = strtolower(get_option('template'));
|
|
| 17 | 17 | |
| 18 | -switch ( $template ) {
|
|
| 18 | +switch ($template) {
|
|
| 19 | 19 | case 'twentyeleven' : |
| 20 | 20 | echo '<div id="primary" class="give-wrap"><div id="content" role="main" class="twentyeleven">'; |
| 21 | 21 | break; |
@@ -65,6 +65,6 @@ discard block |
||
| 65 | 65 | echo '<div class="wrapper hentry" style="box-sizing: border-box;">'; |
| 66 | 66 | break; |
| 67 | 67 | default : |
| 68 | - echo apply_filters( 'give_default_wrapper_start', '<div id="container" class="give-wrap container"><div id="content" role="main">' ); |
|
| 68 | + echo apply_filters('give_default_wrapper_start', '<div id="container" class="give-wrap container"><div id="content" role="main">');
|
|
| 69 | 69 | break; |
| 70 | 70 | } |
| 71 | 71 | \ No newline at end of file |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | * @since 1.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 12 | +if ( ! defined('ABSPATH')) {
|
|
| 13 | 13 | exit; // Exit if accessed directly. |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -$template = get_option( 'template' ); |
|
| 16 | +$template = get_option('template');
|
|
| 17 | 17 | |
| 18 | -switch ( $template ) {
|
|
| 18 | +switch ($template) {
|
|
| 19 | 19 | case 'twentyeleven' : |
| 20 | 20 | echo '</div></div>'; |
| 21 | 21 | break; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | break; |
| 28 | 28 | case 'twentyfourteen' : |
| 29 | 29 | echo '</div></div></div>'; |
| 30 | - get_sidebar( 'content' ); |
|
| 30 | + get_sidebar('content');
|
|
| 31 | 31 | break; |
| 32 | 32 | case 'twentyfifteen' : |
| 33 | 33 | echo '</div></div>'; |
@@ -57,6 +57,6 @@ discard block |
||
| 57 | 57 | echo '</div>'; |
| 58 | 58 | break; |
| 59 | 59 | default : |
| 60 | - echo apply_filters( 'give_default_wrapper_end', '</div></div>' ); |
|
| 60 | + echo apply_filters('give_default_wrapper_end', '</div></div>');
|
|
| 61 | 61 | break; |
| 62 | 62 | } |
| 63 | 63 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @version 1.0 |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 11 | +if ( ! defined('ABSPATH')) {
|
|
| 12 | 12 | exit; // Exit if accessed directly. |
| 13 | 13 | } |
| 14 | 14 | |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @since 1.0 |
| 23 | 23 | */ |
| 24 | -do_action( 'give_before_main_content' ); |
|
| 24 | +do_action('give_before_main_content');
|
|
| 25 | 25 | |
| 26 | -while ( have_posts() ) : the_post(); |
|
| 26 | +while (have_posts()) : the_post(); |
|
| 27 | 27 | |
| 28 | - give_get_template_part( 'single-give-form/content', 'single-give-form' ); |
|
| 28 | + give_get_template_part('single-give-form/content', 'single-give-form');
|
|
| 29 | 29 | |
| 30 | 30 | endwhile; // end of the loop. |
| 31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @since 1.0 |
| 38 | 38 | */ |
| 39 | -do_action( 'give_after_main_content' ); |
|
| 39 | +do_action('give_after_main_content');
|
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * Fires in single form template, on the sidebar. |
@@ -45,6 +45,6 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @since 1.0 |
| 47 | 47 | */ |
| 48 | -do_action( 'give_sidebar' ); |
|
| 48 | +do_action('give_sidebar');
|
|
| 49 | 49 | |
| 50 | 50 | get_footer(); |
| 51 | 51 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @since 1.0 |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if ( ! defined( 'ABSPATH' ) ) {
|
|
| 13 | +if ( ! defined('ABSPATH')) {
|
|
| 14 | 14 | exit; // Exit if accessed directly. |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,22 +23,22 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @since 1.0 |
| 25 | 25 | */ |
| 26 | -do_action( 'give_pre_featured_thumbnail' ); |
|
| 26 | +do_action('give_pre_featured_thumbnail');
|
|
| 27 | 27 | ?> |
| 28 | 28 | |
| 29 | 29 | <div class="images"> |
| 30 | 30 | <?php //Featured Thumbnail |
| 31 | - if ( has_post_thumbnail() ) {
|
|
| 31 | + if (has_post_thumbnail()) {
|
|
| 32 | 32 | |
| 33 | - $image_size = give_get_option( 'featured_image_size' ); |
|
| 34 | - $image = get_the_post_thumbnail( $post->ID, apply_filters( 'single_give_form_large_thumbnail_size', ( ! empty( $image_size ) ? $image_size : 'large' ) ) ); |
|
| 33 | + $image_size = give_get_option('featured_image_size');
|
|
| 34 | + $image = get_the_post_thumbnail($post->ID, apply_filters('single_give_form_large_thumbnail_size', ( ! empty($image_size) ? $image_size : 'large')));
|
|
| 35 | 35 | |
| 36 | - echo apply_filters( 'single_give_form_image_html', $image ); |
|
| 36 | + echo apply_filters('single_give_form_image_html', $image);
|
|
| 37 | 37 | |
| 38 | 38 | } else {
|
| 39 | 39 | |
| 40 | 40 | //Placeholder Image |
| 41 | - echo apply_filters( 'single_give_form_image_html', sprintf( '<img src="%s" alt="%s" />', give_get_placeholder_img_src(), esc_attr__( 'Placeholder', 'give' ) ), $post->ID ); |
|
| 41 | + echo apply_filters('single_give_form_image_html', sprintf('<img src="%s" alt="%s" />', give_get_placeholder_img_src(), esc_attr__('Placeholder', 'give')), $post->ID);
|
|
| 42 | 42 | |
| 43 | 43 | } ?> |
| 44 | 44 | </div> |
@@ -51,5 +51,5 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @since 1.0 |
| 53 | 53 | */ |
| 54 | -do_action( 'give_post_featured_thumbnail' ); |
|
| 54 | +do_action('give_post_featured_thumbnail');
|
|
| 55 | 55 | ?> |