@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined('ABSPATH') ) { |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! isset( $entry) ) { |
|
| 2 | +if ( ! isset( $entry ) ) { |
|
| 3 | 3 | $entry = $record; |
| 4 | 4 | } ?> |
| 5 | 5 | |
@@ -18,4 +18,4 @@ discard block |
||
| 18 | 18 | </div> |
| 19 | 19 | <?php } ?> |
| 20 | 20 | |
| 21 | -<?php do_action('frm_entry_shared_sidebar', $entry); ?> |
|
| 21 | +<?php do_action( 'frm_entry_shared_sidebar', $entry ); ?> |
|
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! isset( $entry) ) { |
| 3 | - $entry = $record; |
|
| 3 | + $entry = $record; |
|
| 4 | 4 | } ?> |
| 5 | 5 | |
| 6 | 6 | <div class="misc-pub-section curtime misc-pub-curtime"> |
| 7 | 7 | <span id="timestamp"> |
| 8 | 8 | <?php |
| 9 | - $date_format = __( 'M j, Y @ G:i' ); |
|
| 9 | + $date_format = __( 'M j, Y @ G:i' ); |
|
| 10 | 10 | printf( esc_html__( 'Published on: %1$s' ), '<b>' . FrmAppHelper::get_localized_date( $date_format, $entry->created_at ) . '</b>' ); |
| 11 | 11 | ?> |
| 12 | 12 | </span> |
@@ -66,18 +66,18 @@ |
||
| 66 | 66 | <?php } ?> |
| 67 | 67 | |
| 68 | 68 | <?php |
| 69 | - foreach ( (array) $data as $k => $d ) { |
|
| 69 | + foreach ( (array) $data as $k => $d ) { |
|
| 70 | 70 | if ( in_array( $k, array( 'browser', 'referrer' ) ) ) { |
| 71 | - continue; |
|
| 72 | - } |
|
| 73 | - ?> |
|
| 71 | + continue; |
|
| 72 | + } |
|
| 73 | + ?> |
|
| 74 | 74 | <div class="misc-pub-section"> |
| 75 | 75 | <b><?php echo sanitize_text_field( ucfirst( str_replace( '-', ' ', $k ) ) ); ?></b>: |
| 76 | 76 | <?php echo wp_kses_post( implode( ', ', (array) $d ) ); ?> |
| 77 | 77 | </div> |
| 78 | 78 | <?php |
| 79 | - unset($k, $d); |
|
| 80 | - } |
|
| 81 | - ?> |
|
| 79 | + unset($k, $d); |
|
| 80 | + } |
|
| 81 | + ?> |
|
| 82 | 82 | </div> |
| 83 | 83 | </div> |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | <div class="postbox frm_with_icons" > |
| 3 | 3 | <h3 class="hndle"> |
| 4 | 4 | <span><?php esc_html_e( 'Entry Details', 'formidable' ) ?></span> |
| 5 | - <?php if ( FrmAppHelper::get_param('frm_action') != 'show' ) { ?> |
|
| 5 | + <?php if ( FrmAppHelper::get_param( 'frm_action' ) != 'show' ) { ?> |
|
| 6 | 6 | <a href="?page=formidable-entries&frm_action=show&id=<?php echo absint( $entry->id ); ?>" class="alignright"> |
| 7 | 7 | <?php esc_html_e( 'View Entry', 'formidable' ) ?> |
| 8 | 8 | </a> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | <div class="misc-pub-section frm_no_print"> |
| 16 | 16 | <span class="dashicons dashicons-admin-post wp-media-buttons-icon"></span> |
| 17 | 17 | <?php esc_html_e( 'Post', 'formidable' ) ?>: |
| 18 | - <b><?php echo get_the_title($entry->post_id) ?></b> |
|
| 18 | + <b><?php echo get_the_title( $entry->post_id ) ?></b> |
|
| 19 | 19 | <span> |
| 20 | 20 | <a href="<?php echo esc_url( admin_url( 'post.php?post=' . $entry->post_id . '&action=edit' ) ) ?>"> |
| 21 | 21 | <?php esc_html_e( 'Edit', 'formidable' ) ?> |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | </div> |
| 76 | 76 | <?php } ?> |
| 77 | 77 | |
| 78 | - <?php if ( isset($data['referrer']) ) { ?> |
|
| 78 | + <?php if ( isset( $data['referrer'] ) ) { ?> |
|
| 79 | 79 | <div class="misc-pub-section frm_force_wrap"> |
| 80 | 80 | <b><?php esc_html_e( 'Referrer', 'formidable' ) ?></b>:<br/> |
| 81 | 81 | <?php echo wp_kses_post( str_replace( "\r\n", '<br/>', $data['referrer'] ) ); ?> |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | <?php echo wp_kses_post( implode( ', ', (array) $d ) ); ?> |
| 94 | 94 | </div> |
| 95 | 95 | <?php |
| 96 | - unset($k, $d); |
|
| 96 | + unset( $k, $d ); |
|
| 97 | 97 | } |
| 98 | 98 | ?> |
| 99 | 99 | </div> |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | class FrmDefPostAction extends FrmFormAction { |
| 4 | 4 | public function __construct() { |
| 5 | 5 | $action_ops = FrmFormAction::default_action_opts(); |
| 6 | - $action_ops['classes'] = 'ab-icon frm_dashicon_font dashicons-before'; |
|
| 6 | + $action_ops['classes'] = 'ab-icon frm_dashicon_font dashicons-before'; |
|
| 7 | 7 | |
| 8 | 8 | parent::__construct( 'wppost', __( 'Create Post', 'formidable' ), $action_ops ); |
| 9 | 9 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | // add register action |
| 13 | 13 | class FrmDefRegAction extends FrmFormAction { |
| 14 | 14 | public function __construct() { |
| 15 | - $action_ops = FrmFormAction::default_action_opts('frm_register_icon'); |
|
| 15 | + $action_ops = FrmFormAction::default_action_opts( 'frm_register_icon' ); |
|
| 16 | 16 | parent::__construct( 'register', __( 'Register User', 'formidable' ), $action_ops ); |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | // add paypal action |
| 21 | 21 | class FrmDefPayPalAction extends FrmFormAction { |
| 22 | 22 | public function __construct() { |
| 23 | - $action_ops = FrmFormAction::default_action_opts('frm_paypal_icon'); |
|
| 23 | + $action_ops = FrmFormAction::default_action_opts( 'frm_paypal_icon' ); |
|
| 24 | 24 | parent::__construct( 'paypal', __( 'Collect Payment', 'formidable' ), $action_ops ); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // add aweber action |
| 29 | 29 | class FrmDefAweberAction extends FrmFormAction { |
| 30 | 30 | public function __construct() { |
| 31 | - $action_ops = FrmFormAction::default_action_opts('frm_aweber_icon'); |
|
| 31 | + $action_ops = FrmFormAction::default_action_opts( 'frm_aweber_icon' ); |
|
| 32 | 32 | parent::__construct( 'aweber', __( 'Aweber', 'formidable' ), $action_ops ); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | // add mailchimp action |
| 37 | 37 | class FrmDefMlcmpAction extends FrmFormAction { |
| 38 | 38 | public function __construct() { |
| 39 | - $action_ops = FrmFormAction::default_action_opts('frm_mailchimp_icon'); |
|
| 39 | + $action_ops = FrmFormAction::default_action_opts( 'frm_mailchimp_icon' ); |
|
| 40 | 40 | parent::__construct( 'mailchimp', __( 'MailChimp', 'formidable' ), $action_ops ); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | // add twilio action |
| 45 | 45 | class FrmDefTwilioAction extends FrmFormAction { |
| 46 | 46 | public function __construct() { |
| 47 | - $action_ops = FrmFormAction::default_action_opts('frm_sms_icon'); |
|
| 47 | + $action_ops = FrmFormAction::default_action_opts( 'frm_sms_icon' ); |
|
| 48 | 48 | parent::__construct( 'twilio', __( 'Twilio', 'formidable' ), $action_ops ); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // add highrise action |
| 53 | 53 | class FrmDefHrsAction extends FrmFormAction { |
| 54 | 54 | public function __construct() { |
| 55 | - $action_ops = FrmFormAction::default_action_opts('frm_highrise_icon'); |
|
| 55 | + $action_ops = FrmFormAction::default_action_opts( 'frm_highrise_icon' ); |
|
| 56 | 56 | parent::__construct( 'highrise', __( 'Highrise', 'formidable' ), $action_ops ); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! $item_ids ) { |
| 4 | - return; |
|
| 4 | + return; |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | // fetch 20 posts at a time rather than loading the entire table into memory |
@@ -45,6 +45,6 @@ discard block |
||
| 45 | 45 | <?php } ?> |
| 46 | 46 | </form> |
| 47 | 47 | <?php |
| 48 | - unset( $fields ); |
|
| 48 | + unset( $fields ); |
|
| 49 | 49 | } |
| 50 | 50 | } |
@@ -13,16 +13,16 @@ discard block |
||
| 13 | 13 | ?> |
| 14 | 14 | <form> |
| 15 | 15 | <id><?php echo absint( $form->id ) ?></id> |
| 16 | - <form_key><?php echo FrmXMLHelper::cdata($form->form_key) ?></form_key> |
|
| 17 | - <name><?php echo FrmXMLHelper::cdata($form->name) ?></name> |
|
| 18 | - <description><?php echo FrmXMLHelper::cdata($form->description) ?></description> |
|
| 16 | + <form_key><?php echo FrmXMLHelper::cdata( $form->form_key ) ?></form_key> |
|
| 17 | + <name><?php echo FrmXMLHelper::cdata( $form->name ) ?></name> |
|
| 18 | + <description><?php echo FrmXMLHelper::cdata( $form->description ) ?></description> |
|
| 19 | 19 | <created_at><?php echo esc_html( $form->created_at ) ?></created_at> |
| 20 | 20 | <logged_in><?php echo esc_html( $form->logged_in ) ?></logged_in> |
| 21 | 21 | <is_template><?php echo esc_html( $form->is_template ) ?></is_template> |
| 22 | 22 | <default_template><?php echo esc_html( $form->default_template ) ?></default_template> |
| 23 | 23 | <editable><?php echo esc_html( $form->editable ) ?></editable> |
| 24 | - <options><?php echo FrmXMLHelper::prepare_form_options_for_export($form->options) ?></options> |
|
| 25 | - <status><?php echo FrmXMLHelper::cdata($form->status) ?></status> |
|
| 24 | + <options><?php echo FrmXMLHelper::prepare_form_options_for_export( $form->options ) ?></options> |
|
| 25 | + <status><?php echo FrmXMLHelper::cdata( $form->status ) ?></status> |
|
| 26 | 26 | <parent_form_id><?php echo esc_html( $form->parent_form_id ) ?></parent_form_id> |
| 27 | 27 | <?php |
| 28 | 28 | |
@@ -32,16 +32,16 @@ discard block |
||
| 32 | 32 | ?> |
| 33 | 33 | <field> |
| 34 | 34 | <id><?php echo absint( $field->id ) ?></id> |
| 35 | - <field_key><?php echo FrmXMLHelper::cdata($field->field_key) ?></field_key> |
|
| 36 | - <name><?php echo FrmXMLHelper::cdata($field->name) ?></name> |
|
| 37 | - <description><?php echo FrmXMLHelper::cdata($field->description) ?></description> |
|
| 38 | - <type><?php echo FrmXMLHelper::cdata($field->type) ?></type> |
|
| 39 | - <default_value><?php echo FrmXMLHelper::cdata($field->default_value) ?></default_value> |
|
| 35 | + <field_key><?php echo FrmXMLHelper::cdata( $field->field_key ) ?></field_key> |
|
| 36 | + <name><?php echo FrmXMLHelper::cdata( $field->name ) ?></name> |
|
| 37 | + <description><?php echo FrmXMLHelper::cdata( $field->description ) ?></description> |
|
| 38 | + <type><?php echo FrmXMLHelper::cdata( $field->type ) ?></type> |
|
| 39 | + <default_value><?php echo FrmXMLHelper::cdata( $field->default_value ) ?></default_value> |
|
| 40 | 40 | <field_order><?php echo absint( $field->field_order ) ?></field_order> |
| 41 | 41 | <form_id><?php echo absint( $field->form_id ) ?></form_id> |
| 42 | 42 | <required><?php echo absint( $field->required ) ?></required> |
| 43 | - <options><?php echo FrmXMLHelper::cdata($field->options) ?></options> |
|
| 44 | - <field_options><?php echo FrmXMLHelper::cdata($field->field_options) ?></field_options> |
|
| 43 | + <options><?php echo FrmXMLHelper::cdata( $field->options ) ?></options> |
|
| 44 | + <field_options><?php echo FrmXMLHelper::cdata( $field->field_options ) ?></field_options> |
|
| 45 | 45 | </field> |
| 46 | 46 | <?php } ?> |
| 47 | 47 | </form> |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | /** |
| 46 | 46 | * Get the singleton instance of this class |
| 47 | 47 | * |
| 48 | - * @return object |
|
| 48 | + * @return FrmPointers |
|
| 49 | 49 | */ |
| 50 | 50 | public static function get_instance() { |
| 51 | 51 | if ( ! ( self::$instance instanceof self ) ) { |
@@ -239,16 +239,16 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | return array( |
| 241 | 241 | 'content' => '<h3>' . __( 'Forms', 'formidable' ) . '</h3>' |
| 242 | - . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
| 243 | - . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
| 244 | - . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
| 245 | - . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
| 246 | - . '<p>' |
|
| 247 | - . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
| 242 | + . '<p>' . __( 'All your forms will be listed on this page. Create your first form by clicking on the "Add New" button.', 'formidable' ) . '</p>' |
|
| 243 | + . '<p><strong>' . __( 'Subscribe to our Newsletter', 'formidable' ) . '</strong><br/>' |
|
| 244 | + . sprintf( __( 'If you would like to hear about new features and updates for %1$s, subscribe to our newsletter:', 'formidable' ), 'Formidable' ) . '</p>' |
|
| 245 | + . '<form target="_blank" action="//formidablepro.us1.list-manage.com/subscribe/post?u=a4a913790ffb892daacc6f271&id=7e7df15967" method="post" selector="newsletter-form" accept-charset="' . esc_attr( get_bloginfo( 'charset' ) ) . '">' |
|
| 246 | + . '<p>' |
|
| 247 | + . '<input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr( $current_user->user_email ) . '" selector="newsletter-email" placeholder="' . esc_attr__( 'Email', 'formidable' ) . '"/>' |
|
| 248 | 248 | . '<input type="hidden" name="group[4505]" value="4" />' |
| 249 | - . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
| 250 | - . '</p>' |
|
| 251 | - . '</form>', |
|
| 249 | + . '<button type="submit" class="button-primary">' . esc_html__( 'Subscribe', 'formidable' ) . '</button>' |
|
| 250 | + . '</p>' |
|
| 251 | + . '</form>', |
|
| 252 | 252 | 'next_page' => 'entries', |
| 253 | 253 | ); |
| 254 | 254 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | private function entries_pointer() { |
| 262 | 262 | return array( |
| 263 | 263 | 'content' => '<h3>' . __( 'Entries', 'formidable' ) . '</h3>' |
| 264 | - . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
| 264 | + . '<p>' . __( 'Each time one of your forms is submitted, an entry is created. You will find every form submission listed here so you will always have a backup if an email fails.', 'formidable' ) . '</p>', |
|
| 265 | 265 | 'prev_page' => '', |
| 266 | 266 | 'next_page' => 'styles', |
| 267 | 267 | 'selector' => '.wp-list-table', |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | private function styles_pointer() { |
| 278 | 278 | return array( |
| 279 | 279 | 'content' => '<h3>' . __( 'Styles', 'formidable' ) . '</h3>' |
| 280 | - . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
| 280 | + . '<p>' . __( 'Want to make changes to the way your forms look? Make all the changes you would like right here, and watch the sample form change before your eyes.', 'formidable' ) . '</p>', |
|
| 281 | 281 | 'prev_page' => 'entries', |
| 282 | 282 | 'next_page' => 'import', |
| 283 | 283 | 'selector' => '.general-style', |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | private function import_pointer() { |
| 294 | 294 | return array( |
| 295 | 295 | 'content' => '<h3>' . __( 'Import/Export', 'formidable' ) . '</h3>' |
| 296 | - . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
| 296 | + . '<p>' . __( 'Import and export forms and styles when copying from one site to another or sharing with someone else. Your entries can be exported to a CSV as well. The Premium version also includes the option to import entries to your site from a CSV.', 'formidable' ) . '</p>', |
|
| 297 | 297 | 'prev_page' => 'styles', |
| 298 | 298 | 'next_page' => 'settings', |
| 299 | 299 | 'selector' => '.inside.with_frm_style', |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | . __( 'Turn stylesheets and scripts off, set which user roles have access to change and create forms, setup your reCaptcha, and set default messages for new forms and fields.', 'formidable' ) |
| 314 | 314 | . '<p><strong>' . __( 'Plugin Licenses', 'formidable' ) . '</strong><br/>' |
| 315 | 315 | . sprintf( __( 'Once you’ve purchased %1$s or any addons, you’ll have to enter a license key to get access to all of their powerful features. A Plugin Licenses tab will appear here for you to enter your license key.', 'formidable' ), 'Formidable Pro' ) |
| 316 | - . '</p>', |
|
| 316 | + . '</p>', |
|
| 317 | 317 | 'prev_page' => 'import', |
| 318 | 318 | 'next_page' => 'addons', |
| 319 | 319 | ); |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | private function addons_pointer() { |
| 328 | 328 | return array( |
| 329 | 329 | 'content' => '<h3>' . __( 'Addons', 'formidable' ) . '</h3>' |
| 330 | - . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/' ) ) . '">', '</a>' ) |
|
| 330 | + . '<p>' . sprintf( __( 'The powerful functions of %1$s can be extended with %2$spremium plugins%3$s. You can read all about the Formidable Premium Plugins %2$shere%3$s.', 'formidable' ), 'Formidable', '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/' ) ) . '">', '</a>' ) |
|
| 331 | 331 | . '</p>' |
| 332 | - . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %1$srate it 5 stars on WordPress.org%2$s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
| 333 | - . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidableforms.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/' ) ) . '">', '</a>' ) . '</p>', |
|
| 332 | + . '<p><strong>' . __( 'Like this plugin?', 'formidable' ) . '</strong><br/>' . sprintf( __( 'So, we’ve come to the end of the tour. If you like the plugin, please %1$srate it 5 stars on WordPress.org%2$s!', 'formidable' ), '<a target="_blank" href="https://wordpress.org/plugins/formidable/">', '</a>' ) . '</p>' |
|
| 333 | + . '<p>' . sprintf( __( 'Thank you for using our plugin and good luck with your forms!<br/><br/>Best,<br/>Team Formidable - %1$sformidableforms.com%2$s', 'formidable' ), '<a target="_blank" href="' . esc_url( FrmAppHelper::make_affiliate_url( 'https://formidableforms.com/' ) ) . '">', '</a>' ) . '</p>', |
|
| 334 | 334 | 'prev_page' => 'settings', |
| 335 | 335 | ); |
| 336 | 336 | } |
@@ -188,7 +188,7 @@ |
||
| 188 | 188 | * @param string $page Admin page key. |
| 189 | 189 | */ |
| 190 | 190 | private function do_page_pointer( $page ) { |
| 191 | - $pointer = call_user_func( array( $this, $this->admin_pages[ $page ] ) ); |
|
| 191 | + $pointer = call_user_func( array( $this, $this->admin_pages[$page] ) ); |
|
| 192 | 192 | |
| 193 | 193 | $opt_arr = array( |
| 194 | 194 | 'content' => $pointer['content'], |
@@ -181,13 +181,13 @@ |
||
| 181 | 181 | ), |
| 182 | 182 | ); |
| 183 | 183 | $random = rand( 0, count( $tips ) - 1 ); |
| 184 | - $tip = $tips[ $random ]; |
|
| 184 | + $tip = $tips[$random]; |
|
| 185 | 185 | $tip['num'] = $random; |
| 186 | 186 | return $tip; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | public static function get_random_tip( $tips ) { |
| 190 | 190 | $random = rand( 0, count( $tips ) - 1 ); |
| 191 | - return $tips[ $random ]; |
|
| 191 | + return $tips[$random]; |
|
| 192 | 192 | } |
| 193 | 193 | } |
@@ -4,12 +4,12 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | public function __construct() { |
| 6 | 6 | $action_ops = array( |
| 7 | - 'classes' => 'frm_email_icon frm_icon_font', |
|
| 8 | - 'active' => true, |
|
| 7 | + 'classes' => 'frm_email_icon frm_icon_font', |
|
| 8 | + 'active' => true, |
|
| 9 | 9 | 'event' => array( 'create' ), |
| 10 | - 'limit' => 99, |
|
| 11 | - 'priority' => 10, |
|
| 12 | - 'ajax_load' => false, |
|
| 10 | + 'limit' => 99, |
|
| 11 | + 'priority' => 10, |
|
| 12 | + 'ajax_load' => false, |
|
| 13 | 13 | ); |
| 14 | 14 | $action_ops = apply_filters('frm_email_control_settings', $action_ops); |
| 15 | 15 | |
@@ -17,23 +17,23 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function form( $form_action, $args = array() ) { |
| 20 | - extract($args); |
|
| 20 | + extract($args); |
|
| 21 | 21 | |
| 22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php' ); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function get_defaults() { |
| 26 | - return array( |
|
| 27 | - 'email_to' => '[admin_email]', |
|
| 28 | - 'cc' => '', |
|
| 29 | - 'bcc' => '', |
|
| 30 | - 'from' => '[sitename] <[admin_email]>', |
|
| 31 | - 'reply_to' => '', |
|
| 32 | - 'email_subject' => '', |
|
| 33 | - 'email_message' => '[default-message]', |
|
| 34 | - 'inc_user_info' => 0, |
|
| 35 | - 'plain_text' => 0, |
|
| 26 | + return array( |
|
| 27 | + 'email_to' => '[admin_email]', |
|
| 28 | + 'cc' => '', |
|
| 29 | + 'bcc' => '', |
|
| 30 | + 'from' => '[sitename] <[admin_email]>', |
|
| 31 | + 'reply_to' => '', |
|
| 32 | + 'email_subject' => '', |
|
| 33 | + 'email_message' => '[default-message]', |
|
| 34 | + 'inc_user_info' => 0, |
|
| 35 | + 'plain_text' => 0, |
|
| 36 | 36 | 'event' => array( 'create' ), |
| 37 | - ); |
|
| 37 | + ); |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -11,13 +11,13 @@ |
||
| 11 | 11 | 'priority' => 10, |
| 12 | 12 | 'ajax_load' => false, |
| 13 | 13 | ); |
| 14 | - $action_ops = apply_filters('frm_email_control_settings', $action_ops); |
|
| 14 | + $action_ops = apply_filters( 'frm_email_control_settings', $action_ops ); |
|
| 15 | 15 | |
| 16 | - parent::__construct('email', __( 'Email Notification', 'formidable' ), $action_ops); |
|
| 16 | + parent::__construct( 'email', __( 'Email Notification', 'formidable' ), $action_ops ); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function form( $form_action, $args = array() ) { |
| 20 | - extract($args); |
|
| 20 | + extract( $args ); |
|
| 21 | 21 | |
| 22 | 22 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/_email_settings.php' ); |
| 23 | 23 | } |
@@ -308,7 +308,7 @@ |
||
| 308 | 308 | * |
| 309 | 309 | * @since 2.02.05 |
| 310 | 310 | * @param string $key |
| 311 | - * @param int|string $value |
|
| 311 | + * @param string $value |
|
| 312 | 312 | * @param string $where |
| 313 | 313 | */ |
| 314 | 314 | private static function add_query_placeholder( $key, $value, &$where ) { |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | public $entry_metas; |
| 8 | 8 | |
| 9 | 9 | public function __construct() { |
| 10 | - if ( ! defined('ABSPATH') ) { |
|
| 11 | - die('You are not allowed to call this page directly.'); |
|
| 10 | + if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | + die( 'You are not allowed to call this page directly.' ); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | _deprecated_function( __METHOD__, '2.05.06', 'FrmMigrate' ); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @param string $starts_with |
| 27 | 27 | */ |
| 28 | 28 | public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
| 29 | - if ( empty($args) ) { |
|
| 29 | + if ( empty( $args ) ) { |
|
| 30 | 30 | // add an arg to prevent prepare from failing |
| 31 | 31 | $args = array( |
| 32 | 32 | 'where' => $starts_with . '1=%d', |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $key = trim( $key ); |
| 95 | 95 | |
| 96 | 96 | if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
| 97 | - $k = explode(' ', $key); |
|
| 97 | + $k = explode( ' ', $key ); |
|
| 98 | 98 | $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
| 99 | 99 | $values[] = '%Y-%m-%d %H:%i:%s'; |
| 100 | 100 | } else { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | if ( is_array( $value ) ) { |
| 108 | 108 | // translate array of values to "in" |
| 109 | 109 | if ( strpos( $lowercase_key, 'like' ) !== false ) { |
| 110 | - $where = preg_replace('/' . $key . '$/', '', $where); |
|
| 110 | + $where = preg_replace( '/' . $key . '$/', '', $where ); |
|
| 111 | 111 | $where .= '('; |
| 112 | 112 | $start = true; |
| 113 | 113 | foreach ( $value as $v ) { |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | ); |
| 293 | 293 | |
| 294 | 294 | $where_is = strtolower( $where_is ); |
| 295 | - if ( isset( $switch_to[ $where_is ] ) ) { |
|
| 296 | - return ' ' . $switch_to[ $where_is ]; |
|
| 295 | + if ( isset( $switch_to[$where_is] ) ) { |
|
| 296 | + return ' ' . $switch_to[$where_is]; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // > and < need a little more work since we don't want them switched to >= and <= |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | private static function get_group_and_table_name( &$table, &$group ) { |
| 316 | 316 | global $wpdb, $wpmuBaseTablePrefix; |
| 317 | 317 | |
| 318 | - $table_parts = explode(' ', $table); |
|
| 319 | - $group = reset($table_parts); |
|
| 318 | + $table_parts = explode( ' ', $table ); |
|
| 319 | + $group = reset( $table_parts ); |
|
| 320 | 320 | $group = str_replace( $wpdb->prefix, '', $group ); |
| 321 | 321 | |
| 322 | 322 | $prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix; |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { |
| 334 | - if ( ! is_array($args) ) { |
|
| 334 | + if ( ! is_array( $args ) ) { |
|
| 335 | 335 | $args = array( 'order_by' => $args ); |
| 336 | 336 | } |
| 337 | 337 | |
@@ -346,13 +346,13 @@ discard block |
||
| 346 | 346 | $temp_args = $args; |
| 347 | 347 | foreach ( $temp_args as $k => $v ) { |
| 348 | 348 | if ( $v == '' ) { |
| 349 | - unset( $args[ $k ] ); |
|
| 349 | + unset( $args[$k] ); |
|
| 350 | 350 | continue; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
| 354 | 354 | if ( strpos( $v, $db_name ) === false ) { |
| 355 | - $args[ $k ] = $db_name . ' ' . $v; |
|
| 355 | + $args[$k] = $db_name . ' ' . $v; |
|
| 356 | 356 | } |
| 357 | 357 | } |
| 358 | 358 | |
@@ -423,13 +423,13 @@ discard block |
||
| 423 | 423 | private static function esc_query_args( &$args ) { |
| 424 | 424 | foreach ( $args as $param => $value ) { |
| 425 | 425 | if ( $param == 'order_by' ) { |
| 426 | - $args[ $param ] = self::esc_order( $value ); |
|
| 426 | + $args[$param] = self::esc_order( $value ); |
|
| 427 | 427 | } elseif ( $param == 'limit' ) { |
| 428 | - $args[ $param ] = self::esc_limit( $value ); |
|
| 428 | + $args[$param] = self::esc_limit( $value ); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - if ( $args[ $param ] == '' ) { |
|
| 432 | - unset( $args[ $param ] ); |
|
| 431 | + if ( $args[$param] == '' ) { |
|
| 432 | + unset( $args[$param] ); |
|
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | 435 | } |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | $limit = explode( ',', trim( $limit ) ); |
| 515 | 515 | foreach ( $limit as $k => $l ) { |
| 516 | 516 | if ( is_numeric( $l ) ) { |
| 517 | - $limit[ $k ] = $l; |
|
| 517 | + $limit[$k] = $l; |
|
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | */ |
| 646 | 646 | public static function add_key_to_group_cache( $key, $group ) { |
| 647 | 647 | $cached = self::get_group_cached_keys( $group ); |
| 648 | - $cached[ $key ] = $key; |
|
| 648 | + $cached[$key] = $key; |
|
| 649 | 649 | wp_cache_set( 'cached_keys', $cached, $group, 300 ); |
| 650 | 650 | } |
| 651 | 651 | |
@@ -1,39 +1,39 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class FrmDb { |
| 4 | - public $fields; |
|
| 5 | - public $forms; |
|
| 6 | - public $entries; |
|
| 7 | - public $entry_metas; |
|
| 8 | - |
|
| 9 | - public function __construct() { |
|
| 10 | - if ( ! defined('ABSPATH') ) { |
|
| 11 | - die('You are not allowed to call this page directly.'); |
|
| 12 | - } |
|
| 4 | + public $fields; |
|
| 5 | + public $forms; |
|
| 6 | + public $entries; |
|
| 7 | + public $entry_metas; |
|
| 8 | + |
|
| 9 | + public function __construct() { |
|
| 10 | + if ( ! defined('ABSPATH') ) { |
|
| 11 | + die('You are not allowed to call this page directly.'); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | 14 | _deprecated_function( __METHOD__, '2.05.06', 'FrmMigrate' ); |
| 15 | - global $wpdb; |
|
| 16 | - $this->fields = $wpdb->prefix . 'frm_fields'; |
|
| 17 | - $this->forms = $wpdb->prefix . 'frm_forms'; |
|
| 18 | - $this->entries = $wpdb->prefix . 'frm_items'; |
|
| 19 | - $this->entry_metas = $wpdb->prefix . 'frm_item_metas'; |
|
| 20 | - } |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * Change array into format $wpdb->prepare can use |
|
| 15 | + global $wpdb; |
|
| 16 | + $this->fields = $wpdb->prefix . 'frm_fields'; |
|
| 17 | + $this->forms = $wpdb->prefix . 'frm_forms'; |
|
| 18 | + $this->entries = $wpdb->prefix . 'frm_items'; |
|
| 19 | + $this->entry_metas = $wpdb->prefix . 'frm_item_metas'; |
|
| 20 | + } |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * Change array into format $wpdb->prepare can use |
|
| 24 | 24 | * |
| 25 | 25 | * @param array $args |
| 26 | 26 | * @param string $starts_with |
| 27 | - */ |
|
| 28 | - public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
|
| 29 | - if ( empty($args) ) { |
|
| 27 | + */ |
|
| 28 | + public static function get_where_clause_and_values( &$args, $starts_with = ' WHERE ' ) { |
|
| 29 | + if ( empty($args) ) { |
|
| 30 | 30 | // add an arg to prevent prepare from failing |
| 31 | 31 | $args = array( |
| 32 | 32 | 'where' => $starts_with . '1=%d', |
| 33 | 33 | 'values' => array( 1 ), |
| 34 | 34 | ); |
| 35 | 35 | return; |
| 36 | - } |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | $where = ''; |
| 39 | 39 | $values = array(); |
@@ -44,20 +44,20 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $args = compact( 'where', 'values' ); |
| 47 | - } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 49 | + /** |
|
| 50 | 50 | * @param array $args |
| 51 | - * @param string $base_where |
|
| 52 | - * @param string $where |
|
| 51 | + * @param string $base_where |
|
| 52 | + * @param string $where |
|
| 53 | 53 | * @param array $values |
| 54 | - */ |
|
| 55 | - public static function parse_where_from_array( $args, $base_where, &$where, &$values ) { |
|
| 56 | - $condition = ' AND'; |
|
| 57 | - if ( isset( $args['or'] ) ) { |
|
| 58 | - $condition = ' OR'; |
|
| 59 | - unset( $args['or'] ); |
|
| 60 | - } |
|
| 54 | + */ |
|
| 55 | + public static function parse_where_from_array( $args, $base_where, &$where, &$values ) { |
|
| 56 | + $condition = ' AND'; |
|
| 57 | + if ( isset( $args['or'] ) ) { |
|
| 58 | + $condition = ' OR'; |
|
| 59 | + unset( $args['or'] ); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | foreach ( $args as $key => $value ) { |
| 63 | 63 | $where .= empty( $where ) ? $base_where : $condition; |
@@ -84,28 +84,28 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * @param string $key |
|
| 87 | + /** |
|
| 88 | + * @param string $key |
|
| 89 | 89 | * @param string|array $value |
| 90 | - * @param string $where |
|
| 90 | + * @param string $where |
|
| 91 | 91 | * @param array $values |
| 92 | - */ |
|
| 93 | - private static function interpret_array_to_sql( $key, $value, &$where, &$values ) { |
|
| 92 | + */ |
|
| 93 | + private static function interpret_array_to_sql( $key, $value, &$where, &$values ) { |
|
| 94 | 94 | $key = trim( $key ); |
| 95 | 95 | |
| 96 | 96 | if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
| 97 | - $k = explode(' ', $key); |
|
| 98 | - $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
|
| 99 | - $values[] = '%Y-%m-%d %H:%i:%s'; |
|
| 100 | - } else { |
|
| 97 | + $k = explode(' ', $key); |
|
| 98 | + $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
|
| 99 | + $values[] = '%Y-%m-%d %H:%i:%s'; |
|
| 100 | + } else { |
|
| 101 | 101 | $where .= ' ' . $key; |
| 102 | - } |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | 104 | $lowercase_key = explode( ' ', strtolower( $key ) ); |
| 105 | 105 | $lowercase_key = end( $lowercase_key ); |
| 106 | 106 | |
| 107 | - if ( is_array( $value ) ) { |
|
| 108 | - // translate array of values to "in" |
|
| 107 | + if ( is_array( $value ) ) { |
|
| 108 | + // translate array of values to "in" |
|
| 109 | 109 | if ( strpos( $lowercase_key, 'like' ) !== false ) { |
| 110 | 110 | $where = preg_replace('/' . $key . '$/', '', $where); |
| 111 | 111 | $where .= '('; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $where .= ' in (' . self::prepare_array_values( $value, '%s' ) . ')'; |
| 124 | 124 | $values = array_merge( $values, $value ); |
| 125 | 125 | } |
| 126 | - } else if ( strpos( $lowercase_key, 'like' ) !== false ) { |
|
| 126 | + } else if ( strpos( $lowercase_key, 'like' ) !== false ) { |
|
| 127 | 127 | /** |
| 128 | 128 | * Allow string to start or end with the value |
| 129 | 129 | * If the key is like% then skip the first % for starts with |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | $where .= ' %s'; |
| 144 | 144 | $values[] = $start . self::esc_like( $value ) . $end; |
| 145 | 145 | |
| 146 | - } else if ( $value === null ) { |
|
| 147 | - $where .= ' IS NULL'; |
|
| 148 | - } else { |
|
| 146 | + } else if ( $value === null ) { |
|
| 147 | + $where .= ' IS NULL'; |
|
| 148 | + } else { |
|
| 149 | 149 | // allow a - to prevent = from being added |
| 150 | 150 | if ( substr( $key, -1 ) == '-' ) { |
| 151 | 151 | $where = rtrim( $where, '-' ); |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | self::add_query_placeholder( $key, $value, $where ); |
| 157 | 157 | |
| 158 | - $values[] = $value; |
|
| 159 | - } |
|
| 160 | - } |
|
| 158 | + $values[] = $value; |
|
| 159 | + } |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * Add %d, or %s to query |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @param int|string $value |
| 168 | 168 | * @param string $where |
| 169 | 169 | */ |
| 170 | - private static function add_query_placeholder( $key, $value, &$where ) { |
|
| 170 | + private static function add_query_placeholder( $key, $value, &$where ) { |
|
| 171 | 171 | if ( is_numeric( $value ) && ( strpos( $key, 'meta_value' ) === false || strpos( $key, '+0' ) !== false ) ) { |
| 172 | 172 | $value = $value + 0; // switch string to number |
| 173 | 173 | $where .= is_float( $value ) ? '%f' : '%d'; |
@@ -176,16 +176,16 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - /** |
|
| 180 | - * @param string $table |
|
| 179 | + /** |
|
| 180 | + * @param string $table |
|
| 181 | 181 | * @param array $where |
| 182 | 182 | * @param array $args |
| 183 | 183 | * @return int |
| 184 | - */ |
|
| 185 | - public static function get_count( $table, $where = array(), $args = array() ) { |
|
| 186 | - $count = self::get_var( $table, $where, 'COUNT(*)', $args ); |
|
| 187 | - return $count; |
|
| 188 | - } |
|
| 184 | + */ |
|
| 185 | + public static function get_count( $table, $where = array(), $args = array() ) { |
|
| 186 | + $count = self::get_var( $table, $where, 'COUNT(*)', $args ); |
|
| 187 | + return $count; |
|
| 188 | + } |
|
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | 191 | * @param string $table |
@@ -196,17 +196,17 @@ discard block |
||
| 196 | 196 | * @param string $type |
| 197 | 197 | * @return array|null|string|object |
| 198 | 198 | */ |
| 199 | - public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) { |
|
| 200 | - $group = ''; |
|
| 201 | - self::get_group_and_table_name( $table, $group ); |
|
| 199 | + public static function get_var( $table, $where = array(), $field = 'id', $args = array(), $limit = '', $type = 'var' ) { |
|
| 200 | + $group = ''; |
|
| 201 | + self::get_group_and_table_name( $table, $group ); |
|
| 202 | 202 | self::convert_options_to_array( $args, '', $limit ); |
| 203 | 203 | |
| 204 | 204 | $query = self::generate_query_string_from_pieces( $field, $table, $where, $args ); |
| 205 | 205 | |
| 206 | 206 | $cache_key = self::generate_cache_key( $where, $args, $field, $type ); |
| 207 | 207 | $results = self::check_cache( $cache_key, $group, $query, 'get_' . $type ); |
| 208 | - return $results; |
|
| 209 | - } |
|
| 208 | + return $results; |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | 211 | /** |
| 212 | 212 | * Generate a cache key from the where query, field, type, and other arguments |
@@ -232,44 +232,44 @@ discard block |
||
| 232 | 232 | return $cache_key; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - /** |
|
| 236 | - * @param string $table |
|
| 237 | - * @param array $where |
|
| 235 | + /** |
|
| 236 | + * @param string $table |
|
| 237 | + * @param array $where |
|
| 238 | 238 | * @param string $field |
| 239 | 239 | * @param array $args |
| 240 | 240 | * @param string $limit |
| 241 | 241 | * @return mixed |
| 242 | - */ |
|
| 243 | - public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) { |
|
| 244 | - return self::get_var( $table, $where, $field, $args, $limit, 'col' ); |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - /** |
|
| 248 | - * @since 2.0 |
|
| 249 | - * @param string $table |
|
| 242 | + */ |
|
| 243 | + public static function get_col( $table, $where = array(), $field = 'id', $args = array(), $limit = '' ) { |
|
| 244 | + return self::get_var( $table, $where, $field, $args, $limit, 'col' ); |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + /** |
|
| 248 | + * @since 2.0 |
|
| 249 | + * @param string $table |
|
| 250 | 250 | * @param array $where |
| 251 | 251 | * @param string $fields |
| 252 | 252 | * @param array $args |
| 253 | 253 | * @return mixed |
| 254 | - */ |
|
| 255 | - public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) { |
|
| 256 | - $args['limit'] = 1; |
|
| 257 | - return self::get_var( $table, $where, $fields, $args, '', 'row' ); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * Prepare a key/value array before DB call |
|
| 254 | + */ |
|
| 255 | + public static function get_row( $table, $where = array(), $fields = '*', $args = array() ) { |
|
| 256 | + $args['limit'] = 1; |
|
| 257 | + return self::get_var( $table, $where, $fields, $args, '', 'row' ); |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * Prepare a key/value array before DB call |
|
| 262 | 262 | * |
| 263 | - * @since 2.0 |
|
| 264 | - * @param string $table |
|
| 263 | + * @since 2.0 |
|
| 264 | + * @param string $table |
|
| 265 | 265 | * @param array $where |
| 266 | 266 | * @param string $fields |
| 267 | 267 | * @param array $args |
| 268 | 268 | * @return mixed |
| 269 | - */ |
|
| 270 | - public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) { |
|
| 271 | - return self::get_var( $table, $where, $fields, $args, '', 'results' ); |
|
| 272 | - } |
|
| 269 | + */ |
|
| 270 | + public static function get_results( $table, $where = array(), $fields = '*', $args = array() ) { |
|
| 271 | + return self::get_var( $table, $where, $fields, $args, '', 'results' ); |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | 274 | /** |
| 275 | 275 | * Check for like, not like, in, not in, =, !=, >, <, <=, >= |
@@ -306,56 +306,56 @@ discard block |
||
| 306 | 306 | return ''; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - /** |
|
| 310 | - * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join |
|
| 311 | - * Also add the wpdb->prefix to the table if it's missing |
|
| 312 | - * |
|
| 313 | - * @param string $table |
|
| 314 | - * @param string $group |
|
| 315 | - */ |
|
| 316 | - private static function get_group_and_table_name( &$table, &$group ) { |
|
| 309 | + /** |
|
| 310 | + * Get 'frm_forms' from wp_frm_forms or a longer table param that includes a join |
|
| 311 | + * Also add the wpdb->prefix to the table if it's missing |
|
| 312 | + * |
|
| 313 | + * @param string $table |
|
| 314 | + * @param string $group |
|
| 315 | + */ |
|
| 316 | + private static function get_group_and_table_name( &$table, &$group ) { |
|
| 317 | 317 | global $wpdb, $wpmuBaseTablePrefix; |
| 318 | 318 | |
| 319 | - $table_parts = explode(' ', $table); |
|
| 320 | - $group = reset($table_parts); |
|
| 321 | - $group = str_replace( $wpdb->prefix, '', $group ); |
|
| 319 | + $table_parts = explode(' ', $table); |
|
| 320 | + $group = reset($table_parts); |
|
| 321 | + $group = str_replace( $wpdb->prefix, '', $group ); |
|
| 322 | 322 | |
| 323 | 323 | $prefix = $wpmuBaseTablePrefix ? $wpmuBaseTablePrefix : $wpdb->base_prefix; |
| 324 | 324 | $group = str_replace( $prefix, '', $group ); |
| 325 | 325 | |
| 326 | - if ( $group == $table ) { |
|
| 327 | - $table = $wpdb->prefix . $table; |
|
| 328 | - } |
|
| 326 | + if ( $group == $table ) { |
|
| 327 | + $table = $wpdb->prefix . $table; |
|
| 328 | + } |
|
| 329 | 329 | |
| 330 | 330 | // switch to singular group name |
| 331 | 331 | $group = rtrim( $group, 's' ); |
| 332 | - } |
|
| 332 | + } |
|
| 333 | 333 | |
| 334 | - private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { |
|
| 335 | - if ( ! is_array($args) ) { |
|
| 334 | + private static function convert_options_to_array( &$args, $order_by = '', $limit = '' ) { |
|
| 335 | + if ( ! is_array($args) ) { |
|
| 336 | 336 | $args = array( 'order_by' => $args ); |
| 337 | - } |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | - if ( ! empty( $order_by ) ) { |
|
| 340 | - $args['order_by'] = $order_by; |
|
| 341 | - } |
|
| 339 | + if ( ! empty( $order_by ) ) { |
|
| 340 | + $args['order_by'] = $order_by; |
|
| 341 | + } |
|
| 342 | 342 | |
| 343 | - if ( ! empty( $limit ) ) { |
|
| 344 | - $args['limit'] = $limit; |
|
| 345 | - } |
|
| 343 | + if ( ! empty( $limit ) ) { |
|
| 344 | + $args['limit'] = $limit; |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | - $temp_args = $args; |
|
| 348 | - foreach ( $temp_args as $k => $v ) { |
|
| 349 | - if ( $v == '' ) { |
|
| 347 | + $temp_args = $args; |
|
| 348 | + foreach ( $temp_args as $k => $v ) { |
|
| 349 | + if ( $v == '' ) { |
|
| 350 | 350 | unset( $args[ $k ] ); |
| 351 | - continue; |
|
| 352 | - } |
|
| 351 | + continue; |
|
| 352 | + } |
|
| 353 | 353 | |
| 354 | - $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
|
| 355 | - if ( strpos( $v, $db_name ) === false ) { |
|
| 354 | + $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
|
| 355 | + if ( strpos( $v, $db_name ) === false ) { |
|
| 356 | 356 | $args[ $k ] = $db_name . ' ' . $v; |
| 357 | - } |
|
| 358 | - } |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | 359 | |
| 360 | 360 | // Make sure LIMIT is the last argument |
| 361 | 361 | if ( isset( $args['order_by'] ) && isset( $args['limit'] ) ) { |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | unset( $args['limit'] ); |
| 364 | 364 | $args['limit'] = $temp_limit; |
| 365 | 365 | } |
| 366 | - } |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | 368 | /** |
| 369 | 369 | * Get the associative array results for the given columns, table, and where query |
@@ -435,25 +435,25 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | - /** |
|
| 439 | - * Added for < WP 4.0 compatability |
|
| 440 | - * |
|
| 441 | - * @since 2.05.06 |
|
| 442 | - * |
|
| 443 | - * @param string $term The value to escape |
|
| 444 | - * @return string The escaped value |
|
| 445 | - */ |
|
| 438 | + /** |
|
| 439 | + * Added for < WP 4.0 compatability |
|
| 440 | + * |
|
| 441 | + * @since 2.05.06 |
|
| 442 | + * |
|
| 443 | + * @param string $term The value to escape |
|
| 444 | + * @return string The escaped value |
|
| 445 | + */ |
|
| 446 | 446 | public static function esc_like( $term ) { |
| 447 | - global $wpdb; |
|
| 448 | - if ( method_exists( $wpdb, 'esc_like' ) ) { |
|
| 447 | + global $wpdb; |
|
| 448 | + if ( method_exists( $wpdb, 'esc_like' ) ) { |
|
| 449 | 449 | // WP 4.0 |
| 450 | - $term = $wpdb->esc_like( $term ); |
|
| 451 | - } else { |
|
| 452 | - $term = like_escape( $term ); |
|
| 453 | - } |
|
| 450 | + $term = $wpdb->esc_like( $term ); |
|
| 451 | + } else { |
|
| 452 | + $term = like_escape( $term ); |
|
| 453 | + } |
|
| 454 | 454 | |
| 455 | - return $term; |
|
| 456 | - } |
|
| 455 | + return $term; |
|
| 456 | + } |
|
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | 459 | * @since 2.05.06 |
@@ -523,10 +523,10 @@ discard block |
||
| 523 | 523 | return ' LIMIT ' . $limit; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - /** |
|
| 527 | - * Get an array of values ready to go through $wpdb->prepare |
|
| 528 | - * @since 2.05.06 |
|
| 529 | - */ |
|
| 526 | + /** |
|
| 527 | + * Get an array of values ready to go through $wpdb->prepare |
|
| 528 | + * @since 2.05.06 |
|
| 529 | + */ |
|
| 530 | 530 | public static function prepare_array_values( $array, $type = '%s' ) { |
| 531 | 531 | $placeholders = array_fill( 0, count( $array ), $type ); |
| 532 | 532 | return implode( ', ', $placeholders ); |
@@ -597,17 +597,17 @@ discard block |
||
| 597 | 597 | return $post; |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | - /** |
|
| 601 | - * Check cache before fetching values and saving to cache |
|
| 602 | - * |
|
| 603 | - * @since 2.05.06 |
|
| 604 | - * |
|
| 605 | - * @param string $cache_key The unique name for this cache |
|
| 606 | - * @param string $group The name of the cache group |
|
| 607 | - * @param string $query If blank, don't run a db call |
|
| 608 | - * @param string $type The wpdb function to use with this query |
|
| 609 | - * @return mixed $results The cache or query results |
|
| 610 | - */ |
|
| 600 | + /** |
|
| 601 | + * Check cache before fetching values and saving to cache |
|
| 602 | + * |
|
| 603 | + * @since 2.05.06 |
|
| 604 | + * |
|
| 605 | + * @param string $cache_key The unique name for this cache |
|
| 606 | + * @param string $group The name of the cache group |
|
| 607 | + * @param string $query If blank, don't run a db call |
|
| 608 | + * @param string $type The wpdb function to use with this query |
|
| 609 | + * @return mixed $results The cache or query results |
|
| 610 | + */ |
|
| 611 | 611 | public static function check_cache( $cache_key, $group = '', $query = '', $type = 'get_var', $time = 300 ) { |
| 612 | 612 | $results = wp_cache_get( $cache_key, $group ); |
| 613 | 613 | if ( ! FrmAppHelper::is_empty_value( $results, false ) || empty( $query ) ) { |
@@ -671,13 +671,13 @@ discard block |
||
| 671 | 671 | wp_cache_delete( $cache_key, $group ); |
| 672 | 672 | } |
| 673 | 673 | |
| 674 | - /** |
|
| 675 | - * Delete all caching in a single group |
|
| 676 | - * |
|
| 677 | - * @since 2.05.06 |
|
| 678 | - * |
|
| 679 | - * @param string $group The name of the cache group |
|
| 680 | - */ |
|
| 674 | + /** |
|
| 675 | + * Delete all caching in a single group |
|
| 676 | + * |
|
| 677 | + * @since 2.05.06 |
|
| 678 | + * |
|
| 679 | + * @param string $group The name of the cache group |
|
| 680 | + */ |
|
| 681 | 681 | public static function cache_delete_group( $group ) { |
| 682 | 682 | $cached_keys = self::get_group_cached_keys( $group ); |
| 683 | 683 | |