@@ -65,6 +65,9 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
| 68 | + /** |
|
| 69 | + * @param string $component |
|
| 70 | + */ |
|
| 68 | 71 | private function load_components( $component ) { |
| 69 | 72 | |
| 70 | 73 | $dir = trailingslashit( self::$file ); |
@@ -141,7 +144,7 @@ discard block |
||
| 141 | 144 | * "You can edit this post from the post page" fields, for example. |
| 142 | 145 | * |
| 143 | 146 | * @param $entry array Gravity Forms entry object |
| 144 | - * @param $view_id int GravityView view id |
|
| 147 | + * @param integer $view_id int GravityView view id |
|
| 145 | 148 | * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
| 146 | 149 | * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
| 147 | 150 | * @return string |
@@ -18,80 +18,80 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | class GravityView_Edit_Entry { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 21 | + /** |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | 24 | static $file; |
| 25 | 25 | |
| 26 | 26 | static $instance; |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Component instances. |
|
| 30 | - * @var array |
|
| 31 | - */ |
|
| 32 | - public $instances = array(); |
|
| 28 | + /** |
|
| 29 | + * Component instances. |
|
| 30 | + * @var array |
|
| 31 | + */ |
|
| 32 | + public $instances = array(); |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | function __construct() { |
| 36 | 36 | |
| 37 | - self::$file = plugin_dir_path( __FILE__ ); |
|
| 37 | + self::$file = plugin_dir_path( __FILE__ ); |
|
| 38 | 38 | |
| 39 | - if( is_admin() ) { |
|
| 40 | - $this->load_components( 'admin' ); |
|
| 41 | - } |
|
| 39 | + if( is_admin() ) { |
|
| 40 | + $this->load_components( 'admin' ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - $this->load_components( 'render' ); |
|
| 44 | + $this->load_components( 'render' ); |
|
| 45 | 45 | |
| 46 | - // If GF User Registration Add-on exists |
|
| 47 | - $this->load_components( 'user-registration' ); |
|
| 46 | + // If GF User Registration Add-on exists |
|
| 47 | + $this->load_components( 'user-registration' ); |
|
| 48 | 48 | |
| 49 | - $this->add_hooks(); |
|
| 49 | + $this->add_hooks(); |
|
| 50 | 50 | |
| 51 | 51 | // Process hooks for addons that may or may not be present |
| 52 | 52 | $this->addon_specific_hooks(); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - static function getInstance() { |
|
| 56 | + static function getInstance() { |
|
| 57 | 57 | |
| 58 | - if( empty( self::$instance ) ) { |
|
| 59 | - self::$instance = new GravityView_Edit_Entry; |
|
| 60 | - } |
|
| 58 | + if( empty( self::$instance ) ) { |
|
| 59 | + self::$instance = new GravityView_Edit_Entry; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - return self::$instance; |
|
| 63 | - } |
|
| 62 | + return self::$instance; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | - private function load_components( $component ) { |
|
| 66 | + private function load_components( $component ) { |
|
| 67 | 67 | |
| 68 | - $dir = trailingslashit( self::$file ); |
|
| 68 | + $dir = trailingslashit( self::$file ); |
|
| 69 | 69 | |
| 70 | - $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
| 71 | - $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
| 70 | + $filename = $dir . 'class-edit-entry-' . $component . '.php'; |
|
| 71 | + $classname = 'GravityView_Edit_Entry_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $component ) ) ); |
|
| 72 | 72 | |
| 73 | - // Loads component and pass extension's instance so that component can |
|
| 74 | - // talk each other. |
|
| 75 | - require_once $filename; |
|
| 76 | - $this->instances[ $component ] = new $classname( $this ); |
|
| 77 | - $this->instances[ $component ]->load(); |
|
| 73 | + // Loads component and pass extension's instance so that component can |
|
| 74 | + // talk each other. |
|
| 75 | + require_once $filename; |
|
| 76 | + $this->instances[ $component ] = new $classname( $this ); |
|
| 77 | + $this->instances[ $component ]->load(); |
|
| 78 | 78 | |
| 79 | - } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - private function add_hooks() { |
|
| 81 | + private function add_hooks() { |
|
| 82 | 82 | |
| 83 | - // Add front-end access to Gravity Forms delete file action |
|
| 84 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 83 | + // Add front-end access to Gravity Forms delete file action |
|
| 84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 85 | 85 | |
| 86 | - // Make sure this hook is run for non-admins |
|
| 87 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 86 | + // Make sure this hook is run for non-admins |
|
| 87 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 88 | 88 | |
| 89 | - add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
|
| 89 | + add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
|
| 90 | 90 | |
| 91 | - // add template path to check for field |
|
| 92 | - add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
| 91 | + // add template path to check for field |
|
| 92 | + add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
|
| 93 | 93 | |
| 94 | - } |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Trigger hooks that are normally run in the admin for Addons, but need to be triggered manually because we're not in the admin |
@@ -105,73 +105,73 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Include this extension templates path |
|
| 110 | - * @param array $file_paths List of template paths ordered |
|
| 111 | - */ |
|
| 112 | - public function add_template_path( $file_paths ) { |
|
| 113 | - |
|
| 114 | - // Index 100 is the default GravityView template path. |
|
| 115 | - $file_paths[ 110 ] = self::$file; |
|
| 116 | - |
|
| 117 | - return $file_paths; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * |
|
| 122 | - * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
| 123 | - * |
|
| 124 | - * @param $view_id int GravityView view id |
|
| 125 | - * @param $form_id int Gravity Forms form id |
|
| 126 | - * @param $entry_id int Gravity Forms entry id |
|
| 127 | - * @return string |
|
| 128 | - */ |
|
| 129 | - public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
| 130 | - return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * The edit entry link creates a secure link with a nonce |
|
| 136 | - * |
|
| 137 | - * It also mimics the URL structure Gravity Forms expects to have so that |
|
| 138 | - * it formats the display of the edit form like it does in the backend, like |
|
| 139 | - * "You can edit this post from the post page" fields, for example. |
|
| 140 | - * |
|
| 141 | - * @param $entry array Gravity Forms entry object |
|
| 142 | - * @param $view_id int GravityView view id |
|
| 143 | - * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
| 144 | - * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
| 145 | - * @return string |
|
| 146 | - */ |
|
| 147 | - public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
| 148 | - |
|
| 149 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
| 150 | - |
|
| 151 | - $base = gv_entry_link( $entry, $post_id ); |
|
| 152 | - |
|
| 153 | - $url = add_query_arg( array( |
|
| 154 | - 'edit' => wp_create_nonce( $nonce_key ) |
|
| 155 | - ), $base ); |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * Allow passing params to dynamically populate entry with values |
|
| 159 | - * @since 1.9.2 |
|
| 160 | - */ |
|
| 161 | - if( !empty( $field_values ) ) { |
|
| 162 | - |
|
| 163 | - if( is_array( $field_values ) ) { |
|
| 164 | - // If already an array, no parse_str() needed |
|
| 165 | - $params = $field_values; |
|
| 166 | - } else { |
|
| 167 | - parse_str( $field_values, $params ); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - $url = add_query_arg( $params, $url ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - return $url; |
|
| 174 | - } |
|
| 108 | + /** |
|
| 109 | + * Include this extension templates path |
|
| 110 | + * @param array $file_paths List of template paths ordered |
|
| 111 | + */ |
|
| 112 | + public function add_template_path( $file_paths ) { |
|
| 113 | + |
|
| 114 | + // Index 100 is the default GravityView template path. |
|
| 115 | + $file_paths[ 110 ] = self::$file; |
|
| 116 | + |
|
| 117 | + return $file_paths; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * |
|
| 122 | + * Return a well formatted nonce key according to GravityView Edit Entry protocol |
|
| 123 | + * |
|
| 124 | + * @param $view_id int GravityView view id |
|
| 125 | + * @param $form_id int Gravity Forms form id |
|
| 126 | + * @param $entry_id int Gravity Forms entry id |
|
| 127 | + * @return string |
|
| 128 | + */ |
|
| 129 | + public static function get_nonce_key( $view_id, $form_id, $entry_id ) { |
|
| 130 | + return sprintf( 'edit_%d_%d_%d', $view_id, $form_id, $entry_id ); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * The edit entry link creates a secure link with a nonce |
|
| 136 | + * |
|
| 137 | + * It also mimics the URL structure Gravity Forms expects to have so that |
|
| 138 | + * it formats the display of the edit form like it does in the backend, like |
|
| 139 | + * "You can edit this post from the post page" fields, for example. |
|
| 140 | + * |
|
| 141 | + * @param $entry array Gravity Forms entry object |
|
| 142 | + * @param $view_id int GravityView view id |
|
| 143 | + * @param $post_id int GravityView Post ID where View may be embedded {@since 1.9.2} |
|
| 144 | + * @param string|array $field_values Parameters to pass in to the Edit Entry form to prefill data. Uses the same format as Gravity Forms "Allow field to be populated dynamically" {@since 1.9.2} {@see https://www.gravityhelp.com/documentation/article/allow-field-to-be-populated-dynamically/ } |
|
| 145 | + * @return string |
|
| 146 | + */ |
|
| 147 | + public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
|
| 148 | + |
|
| 149 | + $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
| 150 | + |
|
| 151 | + $base = gv_entry_link( $entry, $post_id ); |
|
| 152 | + |
|
| 153 | + $url = add_query_arg( array( |
|
| 154 | + 'edit' => wp_create_nonce( $nonce_key ) |
|
| 155 | + ), $base ); |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * Allow passing params to dynamically populate entry with values |
|
| 159 | + * @since 1.9.2 |
|
| 160 | + */ |
|
| 161 | + if( !empty( $field_values ) ) { |
|
| 162 | + |
|
| 163 | + if( is_array( $field_values ) ) { |
|
| 164 | + // If already an array, no parse_str() needed |
|
| 165 | + $params = $field_values; |
|
| 166 | + } else { |
|
| 167 | + parse_str( $field_values, $params ); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + $url = add_query_arg( $params, $url ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + return $url; |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | 177 | * Edit mode doesn't allow certain field types. |
@@ -225,81 +225,81 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
| 228 | - /** |
|
| 229 | - * checks if user has permissions to edit a specific entry |
|
| 230 | - * |
|
| 231 | - * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
| 232 | - * |
|
| 233 | - * @param array $entry Gravity Forms entry array |
|
| 234 | - * @param int $view_id ID of the view you want to check visibility against {@since 1.9.2} |
|
| 235 | - * @return bool |
|
| 236 | - */ |
|
| 237 | - public static function check_user_cap_edit_entry( $entry, $view_id = 0 ) { |
|
| 228 | + /** |
|
| 229 | + * checks if user has permissions to edit a specific entry |
|
| 230 | + * |
|
| 231 | + * Needs to be used combined with GravityView_Edit_Entry::user_can_edit_entry for maximum security!! |
|
| 232 | + * |
|
| 233 | + * @param array $entry Gravity Forms entry array |
|
| 234 | + * @param int $view_id ID of the view you want to check visibility against {@since 1.9.2} |
|
| 235 | + * @return bool |
|
| 236 | + */ |
|
| 237 | + public static function check_user_cap_edit_entry( $entry, $view_id = 0 ) { |
|
| 238 | 238 | |
| 239 | - // No permission by default |
|
| 240 | - $user_can_edit = false; |
|
| 239 | + // No permission by default |
|
| 240 | + $user_can_edit = false; |
|
| 241 | 241 | |
| 242 | - // If they can edit any entries (as defined in Gravity Forms) |
|
| 243 | - // Or if they can edit other people's entries |
|
| 244 | - // Then we're good. |
|
| 245 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 242 | + // If they can edit any entries (as defined in Gravity Forms) |
|
| 243 | + // Or if they can edit other people's entries |
|
| 244 | + // Then we're good. |
|
| 245 | + if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 246 | 246 | |
| 247 | - do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
| 247 | + do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
| 248 | 248 | |
| 249 | - $user_can_edit = true; |
|
| 249 | + $user_can_edit = true; |
|
| 250 | 250 | |
| 251 | - } else if( !isset( $entry['created_by'] ) ) { |
|
| 251 | + } else if( !isset( $entry['created_by'] ) ) { |
|
| 252 | 252 | |
| 253 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
| 253 | + do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
| 254 | 254 | |
| 255 | - $user_can_edit = false; |
|
| 255 | + $user_can_edit = false; |
|
| 256 | 256 | |
| 257 | - } else { |
|
| 257 | + } else { |
|
| 258 | 258 | |
| 259 | - // get user_edit setting |
|
| 260 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 261 | - // if View ID not specified or is the current view |
|
| 262 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
| 263 | - } else { |
|
| 264 | - // in case is specified and not the current view |
|
| 265 | - $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
|
| 266 | - } |
|
| 259 | + // get user_edit setting |
|
| 260 | + if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 261 | + // if View ID not specified or is the current view |
|
| 262 | + $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
| 263 | + } else { |
|
| 264 | + // in case is specified and not the current view |
|
| 265 | + $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - $current_user = wp_get_current_user(); |
|
| 268 | + $current_user = wp_get_current_user(); |
|
| 269 | 269 | |
| 270 | - // User edit is disabled |
|
| 271 | - if( empty( $user_edit ) ) { |
|
| 270 | + // User edit is disabled |
|
| 271 | + if( empty( $user_edit ) ) { |
|
| 272 | 272 | |
| 273 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
| 273 | + do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
| 274 | 274 | |
| 275 | - $user_can_edit = false; |
|
| 276 | - } |
|
| 275 | + $user_can_edit = false; |
|
| 276 | + } |
|
| 277 | 277 | |
| 278 | - // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
| 279 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 278 | + // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
|
| 279 | + else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 280 | 280 | |
| 281 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 281 | + do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 282 | 282 | |
| 283 | - $user_can_edit = true; |
|
| 283 | + $user_can_edit = true; |
|
| 284 | 284 | |
| 285 | - } else if( ! is_user_logged_in() ) { |
|
| 285 | + } else if( ! is_user_logged_in() ) { |
|
| 286 | 286 | |
| 287 | - do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
|
| 288 | - } |
|
| 287 | + do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - } |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
| 294 | - * @since 1.15 Added `$entry` and `$view_id` parameters |
|
| 295 | - * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
| 296 | - * @param[in] array $entry Gravity Forms entry array {@since 1.15} |
|
| 297 | - * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
| 298 | - */ |
|
| 299 | - $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
| 292 | + /** |
|
| 293 | + * @filter `gravityview/edit_entry/user_can_edit_entry` Modify whether user can edit an entry. |
|
| 294 | + * @since 1.15 Added `$entry` and `$view_id` parameters |
|
| 295 | + * @param[in,out] boolean $user_can_edit Can the current user edit the current entry? (Default: false) |
|
| 296 | + * @param[in] array $entry Gravity Forms entry array {@since 1.15} |
|
| 297 | + * @param[in] int $view_id ID of the view you want to check visibility against {@since 1.15} |
|
| 298 | + */ |
|
| 299 | + $user_can_edit = apply_filters( 'gravityview/edit_entry/user_can_edit_entry', $user_can_edit, $entry, $view_id ); |
|
| 300 | 300 | |
| 301 | - return (bool)$user_can_edit; |
|
| 302 | - } |
|
| 301 | + return (bool)$user_can_edit; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | 304 | |
| 305 | 305 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | self::$file = plugin_dir_path( __FILE__ ); |
| 38 | 38 | |
| 39 | - if( is_admin() ) { |
|
| 39 | + if ( is_admin() ) { |
|
| 40 | 40 | $this->load_components( 'admin' ); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | static function getInstance() { |
| 57 | 57 | |
| 58 | - if( empty( self::$instance ) ) { |
|
| 58 | + if ( empty( self::$instance ) ) { |
|
| 59 | 59 | self::$instance = new GravityView_Edit_Entry; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | private function add_hooks() { |
| 82 | 82 | |
| 83 | 83 | // Add front-end access to Gravity Forms delete file action |
| 84 | - add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
| 85 | 85 | |
| 86 | 86 | // Make sure this hook is run for non-admins |
| 87 | - add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file') ); |
|
| 87 | + add_action( 'wp_ajax_rg_delete_file', array( 'GFForms', 'delete_file' ) ); |
|
| 88 | 88 | |
| 89 | 89 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 ); |
| 90 | 90 | |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function addon_specific_hooks() { |
| 101 | 101 | |
| 102 | - if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
| 103 | - add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script')); |
|
| 102 | + if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) { |
|
| 103 | + add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) { |
| 148 | 148 | |
| 149 | - $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id'] ); |
|
| 149 | + $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] ); |
|
| 150 | 150 | |
| 151 | 151 | $base = gv_entry_link( $entry, $post_id ); |
| 152 | 152 | |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | * Allow passing params to dynamically populate entry with values |
| 159 | 159 | * @since 1.9.2 |
| 160 | 160 | */ |
| 161 | - if( !empty( $field_values ) ) { |
|
| 161 | + if ( ! empty( $field_values ) ) { |
|
| 162 | 162 | |
| 163 | - if( is_array( $field_values ) ) { |
|
| 163 | + if ( is_array( $field_values ) ) { |
|
| 164 | 164 | // If already an array, no parse_str() needed |
| 165 | 165 | $params = $field_values; |
| 166 | 166 | } else { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | */ |
| 182 | 182 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
| 183 | 183 | |
| 184 | - if( empty( $context ) || $context !== 'edit' ) { |
|
| 184 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
| 185 | 185 | return $fields; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -242,24 +242,24 @@ discard block |
||
| 242 | 242 | // If they can edit any entries (as defined in Gravity Forms) |
| 243 | 243 | // Or if they can edit other people's entries |
| 244 | 244 | // Then we're good. |
| 245 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 245 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
| 246 | 246 | |
| 247 | - do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
| 247 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.' ); |
|
| 248 | 248 | |
| 249 | 249 | $user_can_edit = true; |
| 250 | 250 | |
| 251 | - } else if( !isset( $entry['created_by'] ) ) { |
|
| 251 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 252 | 252 | |
| 253 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
| 253 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.' ); |
|
| 254 | 254 | |
| 255 | 255 | $user_can_edit = false; |
| 256 | 256 | |
| 257 | 257 | } else { |
| 258 | 258 | |
| 259 | 259 | // get user_edit setting |
| 260 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 260 | + if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 261 | 261 | // if View ID not specified or is the current view |
| 262 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
| 262 | + $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' ); |
|
| 263 | 263 | } else { |
| 264 | 264 | // in case is specified and not the current view |
| 265 | 265 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
@@ -268,21 +268,21 @@ discard block |
||
| 268 | 268 | $current_user = wp_get_current_user(); |
| 269 | 269 | |
| 270 | 270 | // User edit is disabled |
| 271 | - if( empty( $user_edit ) ) { |
|
| 271 | + if ( empty( $user_edit ) ) { |
|
| 272 | 272 | |
| 273 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
| 273 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
| 274 | 274 | |
| 275 | 275 | $user_can_edit = false; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
| 279 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 279 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 280 | 280 | |
| 281 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 281 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 282 | 282 | |
| 283 | 283 | $user_can_edit = true; |
| 284 | 284 | |
| 285 | - } else if( ! is_user_logged_in() ) { |
|
| 285 | + } else if ( ! is_user_logged_in() ) { |
|
| 286 | 286 | |
| 287 | 287 | do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
| 288 | 288 | } |
@@ -169,7 +169,6 @@ |
||
| 169 | 169 | * |
| 170 | 170 | * @since 1.15.2 |
| 171 | 171 | * |
| 172 | - * @param array $handles Array of meta keys to check for existence of shortcodes |
|
| 173 | 172 | * @param int $post_id The ID being checked by GravityView |
| 174 | 173 | * |
| 175 | 174 | * @return array Meta key array, merged with existing meta keys |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | private function maybe_add_hooks() { |
| 92 | 92 | $class_exists = $this->class_name && class_exists( $this->class_name ); |
| 93 | 93 | $function_exists = $this->function_name && function_exists( $this->function_name ); |
| 94 | - $constant_defined = $this->constant_name && defined("{$this->constant_name}"); |
|
| 94 | + $constant_defined = $this->constant_name && defined( "{$this->constant_name}" ); |
|
| 95 | 95 | |
| 96 | - if( $class_exists || $function_exists || $constant_defined ) { |
|
| 96 | + if ( $class_exists || $function_exists || $constant_defined ) { |
|
| 97 | 97 | $this->add_hooks(); |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -104,19 +104,19 @@ discard block |
||
| 104 | 104 | * @return void |
| 105 | 105 | */ |
| 106 | 106 | protected function add_hooks() { |
| 107 | - if( $this->content_meta_keys ) { |
|
| 107 | + if ( $this->content_meta_keys ) { |
|
| 108 | 108 | add_filter( 'gravityview/data/parse/meta_keys', array( $this, 'merge_content_meta_keys' ), 10, 2 ); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if( $this->script_handles ) { |
|
| 111 | + if ( $this->script_handles ) { |
|
| 112 | 112 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'merge_noconflict_scripts' ) ); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if( $this->style_handles ) { |
|
| 115 | + if ( $this->style_handles ) { |
|
| 116 | 116 | add_filter( 'gravityview_noconflict_styles', array( $this, 'merge_noconflict_styles' ) ); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if( $this->post_type_support ) { |
|
| 119 | + if ( $this->post_type_support ) { |
|
| 120 | 120 | add_filter( 'gravityview_post_type_support', array( $this, 'merge_post_type_support' ), 10, 2 ); |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -51,6 +51,9 @@ |
||
| 51 | 51 | // hold widget View options |
| 52 | 52 | private $widget_options; |
| 53 | 53 | |
| 54 | + /** |
|
| 55 | + * @param string $widget_id |
|
| 56 | + */ |
|
| 54 | 57 | function __construct( $widget_label , $widget_id , $defaults = array(), $settings = array() ) { |
| 55 | 58 | |
| 56 | 59 | |
@@ -116,12 +116,12 @@ |
||
| 116 | 116 | return $settings; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * @return string |
|
| 121 | - */ |
|
| 122 | - public function get_widget_id() { |
|
| 123 | - return $this->widget_id; |
|
| 124 | - } |
|
| 119 | + /** |
|
| 120 | + * @return string |
|
| 121 | + */ |
|
| 122 | + public function get_widget_id() { |
|
| 123 | + return $this->widget_id; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * Get the widget settings |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | // hold widget View options |
| 52 | 52 | private $widget_options; |
| 53 | 53 | |
| 54 | - function __construct( $widget_label , $widget_id , $defaults = array(), $settings = array() ) { |
|
| 54 | + function __construct( $widget_label, $widget_id, $defaults = array(), $settings = array() ) { |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * The shortcode name is set to the lowercase name of the widget class, unless overridden by the class specifying a different value for $shortcode_name |
| 59 | 59 | * @var string |
| 60 | 60 | */ |
| 61 | - $this->shortcode_name = !isset( $this->shortcode_name ) ? strtolower( get_class($this) ) : $this->shortcode_name; |
|
| 61 | + $this->shortcode_name = ! isset( $this->shortcode_name ) ? strtolower( get_class( $this ) ) : $this->shortcode_name; |
|
| 62 | 62 | |
| 63 | 63 | $this->widget_label = $widget_label; |
| 64 | 64 | $this->widget_id = $widget_id; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $this->settings = wp_parse_args( $settings, $this->settings ); |
| 70 | 70 | |
| 71 | 71 | // register widgets to be listed in the View Configuration |
| 72 | - add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget') ); |
|
| 72 | + add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget' ) ); |
|
| 73 | 73 | |
| 74 | 74 | // widget options |
| 75 | 75 | add_filter( 'gravityview_template_widget_options', array( $this, 'assign_widget_options' ), 10, 3 ); |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | add_action( "gravityview_render_widget_{$widget_id}", array( $this, 'render_frontend' ), 10, 1 ); |
| 79 | 79 | |
| 80 | 80 | // register shortcodes |
| 81 | - add_action( 'wp', array( $this, 'add_shortcode') ); |
|
| 81 | + add_action( 'wp', array( $this, 'add_shortcode' ) ); |
|
| 82 | 82 | |
| 83 | 83 | // Use shortcodes in text widgets. |
| 84 | - add_filter('widget_text', array( $this, 'maybe_do_shortcode' ) ); |
|
| 84 | + add_filter( 'widget_text', array( $this, 'maybe_do_shortcode' ) ); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | * @param boolean $enable_custom_class False by default. Return true if you want to enable. |
| 100 | 100 | * @param GravityView_Widget $this Current instance of GravityView_Widget |
| 101 | 101 | */ |
| 102 | - $enable_custom_class = apply_filters('gravityview/widget/enable_custom_class', false, $this ); |
|
| 102 | + $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
|
| 103 | 103 | |
| 104 | - if( $enable_custom_class ) { |
|
| 104 | + if ( $enable_custom_class ) { |
|
| 105 | 105 | |
| 106 | - $settings['custom_class'] = array( |
|
| 106 | + $settings[ 'custom_class' ] = array( |
|
| 107 | 107 | 'type' => 'text', |
| 108 | 108 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
| 109 | - 'desc' => __( 'This class will be added to the widget container', 'gravityview'), |
|
| 109 | + 'desc' => __( 'This class will be added to the widget container', 'gravityview' ), |
|
| 110 | 110 | 'value' => '', |
| 111 | 111 | 'merge_tags' => true, |
| 112 | 112 | ); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @return array|null Settings array; NULL if not set |
| 129 | 129 | */ |
| 130 | 130 | public function get_settings() { |
| 131 | - return !empty( $this->settings ) ? $this->settings : NULL; |
|
| 131 | + return ! empty( $this->settings ) ? $this->settings : NULL; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | public function get_setting( $key ) { |
| 140 | 140 | $setting = NULL; |
| 141 | 141 | |
| 142 | - if( isset( $this->settings ) && is_array( $this->settings ) ) { |
|
| 142 | + if ( isset( $this->settings ) && is_array( $this->settings ) ) { |
|
| 143 | 143 | $setting = isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : NULL; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | function maybe_do_shortcode( $text, $widget = NULL ) { |
| 156 | 156 | |
| 157 | - if( !empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) { |
|
| 157 | + if ( ! empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) { |
|
| 158 | 158 | return do_shortcode( $text ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -183,26 +183,26 @@ discard block |
||
| 183 | 183 | return; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if( empty( $this->shortcode_name ) ) { return; } |
|
| 186 | + if ( empty( $this->shortcode_name ) ) { return; } |
|
| 187 | 187 | |
| 188 | 188 | // If the widget shouldn't output on single entries, don't show it |
| 189 | - if( empty( $this->show_on_single ) && class_exists('GravityView_frontend') && GravityView_frontend::is_single_entry() ) { |
|
| 190 | - do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class($this)) ); |
|
| 189 | + if ( empty( $this->show_on_single ) && class_exists( 'GravityView_frontend' ) && GravityView_frontend::is_single_entry() ) { |
|
| 190 | + do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class( $this ) ) ); |
|
| 191 | 191 | |
| 192 | 192 | add_shortcode( $this->shortcode_name, '__return_null' ); |
| 193 | 193 | return; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
| 197 | - if( !has_gravityview_shortcode( $post ) ) { |
|
| 197 | + if ( ! has_gravityview_shortcode( $post ) ) { |
|
| 198 | 198 | |
| 199 | - do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class($this)) ); |
|
| 199 | + do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class( $this ) ) ); |
|
| 200 | 200 | |
| 201 | 201 | add_shortcode( $this->shortcode_name, '__return_null' ); |
| 202 | 202 | return; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
| 205 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | function register_widget( $widgets ) { |
| 214 | 214 | $widgets[ $this->widget_id ] = array( |
| 215 | - 'label' => $this->widget_label , |
|
| 215 | + 'label' => $this->widget_label, |
|
| 216 | 216 | 'description' => $this->widget_description, |
| 217 | 217 | 'subtitle' => $this->widget_subtitle, |
| 218 | 218 | ); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
| 231 | 231 | |
| 232 | - if( $this->widget_id === $widget ) { |
|
| 232 | + if ( $this->widget_id === $widget ) { |
|
| 233 | 233 | $options = array_merge( $options, $this->settings ); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | * |
| 243 | 243 | * @return void |
| 244 | 244 | */ |
| 245 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 245 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 246 | 246 | // to be defined by child class |
| 247 | - if( !$this->pre_render_frontend() ) { |
|
| 247 | + if ( ! $this->pre_render_frontend() ) { |
|
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | public function pre_render_frontend() { |
| 257 | 257 | $gravityview_view = GravityView_View::getInstance(); |
| 258 | 258 | |
| 259 | - if( empty( $gravityview_view ) ) { |
|
| 260 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class($this)) ); |
|
| 259 | + if ( empty( $gravityview_view ) ) { |
|
| 260 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class( $this ) ) ); |
|
| 261 | 261 | return false; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -268,8 +268,8 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | $hide_until_search = apply_filters( 'gravityview/widget/hide_until_searched', $gravityview_view->hide_until_searched, $this ); |
| 270 | 270 | |
| 271 | - if( $hide_until_search ) { |
|
| 272 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class($this)) ); |
|
| 271 | + if ( $hide_until_search ) { |
|
| 272 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class( $this ) ) ); |
|
| 273 | 273 | return false; |
| 274 | 274 | } |
| 275 | 275 | |
@@ -312,11 +312,11 @@ discard block |
||
| 312 | 312 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 313 | 313 | |
| 314 | 314 | |
| 315 | - /** |
|
| 316 | - * When an entry is created, check if we need to update the custom slug meta |
|
| 317 | - * todo: move this to its own class.. |
|
| 318 | - */ |
|
| 319 | - add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 315 | + /** |
|
| 316 | + * When an entry is created, check if we need to update the custom slug meta |
|
| 317 | + * todo: move this to its own class.. |
|
| 318 | + */ |
|
| 319 | + add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 320 | 320 | |
| 321 | 321 | /** |
| 322 | 322 | * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded |
@@ -347,34 +347,34 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | /** DEBUG */ |
| 349 | 349 | |
| 350 | - /** |
|
| 351 | - * Logs messages using Gravity Forms logging add-on |
|
| 352 | - * @param string $message log message |
|
| 353 | - * @param mixed $data Additional data to display |
|
| 354 | - * @return void |
|
| 355 | - */ |
|
| 356 | - public static function log_debug( $message, $data = null ){ |
|
| 357 | - /** |
|
| 358 | - * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 359 | - * @param string $message Message to display |
|
| 360 | - * @param mixed $data Supporting data to print alongside it |
|
| 361 | - */ |
|
| 362 | - do_action( 'gravityview_log_debug', $message, $data ); |
|
| 363 | - } |
|
| 364 | - |
|
| 365 | - /** |
|
| 366 | - * Logs messages using Gravity Forms logging add-on |
|
| 367 | - * @param string $message log message |
|
| 368 | - * @return void |
|
| 369 | - */ |
|
| 370 | - public static function log_error( $message, $data = null ){ |
|
| 371 | - /** |
|
| 372 | - * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 373 | - * @param string $message Error message to display |
|
| 374 | - * @param mixed $data Supporting data to print alongside it |
|
| 375 | - */ |
|
| 376 | - do_action( 'gravityview_log_error', $message, $data ); |
|
| 377 | - } |
|
| 350 | + /** |
|
| 351 | + * Logs messages using Gravity Forms logging add-on |
|
| 352 | + * @param string $message log message |
|
| 353 | + * @param mixed $data Additional data to display |
|
| 354 | + * @return void |
|
| 355 | + */ |
|
| 356 | + public static function log_debug( $message, $data = null ){ |
|
| 357 | + /** |
|
| 358 | + * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 359 | + * @param string $message Message to display |
|
| 360 | + * @param mixed $data Supporting data to print alongside it |
|
| 361 | + */ |
|
| 362 | + do_action( 'gravityview_log_debug', $message, $data ); |
|
| 363 | + } |
|
| 364 | + |
|
| 365 | + /** |
|
| 366 | + * Logs messages using Gravity Forms logging add-on |
|
| 367 | + * @param string $message log message |
|
| 368 | + * @return void |
|
| 369 | + */ |
|
| 370 | + public static function log_error( $message, $data = null ){ |
|
| 371 | + /** |
|
| 372 | + * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 373 | + * @param string $message Error message to display |
|
| 374 | + * @param mixed $data Supporting data to print alongside it |
|
| 375 | + */ |
|
| 376 | + do_action( 'gravityview_log_error', $message, $data ); |
|
| 377 | + } |
|
| 378 | 378 | |
| 379 | 379 | } // end class GravityView_Plugin |
| 380 | 380 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * @param mixed $data Additional data to display |
| 352 | 352 | * @return void |
| 353 | 353 | */ |
| 354 | - public static function log_debug( $message, $data = null ){ |
|
| 354 | + public static function log_debug( $message, $data = null ) { |
|
| 355 | 355 | /** |
| 356 | 356 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 357 | 357 | * @param string $message Message to display |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | * @param string $message log message |
| 366 | 366 | * @return void |
| 367 | 367 | */ |
| 368 | - public static function log_error( $message, $data = null ){ |
|
| 368 | + public static function log_error( $message, $data = null ) { |
|
| 369 | 369 | /** |
| 370 | 370 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 371 | 371 | * @param string $message Error message to display |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public static function getInstance() { |
| 92 | 92 | |
| 93 | - if( empty( self::$instance ) ) { |
|
| 93 | + if ( empty( self::$instance ) ) { |
|
| 94 | 94 | self::$instance = new self; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | self::require_files(); |
| 103 | 103 | |
| 104 | - if( ! GravityView_Compatibility::is_valid() ) { |
|
| 104 | + if ( ! GravityView_Compatibility::is_valid() ) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -116,14 +116,14 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | private static function require_files() { |
| 118 | 118 | require_once( GRAVITYVIEW_DIR . 'includes/helper-functions.php' ); |
| 119 | - require_once( GRAVITYVIEW_DIR . 'includes/class-common.php'); |
|
| 120 | - require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php'); |
|
| 119 | + require_once( GRAVITYVIEW_DIR . 'includes/class-common.php' ); |
|
| 120 | + require_once( GRAVITYVIEW_DIR . 'includes/connector-functions.php' ); |
|
| 121 | 121 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-compatibility.php' ); |
| 122 | 122 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-roles-capabilities.php' ); |
| 123 | 123 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-notices.php' ); |
| 124 | 124 | require_once( GRAVITYVIEW_DIR . 'includes/class-admin.php' ); |
| 125 | - require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php'); |
|
| 126 | - require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php'); |
|
| 125 | + require_once( GRAVITYVIEW_DIR . 'includes/class-post-types.php' ); |
|
| 126 | + require_once( GRAVITYVIEW_DIR . 'includes/class-cache.php' ); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -156,22 +156,22 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval-status.php' ); |
| 159 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-approval.php' ); |
|
| 159 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-approval.php' ); |
|
| 160 | 160 | |
| 161 | - include_once( GRAVITYVIEW_DIR .'includes/class-gravityview-entry-notes.php' ); |
|
| 162 | - include_once( GRAVITYVIEW_DIR .'includes/load-plugin-and-theme-hooks.php' ); |
|
| 161 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-notes.php' ); |
|
| 162 | + include_once( GRAVITYVIEW_DIR . 'includes/load-plugin-and-theme-hooks.php' ); |
|
| 163 | 163 | |
| 164 | 164 | // Load Extensions |
| 165 | 165 | // @todo: Convert to a scan of the directory or a method where this all lives |
| 166 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
| 167 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
| 168 | - include_once( GRAVITYVIEW_DIR .'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
| 166 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/edit-entry/class-edit-entry.php' ); |
|
| 167 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/delete-entry/class-delete-entry.php' ); |
|
| 168 | + include_once( GRAVITYVIEW_DIR . 'includes/extensions/entry-notes/class-gravityview-field-notes.php' ); |
|
| 169 | 169 | |
| 170 | 170 | // Load WordPress Widgets |
| 171 | - include_once( GRAVITYVIEW_DIR .'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 171 | + include_once( GRAVITYVIEW_DIR . 'includes/wordpress-widgets/register-wordpress-widgets.php' ); |
|
| 172 | 172 | |
| 173 | 173 | // Load GravityView Widgets |
| 174 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/register-gravityview-widgets.php' ); |
|
| 174 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/register-gravityview-widgets.php' ); |
|
| 175 | 175 | |
| 176 | 176 | // Add oEmbed |
| 177 | 177 | include_once( GRAVITYVIEW_DIR . 'includes/class-oembed.php' ); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
| 185 | 185 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-admin-bar.php' ); |
| 186 | 186 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-list.php' ); |
| 187 | - include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 187 | + include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 188 | 188 | include_once( GRAVITYVIEW_DIR . 'includes/class-data.php' ); |
| 189 | 189 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-shortcode.php' ); |
| 190 | 190 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | * @return bool |
| 200 | 200 | */ |
| 201 | 201 | public static function is_network_activated() { |
| 202 | - return is_multisite() && ( function_exists('is_plugin_active_for_network') && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 202 | + return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( 'gravityview/gravityview.php' ) ); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | |
@@ -220,12 +220,12 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | if ( php_sapi_name() == 'cli' ) { |
| 222 | 222 | printf( __( "GravityView requires PHP Version %s or newer. You're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), |
| 223 | - GV_FUTURE_MIN_PHP_VERSION , phpversion() ); |
|
| 223 | + GV_FUTURE_MIN_PHP_VERSION, phpversion() ); |
|
| 224 | 224 | } else { |
| 225 | 225 | printf( '<body style="padding: 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">' ); |
| 226 | 226 | printf( '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" alt="The GravityView Astronaut Says:" style="float: left; height: 60px; margin-right : 10px;" />' ); |
| 227 | 227 | printf( __( "%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' ), |
| 228 | - '<h3 style="font-size:16px; margin: 0 0 8px 0;">', GV_FUTURE_MIN_PHP_VERSION , "</h3>\n\n", $version ); |
|
| 228 | + '<h3 style="font-size:16px; margin: 0 0 8px 0;">', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", $version ); |
|
| 229 | 229 | printf( '</body>' ); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @since 1.7.5.1 |
| 296 | 296 | */ |
| 297 | 297 | public static function include_widget_class() { |
| 298 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 298 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | if ( ! $loaded ) { |
| 319 | 319 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
| 320 | - $mofile = dirname( __FILE__ ) . '/languages/gravityview-'. $locale .'.mo'; |
|
| 320 | + $mofile = dirname( __FILE__ ) . '/languages/gravityview-' . $locale . '.mo'; |
|
| 321 | 321 | load_textdomain( 'gravityview', $mofile ); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -354,12 +354,12 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | public function frontend_actions( $force = false ) { |
| 356 | 356 | |
| 357 | - if( self::is_admin() && ! $force ) { return; } |
|
| 357 | + if ( self::is_admin() && ! $force ) { return; } |
|
| 358 | 358 | |
| 359 | 359 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-image.php' ); |
| 360 | - include_once( GRAVITYVIEW_DIR .'includes/class-template.php' ); |
|
| 361 | - include_once( GRAVITYVIEW_DIR .'includes/class-api.php' ); |
|
| 362 | - include_once( GRAVITYVIEW_DIR .'includes/class-frontend-views.php' ); |
|
| 360 | + include_once( GRAVITYVIEW_DIR . 'includes/class-template.php' ); |
|
| 361 | + include_once( GRAVITYVIEW_DIR . 'includes/class-api.php' ); |
|
| 362 | + include_once( GRAVITYVIEW_DIR . 'includes/class-frontend-views.php' ); |
|
| 363 | 363 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 364 | 364 | |
| 365 | 365 | |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | public static function get_default_widget_areas() { |
| 386 | 386 | $default_areas = array( |
| 387 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __('Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
| 388 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __('Left', 'gravityview') , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __('Right', 'gravityview') , 'subtitle' => '' ) ) ), |
|
| 387 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 388 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
| 389 | 389 | ); |
| 390 | 390 | |
| 391 | 391 | /** |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | * @param mixed $data Additional data to display |
| 404 | 404 | * @return void |
| 405 | 405 | */ |
| 406 | - public static function log_debug( $message, $data = null ){ |
|
| 406 | + public static function log_debug( $message, $data = null ) { |
|
| 407 | 407 | /** |
| 408 | 408 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 409 | 409 | * @param string $message Message to display |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | * @param string $message log message |
| 418 | 418 | * @return void |
| 419 | 419 | */ |
| 420 | - public static function log_error( $message, $data = null ){ |
|
| 420 | + public static function log_error( $message, $data = null ) { |
|
| 421 | 421 | /** |
| 422 | 422 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
| 423 | 423 | * @param string $message Error message to display |
@@ -428,4 +428,4 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | } // end class GravityView_Plugin |
| 430 | 430 | |
| 431 | -add_action('plugins_loaded', array('GravityView_Plugin', 'getInstance'), 1); |
|
| 431 | +add_action( 'plugins_loaded', array( 'GravityView_Plugin', 'getInstance' ), 1 ); |
|
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 18 | + $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 19 | 19 | |
| 20 | 20 | ?> |
| 21 | 21 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
@@ -10,12 +10,12 @@ |
||
| 10 | 10 | |
| 11 | 11 | function render_input( $override_input = null ) { |
| 12 | 12 | |
| 13 | - if( isset( $override_input ) ) { |
|
| 13 | + if ( isset( $override_input ) ) { |
|
| 14 | 14 | echo $override_input; |
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 18 | + $class = ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat'; |
|
| 19 | 19 | |
| 20 | 20 | ?> |
| 21 | 21 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | |
| 19 | 19 | $show_mt = $this->show_merge_tags(); |
| 20 | 20 | |
| 21 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 22 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
| 23 | - } |
|
| 24 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 21 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 22 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
| 23 | + } |
|
| 24 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 25 | 25 | |
| 26 | 26 | ?> |
| 27 | 27 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -3,13 +3,13 @@ discard block |
||
| 3 | 3 | * number input type |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if( !class_exists('GravityView_FieldType_text') ) { |
|
| 6 | +if ( ! class_exists( 'GravityView_FieldType_text' ) ) { |
|
| 7 | 7 | include_once( GRAVITYVIEW_DIR . 'includes/admin/field-types/type_text.php' ); |
| 8 | 8 | } |
| 9 | 9 | class GravityView_FieldType_number extends GravityView_FieldType_text { |
| 10 | 10 | |
| 11 | 11 | function render_input( $override_input = null ) { |
| 12 | - if( isset( $override_input ) ) { |
|
| 12 | + if ( isset( $override_input ) ) { |
|
| 13 | 13 | echo $override_input; |
| 14 | 14 | return; |
| 15 | 15 | } |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | $show_mt = $this->show_merge_tags(); |
| 20 | 20 | |
| 21 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 21 | + if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) { |
|
| 22 | 22 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 23 | 23 | } |
| 24 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 24 | + $class .= ! empty( $this->field[ 'class' ] ) ? $this->field[ 'class' ] : 'widefat'; |
|
| 25 | 25 | |
| 26 | 26 | ?> |
| 27 | 27 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | if( !GravityView_Compatibility::is_valid() ) { return; } |
| 16 | 16 | |
| 17 | - self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
| 17 | + self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
| 18 | 18 | |
| 19 | 19 | include_once self::$metaboxes_dir . 'class-gravityview-metabox-tab.php'; |
| 20 | 20 | |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
| 229 | 229 | |
| 230 | 230 | if( isset( $form['id'] ) ) { |
| 231 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 231 | + $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 232 | 232 | |
| 233 | - // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
|
| 234 | - $_GET['id'] = $form['id']; |
|
| 233 | + // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
|
| 234 | + $_GET['id'] = $form['id']; |
|
| 235 | 235 | |
| 236 | 236 | } else { |
| 237 | - $form_script = 'var form = new Form();'; |
|
| 237 | + $form_script = 'var form = new Form();'; |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | function __construct() { |
| 19 | 19 | |
| 20 | - if( !GravityView_Compatibility::is_valid() ) { return; } |
|
| 20 | + if ( ! GravityView_Compatibility::is_valid() ) { return; } |
|
| 21 | 21 | |
| 22 | 22 | self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
| 23 | 23 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | function initialize() { |
| 37 | 37 | |
| 38 | - add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' )); |
|
| 38 | + add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' ) ); |
|
| 39 | 39 | |
| 40 | - add_action( 'add_meta_boxes_gravityview' , array( $this, 'update_priority' ) ); |
|
| 40 | + add_action( 'add_meta_boxes_gravityview', array( $this, 'update_priority' ) ); |
|
| 41 | 41 | |
| 42 | 42 | // information box |
| 43 | 43 | add_action( 'post_submitbox_misc_actions', array( $this, 'render_shortcode_hint' ) ); |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | function update_priority() { |
| 52 | 52 | global $wp_meta_boxes; |
| 53 | 53 | |
| 54 | - if( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
| 55 | - foreach( array( 'high', 'core', 'low' ) as $position ) { |
|
| 56 | - if( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
| 57 | - foreach( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
| 58 | - if( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 59 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
| 60 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
| 54 | + if ( ! empty( $wp_meta_boxes[ 'gravityview' ] ) ) { |
|
| 55 | + foreach ( array( 'high', 'core', 'low' ) as $position ) { |
|
| 56 | + if ( isset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] ) ) { |
|
| 57 | + foreach ( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ] as $key => $meta_box ) { |
|
| 58 | + if ( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 59 | + $wp_meta_boxes[ 'gravityview' ][ 'advanced' ][ $position ][ $key ] = $meta_box; |
|
| 60 | + unset( $wp_meta_boxes[ 'gravityview' ][ 'normal' ][ $position ][ $key ] ); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | global $post; |
| 70 | 70 | |
| 71 | 71 | // On Comment Edit, for example, $post isn't set. |
| 72 | - if( empty( $post ) || !is_object( $post ) || !isset( $post->ID ) ) { |
|
| 72 | + if ( empty( $post ) || ! is_object( $post ) || ! isset( $post->ID ) ) { |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -152,9 +152,9 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | $metaboxes = apply_filters( 'gravityview/metaboxes/default', $metaboxes ); |
| 154 | 154 | |
| 155 | - foreach( $metaboxes as $m ) { |
|
| 155 | + foreach ( $metaboxes as $m ) { |
|
| 156 | 156 | |
| 157 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
| 157 | + $tab = new GravityView_Metabox_Tab( $m[ 'id' ], $m[ 'title' ], $m[ 'file' ], $m[ 'icon-class' ], $m[ 'callback' ], $m[ 'callback_args' ] ); |
|
| 158 | 158 | |
| 159 | 159 | GravityView_Metabox_Tabs::add( $tab ); |
| 160 | 160 | |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $links = GravityView_Admin_Views::get_connected_form_links( $current_form, false ); |
| 182 | 182 | |
| 183 | - if( !empty( $links ) ) { |
|
| 184 | - $links = '<span class="alignright gv-form-links">'. $links .'</span>'; |
|
| 183 | + if ( ! empty( $links ) ) { |
|
| 184 | + $links = '<span class="alignright gv-form-links">' . $links . '</span>'; |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | return __( 'Data Source', 'gravityview' ) . $links; |
@@ -220,28 +220,28 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public static function render_merge_tags_scripts( $curr_form ) { |
| 222 | 222 | |
| 223 | - if( empty( $curr_form )) { |
|
| 223 | + if ( empty( $curr_form ) ) { |
|
| 224 | 224 | return NULL; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $form = gravityview_get_form( $curr_form ); |
| 228 | 228 | |
| 229 | - $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
|
| 229 | + $get_id_backup = isset( $_GET[ 'id' ] ) ? $_GET[ 'id' ] : NULL; |
|
| 230 | 230 | |
| 231 | - if( isset( $form['id'] ) ) { |
|
| 232 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 231 | + if ( isset( $form[ 'id' ] ) ) { |
|
| 232 | + $form_script = 'var form = ' . GFCommon::json_encode( $form ) . ';'; |
|
| 233 | 233 | |
| 234 | 234 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
| 235 | - $_GET['id'] = $form['id']; |
|
| 235 | + $_GET[ 'id' ] = $form[ 'id' ]; |
|
| 236 | 236 | |
| 237 | 237 | } else { |
| 238 | 238 | $form_script = 'var form = new Form();'; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
|
| 241 | + $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars( false ) . '</script>'; |
|
| 242 | 242 | |
| 243 | 243 | // Restore previous $_GET setting |
| 244 | - $_GET['id'] = $get_id_backup; |
|
| 244 | + $_GET[ 'id' ] = $get_id_backup; |
|
| 245 | 245 | |
| 246 | 246 | return $output; |
| 247 | 247 | } |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | global $post; |
| 298 | 298 | |
| 299 | 299 | // Only show this on GravityView post types. |
| 300 | - if( false === gravityview_is_admin_page() ) { return; } |
|
| 300 | + if ( false === gravityview_is_admin_page() ) { return; } |
|
| 301 | 301 | |
| 302 | 302 | // If the View hasn't been configured yet, don't show embed shortcode |
| 303 | - if( !gravityview_get_directory_fields( $post->ID ) ) { return; } |
|
| 303 | + if ( ! gravityview_get_directory_fields( $post->ID ) ) { return; } |
|
| 304 | 304 | |
| 305 | 305 | include self::$metaboxes_dir . 'views/shortcode-hint.php'; |
| 306 | 306 | } |
@@ -12,7 +12,9 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 15 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 16 | + exit; |
|
| 17 | +} |
|
| 16 | 18 | |
| 17 | 19 | /** |
| 18 | 20 | * GravityView_Welcome Class |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | * @since 1.0 |
| 35 | 35 | */ |
| 36 | 36 | public function __construct() { |
| 37 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
| 37 | + add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 ); |
|
| 38 | 38 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
| 39 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 40 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
| 39 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
| 40 | + add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 ); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | // Add help page to GravityView menu |
| 54 | 54 | add_submenu_page( |
| 55 | 55 | 'edit.php?post_type=gravityview', |
| 56 | - __('GravityView: Getting Started', 'gravityview'), |
|
| 57 | - __('Getting Started', 'gravityview'), |
|
| 56 | + __( 'GravityView: Getting Started', 'gravityview' ), |
|
| 57 | + __( 'Getting Started', 'gravityview' ), |
|
| 58 | 58 | $this->minimum_capability, |
| 59 | 59 | 'gv-getting-started', |
| 60 | 60 | array( $this, 'getting_started_screen' ) |
@@ -87,10 +87,10 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @return boolean $is_page True: yep; false: nope |
| 89 | 89 | */ |
| 90 | - public function is_dashboard_page($is_page = false, $hook = NULL) { |
|
| 90 | + public function is_dashboard_page( $is_page = false, $hook = NULL ) { |
|
| 91 | 91 | global $plugin_page; |
| 92 | 92 | |
| 93 | - if($is_page) { return $is_page; } |
|
| 93 | + if ( $is_page ) { return $is_page; } |
|
| 94 | 94 | |
| 95 | 95 | return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
| 96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
| 109 | 109 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
| 110 | 110 | |
| 111 | - if( !$this->is_dashboard_page() ) { return; } |
|
| 111 | + if ( ! $this->is_dashboard_page() ) { return; } |
|
| 112 | 112 | |
| 113 | 113 | ?> |
| 114 | 114 | <style type="text/css" media="screen" xmlns="http://www.w3.org/1999/html"> |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | // Don't fetch -beta, etc. |
| 133 | 133 | list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
| 134 | 134 | |
| 135 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
| 135 | + $selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
| 136 | 136 | |
| 137 | 137 | echo gravityview_get_floaty( 132 ); |
| 138 | 138 | ?> |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
| 142 | 142 | |
| 143 | 143 | <h2 class="nav-tab-wrapper clear"> |
| 144 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 144 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 145 | 145 | <?php _e( "Getting Started", 'gravityview' ); ?> |
| 146 | 146 | </a> |
| 147 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 147 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 148 | 148 | <?php _e( "List of Changes", 'gravityview' ); ?> |
| 149 | 149 | </a> |
| 150 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
| 150 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
| 151 | 151 | <?php _e( 'Credits', 'gravityview' ); ?> |
| 152 | 152 | </a> |
| 153 | 153 | </h2> |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | <h3>Create a View</h3> |
| 183 | 183 | |
| 184 | 184 | <ol class="ol-decimal"> |
| 185 | - <li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views > New View</a></li> |
|
| 185 | + <li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views > New View</a></li> |
|
| 186 | 186 | <li>If you want to <strong>create a new form</strong>, click the "Use a Form Preset" button</li> |
| 187 | 187 | <li>If you want to <strong>use an existing form’s entries</strong>, select from the dropdown.</li> |
| 188 | 188 | <li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>. |
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | </ul> |
| 465 | 465 | |
| 466 | 466 | <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
| 467 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
| 467 | + <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/katzwebservices/GravityView">', '</a>' ); ?></p> |
|
| 468 | 468 | </div> |
| 469 | 469 | </div> |
| 470 | 470 | |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | global $plugin_page; |
| 508 | 508 | |
| 509 | 509 | // Bail if we're just editing the plugin |
| 510 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
| 510 | + if ( $plugin_page === 'plugin-editor.php' ) { return; } |
|
| 511 | 511 | |
| 512 | 512 | // Bail if no activation redirect |
| 513 | 513 | if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | $upgrade = get_option( 'gv_version_upgraded_from' ); |
| 519 | 519 | |
| 520 | 520 | // Don't do anything if they've already seen the new version info |
| 521 | - if( $upgrade === GravityView_Plugin::version ) { |
|
| 521 | + if ( $upgrade === GravityView_Plugin::version ) { |
|
| 522 | 522 | return; |
| 523 | 523 | } |
| 524 | 524 | |
@@ -526,10 +526,10 @@ discard block |
||
| 526 | 526 | update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
| 527 | 527 | |
| 528 | 528 | // Bail if activating from network, or bulk |
| 529 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
| 529 | + if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; } |
|
| 530 | 530 | |
| 531 | 531 | // First time install |
| 532 | - if( ! $upgrade ) { |
|
| 532 | + if ( ! $upgrade ) { |
|
| 533 | 533 | wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
| 534 | 534 | } |
| 535 | 535 | // Update |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | var $style = NULL; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * String representing size of image - Choose from "full", "medium", "thumb", "tiny" |
|
| 26 | + * String representing size of image - Choose from "full", "medium", "thumb", "tiny" |
|
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | 29 | var $size = NULL; |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | |
| 66 | 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,7 +85,7 @@ 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 | 90 | $info = pathinfo( $this->src ); |
| 91 | 91 | |
@@ -93,9 +93,9 @@ discard block |
||
| 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 | /** |
@@ -111,16 +111,16 @@ discard block |
||
| 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 | 116 | $image_size = @getimagesize( $this->src ); |
| 117 | 117 | |
| 118 | 118 | // If it didn't return a response, it may be a HTTPS/SSL error |
| 119 | - if ( empty( $image_size[0] ) ) { |
|
| 119 | + if ( empty( $image_size[ 0 ] ) ) { |
|
| 120 | 120 | $image_size = @getimagesize( set_url_scheme( $this->src, 'http' ) ); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if ( !empty( $image_size ) ) { |
|
| 123 | + if ( ! empty( $image_size ) ) { |
|
| 124 | 124 | list( $width, $height ) = $image_size; |
| 125 | 125 | } |
| 126 | 126 | |
@@ -133,33 +133,33 @@ discard block |
||
| 133 | 133 | * @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 |
| 134 | 134 | */ |
| 135 | 135 | $image_sizes = apply_filters( 'gravityview_image_sizes', array( |
| 136 | - 'tiny' => array('width' => 40, 'height' => 30), |
|
| 137 | - 'small' => array('width' => 100, 'height' => 75), |
|
| 138 | - 'medium' => array('width' => 250, 'height' => 188), |
|
| 139 | - 'large' => array('width' => 448, 'height' => 336), |
|
| 136 | + 'tiny' => array( 'width' => 40, 'height' => 30 ), |
|
| 137 | + 'small' => array( 'width' => 100, 'height' => 75 ), |
|
| 138 | + 'medium' => array( 'width' => 250, 'height' => 188 ), |
|
| 139 | + 'large' => array( 'width' => 448, 'height' => 336 ), |
|
| 140 | 140 | ) ); |
| 141 | 141 | |
| 142 | - switch( $this->size ) { |
|
| 142 | + switch ( $this->size ) { |
|
| 143 | 143 | case 'tiny': |
| 144 | - extract($image_sizes['tiny']); |
|
| 144 | + extract( $image_sizes[ 'tiny' ] ); |
|
| 145 | 145 | break; |
| 146 | 146 | case 'small': |
| 147 | 147 | case 's': |
| 148 | 148 | case 'thumb': |
| 149 | - extract($image_sizes['small']); |
|
| 149 | + extract( $image_sizes[ 'small' ] ); |
|
| 150 | 150 | break; |
| 151 | 151 | case 'm': |
| 152 | 152 | case 'medium': |
| 153 | - extract($image_sizes['medium']); |
|
| 153 | + extract( $image_sizes[ 'medium' ] ); |
|
| 154 | 154 | break; |
| 155 | 155 | case 'large': |
| 156 | 156 | case 'l': |
| 157 | - extract($image_sizes['large']); |
|
| 157 | + extract( $image_sizes[ 'large' ] ); |
|
| 158 | 158 | break; |
| 159 | 159 | default: |
| 160 | 160 | // Verify that the passed sizes are integers. |
| 161 | - $width = !empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
| 162 | - $height = !empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
| 161 | + $width = ! empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
| 162 | + $height = ! empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | } |