@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | protected $script_handles = array( |
| 25 | 25 | 'rcp-admin-scripts', |
| 26 | - 'bbq', |
|
| 26 | + 'bbq', |
|
| 27 | 27 | ); |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | if( empty( $connected_views ) ) { |
| 138 | 138 | |
| 139 | - $menu_items['gravityview'] = array( |
|
| 139 | + $menu_items['gravityview'] = array( |
|
| 140 | 140 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 141 | 141 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 142 | 142 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -167,13 +167,13 @@ discard block |
||
| 167 | 167 | // If there were no items added, then let's create the parent menu |
| 168 | 168 | if( $sub_menu_items ) { |
| 169 | 169 | |
| 170 | - $sub_menu_items[] = array( |
|
| 171 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 172 | - 'link_class' => 'gv-create-view', |
|
| 173 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 174 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 175 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
| 176 | - ); |
|
| 170 | + $sub_menu_items[] = array( |
|
| 171 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 172 | + 'link_class' => 'gv-create-view', |
|
| 173 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 174 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 175 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
| 176 | + ); |
|
| 177 | 177 | |
| 178 | 178 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 179 | 179 | $sub_menu_items[] = array( |
@@ -549,12 +549,12 @@ discard block |
||
| 549 | 549 | * Render html for displaying available fields based on a Form ID |
| 550 | 550 | * $blacklist_field_types - contains the field types which are not proper to be shown in a directory. |
| 551 | 551 | * |
| 552 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 552 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 553 | 553 | * @access public |
| 554 | - * |
|
| 554 | + * |
|
| 555 | 555 | * @param int $form Gravity Forms Form ID (default: '') |
| 556 | 556 | * @param string $context (default: 'single') |
| 557 | - * |
|
| 557 | + * |
|
| 558 | 558 | * @return void |
| 559 | 559 | */ |
| 560 | 560 | function render_available_fields( $form = 0, $context = 'single' ) { |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | if ( ! is_array( $blacklist_field_types ) ) { |
| 570 | 570 | |
| 571 | - do_action( 'gravityview_log_error', __METHOD__ . ': $blacklist_field_types is not an array', print_r( $blacklist_field_types, true ) ); |
|
| 571 | + do_action( 'gravityview_log_error', __METHOD__ . ': $blacklist_field_types is not an array', print_r( $blacklist_field_types, true ) ); |
|
| 572 | 572 | |
| 573 | 573 | $blacklist_field_types = array(); |
| 574 | 574 | } |
@@ -700,12 +700,12 @@ discard block |
||
| 700 | 700 | /** |
| 701 | 701 | * @since 1.7.2 |
| 702 | 702 | */ |
| 703 | - 'other_entries' => array( |
|
| 704 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 705 | - 'type' => 'other_entries', |
|
| 706 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 707 | - ), |
|
| 708 | - ); |
|
| 703 | + 'other_entries' => array( |
|
| 704 | + 'label' => __('Other Entries', 'gravityview'), |
|
| 705 | + 'type' => 'other_entries', |
|
| 706 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 707 | + ), |
|
| 708 | + ); |
|
| 709 | 709 | |
| 710 | 710 | if( 'single' !== $zone) { |
| 711 | 711 | |
@@ -1016,59 +1016,59 @@ discard block |
||
| 1016 | 1016 | |
| 1017 | 1017 | // Don't process any scripts below here if it's not a GravityView page. |
| 1018 | 1018 | if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
| 1019 | - return; |
|
| 1019 | + return; |
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1023 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 1024 | - |
|
| 1025 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1026 | - |
|
| 1027 | - //enqueue scripts |
|
| 1028 | - wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
|
| 1029 | - |
|
| 1030 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1031 | - 'cookiepath' => COOKIEPATH, |
|
| 1032 | - 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
| 1033 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1034 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1035 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1036 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1037 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1038 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1039 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1040 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1041 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1042 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1043 | - 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
|
| 1044 | - )); |
|
| 1045 | - |
|
| 1046 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1047 | - |
|
| 1048 | - // Enqueue scripts needed for merge tags |
|
| 1049 | - self::enqueue_gravity_forms_scripts(); |
|
| 1022 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1023 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 1024 | + |
|
| 1025 | + $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1026 | + |
|
| 1027 | + //enqueue scripts |
|
| 1028 | + wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
|
| 1029 | + |
|
| 1030 | + wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1031 | + 'cookiepath' => COOKIEPATH, |
|
| 1032 | + 'passed_form_id' => (bool) rgget( 'form_id' ), |
|
| 1033 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1034 | + 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1035 | + 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1036 | + 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1037 | + 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1038 | + 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1039 | + 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1040 | + 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1041 | + 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1042 | + 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1043 | + 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
|
| 1044 | + )); |
|
| 1045 | + |
|
| 1046 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1047 | + |
|
| 1048 | + // Enqueue scripts needed for merge tags |
|
| 1049 | + self::enqueue_gravity_forms_scripts(); |
|
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | /** |
| 1053 | 1053 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
| 1054 | - * |
|
| 1055 | - * @since 1.0.5-beta |
|
| 1056 | - * |
|
| 1057 | - * @return void |
|
| 1054 | + * |
|
| 1055 | + * @since 1.0.5-beta |
|
| 1056 | + * |
|
| 1057 | + * @return void |
|
| 1058 | 1058 | */ |
| 1059 | 1059 | static function enqueue_gravity_forms_scripts() { |
| 1060 | 1060 | GFForms::register_scripts(); |
| 1061 | 1061 | |
| 1062 | 1062 | $scripts = array( |
| 1063 | - 'sack', |
|
| 1064 | - 'gform_gravityforms', |
|
| 1065 | - 'gform_forms', |
|
| 1066 | - 'gform_form_admin', |
|
| 1067 | - 'jquery-ui-autocomplete' |
|
| 1063 | + 'sack', |
|
| 1064 | + 'gform_gravityforms', |
|
| 1065 | + 'gform_forms', |
|
| 1066 | + 'gform_form_admin', |
|
| 1067 | + 'jquery-ui-autocomplete' |
|
| 1068 | 1068 | ); |
| 1069 | 1069 | |
| 1070 | 1070 | if ( wp_is_mobile() ) { |
| 1071 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1071 | + $scripts[] = 'jquery-touch-punch'; |
|
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | 1074 | wp_enqueue_script( $scripts ); |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
| 13 | 13 | |
| 14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
| 15 | - add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
| 15 | + add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
| 16 | 16 | |
| 17 | - // Load Debug Bar integration |
|
| 18 | - add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
| 17 | + // Load Debug Bar integration |
|
| 18 | + add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
| 19 | 19 | |
| 20 | 20 | } |
| 21 | 21 | |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * @param array $supported_plugins List of plugins |
| 45 | 45 | */ |
| 46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
| 47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
| 48 | - return $supported_plugins; |
|
| 47 | + $supported_plugins['gravityview'] = 'GravityView'; |
|
| 48 | + return $supported_plugins; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | if ( class_exists("GFLogging") ) { |
| 98 | 98 | GFLogging::include_logger(); |
| 99 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
| 100 | - } |
|
| 99 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
| 100 | + } |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | static function log_error( $message = '', $data = null ) { |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if ( class_exists("GFLogging") ) { |
| 118 | - GFLogging::include_logger(); |
|
| 119 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR ); |
|
| 118 | + GFLogging::include_logger(); |
|
| 119 | + GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR ); |
|
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | 122 | |
@@ -122,10 +122,10 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | - * Uninstall all traces of GravityView |
|
| 126 | - * |
|
| 127 | - * Note: method is public because parent method is public |
|
| 128 | - * |
|
| 125 | + * Uninstall all traces of GravityView |
|
| 126 | + * |
|
| 127 | + * Note: method is public because parent method is public |
|
| 128 | + * |
|
| 129 | 129 | * @return bool |
| 130 | 130 | */ |
| 131 | 131 | public function uninstall() { |
@@ -137,53 +137,53 @@ discard block |
||
| 137 | 137 | $uninstaller->fire_everything(); |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * Set the path so that Gravity Forms can de-activate GravityView |
|
| 141 | - * @see GFAddOn::uninstall_addon |
|
| 142 | - * @uses deactivate_plugins() |
|
| 143 | - */ |
|
| 140 | + * Set the path so that Gravity Forms can de-activate GravityView |
|
| 141 | + * @see GFAddOn::uninstall_addon |
|
| 142 | + * @uses deactivate_plugins() |
|
| 143 | + */ |
|
| 144 | 144 | $this->_path = GRAVITYVIEW_FILE; |
| 145 | 145 | |
| 146 | 146 | return true; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * Get an array of reasons why the plugin might be uninstalled |
|
| 151 | - * |
|
| 152 | - * @since 1.17.5 |
|
| 153 | - * |
|
| 150 | + * Get an array of reasons why the plugin might be uninstalled |
|
| 151 | + * |
|
| 152 | + * @since 1.17.5 |
|
| 153 | + * |
|
| 154 | 154 | * @return array Array of reasons with the label and followup questions for each uninstall reason |
| 155 | 155 | */ |
| 156 | 156 | private function get_uninstall_reasons() { |
| 157 | 157 | |
| 158 | 158 | $reasons = array( |
| 159 | 159 | 'will-continue' => array( |
| 160 | - 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
| 161 | - ), |
|
| 160 | + 'label' => esc_html__( 'I am going to continue using GravityView', 'gravityview' ), |
|
| 161 | + ), |
|
| 162 | 162 | 'no-longer-need' => array( |
| 163 | - 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
| 164 | - ), |
|
| 163 | + 'label' => esc_html__( 'I no longer need GravityView', 'gravityview' ), |
|
| 164 | + ), |
|
| 165 | 165 | 'doesnt-work' => array( |
| 166 | - 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
| 167 | - ), |
|
| 166 | + 'label' => esc_html__( 'The plugin doesn\'t work', 'gravityview' ), |
|
| 167 | + ), |
|
| 168 | 168 | 'found-other' => array( |
| 169 | - 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
| 170 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 171 | - ), |
|
| 169 | + 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
|
| 170 | + 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 171 | + ), |
|
| 172 | 172 | 'other' => array( |
| 173 | - 'label' => esc_html__( 'Other', 'gravityview' ), |
|
| 174 | - ), |
|
| 173 | + 'label' => esc_html__( 'Other', 'gravityview' ), |
|
| 174 | + ), |
|
| 175 | 175 | ); |
| 176 | 176 | |
| 177 | 177 | shuffle( $reasons ); |
| 178 | 178 | |
| 179 | 179 | return $reasons; |
| 180 | - } |
|
| 180 | + } |
|
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * Display a feedback form when the plugin is uninstalled |
|
| 184 | - * |
|
| 185 | - * @since 1.17.5 |
|
| 186 | - * |
|
| 183 | + * Display a feedback form when the plugin is uninstalled |
|
| 184 | + * |
|
| 185 | + * @since 1.17.5 |
|
| 186 | + * |
|
| 187 | 187 | * @return string HTML of the uninstallation form |
| 188 | 188 | */ |
| 189 | 189 | public function uninstall_form() { |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | <h2><?php esc_html_e( 'Why did you uninstall GravityView?', 'gravityview' ); ?></h2> |
| 264 | 264 | <ul> |
| 265 | 265 | <?php |
| 266 | - $reasons = $this->get_uninstall_reasons(); |
|
| 266 | + $reasons = $this->get_uninstall_reasons(); |
|
| 267 | 267 | foreach ( $reasons as $reason ) { |
| 268 | 268 | printf( '<li><label><input name="reason" type="radio" value="other" data-followup="%s"> %s</label></li>', rgar( $reason, 'followup' ), rgar( $reason, 'label' ) ); |
| 269 | 269 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $license_key = self::getSetting('license_key'); |
| 427 | 427 | if( '' === $license_key ) { |
| 428 | 428 | $license_status = 'inactive'; |
| 429 | - } |
|
| 429 | + } |
|
| 430 | 430 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
| 431 | 431 | |
| 432 | 432 | $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | $update_below = false; |
| 442 | 442 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
| 443 | 443 | |
| 444 | - switch ( $license_status ) { |
|
| 444 | + switch ( $license_status ) { |
|
| 445 | 445 | /** @since 1.17 */ |
| 446 | 446 | case 'expired': |
| 447 | 447 | $title = __('Expired License', 'gravityview'); |
@@ -487,12 +487,12 @@ discard block |
||
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | /** |
| 490 | - * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
| 491 | - * |
|
| 492 | - * @since 1.21.5 |
|
| 493 | - * |
|
| 494 | - * @see GFAddOn::scripts() |
|
| 495 | - * |
|
| 490 | + * Add tooltip script to app settings page. Not enqueued by Gravity Forms for some reason. |
|
| 491 | + * |
|
| 492 | + * @since 1.21.5 |
|
| 493 | + * |
|
| 494 | + * @see GFAddOn::scripts() |
|
| 495 | + * |
|
| 496 | 496 | * @return array Array of scripts |
| 497 | 497 | */ |
| 498 | 498 | public function scripts() { |
@@ -501,10 +501,10 @@ discard block |
||
| 501 | 501 | $scripts[] = array( |
| 502 | 502 | 'handle' => 'gform_tooltip_init', |
| 503 | 503 | 'enqueue' => array( |
| 504 | - array( |
|
| 505 | - 'admin_page' => array( 'app_settings' ) |
|
| 506 | - ) |
|
| 507 | - ) |
|
| 504 | + array( |
|
| 505 | + 'admin_page' => array( 'app_settings' ) |
|
| 506 | + ) |
|
| 507 | + ) |
|
| 508 | 508 | ); |
| 509 | 509 | |
| 510 | 510 | return $scripts; |
@@ -523,10 +523,10 @@ discard block |
||
| 523 | 523 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 524 | 524 | 'version' => GravityView_Plugin::version, |
| 525 | 525 | "deps" => array( |
| 526 | - 'gform_admin', |
|
| 526 | + 'gform_admin', |
|
| 527 | 527 | 'gaddon_form_settings_css', |
| 528 | - 'gform_tooltip', |
|
| 529 | - 'gform_font_awesome', |
|
| 528 | + 'gform_tooltip', |
|
| 529 | + 'gform_font_awesome', |
|
| 530 | 530 | ), |
| 531 | 531 | 'enqueue' => array( |
| 532 | 532 | array( 'admin_page' => array( |
@@ -592,12 +592,12 @@ discard block |
||
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | public function app_settings_tab() { |
| 595 | - parent::app_settings_tab(); |
|
| 595 | + parent::app_settings_tab(); |
|
| 596 | 596 | |
| 597 | 597 | if ( $this->maybe_uninstall() ) { |
| 598 | - echo $this->uninstall_form(); |
|
| 598 | + echo $this->uninstall_form(); |
|
| 599 | 599 | } |
| 600 | - } |
|
| 600 | + } |
|
| 601 | 601 | |
| 602 | 602 | /** |
| 603 | 603 | * Make protected public |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | */ |
| 634 | 634 | public function get_app_settings() { |
| 635 | 635 | |
| 636 | - $settings = get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', $this->get_default_settings() ); |
|
| 636 | + $settings = get_option( 'gravityformsaddon_' . $this->_slug . '_app_settings', $this->get_default_settings() ); |
|
| 637 | 637 | |
| 638 | 638 | if( defined( 'GRAVITYVIEW_LICENSE_KEY' ) ) { |
| 639 | 639 | $settings['license_key'] = GRAVITYVIEW_LICENSE_KEY; |
@@ -674,9 +674,9 @@ discard block |
||
| 674 | 674 | */ |
| 675 | 675 | protected function settings_edd_license( $field, $echo = true ) { |
| 676 | 676 | |
| 677 | - if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
| 678 | - $field['input_type'] = 'password'; |
|
| 679 | - } |
|
| 677 | + if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
|
| 678 | + $field['input_type'] = 'password'; |
|
| 679 | + } |
|
| 680 | 680 | |
| 681 | 681 | $text = $this->settings_text( $field, false ); |
| 682 | 682 | |
@@ -731,8 +731,8 @@ discard block |
||
| 731 | 731 | type="' . $field['type'] . '" |
| 732 | 732 | name="' . esc_attr( $name ) . '" |
| 733 | 733 | value="' . $value . '" ' . |
| 734 | - implode( ' ', $attributes ) . |
|
| 735 | - ' />'; |
|
| 734 | + implode( ' ', $attributes ) . |
|
| 735 | + ' />'; |
|
| 736 | 736 | |
| 737 | 737 | if ( $echo ) { |
| 738 | 738 | echo $html; |
@@ -773,19 +773,19 @@ discard block |
||
| 773 | 773 | |
| 774 | 774 | |
| 775 | 775 | /** |
| 776 | - * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
| 777 | - * |
|
| 778 | - * Converts `$field['description']` to `$field['gv_description']` |
|
| 779 | - * Converts `$field['subtitle']` to `$field['description']` |
|
| 780 | - * |
|
| 781 | - * @see GravityView_Settings::single_setting_label Converts `gv_description` back to `description` |
|
| 782 | - * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
| 783 | - * |
|
| 784 | - * @since 1.21.5.2 |
|
| 785 | - * |
|
| 776 | + * Keep GravityView styling for `$field['description']`, even though Gravity Forms added support for it |
|
| 777 | + * |
|
| 778 | + * Converts `$field['description']` to `$field['gv_description']` |
|
| 779 | + * Converts `$field['subtitle']` to `$field['description']` |
|
| 780 | + * |
|
| 781 | + * @see GravityView_Settings::single_setting_label Converts `gv_description` back to `description` |
|
| 782 | + * @see http://share.gravityview.co/P28uGp/2OIRKxog for image that shows subtitle vs description |
|
| 783 | + * |
|
| 784 | + * @since 1.21.5.2 |
|
| 785 | + * |
|
| 786 | 786 | * @param array $field |
| 787 | - * |
|
| 788 | - * @return void |
|
| 787 | + * |
|
| 788 | + * @return void |
|
| 789 | 789 | */ |
| 790 | 790 | public function single_setting_row( $field ) { |
| 791 | 791 | |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | array( |
| 981 | 981 | 'label' => _x('Show me beta versions if they are available.', 'gravityview'), |
| 982 | 982 | 'value' => '1', |
| 983 | - 'name' => 'beta', |
|
| 983 | + 'name' => 'beta', |
|
| 984 | 984 | ), |
| 985 | 985 | ), |
| 986 | 986 | 'description' => __( 'You will have early access to the latest GravityView features and improvements. There may be bugs! If you encounter an issue, help make GravityView better by reporting it!', 'gravityview'), |
@@ -1005,39 +1005,39 @@ discard block |
||
| 1005 | 1005 | |
| 1006 | 1006 | if( empty( $field['disabled'] ) ) { |
| 1007 | 1007 | unset( $field['disabled'] ); |
| 1008 | - } |
|
| 1008 | + } |
|
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | - $sections = array( |
|
| 1012 | - array( |
|
| 1013 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 1014 | - 'fields' => $fields, |
|
| 1015 | - ) |
|
| 1016 | - ); |
|
| 1011 | + $sections = array( |
|
| 1012 | + array( |
|
| 1013 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 1014 | + 'fields' => $fields, |
|
| 1015 | + ) |
|
| 1016 | + ); |
|
| 1017 | 1017 | |
| 1018 | - // custom 'update settings' button |
|
| 1019 | - $button = array( |
|
| 1020 | - 'class' => 'button button-primary button-hero', |
|
| 1021 | - 'type' => 'save', |
|
| 1022 | - ); |
|
| 1018 | + // custom 'update settings' button |
|
| 1019 | + $button = array( |
|
| 1020 | + 'class' => 'button button-primary button-hero', |
|
| 1021 | + 'type' => 'save', |
|
| 1022 | + ); |
|
| 1023 | 1023 | |
| 1024 | 1024 | if( $disabled_attribute ) { |
| 1025 | 1025 | $button['disabled'] = $disabled_attribute; |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | 1028 | |
| 1029 | - /** |
|
| 1030 | - * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
| 1031 | - * Extensions can tap in here to insert their own section and settings. |
|
| 1032 | - * <code> |
|
| 1033 | - * $sections[] = array( |
|
| 1034 | - * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
| 1035 | - * 'fields' => $settings, |
|
| 1036 | - * ); |
|
| 1037 | - * </code> |
|
| 1038 | - * @param array $extension_settings Empty array, ready for extension settings! |
|
| 1039 | - */ |
|
| 1040 | - $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
| 1029 | + /** |
|
| 1030 | + * @filter `gravityview/settings/extension/sections` Modify the GravityView settings page |
|
| 1031 | + * Extensions can tap in here to insert their own section and settings. |
|
| 1032 | + * <code> |
|
| 1033 | + * $sections[] = array( |
|
| 1034 | + * 'title' => __( 'GravityView My Extension Settings', 'gravityview' ), |
|
| 1035 | + * 'fields' => $settings, |
|
| 1036 | + * ); |
|
| 1037 | + * </code> |
|
| 1038 | + * @param array $extension_settings Empty array, ready for extension settings! |
|
| 1039 | + */ |
|
| 1040 | + $extension_sections = apply_filters( 'gravityview/settings/extension/sections', array() ); |
|
| 1041 | 1041 | |
| 1042 | 1042 | // If there are extensions, add a section for them |
| 1043 | 1043 | if ( ! empty( $extension_sections ) ) { |
@@ -1050,13 +1050,13 @@ discard block |
||
| 1050 | 1050 | } |
| 1051 | 1051 | } |
| 1052 | 1052 | |
| 1053 | - $k = count( $extension_sections ) - 1 ; |
|
| 1054 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 1053 | + $k = count( $extension_sections ) - 1 ; |
|
| 1054 | + $extension_sections[ $k ]['fields'][] = $button; |
|
| 1055 | 1055 | $sections = array_merge( $sections, $extension_sections ); |
| 1056 | 1056 | } else { |
| 1057 | - // add the 'update settings' button to the general section |
|
| 1058 | - $sections[0]['fields'][] = $button; |
|
| 1059 | - } |
|
| 1057 | + // add the 'update settings' button to the general section |
|
| 1058 | + $sections[0]['fields'][] = $button; |
|
| 1059 | + } |
|
| 1060 | 1060 | |
| 1061 | 1061 | return $sections; |
| 1062 | 1062 | } |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | if( 'gv_note_add' === $_POST['action'] ) { |
| 171 | 171 | |
| 172 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
| 173 | - do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
|
| 174 | - return; |
|
| 175 | - } |
|
| 172 | + if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
| 173 | + do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
|
| 174 | + return; |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | 177 | $post = wp_unslash( $_POST ); |
| 178 | 178 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * Verify permissions. Check expected $_POST. Parse args, then send to process_delete_notes |
| 274 | 274 | * |
| 275 | - * @since 1.17 |
|
| 275 | + * @since 1.17 |
|
| 276 | 276 | * |
| 277 | 277 | * @see process_delete_notes |
| 278 | 278 | * |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | 'subject-label' => __( 'Subject', 'gravityview' ), |
| 426 | 426 | 'subject' => __( 'Email subject', 'gravityview' ), |
| 427 | 427 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
| 428 | - 'email-footer' => __( 'This note was sent from {url}', 'gravityview' ), |
|
| 428 | + 'email-footer' => __( 'This note was sent from {url}', 'gravityview' ), |
|
| 429 | 429 | 'also-email' => __( 'Also email this note to', 'gravityview' ), |
| 430 | 430 | 'error-add-note' => __( 'There was an error adding the note.', 'gravityview' ), |
| 431 | 431 | 'error-invalid' => __( 'The request was invalid. Refresh the page and try again.', 'gravityview' ), |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | 'gv-note-to-custom' => '', |
| 718 | 718 | 'gv-note-subject' => '', |
| 719 | 719 | 'gv-note-content' => '', |
| 720 | - 'current-url' => '', |
|
| 720 | + 'current-url' => '', |
|
| 721 | 721 | ); |
| 722 | 722 | |
| 723 | 723 | $current_user = wp_get_current_user(); |
@@ -769,9 +769,9 @@ discard block |
||
| 769 | 769 | $message .= $this->get_email_footer( $email_footer, $is_html, $email_data ); |
| 770 | 770 | |
| 771 | 771 | /** |
| 772 | - * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format |
|
| 772 | + * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format |
|
| 773 | 773 | * @since 1.18 |
| 774 | - * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true) |
|
| 774 | + * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true) |
|
| 775 | 775 | */ |
| 776 | 776 | $wpautop_email = apply_filters( 'gravityview/field/notes/wpautop_email', true ); |
| 777 | 777 | |
@@ -791,12 +791,12 @@ discard block |
||
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | /** |
| 794 | - * Get the footer for Entry Note emails |
|
| 795 | - * |
|
| 796 | - * `{url}` is replaced by the URL of the page where the note form was embedded |
|
| 797 | - * |
|
| 798 | - * @since 1.18 |
|
| 799 | - * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer' |
|
| 794 | + * Get the footer for Entry Note emails |
|
| 795 | + * |
|
| 796 | + * `{url}` is replaced by the URL of the page where the note form was embedded |
|
| 797 | + * |
|
| 798 | + * @since 1.18 |
|
| 799 | + * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer' |
|
| 800 | 800 | * |
| 801 | 801 | * @param string $email_footer The message footer value |
| 802 | 802 | * @param bool $is_html True: Email is being sent as HTML; False: sent as text |
@@ -805,10 +805,10 @@ discard block |
||
| 805 | 805 | */ |
| 806 | 806 | private function get_email_footer( $email_footer = '', $is_html = true, $email_data = array() ) { |
| 807 | 807 | |
| 808 | - $output = ''; |
|
| 808 | + $output = ''; |
|
| 809 | 809 | |
| 810 | 810 | if( ! empty( $email_footer ) ) { |
| 811 | - $url = rgar( $email_data, 'current-url' ); |
|
| 811 | + $url = rgar( $email_data, 'current-url' ); |
|
| 812 | 812 | $url = html_entity_decode( $url ); |
| 813 | 813 | $url = site_url( $url ); |
| 814 | 814 | |
@@ -24,132 +24,132 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * Given information provided in an entry, get array of media IDs |
|
| 28 | - * |
|
| 29 | - * This is necessary because GF doesn't expect to need to update post images, only to create them. |
|
| 30 | - * |
|
| 31 | - * @see GFFormsModel::create_post() |
|
| 32 | - * |
|
| 33 | - * @since 1.17 |
|
| 34 | - * |
|
| 35 | - * @param array $form Gravity Forms form array |
|
| 36 | - * @param array $entry Gravity Forms entry array |
|
| 37 | - * |
|
| 38 | - * @return array Array of "Field ID" => "Media IDs" |
|
| 39 | - */ |
|
| 40 | - public static function get_post_field_images( $form, $entry ) { |
|
| 41 | - |
|
| 42 | - $post_data = self::get_post_fields( $form, $entry ); |
|
| 43 | - |
|
| 44 | - $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 45 | - |
|
| 46 | - $post_images = array(); |
|
| 47 | - |
|
| 48 | - foreach ( $media as $media_item ) { |
|
| 49 | - foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 50 | - if( |
|
| 51 | - rgar( $post_data_item, 'title' ) === $media_item->post_title && |
|
| 52 | - rgar( $post_data_item, 'description' ) === $media_item->post_content && |
|
| 53 | - rgar( $post_data_item, 'caption' ) === $media_item->post_excerpt |
|
| 54 | - ) { |
|
| 55 | - $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - return $post_images; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Alias of GFFormsModel::get_post_fields(); just making it public |
|
| 65 | - * |
|
| 66 | - * @see GFFormsModel::get_post_fields() |
|
| 67 | - * |
|
| 68 | - * @since 1.17 |
|
| 69 | - * |
|
| 70 | - * @param array $form Gravity Forms form array |
|
| 71 | - * @param array $entry Gravity Forms entry array |
|
| 72 | - * |
|
| 73 | - * @return array |
|
| 74 | - */ |
|
| 75 | - public static function get_post_fields( $form, $entry ) { |
|
| 76 | - |
|
| 77 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' ); |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * If the method changes to public, use Gravity Forms' method |
|
| 81 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 82 | - */ |
|
| 83 | - if( $reflection->isPublic() ) { |
|
| 84 | - return parent::get_post_fields( $form, $entry ); |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // It was private; let's make it public |
|
| 88 | - $reflection->setAccessible( true ); |
|
| 89 | - |
|
| 90 | - return $reflection->invoke( new GFFormsModel, $form, $entry ); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
|
| 95 | - * |
|
| 96 | - * @since 1.16.2 |
|
| 97 | - * |
|
| 98 | - * @param string $url URL of the post image to update |
|
| 99 | - * @param int $post_id ID of the post image to update |
|
| 100 | - * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
|
| 101 | - */ |
|
| 102 | - public static function copy_post_image( $url, $post_id ) { |
|
| 103 | - |
|
| 104 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' ); |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * If the method changes to public, use Gravity Forms' method |
|
| 108 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 109 | - */ |
|
| 110 | - if( $reflection->isPublic() ) { |
|
| 111 | - return parent::copy_post_image( $url, $post_id ); |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - // It was private; let's make it public |
|
| 115 | - $reflection->setAccessible( true ); |
|
| 116 | - |
|
| 117 | - return $reflection->invoke( new GFFormsModel, $url, $post_id ); |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
|
| 122 | - * |
|
| 123 | - * Note: The method became public in GF 1.9.17.7 |
|
| 124 | - * |
|
| 125 | - * @see GFFormsModel::media_handle_upload |
|
| 126 | - * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
|
| 127 | - * |
|
| 128 | - * @uses copy_post_image |
|
| 129 | - * @uses wp_insert_attachment |
|
| 130 | - * @uses wp_update_attachment_metadata |
|
| 131 | - * |
|
| 132 | - * @param string $url URL of the post image to update |
|
| 133 | - * @param int $post_id ID of the post image to update |
|
| 134 | - * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys. |
|
| 135 | - * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
|
| 136 | - */ |
|
| 137 | - public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
|
| 138 | - |
|
| 139 | - $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' ); |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * If the method changes to public, use Gravity Forms' method |
|
| 143 | - * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 144 | - */ |
|
| 145 | - if( $reflection->isPublic() ) { |
|
| 146 | - return parent::media_handle_upload( $url, $post_id, $post_data ); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - // It was private; let's make it public |
|
| 150 | - $reflection->setAccessible( true ); |
|
| 151 | - |
|
| 152 | - return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data ); |
|
| 153 | - } |
|
| 27 | + * Given information provided in an entry, get array of media IDs |
|
| 28 | + * |
|
| 29 | + * This is necessary because GF doesn't expect to need to update post images, only to create them. |
|
| 30 | + * |
|
| 31 | + * @see GFFormsModel::create_post() |
|
| 32 | + * |
|
| 33 | + * @since 1.17 |
|
| 34 | + * |
|
| 35 | + * @param array $form Gravity Forms form array |
|
| 36 | + * @param array $entry Gravity Forms entry array |
|
| 37 | + * |
|
| 38 | + * @return array Array of "Field ID" => "Media IDs" |
|
| 39 | + */ |
|
| 40 | + public static function get_post_field_images( $form, $entry ) { |
|
| 41 | + |
|
| 42 | + $post_data = self::get_post_fields( $form, $entry ); |
|
| 43 | + |
|
| 44 | + $media = get_attached_media( 'image', $entry['post_id'] ); |
|
| 45 | + |
|
| 46 | + $post_images = array(); |
|
| 47 | + |
|
| 48 | + foreach ( $media as $media_item ) { |
|
| 49 | + foreach( (array) $post_data['images'] as $post_data_item ) { |
|
| 50 | + if( |
|
| 51 | + rgar( $post_data_item, 'title' ) === $media_item->post_title && |
|
| 52 | + rgar( $post_data_item, 'description' ) === $media_item->post_content && |
|
| 53 | + rgar( $post_data_item, 'caption' ) === $media_item->post_excerpt |
|
| 54 | + ) { |
|
| 55 | + $post_images["{$post_data_item['field_id']}"] = $media_item->ID; |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + return $post_images; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Alias of GFFormsModel::get_post_fields(); just making it public |
|
| 65 | + * |
|
| 66 | + * @see GFFormsModel::get_post_fields() |
|
| 67 | + * |
|
| 68 | + * @since 1.17 |
|
| 69 | + * |
|
| 70 | + * @param array $form Gravity Forms form array |
|
| 71 | + * @param array $entry Gravity Forms entry array |
|
| 72 | + * |
|
| 73 | + * @return array |
|
| 74 | + */ |
|
| 75 | + public static function get_post_fields( $form, $entry ) { |
|
| 76 | + |
|
| 77 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' ); |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * If the method changes to public, use Gravity Forms' method |
|
| 81 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 82 | + */ |
|
| 83 | + if( $reflection->isPublic() ) { |
|
| 84 | + return parent::get_post_fields( $form, $entry ); |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // It was private; let's make it public |
|
| 88 | + $reflection->setAccessible( true ); |
|
| 89 | + |
|
| 90 | + return $reflection->invoke( new GFFormsModel, $form, $entry ); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private. |
|
| 95 | + * |
|
| 96 | + * @since 1.16.2 |
|
| 97 | + * |
|
| 98 | + * @param string $url URL of the post image to update |
|
| 99 | + * @param int $post_id ID of the post image to update |
|
| 100 | + * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path. |
|
| 101 | + */ |
|
| 102 | + public static function copy_post_image( $url, $post_id ) { |
|
| 103 | + |
|
| 104 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' ); |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * If the method changes to public, use Gravity Forms' method |
|
| 108 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 109 | + */ |
|
| 110 | + if( $reflection->isPublic() ) { |
|
| 111 | + return parent::copy_post_image( $url, $post_id ); |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + // It was private; let's make it public |
|
| 115 | + $reflection->setAccessible( true ); |
|
| 116 | + |
|
| 117 | + return $reflection->invoke( new GFFormsModel, $url, $post_id ); |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private. |
|
| 122 | + * |
|
| 123 | + * Note: The method became public in GF 1.9.17.7 |
|
| 124 | + * |
|
| 125 | + * @see GFFormsModel::media_handle_upload |
|
| 126 | + * @see GravityView_Edit_Entry_Render::maybe_update_post_fields |
|
| 127 | + * |
|
| 128 | + * @uses copy_post_image |
|
| 129 | + * @uses wp_insert_attachment |
|
| 130 | + * @uses wp_update_attachment_metadata |
|
| 131 | + * |
|
| 132 | + * @param string $url URL of the post image to update |
|
| 133 | + * @param int $post_id ID of the post image to update |
|
| 134 | + * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys. |
|
| 135 | + * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image |
|
| 136 | + */ |
|
| 137 | + public static function media_handle_upload( $url, $post_id, $post_data = array() ) { |
|
| 138 | + |
|
| 139 | + $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' ); |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * If the method changes to public, use Gravity Forms' method |
|
| 143 | + * @todo: If/when the method is public, remove the unneeded copied code. |
|
| 144 | + */ |
|
| 145 | + if( $reflection->isPublic() ) { |
|
| 146 | + return parent::media_handle_upload( $url, $post_id, $post_data ); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + // It was private; let's make it public |
|
| 150 | + $reflection->setAccessible( true ); |
|
| 151 | + |
|
| 152 | + return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data ); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | } |
| 156 | 156 | \ No newline at end of file |
@@ -141,7 +141,7 @@ |
||
| 141 | 141 | global $wpdb; |
| 142 | 142 | |
| 143 | 143 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) |
| 144 | - && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
| 144 | + && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
| 145 | 145 | $notes_table = GFFormsModel::get_entry_notes_table_name(); |
| 146 | 146 | } else { |
| 147 | 147 | $notes_table = GFFormsModel::get_lead_notes_table_name(); |
@@ -359,9 +359,9 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | 361 | * @filter `gravityview/edit_entry/unset_hidden_field_values` Whether to delete values of fields hidden by conditional logic |
| 362 | - * @since 1.22.2 |
|
| 363 | - * @param bool $unset_hidden_field_values Default: true |
|
| 364 | - * @param GravityView_Edit_Entry_Render $this This object |
|
| 362 | + * @since 1.22.2 |
|
| 363 | + * @param bool $unset_hidden_field_values Default: true |
|
| 364 | + * @param GravityView_Edit_Entry_Render $this This object |
|
| 365 | 365 | */ |
| 366 | 366 | $unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this ); |
| 367 | 367 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | return; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
|
| 372 | + if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
|
| 373 | 373 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
| 374 | 374 | $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) ); |
| 375 | 375 | } else { |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | |
| 1289 | 1289 | // TODO: Remove when minimum GF Version is 2.0.6.5 |
| 1290 | 1290 | if( ! isset( $field->visibility ) && ! isset( $field->adminOnly ) ) { |
| 1291 | - $field->adminOnly = NULL; |
|
| 1291 | + $field->adminOnly = NULL; |
|
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | switch( RGFormsModel::get_input_type( $field ) ) { |
@@ -1771,8 +1771,8 @@ discard block |
||
| 1771 | 1771 | * If the Edit Entry tab is not configured, adminOnly fields will not be shown to non-administrators. |
| 1772 | 1772 | * If the Edit Entry tab *is* configured, adminOnly fields will be shown to non-administrators, using the configured GV permissions |
| 1773 | 1773 | * @since 1.9.1 |
| 1774 | - * @since 1.22.6 Deprecated |
|
| 1775 | - * @deprecated Use gravityview/edit_entry/use_gf_visibility_setting instead |
|
| 1774 | + * @since 1.22.6 Deprecated |
|
| 1775 | + * @deprecated Use gravityview/edit_entry/use_gf_visibility_setting instead |
|
| 1776 | 1776 | * @param boolean $use_gf_adminonly_setting True: Hide field if set to Admin Only in GF and the user is not an admin. False: show field based on GV permissions, ignoring GF permissions. |
| 1777 | 1777 | * @param array $form GF Form array |
| 1778 | 1778 | * @param int $view_id View ID |
@@ -1798,7 +1798,7 @@ discard block |
||
| 1798 | 1798 | unset( $fields[ $k ] ); |
| 1799 | 1799 | } |
| 1800 | 1800 | } else{ |
| 1801 | - if( 'administrative' === $field->visibility ) { |
|
| 1801 | + if( 'administrative' === $field->visibility ) { |
|
| 1802 | 1802 | unset( $fields[ $k ] ); |
| 1803 | 1803 | } |
| 1804 | 1804 | } |
@@ -1808,25 +1808,25 @@ discard block |
||
| 1808 | 1808 | |
| 1809 | 1809 | foreach( $fields as &$field ) { |
| 1810 | 1810 | |
| 1811 | - // TODO: Remove when minimum GF Version is 2.0.6.5 |
|
| 1812 | - if( ! isset( $field->visibility ) ) { |
|
| 1811 | + // TODO: Remove when minimum GF Version is 2.0.6.5 |
|
| 1812 | + if( ! isset( $field->visibility ) ) { |
|
| 1813 | 1813 | |
| 1814 | - $field->adminOnly = false; |
|
| 1814 | + $field->adminOnly = false; |
|
| 1815 | 1815 | |
| 1816 | - } else { |
|
| 1816 | + } else { |
|
| 1817 | 1817 | |
| 1818 | - /** |
|
| 1819 | - * @filter `gravityview/edit_entry/make_all_fields_visible` Set field visibility to "visible" for all fields |
|
| 1820 | - * @since 1.22.6 |
|
| 1821 | - * |
|
| 1822 | - * @param string $visibility 'visible' by default. Default options are 'hidden', 'visible', and 'administrative' |
|
| 1823 | - * @param GF_Field $field Form field being modified |
|
| 1824 | - * @param int $view_id Current View ID |
|
| 1825 | - */ |
|
| 1826 | - $visibility = apply_filters( 'gravityview/edit_entry/field_visibility', 'visible', $field, $view_id ); |
|
| 1818 | + /** |
|
| 1819 | + * @filter `gravityview/edit_entry/make_all_fields_visible` Set field visibility to "visible" for all fields |
|
| 1820 | + * @since 1.22.6 |
|
| 1821 | + * |
|
| 1822 | + * @param string $visibility 'visible' by default. Default options are 'hidden', 'visible', and 'administrative' |
|
| 1823 | + * @param GF_Field $field Form field being modified |
|
| 1824 | + * @param int $view_id Current View ID |
|
| 1825 | + */ |
|
| 1826 | + $visibility = apply_filters( 'gravityview/edit_entry/field_visibility', 'visible', $field, $view_id ); |
|
| 1827 | 1827 | |
| 1828 | - $field->visibility = $visibility; |
|
| 1829 | - } |
|
| 1828 | + $field->visibility = $visibility; |
|
| 1829 | + } |
|
| 1830 | 1830 | } |
| 1831 | 1831 | |
| 1832 | 1832 | return $fields; |