@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * - Checks PHP version numbers |
| 208 | 208 | * - Sets self::$is_compatible[__CLASS__] to boolean value |
| 209 | 209 | * |
| 210 | - * @return boolean Is the extension supported? |
|
| 210 | + * @return boolean|null Is the extension supported? |
|
| 211 | 211 | */ |
| 212 | 212 | protected function is_extension_supported() { |
| 213 | 213 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | /** |
| 330 | 330 | * Add a notice to be displayed in the admin. |
| 331 | 331 | * |
| 332 | - * @param array $notice Array with `class` and `message` keys. The message is not escaped. |
|
| 332 | + * @param string $notice Array with `class` and `message` keys. The message is not escaped. |
|
| 333 | 333 | * |
| 334 | 334 | * @return void |
| 335 | 335 | */ |
@@ -291,7 +291,7 @@ |
||
| 291 | 291 | public function settings() { |
| 292 | 292 | |
| 293 | 293 | // If doing ajax, get outta here |
| 294 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
| 294 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
| 295 | 295 | return; |
| 296 | 296 | } |
| 297 | 297 | |
@@ -305,13 +305,13 @@ |
||
| 305 | 305 | $this->_remote_update_url, |
| 306 | 306 | $this->_path, |
| 307 | 307 | array( |
| 308 | - 'version' => $this->_version, // current version number |
|
| 309 | - 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
|
| 310 | - 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
| 311 | - 'item_name' => $this->_title, // name of this plugin |
|
| 312 | - 'author' => strip_tags( $this->_author ) // author of this plugin |
|
| 313 | - ) |
|
| 314 | - ); |
|
| 308 | + 'version' => $this->_version, // current version number |
|
| 309 | + 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
|
| 310 | + 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
| 311 | + 'item_name' => $this->_title, // name of this plugin |
|
| 312 | + 'author' => strip_tags( $this->_author ) // author of this plugin |
|
| 313 | + ) |
|
| 314 | + ); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
| 181 | 181 | |
| 182 | 182 | // Force the screen to be GravityView |
| 183 | - $tab['screen'] = 'gravityview'; |
|
| 183 | + $tab[ 'screen' ] = 'gravityview'; |
|
| 184 | 184 | |
| 185 | 185 | if ( class_exists( 'GravityView_Metabox_Tab' ) ) { |
| 186 | - $metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] ); |
|
| 186 | + $metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] ); |
|
| 187 | 187 | \GravityView_Metabox_Tabs::add( $metabox ); |
| 188 | 188 | } else { |
| 189 | - add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] ); |
|
| 189 | + add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] ); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | protected function is_extension_supported() { |
| 213 | 213 | |
| 214 | - self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible ); |
|
| 214 | + self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible ); |
|
| 215 | 215 | |
| 216 | 216 | if ( ! function_exists( 'gravityview' ) ) { |
| 217 | 217 | $message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) ); |
| 218 | - } else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) { |
|
| 219 | - $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' ); |
|
| 220 | - } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) { |
|
| 221 | - $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' ); |
|
| 218 | + } else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) { |
|
| 219 | + $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' ); |
|
| 220 | + } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) { |
|
| 221 | + $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' ); |
|
| 222 | 222 | } else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) { |
| 223 | 223 | $message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) ); |
| 224 | 224 | } else { |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | $locale = get_locale(); |
| 260 | 260 | |
| 261 | - if ( function_exists('get_user_locale') && is_admin() ) { |
|
| 261 | + if ( function_exists( 'get_user_locale' ) && is_admin() ) { |
|
| 262 | 262 | $locale = get_user_locale(); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // Traditional WordPress plugin locale filter |
| 266 | - $locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain ); |
|
| 266 | + $locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain ); |
|
| 267 | 267 | |
| 268 | 268 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
| 269 | 269 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | public function settings() { |
| 292 | 292 | |
| 293 | 293 | // If doing ajax, get outta here |
| 294 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
| 294 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) { |
|
| 295 | 295 | return; |
| 296 | 296 | } |
| 297 | 297 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | 'version' => $this->_version, // current version number |
| 309 | 309 | 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
| 310 | 310 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
| 311 | - 'item_name' => $this->_title, // name of this plugin |
|
| 311 | + 'item_name' => $this->_title, // name of this plugin |
|
| 312 | 312 | 'author' => strip_tags( $this->_author ) // author of this plugin |
| 313 | 313 | ) |
| 314 | 314 | ); |
@@ -337,16 +337,16 @@ discard block |
||
| 337 | 337 | */ |
| 338 | 338 | public static function add_notice( $notice = array() ) { |
| 339 | 339 | |
| 340 | - if ( is_array( $notice ) && empty( $notice['message'] ) ) { |
|
| 340 | + if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) { |
|
| 341 | 341 | gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) ); |
| 342 | 342 | return; |
| 343 | 343 | } else if ( is_string( $notice ) ) { |
| 344 | 344 | $notice = array( 'message' => $notice ); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
| 347 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
| 348 | 348 | |
| 349 | - self::$admin_notices []= $notice; |
|
| 349 | + self::$admin_notices [ ] = $notice; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /** |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | foreach ( self::$admin_notices as $key => $notice ) { |
| 363 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
| 364 | - echo wpautop( $notice['message'] ); |
|
| 363 | + echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">'; |
|
| 364 | + echo wpautop( $notice[ 'message' ] ); |
|
| 365 | 365 | echo '<div class="clear"></div>'; |
| 366 | 366 | echo '</div>'; |
| 367 | 367 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | * @param \GV\GF_Form $form The Gravity Form form. |
| 55 | 55 | * @param int $field_id The Gravity Form field ID for the $form. |
| 56 | 56 | * |
| 57 | - * @return \GV\Field|null The requested field or null if not found. |
|
| 57 | + * @return null|GF_Field The requested field or null if not found. |
|
| 58 | 58 | */ |
| 59 | 59 | public static function by_id( $form, $field_id ) { |
| 60 | 60 | |
@@ -27,17 +27,17 @@ discard block |
||
| 27 | 27 | * @return \GV\GF_Field|null The field implementation or null on error. |
| 28 | 28 | */ |
| 29 | 29 | public static function from_configuration( $configuration ) { |
| 30 | - if ( empty( $configuration['id'] ) || ! is_numeric( $configuration['id'] ) ) { |
|
| 30 | + if ( empty( $configuration[ 'id' ] ) || ! is_numeric( $configuration[ 'id' ] ) ) { |
|
| 31 | 31 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if ( empty( $configuration['form_id'] ) || ! $form = \GV\GF_Form::by_id( $configuration['form_id'] ) ) { |
|
| 35 | + if ( empty( $configuration[ 'form_id' ] ) || ! $form = \GV\GF_Form::by_id( $configuration[ 'form_id' ] ) ) { |
|
| 36 | 36 | gravityview()->log->error( 'Invalid configuration[form_id] supplied.' ); |
| 37 | 37 | return null; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $field = self::by_id( $form, $configuration['id'] ); |
|
| 40 | + $field = self::by_id( $form, $configuration[ 'id' ] ); |
|
| 41 | 41 | |
| 42 | 42 | if ( ! $field ) { |
| 43 | 43 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | /** This is a complex Gravity Forms input. */ |
| 113 | 113 | if ( $input = \GFFormsModel::get_input( $this->field, $this->ID ) ) { |
| 114 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
| 114 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
| 115 | 115 | } else { |
| 116 | 116 | /** This is a field with one label. */ |
| 117 | 117 | $label = $this->field->get_field_label( true, $this->label ); |
@@ -132,10 +132,8 @@ |
||
| 132 | 132 | /** |
| 133 | 133 | * Get a \GV\Field by Form and Field ID for this data source. |
| 134 | 134 | * |
| 135 | - * @param \GV\GF_Form $form The Gravity Form form ID. |
|
| 136 | - * @param int $field_id The Gravity Form field ID for the $form_id. |
|
| 137 | 135 | * |
| 138 | - * @return \GV\Field|null The requested field or null if not found. |
|
| 136 | + * @return null|GF_Field The requested field or null if not found. |
|
| 139 | 137 | */ |
| 140 | 138 | public static function get_field( /** varargs */ ) { |
| 141 | 139 | $args = func_get_args(); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $self = new self(); |
| 56 | 56 | $self->form = $form; |
| 57 | 57 | |
| 58 | - $self->ID = intval( $self->form['id'] ); |
|
| 58 | + $self->ID = intval( $self->form[ 'id' ] ); |
|
| 59 | 59 | |
| 60 | 60 | return $self; |
| 61 | 61 | } |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | * @return \GV\GF_Form|null An instance of this form or null if not found. |
| 71 | 71 | */ |
| 72 | 72 | public static function from_form( $form ) { |
| 73 | - if ( empty( $form['id'] ) ) { |
|
| 73 | + if ( empty( $form[ 'id' ] ) ) { |
|
| 74 | 74 | return null; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $self = new self(); |
| 78 | 78 | $self->form = $form; |
| 79 | - $self->ID = $self->form['id']; |
|
| 79 | + $self->ID = $self->form[ 'id' ]; |
|
| 80 | 80 | |
| 81 | 81 | return $self; |
| 82 | 82 | } |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | /** The offset and limit */ |
| 121 | 121 | if ( ! empty( $offset->limit ) ) { |
| 122 | - $paging['page_size'] = $offset->limit; |
|
| 122 | + $paging[ 'page_size' ] = $offset->limit; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if ( ! empty( $offset->offset ) ) { |
| 126 | - $paging['offset'] = $offset->offset; |
|
| 126 | + $paging[ 'offset' ] = $offset->offset; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) { |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function get_fields() { |
| 182 | 182 | $fields = array(); |
| 183 | - foreach ( $this['fields'] as $field ) { |
|
| 184 | - foreach ( empty( $field['inputs'] ) ? array( $field['id'] ) : wp_list_pluck( $field['inputs'], 'id' ) as $id ) { |
|
| 183 | + foreach ( $this[ 'fields' ] as $field ) { |
|
| 184 | + foreach ( empty( $field[ 'inputs' ] ) ? array( $field[ 'id' ] ) : wp_list_pluck( $field[ 'inputs' ], 'id' ) as $id ) { |
|
| 185 | 185 | if ( is_numeric( $id ) ) { |
| 186 | 186 | $fields[ $id ] = self::get_field( $this, $id ); |
| 187 | 187 | } else { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @return bool Whether the offset exists or not. |
| 219 | 219 | */ |
| 220 | 220 | public function offsetExists( $offset ) { |
| 221 | - return isset( $this->form[$offset] ); |
|
| 221 | + return isset( $this->form[ $offset ] ); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @return mixed The value of the requested form data. |
| 234 | 234 | */ |
| 235 | 235 | public function offsetGet( $offset ) { |
| 236 | - return $this->form[$offset]; |
|
| 236 | + return $this->form[ $offset ]; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | * @param \GV\Field $field The field to be ouput. |
| 24 | 24 | * |
| 25 | - * @return string|false The field output or false if "hide_empty" is set. |
|
| 25 | + * @return null|string The field output or false if "hide_empty" is set. |
|
| 26 | 26 | */ |
| 27 | 27 | public function the_field( \GV\Field $field ) { |
| 28 | 28 | $renderer = new Field_Renderer(); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function the_field( \GV\Field $field ) { |
| 28 | 28 | $renderer = new Field_Renderer(); |
| 29 | - $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source(); |
|
| 29 | + $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source(); |
|
| 30 | 30 | |
| 31 | 31 | return $renderer->render( $field, $this->view, $source, $this->entry->from_field( $field ), $this->request ); |
| 32 | 32 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | foreach ( $fields->all() as $field ) { |
| 64 | 64 | $context = Template_Context::from_template( $this, compact( 'field' ) ); |
| 65 | 65 | |
| 66 | - $form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form; |
|
| 66 | + $form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form; |
|
| 67 | 67 | $entry = $this->entry->from_field( $field ); |
| 68 | 68 | |
| 69 | 69 | if ( ! $entry ) { |
@@ -63,7 +63,6 @@ |
||
| 63 | 63 | * Initializer. |
| 64 | 64 | * |
| 65 | 65 | * @param \GV\View $view The View connected to this template. |
| 66 | - * @param \GV\Entry_Collection $entries A collection of entries for this view. |
|
| 67 | 66 | * @param \GV\Request $request The request context. |
| 68 | 67 | */ |
| 69 | 68 | public function __construct( Entry $entry, View $view, Request $request ) { |
@@ -113,18 +113,18 @@ |
||
| 113 | 113 | global $post; |
| 114 | 114 | |
| 115 | 115 | if ( ! $this->request->is_view() && $post ) { |
| 116 | - $specifics []= sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 117 | - $specifics []= sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
| 118 | - $specifics []= sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
| 119 | - $specifics []= sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 116 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 117 | + $specifics [ ] = sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
| 118 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
| 119 | + $specifics [ ] = sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $specifics []= sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 123 | - $specifics []= sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
| 124 | - $specifics []= sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
| 125 | - $specifics []= sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
| 122 | + $specifics [ ] = sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 123 | + $specifics [ ] = sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
| 124 | + $specifics [ ] = sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
| 125 | + $specifics [ ] = sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
| 126 | 126 | |
| 127 | - $specifics []= sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
| 127 | + $specifics [ ] = sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
| 128 | 128 | |
| 129 | 129 | return array_merge( $specifics, $templates ); |
| 130 | 130 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | * @param \GV\Field $field The Field. |
| 52 | 52 | * @param \GV\Request $request The request. |
| 53 | 53 | * |
| 54 | - * @return void |
|
| 54 | + * @return string|null |
|
| 55 | 55 | */ |
| 56 | 56 | public function __construct( \GV\View $view, \GV\Entry $entry = null, \GV\Field $field = null, \GV\Request $request = null ) { |
| 57 | 57 | add_filter( $this->filter_prefix . '_get_template_part', array( $this, 'add_id_specific_templates' ), 10, 3 ); |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | $additional = array(); |
| 99 | 99 | |
| 100 | 100 | // form-19-table-body.php |
| 101 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
| 101 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
| 102 | 102 | |
| 103 | 103 | // view-3-table-body.php |
| 104 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
| 104 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
| 105 | 105 | |
| 106 | 106 | global $post; |
| 107 | 107 | if ( $post ) { |
| 108 | 108 | // page-19-table-body.php |
| 109 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
| 109 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | // Combine with existing table-body.php and table.php |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | ob_start(); |
| 131 | 131 | |
| 132 | 132 | $request = new Mock_Request(); |
| 133 | - $request->returns['is_view'] = $this->view; |
|
| 133 | + $request->returns[ 'is_view' ] = $this->view; |
|
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | 136 | * You got one shot. One opportunity. To render all the widgets you have ever wanted. |
@@ -144,17 +144,17 @@ discard block |
||
| 144 | 144 | foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) { |
| 145 | 145 | /** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */ |
| 146 | 146 | if ( is_array( $wp_filter[ $hook ] ) ) { |
| 147 | - if ( ! empty( $wp_filter[ $hook ][10] ) ) { |
|
| 148 | - foreach ( $wp_filter[ $hook ][10] as $function_key => $callback ) { |
|
| 147 | + if ( ! empty( $wp_filter[ $hook ][ 10 ] ) ) { |
|
| 148 | + foreach ( $wp_filter[ $hook ][ 10 ] as $function_key => $callback ) { |
|
| 149 | 149 | if ( strpos( $function_key, 'render_widget_hooks' ) ) { |
| 150 | - unset( $wp_filter[ $hook ][10][ $function_key ] ); |
|
| 150 | + unset( $wp_filter[ $hook ][ 10 ][ $function_key ] ); |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | } else { |
| 155 | - foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) { |
|
| 155 | + foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
| 156 | 156 | if ( strpos( $function_key, 'render_widget_hooks' ) ) { |
| 157 | - unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] ); |
|
| 157 | + unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] ); |
|
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | if ( $this->entry ) { |
| 167 | 167 | |
| 168 | - $request->returns['is_entry'] = $this->entry; |
|
| 168 | + $request->returns[ 'is_entry' ] = $this->entry; |
|
| 169 | 169 | |
| 170 | 170 | global $post; |
| 171 | 171 | |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | * This allows us to fake it till we make it. |
| 200 | 200 | */ |
| 201 | 201 | $parameters = $this->view->settings->as_atts(); |
| 202 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
| 202 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
| 203 | 203 | $has_multisort = true; |
| 204 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
| 205 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
| 206 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
| 204 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
| 205 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
| 206 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | 'fields' => $this->view->fields->by_visible( $this->view ), |
| 223 | 223 | 'in_the_loop' => true, |
| 224 | 224 | ), empty( $parameters ) ? array() : array( |
| 225 | - 'paging' => $parameters['paging'], |
|
| 226 | - 'sorting' => $parameters['sorting'], |
|
| 225 | + 'paging' => $parameters[ 'paging' ], |
|
| 226 | + 'sorting' => $parameters[ 'sorting' ], |
|
| 227 | 227 | ), $post ? array( |
| 228 | 228 | 'post' => $post, |
| 229 | 229 | ) : array() ) ); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | * @param GF_Field|false $field |
| 185 | 185 | * @param string $value |
| 186 | 186 | * |
| 187 | - * @return mixed|string |
|
| 187 | + * @return string |
|
| 188 | 188 | */ |
| 189 | 189 | private static function maybe_urlencode( $field = false, $value = '' ) { |
| 190 | 190 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | * @param bool $url_encode Whether to URL-encode output |
| 350 | 350 | * @param bool $esc_html Whether to apply `esc_html()` to output |
| 351 | 351 | * |
| 352 | - * @return mixed |
|
| 352 | + * @return string |
|
| 353 | 353 | */ |
| 354 | 354 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 355 | 355 | |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | // matching regex => the value is the method to call to replace the value. |
| 53 | 53 | $gv_modifiers = array( |
| 54 | 54 | 'maxwords:(\d+)' => 'modifier_maxwords', /** @see modifier_maxwords */ |
| 55 | - 'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */ |
|
| 55 | + 'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */ |
|
| 56 | 56 | 'explode' => 'modifier_explode', /** @see modifier_explode */ |
| 57 | 57 | |
| 58 | 58 | /** @see modifier_strings */ |
| 59 | 59 | 'urlencode' => 'modifier_strings', |
| 60 | 60 | 'wpautop' => 'modifier_strings', |
| 61 | - 'esc_html' => 'modifier_strings', |
|
| 62 | - 'sanitize_html_class' => 'modifier_strings', |
|
| 61 | + 'esc_html' => 'modifier_strings', |
|
| 62 | + 'sanitize_html_class' => 'modifier_strings', |
|
| 63 | 63 | 'sanitize_title' => 'modifier_strings', |
| 64 | 64 | 'strtolower' => 'modifier_strings', |
| 65 | 65 | 'strtoupper' => 'modifier_strings', |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | $atts = array( |
| 459 | 459 | 'format' => self::get_format_from_modifiers( $exploded, false ), |
| 460 | - 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
| 460 | + 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
| 461 | 461 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
| 462 | 462 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
| 463 | 463 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $non_gv_modifiers = array_diff( $modifiers, array_keys( $gv_modifiers ) ); |
| 80 | 80 | |
| 81 | - $return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false); |
|
| 81 | + $return = $field->get_value_merge_tag( $value, '', array( 'currency' => '' ), array(), implode( '', $non_gv_modifiers ), $raw_value, false, false, 'text', false ); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | foreach ( $modifiers as $passed_modifier ) { |
| 85 | 85 | |
| 86 | - foreach( $gv_modifiers as $gv_modifier => $method ) { |
|
| 86 | + foreach ( $gv_modifiers as $gv_modifier => $method ) { |
|
| 87 | 87 | |
| 88 | 88 | // Uses ^ to only match the first modifier, to enforce same order as passed by GF |
| 89 | 89 | preg_match( '/^' . $gv_modifier . '/ism', $passed_modifier, $matches ); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | private static function modifier_timestamp( $raw_value, $matches ) { |
| 134 | 134 | |
| 135 | - if( empty( $matches[0] ) ) { |
|
| 135 | + if ( empty( $matches[ 0 ] ) ) { |
|
| 136 | 136 | return $raw_value; |
| 137 | 137 | } |
| 138 | 138 | |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | private static function modifier_maxwords( $raw_value, $matches, $field = null ) { |
| 163 | 163 | |
| 164 | - if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
| 164 | + if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
| 165 | 165 | return $raw_value; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $max = intval( $matches[1] ); |
|
| 168 | + $max = intval( $matches[ 1 ] ); |
|
| 169 | 169 | |
| 170 | 170 | $more_placeholder = '[GVMORE]'; |
| 171 | 171 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | private static function modifier_explode( $raw_value, $matches, $value, $field = null ) { |
| 235 | 235 | |
| 236 | 236 | // For JSON-encoded arrays |
| 237 | - if( $json_array = json_decode( $raw_value, true ) ) { |
|
| 237 | + if ( $json_array = json_decode( $raw_value, true ) ) { |
|
| 238 | 238 | return implode( ' ', $json_array ); |
| 239 | 239 | } |
| 240 | 240 | |
@@ -255,13 +255,13 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | private static function modifier_strings( $raw_value, $matches, $value = '', $field = null ) { |
| 257 | 257 | |
| 258 | - if( empty( $matches[0] ) ) { |
|
| 258 | + if ( empty( $matches[ 0 ] ) ) { |
|
| 259 | 259 | return $raw_value; |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $return = $raw_value; |
| 263 | 263 | |
| 264 | - switch( $matches[0] ) { |
|
| 264 | + switch ( $matches[ 0 ] ) { |
|
| 265 | 265 | case 'urlencode': |
| 266 | 266 | $return = urlencode( $raw_value ); |
| 267 | 267 | break; |
@@ -343,9 +343,9 @@ discard block |
||
| 343 | 343 | * @internal Fixed $form['title'] in Gravity Forms |
| 344 | 344 | * @see https://github.com/gravityforms/gravityforms/pull/27/files |
| 345 | 345 | */ |
| 346 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
| 347 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
| 348 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
| 346 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
| 347 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
| 348 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
| 349 | 349 | |
| 350 | 350 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format, $aux_data ); |
| 351 | 351 | } |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | // Is there is {gv_entry_link} or {gv_entry_link:[post id]} or {gv_entry_link:[post id]:[action]} merge tag? |
| 407 | 407 | preg_match_all( "/{gv_entry_link(?:\:(\d+)\:?(.*?))?}/ism", $original_text, $matches, PREG_SET_ORDER ); |
| 408 | 408 | |
| 409 | - if( empty( $matches ) ) { |
|
| 409 | + if ( empty( $matches ) ) { |
|
| 410 | 410 | return $original_text; |
| 411 | 411 | } |
| 412 | 412 | |
@@ -427,18 +427,18 @@ discard block |
||
| 427 | 427 | * } |
| 428 | 428 | */ |
| 429 | 429 | foreach ( $matches as $match ) { |
| 430 | - $full_tag = $match[0]; |
|
| 430 | + $full_tag = $match[ 0 ]; |
|
| 431 | 431 | |
| 432 | 432 | $link_args = array( |
| 433 | 433 | 'return' => 'url', |
| 434 | - 'entry_id' => $entry['id'], |
|
| 434 | + 'entry_id' => $entry[ 'id' ], |
|
| 435 | 435 | 'post_id' => \GV\Utils::get( $match, 1, null ), |
| 436 | 436 | 'action' => \GV\Utils::get( $match, 2, 'read' ), |
| 437 | 437 | ); |
| 438 | 438 | |
| 439 | 439 | $entry_link = $Shortcode->read_shortcode( $link_args, null, 'gv_entry_link_merge_tag' ); |
| 440 | 440 | |
| 441 | - if( $url_encode ) { |
|
| 441 | + if ( $url_encode ) { |
|
| 442 | 442 | $entry_link = urlencode( $entry_link ); |
| 443 | 443 | } |
| 444 | 444 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
| 476 | 476 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
| 477 | 477 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
| 478 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
| 478 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
| 479 | 479 | ); |
| 480 | 480 | |
| 481 | 481 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -552,8 +552,8 @@ discard block |
||
| 552 | 552 | return $original_text; |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - foreach ( (array) $matches as $match ) { |
|
| 556 | - $full_tag = $match[0]; |
|
| 555 | + foreach ( (array)$matches as $match ) { |
|
| 556 | + $full_tag = $match[ 0 ]; |
|
| 557 | 557 | $modifier = \GV\Utils::get( $match, 2, 'permalink' ); |
| 558 | 558 | |
| 559 | 559 | $replacement = false; |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | $replacement = esc_html( $replacement ); |
| 572 | 572 | } |
| 573 | 573 | |
| 574 | - if( $url_encode ) { |
|
| 574 | + if ( $url_encode ) { |
|
| 575 | 575 | $replacement = urlencode( $replacement ); |
| 576 | 576 | } |
| 577 | 577 | |
@@ -611,14 +611,14 @@ discard block |
||
| 611 | 611 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
| 612 | 612 | |
| 613 | 613 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
| 614 | - if( empty( $matches ) ) { |
|
| 614 | + if ( empty( $matches ) ) { |
|
| 615 | 615 | return $text; |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | foreach ( $matches as $match ) { |
| 619 | 619 | |
| 620 | - $full_tag = $match[0]; |
|
| 621 | - $property = $match[1]; |
|
| 620 | + $full_tag = $match[ 0 ]; |
|
| 621 | + $property = $match[ 1 ]; |
|
| 622 | 622 | |
| 623 | 623 | $value = stripslashes_deep( \GV\Utils::_GET( $property ) ); |
| 624 | 624 | |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | * @since 1.15 |
| 643 | 643 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
| 644 | 644 | */ |
| 645 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
| 645 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
| 646 | 646 | |
| 647 | 647 | $value = $esc_html ? esc_html( $value ) : $value; |
| 648 | 648 | |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | * @param[in] array $form Gravity Forms form array |
| 654 | 654 | * @param[in] array $entry Entry array |
| 655 | 655 | */ |
| 656 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
| 656 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
| 657 | 657 | |
| 658 | 658 | $text = str_replace( $full_tag, $value, $text ); |
| 659 | 659 | } |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class GV_License_Handler extends \GV\License_Handler { |
| 11 | 11 | /** |
| 12 | - * @param \GV\Addon_Settings $GFAddOn |
|
| 13 | 12 | * |
| 14 | 13 | * @deprecated Use \GV\License_Handler::get instead |
| 15 | 14 | * |
@@ -219,6 +219,9 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | + /** |
|
| 223 | + * @param string $key |
|
| 224 | + */ |
|
| 222 | 225 | public function getCurrentFieldSetting( $key ) { |
| 223 | 226 | $settings = $this->getCurrentField('field_settings'); |
| 224 | 227 | |
@@ -725,6 +728,7 @@ discard block |
||
| 725 | 728 | * |
| 726 | 729 | * @inheritdoc |
| 727 | 730 | * @see Gamajo_Template_Loader::locate_template() |
| 731 | + * @param string $template_names |
|
| 728 | 732 | * @return null|string NULL: Template not found; String: path to template |
| 729 | 733 | */ |
| 730 | 734 | function locate_template( $template_names, $load = false, $require_once = true ) { |
@@ -328,34 +328,34 @@ discard block |
||
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
| 331 | - * Get the fields for a specific context |
|
| 332 | - * |
|
| 333 | - * @since 1.19.2 |
|
| 334 | - * |
|
| 331 | + * Get the fields for a specific context |
|
| 332 | + * |
|
| 333 | + * @since 1.19.2 |
|
| 334 | + * |
|
| 335 | 335 | * @param string $context [Optional] "directory", "single", or "edit" |
| 336 | 336 | * |
| 337 | 337 | * @return array Array of GravityView field layout configurations |
| 338 | 338 | */ |
| 339 | 339 | public function getContextFields( $context = '' ) { |
| 340 | 340 | |
| 341 | - if( '' === $context ) { |
|
| 342 | - $context = $this->getContext(); |
|
| 343 | - } |
|
| 341 | + if( '' === $context ) { |
|
| 342 | + $context = $this->getContext(); |
|
| 343 | + } |
|
| 344 | 344 | |
| 345 | 345 | $fields = $this->getFields(); |
| 346 | 346 | |
| 347 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 347 | + foreach ( (array) $fields as $key => $context_fields ) { |
|
| 348 | 348 | |
| 349 | - // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 350 | - $matches = explode( '_', $key ); |
|
| 349 | + // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
|
| 350 | + $matches = explode( '_', $key ); |
|
| 351 | 351 | |
| 352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 353 | - return $context_fields; |
|
| 354 | - } |
|
| 355 | - } |
|
| 352 | + if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 353 | + return $context_fields; |
|
| 354 | + } |
|
| 355 | + } |
|
| 356 | 356 | |
| 357 | 357 | return array(); |
| 358 | - } |
|
| 358 | + } |
|
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | 361 | * @param array $fields |
@@ -448,10 +448,10 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | public function getPaging() { |
| 450 | 450 | |
| 451 | - $default_params = array( |
|
| 452 | - 'offset' => 0, |
|
| 453 | - 'page_size' => 20, |
|
| 454 | - ); |
|
| 451 | + $default_params = array( |
|
| 452 | + 'offset' => 0, |
|
| 453 | + 'page_size' => 20, |
|
| 454 | + ); |
|
| 455 | 455 | |
| 456 | 456 | return wp_parse_args( $this->paging, $default_params ); |
| 457 | 457 | } |
@@ -508,10 +508,10 @@ discard block |
||
| 508 | 508 | public function getSorting() { |
| 509 | 509 | |
| 510 | 510 | $defaults_params = array( |
| 511 | - 'sort_field' => 'date_created', |
|
| 512 | - 'sort_direction' => 'ASC', |
|
| 513 | - 'is_numeric' => false, |
|
| 514 | - ); |
|
| 511 | + 'sort_field' => 'date_created', |
|
| 512 | + 'sort_direction' => 'ASC', |
|
| 513 | + 'is_numeric' => false, |
|
| 514 | + ); |
|
| 515 | 515 | |
| 516 | 516 | return wp_parse_args( $this->sorting, $defaults_params ); |
| 517 | 517 | } |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | */ |
| 838 | 838 | public function render_widget_hooks( $view_id_or_context ) { |
| 839 | 839 | |
| 840 | - /** |
|
| 840 | + /** |
|
| 841 | 841 | * @deprecated Numeric argument is deprecated. Pass a \GV\Template_Context instead. |
| 842 | 842 | */ |
| 843 | 843 | if ( is_numeric( $view_id_or_context ) ) { |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | die; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
| 19 | +if ( ! class_exists( '\GV\Gamajo_Template_Loader' ) ) { |
|
| 20 | 20 | require( GRAVITYVIEW_DIR . 'future/lib/class-gamajo-template-loader.php' ); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -157,8 +157,8 @@ discard block |
||
| 157 | 157 | 'atts' => NULL, |
| 158 | 158 | ) ); |
| 159 | 159 | |
| 160 | - foreach ($atts as $key => $value) { |
|
| 161 | - if( is_null( $value ) ) { |
|
| 160 | + foreach ( $atts as $key => $value ) { |
|
| 161 | + if ( is_null( $value ) ) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | $this->{$key} = $value; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | static function getInstance( $passed_post = NULL ) { |
| 190 | 190 | |
| 191 | - if( empty( self::$instance ) ) { |
|
| 191 | + if ( empty( self::$instance ) ) { |
|
| 192 | 192 | self::$instance = new self( $passed_post ); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function getCurrentField( $key = NULL ) { |
| 203 | 203 | |
| 204 | - if( !empty( $key ) ) { |
|
| 205 | - if( isset( $this->_current_field[ $key ] ) ) { |
|
| 204 | + if ( ! empty( $key ) ) { |
|
| 205 | + if ( isset( $this->_current_field[ $key ] ) ) { |
|
| 206 | 206 | return $this->_current_field[ $key ]; |
| 207 | 207 | } |
| 208 | 208 | return NULL; |
@@ -213,16 +213,16 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | public function setCurrentFieldSetting( $key, $value ) { |
| 215 | 215 | |
| 216 | - if( !empty( $this->_current_field ) ) { |
|
| 217 | - $this->_current_field['field_settings'][ $key ] = $value; |
|
| 216 | + if ( ! empty( $this->_current_field ) ) { |
|
| 217 | + $this->_current_field[ 'field_settings' ][ $key ] = $value; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function getCurrentFieldSetting( $key ) { |
| 223 | - $settings = $this->getCurrentField('field_settings'); |
|
| 223 | + $settings = $this->getCurrentField( 'field_settings' ); |
|
| 224 | 224 | |
| 225 | - if( $settings && !empty( $settings[ $key ] ) ) { |
|
| 225 | + if ( $settings && ! empty( $settings[ $key ] ) ) { |
|
| 226 | 226 | return $settings[ $key ]; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public function getAtts( $key = NULL ) { |
| 255 | 255 | |
| 256 | - if( !empty( $key ) ) { |
|
| 257 | - if( isset( $this->atts[ $key ] ) ) { |
|
| 256 | + if ( ! empty( $key ) ) { |
|
| 257 | + if ( isset( $this->atts[ $key ] ) ) { |
|
| 258 | 258 | return $this->atts[ $key ]; |
| 259 | 259 | } |
| 260 | 260 | return NULL; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $fields = empty( $this->fields ) ? NULL : $this->fields; |
| 322 | 322 | |
| 323 | - if( $fields && !empty( $key ) ) { |
|
| 323 | + if ( $fields && ! empty( $key ) ) { |
|
| 324 | 324 | $fields = isset( $fields[ $key ] ) ? $fields[ $key ] : NULL; |
| 325 | 325 | } |
| 326 | 326 | |
@@ -338,18 +338,18 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | public function getContextFields( $context = '' ) { |
| 340 | 340 | |
| 341 | - if( '' === $context ) { |
|
| 341 | + if ( '' === $context ) { |
|
| 342 | 342 | $context = $this->getContext(); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | $fields = $this->getFields(); |
| 346 | 346 | |
| 347 | - foreach ( (array) $fields as $key => $context_fields ) { |
|
| 347 | + foreach ( (array)$fields as $key => $context_fields ) { |
|
| 348 | 348 | |
| 349 | 349 | // Formatted as `{context}_{template id}-{zone name}`, so we want just the $context to match against |
| 350 | 350 | $matches = explode( '_', $key ); |
| 351 | 351 | |
| 352 | - if( isset( $matches[0] ) && $matches[0] === $context ) { |
|
| 352 | + if ( isset( $matches[ 0 ] ) && $matches[ 0 ] === $context ) { |
|
| 353 | 353 | return $context_fields; |
| 354 | 354 | } |
| 355 | 355 | } |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function getField( $key ) { |
| 372 | 372 | |
| 373 | - if( !empty( $key ) ) { |
|
| 374 | - if( isset( $this->fields[ $key ] ) ) { |
|
| 373 | + if ( ! empty( $key ) ) { |
|
| 374 | + if ( isset( $this->fields[ $key ] ) ) { |
|
| 375 | 375 | return $this->fields[ $key ]; |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -477,8 +477,8 @@ discard block |
||
| 477 | 477 | public function getPaginationCounts() { |
| 478 | 478 | |
| 479 | 479 | $paging = $this->getPaging(); |
| 480 | - $offset = $paging['offset']; |
|
| 481 | - $page_size = $paging['page_size']; |
|
| 480 | + $offset = $paging[ 'offset' ]; |
|
| 481 | + $page_size = $paging[ 'page_size' ]; |
|
| 482 | 482 | $total = $this->getTotalEntries(); |
| 483 | 483 | |
| 484 | 484 | if ( empty( $total ) ) { |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | */ |
| 500 | 500 | list( $first, $last, $total ) = apply_filters( 'gravityview_pagination_counts', array( $first, $last, $total ) ); |
| 501 | 501 | |
| 502 | - return array( 'first' => (int) $first, 'last' => (int) $last, 'total' => (int) $total ); |
|
| 502 | + return array( 'first' => (int)$first, 'last' => (int)$last, 'total' => (int)$total ); |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
@@ -595,16 +595,16 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | public function getCurrentEntry() { |
| 597 | 597 | |
| 598 | - if( in_array( $this->getContext(), array( 'edit', 'single') ) ) { |
|
| 598 | + if ( in_array( $this->getContext(), array( 'edit', 'single' ) ) ) { |
|
| 599 | 599 | $entries = $this->getEntries(); |
| 600 | - $entry = $entries[0]; |
|
| 600 | + $entry = $entries[ 0 ]; |
|
| 601 | 601 | } else { |
| 602 | 602 | $entry = $this->_current_entry; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | /** @since 1.16 Fixes DataTables empty entry issue */ |
| 606 | - if ( empty( $entry ) && ! empty( $this->_current_field['entry'] ) ) { |
|
| 607 | - $entry = $this->_current_field['entry']; |
|
| 606 | + if ( empty( $entry ) && ! empty( $this->_current_field[ 'entry' ] ) ) { |
|
| 607 | + $entry = $this->_current_field[ 'entry' ]; |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | return $entry; |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | public function renderZone( $zone = '', $atts = array(), $echo = true ) { |
| 645 | 645 | |
| 646 | 646 | if ( empty( $zone ) ) { |
| 647 | - gravityview()->log->error( 'No zone defined.'); |
|
| 647 | + gravityview()->log->error( 'No zone defined.' ); |
|
| 648 | 648 | return NULL; |
| 649 | 649 | } |
| 650 | 650 | |
@@ -653,16 +653,16 @@ discard block |
||
| 653 | 653 | 'context' => $this->getContext(), |
| 654 | 654 | 'entry' => $this->getCurrentEntry(), |
| 655 | 655 | 'form' => $this->getForm(), |
| 656 | - 'hide_empty' => $this->getAtts('hide_empty'), |
|
| 656 | + 'hide_empty' => $this->getAtts( 'hide_empty' ), |
|
| 657 | 657 | ); |
| 658 | 658 | |
| 659 | 659 | $final_atts = wp_parse_args( $atts, $defaults ); |
| 660 | 660 | |
| 661 | 661 | $output = ''; |
| 662 | 662 | |
| 663 | - $final_atts['zone_id'] = "{$final_atts['context']}_{$final_atts['slug']}-{$zone}"; |
|
| 663 | + $final_atts[ 'zone_id' ] = "{$final_atts[ 'context' ]}_{$final_atts[ 'slug' ]}-{$zone}"; |
|
| 664 | 664 | |
| 665 | - $fields = $this->getField( $final_atts['zone_id'] ); |
|
| 665 | + $fields = $this->getField( $final_atts[ 'zone_id' ] ); |
|
| 666 | 666 | |
| 667 | 667 | // Backward compatibility |
| 668 | 668 | if ( 'table' === $this->getTemplatePartSlug() ) { |
@@ -672,19 +672,19 @@ discard block |
||
| 672 | 672 | * @param \GravityView_View $this |
| 673 | 673 | * @deprecated Use `gravityview/template/table/fields` |
| 674 | 674 | */ |
| 675 | - $fields = apply_filters("gravityview_table_cells", $fields, $this ); |
|
| 675 | + $fields = apply_filters( "gravityview_table_cells", $fields, $this ); |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | if ( empty( $fields ) ) { |
| 679 | 679 | |
| 680 | - gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts['zone_id'] ) ); |
|
| 680 | + gravityview()->log->error( 'Empty zone configuration for {zone_id}.', array( 'zone_id' => $final_atts[ 'zone_id' ] ) ); |
|
| 681 | 681 | |
| 682 | 682 | return NULL; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | $field_output = ''; |
| 686 | 686 | foreach ( $fields as $field ) { |
| 687 | - $final_atts['field'] = $field; |
|
| 687 | + $final_atts[ 'field' ] = $field; |
|
| 688 | 688 | |
| 689 | 689 | $field_output .= gravityview_field_output( $final_atts ); |
| 690 | 690 | } |
@@ -701,17 +701,17 @@ discard block |
||
| 701 | 701 | return NULL; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 705 | - $output .= '<div class="'.gravityview_sanitize_html_class( $final_atts['wrapper_class'] ).'">'; |
|
| 704 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 705 | + $output .= '<div class="' . gravityview_sanitize_html_class( $final_atts[ 'wrapper_class' ] ) . '">'; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | $output .= $field_output; |
| 709 | 709 | |
| 710 | - if( !empty( $final_atts['wrapper_class'] ) ) { |
|
| 710 | + if ( ! empty( $final_atts[ 'wrapper_class' ] ) ) { |
|
| 711 | 711 | $output .= '</div>'; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - if( $echo ) { |
|
| 714 | + if ( $echo ) { |
|
| 715 | 715 | echo $output; |
| 716 | 716 | } |
| 717 | 717 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | */ |
| 730 | 730 | function locate_template( $template_names, $load = false, $require_once = true ) { |
| 731 | 731 | |
| 732 | - if( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 732 | + if ( is_string( $template_names ) && isset( $this->located_templates[ $template_names ] ) ) { |
|
| 733 | 733 | |
| 734 | 734 | $located = $this->located_templates[ $template_names ]; |
| 735 | 735 | |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | // Set $load to always false so we handle it here. |
| 739 | 739 | $located = parent::locate_template( $template_names, false, $require_once ); |
| 740 | 740 | |
| 741 | - if( is_string( $template_names ) ) { |
|
| 741 | + if ( is_string( $template_names ) ) { |
|
| 742 | 742 | $this->located_templates[ $template_names ] = $located; |
| 743 | 743 | } |
| 744 | 744 | } |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | * @return mixed|null The stored data. |
| 757 | 757 | */ |
| 758 | 758 | public function __get( $name ) { |
| 759 | - if( isset( $this->{$name} ) ) { |
|
| 759 | + if ( isset( $this->{$name} ) ) { |
|
| 760 | 760 | return $this->{$name}; |
| 761 | 761 | } else { |
| 762 | 762 | return NULL; |
@@ -785,17 +785,17 @@ discard block |
||
| 785 | 785 | $additional = array(); |
| 786 | 786 | |
| 787 | 787 | // form-19-table-body.php |
| 788 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 788 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->getFormId(), $slug, $name ); |
|
| 789 | 789 | |
| 790 | - if( $view_id = $this->getViewId() ) { |
|
| 790 | + if ( $view_id = $this->getViewId() ) { |
|
| 791 | 791 | // view-3-table-body.php |
| 792 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
| 792 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $view_id, $slug, $name ); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - if( $this->getPostId() ) { |
|
| 795 | + if ( $this->getPostId() ) { |
|
| 796 | 796 | |
| 797 | 797 | // page-19-table-body.php |
| 798 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 798 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $this->getPostId(), $slug, $name ); |
|
| 799 | 799 | } |
| 800 | 800 | |
| 801 | 801 | // Combine with existing table-body.php and table.php |
@@ -817,7 +817,7 @@ discard block |
||
| 817 | 817 | |
| 818 | 818 | gravityview()->log->debug( 'Rendering Template File: {path}', array( 'path' => $template_file ) ); |
| 819 | 819 | |
| 820 | - if( !empty( $template_file) ) { |
|
| 820 | + if ( ! empty( $template_file ) ) { |
|
| 821 | 821 | |
| 822 | 822 | if ( $require_once ) { |
| 823 | 823 | require_once( $template_file ); |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | // Prevent being called twice |
| 894 | 894 | if ( did_action( "gravityview/widgets/$zone/{$view->ID}/rendered" ) ) { |
| 895 | - gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone.'_'.$view->ID.'_widgets' ) ); |
|
| 895 | + gravityview()->log->debug( 'Not rendering {zone}; already rendered', array( 'zone' => $zone . '_' . $view->ID . '_widgets' ) ); |
|
| 896 | 896 | return; |
| 897 | 897 | } |
| 898 | 898 | |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | * @param string $zone Current widget zone, either `header` or `footer` |
| 915 | 915 | * @param array $widgets Array of widget configurations for the current zone, as set by `gravityview_get_current_view_data()['widgets']` |
| 916 | 916 | */ |
| 917 | - $css_class = apply_filters('gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
| 917 | + $css_class = apply_filters( 'gravityview/widgets/wrapper_css_class', $default_css_class, $zone, $widgets->as_configuration() ); |
|
| 918 | 918 | |
| 919 | 919 | $css_class = gravityview_sanitize_html_class( $css_class ); |
| 920 | 920 | |
@@ -922,15 +922,15 @@ discard block |
||
| 922 | 922 | ?> |
| 923 | 923 | <div class="<?php echo $css_class; ?>"> |
| 924 | 924 | <?php |
| 925 | - foreach( $rows as $row ) { |
|
| 926 | - foreach( $row as $col => $areas ) { |
|
| 925 | + foreach ( $rows as $row ) { |
|
| 926 | + foreach ( $row as $col => $areas ) { |
|
| 927 | 927 | $column = ( $col == '2-2' ) ? '1-2 gv-right' : "$col gv-left"; |
| 928 | 928 | ?> |
| 929 | 929 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 930 | 930 | <?php |
| 931 | 931 | if ( ! empty( $areas ) ) { |
| 932 | 932 | foreach ( $areas as $area ) { |
| 933 | - foreach ( $widgets->by_position( $zone . '_' . $area['areaid'] )->all() as $widget ) { |
|
| 933 | + foreach ( $widgets->by_position( $zone . '_' . $area[ 'areaid' ] )->all() as $widget ) { |
|
| 934 | 934 | do_action( sprintf( 'gravityview/widgets/%s/render', $widget->get_widget_id() ), $widget->configuration->all(), null, $view_id_or_context ); |
| 935 | 935 | } |
| 936 | 936 | } |