@@ -5,4 +5,4 @@ |
||
| 5 | 5 | * @deprecated 1.7.5 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 8 | +include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @return GravityView_Compatibility |
| 77 | 77 | */ |
| 78 | 78 | public static function getInstance() { |
| 79 | - if( self::$instance ) { |
|
| 79 | + if ( self::$instance ) { |
|
| 80 | 80 | return self::$instance; |
| 81 | 81 | } |
| 82 | 82 | return new self; |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | // If Gravity Forms doesn't exist or is outdated, load the admin view class to |
| 124 | 124 | // show the notice, but not load any post types or process shortcodes. |
| 125 | 125 | // Without Gravity Forms, there is no GravityView. Beautiful, really. |
| 126 | - if( ! self::is_valid() ) { |
|
| 126 | + if ( ! self::is_valid() ) { |
|
| 127 | 127 | |
| 128 | 128 | // If the plugin's not loaded, might as well hide the shortcode for people. |
| 129 | - add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') ); |
|
| 129 | + add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) ); |
|
| 130 | 130 | |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) { |
| 154 | 154 | |
| 155 | - if( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
| 155 | + if ( ! GVCommon::has_cap( 'activate_plugins' ) ) { |
|
| 156 | 156 | return null; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $notices = self::get_notices(); |
| 160 | 160 | |
| 161 | - $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>'; |
|
| 162 | - foreach( (array)$notices as $notice ) { |
|
| 163 | - $message .= wpautop( $notice['message'] ); |
|
| 161 | + $message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>'; |
|
| 162 | + foreach ( (array)$notices as $notice ) { |
|
| 163 | + $message .= wpautop( $notice[ 'message' ] ); |
|
| 164 | 164 | } |
| 165 | 165 | $message .= '</div>'; |
| 166 | 166 | |
@@ -175,11 +175,11 @@ discard block |
||
| 175 | 175 | * @return boolean |
| 176 | 176 | */ |
| 177 | 177 | public static function check_php() { |
| 178 | - if( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) { |
|
| 178 | + if ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) { |
|
| 179 | 179 | |
| 180 | - self::$notices['php_version'] = array( |
|
| 180 | + self::$notices[ 'php_version' ] = array( |
|
| 181 | 181 | 'class' => 'error', |
| 182 | - 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ), |
|
| 182 | + 'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ), |
|
| 183 | 183 | 'cap' => 'manage_options', |
| 184 | 184 | 'dismiss' => 'php_version', |
| 185 | 185 | ); |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | public static function check_wordpress() { |
| 200 | 200 | global $wp_version; |
| 201 | 201 | |
| 202 | - if( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) { |
|
| 202 | + if ( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) { |
|
| 203 | 203 | |
| 204 | - self::$notices['wp_version'] = array( |
|
| 204 | + self::$notices[ 'wp_version' ] = array( |
|
| 205 | 205 | 'class' => 'error', |
| 206 | - 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ), |
|
| 206 | + 'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ), |
|
| 207 | 207 | 'cap' => 'update_core', |
| 208 | 208 | 'dismiss' => 'wp_version', |
| 209 | 209 | ); |
@@ -226,17 +226,17 @@ discard block |
||
| 226 | 226 | public static function check_gravityforms() { |
| 227 | 227 | |
| 228 | 228 | // Bypass other checks: if the class exists |
| 229 | - if( class_exists( 'GFCommon' ) ) { |
|
| 229 | + if ( class_exists( 'GFCommon' ) ) { |
|
| 230 | 230 | |
| 231 | 231 | // and the version's right, we're good. |
| 232 | - if( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) { |
|
| 232 | + if ( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) { |
|
| 233 | 233 | return true; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Or the version's wrong |
| 237 | - self::$notices['gf_version'] = array( |
|
| 237 | + self::$notices[ 'gf_version' ] = array( |
|
| 238 | 238 | 'class' => 'error', |
| 239 | - 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
| 239 | + 'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
| 240 | 240 | 'cap' => 'update_plugins', |
| 241 | 241 | 'dismiss' => 'gf_version', |
| 242 | 242 | ); |
@@ -251,42 +251,42 @@ discard block |
||
| 251 | 251 | * OR |
| 252 | 252 | * It's the Network Admin and we just don't know whether the sites have GF activated themselves. |
| 253 | 253 | */ |
| 254 | - if( true === $gf_status || is_network_admin() ) { |
|
| 254 | + if ( true === $gf_status || is_network_admin() ) { |
|
| 255 | 255 | return true; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // If GFCommon doesn't exist, assume GF not active |
| 259 | 259 | $return = false; |
| 260 | 260 | |
| 261 | - switch( $gf_status ) { |
|
| 261 | + switch ( $gf_status ) { |
|
| 262 | 262 | case 'inactive': |
| 263 | 263 | |
| 264 | 264 | // Required for multisite |
| 265 | - if( ! function_exists('wp_create_nonce') ) { |
|
| 265 | + if ( ! function_exists( 'wp_create_nonce' ) ) { |
|
| 266 | 266 | require_once ABSPATH . WPINC . '/pluggable.php'; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | // Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE" |
| 270 | - if( is_multisite() ) { |
|
| 270 | + if ( is_multisite() ) { |
|
| 271 | 271 | wp_cookie_constants(); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | $return = false; |
| 275 | 275 | |
| 276 | - $button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">'; |
|
| 276 | + $button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">'; |
|
| 277 | 277 | |
| 278 | - self::$notices['gf_inactive'] = array( |
|
| 278 | + self::$notices[ 'gf_inactive' ] = array( |
|
| 279 | 279 | 'class' => 'error', |
| 280 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ), |
|
| 280 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ), |
|
| 281 | 281 | 'cap' => 'activate_plugins', |
| 282 | 282 | 'dismiss' => 'gf_inactive', |
| 283 | 283 | ); |
| 284 | 284 | |
| 285 | 285 | break; |
| 286 | 286 | default: |
| 287 | - self::$notices['gf_installed'] = array( |
|
| 287 | + self::$notices[ 'gf_installed' ] = array( |
|
| 288 | 288 | 'class' => 'error', |
| 289 | - 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'), |
|
| 289 | + 'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ), |
|
| 290 | 290 | 'cap' => 'install_plugins', |
| 291 | 291 | 'dismiss' => 'gf_installed', |
| 292 | 292 | ); |
@@ -303,10 +303,10 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | private static function check_gf_directory() { |
| 305 | 305 | |
| 306 | - if( class_exists( 'GFDirectory' ) ) { |
|
| 307 | - self::$notices['gf_directory'] = array( |
|
| 306 | + if ( class_exists( 'GFDirectory' ) ) { |
|
| 307 | + self::$notices[ 'gf_directory' ] = array( |
|
| 308 | 308 | 'class' => 'error is-dismissible', |
| 309 | - 'title' => __('Potential Conflict', 'gravityview' ), |
|
| 309 | + 'title' => __( 'Potential Conflict', 'gravityview' ), |
|
| 310 | 310 | 'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ), |
| 311 | 311 | 'dismiss' => 'gf_directory', |
| 312 | 312 | 'cap' => 'activate_plugins', |
@@ -325,21 +325,21 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public static function get_plugin_status( $location = '' ) { |
| 327 | 327 | |
| 328 | - if( ! function_exists('is_plugin_active') ) { |
|
| 328 | + if ( ! function_exists( 'is_plugin_active' ) ) { |
|
| 329 | 329 | include_once( ABSPATH . '/wp-admin/includes/plugin.php' ); |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
| 332 | + if ( is_network_admin() && is_plugin_active_for_network( $location ) ) { |
|
| 333 | 333 | return true; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if( !is_network_admin() && is_plugin_active( $location ) ) { |
|
| 336 | + if ( ! is_network_admin() && is_plugin_active( $location ) ) { |
|
| 337 | 337 | return true; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - if( |
|
| 341 | - !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
| 342 | - !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
| 340 | + if ( |
|
| 341 | + ! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) && |
|
| 342 | + ! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location ) |
|
| 343 | 343 | ) { |
| 344 | 344 | return false; |
| 345 | 345 | } |
@@ -11,29 +11,29 @@ discard block |
||
| 11 | 11 | $field_info_items = array(); |
| 12 | 12 | |
| 13 | 13 | // Fields with IDs, not like Source URL or Entry ID |
| 14 | - if( is_numeric( $this->id ) ) { |
|
| 14 | + if ( is_numeric( $this->id ) ) { |
|
| 15 | 15 | |
| 16 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
| 16 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
| 17 | 17 | |
| 18 | - $field_info_items[] = array( |
|
| 19 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
| 18 | + $field_info_items[ ] = array( |
|
| 19 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ) |
|
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | - $field_info_items[] = array( |
|
| 23 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
| 22 | + $field_info_items[ ] = array( |
|
| 23 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
| 24 | 24 | ); |
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if( !empty( $this->item['desc'] ) ) { |
|
| 29 | - $field_info_items[] = array( |
|
| 30 | - 'value' => $this->item['desc'] |
|
| 28 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
| 29 | + $field_info_items[ ] = array( |
|
| 30 | + 'value' => $this->item[ 'desc' ] |
|
| 31 | 31 | ); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
| 35 | - $field_info_items[] = array( |
|
| 36 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
| 34 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
| 35 | + $field_info_items[ ] = array( |
|
| 36 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
| 37 | 37 | 'class' => 'gv-sublabel' |
| 38 | 38 | ); |
| 39 | 39 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | $field_info = ''; |
| 53 | 53 | $field_info_items = array(); |
| 54 | 54 | |
| 55 | - if( !empty( $this->item['description'] ) ) { |
|
| 55 | + if ( ! empty( $this->item[ 'description' ] ) ) { |
|
| 56 | 56 | |
| 57 | - $field_info_items[] = array( |
|
| 58 | - 'value' => $this->item['description'] |
|
| 57 | + $field_info_items[ ] = array( |
|
| 58 | + 'value' => $this->item[ 'description' ] |
|
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | 61 | } |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | function __construct( $title = '', $field_id, $item = array(), $settings = array() ) { |
| 81 | 81 | |
| 82 | 82 | // Backward compat |
| 83 | - if( !empty( $item['type'] ) ) { |
|
| 84 | - $item['input_type'] = $item['type']; |
|
| 85 | - unset( $item['type'] ); |
|
| 83 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 84 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 85 | + unset( $item[ 'type' ] ); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // Prevent items from not having index set |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | 'adminLabel' => NULL, |
| 97 | 97 | 'adminOnly' => NULL, |
| 98 | 98 | 'subtitle' => NULL, |
| 99 | - )); |
|
| 99 | + ) ); |
|
| 100 | 100 | |
| 101 | 101 | $this->title = $title; |
| 102 | 102 | $this->item = $item; |
| 103 | 103 | $this->id = $field_id; |
| 104 | 104 | $this->settings = $settings; |
| 105 | - $this->label_type = $item['label_type']; |
|
| 105 | + $this->label_type = $item[ 'label_type' ]; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | /** |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | */ |
| 142 | 142 | $field_info_items = apply_filters( 'gravityview_admin_label_item_info', $field_info_items, $this ); |
| 143 | 143 | |
| 144 | - if( $html ) { |
|
| 144 | + if ( $html ) { |
|
| 145 | 145 | |
| 146 | 146 | foreach ( $field_info_items as $item ) { |
| 147 | - $class = isset($item['class']) ? sanitize_html_class( $item['class'] ).' description' : 'description'; |
|
| 147 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 148 | 148 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 149 | - $output .= '<span class="'.$class.'">'; |
|
| 150 | - $output .= esc_html( $item['value'] ); |
|
| 149 | + $output .= '<span class="' . $class . '">'; |
|
| 150 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 151 | 151 | $output .= '</span>'; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $values = wp_list_pluck( $field_info_items, 'value' ); |
| 157 | 157 | |
| 158 | - $output = esc_html( implode(', ', $values) ); |
|
| 158 | + $output = esc_html( implode( ', ', $values ) ); |
|
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
@@ -170,53 +170,53 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | function getOutput() { |
| 172 | 172 | |
| 173 | - $settings_title = sprintf(__('Configure %s Settings', 'gravityview'), ucfirst($this->label_type)); |
|
| 174 | - $delete_title = sprintf(__('Remove %s', 'gravityview'), ucfirst($this->label_type)); |
|
| 175 | - $single_link_title = __('This field links to the Single Entry', 'gravityview'); |
|
| 173 | + $settings_title = sprintf( __( 'Configure %s Settings', 'gravityview' ), ucfirst( $this->label_type ) ); |
|
| 174 | + $delete_title = sprintf( __( 'Remove %s', 'gravityview' ), ucfirst( $this->label_type ) ); |
|
| 175 | + $single_link_title = __( 'This field links to the Single Entry', 'gravityview' ); |
|
| 176 | 176 | |
| 177 | 177 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 178 | 178 | // TODO: Un-hack this |
| 179 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->') > 0 ) ? 'hide-if-js' : ''; |
|
| 179 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 180 | 180 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
| 181 | 181 | |
| 182 | 182 | // Should we show the icon that the field is being used as a link to single entry? |
| 183 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 184 | - $show_as_link = '<span class="dashicons dashicons-admin-links '.$hide_show_as_link_class.'" title="'.esc_attr( $single_link_title ).'"></span>'; |
|
| 183 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 184 | + $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
|
| 185 | 185 | |
| 186 | 186 | // When a field label is empty, use the Field ID |
| 187 | - $label = empty( $this->title ) ? sprintf( _x('Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview'), $this->id ) : $this->title; |
|
| 187 | + $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
|
| 188 | 188 | |
| 189 | 189 | // If there's a custom label, and show label is checked, use that as the field heading |
| 190 | - if( !empty( $this->settings['custom_label'] ) && !empty( $this->settings['show_label'] ) ) { |
|
| 191 | - $label = $this->settings['custom_label']; |
|
| 192 | - } else if( !empty( $this->item['customLabel'] ) ) { |
|
| 193 | - $label = $this->item['customLabel']; |
|
| 190 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 191 | + $label = $this->settings[ 'custom_label' ]; |
|
| 192 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 193 | + $label = $this->item[ 'customLabel' ]; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $output = '<h5 class="selectable gfield field-id-'.esc_attr($this->id).'">'; |
|
| 196 | + $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
|
| 197 | 197 | |
| 198 | 198 | $label = esc_attr( $label ); |
| 199 | 199 | |
| 200 | - if( !empty( $this->item['parent'] ) ) { |
|
| 201 | - $label .= ' <small>('.esc_attr( $this->item['parent']['label'] ) .')</small>'; |
|
| 200 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 201 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | // Name of field / widget |
| 205 | - $output .= '<span class="gv-field-label" data-original-title="'.esc_attr( $label ).'" title="'. $this->get_item_info( false ) .'">'. $label . '</span>'; |
|
| 205 | + $output .= '<span class="gv-field-label" data-original-title="' . esc_attr( $label ) . '" title="' . $this->get_item_info( false ) . '">' . $label . '</span>'; |
|
| 206 | 206 | |
| 207 | 207 | |
| 208 | - $output .= '<span class="gv-field-controls">'.$settings_link.$show_as_link.'<a href="#remove" class="dashicons-dismiss dashicons" title="'.esc_attr( $delete_title ) .'"></a></span>'; |
|
| 208 | + $output .= '<span class="gv-field-controls">' . $settings_link . $show_as_link . '<a href="#remove" class="dashicons-dismiss dashicons" title="' . esc_attr( $delete_title ) . '"></a></span>'; |
|
| 209 | 209 | |
| 210 | 210 | // Displays only in the field/widget picker. |
| 211 | - if( $field_info = $this->get_item_info() ) { |
|
| 212 | - $output .= '<span class="gv-field-info">'.$field_info.'</span>'; |
|
| 211 | + if ( $field_info = $this->get_item_info() ) { |
|
| 212 | + $output .= '<span class="gv-field-info">' . $field_info . '</span>'; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $output .= '</h5>'; |
| 216 | 216 | |
| 217 | - $container_class = !empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 217 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 218 | 218 | |
| 219 | - $output = '<div data-fieldid="'.esc_attr($this->id).'" data-inputtype="'.esc_attr( $this->item['input_type'] ).'" class="gv-fields'.$container_class.'">'.$output.$this->item['settings_html'].'</div>'; |
|
| 219 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 220 | 220 | |
| 221 | 221 | return $output; |
| 222 | 222 | } |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 22 | 22 | |
| 23 | - unset( $field_options['search_filter'] ); |
|
| 23 | + unset( $field_options[ 'search_filter' ] ); |
|
| 24 | 24 | |
| 25 | - if( 'edit' === $context ) { |
|
| 25 | + if ( 'edit' === $context ) { |
|
| 26 | 26 | return $field_options; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $add_options['link_to_file'] = array( |
|
| 29 | + $add_options[ 'link_to_file' ] = array( |
|
| 30 | 30 | 'type' => 'checkbox', |
| 31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 33 | 33 | 'value' => false, |
| 34 | 34 | 'merge_tags' => false, |
| 35 | 35 | ); |
@@ -59,22 +59,22 @@ discard block |
||
| 59 | 59 | $output_arr = array(); |
| 60 | 60 | |
| 61 | 61 | // Get an array of file paths for the field. |
| 62 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 62 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 63 | 63 | |
| 64 | 64 | // Process each file path |
| 65 | - foreach( $file_paths as $file_path ) { |
|
| 65 | + foreach ( $file_paths as $file_path ) { |
|
| 66 | 66 | |
| 67 | 67 | // If the site is HTTPS, use HTTPS |
| 68 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
| 68 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
| 69 | 69 | |
| 70 | 70 | // This is from Gravity Forms's code |
| 71 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
| 71 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
| 72 | 72 | |
| 73 | 73 | // If the field is set to link to the single entry, link to it. |
| 74 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
| 74 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
| 75 | 75 | |
| 76 | 76 | // Get file path information |
| 77 | - $file_path_info = pathinfo($file_path); |
|
| 77 | + $file_path_info = pathinfo( $file_path ); |
|
| 78 | 78 | |
| 79 | 79 | $html_format = NULL; |
| 80 | 80 | |
@@ -83,30 +83,30 @@ discard block |
||
| 83 | 83 | $disable_wrapped_link = false; |
| 84 | 84 | |
| 85 | 85 | // Is this an image? |
| 86 | - $image = new GravityView_Image(array( |
|
| 86 | + $image = new GravityView_Image( array( |
|
| 87 | 87 | 'src' => $file_path, |
| 88 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
| 89 | - 'alt' => $field_settings['label'], |
|
| 90 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
| 91 | - )); |
|
| 88 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 89 | + 'alt' => $field_settings[ 'label' ], |
|
| 90 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
| 91 | + ) ); |
|
| 92 | 92 | |
| 93 | 93 | $content = $image->html(); |
| 94 | 94 | |
| 95 | 95 | // The new default content is the image, if it exists. If not, use the file name as the content. |
| 96 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
| 96 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
| 97 | 97 | |
| 98 | 98 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 99 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 99 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | - switch( true ) { |
|
| 102 | + switch ( true ) { |
|
| 103 | 103 | |
| 104 | 104 | // Audio file |
| 105 | 105 | case in_array( $extension, wp_get_audio_extensions() ): |
| 106 | 106 | |
| 107 | 107 | $disable_lightbox = true; |
| 108 | 108 | |
| 109 | - if( shortcode_exists( 'audio' ) ) { |
|
| 109 | + if ( shortcode_exists( 'audio' ) ) { |
|
| 110 | 110 | |
| 111 | 111 | $disable_wrapped_link = true; |
| 112 | 112 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 119 | 119 | 'src' => $file_path, |
| 120 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 121 | - )); |
|
| 120 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 121 | + ) ); |
|
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * Generate the audio shortcode |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $disable_lightbox = true; |
| 138 | 138 | |
| 139 | - if( shortcode_exists( 'video' ) ) { |
|
| 139 | + if ( shortcode_exists( 'video' ) ) { |
|
| 140 | 140 | |
| 141 | 141 | $disable_wrapped_link = true; |
| 142 | 142 | |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 149 | 149 | 'src' => $file_path, |
| 150 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 151 | - )); |
|
| 150 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 151 | + ) ); |
|
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | 154 | * Generate the video shortcode |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | break; |
| 171 | 171 | |
| 172 | 172 | // if not image, do not set the lightbox (@since 1.5.3) |
| 173 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
| 173 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
| 174 | 174 | |
| 175 | 175 | $disable_lightbox = true; |
| 176 | 176 | |
@@ -180,10 +180,10 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | // If using Link to File, override the content. |
| 182 | 182 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
| 183 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
| 183 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
| 184 | 184 | |
| 185 | 185 | // Force the content to be the file name |
| 186 | - $content = $file_path_info["basename"]; |
|
| 186 | + $content = $file_path_info[ "basename" ]; |
|
| 187 | 187 | |
| 188 | 188 | // Restore the wrapped link |
| 189 | 189 | $disable_wrapped_link = false; |
@@ -191,14 +191,14 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Whether to use lightbox or not |
| 194 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
| 194 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 195 | 195 | |
| 196 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
| 196 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
| 197 | 197 | |
| 198 | 198 | } else { |
| 199 | 199 | |
| 200 | 200 | $link_atts = array( |
| 201 | - 'rel' => sprintf( "%s-%s", $gv_class, $entry['id'] ), |
|
| 201 | + 'rel' => sprintf( "%s-%s", $gv_class, $entry[ 'id' ] ), |
|
| 202 | 202 | 'target' => '_blank', |
| 203 | 203 | 'class' => 'thickbox', |
| 204 | 204 | ); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
| 223 | 223 | |
| 224 | 224 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
| 225 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
| 225 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | 228 | * Modify the link text (defaults to the file name) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $content = gravityview_get_link( $link, $content, $link_atts ); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - $output_arr[] = array( |
|
| 240 | + $output_arr[ ] = array( |
|
| 241 | 241 | 'file_path' => $file_path, |
| 242 | 242 | 'content' => $content |
| 243 | 243 | ); |
@@ -25,11 +25,11 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 27 | 27 | |
| 28 | - if( 'edit' === $context ) { |
|
| 28 | + if ( 'edit' === $context ) { |
|
| 29 | 29 | return $field_options; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $field_options['trim_words'] = array( |
|
| 32 | + $field_options[ 'trim_words' ] = array( |
|
| 33 | 33 | 'type' => 'number', |
| 34 | 34 | 'merge_tags' => false, |
| 35 | 35 | 'value' => null, |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | 'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ), |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - $field_options['make_clickable'] = array( |
|
| 40 | + $field_options[ 'make_clickable' ] = array( |
|
| 41 | 41 | 'type' => 'checkbox', |
| 42 | 42 | 'merge_tags' => false, |
| 43 | 43 | 'value' => 0, |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 29 | 29 | |
| 30 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
| 30 | + unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] ); |
|
| 31 | 31 | |
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
@@ -28,17 +28,17 @@ |
||
| 28 | 28 | |
| 29 | 29 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 30 | 30 | |
| 31 | - $field_options['number_format'] = array( |
|
| 31 | + $field_options[ 'number_format' ] = array( |
|
| 32 | 32 | 'type' => 'checkbox', |
| 33 | 33 | 'label' => __( 'Format number?', 'gravityview' ), |
| 34 | - 'desc' => __('Display numbers with thousands separators.', 'gravityview'), |
|
| 34 | + 'desc' => __( 'Display numbers with thousands separators.', 'gravityview' ), |
|
| 35 | 35 | 'value' => false, |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | - $field_options['decimals'] = array( |
|
| 38 | + $field_options[ 'decimals' ] = array( |
|
| 39 | 39 | 'type' => 'number', |
| 40 | 40 | 'label' => __( 'Decimals', 'gravityview' ), |
| 41 | - 'desc' => __('Precision of the number of decimal places. Leave blank to use existing precision.', 'gravityview'), |
|
| 41 | + 'desc' => __( 'Precision of the number of decimal places. Leave blank to use existing precision.', 'gravityview' ), |
|
| 42 | 42 | 'value' => '', |
| 43 | 43 | 'merge_tags' => false, |
| 44 | 44 | ); |
@@ -24,20 +24,20 @@ |
||
| 24 | 24 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 25 | 25 | |
| 26 | 26 | // If this is NOT the full address field, return default options. |
| 27 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 27 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 28 | 28 | return $field_options; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if( 'edit' === $context ) { |
|
| 31 | + if ( 'edit' === $context ) { |
|
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $add_options = array(); |
| 36 | 36 | |
| 37 | - $add_options['show_map_link'] = array( |
|
| 37 | + $add_options[ 'show_map_link' ] = array( |
|
| 38 | 38 | 'type' => 'checkbox', |
| 39 | 39 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
| 40 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
| 40 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
| 41 | 41 | 'value' => true, |
| 42 | 42 | 'merge_tags' => false, |
| 43 | 43 | ); |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 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 | return $field_options; |
| 35 | 35 | } |