@@ -12,31 +12,31 @@ discard block |
||
12 | 12 | |
13 | 13 | <div class="gv-container gv-list-single-container gv-list-container"> |
14 | 14 | <p class="gv-back-link"><?php echo gravityview_back_link(); ?></p> |
15 | - <?php foreach ( $this->getEntries() as $entry ) { |
|
16 | - $this->setCurrentEntry( $entry ); |
|
15 | + <?php foreach ($this->getEntries() as $entry) { |
|
16 | + $this->setCurrentEntry($entry); |
|
17 | 17 | ?> |
18 | 18 | |
19 | 19 | <div id="gv_list_<?php echo $entry['id']; ?>" class="gv-list-view"> |
20 | 20 | <?php |
21 | 21 | |
22 | - if ( $this->getFields( 'single_list-title' ) || $this->getFields( 'single_list-subtitle' ) ) { ?> |
|
22 | + if ($this->getFields('single_list-title') || $this->getFields('single_list-subtitle')) { ?> |
|
23 | 23 | <div class="gv-list-view-title"> |
24 | 24 | <?php |
25 | - if ( $fields = $this->getFields( 'single_list-title' ) ) { |
|
25 | + if ($fields = $this->getFields('single_list-title')) { |
|
26 | 26 | $i = 0; |
27 | 27 | $title_args = array( |
28 | 28 | 'entry' => $entry, |
29 | 29 | 'form' => $this->form, |
30 | 30 | 'hide_empty' => $this->atts['hide_empty'], |
31 | 31 | ); |
32 | - foreach ( $fields as $field ) { |
|
32 | + foreach ($fields as $field) { |
|
33 | 33 | $title_args['field'] = $field; |
34 | - if ( 0 === $i ) { |
|
34 | + if (0 === $i) { |
|
35 | 35 | $title_args['markup'] = '<h3 id="{{ field_id }}" class="{{class}}">{{label}}{{value}}</h3>'; |
36 | - echo gravityview_field_output( $title_args ); |
|
36 | + echo gravityview_field_output($title_args); |
|
37 | 37 | } else { |
38 | 38 | $title_args['wpautop'] = true; |
39 | - echo gravityview_field_output( $title_args ); |
|
39 | + echo gravityview_field_output($title_args); |
|
40 | 40 | } |
41 | 41 | $i++; |
42 | 42 | } |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | ?> |
76 | 76 | </div> |
77 | 77 | |
78 | - <?php if ( $this->getFields( 'single_list-footer-left' ) || $this->getFields( 'single_list-footer-right' ) ) { ?> |
|
78 | + <?php if ($this->getFields('single_list-footer-left') || $this->getFields('single_list-footer-right')) { ?> |
|
79 | 79 | <div class="gv-grid gv-list-view-footer"> |
80 | 80 | <div class="gv-grid-col-1-2 gv-left"> |
81 | - <?php $this->renderZone( 'footer-left' ); ?> |
|
81 | + <?php $this->renderZone('footer-left'); ?> |
|
82 | 82 | </div> |
83 | 83 | |
84 | 84 | <div class="gv-grid-col-1-2 gv-right"> |
85 | - <?php $this->renderZone( 'footer-right' ); ?> |
|
85 | + <?php $this->renderZone('footer-right'); ?> |
|
86 | 86 | </div> |
87 | 87 | </div> |
88 | 88 | <?php } ?> |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display a single entry when using a list template |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates |
|
7 | - * |
|
8 | - * @global GravityView_View $this |
|
9 | - */ |
|
3 | + * Display a single entry when using a list template |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates |
|
7 | + * |
|
8 | + * @global GravityView_View $this |
|
9 | + */ |
|
10 | 10 | ?> |
11 | 11 | <?php gravityview_before(); ?> |
12 | 12 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display the entry loop when using a table template |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates |
|
7 | - * |
|
8 | - * @global GravityView_View $this |
|
9 | - */ |
|
3 | + * Display the entry loop when using a table template |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates |
|
7 | + * |
|
8 | + * @global GravityView_View $this |
|
9 | + */ |
|
10 | 10 | ?> |
11 | 11 | <tbody> |
12 | 12 | <?php |
@@ -11,28 +11,28 @@ discard block |
||
11 | 11 | <tbody> |
12 | 12 | <?php |
13 | 13 | |
14 | - do_action('gravityview_table_body_before', $this ); |
|
14 | + do_action('gravityview_table_body_before', $this); |
|
15 | 15 | |
16 | - if( 0 === $this->getTotalEntries() ) { |
|
16 | + if (0 === $this->getTotalEntries()) { |
|
17 | 17 | |
18 | 18 | $directory_table_columns = $this->getFields('directory_table-columns'); |
19 | 19 | ?> |
20 | 20 | <tr> |
21 | - <?php do_action('gravityview_table_tr_before', $this ); ?> |
|
22 | - <td colspan="<?php echo $directory_table_columns ? sizeof( $directory_table_columns ) : ''; ?>" class="gv-no-results"> |
|
21 | + <?php do_action('gravityview_table_tr_before', $this); ?> |
|
22 | + <td colspan="<?php echo $directory_table_columns ? sizeof($directory_table_columns) : ''; ?>" class="gv-no-results"> |
|
23 | 23 | <?php echo gv_no_results(); ?> |
24 | 24 | </td> |
25 | - <?php do_action('gravityview_table_tr_after', $this ); ?> |
|
25 | + <?php do_action('gravityview_table_tr_after', $this); ?> |
|
26 | 26 | </tr> |
27 | 27 | <?php |
28 | 28 | } else { |
29 | 29 | |
30 | - foreach( $this->getEntries() as $entry ) : |
|
30 | + foreach ($this->getEntries() as $entry) : |
|
31 | 31 | |
32 | - $this->setCurrentEntry( $entry ); |
|
32 | + $this->setCurrentEntry($entry); |
|
33 | 33 | |
34 | 34 | // Add `alt` class to alternate rows |
35 | - $alt = empty( $alt ) ? 'alt' : ''; |
|
35 | + $alt = empty($alt) ? 'alt' : ''; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @filter `gravityview_entry_class` Modify the class applied to the entry row |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | * @param array $entry Current entry being displayed |
41 | 41 | * @param GravityView_View $this Current GravityView_View object |
42 | 42 | */ |
43 | - $class = apply_filters( 'gravityview_entry_class', $alt, $entry, $this ); |
|
43 | + $class = apply_filters('gravityview_entry_class', $alt, $entry, $this); |
|
44 | 44 | ?> |
45 | - <tr<?php echo ' class="'.esc_attr( $class ).'"'; ?>> |
|
45 | + <tr<?php echo ' class="'.esc_attr($class).'"'; ?>> |
|
46 | 46 | <?php |
47 | - do_action('gravityview_table_cells_before', $this ); |
|
47 | + do_action('gravityview_table_cells_before', $this); |
|
48 | 48 | |
49 | - $this->renderZone( 'columns', array( |
|
49 | + $this->renderZone('columns', array( |
|
50 | 50 | 'markup' => '<td id="{{ field_id }}" class="{{class}}">{{value}}</td>', |
51 | 51 | 'hide_empty' => false, // Always show <td> |
52 | 52 | )); |
53 | 53 | |
54 | - do_action('gravityview_table_cells_after', $this ); |
|
54 | + do_action('gravityview_table_cells_after', $this); |
|
55 | 55 | ?> |
56 | 56 | </tr> |
57 | 57 | <?php |
@@ -59,6 +59,6 @@ discard block |
||
59 | 59 | |
60 | 60 | } |
61 | 61 | |
62 | - do_action('gravityview_table_body_after', $this ); |
|
62 | + do_action('gravityview_table_body_after', $this); |
|
63 | 63 | ?> |
64 | 64 | </tbody> |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display below the entries loop when using a table layout |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates |
|
7 | - * |
|
8 | - * @global GravityView_View $this |
|
9 | - */ |
|
3 | + * Display below the entries loop when using a table layout |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates |
|
7 | + * |
|
8 | + * @global GravityView_View $this |
|
9 | + */ |
|
10 | 10 | ?> |
11 | 11 | <tfoot> |
12 | 12 | <tr> |
@@ -12,7 +12,7 @@ |
||
12 | 12 | <tr> |
13 | 13 | <?php |
14 | 14 | |
15 | - $this->renderZone( 'columns', array( |
|
15 | + $this->renderZone('columns', array( |
|
16 | 16 | 'markup' => '<th id="{{ field_id }}" class="{{class}}">{{label}}</th>', |
17 | 17 | 'hide_empty' => false, // Always show <th> |
18 | 18 | )); |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display above the entries loop when using a table layout |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates |
|
7 | - * |
|
8 | - * @global GravityView_View $this |
|
9 | - */ |
|
3 | + * Display above the entries loop when using a table layout |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates |
|
7 | + * |
|
8 | + * @global GravityView_View $this |
|
9 | + */ |
|
10 | 10 | ?> |
11 | 11 | <?php gravityview_before(); ?> |
12 | 12 | <div class="<?php gv_container_class('gv-table-container'); ?>"> |
@@ -19,7 +19,7 @@ |
||
19 | 19 | // Make sure this wasn't overridden by search |
20 | 20 | $this->setTemplatePartSlug('table'); |
21 | 21 | |
22 | - $this->renderZone( 'columns', array( |
|
22 | + $this->renderZone('columns', array( |
|
23 | 23 | 'markup' => '<th id="{{ field_id }}" class="{{class}}" style="{{width:style}}">{{label}}</th>', |
24 | 24 | 'hide_empty' => false, // Always show <th> |
25 | 25 | )); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | <div class="gv-table-view gv-container gv-table-single-container"> |
16 | 16 | <table class="gv-table-view-content"> |
17 | - <?php if( $this->getFields('single_table-columns') ) { ?> |
|
17 | + <?php if ($this->getFields('single_table-columns')) { ?> |
|
18 | 18 | <thead> |
19 | 19 | <?php gravityview_header(); ?> |
20 | 20 | </thead> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | <td>{{value}}</td> |
28 | 28 | </tr>'; |
29 | 29 | |
30 | - $this->renderZone( 'columns', array( |
|
30 | + $this->renderZone('columns', array( |
|
31 | 31 | 'markup' => $markup, |
32 | 32 | )); |
33 | 33 | ?> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // If uninstall not called from WordPress, then exit |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if (!defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,16 +25,16 @@ discard block |
||
25 | 25 | public function __construct() { |
26 | 26 | |
27 | 27 | /** @define "$file_path" "./" */ |
28 | - $file_path = plugin_dir_path( __FILE__ ); |
|
28 | + $file_path = plugin_dir_path(__FILE__); |
|
29 | 29 | |
30 | - include_once $file_path . 'includes/class-gravityview-roles-capabilities.php'; |
|
30 | + include_once $file_path.'includes/class-gravityview-roles-capabilities.php'; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Only delete content and settings if "Delete on Uninstall?" setting is "Permanently Delete" |
34 | 34 | */ |
35 | 35 | $delete = $this->get_delete_setting(); |
36 | 36 | |
37 | - if( GravityView_Roles_Capabilities::has_cap( 'gravityview_uninstall' ) && 'delete' === $delete ) { |
|
37 | + if (GravityView_Roles_Capabilities::has_cap('gravityview_uninstall') && 'delete' === $delete) { |
|
38 | 38 | $this->fire_everything(); |
39 | 39 | } |
40 | 40 | } |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | */ |
49 | 49 | private function get_delete_setting() { |
50 | 50 | |
51 | - $settings = get_option( $this->settings_name, array() ); |
|
51 | + $settings = get_option($this->settings_name, array()); |
|
52 | 52 | |
53 | - return isset( $settings[ 'delete-on-uninstall' ] ) ? $settings[ 'delete-on-uninstall' ] : null; |
|
53 | + return isset($settings['delete-on-uninstall']) ? $settings['delete-on-uninstall'] : null; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | private function delete_entry_meta() { |
76 | 76 | global $wpdb; |
77 | 77 | |
78 | - $meta_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_meta_table_name() : $wpdb->prefix . 'rg_lead_meta'; |
|
78 | + $meta_table = class_exists('GFFormsModel') ? GFFormsModel::get_lead_meta_table_name() : $wpdb->prefix.'rg_lead_meta'; |
|
79 | 79 | |
80 | 80 | $sql = " |
81 | 81 | DELETE FROM $meta_table |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ); |
85 | 85 | "; |
86 | 86 | |
87 | - $wpdb->query( $sql ); |
|
87 | + $wpdb->query($sql); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | private function delete_entry_notes() { |
96 | 96 | global $wpdb; |
97 | 97 | |
98 | - $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
|
98 | + $notes_table = class_exists('GFFormsModel') ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix.'rg_lead_notes'; |
|
99 | 99 | |
100 | 100 | $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
101 | 101 | $approved = __('Approved the Entry for GravityView', 'gravityview'); |
102 | 102 | |
103 | - $sql = $wpdb->prepare( " |
|
103 | + $sql = $wpdb->prepare(" |
|
104 | 104 | DELETE FROM $notes_table |
105 | 105 | WHERE ( |
106 | 106 | `note_type` = 'gravityview' OR |
107 | 107 | `value` = %s OR |
108 | 108 | `value` = %s |
109 | 109 | ); |
110 | - ", $approved, $disapproved ); |
|
110 | + ", $approved, $disapproved); |
|
111 | 111 | |
112 | - $wpdb->query( $sql ); |
|
112 | + $wpdb->query($sql); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -128,16 +128,16 @@ discard block |
||
128 | 128 | */ |
129 | 129 | private function delete_posts() { |
130 | 130 | |
131 | - $items = get_posts( array( |
|
131 | + $items = get_posts(array( |
|
132 | 132 | 'post_type' => 'gravityview', |
133 | 133 | 'post_status' => 'any', |
134 | 134 | 'numberposts' => -1, |
135 | 135 | 'fields' => 'ids' |
136 | - ) ); |
|
136 | + )); |
|
137 | 137 | |
138 | - if ( $items ) { |
|
139 | - foreach ( $items as $item ) { |
|
140 | - wp_delete_post( $item, true ); |
|
138 | + if ($items) { |
|
139 | + foreach ($items as $item) { |
|
140 | + wp_delete_post($item, true); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | */ |
150 | 150 | private function delete_options() { |
151 | 151 | |
152 | - delete_option( 'gravityformsaddon_gravityview_app_settings' ); |
|
153 | - delete_option( 'gravityformsaddon_gravityview_version' ); |
|
154 | - delete_option( 'gravityview_cache_blacklist' ); |
|
152 | + delete_option('gravityformsaddon_gravityview_app_settings'); |
|
153 | + delete_option('gravityformsaddon_gravityview_version'); |
|
154 | + delete_option('gravityview_cache_blacklist'); |
|
155 | 155 | |
156 | - delete_transient( 'gravityview_edd-activate_valid' ); |
|
157 | - delete_transient( 'gravityview_edd-deactivate_valid' ); |
|
158 | - delete_transient( 'gravityview_dismissed_notices' ); |
|
156 | + delete_transient('gravityview_edd-activate_valid'); |
|
157 | + delete_transient('gravityview_edd-deactivate_valid'); |
|
158 | + delete_transient('gravityview_dismissed_notices'); |
|
159 | 159 | |
160 | - delete_site_transient( 'gravityview_related_plugins' ); |
|
160 | + delete_site_transient('gravityview_related_plugins'); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 |
@@ -8,6 +8,6 @@ |
||
8 | 8 | |
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 | |
11 | -extract( $gravityview_view->getCurrentField() ); |
|
11 | +extract($gravityview_view->getCurrentField()); |
|
12 | 12 | |
13 | -echo gravityview_get_field_value( $entry, $field_id, $display_value ); |
|
13 | +echo gravityview_get_field_value($entry, $field_id, $display_value); |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Display above the entries loop when using a list layout |
|
4 | - * |
|
5 | - * @package GravityView |
|
6 | - * @subpackage GravityView/templates |
|
7 | - * |
|
8 | - * @global GravityView_View $this |
|
9 | - */ |
|
3 | + * Display above the entries loop when using a list layout |
|
4 | + * |
|
5 | + * @package GravityView |
|
6 | + * @subpackage GravityView/templates |
|
7 | + * |
|
8 | + * @global GravityView_View $this |
|
9 | + */ |
|
10 | 10 | ?> |
11 | 11 | <?php gravityview_before(); ?> |
12 | 12 | <div class="<?php gv_container_class('gv-list-container'); ?>"> |
@@ -23,53 +23,53 @@ discard block |
||
23 | 23 | * @param string $input_type (textarea, list, select, etc.) |
24 | 24 | * @return array Array of field options with `label`, `value`, `type`, `default` keys |
25 | 25 | */ |
26 | - public static function get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type ) { |
|
26 | + public static function get_default_field_options($field_type, $template_id, $field_id, $context, $input_type) { |
|
27 | 27 | |
28 | 28 | $field_options = array(); |
29 | 29 | |
30 | - if( 'field' === $field_type ) { |
|
30 | + if ('field' === $field_type) { |
|
31 | 31 | |
32 | 32 | // Default options - fields |
33 | 33 | $field_options = array( |
34 | 34 | 'show_label' => array( |
35 | 35 | 'type' => 'checkbox', |
36 | - 'label' => __( 'Show Label', 'gravityview' ), |
|
36 | + 'label' => __('Show Label', 'gravityview'), |
|
37 | 37 | 'value' => true, |
38 | 38 | ), |
39 | 39 | 'custom_label' => array( |
40 | 40 | 'type' => 'text', |
41 | - 'label' => __( 'Custom Label:', 'gravityview' ), |
|
41 | + 'label' => __('Custom Label:', 'gravityview'), |
|
42 | 42 | 'value' => '', |
43 | 43 | 'merge_tags' => true, |
44 | 44 | ), |
45 | 45 | 'custom_class' => array( |
46 | 46 | 'type' => 'text', |
47 | - 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
|
48 | - 'desc' => __( 'This class will be added to the field container', 'gravityview'), |
|
47 | + 'label' => __('Custom CSS Class:', 'gravityview'), |
|
48 | + 'desc' => __('This class will be added to the field container', 'gravityview'), |
|
49 | 49 | 'value' => '', |
50 | 50 | 'merge_tags' => true, |
51 | 51 | 'tooltip' => 'gv_css_merge_tags', |
52 | 52 | ), |
53 | 53 | 'only_loggedin' => array( |
54 | 54 | 'type' => 'checkbox', |
55 | - 'label' => __( 'Make visible only to logged-in users?', 'gravityview' ), |
|
55 | + 'label' => __('Make visible only to logged-in users?', 'gravityview'), |
|
56 | 56 | 'value' => '' |
57 | 57 | ), |
58 | 58 | 'only_loggedin_cap' => array( |
59 | 59 | 'type' => 'select', |
60 | - 'label' => __( 'Make visible for:', 'gravityview' ), |
|
61 | - 'options' => self::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
|
60 | + 'label' => __('Make visible for:', 'gravityview'), |
|
61 | + 'options' => self::get_cap_choices($template_id, $field_id, $context, $input_type), |
|
62 | 62 | 'class' => 'widefat', |
63 | 63 | 'value' => 'read', |
64 | 64 | ), |
65 | 65 | ); |
66 | 66 | |
67 | 67 | // Match Table as well as DataTables |
68 | - if( preg_match( '/table/ism', $template_id ) && 'single' !== $context ) { |
|
68 | + if (preg_match('/table/ism', $template_id) && 'single' !== $context) { |
|
69 | 69 | $field_options['width'] = array( |
70 | 70 | 'type' => 'number', |
71 | 71 | 'label' => __('Percent Width', 'gravityview'), |
72 | - 'desc' => __( 'Leave blank for column width to be based on the field content.', 'gravityview'), |
|
72 | + 'desc' => __('Leave blank for column width to be based on the field content.', 'gravityview'), |
|
73 | 73 | 'class' => 'code widefat', |
74 | 74 | 'value' => '', |
75 | 75 | ); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param[in] string $context What context are we in? Example: `single` or `directory` |
86 | 86 | * @param[in] string $input_type (textarea, list, select, etc.) |
87 | 87 | */ |
88 | - $field_options = apply_filters( "gravityview_template_{$field_type}_options", $field_options, $template_id, $field_id, $context, $input_type ); |
|
88 | + $field_options = apply_filters("gravityview_template_{$field_type}_options", $field_options, $template_id, $field_id, $context, $input_type); |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * @filter `gravityview_template_{$input_type}_options` Filter the field options by input type (`$input_type` examples: `textarea`, `list`, `select`, etc.) |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param[in] string $context What context are we in? Example: `single` or `directory` |
96 | 96 | * @param[in] string $input_type (textarea, list, select, etc.) |
97 | 97 | */ |
98 | - $field_options = apply_filters( "gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type ); |
|
98 | + $field_options = apply_filters("gravityview_template_{$input_type}_options", $field_options, $template_id, $field_id, $context, $input_type); |
|
99 | 99 | |
100 | 100 | return $field_options; |
101 | 101 | } |
@@ -111,19 +111,19 @@ discard block |
||
111 | 111 | * @param string $input_type Optional. (textarea, list, select, etc.) |
112 | 112 | * @return array Associative array, with the key being the capability and the value being the label shown. |
113 | 113 | */ |
114 | - static public function get_cap_choices( $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
|
114 | + static public function get_cap_choices($template_id = '', $field_id = '', $context = '', $input_type = '') { |
|
115 | 115 | |
116 | 116 | $select_cap_choices = array( |
117 | - 'read' => __( 'Any Logged-In User', 'gravityview' ), |
|
118 | - 'publish_posts' => __( 'Author Or Higher', 'gravityview' ), |
|
119 | - 'gravityforms_view_entries' => __( 'Can View Gravity Forms Entries', 'gravityview' ), |
|
120 | - 'delete_others_posts' => __( 'Editor Or Higher', 'gravityview' ), |
|
121 | - 'gravityforms_edit_entries' => __( 'Can Edit Gravity Forms Entries', 'gravityview' ), |
|
122 | - 'manage_options' => __( 'Administrator', 'gravityview' ), |
|
117 | + 'read' => __('Any Logged-In User', 'gravityview'), |
|
118 | + 'publish_posts' => __('Author Or Higher', 'gravityview'), |
|
119 | + 'gravityforms_view_entries' => __('Can View Gravity Forms Entries', 'gravityview'), |
|
120 | + 'delete_others_posts' => __('Editor Or Higher', 'gravityview'), |
|
121 | + 'gravityforms_edit_entries' => __('Can Edit Gravity Forms Entries', 'gravityview'), |
|
122 | + 'manage_options' => __('Administrator', 'gravityview'), |
|
123 | 123 | ); |
124 | 124 | |
125 | - if( is_multisite() ) { |
|
126 | - $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview' ); |
|
125 | + if (is_multisite()) { |
|
126 | + $select_cap_choices['manage_network'] = __('Multisite Super Admin', 'gravityview'); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param string $context Optional. What context are we in? Example: `single` or `directory` |
137 | 137 | * @param string $input_type Optional. (textarea, list, select, etc.) |
138 | 138 | */ |
139 | - $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type ); |
|
139 | + $select_cap_choices = apply_filters('gravityview_field_visibility_caps', $select_cap_choices, $template_id, $field_id, $context, $input_type); |
|
140 | 140 | |
141 | 141 | return $select_cap_choices; |
142 | 142 | } |
@@ -161,26 +161,26 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return string HTML of dialog box |
163 | 163 | */ |
164 | - public static function render_field_options( $field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array() ) { |
|
164 | + public static function render_field_options($field_type, $template_id, $field_id, $field_label, $area, $input_type = NULL, $uniqid = '', $current = '', $context = 'single', $item = array()) { |
|
165 | 165 | |
166 | - if( empty( $uniqid ) ) { |
|
166 | + if (empty($uniqid)) { |
|
167 | 167 | //generate a unique field id |
168 | 168 | $uniqid = uniqid('', false); |
169 | 169 | } |
170 | 170 | |
171 | 171 | // get field/widget options |
172 | - $options = self::get_default_field_options( $field_type, $template_id, $field_id, $context, $input_type ); |
|
172 | + $options = self::get_default_field_options($field_type, $template_id, $field_id, $context, $input_type); |
|
173 | 173 | |
174 | 174 | // two different post arrays, depending of the field type |
175 | - $name_prefix = $field_type .'s' .'['. $area .']['. $uniqid .']'; |
|
175 | + $name_prefix = $field_type.'s'.'['.$area.']['.$uniqid.']'; |
|
176 | 176 | |
177 | 177 | // build output |
178 | 178 | $output = ''; |
179 | - $output .= '<input type="hidden" class="field-key" name="'. $name_prefix .'[id]" value="'. esc_attr( $field_id ) .'">'; |
|
180 | - $output .= '<input type="hidden" class="field-label" name="'. $name_prefix .'[label]" value="'. esc_attr( $field_label ) .'">'; |
|
179 | + $output .= '<input type="hidden" class="field-key" name="'.$name_prefix.'[id]" value="'.esc_attr($field_id).'">'; |
|
180 | + $output .= '<input type="hidden" class="field-label" name="'.$name_prefix.'[label]" value="'.esc_attr($field_label).'">'; |
|
181 | 181 | |
182 | 182 | // If there are no options, return what we got. |
183 | - if(empty($options)) { |
|
183 | + if (empty($options)) { |
|
184 | 184 | |
185 | 185 | // This is here for checking if the output is empty in render_label() |
186 | 186 | $output .= '<!-- No Options -->'; |
@@ -188,33 +188,33 @@ discard block |
||
188 | 188 | return $output; |
189 | 189 | } |
190 | 190 | |
191 | - $output .= '<div class="gv-dialog-options" title="'. esc_attr( sprintf( __( 'Options: %s', 'gravityview' ) , strip_tags( html_entity_decode( $field_label ) ) ) ) .'">'; |
|
191 | + $output .= '<div class="gv-dialog-options" title="'.esc_attr(sprintf(__('Options: %s', 'gravityview'), strip_tags(html_entity_decode($field_label)))).'">'; |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * @since 1.8 |
195 | 195 | */ |
196 | - if( !empty( $item['subtitle'] ) ) { |
|
197 | - $output .= '<div class="subtitle">' . $item['subtitle'] . '</div>'; |
|
196 | + if (!empty($item['subtitle'])) { |
|
197 | + $output .= '<div class="subtitle">'.$item['subtitle'].'</div>'; |
|
198 | 198 | } |
199 | 199 | |
200 | - foreach( $options as $key => $option ) { |
|
200 | + foreach ($options as $key => $option) { |
|
201 | 201 | |
202 | - $value = isset( $current[ $key ] ) ? $current[ $key ] : NULL; |
|
202 | + $value = isset($current[$key]) ? $current[$key] : NULL; |
|
203 | 203 | |
204 | - $field_output = self::render_field_option( $name_prefix . '['. $key .']' , $option, $value); |
|
204 | + $field_output = self::render_field_option($name_prefix.'['.$key.']', $option, $value); |
|
205 | 205 | |
206 | 206 | // The setting is empty |
207 | - if( empty( $field_output ) ) { |
|
207 | + if (empty($field_output)) { |
|
208 | 208 | continue; |
209 | 209 | } |
210 | 210 | |
211 | - switch( $option['type'] ) { |
|
211 | + switch ($option['type']) { |
|
212 | 212 | // Hide hidden fields |
213 | 213 | case 'hidden': |
214 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . ' screen-reader-text">'. $field_output . '</div>'; |
|
214 | + $output .= '<div class="gv-setting-container gv-setting-container-'.esc_attr($key).' screen-reader-text">'.$field_output.'</div>'; |
|
215 | 215 | break; |
216 | 216 | default: |
217 | - $output .= '<div class="gv-setting-container gv-setting-container-'. esc_attr( $key ) . '">'. $field_output .'</div>'; |
|
217 | + $output .= '<div class="gv-setting-container gv-setting-container-'.esc_attr($key).'">'.$field_output.'</div>'; |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @param mixed $curr_value Current value of option |
236 | 236 | * @return string HTML output of option |
237 | 237 | */ |
238 | - public static function render_field_option( $name = '', $option, $curr_value = NULL ) { |
|
238 | + public static function render_field_option($name = '', $option, $curr_value = NULL) { |
|
239 | 239 | |
240 | 240 | $output = ''; |
241 | 241 | |
@@ -243,19 +243,19 @@ discard block |
||
243 | 243 | * @deprecated setting index 'default' was replaced by 'value' |
244 | 244 | * @see GravityView_FieldType::get_field_defaults |
245 | 245 | */ |
246 | - if( !empty( $option['default'] ) && empty( $option['value'] ) ) { |
|
246 | + if (!empty($option['default']) && empty($option['value'])) { |
|
247 | 247 | $option['value'] = $option['default']; |
248 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '. $name .' details' ); |
|
248 | + _deprecated_function('GravityView_FieldType::get_field_defaults', '1.1.7', '[value] instead of [default] when defining the setting '.$name.' details'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | // prepare to render option field type |
252 | - if( isset( $option['type'] ) ) { |
|
252 | + if (isset($option['type'])) { |
|
253 | 253 | |
254 | - $type_class = self::load_type_class( $option ); |
|
254 | + $type_class = self::load_type_class($option); |
|
255 | 255 | |
256 | - if( class_exists( $type_class ) ) { |
|
256 | + if (class_exists($type_class)) { |
|
257 | 257 | |
258 | - $render_type = new $type_class( $name, $option, $curr_value ); |
|
258 | + $render_type = new $type_class($name, $option, $curr_value); |
|
259 | 259 | |
260 | 260 | ob_start(); |
261 | 261 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @param[in,out] string $output field class name |
270 | 270 | * @param[in] array $option option field data |
271 | 271 | */ |
272 | - $output = apply_filters( "gravityview/option/output/{$option['type']}" , $output, $option ); |
|
272 | + $output = apply_filters("gravityview/option/output/{$option['type']}", $output, $option); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | } // isset option[type] |
@@ -291,35 +291,35 @@ discard block |
||
291 | 291 | * @param string $id [description] |
292 | 292 | * @return void [description] |
293 | 293 | */ |
294 | - public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
|
294 | + public static function render_setting_row($key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s') { |
|
295 | 295 | |
296 | - $setting = GravityView_View_Data::get_default_arg( $key, true ); |
|
296 | + $setting = GravityView_View_Data::get_default_arg($key, true); |
|
297 | 297 | |
298 | 298 | // If the key doesn't exist, there's something wrong. |
299 | - if( empty( $setting ) ) { return; } |
|
299 | + if (empty($setting)) { return; } |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * @deprecated setting index 'name' was replaced by 'label' |
303 | 303 | * @see GravityView_FieldType::get_field_defaults |
304 | 304 | */ |
305 | - if( isset( $setting['name'] ) && empty( $setting['label'] ) ) { |
|
305 | + if (isset($setting['name']) && empty($setting['label'])) { |
|
306 | 306 | $setting['label'] = $setting['name']; |
307 | - _deprecated_function( 'GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '. $key .' details' ); |
|
307 | + _deprecated_function('GravityView_FieldType::get_field_defaults', '1.1.7', '[label] instead of [name] when defining the setting '.$key.' details'); |
|
308 | 308 | } |
309 | 309 | |
310 | - $name = esc_attr( sprintf( $name, $key ) ); |
|
311 | - $setting['id'] = esc_attr( sprintf( $id, $key ) ); |
|
312 | - $setting['tooltip'] = 'gv_' . $key; |
|
310 | + $name = esc_attr(sprintf($name, $key)); |
|
311 | + $setting['id'] = esc_attr(sprintf($id, $key)); |
|
312 | + $setting['tooltip'] = 'gv_'.$key; |
|
313 | 313 | |
314 | 314 | // Use default if current setting isn't set. |
315 | - $curr_value = isset( $current_settings[ $key ] ) ? $current_settings[ $key ] : $setting['value']; |
|
315 | + $curr_value = isset($current_settings[$key]) ? $current_settings[$key] : $setting['value']; |
|
316 | 316 | |
317 | 317 | // default setting type = text |
318 | - $setting['type'] = empty( $setting['type'] ) ? 'text' : $setting['type']; |
|
318 | + $setting['type'] = empty($setting['type']) ? 'text' : $setting['type']; |
|
319 | 319 | |
320 | 320 | // merge tags |
321 | - if( !isset( $setting['merge_tags'] ) ) { |
|
322 | - if( $setting['type'] === 'text' ) { |
|
321 | + if (!isset($setting['merge_tags'])) { |
|
322 | + if ($setting['type'] === 'text') { |
|
323 | 323 | $setting['merge_tags'] = true; |
324 | 324 | } else { |
325 | 325 | $setting['merge_tags'] = false; |
@@ -329,27 +329,27 @@ discard block |
||
329 | 329 | $output = ''; |
330 | 330 | |
331 | 331 | // render the setting |
332 | - $type_class = self::load_type_class( $setting ); |
|
333 | - if( class_exists( $type_class ) ) { |
|
332 | + $type_class = self::load_type_class($setting); |
|
333 | + if (class_exists($type_class)) { |
|
334 | 334 | /** @var GravityView_FieldType $render_type */ |
335 | - $render_type = new $type_class( $name, $setting, $curr_value ); |
|
335 | + $render_type = new $type_class($name, $setting, $curr_value); |
|
336 | 336 | ob_start(); |
337 | - $render_type->render_setting( $override_input ); |
|
337 | + $render_type->render_setting($override_input); |
|
338 | 338 | $output = ob_get_clean(); |
339 | 339 | } |
340 | 340 | |
341 | 341 | // Check if setting is specific for a template |
342 | - if( !empty( $setting['show_in_template'] ) ) { |
|
343 | - if( !is_array( $setting['show_in_template'] ) ) { |
|
344 | - $setting['show_in_template'] = array( $setting['show_in_template'] ); |
|
342 | + if (!empty($setting['show_in_template'])) { |
|
343 | + if (!is_array($setting['show_in_template'])) { |
|
344 | + $setting['show_in_template'] = array($setting['show_in_template']); |
|
345 | 345 | } |
346 | - $show_if = ' data-show-if="'. implode( ' ', $setting['show_in_template'] ).'"'; |
|
346 | + $show_if = ' data-show-if="'.implode(' ', $setting['show_in_template']).'"'; |
|
347 | 347 | } else { |
348 | 348 | $show_if = ''; |
349 | 349 | } |
350 | 350 | |
351 | 351 | // output |
352 | - echo '<tr valign="top" '. $show_if .'>' . $output . '</tr>'; |
|
352 | + echo '<tr valign="top" '.$show_if.'>'.$output.'</tr>'; |
|
353 | 353 | |
354 | 354 | } |
355 | 355 | |
@@ -359,9 +359,9 @@ discard block |
||
359 | 359 | * @param array $field |
360 | 360 | * @return string type class name |
361 | 361 | */ |
362 | - public static function load_type_class( $field = NULL ) { |
|
362 | + public static function load_type_class($field = NULL) { |
|
363 | 363 | |
364 | - if( empty( $field['type'] ) ) { |
|
364 | + if (empty($field['type'])) { |
|
365 | 365 | return NULL; |
366 | 366 | } |
367 | 367 | |
@@ -370,20 +370,20 @@ discard block |
||
370 | 370 | * @param string $class_suffix field class suffix; `GravityView_FieldType_{$class_suffix}` |
371 | 371 | * @param array $field field data |
372 | 372 | */ |
373 | - $type_class = apply_filters( "gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_' . $field['type'], $field ); |
|
373 | + $type_class = apply_filters("gravityview/setting/class/{$field['type']}", 'GravityView_FieldType_'.$field['type'], $field); |
|
374 | 374 | |
375 | - if( !class_exists( $type_class ) ) { |
|
375 | + if (!class_exists($type_class)) { |
|
376 | 376 | |
377 | 377 | /** |
378 | 378 | * @filter `gravityview/setting/class_file/{field_type}` |
379 | 379 | * @param string $field_type_include_path field class file path |
380 | 380 | * @param array $field field data |
381 | 381 | */ |
382 | - $class_file = apply_filters( "gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR . "includes/admin/field-types/type_{$field['type']}.php", $field ); |
|
382 | + $class_file = apply_filters("gravityview/setting/class_file/{$field['type']}", GRAVITYVIEW_DIR."includes/admin/field-types/type_{$field['type']}.php", $field); |
|
383 | 383 | |
384 | - if( $class_file ) { |
|
385 | - if( file_exists( $class_file ) ) { |
|
386 | - require_once( $class_file ); |
|
384 | + if ($class_file) { |
|
385 | + if (file_exists($class_file)) { |
|
386 | + require_once($class_file); |
|
387 | 387 | } |
388 | 388 | } |
389 | 389 | |
@@ -403,10 +403,10 @@ discard block |
||
403 | 403 | * @param string $current current value |
404 | 404 | * @return string html tags |
405 | 405 | */ |
406 | - public static function render_checkbox_option( $name = '', $id = '', $current = '' ) { |
|
406 | + public static function render_checkbox_option($name = '', $id = '', $current = '') { |
|
407 | 407 | |
408 | - $output = '<input name="'. esc_attr( $name ) .'" type="hidden" value="0">'; |
|
409 | - $output .= '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="checkbox" value="1" '. checked( $current, '1', false ) .' >'; |
|
408 | + $output = '<input name="'.esc_attr($name).'" type="hidden" value="0">'; |
|
409 | + $output .= '<input name="'.esc_attr($name).'" id="'.esc_attr($id).'" type="checkbox" value="1" '.checked($current, '1', false).' >'; |
|
410 | 410 | |
411 | 411 | return $output; |
412 | 412 | } |
@@ -421,25 +421,25 @@ discard block |
||
421 | 421 | * @param array $args Field settings, including `class` key for CSS class |
422 | 422 | * @return string [html tags] |
423 | 423 | */ |
424 | - public static function render_text_option( $name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array() ) { |
|
424 | + public static function render_text_option($name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array()) { |
|
425 | 425 | |
426 | 426 | // Show the merge tags if the field is a list view |
427 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
427 | + $is_list = (preg_match('/_list-/ism', $name)); |
|
428 | 428 | |
429 | 429 | // Or is a single entry view |
430 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
431 | - $show = ( $is_single || $is_list ); |
|
430 | + $is_single = (preg_match('/single_/ism', $name)); |
|
431 | + $show = ($is_single || $is_list); |
|
432 | 432 | |
433 | 433 | $class = ''; |
434 | 434 | // and $add_merge_tags is not false |
435 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
435 | + if ($show && $add_merge_tags !== false || $add_merge_tags === 'force') { |
|
436 | 436 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
437 | 437 | } |
438 | 438 | |
439 | - $class .= !empty( $args['class'] ) ? $args['class'] : 'widefat'; |
|
440 | - $type = !empty( $args['type'] ) ? $args['type'] : 'text'; |
|
439 | + $class .= !empty($args['class']) ? $args['class'] : 'widefat'; |
|
440 | + $type = !empty($args['type']) ? $args['type'] : 'text'; |
|
441 | 441 | |
442 | - return '<input name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" type="'.esc_attr($type).'" value="'. esc_attr( $current ) .'" class="'.esc_attr( $class ).'">'; |
|
442 | + return '<input name="'.esc_attr($name).'" id="'.esc_attr($id).'" type="'.esc_attr($type).'" value="'.esc_attr($current).'" class="'.esc_attr($class).'">'; |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -451,24 +451,24 @@ discard block |
||
451 | 451 | * @param array $args Field settings, including `class` key for CSS class |
452 | 452 | * @return string [html tags] |
453 | 453 | */ |
454 | - public static function render_textarea_option( $name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array() ) { |
|
454 | + public static function render_textarea_option($name = '', $id = '', $current = '', $add_merge_tags = NULL, $args = array()) { |
|
455 | 455 | |
456 | 456 | // Show the merge tags if the field is a list view |
457 | - $is_list = ( preg_match( '/_list-/ism', $name )); |
|
457 | + $is_list = (preg_match('/_list-/ism', $name)); |
|
458 | 458 | |
459 | 459 | // Or is a single entry view |
460 | - $is_single = ( preg_match( '/single_/ism', $name )); |
|
461 | - $show = ( $is_single || $is_list ); |
|
460 | + $is_single = (preg_match('/single_/ism', $name)); |
|
461 | + $show = ($is_single || $is_list); |
|
462 | 462 | |
463 | 463 | $class = ''; |
464 | 464 | // and $add_merge_tags is not false |
465 | - if( $show && $add_merge_tags !== false || $add_merge_tags === 'force' ) { |
|
465 | + if ($show && $add_merge_tags !== false || $add_merge_tags === 'force') { |
|
466 | 466 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
467 | 467 | } |
468 | 468 | |
469 | - $class .= !empty( $args['class'] ) ? 'widefat '.$args['class'] : 'widefat'; |
|
469 | + $class .= !empty($args['class']) ? 'widefat '.$args['class'] : 'widefat'; |
|
470 | 470 | |
471 | - return '<textarea name="'. esc_attr( $name ) .'" id="'. esc_attr( $id ) .'" class="'.esc_attr( $class ).'">'. esc_textarea( $current ) .'</textarea>'; |
|
471 | + return '<textarea name="'.esc_attr($name).'" id="'.esc_attr($id).'" class="'.esc_attr($class).'">'.esc_textarea($current).'</textarea>'; |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -480,11 +480,11 @@ discard block |
||
480 | 480 | * @param string $current [current value] |
481 | 481 | * @return string [html tags] |
482 | 482 | */ |
483 | - public static function render_select_option( $name = '', $id = '', $choices, $current = '' ) { |
|
483 | + public static function render_select_option($name = '', $id = '', $choices, $current = '') { |
|
484 | 484 | |
485 | - $output = '<select name="'. $name .'" id="'. $id .'">'; |
|
486 | - foreach( $choices as $value => $label ) { |
|
487 | - $output .= '<option value="'. esc_attr( $value ) .'" '. selected( $value, $current, false ) .'>'. esc_html( $label ) .'</option>'; |
|
485 | + $output = '<select name="'.$name.'" id="'.$id.'">'; |
|
486 | + foreach ($choices as $value => $label) { |
|
487 | + $output .= '<option value="'.esc_attr($value).'" '.selected($value, $current, false).'>'.esc_html($label).'</option>'; |
|
488 | 488 | } |
489 | 489 | $output .= '</select>'; |
490 | 490 |