@@ -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,11 +111,11 @@ 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 | - if ( !empty( $image_size ) ) { |
|
| 118 | + if ( ! empty( $image_size ) ) { |
|
| 119 | 119 | list( $width, $height ) = $image_size; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -128,33 +128,33 @@ discard block |
||
| 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 | 130 | $image_sizes = apply_filters( 'gravityview_image_sizes', array( |
| 131 | - 'tiny' => array('width' => 40, 'height' => 30), |
|
| 132 | - 'small' => array('width' => 100, 'height' => 75), |
|
| 133 | - 'medium' => array('width' => 250, 'height' => 188), |
|
| 134 | - 'large' => array('width' => 448, 'height' => 336), |
|
| 131 | + 'tiny' => array( 'width' => 40, 'height' => 30 ), |
|
| 132 | + 'small' => array( 'width' => 100, 'height' => 75 ), |
|
| 133 | + 'medium' => array( 'width' => 250, 'height' => 188 ), |
|
| 134 | + 'large' => array( 'width' => 448, 'height' => 336 ), |
|
| 135 | 135 | ) ); |
| 136 | 136 | |
| 137 | - switch( $this->size ) { |
|
| 137 | + switch ( $this->size ) { |
|
| 138 | 138 | case 'tiny': |
| 139 | - extract($image_sizes['tiny']); |
|
| 139 | + extract( $image_sizes[ 'tiny' ] ); |
|
| 140 | 140 | break; |
| 141 | 141 | case 'small': |
| 142 | 142 | case 's': |
| 143 | 143 | case 'thumb': |
| 144 | - extract($image_sizes['small']); |
|
| 144 | + extract( $image_sizes[ 'small' ] ); |
|
| 145 | 145 | break; |
| 146 | 146 | case 'm': |
| 147 | 147 | case 'medium': |
| 148 | - extract($image_sizes['medium']); |
|
| 148 | + extract( $image_sizes[ 'medium' ] ); |
|
| 149 | 149 | break; |
| 150 | 150 | case 'large': |
| 151 | 151 | case 'l': |
| 152 | - extract($image_sizes['large']); |
|
| 152 | + extract( $image_sizes[ 'large' ] ); |
|
| 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 | } |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | |
| 72 | 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 | 76 | add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 ); |
| 77 | 77 | |
| 78 | 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 | |
@@ -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 | |
@@ -134,17 +134,17 @@ discard block |
||
| 134 | 134 | $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
| 135 | 135 | |
| 136 | 136 | // Force the screen to be GravityView |
| 137 | - $tab['screen'] = 'gravityview'; |
|
| 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 | 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,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function load_plugin_textdomain() { |
| 162 | 162 | |
| 163 | - if( empty( $this->_text_domain ) ) { |
|
| 163 | + if ( empty( $this->_text_domain ) ) { |
|
| 164 | 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 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 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 | 177 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
| 178 | 178 | |
@@ -202,11 +202,11 @@ 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 | |
| 209 | - $license = GravityView_Settings::getSetting('license'); |
|
| 209 | + $license = GravityView_Settings::getSetting( 'license' ); |
|
| 210 | 210 | |
| 211 | 211 | return $license; |
| 212 | 212 | } |
@@ -219,16 +219,16 @@ 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 | 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 ) ) { |
|
| 231 | + if ( ! file_exists( $file_path ) ) { |
|
| 232 | 232 | $file_path = plugin_dir_path( __FILE__ ) . '/EDD_SL_Plugin_Updater.php'; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -238,16 +238,16 @@ 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, |
| 245 | 245 | $this->_path, |
| 246 | 246 | array( |
| 247 | 247 | 'version' => $this->_version, // current version number |
| 248 | - 'license' => $license['license'], |
|
| 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 |
|
| 250 | + 'item_name' => $this->_title, // name of this plugin |
|
| 251 | 251 | 'author' => strip_tags( $this->_author ) // author of this plugin |
| 252 | 252 | ) |
| 253 | 253 | ); |
@@ -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 | } |
@@ -282,16 +282,16 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 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 ) ) { |
|
| 288 | + } else if ( is_string( $notice ) ) { |
|
| 289 | 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 | - self::$admin_notices[] = $notice; |
|
| 294 | + self::$admin_notices[ ] = $notice; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
@@ -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 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 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 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | var $name = 'post_category'; |
| 11 | 11 | |
| 12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 13 | 13 | |
| 14 | 14 | var $_gf_field_class_name = 'GF_Field_Post_Category'; |
| 15 | 15 | |
@@ -22,12 +22,12 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 24 | 24 | |
| 25 | - if( 'edit' === $context ) { |
|
| 25 | + if ( 'edit' === $context ) { |
|
| 26 | 26 | return $field_options; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 30 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 29 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 30 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 31 | 31 | |
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | var $name = 'radio'; |
| 11 | 11 | |
| 12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 13 | 13 | |
| 14 | 14 | var $_gf_field_class_name = 'GF_Field_Radio'; |
| 15 | 15 | |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 24 | 24 | |
| 25 | - unset( $field_options['show_as_link'] ); |
|
| 25 | + unset( $field_options[ 'show_as_link' ] ); |
|
| 26 | 26 | |
| 27 | - if( 'edit' === $context ) { |
|
| 27 | + if ( 'edit' === $context ) { |
|
| 28 | 28 | return $field_options; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 31 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 32 | 32 | |
| 33 | 33 | return $field_options; |
| 34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field ) { |
| 46 | 46 | |
| 47 | - $id = (int) $field->id; |
|
| 47 | + $id = (int)$field->id; |
|
| 48 | 48 | $input_name = "input_{$id}"; |
| 49 | 49 | $class = esc_attr( $field->size ); |
| 50 | 50 | $tabindex = $field->get_tabindex(); |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @return GravityView_Field | bool |
| 43 | 43 | */ |
| 44 | 44 | public static function create( $properties ) { |
| 45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
| 46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
| 45 | + $type = isset( $properties[ 'type' ] ) ? $properties[ 'type' ] : ''; |
|
| 46 | + $type = empty( $properties[ 'inputType' ] ) ? $type : $properties[ 'inputType' ]; |
|
| 47 | 47 | if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
| 48 | 48 | return new GravityView_Field( $properties ); |
| 49 | 49 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @return bool True: yes, it exists; False: nope |
| 63 | 63 | */ |
| 64 | 64 | public static function exists( $field_name ) { |
| 65 | - return isset( self::$_fields["{$field_name}"] ); |
|
| 65 | + return isset( self::$_fields[ "{$field_name}" ] ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $field_type = is_a( $gf_field, 'GF_Field' ) ? get_class( $gf_field ) : $gf_field; |
| 98 | 98 | |
| 99 | - foreach( self::$_fields as $field ) { |
|
| 100 | - if( $field_type === $field->_gf_field_class_name ) { |
|
| 99 | + foreach ( self::$_fields as $field ) { |
|
| 100 | + if ( $field_type === $field->_gf_field_class_name ) { |
|
| 101 | 101 | return $field; |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -116,10 +116,10 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public static function get_all( $group = '' ) { |
| 118 | 118 | |
| 119 | - if( '' !== $group ) { |
|
| 119 | + if ( '' !== $group ) { |
|
| 120 | 120 | $return_fields = self::$_fields; |
| 121 | 121 | foreach ( $return_fields as $key => $field ) { |
| 122 | - if( $group !== $field->group ) { |
|
| 122 | + if ( $group !== $field->group ) { |
|
| 123 | 123 | unset( $return_fields[ $key ] ); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 25 | 25 | |
| 26 | - unset ( $field_options['search_filter'] ); |
|
| 26 | + unset ( $field_options[ 'search_filter' ] ); |
|
| 27 | 27 | |
| 28 | - if( 'edit' === $context ) { |
|
| 28 | + if ( 'edit' === $context ) { |
|
| 29 | 29 | return $field_options; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $this->add_field_support('link_to_post', $field_options ); |
|
| 32 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
| 33 | 33 | |
| 34 | 34 | // @since 1.5.4 |
| 35 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 35 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 36 | 36 | |
| 37 | 37 | return $field_options; |
| 38 | 38 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $url = $title = $caption = $description = ''; |
| 59 | 59 | |
| 60 | 60 | // If there's a |:| match, process. Otherwise, empty array! |
| 61 | - if( preg_match( '/\|\:\|/', $value ) ) { |
|
| 61 | + if ( preg_match( '/\|\:\|/', $value ) ) { |
|
| 62 | 62 | list( $url, $title, $caption, $description ) = array_pad( explode( '|:|', $value ), 4, false ); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Image $field ) { |
| 89 | 89 | |
| 90 | - $id = (int) $field->id; |
|
| 91 | - $form_id = $form['id']; |
|
| 90 | + $id = (int)$field->id; |
|
| 91 | + $form_id = $form[ 'id' ]; |
|
| 92 | 92 | $input_name = "input_{$id}"; |
| 93 | 93 | $field_id = sprintf( 'input_%d_%d', $form_id, $id ); |
| 94 | 94 | $img_name = null; |
@@ -96,16 +96,16 @@ discard block |
||
| 96 | 96 | // Convert |:| to associative array |
| 97 | 97 | $img_array = $this->explode_value( $value ); |
| 98 | 98 | |
| 99 | - if( ! empty( $img_array['url'] ) ) { |
|
| 99 | + if ( ! empty( $img_array[ 'url' ] ) ) { |
|
| 100 | 100 | |
| 101 | - $img_name = basename( $img_array['url'] ); |
|
| 101 | + $img_name = basename( $img_array[ 'url' ] ); |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * Set the $uploaded_files value so that the .ginput_preview renders, and the file upload is hidden |
| 105 | 105 | * @see GF_Field_Post_Image::get_field_input See the `<span class='ginput_preview'>` code |
| 106 | 106 | * @see GFFormsModel::get_temp_filename See the `rgget( $input_name, self::$uploaded_files[ $form_id ] );` code |
| 107 | 107 | */ |
| 108 | - if( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
| 108 | + if ( empty( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
| 109 | 109 | GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] = $img_name; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | * @hack |
| 135 | 135 | */ |
| 136 | 136 | if ( $img_name ) { |
| 137 | - $current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array['url'] ) ); |
|
| 138 | - $gf_post_image_field_output = str_replace('<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>'.$current_file, $gf_post_image_field_output ); |
|
| 137 | + $current_file = sprintf( "<input name='%s' id='%s' type='hidden' value='%s' />", $input_name, $field_id, esc_url_raw( $img_array[ 'url' ] ) ); |
|
| 138 | + $gf_post_image_field_output = str_replace( '<span class=\'ginput_preview\'>', '<span class=\'ginput_preview\'>' . $current_file, $gf_post_image_field_output ); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | return $gf_post_image_field_output; |
@@ -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( 'RGForms', 'delete_file') ); |
|
| 84 | + add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file' ) ); |
|
| 85 | 85 | |
| 86 | 86 | // Make sure this hook is run for non-admins |
| 87 | - add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file') ); |
|
| 87 | + add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', '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 | |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | * Allow passing params to dynamically populate entry with values |
| 161 | 161 | * @since 1.9.2 |
| 162 | 162 | */ |
| 163 | - if( !empty( $field_values ) ) { |
|
| 163 | + if ( ! empty( $field_values ) ) { |
|
| 164 | 164 | |
| 165 | - if( is_array( $field_values ) ) { |
|
| 165 | + if ( is_array( $field_values ) ) { |
|
| 166 | 166 | // If already an array, no parse_str() needed |
| 167 | 167 | $params = $field_values; |
| 168 | 168 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function modify_field_blacklist( $fields = array(), $context = NULL ) { |
| 186 | 186 | |
| 187 | - if( empty( $context ) || $context !== 'edit' ) { |
|
| 187 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
| 188 | 188 | return $fields; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -226,24 +226,24 @@ discard block |
||
| 226 | 226 | // If they can edit any entries (as defined in Gravity Forms) |
| 227 | 227 | // Or if they can edit other people's entries |
| 228 | 228 | // Then we're good. |
| 229 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) { |
|
| 229 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) { |
|
| 230 | 230 | |
| 231 | - do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.'); |
|
| 231 | + do_action( 'gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.' ); |
|
| 232 | 232 | |
| 233 | 233 | $user_can_edit = true; |
| 234 | 234 | |
| 235 | - } else if( !isset( $entry['created_by'] ) ) { |
|
| 235 | + } else if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 236 | 236 | |
| 237 | - do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.'); |
|
| 237 | + do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.' ); |
|
| 238 | 238 | |
| 239 | 239 | $user_can_edit = false; |
| 240 | 240 | |
| 241 | 241 | } else { |
| 242 | 242 | |
| 243 | 243 | // get user_edit setting |
| 244 | - if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 244 | + if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) { |
|
| 245 | 245 | // if View ID not specified or is the current view |
| 246 | - $user_edit = GravityView_View::getInstance()->getAtts('user_edit'); |
|
| 246 | + $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' ); |
|
| 247 | 247 | } else { |
| 248 | 248 | // in case is specified and not the current view |
| 249 | 249 | $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' ); |
@@ -252,21 +252,21 @@ discard block |
||
| 252 | 252 | $current_user = wp_get_current_user(); |
| 253 | 253 | |
| 254 | 254 | // User edit is disabled |
| 255 | - if( empty( $user_edit ) ) { |
|
| 255 | + if ( empty( $user_edit ) ) { |
|
| 256 | 256 | |
| 257 | - do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
| 257 | + do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' ); |
|
| 258 | 258 | |
| 259 | 259 | $user_can_edit = false; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good. |
| 263 | - else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 263 | + else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 264 | 264 | |
| 265 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 265 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 266 | 266 | |
| 267 | 267 | $user_can_edit = true; |
| 268 | 268 | |
| 269 | - } else if( ! is_user_logged_in() ) { |
|
| 269 | + } else if ( ! is_user_logged_in() ) { |
|
| 270 | 270 | |
| 271 | 271 | do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' ); |
| 272 | 272 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $labels = array( |
| 31 | 31 | 'cancel' => __( 'Cancel', 'gravityview' ), |
| 32 | - 'submit' => __( 'Update', 'gravityview') |
|
| 32 | + 'submit' => __( 'Update', 'gravityview' ) |
|
| 33 | 33 | ); |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | $labels = apply_filters( 'gravityview/edit_entry/button_labels', $labels, $object->form, $object->entry, $object->view_id ); |
| 44 | 44 | |
| 45 | 45 | ?> |
| 46 | - <input id="gform_submit_button_<?php echo esc_attr( $object->form['id'] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels['submit'] ); ?>" name="save" /> |
|
| 46 | + <input id="gform_submit_button_<?php echo esc_attr( $object->form[ 'id' ] ); ?>" class="btn btn-lg button button-large gform_button button-primary gv-button-update" type="submit" tabindex="4" value="<?php echo esc_attr( $labels[ 'submit' ] ); ?>" name="save" /> |
|
| 47 | 47 | |
| 48 | - <a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels['cancel'] ); ?></a> |
|
| 48 | + <a class="btn btn-sm button button-small gv-button-cancel" tabindex="5" href="<?php echo esc_url( $back_link ); ?>"><?php echo esc_attr( $labels[ 'cancel' ] ); ?></a> |
|
| 49 | 49 | <?php |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -59,5 +59,5 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | ?> |
| 61 | 61 | <input type="hidden" name="action" value="update" /> |
| 62 | - <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry['id'] ); ?>" /> |
|
| 62 | + <input type="hidden" name="lid" value="<?php echo esc_attr( $object->entry[ 'id' ] ); ?>" /> |
|
| 63 | 63 | </div> |