@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 10 | 10 | |
| 11 | 11 | echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
| 12 | - echo $this->get_tooltip() . $this->get_field_desc(); |
|
| 12 | + echo $this->get_tooltip().$this->get_field_desc(); |
|
| 13 | 13 | ?><div> |
| 14 | 14 | <?php $this->render_input(); ?> |
| 15 | 15 | </div> |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | <?php |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - function render_input( $override_input = null ) { |
|
| 20 | + function render_input($override_input = null) { |
|
| 21 | 21 | |
| 22 | - if( isset( $override_input ) ) { |
|
| 22 | + if (isset($override_input)) { |
|
| 23 | 23 | echo $override_input; |
| 24 | 24 | return; |
| 25 | 25 | } |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 31 | + if ($show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force') { |
|
| 32 | 32 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
| 33 | 33 | } |
| 34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
| 34 | + $class .= !empty($this->field['class']) ? $this->field['class'] : 'widefat'; |
|
| 35 | 35 | |
| 36 | 36 | ?> |
| 37 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
| 37 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr($this->value); ?>" class="<?php echo esc_attr($class); ?>"> |
|
| 38 | 38 | <?php |
| 39 | 39 | } |
| 40 | 40 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 11 | 11 | |
| 12 | 12 | echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
| 13 | - echo $this->get_tooltip() . $this->get_field_desc(); |
|
| 13 | + echo $this->get_tooltip().$this->get_field_desc(); |
|
| 14 | 14 | ?><div> |
| 15 | 15 | <?php $this->render_input(); ?> |
| 16 | 16 | </div> |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | <?php |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - function render_input( $override_input = null ) { |
|
| 22 | - if( isset( $override_input ) ) { |
|
| 21 | + function render_input($override_input = null) { |
|
| 22 | + if (isset($override_input)) { |
|
| 23 | 23 | echo $override_input; |
| 24 | 24 | return; |
| 25 | 25 | } |
@@ -28,17 +28,17 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $show_mt = $this->show_merge_tags(); |
| 30 | 30 | |
| 31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
| 31 | + if ($show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force') { |
|
| 32 | 32 | $class = ' merge-tag-support mt-position-right '; |
| 33 | 33 | |
| 34 | - if( empty( $this->field['show_all_fields'] ) ) { |
|
| 34 | + if (empty($this->field['show_all_fields'])) { |
|
| 35 | 35 | $class .= ' mt-hide_all_fields'; |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - $class .= !empty( $this->field['class'] ) ? 'widefat ' . $this->field['class'] : 'widefat'; |
|
| 38 | + $class .= !empty($this->field['class']) ? 'widefat '.$this->field['class'] : 'widefat'; |
|
| 39 | 39 | |
| 40 | 40 | ?> |
| 41 | - <textarea name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr( $class ); ?>" rows="5"><?php echo esc_textarea( $this->value ); ?></textarea> |
|
| 41 | + <textarea name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo esc_attr($class); ?>" rows="5"><?php echo esc_textarea($this->value); ?></textarea> |
|
| 42 | 42 | <?php |
| 43 | 43 | } |
| 44 | 44 | |
@@ -12,13 +12,13 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | function __construct() { |
| 14 | 14 | |
| 15 | - if( !GravityView_Compatibility::is_valid() ) { return; } |
|
| 15 | + if (!GravityView_Compatibility::is_valid()) { return; } |
|
| 16 | 16 | |
| 17 | - self::$metaboxes_dir = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/'; |
|
| 17 | + self::$metaboxes_dir = GRAVITYVIEW_DIR.'includes/admin/metaboxes/'; |
|
| 18 | 18 | |
| 19 | - include_once self::$metaboxes_dir . 'class-gravityview-metabox-tab.php'; |
|
| 19 | + include_once self::$metaboxes_dir.'class-gravityview-metabox-tab.php'; |
|
| 20 | 20 | |
| 21 | - include_once self::$metaboxes_dir . 'class-gravityview-metabox-tabs.php'; |
|
| 21 | + include_once self::$metaboxes_dir.'class-gravityview-metabox-tabs.php'; |
|
| 22 | 22 | |
| 23 | 23 | $this->initialize(); |
| 24 | 24 | |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | function initialize() { |
| 32 | 32 | |
| 33 | - add_action( 'add_meta_boxes', array( $this, 'register_metaboxes' )); |
|
| 33 | + add_action('add_meta_boxes', array($this, 'register_metaboxes')); |
|
| 34 | 34 | |
| 35 | - add_action( 'add_meta_boxes_gravityview' , array( $this, 'update_priority' ) ); |
|
| 35 | + add_action('add_meta_boxes_gravityview', array($this, 'update_priority')); |
|
| 36 | 36 | |
| 37 | 37 | // information box |
| 38 | - add_action( 'post_submitbox_misc_actions', array( $this, 'render_shortcode_hint' ) ); |
|
| 38 | + add_action('post_submitbox_misc_actions', array($this, 'render_shortcode_hint')); |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | function update_priority() { |
| 47 | 47 | global $wp_meta_boxes; |
| 48 | 48 | |
| 49 | - if( ! empty( $wp_meta_boxes['gravityview'] ) ) { |
|
| 50 | - foreach( array( 'high', 'core', 'low' ) as $position ) { |
|
| 51 | - if( isset( $wp_meta_boxes['gravityview']['normal'][ $position ] ) ) { |
|
| 52 | - foreach( $wp_meta_boxes['gravityview']['normal'][ $position ] as $key => $meta_box ) { |
|
| 53 | - if( ! preg_match( '/^gravityview_/ism', $key ) ) { |
|
| 54 | - $wp_meta_boxes['gravityview']['advanced'][ $position ][ $key ] = $meta_box; |
|
| 55 | - unset( $wp_meta_boxes['gravityview']['normal'][ $position ][ $key ] ); |
|
| 49 | + if (!empty($wp_meta_boxes['gravityview'])) { |
|
| 50 | + foreach (array('high', 'core', 'low') as $position) { |
|
| 51 | + if (isset($wp_meta_boxes['gravityview']['normal'][$position])) { |
|
| 52 | + foreach ($wp_meta_boxes['gravityview']['normal'][$position] as $key => $meta_box) { |
|
| 53 | + if (!preg_match('/^gravityview_/ism', $key)) { |
|
| 54 | + $wp_meta_boxes['gravityview']['advanced'][$position][$key] = $meta_box; |
|
| 55 | + unset($wp_meta_boxes['gravityview']['normal'][$position][$key]); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -64,23 +64,23 @@ discard block |
||
| 64 | 64 | global $post; |
| 65 | 65 | |
| 66 | 66 | // On Comment Edit, for example, $post isn't set. |
| 67 | - if( empty( $post ) || !is_object( $post ) || !isset( $post->ID ) ) { |
|
| 67 | + if (empty($post) || !is_object($post) || !isset($post->ID)) { |
|
| 68 | 68 | return; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // select data source for this view |
| 72 | - add_meta_box( 'gravityview_select_form', $this->get_data_source_header( $post->ID ), array( $this, 'render_data_source_metabox' ), 'gravityview', 'normal', 'high' ); |
|
| 72 | + add_meta_box('gravityview_select_form', $this->get_data_source_header($post->ID), array($this, 'render_data_source_metabox'), 'gravityview', 'normal', 'high'); |
|
| 73 | 73 | |
| 74 | 74 | // select view type/template |
| 75 | - add_meta_box( 'gravityview_select_template', __( 'Choose a View Type', 'gravityview' ), array( $this, 'render_select_template_metabox' ), 'gravityview', 'normal', 'high' ); |
|
| 75 | + add_meta_box('gravityview_select_template', __('Choose a View Type', 'gravityview'), array($this, 'render_select_template_metabox'), 'gravityview', 'normal', 'high'); |
|
| 76 | 76 | |
| 77 | 77 | // View Configuration box |
| 78 | - add_meta_box( 'gravityview_view_config', __( 'View Configuration', 'gravityview' ), array( $this, 'render_view_configuration_metabox' ), 'gravityview', 'normal', 'high' ); |
|
| 78 | + add_meta_box('gravityview_view_config', __('View Configuration', 'gravityview'), array($this, 'render_view_configuration_metabox'), 'gravityview', 'normal', 'high'); |
|
| 79 | 79 | |
| 80 | 80 | $this->add_settings_metabox_tabs(); |
| 81 | 81 | |
| 82 | 82 | // Other Settings box |
| 83 | - add_meta_box( 'gravityview_settings', __( 'View Settings', 'gravityview' ), array( $this, 'settings_metabox_render' ), 'gravityview', 'normal', 'core' ); |
|
| 83 | + add_meta_box('gravityview_settings', __('View Settings', 'gravityview'), array($this, 'settings_metabox_render'), 'gravityview', 'normal', 'core'); |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | |
@@ -89,22 +89,22 @@ discard block |
||
| 89 | 89 | * @since 1.8 |
| 90 | 90 | * @param WP_Post $post |
| 91 | 91 | */ |
| 92 | - function settings_metabox_render( $post ) { |
|
| 92 | + function settings_metabox_render($post) { |
|
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | 95 | * @param WP_Post $post |
| 96 | 96 | */ |
| 97 | - do_action( 'gravityview/metaboxes/before_render', $post ); |
|
| 97 | + do_action('gravityview/metaboxes/before_render', $post); |
|
| 98 | 98 | |
| 99 | 99 | $metaboxes = GravityView_Metabox_Tabs::get_all(); |
| 100 | 100 | |
| 101 | - include self::$metaboxes_dir . 'views/gravityview-navigation.php'; |
|
| 102 | - include self::$metaboxes_dir . 'views/gravityview-content.php'; |
|
| 101 | + include self::$metaboxes_dir.'views/gravityview-navigation.php'; |
|
| 102 | + include self::$metaboxes_dir.'views/gravityview-content.php'; |
|
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * @param WP_Post $post |
| 106 | 106 | */ |
| 107 | - do_action( 'gravityview/metaboxes/after_render', $post ); |
|
| 107 | + do_action('gravityview/metaboxes/after_render', $post); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $metaboxes = array( |
| 117 | 117 | array( |
| 118 | 118 | 'id' => 'template_settings', |
| 119 | - 'title' => __( 'View Settings', 'gravityview' ), |
|
| 119 | + 'title' => __('View Settings', 'gravityview'), |
|
| 120 | 120 | 'file' => 'view-settings.php', |
| 121 | 121 | 'icon-class' => 'dashicons-admin-generic', |
| 122 | 122 | 'callback' => '', |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | ), |
| 125 | 125 | array( |
| 126 | 126 | 'id' => 'single_entry', // Use the same ID as View Settings for backward compatibility |
| 127 | - 'title' => __( 'Single Entry', 'gravityview' ), |
|
| 127 | + 'title' => __('Single Entry', 'gravityview'), |
|
| 128 | 128 | 'file' => 'single-entry.php', |
| 129 | 129 | 'icon-class' => 'dashicons-media-default', |
| 130 | 130 | 'callback' => '', |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | ), |
| 133 | 133 | array( |
| 134 | 134 | 'id' => 'sort_filter', |
| 135 | - 'title' => __( 'Filter & Sort', 'gravityview' ), |
|
| 135 | + 'title' => __('Filter & Sort', 'gravityview'), |
|
| 136 | 136 | 'file' => 'sort-filter.php', |
| 137 | 137 | 'icon-class' => 'dashicons-sort', |
| 138 | 138 | 'callback' => '', |
@@ -145,17 +145,17 @@ discard block |
||
| 145 | 145 | * @param array $metaboxes |
| 146 | 146 | * @since 1.8 |
| 147 | 147 | */ |
| 148 | - $metaboxes = apply_filters( 'gravityview/metaboxes/default', $metaboxes ); |
|
| 148 | + $metaboxes = apply_filters('gravityview/metaboxes/default', $metaboxes); |
|
| 149 | 149 | |
| 150 | - foreach( $metaboxes as $m ) { |
|
| 150 | + foreach ($metaboxes as $m) { |
|
| 151 | 151 | |
| 152 | - $tab = new GravityView_Metabox_Tab( $m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args'] ); |
|
| 152 | + $tab = new GravityView_Metabox_Tab($m['id'], $m['title'], $m['file'], $m['icon-class'], $m['callback'], $m['callback_args']); |
|
| 153 | 153 | |
| 154 | - GravityView_Metabox_Tabs::add( $tab ); |
|
| 154 | + GravityView_Metabox_Tabs::add($tab); |
|
| 155 | 155 | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - unset( $tab ); |
|
| 158 | + unset($tab); |
|
| 159 | 159 | |
| 160 | 160 | } |
| 161 | 161 | |
@@ -168,18 +168,18 @@ discard block |
||
| 168 | 168 | * |
| 169 | 169 | * @return string "Data Source", plus links if any |
| 170 | 170 | */ |
| 171 | - private function get_data_source_header( $post_id ) { |
|
| 171 | + private function get_data_source_header($post_id) { |
|
| 172 | 172 | |
| 173 | 173 | //current value |
| 174 | - $current_form = gravityview_get_form_id( $post_id ); |
|
| 174 | + $current_form = gravityview_get_form_id($post_id); |
|
| 175 | 175 | |
| 176 | - $links = GravityView_Admin_Views::get_connected_form_links( $current_form, false ); |
|
| 176 | + $links = GravityView_Admin_Views::get_connected_form_links($current_form, false); |
|
| 177 | 177 | |
| 178 | - if( !empty( $links ) ) { |
|
| 179 | - $links = '<span class="alignright gv-form-links">'. $links .'</span>'; |
|
| 178 | + if (!empty($links)) { |
|
| 179 | + $links = '<span class="alignright gv-form-links">'.$links.'</span>'; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - return __( 'Data Source', 'gravityview' ) . $links; |
|
| 182 | + return __('Data Source', 'gravityview').$links; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -189,13 +189,13 @@ discard block |
||
| 189 | 189 | * @param object $post |
| 190 | 190 | * @return void |
| 191 | 191 | */ |
| 192 | - function render_data_source_metabox( $post ) { |
|
| 192 | + function render_data_source_metabox($post) { |
|
| 193 | 193 | |
| 194 | - if( !empty( $post->ID ) ) { |
|
| 194 | + if (!empty($post->ID)) { |
|
| 195 | 195 | $this->post_id = $post->ID; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - include self::$metaboxes_dir . 'views/data-source.php'; |
|
| 198 | + include self::$metaboxes_dir.'views/data-source.php'; |
|
| 199 | 199 | |
| 200 | 200 | } |
| 201 | 201 | |
@@ -206,9 +206,9 @@ discard block |
||
| 206 | 206 | * @param object $post |
| 207 | 207 | * @return void |
| 208 | 208 | */ |
| 209 | - function render_select_template_metabox( $post ) { |
|
| 209 | + function render_select_template_metabox($post) { |
|
| 210 | 210 | |
| 211 | - include self::$metaboxes_dir . 'views/select-template.php'; |
|
| 211 | + include self::$metaboxes_dir.'views/select-template.php'; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -217,18 +217,18 @@ discard block |
||
| 217 | 217 | * @param mixed $curr_form Form ID |
| 218 | 218 | * @return null|string Merge tags html; NULL if $curr_form isn't defined. |
| 219 | 219 | */ |
| 220 | - public static function render_merge_tags_scripts( $curr_form ) { |
|
| 220 | + public static function render_merge_tags_scripts($curr_form) { |
|
| 221 | 221 | |
| 222 | - if( empty( $curr_form )) { |
|
| 222 | + if (empty($curr_form)) { |
|
| 223 | 223 | return NULL; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - $form = gravityview_get_form( $curr_form ); |
|
| 226 | + $form = gravityview_get_form($curr_form); |
|
| 227 | 227 | |
| 228 | 228 | $get_id_backup = isset($_GET['id']) ? $_GET['id'] : NULL; |
| 229 | 229 | |
| 230 | - if( isset( $form['id'] ) ) { |
|
| 231 | - $form_script = 'var form = ' . GFCommon::json_encode($form) . ';'; |
|
| 230 | + if (isset($form['id'])) { |
|
| 231 | + $form_script = 'var form = '.GFCommon::json_encode($form).';'; |
|
| 232 | 232 | |
| 233 | 233 | // The `gf_vars()` method needs a $_GET[id] variable set with the form ID. |
| 234 | 234 | $_GET['id'] = $form['id']; |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $form_script = 'var form = new Form();'; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - $output = '<script type="text/javascript" data-gv-merge-tags="1">' . $form_script . "\n" . GFCommon::gf_vars(false) . '</script>'; |
|
| 240 | + $output = '<script type="text/javascript" data-gv-merge-tags="1">'.$form_script."\n".GFCommon::gf_vars(false).'</script>'; |
|
| 241 | 241 | |
| 242 | 242 | // Restore previous $_GET setting |
| 243 | 243 | $_GET['id'] = $get_id_backup; |
@@ -252,20 +252,20 @@ discard block |
||
| 252 | 252 | * @param mixed $post |
| 253 | 253 | * @return void |
| 254 | 254 | */ |
| 255 | - function render_view_configuration_metabox( $post ) { |
|
| 255 | + function render_view_configuration_metabox($post) { |
|
| 256 | 256 | |
| 257 | 257 | // Use nonce for verification |
| 258 | - wp_nonce_field( 'gravityview_view_configuration', 'gravityview_view_configuration_nonce' ); |
|
| 258 | + wp_nonce_field('gravityview_view_configuration', 'gravityview_view_configuration_nonce'); |
|
| 259 | 259 | |
| 260 | 260 | // Selected Form |
| 261 | - $curr_form = gravityview_get_form_id( $post->ID ); |
|
| 261 | + $curr_form = gravityview_get_form_id($post->ID); |
|
| 262 | 262 | |
| 263 | 263 | // Selected template |
| 264 | - $curr_template = gravityview_get_template_id( $post->ID ); |
|
| 264 | + $curr_template = gravityview_get_template_id($post->ID); |
|
| 265 | 265 | |
| 266 | - echo self::render_merge_tags_scripts( $curr_form ); |
|
| 266 | + echo self::render_merge_tags_scripts($curr_form); |
|
| 267 | 267 | |
| 268 | - include self::$metaboxes_dir . 'views/view-configuration.php'; |
|
| 268 | + include self::$metaboxes_dir.'views/view-configuration.php'; |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -275,12 +275,12 @@ discard block |
||
| 275 | 275 | * @param object $post |
| 276 | 276 | * @return void |
| 277 | 277 | */ |
| 278 | - function render_view_settings_metabox( $post ) { |
|
| 278 | + function render_view_settings_metabox($post) { |
|
| 279 | 279 | |
| 280 | 280 | // View template settings |
| 281 | - $current_settings = gravityview_get_template_settings( $post->ID ); |
|
| 281 | + $current_settings = gravityview_get_template_settings($post->ID); |
|
| 282 | 282 | |
| 283 | - include self::$metaboxes_dir . 'views/view-settings.php'; |
|
| 283 | + include self::$metaboxes_dir.'views/view-settings.php'; |
|
| 284 | 284 | |
| 285 | 285 | } |
| 286 | 286 | |
@@ -297,12 +297,12 @@ discard block |
||
| 297 | 297 | global $post; |
| 298 | 298 | |
| 299 | 299 | // Only show this on GravityView post types. |
| 300 | - if( false === gravityview_is_admin_page() ) { return; } |
|
| 300 | + if (false === gravityview_is_admin_page()) { return; } |
|
| 301 | 301 | |
| 302 | 302 | // If the View hasn't been configured yet, don't show embed shortcode |
| 303 | - if( !gravityview_get_directory_fields( $post->ID ) ) { return; } |
|
| 303 | + if (!gravityview_get_directory_fields($post->ID)) { return; } |
|
| 304 | 304 | |
| 305 | - include self::$metaboxes_dir . 'views/shortcode-hint.php'; |
|
| 305 | + include self::$metaboxes_dir.'views/shortcode-hint.php'; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | } |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | * @param null $callback_args Arguments passed to the callback |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | - function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = null ) { |
|
| 100 | + function __construct($id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = null) { |
|
| 101 | 101 | |
| 102 | 102 | $this->id = $this->prefix.$id; |
| 103 | 103 | $this->title = $title; |
| 104 | 104 | $this->render_template_file = $file; |
| 105 | 105 | $this->callback = $callback; |
| 106 | 106 | $this->callback_args = $callback_args; |
| 107 | - $this->icon_class_name = $this->parse_icon_class_name( $icon_class_name ); |
|
| 107 | + $this->icon_class_name = $this->parse_icon_class_name($icon_class_name); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -116,13 +116,13 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return string sanitized CSS class |
| 118 | 118 | */ |
| 119 | - function parse_icon_class_name( $icon_class_name = '' ) { |
|
| 119 | + function parse_icon_class_name($icon_class_name = '') { |
|
| 120 | 120 | |
| 121 | - if( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
| 122 | - $icon_class_name = 'dashicons ' . $icon_class_name; |
|
| 121 | + if (preg_match('/dashicon/i', $icon_class_name)) { |
|
| 122 | + $icon_class_name = 'dashicons '.$icon_class_name; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - return esc_attr( $icon_class_name ); |
|
| 125 | + return esc_attr($icon_class_name); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -140,38 +140,38 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @param WP_Post $post Currently edited post object |
| 142 | 142 | */ |
| 143 | - function render( $post ) { |
|
| 143 | + function render($post) { |
|
| 144 | 144 | |
| 145 | - if( !empty( $this->render_template_file ) ) { |
|
| 145 | + if (!empty($this->render_template_file)) { |
|
| 146 | 146 | |
| 147 | 147 | $file = $this->render_template_file; |
| 148 | 148 | |
| 149 | 149 | // If the full path exists, use it |
| 150 | - if( file_exists( $file ) ) { |
|
| 150 | + if (file_exists($file)) { |
|
| 151 | 151 | $path = $file; |
| 152 | 152 | } else { |
| 153 | - $path = GRAVITYVIEW_DIR .'includes/admin/metaboxes/views/'.$file; |
|
| 153 | + $path = GRAVITYVIEW_DIR.'includes/admin/metaboxes/views/'.$file; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if( file_exists( $path ) ) { |
|
| 156 | + if (file_exists($path)) { |
|
| 157 | 157 | include $path; |
| 158 | 158 | } else { |
| 159 | - do_action( 'gravityview_log_error', 'Metabox template file not found', $this ); |
|
| 159 | + do_action('gravityview_log_error', 'Metabox template file not found', $this); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - } else if( !empty( $this->callback ) ) { |
|
| 162 | + } else if (!empty($this->callback)) { |
|
| 163 | 163 | |
| 164 | - if( is_callable( $this->callback ) ) { |
|
| 164 | + if (is_callable($this->callback)) { |
|
| 165 | 165 | |
| 166 | 166 | /** @see do_accordion_sections() */ |
| 167 | - call_user_func( $this->callback, $post, (array) $this ); |
|
| 167 | + call_user_func($this->callback, $post, (array)$this); |
|
| 168 | 168 | |
| 169 | 169 | } else { |
| 170 | - do_action( 'gravityview_log_error', 'Metabox callback was not callable', $this ); |
|
| 170 | + do_action('gravityview_log_error', 'Metabox callback was not callable', $this); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | } else { |
| 174 | - do_action( 'gravityview_log_error', 'Metabox file and callback were not found', $this ); |
|
| 174 | + do_action('gravityview_log_error', 'Metabox file and callback were not found', $this); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | - public static function add( GravityView_Metabox_Tab $meta_box ) { |
|
| 28 | - self::$meta_boxes[ $meta_box->id ] = $meta_box; |
|
| 27 | + public static function add(GravityView_Metabox_Tab $meta_box) { |
|
| 28 | + self::$meta_boxes[$meta_box->id] = $meta_box; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | - public static function remove( $meta_box_id ) { |
|
| 41 | - if ( array_key_exists( $meta_box_id, self::$meta_boxes ) ) { |
|
| 42 | - unset( self::$meta_boxes[ $meta_box_id ] ); |
|
| 40 | + public static function remove($meta_box_id) { |
|
| 41 | + if (array_key_exists($meta_box_id, self::$meta_boxes)) { |
|
| 42 | + unset(self::$meta_boxes[$meta_box_id]); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return bool|GravityView_Metabox_Tab False if none exist at the key $id; GravityView_Metabox_Tab if exists. |
| 54 | 54 | */ |
| 55 | - public static function get( $id ) { |
|
| 56 | - if ( empty( self::$meta_boxes ) || empty( self::$meta_boxes[ $id ] ) ) { |
|
| 55 | + public static function get($id) { |
|
| 56 | + if (empty(self::$meta_boxes) || empty(self::$meta_boxes[$id])) { |
|
| 57 | 57 | return false; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - return self::$meta_boxes[ $id ]; |
|
| 60 | + return self::$meta_boxes[$id]; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -7,55 +7,55 @@ |
||
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | // Use nonce for verification |
| 10 | -wp_nonce_field( 'gravityview_select_form', 'gravityview_select_form_nonce' ); |
|
| 10 | +wp_nonce_field('gravityview_select_form', 'gravityview_select_form_nonce'); |
|
| 11 | 11 | |
| 12 | 12 | //current value |
| 13 | -$current_form = gravityview_get_form_id( $post->ID ); |
|
| 13 | +$current_form = gravityview_get_form_id($post->ID); |
|
| 14 | 14 | |
| 15 | 15 | // check for available gravity forms |
| 16 | 16 | $forms = gravityview_get_forms(); |
| 17 | 17 | |
| 18 | 18 | ?> |
| 19 | -<label for="gravityview_form_id" ><?php esc_html_e( 'Where would you like the data to come from for this View?', 'gravityview' ); ?></label> |
|
| 19 | +<label for="gravityview_form_id" ><?php esc_html_e('Where would you like the data to come from for this View?', 'gravityview'); ?></label> |
|
| 20 | 20 | |
| 21 | 21 | <p> |
| 22 | 22 | <?php |
| 23 | 23 | |
| 24 | - if ( empty( $current_form ) && GVCommon::has_cap( 'gravityforms_create_form' ) ) { |
|
| 24 | + if (empty($current_form) && GVCommon::has_cap('gravityforms_create_form')) { |
|
| 25 | 25 | ?> |
| 26 | - <a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e( 'Start Fresh', 'gravityview' ); ?>"><?php esc_html_e( 'Start Fresh', 'gravityview' ); ?></a> |
|
| 26 | + <a class="button button-primary" href="#gv_start_fresh" title="<?php esc_attr_e('Start Fresh', 'gravityview'); ?>"><?php esc_html_e('Start Fresh', 'gravityview'); ?></a> |
|
| 27 | 27 | |
| 28 | - <?php if( !empty( $forms ) ) { ?> |
|
| 29 | - <span> <?php esc_html_e( 'or use an existing form', 'gravityview' ); ?> </span> |
|
| 28 | + <?php if (!empty($forms)) { ?> |
|
| 29 | + <span> <?php esc_html_e('or use an existing form', 'gravityview'); ?> </span> |
|
| 30 | 30 | <?php } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | // If there are no forms to select, show no forms. |
| 34 | - if( !empty( $forms ) ) { ?> |
|
| 34 | + if (!empty($forms)) { ?> |
|
| 35 | 35 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 36 | - <option value="" <?php selected( '', $current_form, true ); ?>>— <?php esc_html_e( 'list of forms', 'gravityview' ); ?> —</option> |
|
| 37 | - <?php foreach( $forms as $form ) { ?> |
|
| 38 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 36 | + <option value="" <?php selected('', $current_form, true); ?>>— <?php esc_html_e('list of forms', 'gravityview'); ?> —</option> |
|
| 37 | + <?php foreach ($forms as $form) { ?> |
|
| 38 | + <option value="<?php echo $form['id']; ?>" <?php selected($form['id'], $current_form, true); ?>><?php echo esc_html($form['title']); ?></option> |
|
| 39 | 39 | <?php } ?> |
| 40 | 40 | </select> |
| 41 | 41 | <?php } ?> |
| 42 | 42 | |
| 43 | - <a class="button button-primary" <?php if( empty( $current_form ) ) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e( 'Switch View', 'gravityview' ); ?>"><?php esc_html_e( 'Switch View Type', 'gravityview' ); ?></a> |
|
| 43 | + <a class="button button-primary" <?php if (empty($current_form)) { echo 'style="display:none;"'; } ?> id="gv_switch_view_button" href="#gv_switch_view" title="<?php esc_attr_e('Switch View', 'gravityview'); ?>"><?php esc_html_e('Switch View Type', 'gravityview'); ?></a> |
|
| 44 | 44 | </p> |
| 45 | 45 | |
| 46 | 46 | <?php // confirm dialog box ?> |
| 47 | -<div id="gravityview_form_id_dialog" class="gv-dialog-options gv-dialog-warning" title="<?php esc_attr_e( 'Attention', 'gravityview' ); ?>"> |
|
| 48 | - <p><?php esc_html_e( 'Changing the form will reset your field configuration. Changes will be permanent once you save the View.', 'gravityview' ); ?></p> |
|
| 47 | +<div id="gravityview_form_id_dialog" class="gv-dialog-options gv-dialog-warning" title="<?php esc_attr_e('Attention', 'gravityview'); ?>"> |
|
| 48 | + <p><?php esc_html_e('Changing the form will reset your field configuration. Changes will be permanent once you save the View.', 'gravityview'); ?></p> |
|
| 49 | 49 | </div> |
| 50 | 50 | |
| 51 | 51 | <?php // confirm template dialog box ?> |
| 52 | -<div id="gravityview_switch_template_dialog" class="gv-dialog-options gv-dialog-warning" title="<?php esc_attr_e( 'Attention', 'gravityview' ); ?>"> |
|
| 53 | - <p><?php esc_html_e( 'Changing the View Type will reset your field configuration. Changes will be permanent once you save the View.', 'gravityview' ); ?></p> |
|
| 52 | +<div id="gravityview_switch_template_dialog" class="gv-dialog-options gv-dialog-warning" title="<?php esc_attr_e('Attention', 'gravityview'); ?>"> |
|
| 53 | + <p><?php esc_html_e('Changing the View Type will reset your field configuration. Changes will be permanent once you save the View.', 'gravityview'); ?></p> |
|
| 54 | 54 | </div> |
| 55 | 55 | |
| 56 | 56 | <?php // no js notice ?> |
| 57 | 57 | <div class="error hide-if-js"> |
| 58 | - <p><?php esc_html_e( 'GravityView requires Javascript to be enabled.', 'gravityview' ); ?></p> |
|
| 58 | + <p><?php esc_html_e('GravityView requires Javascript to be enabled.', 'gravityview'); ?></p> |
|
| 59 | 59 | </div> |
| 60 | 60 | |
| 61 | 61 | <?php |
@@ -19,11 +19,11 @@ |
||
| 19 | 19 | * Loop through the array of registered metaboxes |
| 20 | 20 | * @var GravityView_Metabox_Tab $metabox |
| 21 | 21 | */ |
| 22 | - foreach( $metaboxes as $metabox ) { |
|
| 22 | + foreach ($metaboxes as $metabox) { |
|
| 23 | 23 | |
| 24 | - echo '<div id="'.esc_attr( $metabox->id ).'">'; |
|
| 24 | + echo '<div id="'.esc_attr($metabox->id).'">'; |
|
| 25 | 25 | |
| 26 | - $metabox->render( $post ); |
|
| 26 | + $metabox->render($post); |
|
| 27 | 27 | |
| 28 | 28 | echo '</div>'; |
| 29 | 29 | } |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all"> |
| 15 | 15 | <?php |
| 16 | 16 | |
| 17 | - foreach( $metaboxes as $metabox ) { |
|
| 18 | - $class = !isset( $class ) ? 'nav-tab-active' : ''; |
|
| 17 | + foreach ($metaboxes as $metabox) { |
|
| 18 | + $class = !isset($class) ? 'nav-tab-active' : ''; |
|
| 19 | 19 | ?> |
| 20 | 20 | <li class="ui-state-default"> |
| 21 | - <a class="nav-tab ui-tabs-anchor <?php echo $class; ?>" href="#<?php echo esc_attr( $metabox->id ); ?>"> |
|
| 21 | + <a class="nav-tab ui-tabs-anchor <?php echo $class; ?>" href="#<?php echo esc_attr($metabox->id); ?>"> |
|
| 22 | 22 | <span class="<?php echo $metabox->icon_class_name; ?>"></span> |
| 23 | - <?php echo esc_html( $metabox->title ); ?> |
|
| 23 | + <?php echo esc_html($metabox->title); ?> |
|
| 24 | 24 | </a> |
| 25 | 25 | </li> |
| 26 | 26 | <?php |
@@ -9,40 +9,40 @@ |
||
| 9 | 9 | global $post; |
| 10 | 10 | |
| 11 | 11 | // Use nonce for verification |
| 12 | -wp_nonce_field( 'gravityview_select_template', 'gravityview_select_template_nonce' ); |
|
| 12 | +wp_nonce_field('gravityview_select_template', 'gravityview_select_template_nonce'); |
|
| 13 | 13 | |
| 14 | 14 | //current value |
| 15 | -$current_template = gravityview_get_template_id( $post->ID ); |
|
| 15 | +$current_template = gravityview_get_template_id($post->ID); |
|
| 16 | 16 | |
| 17 | 17 | $templates = gravityview_get_registered_templates(); |
| 18 | 18 | |
| 19 | 19 | // current input |
| 20 | 20 | ?> |
| 21 | -<input type="hidden" id="gravityview_directory_template" name="gravityview_directory_template" value="<?php echo esc_attr( $current_template ); ?>" /> |
|
| 21 | +<input type="hidden" id="gravityview_directory_template" name="gravityview_directory_template" value="<?php echo esc_attr($current_template); ?>" /> |
|
| 22 | 22 | |
| 23 | 23 | <?php // list all the available templates (type= fresh or custom ) ?> |
| 24 | 24 | <div class="gv-grid"> |
| 25 | - <?php foreach( $templates as $id => $template ) { |
|
| 26 | - $selected = ( $id == $current_template ) ? ' gv-selected' : ''; ?> |
|
| 25 | + <?php foreach ($templates as $id => $template) { |
|
| 26 | + $selected = ($id == $current_template) ? ' gv-selected' : ''; ?> |
|
| 27 | 27 | |
| 28 | 28 | <div class="gv-grid-col-1-3"> |
| 29 | - <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr( $template['type'] ); ?>"> |
|
| 29 | + <div class="gv-view-types-module<?php echo $selected; ?>" data-filter="<?php echo esc_attr($template['type']); ?>"> |
|
| 30 | 30 | <div class="gv-view-types-hover"> |
| 31 | 31 | <div> |
| 32 | - <?php if( !empty( $template['buy_source'] ) ) { ?> |
|
| 33 | - <p><a href="<?php echo esc_url( $template['buy_source'] ); ?>" class="button-primary button-buy-now"><?php esc_html_e( 'Buy Now', 'gravityview'); ?></a></p> |
|
| 32 | + <?php if (!empty($template['buy_source'])) { ?> |
|
| 33 | + <p><a href="<?php echo esc_url($template['buy_source']); ?>" class="button-primary button-buy-now"><?php esc_html_e('Buy Now', 'gravityview'); ?></a></p> |
|
| 34 | 34 | <?php } else { ?> |
| 35 | - <p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr( $id ); ?>"><?php esc_html_e( 'Select', 'gravityview'); ?></a></p> |
|
| 36 | - <?php if( !empty( $template['preview'] ) ) { ?> |
|
| 37 | - <a href="<?php echo esc_url( $template['preview'] ); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e( 'View a live demo of this preset', 'gravityview'); ?>"></i></a> |
|
| 35 | + <p><a href="#gv_select_template" class="button button-large button-primary" data-templateid="<?php echo esc_attr($id); ?>"><?php esc_html_e('Select', 'gravityview'); ?></a></p> |
|
| 36 | + <?php if (!empty($template['preview'])) { ?> |
|
| 37 | + <a href="<?php echo esc_url($template['preview']); ?>" rel="external" class="gv-site-preview"><i class="dashicons dashicons-admin-links" title="<?php esc_html_e('View a live demo of this preset', 'gravityview'); ?>"></i></a> |
|
| 38 | 38 | <?php } ?> |
| 39 | 39 | <?php } ?> |
| 40 | 40 | </div> |
| 41 | 41 | </div> |
| 42 | 42 | <div class="gv-view-types-normal"> |
| 43 | - <img src="<?php echo esc_url( $template['logo'] ); ?>" alt="<?php echo esc_attr( $template['label'] ); ?>"> |
|
| 44 | - <h5><?php echo esc_attr( $template['label'] ); ?></h5> |
|
| 45 | - <p class="description"><?php echo esc_attr( $template['description'] ); ?></p> |
|
| 43 | + <img src="<?php echo esc_url($template['logo']); ?>" alt="<?php echo esc_attr($template['label']); ?>"> |
|
| 44 | + <h5><?php echo esc_attr($template['label']); ?></h5> |
|
| 45 | + <p class="description"><?php echo esc_attr($template['description']); ?></p> |
|
| 46 | 46 | </div> |
| 47 | 47 | </div> |
| 48 | 48 | </div> |