@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * When the plugin is activated, flush dismissed notices |
| 16 | 16 | * @since 1.15.1 |
| 17 | 17 | */ |
| 18 | -register_activation_hook( GRAVITYVIEW_FILE, array( 'GravityView_Admin_Notices', 'flush_dismissed_notices' ) ); |
|
| 18 | +register_activation_hook(GRAVITYVIEW_FILE, array('GravityView_Admin_Notices', 'flush_dismissed_notices')); |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Handle displaying and storing of admin notices for GravityView |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | function add_hooks() { |
| 36 | - add_action( 'network_admin_notices', array( $this, 'dismiss_notice' ), 50 ); |
|
| 37 | - add_action( 'admin_notices', array( $this, 'dismiss_notice' ), 50 ); |
|
| 38 | - add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 ); |
|
| 39 | - add_action( 'network_admin_notices', array( $this, 'admin_notice' ), 100 ); |
|
| 36 | + add_action('network_admin_notices', array($this, 'dismiss_notice'), 50); |
|
| 37 | + add_action('admin_notices', array($this, 'dismiss_notice'), 50); |
|
| 38 | + add_action('admin_notices', array($this, 'admin_notice'), 100); |
|
| 39 | + add_action('network_admin_notices', array($this, 'admin_notice'), 100); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | 48 | static public function flush_dismissed_notices() { |
| 49 | - delete_transient( 'gravityview_dismissed_notices' ); |
|
| 49 | + delete_transient('gravityview_dismissed_notices'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -57,26 +57,26 @@ discard block |
||
| 57 | 57 | public function dismiss_notice() { |
| 58 | 58 | |
| 59 | 59 | // No dismiss sent |
| 60 | - if( empty( $_GET['gv-dismiss'] ) ) { |
|
| 60 | + if (empty($_GET['gv-dismiss'])) { |
|
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | // Invalid nonce |
| 65 | - if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) { |
|
| 65 | + if (!wp_verify_nonce($_GET['gv-dismiss'], 'dismiss')) { |
|
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - $notice_id = esc_attr( $_GET['notice'] ); |
|
| 69 | + $notice_id = esc_attr($_GET['notice']); |
|
| 70 | 70 | |
| 71 | 71 | //don't display a message if use has dismissed the message for this version |
| 72 | - $dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' ); |
|
| 72 | + $dismissed_notices = (array)get_transient('gravityview_dismissed_notices'); |
|
| 73 | 73 | |
| 74 | 74 | $dismissed_notices[] = $notice_id; |
| 75 | 75 | |
| 76 | - $dismissed_notices = array_unique( $dismissed_notices ); |
|
| 76 | + $dismissed_notices = array_unique($dismissed_notices); |
|
| 77 | 77 | |
| 78 | 78 | // Remind users every 16 weeks |
| 79 | - set_transient( 'gravityview_dismissed_notices', $dismissed_notices, WEEK_IN_SECONDS * 16 ); |
|
| 79 | + set_transient('gravityview_dismissed_notices', $dismissed_notices, WEEK_IN_SECONDS * 16); |
|
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | * @param string $notice Notice array, set using `add_notice()`. |
| 92 | 92 | * @return boolean True: show notice; False: hide notice |
| 93 | 93 | */ |
| 94 | - private function is_notice_dismissed( $notice ) { |
|
| 94 | + private function is_notice_dismissed($notice) { |
|
| 95 | 95 | |
| 96 | 96 | // There are no dismissed notices. |
| 97 | - if( empty( self::$dismissed_notices ) ) { |
|
| 97 | + if (empty(self::$dismissed_notices)) { |
|
| 98 | 98 | return false; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Has the |
| 102 | - $is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices ); |
|
| 102 | + $is_dismissed = !empty($notice['dismiss']) && in_array($notice['dismiss'], self::$dismissed_notices); |
|
| 103 | 103 | |
| 104 | 104 | return $is_dismissed ? true : false; |
| 105 | 105 | } |
@@ -124,17 +124,17 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | private function check_show_multisite_notices() { |
| 126 | 126 | |
| 127 | - if( ! is_multisite() ) { |
|
| 127 | + if (!is_multisite()) { |
|
| 128 | 128 | return true; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // It's network activated but the user can't manage network plugins; they can't do anything about it. |
| 132 | - if( GravityView_Plugin::is_network_activated() && ! is_main_site() ) { |
|
| 132 | + if (GravityView_Plugin::is_network_activated() && !is_main_site()) { |
|
| 133 | 133 | return false; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | // or they don't have admin capabilities |
| 137 | - if( ! is_super_admin() ) { |
|
| 137 | + if (!is_super_admin()) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -155,53 +155,53 @@ discard block |
||
| 155 | 155 | * @filter `gravityview/admin/notices` Modify the notices displayed in the admin |
| 156 | 156 | * @since 1.12 |
| 157 | 157 | */ |
| 158 | - $notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices ); |
|
| 158 | + $notices = apply_filters('gravityview/admin/notices', self::$admin_notices); |
|
| 159 | 159 | |
| 160 | - if( empty( $notices ) || ! $this->check_show_multisite_notices() ) { |
|
| 160 | + if (empty($notices) || !$this->check_show_multisite_notices()) { |
|
| 161 | 161 | return; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | //don't display a message if use has dismissed the message for this version |
| 165 | 165 | // TODO: Use get_user_meta instead of get_transient |
| 166 | - self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' ); |
|
| 166 | + self::$dismissed_notices = isset($_GET['show-dismissed-notices']) ? array() : (array)get_transient('gravityview_dismissed_notices'); |
|
| 167 | 167 | |
| 168 | 168 | $output = ''; |
| 169 | 169 | |
| 170 | - foreach( $notices as $notice ) { |
|
| 170 | + foreach ($notices as $notice) { |
|
| 171 | 171 | |
| 172 | 172 | // If the user doesn't have the capability to see the warning |
| 173 | - if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) { |
|
| 174 | - do_action( 'gravityview_log_debug', 'Notice not shown because user does not have the capability to view it.', $notice ); |
|
| 173 | + if (isset($notice['cap']) && false === GVCommon::has_cap($notice['cap'])) { |
|
| 174 | + do_action('gravityview_log_debug', 'Notice not shown because user does not have the capability to view it.', $notice); |
|
| 175 | 175 | continue; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if( true === $this->is_notice_dismissed( $notice ) ) { |
|
| 179 | - do_action( 'gravityview_log_debug', 'Notice not shown because the notice has already been dismissed.', $notice ); |
|
| 178 | + if (true === $this->is_notice_dismissed($notice)) { |
|
| 179 | + do_action('gravityview_log_debug', 'Notice not shown because the notice has already been dismissed.', $notice); |
|
| 180 | 180 | continue; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - $output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">'; |
|
| 183 | + $output .= '<div id="message" style="position:relative" class="notice '.gravityview_sanitize_html_class($notice['class']).'">'; |
|
| 184 | 184 | |
| 185 | 185 | // Too cute to leave out. |
| 186 | 186 | $output .= gravityview_get_floaty(); |
| 187 | 187 | |
| 188 | - if( !empty( $notice['title'] ) ) { |
|
| 189 | - $output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>'; |
|
| 188 | + if (!empty($notice['title'])) { |
|
| 189 | + $output .= '<h3>'.esc_html($notice['title']).'</h3>'; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $message = isset( $notice['message'] ) ? $notice['message'] : ''; |
|
| 192 | + $message = isset($notice['message']) ? $notice['message'] : ''; |
|
| 193 | 193 | |
| 194 | - if( !empty( $notice['dismiss'] ) ) { |
|
| 194 | + if (!empty($notice['dismiss'])) { |
|
| 195 | 195 | |
| 196 | 196 | $dismiss = esc_attr($notice['dismiss']); |
| 197 | 197 | |
| 198 | - $url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) ); |
|
| 198 | + $url = esc_url(add_query_arg(array('gv-dismiss' => wp_create_nonce('dismiss'), 'notice' => $dismiss))); |
|
| 199 | 199 | |
| 200 | 200 | $align = is_rtl() ? 'alignleft' : 'alignright'; |
| 201 | - $message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>'; |
|
| 201 | + $message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="'.$align.' button button-link">'.esc_html__('Dismiss', 'gravityview').'</a></p>'; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $output .= wpautop( $message ); |
|
| 204 | + $output .= wpautop($message); |
|
| 205 | 205 | |
| 206 | 206 | $output .= '<div class="clear"></div>'; |
| 207 | 207 | $output .= '</div>'; |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | |
| 211 | 211 | echo $output; |
| 212 | 212 | |
| 213 | - unset( $output, $align, $message, $notices ); |
|
| 213 | + unset($output, $align, $message, $notices); |
|
| 214 | 214 | |
| 215 | 215 | //reset the notices handler |
| 216 | 216 | self::$admin_notices = array(); |
@@ -223,14 +223,14 @@ discard block |
||
| 223 | 223 | * @param array $notice Array with `class`, `message`, `dismiss` and `cap` keys. The message is not escaped. |
| 224 | 224 | * @return void |
| 225 | 225 | */ |
| 226 | - public static function add_notice( $notice = array() ) { |
|
| 226 | + public static function add_notice($notice = array()) { |
|
| 227 | 227 | |
| 228 | - if( !isset( $notice['message'] ) ) { |
|
| 229 | - do_action( 'gravityview_log_error', 'GravityView_Admin[add_notice] Notice not set', $notice ); |
|
| 228 | + if (!isset($notice['message'])) { |
|
| 229 | + do_action('gravityview_log_error', 'GravityView_Admin[add_notice] Notice not set', $notice); |
|
| 230 | 230 | return; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
| 233 | + $notice['class'] = empty($notice['class']) ? 'error' : $notice['class']; |
|
| 234 | 234 | |
| 235 | 235 | self::$admin_notices[] = $notice; |
| 236 | 236 | } |
@@ -10,17 +10,17 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * @since 1.5.1 |
| 12 | 12 | */ |
| 13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
| 13 | + add_action('gform_user_registered', array($this, 'assign_new_user_to_lead'), 10, 4); |
|
| 14 | 14 | |
| 15 | 15 | // ONLY ADMIN FROM HERE ON. |
| 16 | - if( !is_admin() ) { return; } |
|
| 16 | + if (!is_admin()) { return; } |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
| 20 | 20 | * @since 1.7.4 |
| 21 | 21 | * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
| 22 | 22 | */ |
| 23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
| 23 | + if (apply_filters('gravityview_disable_change_entry_creator', false)) { |
|
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | * Use `init` to fix bbPress warning |
| 29 | 29 | * @see https://bbpress.trac.wordpress.org/ticket/2309 |
| 30 | 30 | */ |
| 31 | - add_action('init', array( $this, 'load'), 100 ); |
|
| 31 | + add_action('init', array($this, 'load'), 100); |
|
| 32 | 32 | |
| 33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
| 33 | + add_action('plugins_loaded', array($this, 'prevent_conflicts')); |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param string $password User password |
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | - function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) { |
|
| 48 | + function assign_new_user_to_lead($user_id, $config, $entry = array(), $password = '') { |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Disable assigning the new user to the entry by returning false. |
@@ -53,27 +53,27 @@ discard block |
||
| 53 | 53 | * @param array $config User registration feed configuration |
| 54 | 54 | * @param array $entry GF Entry array |
| 55 | 55 | */ |
| 56 | - $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
|
| 56 | + $assign_to_lead = apply_filters('gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry); |
|
| 57 | 57 | |
| 58 | 58 | // If filter returns false, do not process |
| 59 | - if( empty( $assign_to_lead ) ) { |
|
| 59 | + if (empty($assign_to_lead)) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
| 64 | - $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
| 64 | + $result = RGFormsModel::update_lead_property($entry['id'], 'created_by', $user_id, false, true); |
|
| 65 | 65 | |
| 66 | - if( empty( $result ) ) { |
|
| 66 | + if (empty($result)) { |
|
| 67 | 67 | $status = __('Error', 'gravityview'); |
| 68 | 68 | } else { |
| 69 | 69 | $status = __('Success', 'gravityview'); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
| 72 | + $note = sprintf(_x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id); |
|
| 73 | 73 | |
| 74 | - do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
| 74 | + do_action('gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note); |
|
| 75 | 75 | |
| 76 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
| 76 | + GravityView_Entry_Notes::add_note($entry['id'], -1, 'GravityView', $note, 'gravityview'); |
|
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
@@ -89,16 +89,16 @@ discard block |
||
| 89 | 89 | remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10, 2); |
| 90 | 90 | |
| 91 | 91 | // Disable for Gravity Forms Add-ons 3.6.2 and lower |
| 92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
| 92 | + if (class_exists('KWS_GF_Change_Lead_Creator')) { |
|
| 93 | 93 | |
| 94 | 94 | $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
| 95 | 95 | |
| 96 | 96 | // Now, no validation is required in the methods; let's hook in. |
| 97 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
| 97 | + remove_action('admin_init', array($Old_Lead_Creator, 'set_screen_mode')); |
|
| 98 | 98 | |
| 99 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10, 2); |
|
| 99 | + remove_action("gform_entry_info", array($Old_Lead_Creator, 'add_select'), 10, 2); |
|
| 100 | 100 | |
| 101 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10, 2); |
|
| 101 | + remove_action("gform_after_update_entry", array($Old_Lead_Creator, 'update_entry_creator'), 10, 2); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | } |
@@ -110,26 +110,26 @@ discard block |
||
| 110 | 110 | function load() { |
| 111 | 111 | |
| 112 | 112 | // Does GF exist? |
| 113 | - if( !class_exists('GFCommon') ) { |
|
| 113 | + if (!class_exists('GFCommon')) { |
|
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // Can the user edit entries? |
| 118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
| 118 | + if (!GVCommon::has_cap(array('gravityforms_edit_entries', 'gravityview_edit_entries'))) { |
|
| 119 | 119 | return; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // If screen mode isn't set, then we're in the wrong place. |
| 123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
| 123 | + if (empty($_REQUEST['screen_mode'])) { |
|
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Now, no validation is required in the methods; let's hook in. |
| 128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
| 128 | + add_action('admin_init', array(&$this, 'set_screen_mode')); |
|
| 129 | 129 | |
| 130 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
| 130 | + add_action("gform_entry_info", array(&$this, 'add_select'), 10, 2); |
|
| 131 | 131 | |
| 132 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
| 132 | + add_action("gform_after_update_entry", array(&$this, 'update_entry_creator'), 10, 2); |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | function set_screen_mode() { |
| 141 | 141 | |
| 142 | 142 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
| 143 | - if( rgget('screen_mode') === 'edit' ) { |
|
| 143 | + if (rgget('screen_mode') === 'edit') { |
|
| 144 | 144 | $_POST["screen_mode"] = 'edit'; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -156,38 +156,38 @@ discard block |
||
| 156 | 156 | global $current_user; |
| 157 | 157 | |
| 158 | 158 | // Update the entry |
| 159 | - $created_by = absint( rgpost('created_by') ); |
|
| 159 | + $created_by = absint(rgpost('created_by')); |
|
| 160 | 160 | |
| 161 | - RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
|
| 161 | + RGFormsModel::update_lead_property($entry_id, 'created_by', $created_by); |
|
| 162 | 162 | |
| 163 | 163 | // If the creator has changed, let's add a note about who it used to be. |
| 164 | 164 | $originally_created_by = rgpost('originally_created_by'); |
| 165 | 165 | |
| 166 | 166 | // If there's no owner and there didn't used to be, keep going |
| 167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
| 167 | + if (empty($originally_created_by) && empty($created_by)) { |
|
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // If the values have changed |
| 172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
| 172 | + if (absint($originally_created_by) !== absint($created_by)) { |
|
| 173 | 173 | |
| 174 | 174 | $user_data = get_userdata($current_user->ID); |
| 175 | 175 | |
| 176 | 176 | $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
| 177 | 177 | |
| 178 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
| 178 | + $original_name = $created_by_name = esc_attr_x('No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
| 179 | 179 | |
| 180 | - if( !empty( $originally_created_by ) ) { |
|
| 180 | + if (!empty($originally_created_by)) { |
|
| 181 | 181 | $originally_created_by_user_data = get_userdata($originally_created_by); |
| 182 | - $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
|
| 182 | + $original_name = sprintf($user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if( !empty( $created_by ) ) { |
|
| 186 | - $created_by_user_data = get_userdata($created_by); |
|
| 187 | - $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
|
| 185 | + if (!empty($created_by)) { |
|
| 186 | + $created_by_user_data = get_userdata($created_by); |
|
| 187 | + $created_by_name = sprintf($user_format, $created_by_user_data->display_name, $created_by_user_data->ID); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
| 190 | + GravityView_Entry_Notes::add_note($entry_id, $current_user->ID, $user_data->display_name, sprintf(__('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name), 'note'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | } |
@@ -198,24 +198,24 @@ discard block |
||
| 198 | 198 | * @param array $entry GF entry array |
| 199 | 199 | * @return void |
| 200 | 200 | */ |
| 201 | - function add_select($form_id, $entry ) { |
|
| 201 | + function add_select($form_id, $entry) { |
|
| 202 | 202 | |
| 203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
| 203 | + if (rgpost('screen_mode') !== 'edit') { |
|
| 204 | 204 | return; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - $users = GVCommon::get_users( 'change_entry_creator' ); |
|
| 207 | + $users = GVCommon::get_users('change_entry_creator'); |
|
| 208 | 208 | |
| 209 | 209 | $output = '<label for="change_created_by">'; |
| 210 | 210 | $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
| 211 | 211 | $output .= '</label> |
| 212 | 212 | <select name="created_by" id="change_created_by" class="widefat">'; |
| 213 | - $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
| 214 | - foreach($users as $user) { |
|
| 215 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
| 213 | + $output .= '<option value=""> — '.esc_attr_x('No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
| 214 | + foreach ($users as $user) { |
|
| 215 | + $output .= '<option value="'.$user->ID.'"'.selected($entry['created_by'], $user->ID, false).'>'.esc_attr($user->display_name.' ('.$user->user_nicename.')').'</option>'; |
|
| 216 | 216 | } |
| 217 | 217 | $output .= '</select>'; |
| 218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
| 218 | + $output .= '<input name="originally_created_by" value="'.esc_attr($entry['created_by']).'" type="hidden" />'; |
|
| 219 | 219 | echo $output; |
| 220 | 220 | |
| 221 | 221 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | function add_hooks() { |
| 59 | 59 | |
| 60 | - add_filter( 'gravityview/admin/notices', array( $this, 'insert_admin_notices' ) ); |
|
| 60 | + add_filter('gravityview/admin/notices', array($this, 'insert_admin_notices')); |
|
| 61 | 61 | |
| 62 | 62 | $this->add_fallback_shortcode(); |
| 63 | 63 | } |
@@ -68,15 +68,15 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return array |
| 70 | 70 | */ |
| 71 | - function insert_admin_notices( $notices = array() ) { |
|
| 72 | - return array_merge( $notices, self::$notices ); |
|
| 71 | + function insert_admin_notices($notices = array()) { |
|
| 72 | + return array_merge($notices, self::$notices); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * @return GravityView_Compatibility |
| 77 | 77 | */ |
| 78 | 78 | public static function getInstance() { |
| 79 | - if( self::$instance ) { |
|
| 79 | + if (self::$instance) { |
|
| 80 | 80 | return self::$instance; |
| 81 | 81 | } |
| 82 | 82 | return new self; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return bool |
| 88 | 88 | */ |
| 89 | 89 | public static function is_valid() { |
| 90 | - return ( self::is_valid_gravity_forms() && self::is_valid_wordpress() && self::is_valid_php() ); |
|
| 90 | + return (self::is_valid_gravity_forms() && self::is_valid_wordpress() && self::is_valid_php()); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | // If Gravity Forms doesn't exist or is outdated, load the admin view class to |
| 124 | 124 | // show the notice, but not load any post types or process shortcodes. |
| 125 | 125 | // Without Gravity Forms, there is no GravityView. Beautiful, really. |
| 126 | - if( ! self::is_valid() ) { |
|
| 126 | + if (!self::is_valid()) { |
|
| 127 | 127 | |
| 128 | 128 | // If the plugin's not loaded, might as well hide the shortcode for people. |
| 129 | - add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') ); |
|
| 129 | + add_shortcode('gravityview', array($this, '_shortcode_gf_notice')); |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @return null|string NULL returned if user can't activate plugins. Notice shown with a warning that GF isn't supported. |
| 152 | 152 | */ |
| 153 | - public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) { |
|
| 153 | + public function _shortcode_gf_notice($atts = array(), $content = null, $shortcode = 'gravityview') { |
|
| 154 | 154 | |
| 155 | - if( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
| 155 | + if (!GVCommon::has_cap('activate_plugins')) { |
|
| 156 | 156 | return null; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $notices = self::get_notices(); |
| 160 | 160 | |
| 161 | - $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>'; |
|
| 162 | - foreach( (array)$notices as $notice ) { |
|
| 163 | - $message .= wpautop( $notice['message'] ); |
|
| 161 | + $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>'.esc_html__('You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview').'</em></p>'; |
|
| 162 | + foreach ((array)$notices as $notice) { |
|
| 163 | + $message .= wpautop($notice['message']); |
|
| 164 | 164 | } |
| 165 | 165 | $message .= '</div>'; |
| 166 | 166 | |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | * @return boolean |
| 176 | 176 | */ |
| 177 | 177 | public static function check_php() { |
| 178 | - if( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) { |
|
| 178 | + if (false === version_compare(phpversion(), GV_MIN_PHP_VERSION, '>=')) { |
|
| 179 | 179 | |
| 180 | 180 | self::$notices['php_version'] = array( |
| 181 | 181 | 'class' => 'error', |
| 182 | - 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
| 182 | + 'message' => sprintf(__("%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview'), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>'), |
|
| 183 | 183 | 'cap' => 'manage_options', |
| 184 | 184 | 'dismiss' => 'php_version', |
| 185 | 185 | ); |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | public static function check_wordpress() { |
| 200 | 200 | global $wp_version; |
| 201 | 201 | |
| 202 | - if( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) { |
|
| 202 | + if (version_compare($wp_version, GV_MIN_WP_VERSION) <= 0) { |
|
| 203 | 203 | |
| 204 | 204 | self::$notices['wp_version'] = array( |
| 205 | 205 | 'class' => 'error', |
| 206 | - 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
|
| 206 | + 'message' => sprintf(__("%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview'), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>'), |
|
| 207 | 207 | 'cap' => 'update_core', |
| 208 | 208 | 'dismiss' => 'wp_version', |
| 209 | 209 | ); |
@@ -226,17 +226,17 @@ discard block |
||
| 226 | 226 | public static function check_gravityforms() { |
| 227 | 227 | |
| 228 | 228 | // Bypass other checks: if the class exists |
| 229 | - if( class_exists( 'GFCommon' ) ) { |
|
| 229 | + if (class_exists('GFCommon')) { |
|
| 230 | 230 | |
| 231 | 231 | // and the version's right, we're good. |
| 232 | - if( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) { |
|
| 232 | + if (true === version_compare(GFCommon::$version, GV_MIN_GF_VERSION, ">=")) { |
|
| 233 | 233 | return true; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Or the version's wrong |
| 237 | 237 | self::$notices['gf_version'] = array( |
| 238 | 238 | 'class' => 'error', |
| 239 | - 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
| 239 | + 'message' => sprintf(__("%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview'), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>'), |
|
| 240 | 240 | 'cap' => 'update_plugins', |
| 241 | 241 | 'dismiss' => 'gf_version', |
| 242 | 242 | ); |
@@ -244,40 +244,40 @@ discard block |
||
| 244 | 244 | return false; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - $gf_status = self::get_plugin_status( 'gravityforms/gravityforms.php' ); |
|
| 247 | + $gf_status = self::get_plugin_status('gravityforms/gravityforms.php'); |
|
| 248 | 248 | |
| 249 | 249 | /** |
| 250 | 250 | * The plugin is activated and yet somehow GFCommon didn't get picked up... |
| 251 | 251 | * OR |
| 252 | 252 | * It's the Network Admin and we just don't know whether the sites have GF activated themselves. |
| 253 | 253 | */ |
| 254 | - if( true === $gf_status || is_network_admin() ) { |
|
| 254 | + if (true === $gf_status || is_network_admin()) { |
|
| 255 | 255 | return true; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // If GFCommon doesn't exist, assume GF not active |
| 259 | 259 | $return = false; |
| 260 | 260 | |
| 261 | - switch( $gf_status ) { |
|
| 261 | + switch ($gf_status) { |
|
| 262 | 262 | case 'inactive': |
| 263 | 263 | |
| 264 | 264 | // Required for multisite |
| 265 | - if( ! function_exists('wp_create_nonce') ) { |
|
| 266 | - require_once ABSPATH . WPINC . '/pluggable.php'; |
|
| 265 | + if (!function_exists('wp_create_nonce')) { |
|
| 266 | + require_once ABSPATH.WPINC.'/pluggable.php'; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE" |
| 270 | - if( is_multisite() ) { |
|
| 270 | + if (is_multisite()) { |
|
| 271 | 271 | wp_cookie_constants(); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $return = false; |
| 275 | 275 | |
| 276 | - $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">'; |
|
| 276 | + $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'.wp_nonce_url(admin_url('plugins.php?action=activate&plugin=gravityforms/gravityforms.php'), 'activate-plugin_gravityforms/gravityforms.php').'" class="button button-large">'; |
|
| 277 | 277 | |
| 278 | 278 | self::$notices['gf_inactive'] = array( |
| 279 | 279 | 'class' => 'error', |
| 280 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ), |
|
| 280 | + 'message' => sprintf(__('%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview'), '<h3>', "</h3>\n\n".$button, '</a></strong>'), |
|
| 281 | 281 | 'cap' => 'activate_plugins', |
| 282 | 282 | 'dismiss' => 'gf_inactive', |
| 283 | 283 | ); |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | default: |
| 287 | 287 | self::$notices['gf_installed'] = array( |
| 288 | 288 | 'class' => 'error', |
| 289 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
| 289 | + 'message' => sprintf(__('%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview'), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>'), |
|
| 290 | 290 | 'cap' => 'install_plugins', |
| 291 | 291 | 'dismiss' => 'gf_installed', |
| 292 | 292 | ); |
@@ -303,11 +303,11 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | private static function check_gf_directory() { |
| 305 | 305 | |
| 306 | - if( class_exists( 'GFDirectory' ) ) { |
|
| 306 | + if (class_exists('GFDirectory')) { |
|
| 307 | 307 | self::$notices['gf_directory'] = array( |
| 308 | 308 | 'class' => 'error is-dismissible', |
| 309 | - 'title' => __('Potential Conflict', 'gravityview' ), |
|
| 310 | - 'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ), |
|
| 309 | + 'title' => __('Potential Conflict', 'gravityview'), |
|
| 310 | + 'message' => __('GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview'), |
|
| 311 | 311 | 'dismiss' => 'gf_directory', |
| 312 | 312 | 'cap' => 'activate_plugins', |
| 313 | 313 | ); |
@@ -323,23 +323,23 @@ discard block |
||
| 323 | 323 | * @param string $location (default: '') |
| 324 | 324 | * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive |
| 325 | 325 | */ |
| 326 | - public static function get_plugin_status( $location = '' ) { |
|
| 326 | + public static function get_plugin_status($location = '') { |
|
| 327 | 327 | |
| 328 | - if( ! function_exists('is_plugin_active') ) { |
|
| 329 | - include_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
|
| 328 | + if (!function_exists('is_plugin_active')) { |
|
| 329 | + include_once(ABSPATH.'/wp-admin/includes/plugin.php'); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
| 332 | + if (is_network_admin() && is_plugin_active_for_network($location)) { |
|
| 333 | 333 | return true; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if( !is_network_admin() && is_plugin_active( $location ) ) { |
|
| 336 | + if (!is_network_admin() && is_plugin_active($location)) { |
|
| 337 | 337 | return true; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if( |
|
| 341 | - !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
| 342 | - !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
| 340 | + if ( |
|
| 341 | + !file_exists(trailingslashit(WP_PLUGIN_DIR).$location) && |
|
| 342 | + !file_exists(trailingslashit(WPMU_PLUGIN_DIR).$location) |
|
| 343 | 343 | ) { |
| 344 | 344 | return false; |
| 345 | 345 | } |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | * @since 1.15 |
| 52 | 52 | */ |
| 53 | 53 | private function add_hooks() { |
| 54 | - add_shortcode( 'gv_entry_link', array( $this, 'read_shortcode' ) ); |
|
| 55 | - add_shortcode( 'gv_edit_entry_link', array( $this, 'edit_shortcode' ) ); |
|
| 56 | - add_shortcode( 'gv_delete_entry_link', array( $this, 'delete_shortcode' ) ); |
|
| 54 | + add_shortcode('gv_entry_link', array($this, 'read_shortcode')); |
|
| 55 | + add_shortcode('gv_edit_entry_link', array($this, 'edit_shortcode')); |
|
| 56 | + add_shortcode('gv_delete_entry_link', array($this, 'delete_shortcode')); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * @since 1.15 |
| 61 | 61 | * @copydoc GravityView_Entry_Link_Shortcode::shortcode |
| 62 | 62 | */ |
| 63 | - public function read_shortcode( $atts, $content = null, $context = 'gv_entry_link' ) { |
|
| 64 | - return $this->shortcode( $atts, $content, $context ); |
|
| 63 | + public function read_shortcode($atts, $content = null, $context = 'gv_entry_link') { |
|
| 64 | + return $this->shortcode($atts, $content, $context); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | * @since 1.15 |
| 72 | 72 | * @copydoc GravityView_Entry_Link_Shortcode::shortcode |
| 73 | 73 | */ |
| 74 | - public function edit_shortcode( $atts, $content = null, $context = 'gv_edit_entry_link' ) { |
|
| 74 | + public function edit_shortcode($atts, $content = null, $context = 'gv_edit_entry_link') { |
|
| 75 | 75 | $atts['action'] = 'edit'; |
| 76 | 76 | |
| 77 | - return $this->shortcode( $atts, $content, $context ); |
|
| 77 | + return $this->shortcode($atts, $content, $context); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | * @since 1.15 |
| 85 | 85 | * @copydoc GravityView_Entry_Link_Shortcode::shortcode |
| 86 | 86 | */ |
| 87 | - public function delete_shortcode( $atts, $content = null, $context = 'gv_delete_entry_link' ) { |
|
| 87 | + public function delete_shortcode($atts, $content = null, $context = 'gv_delete_entry_link') { |
|
| 88 | 88 | $atts['action'] = 'delete'; |
| 89 | 89 | |
| 90 | - return $this->shortcode( $atts, $content, $context ); |
|
| 90 | + return $this->shortcode($atts, $content, $context); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -110,58 +110,58 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return null|string If admin or an error occurred, returns null. Otherwise, returns entry link output. If `$atts['return']` is 'url', the entry link URL. Otherwise, entry link `<a>` HTML tag. |
| 112 | 112 | */ |
| 113 | - private function shortcode( $atts, $content = null, $context = 'gv_entry_link' ) { |
|
| 113 | + private function shortcode($atts, $content = null, $context = 'gv_entry_link') { |
|
| 114 | 114 | |
| 115 | 115 | // Don't process when saving post. Keep processing if it's admin-ajax.php |
| 116 | - if ( ! class_exists( 'GravityView_Plugin' ) || GravityView_Plugin::is_admin() ) { |
|
| 116 | + if (!class_exists('GravityView_Plugin') || GravityView_Plugin::is_admin()) { |
|
| 117 | 117 | return null; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | // Make sure GV is loaded |
| 121 | - if ( ! class_exists( 'GravityView_frontend' ) || ! class_exists( 'GravityView_View' ) ) { |
|
| 122 | - do_action( 'gravityview_log_error', __METHOD__ . ' GravityView_frontend or GravityView_View do not exist.' ); |
|
| 121 | + if (!class_exists('GravityView_frontend') || !class_exists('GravityView_View')) { |
|
| 122 | + do_action('gravityview_log_error', __METHOD__.' GravityView_frontend or GravityView_View do not exist.'); |
|
| 123 | 123 | |
| 124 | 124 | return null; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
|
| 127 | + $this->settings = shortcode_atts(self::$defaults, $atts, $context); |
|
| 128 | 128 | |
| 129 | - $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
| 129 | + $this->view_id = empty($this->settings['view_id']) ? GravityView_View::getInstance()->getViewId() : absint($this->settings['view_id']); |
|
| 130 | 130 | |
| 131 | - if ( empty( $this->view_id ) ) { |
|
| 132 | - do_action( 'gravityview_log_error', __METHOD__ . ' A View ID was not defined and we are not inside a View' ); |
|
| 131 | + if (empty($this->view_id)) { |
|
| 132 | + do_action('gravityview_log_error', __METHOD__.' A View ID was not defined and we are not inside a View'); |
|
| 133 | 133 | |
| 134 | 134 | return null; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
| 137 | + $this->entry = $this->get_entry($this->settings['entry_id']); |
|
| 138 | 138 | |
| 139 | - do_action( 'gravityview_log_debug', __METHOD__ . ' ' . $context . ' $atts: ', $atts ); |
|
| 139 | + do_action('gravityview_log_debug', __METHOD__.' '.$context.' $atts: ', $atts); |
|
| 140 | 140 | |
| 141 | - if ( ! $this->has_cap() ) { |
|
| 142 | - do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the capability to ' . esc_attr( $this->settings['action'] ) . ' this entry: ' . $this->entry['id'] ); |
|
| 141 | + if (!$this->has_cap()) { |
|
| 142 | + do_action('gravityview_log_error', __METHOD__.' User does not have the capability to '.esc_attr($this->settings['action']).' this entry: '.$this->entry['id']); |
|
| 143 | 143 | |
| 144 | 144 | return null; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | $url = $this->get_url(); |
| 148 | 148 | |
| 149 | - if ( ! $url ) { |
|
| 150 | - do_action( 'gravityview_log_error', __METHOD__ . ' Link returned false; View or Post may not exist.' ); |
|
| 149 | + if (!$url) { |
|
| 150 | + do_action('gravityview_log_error', __METHOD__.' Link returned false; View or Post may not exist.'); |
|
| 151 | 151 | |
| 152 | 152 | return false; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | // Get just the URL, not the tag |
| 156 | - if ( 'url' === $this->settings['return'] ) { |
|
| 156 | + if ('url' === $this->settings['return']) { |
|
| 157 | 157 | return $url; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $link_atts = $this->get_link_atts(); |
| 161 | 161 | |
| 162 | - $link_text = $this->get_anchor_text( $content ); |
|
| 162 | + $link_text = $this->get_anchor_text($content); |
|
| 163 | 163 | |
| 164 | - return gravityview_get_link( $url, $link_text, $link_atts ); |
|
| 164 | + return gravityview_get_link($url, $link_text, $link_atts); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -174,13 +174,13 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | private function get_link_atts() { |
| 176 | 176 | |
| 177 | - wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
| 177 | + wp_parse_str($this->settings['link_atts'], $link_atts); |
|
| 178 | 178 | |
| 179 | - if ( 'delete' === $this->settings['action'] ) { |
|
| 180 | - $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
| 179 | + if ('delete' === $this->settings['action']) { |
|
| 180 | + $link_atts['onclick'] = isset($link_atts['onclick']) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - return (array) $link_atts; |
|
| 183 | + return (array)$link_atts; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -194,21 +194,21 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return string Text to use for HTML anchor |
| 196 | 196 | */ |
| 197 | - private function get_anchor_text( $content = null ) { |
|
| 197 | + private function get_anchor_text($content = null) { |
|
| 198 | 198 | |
| 199 | - if ( $content ) { |
|
| 199 | + if ($content) { |
|
| 200 | 200 | return $content; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - switch ( $this->settings['action'] ) { |
|
| 203 | + switch ($this->settings['action']) { |
|
| 204 | 204 | case 'edit': |
| 205 | - $anchor_text = __( 'Edit Entry', 'gravityview' ); |
|
| 205 | + $anchor_text = __('Edit Entry', 'gravityview'); |
|
| 206 | 206 | break; |
| 207 | 207 | case 'delete': |
| 208 | - $anchor_text = __( 'Delete Entry', 'gravityview' ); |
|
| 208 | + $anchor_text = __('Delete Entry', 'gravityview'); |
|
| 209 | 209 | break; |
| 210 | 210 | default: |
| 211 | - $anchor_text = __( 'View Details', 'gravityview' ); |
|
| 211 | + $anchor_text = __('View Details', 'gravityview'); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | return $anchor_text; |
@@ -228,21 +228,21 @@ discard block |
||
| 228 | 228 | private function get_url() { |
| 229 | 229 | |
| 230 | 230 | // if post_id is not defined, default to view_id |
| 231 | - $post_id = empty( $this->settings['post_id'] ) ? $this->view_id : absint( $this->settings['post_id'] ); |
|
| 231 | + $post_id = empty($this->settings['post_id']) ? $this->view_id : absint($this->settings['post_id']); |
|
| 232 | 232 | |
| 233 | - switch ( $this->settings['action'] ) { |
|
| 233 | + switch ($this->settings['action']) { |
|
| 234 | 234 | case 'edit': |
| 235 | - $url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
|
| 235 | + $url = GravityView_Edit_Entry::get_edit_link($this->entry, $this->view_id, $post_id); |
|
| 236 | 236 | break; |
| 237 | 237 | case 'delete': |
| 238 | - $url = GravityView_Delete_Entry::get_delete_link( $this->entry, $this->view_id, $post_id ); |
|
| 238 | + $url = GravityView_Delete_Entry::get_delete_link($this->entry, $this->view_id, $post_id); |
|
| 239 | 239 | break; |
| 240 | 240 | case 'read': |
| 241 | 241 | default: |
| 242 | - $url = GravityView_API::entry_link( $this->entry, $post_id ); |
|
| 242 | + $url = GravityView_API::entry_link($this->entry, $post_id); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - $url = $this->maybe_add_field_values_query_args( $url ); |
|
| 245 | + $url = $this->maybe_add_field_values_query_args($url); |
|
| 246 | 246 | |
| 247 | 247 | return $url; |
| 248 | 248 | } |
@@ -255,12 +255,12 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | private function has_cap() { |
| 257 | 257 | |
| 258 | - switch ( $this->settings['action'] ) { |
|
| 258 | + switch ($this->settings['action']) { |
|
| 259 | 259 | case 'edit': |
| 260 | - $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
|
| 260 | + $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry($this->entry, $this->view_id); |
|
| 261 | 261 | break; |
| 262 | 262 | case 'delete': |
| 263 | - $has_cap = GravityView_Delete_Entry::check_user_cap_delete_entry( $this->entry, array(), $this->view_id ); |
|
| 263 | + $has_cap = GravityView_Delete_Entry::check_user_cap_delete_entry($this->entry, array(), $this->view_id); |
|
| 264 | 264 | break; |
| 265 | 265 | case 'read': |
| 266 | 266 | default: |
@@ -281,28 +281,28 @@ discard block |
||
| 281 | 281 | * |
| 282 | 282 | * @return array|bool Gravity Forms array, if found. Otherwise, false. |
| 283 | 283 | */ |
| 284 | - private function get_entry( $entry_id = 0 ) { |
|
| 284 | + private function get_entry($entry_id = 0) { |
|
| 285 | 285 | |
| 286 | 286 | $backup_entry = GravityView_frontend::getInstance()->getSingleEntry() ? GravityView_frontend::getInstance()->getEntry() : GravityView_View::getInstance()->getCurrentEntry(); |
| 287 | 287 | |
| 288 | - if ( empty( $entry_id ) ) { |
|
| 289 | - if ( ! $backup_entry ) { |
|
| 290 | - do_action( 'gravityview_log_error', __METHOD__ . ' No entry defined (or entry id not valid number)', $this->settings ); |
|
| 288 | + if (empty($entry_id)) { |
|
| 289 | + if (!$backup_entry) { |
|
| 290 | + do_action('gravityview_log_error', __METHOD__.' No entry defined (or entry id not valid number)', $this->settings); |
|
| 291 | 291 | |
| 292 | 292 | return false; |
| 293 | 293 | } |
| 294 | 294 | $entry = $backup_entry; |
| 295 | 295 | } else { |
| 296 | - $entry = wp_cache_get( 'gv_entry_link_entry_' . $entry_id, 'gravityview_entry_link_shortcode' ); |
|
| 297 | - if ( false === $entry ) { |
|
| 298 | - $entry = GVCommon::get_entry( $entry_id, true, false ); |
|
| 299 | - wp_cache_add( 'gv_entry_link_entry_' . $entry_id, $entry, 'gravityview_entry_link_shortcode' ); |
|
| 296 | + $entry = wp_cache_get('gv_entry_link_entry_'.$entry_id, 'gravityview_entry_link_shortcode'); |
|
| 297 | + if (false === $entry) { |
|
| 298 | + $entry = GVCommon::get_entry($entry_id, true, false); |
|
| 299 | + wp_cache_add('gv_entry_link_entry_'.$entry_id, $entry, 'gravityview_entry_link_shortcode'); |
|
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | // No search results |
| 304 | - if ( false === $entry ) { |
|
| 305 | - do_action( 'gravityview_log_error', __METHOD__ . ' No entries match the entry ID defined', $entry_id ); |
|
| 304 | + if (false === $entry) { |
|
| 305 | + do_action('gravityview_log_error', __METHOD__.' No entries match the entry ID defined', $entry_id); |
|
| 306 | 306 | |
| 307 | 307 | return false; |
| 308 | 308 | } |
@@ -318,13 +318,13 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * @param string $href URL |
| 320 | 320 | */ |
| 321 | - private function maybe_add_field_values_query_args( $url ) { |
|
| 321 | + private function maybe_add_field_values_query_args($url) { |
|
| 322 | 322 | |
| 323 | - if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
| 323 | + if ($url && !empty($this->settings['field_values'])) { |
|
| 324 | 324 | |
| 325 | - wp_parse_str( $this->settings['field_values'], $field_values ); |
|
| 325 | + wp_parse_str($this->settings['field_values'], $field_values); |
|
| 326 | 326 | |
| 327 | - $url = add_query_arg( $field_values, $url ); |
|
| 327 | + $url = add_query_arg($field_values, $url); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | return $url; |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** If this file is called directly, abort. */ |
| 4 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 4 | +if (!defined('ABSPATH')) { |
|
| 5 | 5 | die; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @param string $link_format |
| 76 | 76 | * @param string $after_link |
| 77 | 77 | */ |
| 78 | - function __construct( $entries = array(), $post_id = 0, $form = array(), $link_format = '', $after_link = '', $context = '' ) { |
|
| 78 | + function __construct($entries = array(), $post_id = 0, $form = array(), $link_format = '', $after_link = '', $context = '') { |
|
| 79 | 79 | |
| 80 | 80 | $this->entries = $entries; |
| 81 | 81 | $this->post_id = $post_id; |
@@ -90,28 +90,28 @@ discard block |
||
| 90 | 90 | /** |
| 91 | 91 | * @param int $post_id |
| 92 | 92 | */ |
| 93 | - public function set_post_id( $post_id ) { |
|
| 93 | + public function set_post_id($post_id) { |
|
| 94 | 94 | $this->post_id = $post_id; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @param string $link_format |
| 99 | 99 | */ |
| 100 | - public function set_link_format( $link_format ) { |
|
| 100 | + public function set_link_format($link_format) { |
|
| 101 | 101 | $this->link_format = $link_format; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * @param boolean $skip_current_entry |
| 106 | 106 | */ |
| 107 | - public function set_skip_current_entry( $skip_current_entry ) { |
|
| 107 | + public function set_skip_current_entry($skip_current_entry) { |
|
| 108 | 108 | $this->skip_current_entry = (bool)$skip_current_entry; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * @param string $after_link |
| 113 | 113 | */ |
| 114 | - public function set_after_link( $after_link ) { |
|
| 114 | + public function set_after_link($after_link) { |
|
| 115 | 115 | $this->after_link = $after_link; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * Set the message when there are no entries to display |
| 120 | 120 | * @param string $empty_message |
| 121 | 121 | */ |
| 122 | - public function set_empty_message( $empty_message ) { |
|
| 122 | + public function set_empty_message($empty_message) { |
|
| 123 | 123 | $this->empty_message = $empty_message; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -127,23 +127,23 @@ discard block |
||
| 127 | 127 | * Set the context in which this entry list is being displayed. |
| 128 | 128 | * @param string $context |
| 129 | 129 | */ |
| 130 | - public function set_context( $context ) { |
|
| 130 | + public function set_context($context) { |
|
| 131 | 131 | $this->context = $context; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * @param string $wrapper_tag |
| 136 | 136 | */ |
| 137 | - public function set_wrapper_tag( $wrapper_tag ) { |
|
| 138 | - $this->wrapper_tag = esc_attr( $wrapper_tag ); |
|
| 137 | + public function set_wrapper_tag($wrapper_tag) { |
|
| 138 | + $this->wrapper_tag = esc_attr($wrapper_tag); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | * |
| 143 | 143 | * @param string $item_tag |
| 144 | 144 | */ |
| 145 | - public function set_item_tag( $item_tag ) { |
|
| 146 | - $this->item_tag = esc_attr( $item_tag ); |
|
| 145 | + public function set_item_tag($item_tag) { |
|
| 146 | + $this->item_tag = esc_attr($item_tag); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -170,32 +170,32 @@ discard block |
||
| 170 | 170 | public function get_output() { |
| 171 | 171 | |
| 172 | 172 | // No Entries |
| 173 | - if( empty( $this->entries ) ) { |
|
| 173 | + if (empty($this->entries)) { |
|
| 174 | 174 | return '<div class="gv-no-results">'.$this->empty_message.'</div>'; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $output = ''; |
| 178 | 178 | $current_entry = GravityView_View::getInstance()->getCurrentEntry(); |
| 179 | 179 | |
| 180 | - $output .= '<'. $this->wrapper_tag .'>'; |
|
| 180 | + $output .= '<'.$this->wrapper_tag.'>'; |
|
| 181 | 181 | |
| 182 | - foreach( $this->entries as $entry ) { |
|
| 182 | + foreach ($this->entries as $entry) { |
|
| 183 | 183 | |
| 184 | - if( $this->skip_entry( $entry, $current_entry ) ) { |
|
| 184 | + if ($this->skip_entry($entry, $current_entry)) { |
|
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $output .= $this->get_item_output( $entry ); |
|
| 188 | + $output .= $this->get_item_output($entry); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $output .= '</'. $this->wrapper_tag .'>'; |
|
| 191 | + $output .= '</'.$this->wrapper_tag.'>'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output |
| 195 | 195 | * @param string $output HTML to be displayed |
| 196 | 196 | * @param GravityView_Entry_List $this The current class instance |
| 197 | 197 | */ |
| 198 | - $output = apply_filters( 'gravityview/widget/recent-entries/output', $output, $this ); |
|
| 198 | + $output = apply_filters('gravityview/widget/recent-entries/output', $output, $this); |
|
| 199 | 199 | |
| 200 | 200 | return $output; |
| 201 | 201 | } |
@@ -208,18 +208,18 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @return bool True: Skip entry; False: don't skip entry |
| 210 | 210 | */ |
| 211 | - private function skip_entry( $entry, $current_entry ) { |
|
| 211 | + private function skip_entry($entry, $current_entry) { |
|
| 212 | 212 | |
| 213 | 213 | // If skip entry is off, or there's no current entry, return false |
| 214 | - if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
| 214 | + if (empty($this->skip_current_entry) || empty($current_entry)) { |
|
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // If in Single or Edit mode, $current_entry will be an array. |
| 219 | - $current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry; |
|
| 219 | + $current_entry_id = is_array($current_entry) ? $current_entry['id'] : $current_entry; |
|
| 220 | 220 | |
| 221 | 221 | // If the entry ID matches the current entry, yes: skip |
| 222 | - if( $entry['id'] === $current_entry_id ) { |
|
| 222 | + if ($entry['id'] === $current_entry_id) { |
|
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -240,13 +240,13 @@ discard block |
||
| 240 | 240 | * |
| 241 | 241 | * @return string HTML output for the entry |
| 242 | 242 | */ |
| 243 | - private function get_item_output( $entry ) { |
|
| 243 | + private function get_item_output($entry) { |
|
| 244 | 244 | |
| 245 | - $link = GravityView_API::entry_link( $entry, $this->post_id ); |
|
| 245 | + $link = GravityView_API::entry_link($entry, $this->post_id); |
|
| 246 | 246 | |
| 247 | - $item_output = gravityview_get_link( $link, $this->link_format ); |
|
| 247 | + $item_output = gravityview_get_link($link, $this->link_format); |
|
| 248 | 248 | |
| 249 | - if( !empty( $this->after_link ) ) { |
|
| 249 | + if (!empty($this->after_link)) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | * @param array $entry Gravity Forms entry array |
| 256 | 256 | * @param GravityView_Entry_List $this The current class instance |
| 257 | 257 | */ |
| 258 | - $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this ); |
|
| 258 | + $after_link = apply_filters('gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this); |
|
| 259 | 259 | |
| 260 | 260 | $item_output .= $after_link; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - $item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry ); |
|
| 263 | + $item_output = GravityView_API::replace_variables($item_output, $this->form, $entry); |
|
| 264 | 264 | |
| 265 | - $item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>'; |
|
| 265 | + $item_output = '<'.$this->item_tag.'>'.$item_output.'</'.$this->item_tag.'>'; |
|
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * @filter `gravityview/entry-list/item` Modify each item's output in an entry list |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @param array $entry Gravity Forms entry array |
| 272 | 272 | * @param GravityView_Entry_List $this The current class instance |
| 273 | 273 | */ |
| 274 | - $item_output = apply_filters( 'gravityview/entry-list/item', $item_output, $entry, $this ); |
|
| 274 | + $item_output = apply_filters('gravityview/entry-list/item', $item_output, $entry, $this); |
|
| 275 | 275 | |
| 276 | 276 | return $item_output; |
| 277 | 277 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @since 1.15 |
| 18 | 18 | */ |
| 19 | 19 | private function add_hooks() { |
| 20 | - add_filter( 'gform_notes_avatar', array( 'GravityView_Entry_Notes', 'filter_avatar' ), 10, 2 ); |
|
| 20 | + add_filter('gform_notes_avatar', array('GravityView_Entry_Notes', 'filter_avatar'), 10, 2); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param string $note Note content. |
| 32 | 32 | * @param string $note_type Type of note. Default: `gravityview` |
| 33 | 33 | */ |
| 34 | - public static function add_note( $lead_id, $user_id, $user_name, $note = '', $note_type = 'gravityview' ) { |
|
| 34 | + public static function add_note($lead_id, $user_id, $user_name, $note = '', $note_type = 'gravityview') { |
|
| 35 | 35 | |
| 36 | 36 | $default_note = array( |
| 37 | 37 | 'lead_id' => 0, |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | * @since 1.15.2 |
| 48 | 48 | * @param array $note Array with `lead_id`, `user_id`, `user_name`, `note`, and `note_type` key value pairs |
| 49 | 49 | */ |
| 50 | - $note = apply_filters( 'gravityview/entry_notes/add_note', compact( 'lead_id', 'user_id', 'user_name', 'note', 'note_type' ) ); |
|
| 50 | + $note = apply_filters('gravityview/entry_notes/add_note', compact('lead_id', 'user_id', 'user_name', 'note', 'note_type')); |
|
| 51 | 51 | |
| 52 | 52 | // Make sure the keys are all set |
| 53 | - $note = wp_parse_args( $note, $default_note ); |
|
| 53 | + $note = wp_parse_args($note, $default_note); |
|
| 54 | 54 | |
| 55 | - GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) ); |
|
| 55 | + GFFormsModel::add_note(intval($note['lead_id']), intval($note['user_id']), esc_attr($note['user_name']), $note['note'], esc_attr($note['note_type'])); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | * @see GFFormsModel::delete_note() |
| 61 | 61 | * @param int $note_id Entry note ID |
| 62 | 62 | */ |
| 63 | - public static function delete_note( $note_id ) { |
|
| 64 | - GFFormsModel::delete_note( $note_id ); |
|
| 63 | + public static function delete_note($note_id) { |
|
| 64 | + GFFormsModel::delete_note($note_id); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | * @todo Write more efficient delete note method using SQL |
| 71 | 71 | * @param int[] $note_ids Array of entry note ids |
| 72 | 72 | */ |
| 73 | - public static function delete_notes( $note_ids = array() ) { |
|
| 73 | + public static function delete_notes($note_ids = array()) { |
|
| 74 | 74 | |
| 75 | - if( !is_array( $note_ids ) ) { |
|
| 76 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Note IDs not an array', $note_ids ); |
|
| 75 | + if (!is_array($note_ids)) { |
|
| 76 | + do_action('gravityview_log_error', __METHOD__.' - Note IDs not an array', $note_ids); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - GFFormsModel::delete_notes( $note_ids ); |
|
| 79 | + GFFormsModel::delete_notes($note_ids); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @return stdClass[] Integer-keyed array of note objects |
| 89 | 89 | */ |
| 90 | - public static function get_notes( $entry_id ) { |
|
| 91 | - $notes = GFFormsModel::get_lead_notes( $entry_id ); |
|
| 90 | + public static function get_notes($entry_id) { |
|
| 91 | + $notes = GFFormsModel::get_lead_notes($entry_id); |
|
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @filter `gravityview/entry_notes/get_notes` Modify the notes array for an entry |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param stdClass[] $notes Integer-keyed array of note objects |
| 97 | 97 | * @param int $entry_id Entry to get notes for |
| 98 | 98 | */ |
| 99 | - $notes = apply_filters( 'gravityview/entry_notes/get_notes', $notes, $entry_id ); |
|
| 99 | + $notes = apply_filters('gravityview/entry_notes/get_notes', $notes, $entry_id); |
|
| 100 | 100 | |
| 101 | 101 | return $notes; |
| 102 | 102 | } |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | * @param object $note Note object with id, user_id, date_created, value, note_type, user_name, user_email vars |
| 110 | 110 | * @return string Possibly-modified avatar |
| 111 | 111 | */ |
| 112 | - public static function filter_avatar( $avatar = '', $note ) { |
|
| 112 | + public static function filter_avatar($avatar = '', $note) { |
|
| 113 | 113 | |
| 114 | - if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
| 115 | - $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
| 114 | + if ('gravityview' === $note->note_type && -1 === (int)$note->user_id) { |
|
| 115 | + $avatar = sprintf('<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw(plugins_url('assets/images/floaty-avatar.png', GRAVITYVIEW_FILE))); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | return $avatar; |
@@ -69,22 +69,22 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | function __construct() { |
| 71 | 71 | |
| 72 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
| 72 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
| 73 | 73 | |
| 74 | - add_action( 'admin_init', array( $this, 'settings') ); |
|
| 74 | + add_action('admin_init', array($this, 'settings')); |
|
| 75 | 75 | |
| 76 | - add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 ); |
|
| 76 | + add_action('admin_notices', array($this, 'admin_notice'), 100); |
|
| 77 | 77 | |
| 78 | - add_action( 'gravityview/metaboxes/before_render', array( $this, 'add_metabox_tab' ) ); |
|
| 78 | + add_action('gravityview/metaboxes/before_render', array($this, 'add_metabox_tab')); |
|
| 79 | 79 | |
| 80 | - if( false === $this->is_extension_supported() ) { |
|
| 80 | + if (false === $this->is_extension_supported()) { |
|
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
|
| 84 | + add_filter('gravityview_tooltips', array($this, 'tooltips')); |
|
| 85 | 85 | |
| 86 | 86 | // Save the form configuration. Run at 14 so that View metadata is already saved (at 10) |
| 87 | - add_action( 'save_post', array( $this, 'save_post' ), 14 ); |
|
| 87 | + add_action('save_post', array($this, 'save_post'), 14); |
|
| 88 | 88 | |
| 89 | 89 | $this->add_hooks(); |
| 90 | 90 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $tab_settings = $this->tab_settings(); |
| 117 | 117 | |
| 118 | 118 | // Don't add a tab if it's empty. |
| 119 | - if( empty( $tab_settings ) ) { |
|
| 119 | + if (empty($tab_settings)) { |
|
| 120 | 120 | return; |
| 121 | 121 | } |
| 122 | 122 | |
@@ -131,20 +131,20 @@ discard block |
||
| 131 | 131 | 'priority' => 'default', |
| 132 | 132 | ); |
| 133 | 133 | |
| 134 | - $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
|
| 134 | + $tab = wp_parse_args($tab_settings, $tab_defaults); |
|
| 135 | 135 | |
| 136 | 136 | // Force the screen to be GravityView |
| 137 | 137 | $tab['screen'] = 'gravityview'; |
| 138 | 138 | |
| 139 | - if( class_exists('GravityView_Metabox_Tab') ) { |
|
| 139 | + if (class_exists('GravityView_Metabox_Tab')) { |
|
| 140 | 140 | |
| 141 | - $metabox = new GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] ); |
|
| 141 | + $metabox = new GravityView_Metabox_Tab($tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args']); |
|
| 142 | 142 | |
| 143 | - GravityView_Metabox_Tabs::add( $metabox ); |
|
| 143 | + GravityView_Metabox_Tabs::add($metabox); |
|
| 144 | 144 | |
| 145 | 145 | } else { |
| 146 | 146 | |
| 147 | - add_meta_box( 'gravityview_'.$tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] ); |
|
| 147 | + add_meta_box('gravityview_'.$tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority']); |
|
| 148 | 148 | |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -160,37 +160,37 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function load_plugin_textdomain() { |
| 162 | 162 | |
| 163 | - if( empty( $this->_text_domain ) ) { |
|
| 164 | - do_action( 'gravityview_log_debug', __METHOD__ . ': Extension translation cannot be loaded; the `_text_domain` variable is not defined', $this ); |
|
| 163 | + if (empty($this->_text_domain)) { |
|
| 164 | + do_action('gravityview_log_debug', __METHOD__.': Extension translation cannot be loaded; the `_text_domain` variable is not defined', $this); |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // Backward compat for Ratings & Reviews / Maps |
| 169 | - $path = isset( $this->_path ) ? $this->_path : ( isset( $this->plugin_file ) ? $this->plugin_file : '' ); |
|
| 169 | + $path = isset($this->_path) ? $this->_path : (isset($this->plugin_file) ? $this->plugin_file : ''); |
|
| 170 | 170 | |
| 171 | 171 | // Set filter for plugin's languages directory |
| 172 | - $lang_dir = dirname( plugin_basename( $path ) ) . '/languages/'; |
|
| 172 | + $lang_dir = dirname(plugin_basename($path)).'/languages/'; |
|
| 173 | 173 | |
| 174 | 174 | // Traditional WordPress plugin locale filter |
| 175 | - $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
| 175 | + $locale = apply_filters('plugin_locale', get_locale(), $this->_text_domain); |
|
| 176 | 176 | |
| 177 | - $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
|
| 177 | + $mofile = sprintf('%1$s-%2$s.mo', $this->_text_domain, $locale); |
|
| 178 | 178 | |
| 179 | 179 | // Setup paths to current locale file |
| 180 | - $mofile_local = $lang_dir . $mofile; |
|
| 181 | - $mofile_global = WP_LANG_DIR . '/' . $this->_text_domain . '/' . $mofile; |
|
| 180 | + $mofile_local = $lang_dir.$mofile; |
|
| 181 | + $mofile_global = WP_LANG_DIR.'/'.$this->_text_domain.'/'.$mofile; |
|
| 182 | 182 | |
| 183 | - if ( file_exists( $mofile_global ) ) { |
|
| 183 | + if (file_exists($mofile_global)) { |
|
| 184 | 184 | // Look in global /wp-content/languages/[plugin-dir]/ folder |
| 185 | - load_textdomain( $this->_text_domain, $mofile_global ); |
|
| 185 | + load_textdomain($this->_text_domain, $mofile_global); |
|
| 186 | 186 | } |
| 187 | - elseif ( file_exists( $mofile_local ) ) { |
|
| 187 | + elseif (file_exists($mofile_local)) { |
|
| 188 | 188 | // Look in local /wp-content/plugins/[plugin-dir]/languages/ folder |
| 189 | - load_textdomain( $this->_text_domain, $mofile_local ); |
|
| 189 | + load_textdomain($this->_text_domain, $mofile_local); |
|
| 190 | 190 | } |
| 191 | 191 | else { |
| 192 | 192 | // Load the default language files |
| 193 | - load_plugin_textdomain( $this->_text_domain, false, $lang_dir ); |
|
| 193 | + load_plugin_textdomain($this->_text_domain, false, $lang_dir); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | protected function get_license() { |
| 204 | 204 | |
| 205 | - if( !class_exists( 'GravityView_Settings' ) ) { |
|
| 205 | + if (!class_exists('GravityView_Settings')) { |
|
| 206 | 206 | return false; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -219,17 +219,17 @@ discard block |
||
| 219 | 219 | public function settings() { |
| 220 | 220 | |
| 221 | 221 | // If doing ajax, get outta here |
| 222 | - if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
| 222 | + if (!is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) { |
|
| 223 | 223 | return; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
| 226 | + if (!class_exists('EDD_SL_Plugin_Updater')) { |
|
| 227 | 227 | |
| 228 | - $file_path = plugin_dir_path( __FILE__ ) . 'lib/EDD_SL_Plugin_Updater.php'; |
|
| 228 | + $file_path = plugin_dir_path(__FILE__).'lib/EDD_SL_Plugin_Updater.php'; |
|
| 229 | 229 | |
| 230 | 230 | // This file may be in the lib/ directory already |
| 231 | - if( ! file_exists( $file_path ) ) { |
|
| 232 | - $file_path = plugin_dir_path( __FILE__ ) . '/EDD_SL_Plugin_Updater.php'; |
|
| 231 | + if (!file_exists($file_path)) { |
|
| 232 | + $file_path = plugin_dir_path(__FILE__).'/EDD_SL_Plugin_Updater.php'; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | include_once $file_path; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $license = $this->get_license(); |
| 239 | 239 | |
| 240 | 240 | // Don't update if invalid license. |
| 241 | - if( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) { return; } |
|
| 241 | + if (false === $license || empty($license['status']) || strtolower($license['status']) !== 'valid') { return; } |
|
| 242 | 242 | |
| 243 | 243 | new EDD_SL_Plugin_Updater( |
| 244 | 244 | $this->_remote_update_url, |
@@ -247,8 +247,8 @@ discard block |
||
| 247 | 247 | 'version' => $this->_version, // current version number |
| 248 | 248 | 'license' => $license['license'], |
| 249 | 249 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
| 250 | - 'item_name' => $this->_title, // name of this plugin |
|
| 251 | - 'author' => strip_tags( $this->_author ) // author of this plugin |
|
| 250 | + 'item_name' => $this->_title, // name of this plugin |
|
| 251 | + 'author' => strip_tags($this->_author) // author of this plugin |
|
| 252 | 252 | ) |
| 253 | 253 | ); |
| 254 | 254 | } |
@@ -260,14 +260,14 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function admin_notice() { |
| 262 | 262 | |
| 263 | - if( empty( self::$admin_notices ) ) { |
|
| 263 | + if (empty(self::$admin_notices)) { |
|
| 264 | 264 | return; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - foreach( self::$admin_notices as $key => $notice ) { |
|
| 267 | + foreach (self::$admin_notices as $key => $notice) { |
|
| 268 | 268 | |
| 269 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
| 270 | - echo wpautop( $notice['message'] ); |
|
| 269 | + echo '<div id="message" class="'.esc_attr($notice['class']).'">'; |
|
| 270 | + echo wpautop($notice['message']); |
|
| 271 | 271 | echo '<div class="clear"></div>'; |
| 272 | 272 | echo '</div>'; |
| 273 | 273 | } |
@@ -280,16 +280,16 @@ discard block |
||
| 280 | 280 | * Add a notice to be displayed in the admin. |
| 281 | 281 | * @param array $notice Array with `class` and `message` keys. The message is not escaped. |
| 282 | 282 | */ |
| 283 | - public static function add_notice( $notice = array() ) { |
|
| 283 | + public static function add_notice($notice = array()) { |
|
| 284 | 284 | |
| 285 | - if( is_array( $notice ) && !isset( $notice['message'] ) ) { |
|
| 286 | - do_action( 'gravityview_log_error', __CLASS__.'[add_notice] Notice not set', $notice ); |
|
| 285 | + if (is_array($notice) && !isset($notice['message'])) { |
|
| 286 | + do_action('gravityview_log_error', __CLASS__.'[add_notice] Notice not set', $notice); |
|
| 287 | 287 | return; |
| 288 | - } else if( is_string( $notice ) ) { |
|
| 289 | - $notice = array( 'message' => $notice ); |
|
| 288 | + } else if (is_string($notice)) { |
|
| 289 | + $notice = array('message' => $notice); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
| 292 | + $notice['class'] = empty($notice['class']) ? 'error' : $notice['class']; |
|
| 293 | 293 | |
| 294 | 294 | self::$admin_notices[] = $notice; |
| 295 | 295 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @param int $post_id Post ID |
| 305 | 305 | * @return void |
| 306 | 306 | */ |
| 307 | - public function save_post( $post_id ) {} |
|
| 307 | + public function save_post($post_id) {} |
|
| 308 | 308 | |
| 309 | 309 | /** |
| 310 | 310 | * Add tooltips for the extension. |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | * @param array $tooltips Existing GV tooltips, with `title` and `value` keys |
| 324 | 324 | * @return array Modified tooltips |
| 325 | 325 | */ |
| 326 | - public function tooltips( $tooltips = array() ) { |
|
| 326 | + public function tooltips($tooltips = array()) { |
|
| 327 | 327 | |
| 328 | 328 | return $tooltips; |
| 329 | 329 | |
@@ -346,17 +346,17 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | $message = ''; |
| 348 | 348 | |
| 349 | - if( !class_exists( 'GravityView_Plugin' ) ) { |
|
| 349 | + if (!class_exists('GravityView_Plugin')) { |
|
| 350 | 350 | |
| 351 | - $message = sprintf( __('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title ); |
|
| 351 | + $message = sprintf(__('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title); |
|
| 352 | 352 | |
| 353 | - } else if( false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version , ">=") ) { |
|
| 353 | + } else if (false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version, ">=")) { |
|
| 354 | 354 | |
| 355 | - $message = sprintf( __('The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_gravityview_version.'</tt>' ); |
|
| 355 | + $message = sprintf(__('The %s Extension requires GravityView Version %s or newer.', 'gravityview'), $this->_title, '<tt>'.$this->_min_gravityview_version.'</tt>'); |
|
| 356 | 356 | |
| 357 | - } else if( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=") ) { |
|
| 357 | + } else if (isset($this->_min_php_version) && false === version_compare(phpversion(), $this->_min_php_version, ">=")) { |
|
| 358 | 358 | |
| 359 | - $message = sprintf( __('The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_php_version.'</tt>' ); |
|
| 359 | + $message = sprintf(__('The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview'), $this->_title, '<tt>'.$this->_min_php_version.'</tt>'); |
|
| 360 | 360 | |
| 361 | 361 | } else { |
| 362 | 362 | |
@@ -364,11 +364,11 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - if ( ! empty( $message ) ) { |
|
| 367 | + if (!empty($message)) { |
|
| 368 | 368 | |
| 369 | - self::add_notice( $message ); |
|
| 369 | + self::add_notice($message); |
|
| 370 | 370 | |
| 371 | - do_action( 'gravityview_log_error', __METHOD__. ' ' . $message ); |
|
| 371 | + do_action('gravityview_log_error', __METHOD__.' '.$message); |
|
| 372 | 372 | |
| 373 | 373 | self::$is_compatible = false; |
| 374 | 374 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
| 52 | - function __construct( $atts = array() ) { |
|
| 52 | + function __construct($atts = array()) { |
|
| 53 | 53 | |
| 54 | 54 | $defaults = array( |
| 55 | 55 | 'width' => $this->width, |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | 'validate_src' => true |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | - $atts = wp_parse_args( $atts, $defaults ); |
|
| 66 | + $atts = wp_parse_args($atts, $defaults); |
|
| 67 | 67 | |
| 68 | - foreach( $atts as $key => $val ) { |
|
| 68 | + foreach ($atts as $key => $val) { |
|
| 69 | 69 | $this->{$key} = $val; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
| 72 | + $this->class = !empty($this->class) ? esc_attr(implode(' ', (array)$this->class)) : $this->class; |
|
| 73 | 73 | |
| 74 | 74 | $this->set_image_size(); |
| 75 | 75 | |
@@ -85,17 +85,17 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function validate_image_src() { |
| 87 | 87 | |
| 88 | - if ( !$this->validate_src ) { return true; } |
|
| 88 | + if (!$this->validate_src) { return true; } |
|
| 89 | 89 | |
| 90 | - $info = pathinfo( $this->src ); |
|
| 90 | + $info = pathinfo($this->src); |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * @filter `gravityview_image_extensions` Extensions that GravityView recognizes as valid images to be shown in an `img` tag |
| 94 | 94 | * @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico']` |
| 95 | 95 | */ |
| 96 | - $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' )); |
|
| 96 | + $image_exts = apply_filters('gravityview_image_extensions', array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico')); |
|
| 97 | 97 | |
| 98 | - return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts); |
|
| 98 | + return isset($info['extension']) && in_array(strtolower($info['extension']), $image_exts); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -103,20 +103,20 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return void |
| 105 | 105 | */ |
| 106 | - public function set_image_size( $string = NULL, $width = NULL, $height = NULL ) { |
|
| 106 | + public function set_image_size($string = NULL, $width = NULL, $height = NULL) { |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | // If there is no width or height passed |
| 110 | - if ( empty( $width ) || empty( $height ) ) { |
|
| 110 | + if (empty($width) || empty($height)) { |
|
| 111 | 111 | |
| 112 | 112 | // And there is no string size passed |
| 113 | 113 | // And we want to get the image size using PHP |
| 114 | - if ( empty( $string ) && !empty( $this->getimagesize ) ) { |
|
| 114 | + if (empty($string) && !empty($this->getimagesize)) { |
|
| 115 | 115 | |
| 116 | - $image_size = getimagesize( $this->src ); |
|
| 116 | + $image_size = getimagesize($this->src); |
|
| 117 | 117 | |
| 118 | - if ( !empty( $image_size ) ) { |
|
| 119 | - list( $width, $height ) = $image_size; |
|
| 118 | + if (!empty($image_size)) { |
|
| 119 | + list($width, $height) = $image_size; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | } |
@@ -127,14 +127,14 @@ discard block |
||
| 127 | 127 | * @filter `gravityview_image_sizes` Modify the image size presets used by GravityView_Image class |
| 128 | 128 | * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels |
| 129 | 129 | */ |
| 130 | - $image_sizes = apply_filters( 'gravityview_image_sizes', array( |
|
| 130 | + $image_sizes = apply_filters('gravityview_image_sizes', array( |
|
| 131 | 131 | 'tiny' => array('width' => 40, 'height' => 30), |
| 132 | 132 | 'small' => array('width' => 100, 'height' => 75), |
| 133 | 133 | 'medium' => array('width' => 250, 'height' => 188), |
| 134 | 134 | 'large' => array('width' => 448, 'height' => 336), |
| 135 | - ) ); |
|
| 135 | + )); |
|
| 136 | 136 | |
| 137 | - switch( $this->size ) { |
|
| 137 | + switch ($this->size) { |
|
| 138 | 138 | case 'tiny': |
| 139 | 139 | extract($image_sizes['tiny']); |
| 140 | 140 | break; |
@@ -153,8 +153,8 @@ discard block |
||
| 153 | 153 | break; |
| 154 | 154 | default: |
| 155 | 155 | // Verify that the passed sizes are integers. |
| 156 | - $width = !empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
| 157 | - $height = !empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
| 156 | + $width = !empty($width) ? intval($width) : intval($this->width); |
|
| 157 | + $height = !empty($height) ? intval($height) : intval($this->height); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | } |
@@ -171,18 +171,18 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function html() { |
| 173 | 173 | |
| 174 | - if ( ! $this->validate_image_src() ) { |
|
| 174 | + if (!$this->validate_image_src()) { |
|
| 175 | 175 | $html = ''; |
| 176 | 176 | } else { |
| 177 | 177 | $atts = ''; |
| 178 | - foreach ( array( 'width', 'height', 'alt', 'title', 'class' ) as $attr ) { |
|
| 178 | + foreach (array('width', 'height', 'alt', 'title', 'class') as $attr) { |
|
| 179 | 179 | |
| 180 | - if ( empty( $this->{$attr} ) ) { continue; } |
|
| 180 | + if (empty($this->{$attr} )) { continue; } |
|
| 181 | 181 | |
| 182 | - $atts .= sprintf( ' %s="%s"', $attr, esc_attr( $this->{$attr} ) ); |
|
| 182 | + $atts .= sprintf(' %s="%s"', $attr, esc_attr($this->{$attr} )); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $html = sprintf( '<img src="%s" %s />', esc_url_raw( $this->src ), $atts ); |
|
| 185 | + $html = sprintf('<img src="%s" %s />', esc_url_raw($this->src), $atts); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -190,6 +190,6 @@ discard block |
||
| 190 | 190 | * @param string $html the generated image html |
| 191 | 191 | * @param GravityView_Image $this The current image object |
| 192 | 192 | */ |
| 193 | - return apply_filters( 'gravityview_image_html', $html, $this ); |
|
| 193 | + return apply_filters('gravityview_image_html', $html, $this); |
|
| 194 | 194 | } |
| 195 | 195 | } |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | function __construct() { |
| 9 | 9 | |
| 10 | - add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 ); |
|
| 10 | + add_action('gravityview_log_error', array($this, 'log_error'), 10, 2); |
|
| 11 | 11 | |
| 12 | - add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
|
| 12 | + add_action('gravityview_log_debug', array($this, 'log_debug'), 10, 2); |
|
| 13 | 13 | |
| 14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
| 15 | - add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
| 15 | + add_filter('gform_logging_supported', array($this, 'enable_gform_logging')); |
|
| 16 | 16 | |
| 17 | 17 | // Load Debug Bar integration |
| 18 | - add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
| 18 | + add_filter('debug_bar_panels', array($this, 'add_debug_bar')); |
|
| 19 | 19 | |
| 20 | 20 | } |
| 21 | 21 | |
@@ -24,14 +24,14 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @see http://wordpress.org/plugins/debug-bar/ |
| 26 | 26 | */ |
| 27 | - public function add_debug_bar( $panels ) { |
|
| 27 | + public function add_debug_bar($panels) { |
|
| 28 | 28 | |
| 29 | - if ( ! class_exists( 'Debug_Bar_Panel' ) ) { |
|
| 29 | + if (!class_exists('Debug_Bar_Panel')) { |
|
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if ( ! class_exists( 'GravityView_Debug_Bar' ) ) { |
|
| 34 | - include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' ); |
|
| 33 | + if (!class_exists('GravityView_Debug_Bar')) { |
|
| 34 | + include_once(GRAVITYVIEW_DIR.'includes/class-debug-bar.php'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $panels[] = new GravityView_Debug_Bar; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * Enables debug with Gravity Forms logging add-on |
| 44 | 44 | * @param array $supported_plugins List of plugins |
| 45 | 45 | */ |
| 46 | - public function enable_gform_logging( $supported_plugins ) { |
|
| 46 | + public function enable_gform_logging($supported_plugins) { |
|
| 47 | 47 | $supported_plugins['gravityview'] = 'GravityView'; |
| 48 | 48 | return $supported_plugins; |
| 49 | 49 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @return string "print_r" or "var_export" |
| 73 | 73 | */ |
| 74 | 74 | static function get_print_function() { |
| 75 | - if( ob_get_level() > 0 ) { |
|
| 75 | + if (ob_get_level() > 0) { |
|
| 76 | 76 | $function = 'var_export'; |
| 77 | 77 | } else { |
| 78 | 78 | $function = 'print_r'; |
@@ -81,43 +81,43 @@ discard block |
||
| 81 | 81 | return $function; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - static function log_debug( $message = '', $data = null ) { |
|
| 84 | + static function log_debug($message = '', $data = null) { |
|
| 85 | 85 | |
| 86 | 86 | $function = self::get_print_function(); |
| 87 | 87 | |
| 88 | 88 | $notice = array( |
| 89 | - 'message' => $function( $message, true ), |
|
| 89 | + 'message' => $function($message, true), |
|
| 90 | 90 | 'data' => $data, |
| 91 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
| 91 | + 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary(null, 3) : '', |
|
| 92 | 92 | ); |
| 93 | 93 | |
| 94 | - if( !in_array( $notice, self::$notices ) ) { |
|
| 94 | + if (!in_array($notice, self::$notices)) { |
|
| 95 | 95 | self::$notices[] = $notice; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if ( class_exists("GFLogging") ) { |
|
| 98 | + if (class_exists("GFLogging")) { |
|
| 99 | 99 | GFLogging::include_logger(); |
| 100 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
| 100 | + GFLogging::log_message('gravityview', $function($message, true).$function($data, true), KLogger::DEBUG); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - static function log_error( $message = '', $data = null ) { |
|
| 104 | + static function log_error($message = '', $data = null) { |
|
| 105 | 105 | |
| 106 | 106 | $function = self::get_print_function(); |
| 107 | 107 | |
| 108 | 108 | $error = array( |
| 109 | 109 | 'message' => $message, |
| 110 | 110 | 'data' => $data, |
| 111 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
| 111 | + 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary(null, 3) : '', |
|
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | - if( !in_array( $error, self::$errors ) ) { |
|
| 114 | + if (!in_array($error, self::$errors)) { |
|
| 115 | 115 | self::$errors[] = $error; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( class_exists("GFLogging") ) { |
|
| 118 | + if (class_exists("GFLogging")) { |
|
| 119 | 119 | GFLogging::include_logger(); |
| 120 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
| 120 | + GFLogging::log_message('gravityview', $function($message, true).$function($data, true), KLogger::ERROR); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |