@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // Exit if accessed directly. |
| 3 | -if (!defined( 'ABSPATH' ) ) exit; |
|
| 3 | +if (!defined('ABSPATH')) exit; |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * The Subscriptions DB Class |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | 'transaction_id' => '', |
| 69 | 69 | 'parent_payment_id' => 0, |
| 70 | 70 | 'product_id' => 0, |
| 71 | - 'created' => date( 'Y-m-d H:i:s' ), |
|
| 72 | - 'expiration' => date( 'Y-m-d H:i:s' ), |
|
| 71 | + 'created' => date('Y-m-d H:i:s'), |
|
| 72 | + 'expiration' => date('Y-m-d H:i:s'), |
|
| 73 | 73 | 'trial_period' => '', |
| 74 | 74 | 'status' => '', |
| 75 | 75 | 'profile_id' => '', |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | * @access public |
| 83 | 83 | * @since 1.0.0 |
| 84 | 84 | */ |
| 85 | - public function get_subscriptions( $args = array() ) { |
|
| 85 | + public function get_subscriptions($args = array()) { |
|
| 86 | 86 | global $wpdb; |
| 87 | 87 | |
| 88 | 88 | $defaults = array( |
| 89 | - 'number' => get_option( 'posts_per_page' ), |
|
| 89 | + 'number' => get_option('posts_per_page'), |
|
| 90 | 90 | 'offset' => 0, |
| 91 | 91 | 'search' => '', |
| 92 | 92 | 'customer_id' => 0, |
@@ -94,21 +94,21 @@ discard block |
||
| 94 | 94 | 'order' => 'DESC' |
| 95 | 95 | ); |
| 96 | 96 | |
| 97 | - $args = wp_parse_args( $args, $defaults ); |
|
| 97 | + $args = wp_parse_args($args, $defaults); |
|
| 98 | 98 | |
| 99 | - if( $args['number'] < 1 ) { |
|
| 99 | + if ($args['number'] < 1) { |
|
| 100 | 100 | $args['number'] = 999999999999; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $where = ' WHERE 1=1 '; |
| 104 | 104 | |
| 105 | 105 | // specific customers |
| 106 | - if( ! empty( $args['id'] ) ) { |
|
| 106 | + if (!empty($args['id'])) { |
|
| 107 | 107 | |
| 108 | - if( is_array( $args['id'] ) ) { |
|
| 109 | - $ids = implode( ',', array_map('intval', $args['id'] ) ); |
|
| 108 | + if (is_array($args['id'])) { |
|
| 109 | + $ids = implode(',', array_map('intval', $args['id'])); |
|
| 110 | 110 | } else { |
| 111 | - $ids = intval( $args['id'] ); |
|
| 111 | + $ids = intval($args['id']); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $where .= " AND `id` IN( {$ids} ) "; |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | // Specific products |
| 119 | - if( ! empty( $args['product_id'] ) ) { |
|
| 119 | + if (!empty($args['product_id'])) { |
|
| 120 | 120 | |
| 121 | - if( is_array( $args['product_id'] ) ) { |
|
| 122 | - $product_ids = implode( ',', array_map('intval', $args['product_id'] ) ); |
|
| 121 | + if (is_array($args['product_id'])) { |
|
| 122 | + $product_ids = implode(',', array_map('intval', $args['product_id'])); |
|
| 123 | 123 | } else { |
| 124 | - $product_ids = intval( $args['product_id'] ); |
|
| 124 | + $product_ids = intval($args['product_id']); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $where .= " AND `product_id` IN( {$product_ids} ) "; |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Specific parent payments |
| 132 | - if( ! empty( $args['parent_payment_id'] ) ) { |
|
| 132 | + if (!empty($args['parent_payment_id'])) { |
|
| 133 | 133 | |
| 134 | - if( is_array( $args['parent_payment_id'] ) ) { |
|
| 135 | - $parent_payment_ids = implode( ',', array_map('intval', $args['parent_payment_id'] ) ); |
|
| 134 | + if (is_array($args['parent_payment_id'])) { |
|
| 135 | + $parent_payment_ids = implode(',', array_map('intval', $args['parent_payment_id'])); |
|
| 136 | 136 | } else { |
| 137 | - $parent_payment_ids = intval( $args['parent_payment_id'] ); |
|
| 137 | + $parent_payment_ids = intval($args['parent_payment_id']); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | $where .= " AND `parent_payment_id` IN( {$parent_payment_ids} ) "; |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // Specific transaction IDs |
| 145 | - if( ! empty( $args['transaction_id'] ) ) { |
|
| 145 | + if (!empty($args['transaction_id'])) { |
|
| 146 | 146 | |
| 147 | - if( is_array( $args['transaction_id'] ) ) { |
|
| 148 | - $transaction_ids = implode( "','", array_map('sanitize_text_field', $args['transaction_id'] ) ); |
|
| 147 | + if (is_array($args['transaction_id'])) { |
|
| 148 | + $transaction_ids = implode("','", array_map('sanitize_text_field', $args['transaction_id'])); |
|
| 149 | 149 | } else { |
| 150 | - $transaction_ids = sanitize_text_field( $args['transaction_id'] ); |
|
| 150 | + $transaction_ids = sanitize_text_field($args['transaction_id']); |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | $where .= " AND `transaction_id` IN ( '{$transaction_ids}' ) "; |
@@ -155,12 +155,12 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | // Subscriptoins for specific customers |
| 158 | - if( ! empty( $args['customer_id'] ) ) { |
|
| 158 | + if (!empty($args['customer_id'])) { |
|
| 159 | 159 | |
| 160 | - if( is_array( $args['customer_id'] ) ) { |
|
| 161 | - $customer_ids = implode( ',', array_map('intval', $args['customer_id'] ) ); |
|
| 160 | + if (is_array($args['customer_id'])) { |
|
| 161 | + $customer_ids = implode(',', array_map('intval', $args['customer_id'])); |
|
| 162 | 162 | } else { |
| 163 | - $customer_ids = intval( $args['customer_id'] ); |
|
| 163 | + $customer_ids = intval($args['customer_id']); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $where .= " AND `customer_id` IN( {$customer_ids} ) "; |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | // Subscriptions for specific profile IDs |
| 171 | - if( ! empty( $args['profile_id'] ) ) { |
|
| 171 | + if (!empty($args['profile_id'])) { |
|
| 172 | 172 | |
| 173 | - if( is_array( $args['profile_id'] ) ) { |
|
| 174 | - $profile_ids = implode( "','", array_map('sanitize_text_field', $args['profile_id'] ) ); |
|
| 173 | + if (is_array($args['profile_id'])) { |
|
| 174 | + $profile_ids = implode("','", array_map('sanitize_text_field', $args['profile_id'])); |
|
| 175 | 175 | } else { |
| 176 | - $profile_ids = sanitize_text_field( $args['profile_id'] ); |
|
| 176 | + $profile_ids = sanitize_text_field($args['profile_id']); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | $where .= " AND `profile_id` IN( '{$profile_ids}' ) "; |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // Subscriptions for specific statuses |
| 184 | - if( ! empty( $args['status'] ) ) { |
|
| 184 | + if (!empty($args['status'])) { |
|
| 185 | 185 | |
| 186 | - if( is_array( $args['status'] ) ) { |
|
| 187 | - $statuses = implode( "','", array_map( 'sanitize_text_field', $args['status'] ) ); |
|
| 186 | + if (is_array($args['status'])) { |
|
| 187 | + $statuses = implode("','", array_map('sanitize_text_field', $args['status'])); |
|
| 188 | 188 | } else { |
| 189 | - $statuses = sanitize_text_field( $args['status'] ); |
|
| 189 | + $statuses = sanitize_text_field($args['status']); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | $where .= " AND `status` IN( '{$statuses}' ) "; |
@@ -194,21 +194,21 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | // Subscriptions created for a specific date or in a date range |
| 197 | - if( ! empty( $args['date'] ) ) { |
|
| 197 | + if (!empty($args['date'])) { |
|
| 198 | 198 | |
| 199 | - if( is_array( $args['date'] ) ) { |
|
| 199 | + if (is_array($args['date'])) { |
|
| 200 | 200 | |
| 201 | - if( ! empty( $args['date']['start'] ) ) { |
|
| 201 | + if (!empty($args['date']['start'])) { |
|
| 202 | 202 | |
| 203 | - $start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) ); |
|
| 203 | + $start = date('Y-m-d H:i:s', strtotime($args['date']['start'])); |
|
| 204 | 204 | |
| 205 | 205 | $where .= " AND `created` >= '{$start}'"; |
| 206 | 206 | |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - if( ! empty( $args['date']['end'] ) ) { |
|
| 209 | + if (!empty($args['date']['end'])) { |
|
| 210 | 210 | |
| 211 | - $end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) ); |
|
| 211 | + $end = date('Y-m-d H:i:s', strtotime($args['date']['end'])); |
|
| 212 | 212 | |
| 213 | 213 | $where .= " AND `created` <= '{$end}'"; |
| 214 | 214 | |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | } else { |
| 218 | 218 | |
| 219 | - $year = date( 'Y', strtotime( $args['date'] ) ); |
|
| 220 | - $month = date( 'm', strtotime( $args['date'] ) ); |
|
| 221 | - $day = date( 'd', strtotime( $args['date'] ) ); |
|
| 219 | + $year = date('Y', strtotime($args['date'])); |
|
| 220 | + $month = date('m', strtotime($args['date'])); |
|
| 221 | + $day = date('d', strtotime($args['date'])); |
|
| 222 | 222 | |
| 223 | 223 | $where .= " AND $year = YEAR ( created ) AND $month = MONTH ( created ) AND $day = DAY ( created )"; |
| 224 | 224 | } |
@@ -226,21 +226,21 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | // Subscriptions with a specific expiration date or in an expiration date range |
| 229 | - if( ! empty( $args['expiration'] ) ) { |
|
| 229 | + if (!empty($args['expiration'])) { |
|
| 230 | 230 | |
| 231 | - if( is_array( $args['expiration'] ) ) { |
|
| 231 | + if (is_array($args['expiration'])) { |
|
| 232 | 232 | |
| 233 | - if( ! empty( $args['expiration']['start'] ) ) { |
|
| 233 | + if (!empty($args['expiration']['start'])) { |
|
| 234 | 234 | |
| 235 | - $start = date( 'Y-m-d H:i:s', strtotime( $args['expiration']['start'] ) ); |
|
| 235 | + $start = date('Y-m-d H:i:s', strtotime($args['expiration']['start'])); |
|
| 236 | 236 | |
| 237 | 237 | $where .= " AND `expiration` >= '{$start}'"; |
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if( ! empty( $args['expiration']['end'] ) ) { |
|
| 241 | + if (!empty($args['expiration']['end'])) { |
|
| 242 | 242 | |
| 243 | - $end = date( 'Y-m-d H:i:s', strtotime( $args['expiration']['end'] ) ); |
|
| 243 | + $end = date('Y-m-d H:i:s', strtotime($args['expiration']['end'])); |
|
| 244 | 244 | |
| 245 | 245 | $where .= " AND `expiration` <= '{$end}'"; |
| 246 | 246 | |
@@ -248,73 +248,73 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | } else { |
| 250 | 250 | |
| 251 | - $year = date( 'Y', strtotime( $args['expiration'] ) ); |
|
| 252 | - $month = date( 'm', strtotime( $args['expiration'] ) ); |
|
| 253 | - $day = date( 'd', strtotime( $args['expiration'] ) ); |
|
| 251 | + $year = date('Y', strtotime($args['expiration'])); |
|
| 252 | + $month = date('m', strtotime($args['expiration'])); |
|
| 253 | + $day = date('d', strtotime($args['expiration'])); |
|
| 254 | 254 | |
| 255 | 255 | $where .= " AND $year = YEAR ( expiration ) AND $month = MONTH ( expiration ) AND $day = DAY ( expiration )"; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if ( ! empty( $args['search'] ) ) { |
|
| 260 | + if (!empty($args['search'])) { |
|
| 261 | 261 | |
| 262 | - if( false !== strpos( 'id:', $args['search'] ) ) { |
|
| 262 | + if (false !== strpos('id:', $args['search'])) { |
|
| 263 | 263 | |
| 264 | - $args['search'] = trim( str_replace( 'id:', '', $args['search'] ) ); |
|
| 265 | - $where .= " AND `id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 264 | + $args['search'] = trim(str_replace('id:', '', $args['search'])); |
|
| 265 | + $where .= " AND `id` = '" . esc_sql($args['search']) . "'"; |
|
| 266 | 266 | |
| 267 | - } else if( false !== strpos( $args['search'], 'txn:' ) ) { |
|
| 267 | + } else if (false !== strpos($args['search'], 'txn:')) { |
|
| 268 | 268 | |
| 269 | - $args['search'] = trim( str_replace( 'txn:', '', $args['search'] ) ); |
|
| 270 | - $where .= " AND `transaction_id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 269 | + $args['search'] = trim(str_replace('txn:', '', $args['search'])); |
|
| 270 | + $where .= " AND `transaction_id` = '" . esc_sql($args['search']) . "'"; |
|
| 271 | 271 | |
| 272 | - } else if( false !== strpos( $args['search'], 'profile_id:' ) ) { |
|
| 272 | + } else if (false !== strpos($args['search'], 'profile_id:')) { |
|
| 273 | 273 | |
| 274 | - $args['search'] = trim( str_replace( 'profile_id:', '', $args['search'] ) ); |
|
| 275 | - $where .= " AND `profile_id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 274 | + $args['search'] = trim(str_replace('profile_id:', '', $args['search'])); |
|
| 275 | + $where .= " AND `profile_id` = '" . esc_sql($args['search']) . "'"; |
|
| 276 | 276 | |
| 277 | - } else if( false !== strpos( $args['search'], 'product_id:' ) ) { |
|
| 277 | + } else if (false !== strpos($args['search'], 'product_id:')) { |
|
| 278 | 278 | |
| 279 | - $args['search'] = trim( str_replace( 'product_id:', '', $args['search'] ) ); |
|
| 280 | - $where .= " AND `product_id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 279 | + $args['search'] = trim(str_replace('product_id:', '', $args['search'])); |
|
| 280 | + $where .= " AND `product_id` = '" . esc_sql($args['search']) . "'"; |
|
| 281 | 281 | |
| 282 | - } else if( false !== strpos( $args['search'], 'customer_id:' ) ) { |
|
| 282 | + } else if (false !== strpos($args['search'], 'customer_id:')) { |
|
| 283 | 283 | |
| 284 | - $args['search'] = trim( str_replace( 'customer_id:', '', $args['search'] ) ); |
|
| 285 | - $where .= " AND `customer_id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 284 | + $args['search'] = trim(str_replace('customer_id:', '', $args['search'])); |
|
| 285 | + $where .= " AND `customer_id` = '" . esc_sql($args['search']) . "'"; |
|
| 286 | 286 | |
| 287 | 287 | } else { |
| 288 | 288 | |
| 289 | - $where .= " AND ( `parent_payment_id` LIKE '%%" . esc_sql( $args['search'] ) . "%%' OR `profile_id` LIKE '%%" . esc_sql( $args['search'] ) . "%%' OR `transaction_id` LIKE '%%" . esc_sql( $args['search'] ) . "%%' OR `product_id` LIKE '%%" . esc_sql( $args['search'] ) . "%%' OR `id` = '" . esc_sql( $args['search'] ) . "' )"; |
|
| 289 | + $where .= " AND ( `parent_payment_id` LIKE '%%" . esc_sql($args['search']) . "%%' OR `profile_id` LIKE '%%" . esc_sql($args['search']) . "%%' OR `transaction_id` LIKE '%%" . esc_sql($args['search']) . "%%' OR `product_id` LIKE '%%" . esc_sql($args['search']) . "%%' OR `id` = '" . esc_sql($args['search']) . "' )"; |
|
| 290 | 290 | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $args['orderby'] = ! array_key_exists( $args['orderby'], $this->get_columns() ) ? 'id' : $args['orderby']; |
|
| 295 | + $args['orderby'] = !array_key_exists($args['orderby'], $this->get_columns()) ? 'id' : $args['orderby']; |
|
| 296 | 296 | |
| 297 | - if( 'amount' == $args['orderby'] ) { |
|
| 297 | + if ('amount' == $args['orderby']) { |
|
| 298 | 298 | $args['orderby'] = 'amount+0'; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - $cache_key = md5( 'wpinv_subscriptions_' . serialize( $args ) ); |
|
| 301 | + $cache_key = md5('wpinv_subscriptions_' . serialize($args)); |
|
| 302 | 302 | |
| 303 | - $subscriptions = wp_cache_get( $cache_key, 'subscriptions' ); |
|
| 303 | + $subscriptions = wp_cache_get($cache_key, 'subscriptions'); |
|
| 304 | 304 | |
| 305 | - $args['orderby'] = esc_sql( $args['orderby'] ); |
|
| 306 | - $args['order'] = esc_sql( $args['order'] ); |
|
| 305 | + $args['orderby'] = esc_sql($args['orderby']); |
|
| 306 | + $args['order'] = esc_sql($args['order']); |
|
| 307 | 307 | |
| 308 | - if( $subscriptions === false ) { |
|
| 309 | - $subscriptions = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint( $args['offset'] ), absint( $args['number'] ) ), OBJECT ); |
|
| 308 | + if ($subscriptions === false) { |
|
| 309 | + $subscriptions = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->table_name $where ORDER BY {$args['orderby']} {$args['order']} LIMIT %d,%d;", absint($args['offset']), absint($args['number'])), OBJECT); |
|
| 310 | 310 | |
| 311 | - if( ! empty( $subscriptions ) ) { |
|
| 311 | + if (!empty($subscriptions)) { |
|
| 312 | 312 | |
| 313 | - foreach( $subscriptions as $key => $subscription ) { |
|
| 314 | - $subscriptions[ $key ] = new WPInv_Subscription( $subscription ); |
|
| 313 | + foreach ($subscriptions as $key => $subscription) { |
|
| 314 | + $subscriptions[$key] = new WPInv_Subscription($subscription); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - wp_cache_set( $cache_key, $subscriptions, 'subscriptions', 3600 ); |
|
| 317 | + wp_cache_set($cache_key, $subscriptions, 'subscriptions', 3600); |
|
| 318 | 318 | |
| 319 | 319 | } |
| 320 | 320 | |
@@ -329,19 +329,19 @@ discard block |
||
| 329 | 329 | * @access public |
| 330 | 330 | * @since 1.0.0 |
| 331 | 331 | */ |
| 332 | - public function count( $args = array() ) { |
|
| 332 | + public function count($args = array()) { |
|
| 333 | 333 | |
| 334 | 334 | global $wpdb; |
| 335 | 335 | |
| 336 | 336 | $where = ' WHERE 1=1 '; |
| 337 | 337 | |
| 338 | 338 | // specific customers |
| 339 | - if( ! empty( $args['id'] ) ) { |
|
| 339 | + if (!empty($args['id'])) { |
|
| 340 | 340 | |
| 341 | - if( is_array( $args['id'] ) ) { |
|
| 342 | - $ids = implode( ',', array_map('intval', $args['id'] ) ); |
|
| 341 | + if (is_array($args['id'])) { |
|
| 342 | + $ids = implode(',', array_map('intval', $args['id'])); |
|
| 343 | 343 | } else { |
| 344 | - $ids = intval( $args['id'] ); |
|
| 344 | + $ids = intval($args['id']); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | $where .= " AND `id` IN( {$ids} ) "; |
@@ -349,12 +349,12 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | // Specific products |
| 352 | - if( ! empty( $args['product_id'] ) ) { |
|
| 352 | + if (!empty($args['product_id'])) { |
|
| 353 | 353 | |
| 354 | - if( is_array( $args['product_id'] ) ) { |
|
| 355 | - $product_ids = implode( ',', array_map('intval', $args['product_id'] ) ); |
|
| 354 | + if (is_array($args['product_id'])) { |
|
| 355 | + $product_ids = implode(',', array_map('intval', $args['product_id'])); |
|
| 356 | 356 | } else { |
| 357 | - $product_ids = intval( $args['product_id'] ); |
|
| 357 | + $product_ids = intval($args['product_id']); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $where .= " AND `product_id` IN( {$product_ids} ) "; |
@@ -362,12 +362,12 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | // Specific parent payments |
| 365 | - if( ! empty( $args['parent_payment_id'] ) ) { |
|
| 365 | + if (!empty($args['parent_payment_id'])) { |
|
| 366 | 366 | |
| 367 | - if( is_array( $args['parent_payment_id'] ) ) { |
|
| 368 | - $parent_payment_ids = implode( ',', array_map('intval', $args['parent_payment_id'] ) ); |
|
| 367 | + if (is_array($args['parent_payment_id'])) { |
|
| 368 | + $parent_payment_ids = implode(',', array_map('intval', $args['parent_payment_id'])); |
|
| 369 | 369 | } else { |
| 370 | - $parent_payment_ids = intval( $args['parent_payment_id'] ); |
|
| 370 | + $parent_payment_ids = intval($args['parent_payment_id']); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | $where .= " AND `parent_payment_id` IN( {$parent_payment_ids} ) "; |
@@ -375,12 +375,12 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | // Subscriptoins for specific customers |
| 378 | - if( ! empty( $args['customer_id'] ) ) { |
|
| 378 | + if (!empty($args['customer_id'])) { |
|
| 379 | 379 | |
| 380 | - if( is_array( $args['customer_id'] ) ) { |
|
| 381 | - $customer_ids = implode( ',', array_map('intval', $args['customer_id'] ) ); |
|
| 380 | + if (is_array($args['customer_id'])) { |
|
| 381 | + $customer_ids = implode(',', array_map('intval', $args['customer_id'])); |
|
| 382 | 382 | } else { |
| 383 | - $customer_ids = intval( $args['customer_id'] ); |
|
| 383 | + $customer_ids = intval($args['customer_id']); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | $where .= " AND `customer_id` IN( {$customer_ids} ) "; |
@@ -388,12 +388,12 @@ discard block |
||
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // Subscriptions for specific profile IDs |
| 391 | - if( ! empty( $args['profile_id'] ) ) { |
|
| 391 | + if (!empty($args['profile_id'])) { |
|
| 392 | 392 | |
| 393 | - if( is_array( $args['profile_id'] ) ) { |
|
| 394 | - $profile_ids = implode( ',', array_map('intval', $args['profile_id'] ) ); |
|
| 393 | + if (is_array($args['profile_id'])) { |
|
| 394 | + $profile_ids = implode(',', array_map('intval', $args['profile_id'])); |
|
| 395 | 395 | } else { |
| 396 | - $profile_ids = intval( $args['profile_id'] ); |
|
| 396 | + $profile_ids = intval($args['profile_id']); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $where .= " AND `profile_id` IN( {$profile_ids} ) "; |
@@ -401,12 +401,12 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | // Specific transaction IDs |
| 404 | - if( ! empty( $args['transaction_id'] ) ) { |
|
| 404 | + if (!empty($args['transaction_id'])) { |
|
| 405 | 405 | |
| 406 | - if( is_array( $args['transaction_id'] ) ) { |
|
| 407 | - $transaction_ids = implode( ',', array_map('sanitize_text_field', $args['transaction_id'] ) ); |
|
| 406 | + if (is_array($args['transaction_id'])) { |
|
| 407 | + $transaction_ids = implode(',', array_map('sanitize_text_field', $args['transaction_id'])); |
|
| 408 | 408 | } else { |
| 409 | - $transaction_ids = sanitize_text_field( $args['transaction_id'] ); |
|
| 409 | + $transaction_ids = sanitize_text_field($args['transaction_id']); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | $where .= " AND `transaction_id` IN( {$transaction_ids} ) "; |
@@ -414,10 +414,10 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | // Subscriptions for specific statuses |
| 417 | - if( ! empty( $args['status'] ) ) { |
|
| 417 | + if (!empty($args['status'])) { |
|
| 418 | 418 | |
| 419 | - if( is_array( $args['status'] ) ) { |
|
| 420 | - $statuses = implode( ',', $args['status'] ); |
|
| 419 | + if (is_array($args['status'])) { |
|
| 420 | + $statuses = implode(',', $args['status']); |
|
| 421 | 421 | $where .= " AND `status` IN( {$statuses} ) "; |
| 422 | 422 | } else { |
| 423 | 423 | $statuses = $args['status']; |
@@ -429,21 +429,21 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | // Subscriptions created for a specific date or in a date range |
| 432 | - if( ! empty( $args['date'] ) ) { |
|
| 432 | + if (!empty($args['date'])) { |
|
| 433 | 433 | |
| 434 | - if( is_array( $args['date'] ) ) { |
|
| 434 | + if (is_array($args['date'])) { |
|
| 435 | 435 | |
| 436 | - if( ! empty( $args['date']['start'] ) ) { |
|
| 436 | + if (!empty($args['date']['start'])) { |
|
| 437 | 437 | |
| 438 | - $start = date( 'Y-m-d H:i:s', strtotime( $args['date']['start'] ) ); |
|
| 438 | + $start = date('Y-m-d H:i:s', strtotime($args['date']['start'])); |
|
| 439 | 439 | |
| 440 | 440 | $where .= " AND `created` >= '{$start}'"; |
| 441 | 441 | |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - if( ! empty( $args['date']['end'] ) ) { |
|
| 444 | + if (!empty($args['date']['end'])) { |
|
| 445 | 445 | |
| 446 | - $end = date( 'Y-m-d H:i:s', strtotime( $args['date']['end'] ) ); |
|
| 446 | + $end = date('Y-m-d H:i:s', strtotime($args['date']['end'])); |
|
| 447 | 447 | |
| 448 | 448 | $where .= " AND `created` <= '{$end}'"; |
| 449 | 449 | |
@@ -451,9 +451,9 @@ discard block |
||
| 451 | 451 | |
| 452 | 452 | } else { |
| 453 | 453 | |
| 454 | - $year = date( 'Y', strtotime( $args['date'] ) ); |
|
| 455 | - $month = date( 'm', strtotime( $args['date'] ) ); |
|
| 456 | - $day = date( 'd', strtotime( $args['date'] ) ); |
|
| 454 | + $year = date('Y', strtotime($args['date'])); |
|
| 455 | + $month = date('m', strtotime($args['date'])); |
|
| 456 | + $day = date('d', strtotime($args['date'])); |
|
| 457 | 457 | |
| 458 | 458 | $where .= " AND $year = YEAR ( created ) AND $month = MONTH ( created ) AND $day = DAY ( created )"; |
| 459 | 459 | } |
@@ -461,21 +461,21 @@ discard block |
||
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | // Subscriptions with a specific expiration date or in an expiration date range |
| 464 | - if( ! empty( $args['expiration'] ) ) { |
|
| 464 | + if (!empty($args['expiration'])) { |
|
| 465 | 465 | |
| 466 | - if( is_array( $args['expiration'] ) ) { |
|
| 466 | + if (is_array($args['expiration'])) { |
|
| 467 | 467 | |
| 468 | - if( ! empty( $args['expiration']['start'] ) ) { |
|
| 468 | + if (!empty($args['expiration']['start'])) { |
|
| 469 | 469 | |
| 470 | - $start = date( 'Y-m-d H:i:s', strtotime( $args['expiration']['start'] ) ); |
|
| 470 | + $start = date('Y-m-d H:i:s', strtotime($args['expiration']['start'])); |
|
| 471 | 471 | |
| 472 | 472 | $where .= " AND `expiration` >= '{$start}'"; |
| 473 | 473 | |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - if( ! empty( $args['expiration']['end'] ) ) { |
|
| 476 | + if (!empty($args['expiration']['end'])) { |
|
| 477 | 477 | |
| 478 | - $end = date( 'Y-m-d H:i:s', strtotime( $args['expiration']['end'] ) ); |
|
| 478 | + $end = date('Y-m-d H:i:s', strtotime($args['expiration']['end'])); |
|
| 479 | 479 | |
| 480 | 480 | $where .= " AND `expiration` <= '{$end}'"; |
| 481 | 481 | |
@@ -483,64 +483,64 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | } else { |
| 485 | 485 | |
| 486 | - $year = date( 'Y', strtotime( $args['expiration'] ) ); |
|
| 487 | - $month = date( 'm', strtotime( $args['expiration'] ) ); |
|
| 488 | - $day = date( 'd', strtotime( $args['expiration'] ) ); |
|
| 486 | + $year = date('Y', strtotime($args['expiration'])); |
|
| 487 | + $month = date('m', strtotime($args['expiration'])); |
|
| 488 | + $day = date('d', strtotime($args['expiration'])); |
|
| 489 | 489 | |
| 490 | 490 | $where .= " AND $year = YEAR ( expiration ) AND $month = MONTH ( expiration ) AND $day = DAY ( expiration )"; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | - if ( ! empty( $args['search'] ) ) { |
|
| 495 | + if (!empty($args['search'])) { |
|
| 496 | 496 | |
| 497 | - if( false !== strpos( 'id:', $args['search'] ) ) { |
|
| 497 | + if (false !== strpos('id:', $args['search'])) { |
|
| 498 | 498 | |
| 499 | - $args['search'] = trim( str_replace( 'id:', '', $args['search'] ) ); |
|
| 500 | - $where .= " AND `id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 499 | + $args['search'] = trim(str_replace('id:', '', $args['search'])); |
|
| 500 | + $where .= " AND `id` = '" . esc_sql($args['search']) . "'"; |
|
| 501 | 501 | |
| 502 | - } else if( false !== strpos( $args['search'], 'txn:' ) ) { |
|
| 502 | + } else if (false !== strpos($args['search'], 'txn:')) { |
|
| 503 | 503 | |
| 504 | - $args['search'] = trim( str_replace( 'txn:', '', $args['search'] ) ); |
|
| 505 | - $where .= " AND `transaction_id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 504 | + $args['search'] = trim(str_replace('txn:', '', $args['search'])); |
|
| 505 | + $where .= " AND `transaction_id` = '" . esc_sql($args['search']) . "'"; |
|
| 506 | 506 | |
| 507 | - } else if( false !== strpos( $args['search'], 'profile_id:' ) ) { |
|
| 507 | + } else if (false !== strpos($args['search'], 'profile_id:')) { |
|
| 508 | 508 | |
| 509 | - $args['search'] = trim( str_replace( 'profile_id:', '', $args['search'] ) ); |
|
| 510 | - $where .= " AND `profile_id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 509 | + $args['search'] = trim(str_replace('profile_id:', '', $args['search'])); |
|
| 510 | + $where .= " AND `profile_id` = '" . esc_sql($args['search']) . "'"; |
|
| 511 | 511 | |
| 512 | - } else if( false !== strpos( $args['search'], 'product_id:' ) ) { |
|
| 512 | + } else if (false !== strpos($args['search'], 'product_id:')) { |
|
| 513 | 513 | |
| 514 | - $args['search'] = trim( str_replace( 'product_id:', '', $args['search'] ) ); |
|
| 515 | - $where .= " AND `product_id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 514 | + $args['search'] = trim(str_replace('product_id:', '', $args['search'])); |
|
| 515 | + $where .= " AND `product_id` = '" . esc_sql($args['search']) . "'"; |
|
| 516 | 516 | |
| 517 | - } else if( false !== strpos( $args['search'], 'customer_id:' ) ) { |
|
| 517 | + } else if (false !== strpos($args['search'], 'customer_id:')) { |
|
| 518 | 518 | |
| 519 | - $args['search'] = trim( str_replace( 'customer_id:', '', $args['search'] ) ); |
|
| 520 | - $where .= " AND `customer_id` = '" . esc_sql( $args['search'] ) . "'"; |
|
| 519 | + $args['search'] = trim(str_replace('customer_id:', '', $args['search'])); |
|
| 520 | + $where .= " AND `customer_id` = '" . esc_sql($args['search']) . "'"; |
|
| 521 | 521 | |
| 522 | 522 | } else { |
| 523 | 523 | |
| 524 | - $where .= " AND ( `parent_payment_id` LIKE '%%" . esc_sql( $args['search'] ) . "%%' OR `profile_id` LIKE '%%" . esc_sql( $args['search'] ) . "%%' OR `transaction_id` LIKE '%%" . esc_sql( $args['search'] ) . "%%' OR `product_id` LIKE '%%" . esc_sql( $args['search'] ) . "%%' OR `id` = '" . esc_sql( $args['search'] ) . "' )"; |
|
| 524 | + $where .= " AND ( `parent_payment_id` LIKE '%%" . esc_sql($args['search']) . "%%' OR `profile_id` LIKE '%%" . esc_sql($args['search']) . "%%' OR `transaction_id` LIKE '%%" . esc_sql($args['search']) . "%%' OR `product_id` LIKE '%%" . esc_sql($args['search']) . "%%' OR `id` = '" . esc_sql($args['search']) . "' )"; |
|
| 525 | 525 | |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - $cache_key = md5( 'wpinv_subscriptions_count' . serialize( $args ) ); |
|
| 530 | + $cache_key = md5('wpinv_subscriptions_count' . serialize($args)); |
|
| 531 | 531 | |
| 532 | - $count = wp_cache_get( $cache_key, 'subscriptions' ); |
|
| 532 | + $count = wp_cache_get($cache_key, 'subscriptions'); |
|
| 533 | 533 | |
| 534 | - if( $count === false ) { |
|
| 534 | + if ($count === false) { |
|
| 535 | 535 | |
| 536 | 536 | $sql = "SELECT COUNT($this->primary_key) FROM " . $this->table_name . "{$where};"; |
| 537 | - $count = $wpdb->get_var( $sql ); |
|
| 537 | + $count = $wpdb->get_var($sql); |
|
| 538 | 538 | |
| 539 | - wp_cache_set( $cache_key, $count, 'subscriptions', 3600 ); |
|
| 539 | + wp_cache_set($cache_key, $count, 'subscriptions', 3600); |
|
| 540 | 540 | |
| 541 | 541 | } |
| 542 | 542 | |
| 543 | - return absint( $count ); |
|
| 543 | + return absint($count); |
|
| 544 | 544 | |
| 545 | 545 | } |
| 546 | 546 | |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | public function create_table() { |
| 554 | 554 | global $wpdb; |
| 555 | 555 | |
| 556 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 556 | + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
| 557 | 557 | |
| 558 | 558 | $sql = "CREATE TABLE " . $this->table_name . " ( |
| 559 | 559 | id bigint(20) NOT NULL AUTO_INCREMENT, |
@@ -578,9 +578,9 @@ discard block |
||
| 578 | 578 | KEY customer_and_status ( customer_id, status) |
| 579 | 579 | ) CHARACTER SET utf8 COLLATE utf8_general_ci;"; |
| 580 | 580 | |
| 581 | - dbDelta( $sql ); |
|
| 581 | + dbDelta($sql); |
|
| 582 | 582 | |
| 583 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
| 583 | + update_option($this->table_name . '_db_version', $this->version); |
|
| 584 | 584 | } |
| 585 | 585 | |
| 586 | 586 | } |
| 587 | 587 | \ No newline at end of file |
@@ -22,14 +22,14 @@ discard block |
||
| 22 | 22 | 'block-output' => array( // the block visual output elements as an array |
| 23 | 23 | array( |
| 24 | 24 | 'element' => 'p', |
| 25 | - 'content' => __('A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ','super-duper'), |
|
| 25 | + 'content' => __('A Google API key is required to use this block, we recommend installing our plugin which makes it easy and sets it globally, or you can set a key in the block settings sidebar: ', 'super-duper'), |
|
| 26 | 26 | //'element_require' => '"1"=='.get_option( 'rgmk_google_map_api_key', '"0"') ? '"0"' : '"1"', |
| 27 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', |
|
| 27 | + 'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', |
|
| 28 | 28 | ), |
| 29 | 29 | array( |
| 30 | 30 | 'element' => 'a', |
| 31 | - 'content' => __('API KEY for Google Maps','super-duper'), |
|
| 32 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', |
|
| 31 | + 'content' => __('API KEY for Google Maps', 'super-duper'), |
|
| 32 | + 'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1 && [%api_key%]==""', |
|
| 33 | 33 | 'href' => 'https://wordpress.org/plugins/api-key-for-google-maps/', |
| 34 | 34 | ), |
| 35 | 35 | array( |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'class' => '[%className%]', |
| 38 | 38 | //'content' => 'Hello: [%after_text%]' // block properties can be added by wrapping them in [%name%] |
| 39 | 39 | 'element_require' => '[%type%]=="image"', |
| 40 | - 'src' => get_option( 'rgmk_google_map_api_key', false) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=".get_option( 'rgmk_google_map_api_key') : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]" |
|
| 40 | + 'src' => get_option('rgmk_google_map_api_key', false) ? "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=" . get_option('rgmk_google_map_api_key') : "https://maps.googleapis.com/maps/api/staticmap?center=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&size=[%static_width%]x[%static_height%]&key=[%api_key%]" |
|
| 41 | 41 | ), |
| 42 | 42 | array( |
| 43 | 43 | 'element' => 'div', |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | 'style' => '{overflow:"hidden", position:"relative"}', |
| 46 | 46 | array( |
| 47 | 47 | 'element' => 'iframe', |
| 48 | - 'title' => __( 'Placeholderx', 'super-duper' ), |
|
| 48 | + 'title' => __('Placeholderx', 'super-duper'), |
|
| 49 | 49 | 'class' => '[%className%]', |
| 50 | 50 | 'width' => '[%width%]', |
| 51 | 51 | 'height' => '[%height%]', |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | 'allowfullscreen' => 'true', |
| 54 | 54 | 'style' => '{border:0}', |
| 55 | 55 | 'element_require' => '[%type%]!="image"', |
| 56 | - 'src' => get_option( 'rgmk_google_map_api_key', false) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=".get_option( 'rgmk_google_map_api_key') : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]" |
|
| 56 | + 'src' => get_option('rgmk_google_map_api_key', false) ? "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=" . get_option('rgmk_google_map_api_key') : "https://www.google.com/maps/embed/v1/[%type%]?q=[%location%]&maptype=[%maptype%]&zoom=[%zoom%]&key=[%api_key%]" |
|
| 57 | 57 | ), |
| 58 | 58 | ), |
| 59 | 59 | array( |
| 60 | 60 | 'element' => 'style', |
| 61 | - 'content' => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "'.__("Click here, Settings are in the block settings sidebar","super-duper").'";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center; color: #fff; font-size: 20px; font-weight: bold;}', |
|
| 61 | + 'content' => '.sd-map-iframe-cover:hover:before {background: #4a4a4a88; content: "' . __("Click here, Settings are in the block settings sidebar", "super-duper") . '";} .sd-map-iframe-cover:before{cursor: pointer; content: ""; width: 100%; height: 100%; position: absolute; top: 0; bottom: 0;padding-top: 33%; text-align: center; color: #fff; font-size: 20px; font-weight: bold;}', |
|
| 62 | 62 | 'element_require' => '[%type%]!="image"', |
| 63 | 63 | ), |
| 64 | 64 | ), |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | // The calling class name |
| 67 | 67 | 'base_id' => 'sd_map', |
| 68 | 68 | // this is used as the widget id and the shortcode id. |
| 69 | - 'name' => __( 'Map', 'super-duper' ), |
|
| 69 | + 'name' => __('Map', 'super-duper'), |
|
| 70 | 70 | // the name of the widget/block |
| 71 | 71 | 'widget_ops' => array( |
| 72 | 72 | 'classname' => 'sd-map-class', |
| 73 | 73 | // widget class |
| 74 | - 'description' => esc_html__( 'This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world' ), |
|
| 74 | + 'description' => esc_html__('This is an example that will take a text parameter and output it after `Hello:`.', 'hello-world'), |
|
| 75 | 75 | // widget description |
| 76 | 76 | ), |
| 77 | 77 | 'arguments' => array( // these are the arguments that will be used in the widget, shortcode and block settings. |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | ), |
| 94 | 94 | 'location' => array( |
| 95 | 95 | 'type' => 'text', |
| 96 | - 'title' => __( 'Location:', 'geodirectory' ), |
|
| 97 | - 'desc' => __( 'Enter the location to show on the map, place, city, zip code or GPS.', 'geodirectory' ), |
|
| 96 | + 'title' => __('Location:', 'geodirectory'), |
|
| 97 | + 'desc' => __('Enter the location to show on the map, place, city, zip code or GPS.', 'geodirectory'), |
|
| 98 | 98 | 'placeholder' => 'Place, city, zip code or GPS', |
| 99 | 99 | 'desc_tip' => true, |
| 100 | 100 | 'default' => 'Ireland', |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | ), |
| 103 | 103 | 'static_width' => array( |
| 104 | 104 | 'type' => 'number', |
| 105 | - 'title' => __( 'Width:', 'geodirectory' ), |
|
| 106 | - 'desc' => __( 'This is the width of the map, for static maps you can only use px values.', 'geodirectory' ), |
|
| 105 | + 'title' => __('Width:', 'geodirectory'), |
|
| 106 | + 'desc' => __('This is the width of the map, for static maps you can only use px values.', 'geodirectory'), |
|
| 107 | 107 | 'placeholder' => '600', |
| 108 | 108 | 'desc_tip' => true, |
| 109 | 109 | 'default' => '600', |
@@ -116,8 +116,8 @@ discard block |
||
| 116 | 116 | ), |
| 117 | 117 | 'static_height' => array( |
| 118 | 118 | 'type' => 'number', |
| 119 | - 'title' => __( 'Height:', 'geodirectory' ), |
|
| 120 | - 'desc' => __( 'This is the height of the map, for static maps you can only use px values.', 'geodirectory' ), |
|
| 119 | + 'title' => __('Height:', 'geodirectory'), |
|
| 120 | + 'desc' => __('This is the height of the map, for static maps you can only use px values.', 'geodirectory'), |
|
| 121 | 121 | 'placeholder' => '400', |
| 122 | 122 | 'desc_tip' => true, |
| 123 | 123 | 'default' => '400', |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | ), |
| 132 | 132 | 'width' => array( |
| 133 | 133 | 'type' => 'text', |
| 134 | - 'title' => __( 'Width:', 'geodirectory' ), |
|
| 135 | - 'desc' => __( 'This is the width of the map, you can use % or px here.', 'geodirectory' ), |
|
| 134 | + 'title' => __('Width:', 'geodirectory'), |
|
| 135 | + 'desc' => __('This is the width of the map, you can use % or px here.', 'geodirectory'), |
|
| 136 | 136 | 'placeholder' => '100%', |
| 137 | 137 | 'desc_tip' => true, |
| 138 | 138 | 'default' => '100%', |
@@ -141,8 +141,8 @@ discard block |
||
| 141 | 141 | ), |
| 142 | 142 | 'height' => array( |
| 143 | 143 | 'type' => 'text', |
| 144 | - 'title' => __( 'Height:', 'geodirectory' ), |
|
| 145 | - 'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'geodirectory' ), |
|
| 144 | + 'title' => __('Height:', 'geodirectory'), |
|
| 145 | + 'desc' => __('This is the height of the map, you can use %, px or vh here.', 'geodirectory'), |
|
| 146 | 146 | 'placeholder' => '425px', |
| 147 | 147 | 'desc_tip' => true, |
| 148 | 148 | 'default' => '425px', |
@@ -151,11 +151,11 @@ discard block |
||
| 151 | 151 | ), |
| 152 | 152 | 'maptype' => array( |
| 153 | 153 | 'type' => 'select', |
| 154 | - 'title' => __( 'Mapview:', 'geodirectory' ), |
|
| 155 | - 'desc' => __( 'This is the type of map view that will be used by default.', 'geodirectory' ), |
|
| 154 | + 'title' => __('Mapview:', 'geodirectory'), |
|
| 155 | + 'desc' => __('This is the type of map view that will be used by default.', 'geodirectory'), |
|
| 156 | 156 | 'options' => array( |
| 157 | - "roadmap" => __( 'Road Map', 'geodirectory' ), |
|
| 158 | - "satellite" => __( 'Satellite Map', 'geodirectory' ), |
|
| 157 | + "roadmap" => __('Road Map', 'geodirectory'), |
|
| 158 | + "satellite" => __('Satellite Map', 'geodirectory'), |
|
| 159 | 159 | // "hybrid" => __( 'Hybrid Map', 'geodirectory' ), |
| 160 | 160 | // "terrain" => __( 'Terrain Map', 'geodirectory' ), |
| 161 | 161 | ), |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | ), |
| 166 | 166 | 'zoom' => array( |
| 167 | 167 | 'type' => 'select', |
| 168 | - 'title' => __( 'Zoom level:', 'geodirectory' ), |
|
| 169 | - 'desc' => __( 'This is the zoom level of the map, `auto` is recommended.', 'geodirectory' ), |
|
| 170 | - 'options' => range( 1, 19 ), |
|
| 168 | + 'title' => __('Zoom level:', 'geodirectory'), |
|
| 169 | + 'desc' => __('This is the zoom level of the map, `auto` is recommended.', 'geodirectory'), |
|
| 170 | + 'options' => range(1, 19), |
|
| 171 | 171 | 'placeholder' => '', |
| 172 | 172 | 'desc_tip' => true, |
| 173 | 173 | 'default' => '7', |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | ), |
| 176 | 176 | 'api_key' => array( |
| 177 | 177 | 'type' => 'text', |
| 178 | - 'title' => __( 'Api Key:', 'geodirectory' ), |
|
| 179 | - 'desc' => __( 'This is the height of the map, you can use %, px or vh here.', 'geodirectory' ), |
|
| 178 | + 'title' => __('Api Key:', 'geodirectory'), |
|
| 179 | + 'desc' => __('This is the height of the map, you can use %, px or vh here.', 'geodirectory'), |
|
| 180 | 180 | 'placeholder' => '', |
| 181 | 181 | 'desc_tip' => true, |
| 182 | 182 | 'default' => '', |
| 183 | - 'element_require' => get_option( 'rgmk_google_map_api_key', false) ? '1==0' : '1==1', |
|
| 183 | + 'element_require' => get_option('rgmk_google_map_api_key', false) ? '1==0' : '1==1', |
|
| 184 | 184 | 'advanced' => false |
| 185 | 185 | ), |
| 186 | 186 | ) |
| 187 | 187 | ); |
| 188 | 188 | |
| 189 | - parent::__construct( $options ); |
|
| 189 | + parent::__construct($options); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @return string |
| 201 | 201 | */ |
| 202 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
| 202 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
| 203 | 203 | |
| 204 | 204 | // options |
| 205 | 205 | $defaults = array( |
@@ -217,18 +217,18 @@ discard block |
||
| 217 | 217 | /** |
| 218 | 218 | * Parse incoming $args into an array and merge it with $defaults |
| 219 | 219 | */ |
| 220 | - $args = wp_parse_args($args, $defaults ); |
|
| 220 | + $args = wp_parse_args($args, $defaults); |
|
| 221 | 221 | |
| 222 | 222 | $output = ''; |
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | // check if we have a global API key |
| 226 | - $args['api_key'] = get_option( 'rgmk_google_map_api_key', false ) ? get_option( 'rgmk_google_map_api_key' ) : $args['api_key']; |
|
| 226 | + $args['api_key'] = get_option('rgmk_google_map_api_key', false) ? get_option('rgmk_google_map_api_key') : $args['api_key']; |
|
| 227 | 227 | |
| 228 | - if($args['type']=='image'){ |
|
| 229 | - $output .= "<img src='https://maps.googleapis.com/maps/api/staticmap?center=".esc_attr($args['location'])."&maptype=".esc_attr($args['maptype'])."&zoom=".esc_attr($args['zoom'])."&size=".esc_attr($args['static_width'])."x".esc_attr($args['static_height'])."&key=".esc_attr($args['api_key'])."' />"; |
|
| 230 | - }else{ |
|
| 231 | - $output .= "<iframe width='".esc_attr($args['width'])."' height='".esc_attr($args['height'])."' frameborder='0' allowfullscreen style='border:0;' src='https://www.google.com/maps/embed/v1/".esc_attr($args['type'])."?q=".esc_attr($args['location'])."&maptype=".esc_attr($args['maptype'])."&zoom=".esc_attr($args['zoom'])."&key=".esc_attr($args['api_key'])."' ></iframe> "; |
|
| 228 | + if ($args['type'] == 'image') { |
|
| 229 | + $output .= "<img src='https://maps.googleapis.com/maps/api/staticmap?center=" . esc_attr($args['location']) . "&maptype=" . esc_attr($args['maptype']) . "&zoom=" . esc_attr($args['zoom']) . "&size=" . esc_attr($args['static_width']) . "x" . esc_attr($args['static_height']) . "&key=" . esc_attr($args['api_key']) . "' />"; |
|
| 230 | + } else { |
|
| 231 | + $output .= "<iframe width='" . esc_attr($args['width']) . "' height='" . esc_attr($args['height']) . "' frameborder='0' allowfullscreen style='border:0;' src='https://www.google.com/maps/embed/v1/" . esc_attr($args['type']) . "?q=" . esc_attr($args['location']) . "&maptype=" . esc_attr($args['maptype']) . "&zoom=" . esc_attr($args['zoom']) . "&key=" . esc_attr($args['api_key']) . "' ></iframe> "; |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | return $output; |
@@ -238,6 +238,6 @@ discard block |
||
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | // register it. |
| 241 | -add_action( 'widgets_init', function () { |
|
| 242 | - register_widget( 'SD_Map' ); |
|
| 241 | +add_action('widgets_init', function() { |
|
| 242 | + register_widget('SD_Map'); |
|
| 243 | 243 | } ); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $restrictedWords = implode('|', array_keys($this->locations)); |
| 21 | 21 | |
| 22 | 22 | $vars['name'] = strtolower($vars['name']); |
| 23 | - $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui', |
|
| 23 | + $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:' . $restrictedWords . ')-)?(.*?)(?:-(?:' . $restrictedWords . '))?$/ui', |
|
| 24 | 24 | '$1', |
| 25 | 25 | $vars['name'] |
| 26 | 26 | ); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function inflectPackageVars($vars) |
| 15 | 15 | { |
| 16 | 16 | if ($vars['type'] == 'mautic-plugin') { |
| 17 | - $vars['name'] = preg_replace_callback('/(-[a-z])/', function ($matches) { |
|
| 17 | + $vars['name'] = preg_replace_callback('/(-[a-z])/', function($matches) { |
|
| 18 | 18 | return strtoupper($matches[0][1]); |
| 19 | 19 | }, ucfirst($vars['name'])); |
| 20 | 20 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | unset($vars['name'][$key]); |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | - $vars['name'] = implode("",$vars['name']); |
|
| 25 | + $vars['name'] = implode("", $vars['name']); |
|
| 26 | 26 | |
| 27 | 27 | return $vars; |
| 28 | 28 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | private function correctPluginName($vars) |
| 30 | 30 | { |
| 31 | - $camelCasedName = preg_replace_callback('/(-[a-z])/', function ($matches) { |
|
| 31 | + $camelCasedName = preg_replace_callback('/(-[a-z])/', function($matches) { |
|
| 32 | 32 | return strtoupper($matches[0][1]); |
| 33 | 33 | }, $vars['name']); |
| 34 | 34 | $vars['name'] = ucfirst($camelCasedName); |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function inflectPackageVars($vars) |
| 14 | 14 | { |
| 15 | - $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function ($matches) { |
|
| 15 | + $vars['name'] = preg_replace_callback('/(?:^|_|-)(.?)/', function($matches) { |
|
| 16 | 16 | return strtoupper($matches[1]); |
| 17 | 17 | }, $vars['name']); |
| 18 | 18 | |
@@ -215,7 +215,7 @@ |
||
| 215 | 215 | $pattern = $locations ? '(' . implode('|', $locations) . ')' : false; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - return $pattern ? : '(\w+)'; |
|
| 218 | + return $pattern ?: '(\w+)'; |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | class BitrixInstaller extends BaseInstaller |
| 27 | 27 | { |
| 28 | 28 | protected $locations = array( |
| 29 | - 'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) |
|
| 29 | + 'module' => '{$bitrix_dir}/modules/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) |
|
| 30 | 30 | 'component' => '{$bitrix_dir}/components/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) |
| 31 | - 'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) |
|
| 31 | + 'theme' => '{$bitrix_dir}/templates/{$name}/', // deprecated, remove on the major release (Backward compatibility will be broken) |
|
| 32 | 32 | 'd7-module' => '{$bitrix_dir}/modules/{$vendor}.{$name}/', |
| 33 | 33 | 'd7-component' => '{$bitrix_dir}/components/{$vendor}/{$name}/', |
| 34 | 34 | 'd7-template' => '{$bitrix_dir}/templates/{$vendor}_{$name}/', |