@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Display the date_created field type |
|
| 4 | - * |
|
| 5 | - * @package GravityView |
|
| 6 | - * @subpackage GravityView/templates/fields |
|
| 7 | - */ |
|
| 3 | + * Display the date_created field type |
|
| 4 | + * |
|
| 5 | + * @package GravityView |
|
| 6 | + * @subpackage GravityView/templates/fields |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
| 10 | 10 | |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package GravityView |
|
| 4 | - * @subpackage Gravityview/admin/metaboxes/views |
|
| 5 | - * @since 1.8 |
|
| 6 | - * @global WP_Post $post |
|
| 7 | - */ |
|
| 3 | + * @package GravityView |
|
| 4 | + * @subpackage Gravityview/admin/metaboxes/views |
|
| 5 | + * @since 1.8 |
|
| 6 | + * @global WP_Post $post |
|
| 7 | + */ |
|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | // Use nonce for verification |
@@ -1,15 +1,15 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * GravityView templating engine class |
|
| 4 | - * |
|
| 5 | - * @package GravityView |
|
| 6 | - * @license GPL2+ |
|
| 7 | - * @author Katz Web Services, Inc. |
|
| 8 | - * @link http://gravityview.co |
|
| 9 | - * @copyright Copyright 2014, Katz Web Services, Inc. |
|
| 10 | - * |
|
| 11 | - * @since 1.0.0 |
|
| 12 | - */ |
|
| 3 | + * GravityView templating engine class |
|
| 4 | + * |
|
| 5 | + * @package GravityView |
|
| 6 | + * @license GPL2+ |
|
| 7 | + * @author Katz Web Services, Inc. |
|
| 8 | + * @link http://gravityview.co |
|
| 9 | + * @copyright Copyright 2014, Katz Web Services, Inc. |
|
| 10 | + * |
|
| 11 | + * @since 1.0.0 |
|
| 12 | + */ |
|
| 13 | 13 | |
| 14 | 14 | /** If this file is called directly, abort. */ |
| 15 | 15 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -10,159 +10,159 @@ discard block |
||
| 10 | 10 | * |
| 11 | 11 | * @var string |
| 12 | 12 | */ |
| 13 | - protected $name; |
|
| 13 | + protected $name; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Field settings |
| 17 | 17 | * |
| 18 | 18 | * @var array |
| 19 | 19 | */ |
| 20 | - protected $field; |
|
| 20 | + protected $field; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Field current value |
| 24 | 24 | * |
| 25 | 25 | * @var mixed |
| 26 | 26 | */ |
| 27 | - protected $value; |
|
| 28 | - |
|
| 29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
| 30 | - |
|
| 31 | - $this->name = $name; |
|
| 32 | - |
|
| 33 | - $defaults = self::get_field_defaults(); |
|
| 34 | - |
|
| 35 | - // Backward compatibility |
|
| 36 | - if( !empty( $field['choices'] ) ) { |
|
| 37 | - $field['options'] = $field['choices']; |
|
| 38 | - unset( $field['choices'] ); |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
| 42 | - |
|
| 43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
| 44 | - |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Returns the default details for a field option |
|
| 49 | - * |
|
| 50 | - * - default // default option value, in case nothing is defined (@deprecated) |
|
| 51 | - * - desc // option description |
|
| 52 | - * - value // the option default value |
|
| 53 | - * - label // the option label |
|
| 54 | - * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
| 55 | - * - id // the field id |
|
| 56 | - * - type // the option type ( text, checkbox, select, ... ) |
|
| 57 | - * - options // when type is select, define the select options ('choices' is @deprecated) |
|
| 58 | - * - merge_tags // if the option supports merge tags feature |
|
| 59 | - * - class // (new) define extra classes for the field |
|
| 60 | - * - tooltip // |
|
| 61 | - * |
|
| 62 | - * @return array |
|
| 63 | - */ |
|
| 64 | - public static function get_field_defaults() { |
|
| 65 | - return array( |
|
| 66 | - 'desc' => '', |
|
| 67 | - 'value' => NULL, |
|
| 68 | - 'label' => '', |
|
| 69 | - 'left_label' => NULL, |
|
| 70 | - 'id' => NULL, |
|
| 71 | - 'type' => 'text', |
|
| 72 | - 'options' => NULL, |
|
| 73 | - 'merge_tags' => true, |
|
| 74 | - 'class' => '', |
|
| 75 | - 'tooltip' => NULL |
|
| 76 | - ); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - function get_tooltip() { |
|
| 81 | - if( !function_exists('gform_tooltip') ) { |
|
| 82 | - return NULL; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Build input id based on the name |
|
| 90 | - * @return string |
|
| 91 | - */ |
|
| 92 | - function get_field_id() { |
|
| 93 | - if( isset( $this->field['id'] ) ) { |
|
| 94 | - return esc_attr( $this->field['id'] ); |
|
| 95 | - } |
|
| 96 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
| 97 | - } |
|
| 98 | - |
|
| 99 | - /** |
|
| 100 | - * Retrieve field label |
|
| 101 | - * @return string |
|
| 102 | - */ |
|
| 103 | - function get_field_label() { |
|
| 104 | - return esc_html( trim( $this->field['label'] ) ); |
|
| 105 | - } |
|
| 27 | + protected $value; |
|
| 28 | + |
|
| 29 | + function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
| 30 | + |
|
| 31 | + $this->name = $name; |
|
| 32 | + |
|
| 33 | + $defaults = self::get_field_defaults(); |
|
| 34 | + |
|
| 35 | + // Backward compatibility |
|
| 36 | + if( !empty( $field['choices'] ) ) { |
|
| 37 | + $field['options'] = $field['choices']; |
|
| 38 | + unset( $field['choices'] ); |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
| 42 | + |
|
| 43 | + $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
| 44 | + |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Returns the default details for a field option |
|
| 49 | + * |
|
| 50 | + * - default // default option value, in case nothing is defined (@deprecated) |
|
| 51 | + * - desc // option description |
|
| 52 | + * - value // the option default value |
|
| 53 | + * - label // the option label |
|
| 54 | + * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
| 55 | + * - id // the field id |
|
| 56 | + * - type // the option type ( text, checkbox, select, ... ) |
|
| 57 | + * - options // when type is select, define the select options ('choices' is @deprecated) |
|
| 58 | + * - merge_tags // if the option supports merge tags feature |
|
| 59 | + * - class // (new) define extra classes for the field |
|
| 60 | + * - tooltip // |
|
| 61 | + * |
|
| 62 | + * @return array |
|
| 63 | + */ |
|
| 64 | + public static function get_field_defaults() { |
|
| 65 | + return array( |
|
| 66 | + 'desc' => '', |
|
| 67 | + 'value' => NULL, |
|
| 68 | + 'label' => '', |
|
| 69 | + 'left_label' => NULL, |
|
| 70 | + 'id' => NULL, |
|
| 71 | + 'type' => 'text', |
|
| 72 | + 'options' => NULL, |
|
| 73 | + 'merge_tags' => true, |
|
| 74 | + 'class' => '', |
|
| 75 | + 'tooltip' => NULL |
|
| 76 | + ); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + function get_tooltip() { |
|
| 81 | + if( !function_exists('gform_tooltip') ) { |
|
| 82 | + return NULL; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Build input id based on the name |
|
| 90 | + * @return string |
|
| 91 | + */ |
|
| 92 | + function get_field_id() { |
|
| 93 | + if( isset( $this->field['id'] ) ) { |
|
| 94 | + return esc_attr( $this->field['id'] ); |
|
| 95 | + } |
|
| 96 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
| 97 | + } |
|
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * Retrieve field label |
|
| 101 | + * @return string |
|
| 102 | + */ |
|
| 103 | + function get_field_label() { |
|
| 104 | + return esc_html( trim( $this->field['label'] ) ); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * Retrieve field left label |
| 109 | - * |
|
| 110 | - * @since 1.7 |
|
| 111 | - * |
|
| 109 | + * |
|
| 110 | + * @since 1.7 |
|
| 111 | + * |
|
| 112 | 112 | * @return string |
| 113 | 113 | */ |
| 114 | 114 | function get_field_left_label() { |
| 115 | 115 | return ! empty( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Retrieve field label class |
|
| 120 | - * @return string |
|
| 121 | - */ |
|
| 122 | - function get_label_class() { |
|
| 123 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * Retrieve field description |
|
| 129 | - * @return string |
|
| 130 | - */ |
|
| 131 | - function get_field_desc() { |
|
| 132 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Verify if field should have merge tags |
|
| 138 | - * @return boolean |
|
| 139 | - */ |
|
| 140 | - function show_merge_tags() { |
|
| 141 | - // Show the merge tags if the field is a list view |
|
| 142 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
| 143 | - // Or is a single entry view |
|
| 144 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
| 145 | - |
|
| 146 | - return ( $is_single || $is_list ); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * important! Override this class |
|
| 153 | - * outputs the field option html |
|
| 154 | - */ |
|
| 155 | - function render_option() { |
|
| 156 | - // to replace on each field |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * important! Override this class if needed |
|
| 161 | - * outputs the field setting html |
|
| 162 | - */ |
|
| 163 | - function render_setting( $override_input = NULL ) { |
|
| 164 | - |
|
| 165 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
| 118 | + /** |
|
| 119 | + * Retrieve field label class |
|
| 120 | + * @return string |
|
| 121 | + */ |
|
| 122 | + function get_label_class() { |
|
| 123 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * Retrieve field description |
|
| 129 | + * @return string |
|
| 130 | + */ |
|
| 131 | + function get_field_desc() { |
|
| 132 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Verify if field should have merge tags |
|
| 138 | + * @return boolean |
|
| 139 | + */ |
|
| 140 | + function show_merge_tags() { |
|
| 141 | + // Show the merge tags if the field is a list view |
|
| 142 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
| 143 | + // Or is a single entry view |
|
| 144 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
| 145 | + |
|
| 146 | + return ( $is_single || $is_list ); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * important! Override this class |
|
| 153 | + * outputs the field option html |
|
| 154 | + */ |
|
| 155 | + function render_option() { |
|
| 156 | + // to replace on each field |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * important! Override this class if needed |
|
| 161 | + * outputs the field setting html |
|
| 162 | + */ |
|
| 163 | + function render_setting( $override_input = NULL ) { |
|
| 164 | + |
|
| 165 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
| 166 | 166 | <th scope="row" colspan="2"> |
| 167 | 167 | <div> |
| 168 | 168 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -182,14 +182,14 @@ discard block |
||
| 182 | 182 | </td> |
| 183 | 183 | <?php } |
| 184 | 184 | |
| 185 | - } |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - /** |
|
| 188 | - * important! Override this class |
|
| 189 | - * outputs the input html part |
|
| 190 | - */ |
|
| 191 | - function render_input( $override_input ) { |
|
| 192 | - echo ''; |
|
| 193 | - } |
|
| 187 | + /** |
|
| 188 | + * important! Override this class |
|
| 189 | + * outputs the input html part |
|
| 190 | + */ |
|
| 191 | + function render_input( $override_input ) { |
|
| 192 | + echo ''; |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | } |
@@ -1,29 +1,29 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @file gravityview.php |
|
| 4 | - * |
|
| 5 | - * The GravityView plugin |
|
| 6 | - * |
|
| 7 | - * Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output. |
|
| 8 | - * |
|
| 9 | - * @package GravityView |
|
| 10 | - * @license GPL2+ |
|
| 11 | - * @author Katz Web Services, Inc. |
|
| 12 | - * @link http://gravityview.co |
|
| 13 | - * @copyright Copyright 2016, Katz Web Services, Inc. |
|
| 14 | - * |
|
| 15 | - * @wordpress-plugin |
|
| 16 | - * Plugin Name: GravityView |
|
| 17 | - * Plugin URI: http://gravityview.co |
|
| 18 | - * Description: Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output. |
|
| 19 | - * Version: 1.16-beta |
|
| 20 | - * Author: Katz Web Services, Inc. |
|
| 21 | - * Author URI: http://www.katzwebservices.com |
|
| 22 | - * Text Domain: gravityview |
|
| 23 | - * License: GPLv2 or later |
|
| 24 | - * License URI: http://www.gnu.org/licenses/gpl-2.0.html |
|
| 25 | - * Domain Path: /languages |
|
| 26 | - */ |
|
| 3 | + * @file gravityview.php |
|
| 4 | + * |
|
| 5 | + * The GravityView plugin |
|
| 6 | + * |
|
| 7 | + * Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output. |
|
| 8 | + * |
|
| 9 | + * @package GravityView |
|
| 10 | + * @license GPL2+ |
|
| 11 | + * @author Katz Web Services, Inc. |
|
| 12 | + * @link http://gravityview.co |
|
| 13 | + * @copyright Copyright 2016, Katz Web Services, Inc. |
|
| 14 | + * |
|
| 15 | + * @wordpress-plugin |
|
| 16 | + * Plugin Name: GravityView |
|
| 17 | + * Plugin URI: http://gravityview.co |
|
| 18 | + * Description: Create directories based on a Gravity Forms form, insert them using a shortcode, and modify how they output. |
|
| 19 | + * Version: 1.16-beta |
|
| 20 | + * Author: Katz Web Services, Inc. |
|
| 21 | + * Author URI: http://www.katzwebservices.com |
|
| 22 | + * Text Domain: gravityview |
|
| 23 | + * License: GPLv2 or later |
|
| 24 | + * License URI: http://www.gnu.org/licenses/gpl-2.0.html |
|
| 25 | + * Domain Path: /languages |
|
| 26 | + */ |
|
| 27 | 27 | |
| 28 | 28 | /** If this file is called directly, abort. */ |
| 29 | 29 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -311,11 +311,11 @@ discard block |
||
| 311 | 311 | include_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-change-entry-creator.php' ); |
| 312 | 312 | |
| 313 | 313 | |
| 314 | - /** |
|
| 315 | - * When an entry is created, check if we need to update the custom slug meta |
|
| 316 | - * todo: move this to its own class.. |
|
| 317 | - */ |
|
| 318 | - add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 314 | + /** |
|
| 315 | + * When an entry is created, check if we need to update the custom slug meta |
|
| 316 | + * todo: move this to its own class.. |
|
| 317 | + */ |
|
| 318 | + add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded |
@@ -345,34 +345,34 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | /** DEBUG */ |
| 347 | 347 | |
| 348 | - /** |
|
| 349 | - * Logs messages using Gravity Forms logging add-on |
|
| 350 | - * @param string $message log message |
|
| 351 | - * @param mixed $data Additional data to display |
|
| 352 | - * @return void |
|
| 353 | - */ |
|
| 354 | - public static function log_debug( $message, $data = null ){ |
|
| 355 | - /** |
|
| 356 | - * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 357 | - * @param string $message Message to display |
|
| 358 | - * @param mixed $data Supporting data to print alongside it |
|
| 359 | - */ |
|
| 360 | - do_action( 'gravityview_log_debug', $message, $data ); |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - /** |
|
| 364 | - * Logs messages using Gravity Forms logging add-on |
|
| 365 | - * @param string $message log message |
|
| 366 | - * @return void |
|
| 367 | - */ |
|
| 368 | - public static function log_error( $message, $data = null ){ |
|
| 369 | - /** |
|
| 370 | - * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 371 | - * @param string $message Error message to display |
|
| 372 | - * @param mixed $data Supporting data to print alongside it |
|
| 373 | - */ |
|
| 374 | - do_action( 'gravityview_log_error', $message, $data ); |
|
| 375 | - } |
|
| 348 | + /** |
|
| 349 | + * Logs messages using Gravity Forms logging add-on |
|
| 350 | + * @param string $message log message |
|
| 351 | + * @param mixed $data Additional data to display |
|
| 352 | + * @return void |
|
| 353 | + */ |
|
| 354 | + public static function log_debug( $message, $data = null ){ |
|
| 355 | + /** |
|
| 356 | + * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 357 | + * @param string $message Message to display |
|
| 358 | + * @param mixed $data Supporting data to print alongside it |
|
| 359 | + */ |
|
| 360 | + do_action( 'gravityview_log_debug', $message, $data ); |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + /** |
|
| 364 | + * Logs messages using Gravity Forms logging add-on |
|
| 365 | + * @param string $message log message |
|
| 366 | + * @return void |
|
| 367 | + */ |
|
| 368 | + public static function log_error( $message, $data = null ){ |
|
| 369 | + /** |
|
| 370 | + * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
|
| 371 | + * @param string $message Error message to display |
|
| 372 | + * @param mixed $data Supporting data to print alongside it |
|
| 373 | + */ |
|
| 374 | + do_action( 'gravityview_log_error', $message, $data ); |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | 377 | } // end class GravityView_Plugin |
| 378 | 378 | |