@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | var $is_searchable = true; |
| 16 | 16 | |
| 17 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 17 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 18 | 18 | |
| 19 | 19 | var $_gf_field_class_name = 'GF_Field_Post_Tags'; |
| 20 | 20 | |
@@ -29,15 +29,15 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 31 | 31 | |
| 32 | - if( 'edit' === $context ) { |
|
| 32 | + if ( 'edit' === $context ) { |
|
| 33 | 33 | return $field_options; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 37 | - $this->add_field_support('link_to_term', $field_options ); |
|
| 38 | - $this->add_field_support('new_window', $field_options ); |
|
| 36 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 37 | + $this->add_field_support( 'link_to_term', $field_options ); |
|
| 38 | + $this->add_field_support( 'new_window', $field_options ); |
|
| 39 | 39 | |
| 40 | - $field_options['new_window']['requires'] = 'link_to_term'; |
|
| 40 | + $field_options[ 'new_window' ][ 'requires' ] = 'link_to_term'; |
|
| 41 | 41 | |
| 42 | 42 | return $field_options; |
| 43 | 43 | } |
@@ -45,13 +45,13 @@ |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $field_options['link_phone'] = array( |
| 48 | - 'type' => 'checkbox', |
|
| 49 | - 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
| 50 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 51 | - 'value' => true, |
|
| 52 | - 'group' => 'display', |
|
| 53 | - 'priority' => 100, |
|
| 54 | - ); |
|
| 48 | + 'type' => 'checkbox', |
|
| 49 | + 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
| 50 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 51 | + 'value' => true, |
|
| 52 | + 'group' => 'display', |
|
| 53 | + 'priority' => 100, |
|
| 54 | + ); |
|
| 55 | 55 | |
| 56 | 56 | return $field_options; |
| 57 | 57 | } |
@@ -40,14 +40,14 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 42 | 42 | |
| 43 | - if( 'edit' === $context ) { |
|
| 43 | + if ( 'edit' === $context ) { |
|
| 44 | 44 | return $field_options; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $field_options['link_phone'] = array( |
|
| 47 | + $field_options[ 'link_phone' ] = array( |
|
| 48 | 48 | 'type' => 'checkbox', |
| 49 | 49 | 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
| 50 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
| 50 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview' ), |
|
| 51 | 51 | 'value' => true, |
| 52 | 52 | 'group' => 'display', |
| 53 | 53 | 'priority' => 100, |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->label = esc_html__( 'Other Entries', 'gravityview' ); |
| 30 | - $this->description = esc_html__('Display other entries created by the entry creator.', 'gravityview'); |
|
| 30 | + $this->description = esc_html__( 'Display other entries created by the entry creator.', 'gravityview' ); |
|
| 31 | 31 | parent::__construct(); |
| 32 | 32 | } |
| 33 | 33 | |
@@ -37,34 +37,34 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 39 | 39 | |
| 40 | - if( 'edit' === $context ) { |
|
| 40 | + if ( 'edit' === $context ) { |
|
| 41 | 41 | return $field_options; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // No "Link to single entry"; all the items will be links to entries! |
| 45 | - unset( $field_options['show_as_link'] ); |
|
| 45 | + unset( $field_options[ 'show_as_link' ] ); |
|
| 46 | 46 | |
| 47 | 47 | $new_options = array(); |
| 48 | 48 | |
| 49 | - $new_options['link_format'] = array( |
|
| 49 | + $new_options[ 'link_format' ] = array( |
|
| 50 | 50 | 'type' => 'text', |
| 51 | 51 | 'label' => __( 'Entry link text (required)', 'gravityview' ), |
| 52 | - 'value' => __('Entry #{entry_id}', 'gravityview'), |
|
| 52 | + 'value' => __( 'Entry #{entry_id}', 'gravityview' ), |
|
| 53 | 53 | 'merge_tags' => 'force', |
| 54 | 54 | 'group' => 'field', |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | - $new_options['after_link'] = array( |
|
| 57 | + $new_options[ 'after_link' ] = array( |
|
| 58 | 58 | 'type' => 'textarea', |
| 59 | 59 | 'label' => __( 'Text or HTML to display after the link (optional)', 'gravityview' ), |
| 60 | - 'desc' => __('This content will be displayed below each entry link.', 'gravityview'), |
|
| 60 | + 'desc' => __( 'This content will be displayed below each entry link.', 'gravityview' ), |
|
| 61 | 61 | 'value' => '', |
| 62 | 62 | 'merge_tags' => 'force', |
| 63 | 63 | 'class' => 'widefat code', |
| 64 | 64 | 'group' => 'field', |
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | - $new_options['page_size'] = array( |
|
| 67 | + $new_options[ 'page_size' ] = array( |
|
| 68 | 68 | 'type' => 'number', |
| 69 | 69 | 'label' => __( 'Entries to Display', 'gravityview' ), |
| 70 | 70 | 'desc' => __( 'What is the maximum number of entries that should be shown?', 'gravityview' ) . ' ' . sprintf( _x( 'Set to %s for no maximum.', '%s replaced with a formatted 0', 'gravityview' ), '<code>0</code>' ), |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | 'group' => 'field', |
| 75 | 75 | ); |
| 76 | 76 | |
| 77 | - $new_options['no_entries_hide'] = array( |
|
| 77 | + $new_options[ 'no_entries_hide' ] = array( |
|
| 78 | 78 | 'type' => 'checkbox', |
| 79 | 79 | 'label' => __( 'Hide if no entries', 'gravityview' ), |
| 80 | 80 | 'desc' => __( 'Don\'t display this field if the entry creator has no other entries', 'gravityview' ), |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | 'group' => 'visibility', |
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | - $new_options['no_entries_text'] = array( |
|
| 85 | + $new_options[ 'no_entries_text' ] = array( |
|
| 86 | 86 | 'type' => 'text', |
| 87 | 87 | 'label' => __( 'No Entries Text', 'gravityview' ), |
| 88 | 88 | 'desc' => __( 'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview' ), |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | foreach ( $filters as $filter ) { |
| 118 | 118 | foreach ( $wp_filter[ $filter ] as $priority => $callbacks ) { |
| 119 | 119 | foreach ( $callbacks as $id => $callback ) { |
| 120 | - if ( ! is_array( $callback['function'] ) ) { |
|
| 120 | + if ( ! is_array( $callback[ 'function' ] ) ) { |
|
| 121 | 121 | continue; |
| 122 | 122 | } |
| 123 | - if ( $callback['function'][0] instanceof \GV\Widget ) { |
|
| 124 | - $remove[] = array( $filter, $priority, $id ); |
|
| 123 | + if ( $callback[ 'function' ][ 0 ] instanceof \GV\Widget ) { |
|
| 124 | + $remove[ ] = array( $filter, $priority, $id ); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | foreach ( $remove as $r ) { |
| 131 | 131 | list( $filter, $priority, $id ) = $r; |
| 132 | - $removed[] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] ); |
|
| 132 | + $removed[ ] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] ); |
|
| 133 | 133 | unset( $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] ); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -153,10 +153,10 @@ discard block |
||
| 153 | 153 | public function filter_entries( $search_criteria, $form_id = null, $args = array(), $force_search_criteria = false ) { |
| 154 | 154 | $context = $this->context; |
| 155 | 155 | |
| 156 | - $created_by = $context->entry['created_by']; |
|
| 156 | + $created_by = $context->entry[ 'created_by' ]; |
|
| 157 | 157 | |
| 158 | 158 | /** Filter entries by approved and created_by. */ |
| 159 | - $search_criteria['field_filters'][] = array( |
|
| 159 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 160 | 160 | 'key' => 'created_by', |
| 161 | 161 | 'value' => $created_by, |
| 162 | 162 | 'operator' => 'is' |
@@ -176,14 +176,14 @@ discard block |
||
| 176 | 176 | $criteria = apply_filters( 'gravityview/field/other_entries/criteria', $search_criteria, $context->view->settings->as_atts(), $context->view->form->ID, $context ); |
| 177 | 177 | |
| 178 | 178 | /** Force mode all and filter out our own entry. */ |
| 179 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
| 180 | - $search_criteria['field_filters'][] = array( |
|
| 179 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
| 180 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 181 | 181 | 'key' => 'id', |
| 182 | 182 | 'value' => $context->entry->ID, |
| 183 | 183 | 'operator' => 'isnot' |
| 184 | 184 | ); |
| 185 | 185 | |
| 186 | - $search_criteria['paging']['page_size'] = $context->field->page_size ? : 10; |
|
| 186 | + $search_criteria[ 'paging' ][ 'page_size' ] = $context->field->page_size ?: 10; |
|
| 187 | 187 | |
| 188 | 188 | return $search_criteria; |
| 189 | 189 | } |
@@ -31,16 +31,16 @@ discard block |
||
| 31 | 31 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
| 32 | 32 | |
| 33 | 33 | // It makes no sense to use this as the link. |
| 34 | - unset( $field_options['show_as_link'] ); |
|
| 34 | + unset( $field_options[ 'show_as_link' ] ); |
|
| 35 | 35 | |
| 36 | - if( 'edit' === $context ) { |
|
| 36 | + if ( 'edit' === $context ) { |
|
| 37 | 37 | return $field_options; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @since 1.8 |
| 42 | 42 | */ |
| 43 | - $field_options['anchor_text'] = array( |
|
| 43 | + $field_options[ 'anchor_text' ] = array( |
|
| 44 | 44 | 'type' => 'text', |
| 45 | 45 | 'label' => __( 'Link Text:', 'gravityview' ), |
| 46 | 46 | 'desc' => __( 'Define custom link text. Leave blank to display the URL', 'gravityview' ), |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'priority' => 1000, |
| 50 | 50 | ); |
| 51 | 51 | |
| 52 | - $field_options['truncatelink'] = array( |
|
| 52 | + $field_options[ 'truncatelink' ] = array( |
|
| 53 | 53 | 'type' => 'checkbox', |
| 54 | 54 | 'value' => true, |
| 55 | 55 | 'label' => __( 'Shorten Link Display', 'gravityview' ), |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | * Set default to opening in new links for back-compatibility with Version 1.5.1 |
| 65 | 65 | * @link https://github.com/gravityview/GravityView/commit/e12e76e2d032754227728d41e65103042d4f75ec |
| 66 | 66 | */ |
| 67 | - $field_options['new_window']['value'] = true; |
|
| 68 | - $field_options['new_window']['priority'] = 2000; |
|
| 67 | + $field_options[ 'new_window' ][ 'value' ] = true; |
|
| 68 | + $field_options[ 'new_window' ][ 'priority' ] = 2000; |
|
| 69 | 69 | |
| 70 | 70 | return $field_options; |
| 71 | 71 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | if ( 'single' === $context ) { |
| 36 | - unset( $field_options['new_window'] ); |
|
| 36 | + unset( $field_options[ 'new_window' ] ); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | return $field_options; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | function __construct() { |
| 21 | 21 | |
| 22 | - $this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' ); |
|
| 22 | + $this->widget_description = __( 'Insert custom text or HTML as a widget', 'gravityview' ); |
|
| 23 | 23 | |
| 24 | 24 | $default_values = array( |
| 25 | 25 | 'header' => 1, |
@@ -44,39 +44,39 @@ discard block |
||
| 44 | 44 | ), |
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | - parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings ); |
|
| 47 | + parent::__construct( __( 'Custom Content', 'gravityview' ), 'custom_content', $default_values, $settings ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 50 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 51 | 51 | |
| 52 | - if( !$this->pre_render_frontend() ) { |
|
| 52 | + if ( ! $this->pre_render_frontend() ) { |
|
| 53 | 53 | return; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if( !empty( $widget_args['title'] ) ) { |
|
| 57 | - echo $widget_args['title']; |
|
| 56 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
| 57 | + echo $widget_args[ 'title' ]; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | // Make sure the class is loaded in DataTables |
| 62 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
| 62 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
| 63 | 63 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $widget_args['content'] = trim( rtrim( \GV\Utils::get( $widget_args, 'content' ) ) ); |
|
| 66 | + $widget_args[ 'content' ] = trim( rtrim( \GV\Utils::get( $widget_args, 'content' ) ) ); |
|
| 67 | 67 | |
| 68 | 68 | // No custom content |
| 69 | - if( empty( $widget_args['content'] ) ) { |
|
| 69 | + if ( empty( $widget_args[ 'content' ] ) ) { |
|
| 70 | 70 | gravityview()->log->debug( 'No content.' ); |
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Add paragraphs? |
| 75 | - if( !empty( $widget_args['wpautop'] ) ) { |
|
| 76 | - $widget_args['content'] = wpautop( $widget_args['content'] ); |
|
| 75 | + if ( ! empty( $widget_args[ 'wpautop' ] ) ) { |
|
| 76 | + $widget_args[ 'content' ] = wpautop( $widget_args[ 'content' ] ); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $content = $widget_args['content']; |
|
| 79 | + $content = $widget_args[ 'content' ]; |
|
| 80 | 80 | |
| 81 | 81 | $content = GravityView_Merge_Tags::replace_variables( $content, array(), array(), false, true, false ); |
| 82 | 82 | |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | // Add custom class |
| 89 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 89 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 90 | 90 | $class = gravityview_sanitize_html_class( $class ); |
| 91 | 91 | |
| 92 | - echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>'; |
|
| 92 | + echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>'; |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
@@ -16,17 +16,17 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | function gravityview_register_gravityview_widgets() { |
| 18 | 18 | |
| 19 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget.php' ); |
|
| 19 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget.php' ); |
|
| 20 | 20 | |
| 21 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/search-widget/class-search-widget.php' ); |
|
| 22 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
| 23 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-gravityforms.php' ); |
|
| 24 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
| 25 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
| 26 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
| 21 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/search-widget/class-search-widget.php' ); |
|
| 22 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-custom-content.php' ); |
|
| 23 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-gravityforms.php' ); |
|
| 24 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-size.php' ); |
|
| 25 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-pagination-info.php' ); |
|
| 26 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/class-gravityview-widget-page-links.php' ); |
|
| 27 | 27 | |
| 28 | - if( class_exists('GFPolls') ) { |
|
| 29 | - include_once( GRAVITYVIEW_DIR .'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
| 28 | + if ( class_exists( 'GFPolls' ) ) { |
|
| 29 | + include_once( GRAVITYVIEW_DIR . 'includes/widgets/poll/class-gravityview-widget-poll.php' ); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected $form_id; |
| 46 | 46 | |
| 47 | - function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null) { |
|
| 47 | + function __construct( $title = '', $item_id = '', $item = array(), $settings = array(), $form_id = null ) { |
|
| 48 | 48 | |
| 49 | 49 | // Backward compat |
| 50 | - if ( ! empty( $item['type'] ) ) { |
|
| 51 | - $item['input_type'] = $item['type']; |
|
| 52 | - unset( $item['type'] ); |
|
| 50 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 51 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 52 | + unset( $item[ 'type' ] ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if ( $admin_label = \GV\Utils::get( $settings, 'admin_label' ) ) { |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $this->id = $item_id; |
| 77 | 77 | $this->form_id = $form_id; |
| 78 | 78 | $this->settings = $settings; |
| 79 | - $this->label_type = $item['label_type']; |
|
| 79 | + $this->label_type = $item[ 'label_type' ]; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | foreach ( $field_info_items as $item ) { |
| 122 | 122 | |
| 123 | - if( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 123 | + if ( \GV\Utils::get( $item, 'hide_in_picker', false ) ) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
| 127 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 128 | 128 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 129 | 129 | $output .= '<span class="' . $class . '">'; |
| 130 | - $output .= esc_html( $item['value'] ); |
|
| 130 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 131 | 131 | $output .= '</span>'; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -156,46 +156,46 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 158 | 158 | // TODO: Un-hack this |
| 159 | - $hide_settings_link_class = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 160 | - $settings_link = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
| 159 | + $hide_settings_link_class = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 160 | + $settings_link = sprintf( '<button class="gv-field-settings %2$s" title="%1$s" aria-label="%1$s"><span class="dashicons-admin-generic dashicons"></span></button>', esc_attr( $settings_title ), $hide_settings_link_class ); |
|
| 161 | 161 | |
| 162 | 162 | // When a field label is empty, use the Field ID |
| 163 | 163 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
| 164 | 164 | |
| 165 | 165 | // If there's a custom label, and show label is checked, use that as the field heading |
| 166 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
| 167 | - $label = $this->settings['custom_label']; |
|
| 168 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
| 169 | - $label = $this->item['customLabel']; |
|
| 166 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 167 | + $label = $this->settings[ 'custom_label' ]; |
|
| 168 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 169 | + $label = $this->item[ 'customLabel' ]; |
|
| 170 | 170 | } |
| 171 | 171 | $label = esc_attr( $label ); |
| 172 | 172 | |
| 173 | 173 | $field_icon = ''; |
| 174 | 174 | |
| 175 | 175 | $form = ! empty( $this->form_id ) ? GVCommon::get_form( $this->form_id ) : false; |
| 176 | - $nonexistent_form_field = $form && $this->id && preg_match('/^\d+\.\d+$|^\d+$/', $this->id) && ! gravityview_get_field( $form, $this->id ); |
|
| 176 | + $nonexistent_form_field = $form && $this->id && preg_match( '/^\d+\.\d+$|^\d+$/', $this->id ) && ! gravityview_get_field( $form, $this->id ); |
|
| 177 | 177 | |
| 178 | - if ( $this->item['icon'] && ! \GV\Utils::get( $this->item, 'parent' ) ) { |
|
| 178 | + if ( $this->item[ 'icon' ] && ! \GV\Utils::get( $this->item, 'parent' ) ) { |
|
| 179 | 179 | |
| 180 | - $has_gf_icon = ( false !== strpos( $this->item['icon'], 'gform-icon' ) ); |
|
| 181 | - $has_dashicon = ( false !== strpos( $this->item['icon'], 'dashicons' ) ); |
|
| 180 | + $has_gf_icon = ( false !== strpos( $this->item[ 'icon' ], 'gform-icon' ) ); |
|
| 181 | + $has_dashicon = ( false !== strpos( $this->item[ 'icon' ], 'dashicons' ) ); |
|
| 182 | 182 | |
| 183 | - if ( 0 === strpos( $this->item['icon'], 'data:' ) ) { |
|
| 183 | + if ( 0 === strpos( $this->item[ 'icon' ], 'data:' ) ) { |
|
| 184 | 184 | // Inline icon SVG |
| 185 | - $field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item['icon'] ) . '\');"></i>'; |
|
| 186 | - } elseif( $has_gf_icon && gravityview()->plugin->is_GF_25() ) { |
|
| 185 | + $field_icon = '<i class="dashicons background-icon" style="background-image: url(\'' . esc_attr( $this->item[ 'icon' ] ) . '\');"></i>'; |
|
| 186 | + } elseif ( $has_gf_icon && gravityview()->plugin->is_GF_25() ) { |
|
| 187 | 187 | // Gravity Forms icon font |
| 188 | - $field_icon = '<i class="gform-icon ' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
| 189 | - } elseif( $has_dashicon ) { |
|
| 188 | + $field_icon = '<i class="gform-icon ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
| 189 | + } elseif ( $has_dashicon ) { |
|
| 190 | 190 | // Dashicon; prefix with "dashicons" |
| 191 | - $field_icon = '<i class="dashicons ' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
| 191 | + $field_icon = '<i class="dashicons ' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
| 192 | 192 | } else { |
| 193 | 193 | // Not dashicon icon |
| 194 | - $field_icon = '<i class="' . esc_attr( $this->item['icon'] ) . '"></i>'; |
|
| 194 | + $field_icon = '<i class="' . esc_attr( $this->item[ 'icon' ] ) . '"></i>'; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $field_icon = $field_icon . ' '; |
| 198 | - } elseif( \GV\Utils::get( $this->item, 'parent' ) ) { |
|
| 198 | + } elseif ( \GV\Utils::get( $this->item, 'parent' ) ) { |
|
| 199 | 199 | $field_icon = '<i class="gv-icon gv-icon-level-down"></i>' . ' '; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -222,19 +222,19 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | $output .= '</h5>'; |
| 224 | 224 | |
| 225 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 225 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 226 | 226 | |
| 227 | 227 | $container_class .= $nonexistent_form_field ? ' gv-nonexistent-form-field' : ''; |
| 228 | 228 | |
| 229 | - $container_class .= empty( $this->settings['show_as_link'] ) ? '' : ' has-single-entry-link'; |
|
| 229 | + $container_class .= empty( $this->settings[ 'show_as_link' ] ) ? '' : ' has-single-entry-link'; |
|
| 230 | 230 | |
| 231 | - $container_class .= empty( $this->settings['only_loggedin'] ) ? '' : ' has-custom-visibility'; |
|
| 231 | + $container_class .= empty( $this->settings[ 'only_loggedin' ] ) ? '' : ' has-custom-visibility'; |
|
| 232 | 232 | |
| 233 | - $data_form_id = $form ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 233 | + $data_form_id = $form ? ' data-formid="' . esc_attr( $this->form_id ) . '"' : ''; |
|
| 234 | 234 | |
| 235 | - $data_parent_label = ! empty( $this->item['parent'] ) ? ' data-parent-label="' . esc_attr( $this->item['parent']['label'] ) . '"' : ''; |
|
| 235 | + $data_parent_label = ! empty( $this->item[ 'parent' ] ) ? ' data-parent-label="' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . '"' : ''; |
|
| 236 | 236 | |
| 237 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
| 237 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" ' . $data_form_id . $data_parent_label . ' data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 238 | 238 | |
| 239 | 239 | return $output; |
| 240 | 240 | } |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | $icons = array( |
| 254 | 254 | 'show_as_link' => array( |
| 255 | - 'visible' => ( ! empty( $this->settings['show_as_link'] ) ), |
|
| 255 | + 'visible' => ( ! empty( $this->settings[ 'show_as_link' ] ) ), |
|
| 256 | 256 | 'title' => __( 'This field links to the Single Entry', 'gravityview' ), |
| 257 | 257 | 'css_class' => 'dashicons dashicons-media-default icon-link-to-single-entry', |
| 258 | 258 | ), |
| 259 | 259 | 'only_loggedin' => array( |
| 260 | - 'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings['allow_edit_cap'] ) && 'read' !== $this->settings['allow_edit_cap'] ), |
|
| 260 | + 'visible' => ( \GV\Utils::get( $this->settings, 'only_loggedin' ) || isset( $this->settings[ 'allow_edit_cap' ] ) && 'read' !== $this->settings[ 'allow_edit_cap' ] ), |
|
| 261 | 261 | 'title' => __( 'This field has modified visibility', 'gravityview' ), |
| 262 | 262 | 'css_class' => 'dashicons dashicons-lock icon-custom-visibility', |
| 263 | 263 | ), |
@@ -271,21 +271,21 @@ discard block |
||
| 271 | 271 | * @param array $icons Array of icons to be shown, with `visible`, `title`, `css_class` keys. |
| 272 | 272 | * @param array $item_settings Settings for the current item (widget or field) |
| 273 | 273 | */ |
| 274 | - $icons = (array) apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings ); |
|
| 274 | + $icons = (array)apply_filters( 'gravityview/admin/indicator_icons', $icons, $this->settings ); |
|
| 275 | 275 | |
| 276 | 276 | foreach ( $icons as $icon ) { |
| 277 | 277 | |
| 278 | - if ( empty( $icon['css_class'] ) || empty( $icon['title'] ) ) { |
|
| 278 | + if ( empty( $icon[ 'css_class' ] ) || empty( $icon[ 'title' ] ) ) { |
|
| 279 | 279 | continue; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - $css_class = trim( $icon['css_class'] ); |
|
| 282 | + $css_class = trim( $icon[ 'css_class' ] ); |
|
| 283 | 283 | |
| 284 | - if ( empty( $icon['visible'] ) ) { |
|
| 284 | + if ( empty( $icon[ 'visible' ] ) ) { |
|
| 285 | 285 | $css_class .= ' hide-if-js'; |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - $output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon['title'] ) . '"></span>'; |
|
| 288 | + $output .= '<span class="' . gravityview_sanitize_html_class( $css_class ) . '" title="' . esc_attr( $icon[ 'title' ] ) . '"></span>'; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | return $output; |
@@ -50,26 +50,26 @@ |
||
| 50 | 50 | |
| 51 | 51 | if ( ! empty( $quiz_fields ) ) { |
| 52 | 52 | |
| 53 | - $fields['gquiz_score'] = array( |
|
| 53 | + $fields[ 'gquiz_score' ] = array( |
|
| 54 | 54 | 'label' => __( 'Quiz Score Total', 'gravityview' ), |
| 55 | 55 | 'type' => 'quiz_score', |
| 56 | 56 | 'desc' => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ), |
| 57 | 57 | 'icon' => 'dashicons-forms', |
| 58 | 58 | ); |
| 59 | - $fields['gquiz_percent'] = array( |
|
| 59 | + $fields[ 'gquiz_percent' ] = array( |
|
| 60 | 60 | 'label' => __( 'Quiz Percentage Grade', 'gravityview' ), |
| 61 | 61 | 'type' => 'quiz_percent', |
| 62 | 62 | 'desc' => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ), |
| 63 | 63 | 'icon' => 'dashicons-forms', |
| 64 | 64 | ); |
| 65 | - $fields['gquiz_grade'] = array( |
|
| 65 | + $fields[ 'gquiz_grade' ] = array( |
|
| 66 | 66 | /* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc. */ |
| 67 | 67 | 'label' => __( 'Quiz Letter Grade', 'gravityview' ), |
| 68 | 68 | 'type' => 'quiz_grade', |
| 69 | 69 | 'desc' => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ), |
| 70 | 70 | 'icon' => 'dashicons-forms', |
| 71 | 71 | ); |
| 72 | - $fields['gquiz_is_pass'] = array( |
|
| 72 | + $fields[ 'gquiz_is_pass' ] = array( |
|
| 73 | 73 | 'label' => __( 'Quiz Pass/Fail', 'gravityview' ), |
| 74 | 74 | 'type' => 'quiz_is_pass', |
| 75 | 75 | 'desc' => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ), |