Файловый менеджер - Редактировать - /home/infrafs/INFRABIKEIT/wp-content/plugins/Views.tar
Назад
Importer.php 0000644 00000023255 15134162217 0007067 0 ustar 00 <?php namespace WPForms\Admin\Tools\Views; use WPForms\Admin\Tools\Importers; /** * Class Importer. * * @since 1.6.6 */ class Importer extends View { /** * View slug. * * @since 1.6.6 * * @var string */ protected $slug = 'import'; /** * Registered importers. * * @since 1.6.6 * * @var array */ public $importers = []; /** * Available forms for a specific importer. * * @since 1.6.6 * * @var array */ public $importer_forms = []; /** * Init view. * * @since 1.6.6 */ public function init() { $importers = new Importers(); $this->importers = $importers->get_importers(); if ( ! empty( $_GET['provider'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended $this->importer_forms = $importers->get_importer_forms( sanitize_key( $_GET['provider'] ) );//phpcs:ignore WordPress.Security.NonceVerification.Recommended } // Load the Underscores templates for importers. add_action( 'admin_print_scripts', [ $this, 'importer_templates' ] ); } /** * Get view label. * * @since 1.6.6 * * @return string */ public function get_label() { return ''; } /** * Checking user capability to view. * * @since 1.6.6 * * @return bool */ public function check_capability() { return wpforms_current_user_can( 'create_forms' ); } /** * Checking if needs display in navigation. * * @since 1.6.6 * * @return bool */ public function hide_from_nav() { return true; } /** * Importer view content. * * @since 1.6.6 */ public function display() { $this->heading_block(); $this->forms_block(); $this->analyze_block(); $this->process_block(); } /** * Get provider. * * @since 1.6.6 * * @return string */ private function get_provider_name() { //phpcs:ignore WordPress.Security.NonceVerification.Recommended $slug = ! empty( $_GET['provider'] ) ? sanitize_key( $_GET['provider'] ) : ''; return isset( $this->importers[ $slug ] ) ? $this->importers[ $slug ]['name'] : ''; } /** * Heading block. * * @since 1.6.6 */ private function heading_block() { ?> <div class="wpforms-setting-row tools wpforms-clear section-heading no-desc"> <div class="wpforms-setting-field"> <h4><?php esc_html_e( 'Form Import', 'wpforms-lite' ); ?></h4> </div> </div> <?php } /** * Forms block. * * @since 1.6.6 */ private function forms_block() { ?> <div id="wpforms-importer-forms"> <div class="wpforms-setting-row tools"> <p><?php esc_html_e( 'Select the forms you would like to import.', 'wpforms-lite' ); ?></p> <div class="checkbox-multiselect-columns"> <div class="first-column"> <h5 class="header"><?php esc_html_e( 'Available Forms', 'wpforms-lite' ); ?></h5> <ul> <?php if ( empty( $this->importer_forms ) ) { echo '<li>' . esc_html__( 'No forms found.', 'wpforms-lite' ) . '</li>'; } else { foreach ( $this->importer_forms as $id => $form ) { printf( '<li><label><input type="checkbox" name="forms[]" value="%s">%s</label></li>', esc_attr( $id ), esc_attr( sanitize_text_field( $form ) ) ); } } ?> </ul> <?php if ( ! empty( $this->importer_forms ) ) : ?> <a href="#" class="all"><?php esc_html_e( 'Select All', 'wpforms-lite' ); ?></a> <?php endif; ?> </div> <div class="second-column"> <h5 class="header"><?php esc_html_e( 'Forms to Import', 'wpforms-lite' ); ?></h5> <ul></ul> </div> </div> </div> <?php if ( ! empty( $this->importer_forms ) ) : ?> <p class="submit"> <button class="wpforms-btn wpforms-btn-md wpforms-btn-orange" id="wpforms-importer-forms-submit"><?php esc_html_e( 'Import', 'wpforms-lite' ); ?></button> </p> <?php endif; ?> </div> <?php } /** * Analyze block. * * @since 1.6.6 */ private function analyze_block() { ?> <div id="wpforms-importer-analyze"> <p class="process-analyze"> <i class="fa fa-spinner fa-spin" aria-hidden="true"></i> <?php printf( wp_kses( /* translators: %s - Provider name. */ __( 'Analyzing <span class="form-current">1</span> of <span class="form-total">0</span> forms from %s.', 'wpforms-lite' ), [ 'span' => [ 'class' => [], ], ] ), esc_attr( sanitize_text_field( $this->get_provider_name() ) ) ); ?> </p> <div class="upgrade"> <h5><?php esc_html_e( 'Heads Up!', 'wpforms-lite' ); ?></h5> <p><?php esc_html_e( 'One or more of your forms contain fields that are not available in WPForms Lite. To properly import these fields, we recommend upgrading to WPForms Pro.', 'wpforms-lite' ); ?></p> <p><?php esc_html_e( 'You can continue with the import without upgrading, and we will do our best to match the fields. However, some of them will be omitted due to compatibility issues.', 'wpforms-lite' ); ?></p> <p> <a href="<?php echo esc_url( wpforms_admin_upgrade_link( 'tools-import' ) ); ?>" target="_blank" rel="noopener noreferrer" class="wpforms-btn wpforms-btn-md wpforms-btn-orange wpforms-upgrade-modal"><?php esc_html_e( 'Upgrade to WPForms Pro', 'wpforms-lite' ); ?></a> <a href="#" class="wpforms-btn wpforms-btn-md wpforms-btn-light-grey" id="wpforms-importer-continue-submit"><?php esc_html_e( 'Continue Import without Upgrading', 'wpforms-lite' ); ?></a> </p> <hr> <p><?php esc_html_e( 'Below is the list of form fields that may be impacted:', 'wpforms-lite' ); ?></p> </div> </div> <?php } /** * Process block. * * @since 1.6.6 */ private function process_block() { ?> <div id="wpforms-importer-process"> <p class="process-count"> <i class="fa fa-spinner fa-spin" aria-hidden="true"></i> <?php printf( wp_kses( /* translators: %s - Provider name. */ __( 'Importing <span class="form-current">1</span> of <span class="form-total">0</span> forms from %s.', 'wpforms-lite' ), [ 'span' => [ 'class' => [], ], ] ), esc_attr( sanitize_text_field( $this->get_provider_name() ) ) ); ?> </p> <p class="process-completed"> <?php echo wp_kses( __( 'Congrats, the import process has finished! We have successfully imported <span class="forms-completed"></span> forms. You can review the results below.', 'wpforms-lite' ), [ 'span' => [ 'class' => [], ], ] ); ?> </p> <div class="status"></div> </div> <?php } /** * Various Underscores templates for form importing. * * @since 1.6.6 */ public function importer_templates() { ?> <script type="text/html" id="tmpl-wpforms-importer-upgrade"> <# _.each( data, function( item, key ) { #> <ul> <li class="form">{{ item.name }}</li> <# _.each( item.fields, function( val, key ) { #> <li>{{ val }}</li> <# }) #> </ul> <# }) #> </script> <script type="text/html" id="tmpl-wpforms-importer-status-error"> <div class="item"> <div class="wpforms-clear"> <span class="name"> <i class="status-icon fa fa-times" aria-hidden="true"></i> {{ data.name }} </span> </div> <p>{{ data.msg }}</p> </div> </script> <script type="text/html" id="tmpl-wpforms-importer-status-update"> <div class="item"> <div class="wpforms-clear"> <span class="name"> <# if ( ! _.isEmpty( data.upgrade_omit ) ) { #> <i class="status-icon fa fa-exclamation-circle" aria-hidden="true"></i> <# } else if ( ! _.isEmpty( data.upgrade_plain ) ) { #> <i class="status-icon fa fa-exclamation-triangle" aria-hidden="true"></i> <# } else if ( ! _.isEmpty( data.unsupported ) ) { #> <i class="status-icon fa fa-info-circle" aria-hidden="true"></i> <# } else { #> <i class="status-icon fa fa-check" aria-hidden="true"></i> <# } #> {{ data.name }} </span> <span class="actions"> <a href="{{ data.edit }}" target="_blank"><?php esc_html_e( 'Edit', 'wpforms-lite' ); ?></a> <span class="sep">|</span> <a href="{{ data.preview }}" target="_blank"><?php esc_html_e( 'Preview', 'wpforms-lite' ); ?></a> </span> </div> <# if ( ! _.isEmpty( data.upgrade_omit ) ) { #> <p><?php esc_html_e( 'The following fields are available in PRO and were not imported:', 'wpforms-lite' ); ?></p> <ul> <# _.each( data.upgrade_omit, function( val, key ) { #> <li>{{ val }}</li> <# }) #> </ul> <# } #> <# if ( ! _.isEmpty( data.upgrade_plain ) ) { #> <p><?php esc_html_e( 'The following fields are available in PRO and were imported as text fields:', 'wpforms-lite' ); ?></p> <ul> <# _.each( data.upgrade_plain, function( val, key ) { #> <li>{{ val }}</li> <# }) #> </ul> <# } #> <# if ( ! _.isEmpty( data.unsupported ) ) { #> <p><?php esc_html_e( 'The following fields are not supported and were not imported:', 'wpforms-lite' ); ?></p> <ul> <# _.each( data.unsupported, function( val, key ) { #> <li>{{ val }}</li> <# }) #> </ul> <# } #> <# if ( ! _.isEmpty( data.upgrade_plain ) || ! _.isEmpty( data.upgrade_omit ) ) { #> <p> <?php esc_html_e( 'Upgrade to the PRO plan to import these fields.', 'wpforms-lite' ); ?><br><br> <a href="<?php echo esc_url( wpforms_admin_upgrade_link( 'tools-import' ) ); ?>" class="wpforms-btn wpforms-btn-orange wpforms-btn-md wpforms-upgrade-modal" target="_blank" rel="noopener noreferrer"> <?php esc_html_e( 'Upgrade Now', 'wpforms-lite' ); ?> </a> </p> <# } #> </div> </script> <?php } } Export.php 0000644 00000021202 15134162217 0006535 0 ustar 00 <?php namespace WPForms\Admin\Tools\Views; /** * Class Export. * * @since 1.6.6 */ class Export extends View { /** * View slug. * * @since 1.6.6 * * @var string */ protected $slug = 'export'; /** * Template code if generated. * * @since 1.6.6 * * @var string */ private $template = ''; /** * Existed forms. * * @since 1.6.6 * * @var [] */ private $forms = []; /** * Init view. * * @since 1.6.6 */ public function init() { add_action( 'wpforms_tools_init', [ $this, 'process' ] ); } /** * Get view label. * * @since 1.6.6 * * @return string */ public function get_label() { return esc_html__( 'Export', 'wpforms-lite' ); } /** * Export process. * * @since 1.6.6 */ public function process() { if ( empty( $_POST['action'] ) || //phpcs:ignore WordPress.Security.NonceVerification ! isset( $_POST['submit-export'] ) || //phpcs:ignore WordPress.Security.NonceVerification ! $this->verify_nonce() ) { return; } if ( $_POST['action'] === 'export_form' && ! empty( $_POST['forms'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification $this->process_form(); } if ( $_POST['action'] === 'export_template' && ! empty( $_POST['form'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification $this->process_template(); } } /** * Checking user capability to view. * * @since 1.6.6 * * @return bool */ public function check_capability() { return wpforms_current_user_can( [ 'edit_forms', 'view_entries' ] ); } /** * Get available forms. * * @since 1.6.6 * * @return array */ public function get_forms() { $forms = wpforms()->form->get( '', [ 'orderby' => 'title' ] ); return ! empty( $forms ) ? $forms : []; } /** * Export view content. * * @since 1.6.6 */ public function display() { $this->forms = $this->get_forms(); if ( empty( $this->forms ) ) { echo wpforms_render( 'admin/empty-states/no-forms' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped return; } do_action( 'wpforms_admin_tools_export_top' ); $this->forms_export_block(); $this->form_template_export_block(); do_action( 'wpforms_admin_tools_export_bottom' ); } /** * Forms export block. * * @since 1.6.6 */ private function forms_export_block() { ?> <div class="wpforms-setting-row tools"> <h4 id="form-export"><?php esc_html_e( 'Form Export', 'wpforms-lite' ); ?></h4> <p><?php esc_html_e( 'Form exports files can be used to create a backup of your forms or to import forms into another site.', 'wpforms-lite' ); ?></p> <?php if ( ! empty( $this->forms ) ) { ?> <form method="post" action="<?php echo esc_attr( $this->get_link() ); ?>"> <?php $this->forms_select_html( 'wpforms-tools-form-export', 'forms[]', esc_html__( 'Select Form(s)', 'wpforms-lite' ) ); ?> <br> <input type="hidden" name="action" value="export_form"> <?php $this->nonce_field(); ?> <button name="submit-export" class="wpforms-btn wpforms-btn-md wpforms-btn-orange"> <?php esc_html_e( 'Export', 'wpforms-lite' ); ?> </button> </form> <?php } else { ?> <p><?php esc_html_e( 'You need to create a form before you can use form export.', 'wpforms-lite' ); ?></p> <?php } ?> </div> <?php } /** * Forms export block. * * @since 1.6.6 */ private function form_template_export_block() { ?> <div class="wpforms-setting-row tools"> <h4 id="template-export"><?php esc_html_e( 'Form Template Export', 'wpforms-lite' ); ?></h4> <?php if ( $this->template ) { $doc_link = sprintf( wp_kses( /* translators: %s - WPForms.com docs URL. */ __( 'For more information <a href="%s" target="_blank" rel="noopener noreferrer">see our documentation</a>.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), 'https://wpforms.com/docs/how-to-create-a-custom-form-template/' ); ?> <p><?php esc_html_e( 'The following code can be used to register your custom form template. Copy and paste the following code to your theme\'s functions.php file or include it within an external file.', 'wpforms-lite' ); ?><p> <p><?php echo $doc_link; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?><p> <textarea class="info-area" readonly><?php echo esc_textarea( $this->template ); ?></textarea><br> <?php } ?> <p><?php esc_html_e( 'Select a form to generate PHP code that can be used to register a custom form template.', 'wpforms-lite' ); ?></p> <?php if ( ! empty( $this->forms ) ) { ?> <form method="post" action="<?php echo esc_attr( $this->get_link() ); ?>"> <?php $this->forms_select_html( 'wpforms-tools-form-template', 'form', esc_html__( 'Select a Template', 'wpforms-lite' ), false ); ?> <br> <input type="hidden" name="action" value="export_template"> <?php $this->nonce_field(); ?> <button name="submit-export" class="wpforms-btn wpforms-btn-md wpforms-btn-orange"> <?php esc_html_e( 'Export Template', 'wpforms-lite' ); ?> </button> </form> <?php } else { ?> <p><?php esc_html_e( 'You need to create a form before you can generate a template.', 'wpforms-lite' ); ?></p> <?php } ?> </div> <?php } /** * Forms selector. * * @since 1.6.6 * * @param string $select_id Select id. * @param string $select_name Select name. * @param string $placeholder Placeholder. * @param bool $multiple Is multiple select. */ private function forms_select_html( $select_id, $select_name, $placeholder, $multiple = true ) { ?> <span class="choicesjs-select-wrap"> <select id="<?php echo esc_attr( $select_id ); ?>" class="choicesjs-select" name="<?php echo esc_attr( $select_name ); ?>" <?php if ( $multiple ) { //phpcs:ignore ?> multiple <?php } ?> data-search="true"> <option value=""><?php echo esc_attr( $placeholder ); ?></option> <?php foreach ( $this->forms as $form ) { ?> <option value="<?php echo absint( $form->ID ); ?>"><?php echo esc_html( $form->post_title ); ?></option> <?php } ?> </select> </span> <?php } /** * Export processing. * * @since 1.6.6 */ private function process_form() { $export = []; $forms = get_posts( [ 'post_type' => 'wpforms', 'nopaging' => true, 'post__in' => isset( $_POST['forms'] ) ? array_map( 'intval', $_POST['forms'] ) : [], //phpcs:ignore WordPress.Security.NonceVerification ] ); foreach ( $forms as $form ) { $export[] = wpforms_decode( $form->post_content ); } ignore_user_abort( true ); wpforms_set_time_limit(); nocache_headers(); header( 'Content-Type: application/json; charset=utf-8' ); header( 'Content-Disposition: attachment; filename=wpforms-form-export-' . current_time( 'm-d-Y' ) . '.json' ); header( 'Expires: 0' ); echo wp_json_encode( $export ); exit; } /** * Export template processing. * * @since 1.6.6 */ private function process_template() { $form_data = false; if ( isset( $_POST['form'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification $form_data = wpforms()->form->get( absint( $_POST['form'] ), //phpcs:ignore WordPress.Security.NonceVerification [ 'content_only' => true ] ); } if ( ! $form_data ) { return; } // Define basic data. $name = sanitize_text_field( $form_data['settings']['form_title'] ); $desc = sanitize_text_field( $form_data['settings']['form_desc'] ); $slug = sanitize_key( str_replace( [ ' ', '-' ], '_', $form_data['settings']['form_title'] ) ); $class = 'WPForms_Template_' . $slug; // Format template field and settings data. $data = $form_data; $data['meta']['template'] = $slug; $data['fields'] = isset( $data['fields'] ) ? wpforms_array_remove_empty_strings( $data['fields'] ) : []; $data['settings'] = wpforms_array_remove_empty_strings( $data['settings'] ); unset( $data['id'] ); $data = var_export( $data, true ); //phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export $data = str_replace( ' ', "\t", $data ); $data = preg_replace( '/([\t\r\n]+?)array/', 'array', $data ); // Build the final template string. $this->template = <<<EOT if ( class_exists( 'WPForms_Template', false ) ) : /** * {$name} * Template for WPForms. */ class {$class} extends WPForms_Template { /** * Primary class constructor. * * @since 1.0.0 */ public function init() { // Template name \$this->name = '{$name}'; // Template slug \$this->slug = '{$slug}'; // Template description \$this->description = '{$desc}'; // Template field and settings \$this->data = {$data}; } } new {$class}(); endif; EOT; } } View.php 0000644 00000003244 15134162217 0006174 0 ustar 00 <?php namespace WPForms\Admin\Tools\Views; use WPForms\Admin\Tools\Tools; /** * Single view class. * * @since 1.6.6 */ abstract class View { /** * View slug. * * @since 1.6.6 * * @var string */ protected $slug; /** * Init view. * * @since 1.6.6 */ abstract public function init(); /** * Get link to the view. * * @since 1.6.6 * * @return string */ public function get_link() { return add_query_arg( [ 'page' => Tools::SLUG, 'view' => $this->slug, ], admin_url( 'admin.php' ) ); } /** * Get view label. * * @since 1.6.6 * * @return string */ abstract public function get_label(); /** * Checking user capability to view. * * @since 1.6.6 * * @return bool */ abstract public function check_capability(); /** * Checking if needs display in navigation. * * @since 1.6.6 * * @return bool */ public function hide_from_nav() { return false; } /** * Checking if navigation needs display. * * @since 1.6.6 * * @return bool */ public function show_nav() { return true; } /** * Display nonce field. * * @since 1.6.6 */ public function nonce_field() { wp_nonce_field( 'wpforms_' . $this->slug . '_nonce', 'wpforms-tools-' . $this->slug . '-nonce' ); } /** * Verify nonce field. * * @since 1.6.6 */ public function verify_nonce() { return ! empty( $_POST[ 'wpforms-tools-' . $this->slug . '-nonce' ] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_POST[ 'wpforms-tools-' . $this->slug . '-nonce' ] ) ), 'wpforms_' . $this->slug . '_nonce' ); } /** * Display view content. * * @since 1.6.6 */ abstract public function display(); } Logs.php 0000644 00000017170 15134162217 0006171 0 ustar 00 <?php namespace WPForms\Admin\Tools\Views; use WPForms\Logger\Log; /** * Class Logs. * * @since 1.6.6 */ class Logs extends View { /** * View slug. * * @since 1.6.6 * * @var string */ protected $slug = 'logs'; /** * ListTable instance. * * @since 1.6.6 * * @var \WPForms\Logger\ListTable */ private $list_table = []; /** * Init view. * * @since 1.6.6 */ public function init() { $this->logs_controller(); } /** * Get view label. * * @since 1.6.6 * * @return string */ public function get_label() { return esc_html__( 'Logs', 'wpforms-lite' ); } /** * Checking user capability to view. * * @since 1.6.6 * * @return bool */ public function check_capability() { return wpforms_current_user_can(); } /** * Get ListTable instance. * * @since 1.6.6 * * @return \WPForms\Logger\ListTable */ private function get_list_table() { if ( empty( $this->list_table ) ) { $this->list_table = wpforms()->get( 'log' )->get_list_table(); } return $this->list_table; } /** * Display view content. * * @since 1.6.6 */ public function display() { ?> <form action="<?php echo esc_url( $this->get_link() ); ?>" method="POST"> <?php $this->nonce_field(); ?> <div class="wpforms-setting-row tools"> <h3><?php esc_html_e( 'Logs', 'wpforms-lite' ); ?></h3> <p><?php esc_html_e( 'On this page, you can enable and configure the logging functionality while debugging behavior of various parts of the plugin, including forms and entries processing.', 'wpforms-lite' ); ?></p> </div> <div class="wpforms-setting-row tools wpforms-setting-row-checkbox wpforms-clear" id="wpforms-setting-row-logs-enable"> <div class="wpforms-setting-label"> <label for="wpforms-setting-logs-enable"><?php esc_html_e( 'Enable Logs', 'wpforms-lite' ); ?></label> </div> <div class="wpforms-setting-field"> <input type="checkbox" id="wpforms-setting-logs-enable" name="logs-enable" value="1" <?php checked( wpforms_setting( 'logs-enable' ) ); ?>> <p class="desc"> <?php esc_html_e( 'Check this option to start logging WPForms-related events. This is recommended only while debugging.', 'wpforms-lite' ); ?> </p> </div> </div> <?php if ( wpforms_setting( 'logs-enable' ) ) { $this->types_block(); $this->user_roles_block(); $this->users_block(); } ?> <p class="submit"> <button class="wpforms-btn wpforms-btn-md wpforms-btn-orange" name="wpforms-settings-submit"> <?php esc_html_e( 'Save Settings', 'wpforms-lite' ); ?> </button> </p> </form> <?php $logs_list_table = $this->get_list_table(); if ( wpforms_setting( 'logs-enable' ) || $logs_list_table->get_total() ) { $logs_list_table->display_page(); } } /** * Types block. * * @since 1.6.6 */ private function types_block() { ?> <div class="wpforms-setting-row tools wpforms-setting-row-select wpforms-clear" id="wpforms-setting-row-log-types"> <div class="wpforms-setting-label"> <label for="wpforms-setting-logs-types"><?php esc_html_e( 'Log Types', 'wpforms-lite' ); ?></label> </div> <div class="wpforms-setting-field"> <span class="choicesjs-select-wrap"> <select id="wpforms-setting-logs-types" class="choicesjs-select" name="logs-types[]" multiple> <?php $log_types = wpforms_setting( 'logs-types', [] ); foreach ( Log::get_log_types() as $slug => $name ) { ?> <option value="<?php echo esc_attr( $slug ); ?>" <?php selected( in_array( $slug, $log_types, true ) ); ?> > <?php echo esc_html( $name ); ?> </option> <?php } ?> </select> </span> <p class="desc"><?php esc_html_e( 'Select the types of events you want to log. Everything is logged by default.', 'wpforms-lite' ); ?></p> </div> </div> <?php } /** * User roles block. * * @since 1.6.6 */ private function user_roles_block() { ?> <div class="wpforms-setting-row tools wpforms-setting-row-select wpforms-clear" id="wpforms-setting-row-log-user-roles"> <div class="wpforms-setting-label"> <label for="wpforms-setting-logs-user-roles"><?php esc_html_e( 'User Roles', 'wpforms-lite' ); ?></label> </div> <div class="wpforms-setting-field"> <span class="choicesjs-select-wrap"> <?php $logs_user_roles = wpforms_setting( 'logs-user-roles', [] ); $roles = wp_list_pluck( get_editable_roles(), 'name' ); ?> <select id="wpforms-setting-logs-user-roles" class="choicesjs-select" name="logs-user-roles[]" multiple> <?php foreach ( $roles as $slug => $name ) { ?> <option value="<?php echo esc_attr( $slug ); ?>" <?php selected( in_array( $slug, $logs_user_roles, true ) ); ?> > <?php echo esc_html( $name ); ?> </option> <?php } ?> </select> <span class="hidden" id="wpforms-setting-logs-user-roles-selectform-spinner"> <i class="fa fa-cog fa-spin fa-lg"></i> </span> </span> <p class="desc"> <?php esc_html_e( 'Select the user roles you want to log. All roles are logged by default.', 'wpforms-lite' ); ?> </p> </div> </div> <?php } /** * Users block. * * @since 1.6.6 */ private function users_block() { ?> <div class="wpforms-setting-row tools wpforms-setting-row-select wpforms-clear" id="wpforms-setting-row-log-users"> <div class="wpforms-setting-label"> <label for="wpforms-setting-logs-users"><?php esc_html_e( 'Users', 'wpforms-lite' ); ?></label> </div> <div class="wpforms-setting-field"> <span class="choicesjs-select-wrap"> <select id="wpforms-setting-logs-users" class="choicesjs-select" name="logs-users[]" multiple> <?php $users = get_users( [ 'fields' => [ 'ID', 'display_name' ] ] ); $users = wp_list_pluck( $users, 'display_name', 'ID' ); $logs_users = wpforms_setting( 'logs-users', [] ); foreach ( $users as $slug => $name ) { ?> <option value="<?php echo esc_attr( $slug ); ?>" <?php selected( in_array( $slug, $logs_users, true ) ); ?> > <?php echo esc_html( $name ); ?> </option> <?php } ?> </select> <span class="hidden" id="wpforms-setting-logs-users-selectform-spinner"> <i class="fa fa-cog fa-spin fa-lg"></i> </span> </span> <p class="desc"> <?php esc_html_e( 'Log events for specific users only. All users are logged by default.', 'wpforms-lite' ); ?> </p> </div> </div> <?php } /** * Controller. * * @since 1.6.6 */ private function logs_controller() { $log = wpforms()->get( 'log' ); $log->create_table(); if ( $this->verify_nonce() ) { $settings = get_option( 'wpforms_settings' ); $was_enabled = ! empty( $settings['logs-enable'] ) ? $settings['logs-enable'] : 0; $settings['logs-enable'] = filter_input( INPUT_POST, 'logs-enable', FILTER_VALIDATE_BOOLEAN ); $logs_types = filter_input( INPUT_POST, 'logs-types', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_REQUIRE_ARRAY ); $logs_user_roles = filter_input( INPUT_POST, 'logs-user-roles', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_REQUIRE_ARRAY ); $logs_users = filter_input( INPUT_POST, 'logs-users', FILTER_SANITIZE_NUMBER_INT, FILTER_REQUIRE_ARRAY ); if ( $was_enabled ) { $settings['logs-types'] = $logs_types ? $logs_types : []; $settings['logs-user-roles'] = $logs_user_roles ? $logs_user_roles : []; $settings['logs-users'] = $logs_users ? array_map( 'absint', $logs_users ) : []; } wpforms_update_settings( $settings ); } $logs_list_table = $this->get_list_table(); $logs_list_table->process_admin_ui(); } } System.php 0000644 00000030121 15134162217 0006540 0 ustar 00 <?php namespace WPForms\Admin\Tools\Views; /** * Class System. * * @since 1.6.6 */ class System extends View { /** * View slug. * * @since 1.6.6 * * @var string */ protected $slug = 'system'; /** * Init view. * * @since 1.6.6 */ public function init() {} /** * Get view label. * * @since 1.6.6 * * @return string */ public function get_label() { return esc_html__( 'System Info', 'wpforms-lite' ); } /** * Checking user capability to view. * * @since 1.6.6 * * @return bool */ public function check_capability() { return wpforms_current_user_can(); } /** * System view content. * * @since 1.6.6 */ public function display() { ?> <div class="wpforms-setting-row tools"> <h4 id="form-export"><?php esc_html_e( 'System Information', 'wpforms-lite' ); ?></h4> <textarea class="info-area" readonly><?php echo esc_textarea( $this->get_system_info() ); ?></textarea> </div> <div class="wpforms-setting-row tools"> <h4 id="ssl-verify"><?php esc_html_e( 'Test SSL Connections', 'wpforms-lite' ); ?></h4> <p><?php esc_html_e( 'Click the button below to verify your web server can perform SSL connections successfully.', 'wpforms-lite' ); ?></p> <button type="button" id="wpforms-ssl-verify" class="wpforms-btn wpforms-btn-md wpforms-btn-orange"> <?php esc_html_e( 'Test Connection', 'wpforms-lite' ); ?> </button> </div> <?php } /** * Get system information. * * Based on a function from Easy Digital Downloads by Pippin Williamson. * * @link https://github.com/easydigitaldownloads/easy-digital-downloads/blob/master/includes/admin/tools.php#L470 * * @since 1.6.6 * * @return string */ public function get_system_info() { $data = '### Begin System Info ###' . "\n\n"; $data .= $this->wpforms_info(); $data .= $this->site_info(); $data .= $this->wp_info(); $data .= $this->uploads_info(); $data .= $this->plugins_info(); $data .= $this->server_info(); $data .= "\n" . '### End System Info ###'; return $data; } /** * Get WPForms info. * * @since 1.6.6 * * @return string */ private function wpforms_info() { $activated = get_option( 'wpforms_activated', [] ); $data = '-- WPForms Info' . "\n\n"; if ( ! empty( $activated['pro'] ) ) { $date = $activated['pro'] + ( get_option( 'gmt_offset' ) * 3600 ); $data .= 'Pro: ' . date_i18n( 'M j, Y @ g:ia', $date ) . "\n"; } if ( ! empty( $activated['lite'] ) ) { $date = $activated['lite'] + ( get_option( 'gmt_offset' ) * 3600 ); $data .= 'Lite: ' . date_i18n( 'M j, Y @ g:ia', $date ) . "\n"; } $data .= 'Lite Connect: ' . $this->get_lite_connect_info() . "\n"; return $data; } /** * Get Site info. * * @since 1.6.6 * * @return string */ private function site_info() { $data = "\n" . '-- Site Info' . "\n\n"; $data .= 'Site URL: ' . site_url() . "\n"; $data .= 'Home URL: ' . home_url() . "\n"; $data .= 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ) . "\n"; return $data; } /** * Get WordPress Configuration info. * * @since 1.6.6 * * @return string */ private function wp_info() { global $wpdb; $theme_data = wp_get_theme(); $theme = $theme_data->name . ' ' . $theme_data->version; $data = "\n" . '-- WordPress Configuration' . "\n\n"; $data .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; $data .= 'Language: ' . get_locale() . "\n"; $data .= 'User Language: ' . get_user_locale() . "\n"; $data .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; $data .= 'Active Theme: ' . $theme . "\n"; $data .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; // Only show page specs if front page is set to 'page'. if ( get_option( 'show_on_front' ) === 'page' ) { $front_page_id = get_option( 'page_on_front' ); $blog_page_id = get_option( 'page_for_posts' ); $data .= 'Page On Front: ' . ( $front_page_id ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; $data .= 'Page For Posts: ' . ( $blog_page_id ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; } $data .= 'ABSPATH: ' . ABSPATH . "\n"; $data .= 'Table Prefix: ' . 'Length: ' . strlen( $wpdb->prefix ) . ' Status: ' . ( strlen( $wpdb->prefix ) > 16 ? 'ERROR: Too long' : 'Acceptable' ) . "\n"; //phpcs:ignore $data .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; $data .= 'WPFORMS_DEBUG: ' . ( defined( 'WPFORMS_DEBUG' ) ? WPFORMS_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; $data .= 'Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; $data .= 'Registered Post Stati: ' . implode( ', ', get_post_stati() ) . "\n"; $data .= 'Revisions: ' . ( WP_POST_REVISIONS ? WP_POST_REVISIONS > 1 ? 'Limited to ' . WP_POST_REVISIONS : 'Enabled' : 'Disabled' ) . "\n"; return $data; } /** * Get Uploads/Constants info. * * @since 1.6.6 * * @return string */ private function uploads_info() { // @todo WPForms configuration/specific details. $data = "\n" . '-- WordPress Uploads/Constants' . "\n\n"; $data .= 'WP_CONTENT_DIR: ' . ( defined( 'WP_CONTENT_DIR' ) ? WP_CONTENT_DIR ? WP_CONTENT_DIR : 'Disabled' : 'Not set' ) . "\n"; $data .= 'WP_CONTENT_URL: ' . ( defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL ? WP_CONTENT_URL : 'Disabled' : 'Not set' ) . "\n"; $data .= 'UPLOADS: ' . ( defined( 'UPLOADS' ) ? UPLOADS ? UPLOADS : 'Disabled' : 'Not set' ) . "\n"; $uploads_dir = wp_upload_dir(); $data .= 'wp_uploads_dir() path: ' . $uploads_dir['path'] . "\n"; $data .= 'wp_uploads_dir() url: ' . $uploads_dir['url'] . "\n"; $data .= 'wp_uploads_dir() basedir: ' . $uploads_dir['basedir'] . "\n"; $data .= 'wp_uploads_dir() baseurl: ' . $uploads_dir['baseurl'] . "\n"; return $data; } /** * Get Plugins info. * * @since 1.6.6 * * @return string */ private function plugins_info() { // Get plugins that have an update. $data = $this->mu_plugins(); $data .= $this->installed_plugins(); $data .= $this->multisite_plugins(); return $data; } /** * Get MU Plugins info. * * @since 1.6.6 * * @return string */ private function mu_plugins() { $data = ''; // Must-use plugins. // NOTE: MU plugins can't show updates! $muplugins = get_mu_plugins(); if ( ! empty( $muplugins ) && count( $muplugins ) > 0 ) { $data = "\n" . '-- Must-Use Plugins' . "\n\n"; foreach ( $muplugins as $plugin => $plugin_data ) { $data .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; } } return $data; } /** * Get Installed Plugins info. * * @since 1.6.6 * * @return string */ private function installed_plugins() { $updates = get_plugin_updates(); // WordPress active plugins. $data = "\n" . '-- WordPress Active Plugins' . "\n\n"; $plugins = get_plugins(); $active_plugins = get_option( 'active_plugins', [] ); foreach ( $plugins as $plugin_path => $plugin ) { if ( ! in_array( $plugin_path, $active_plugins, true ) ) { continue; } $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $data .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } // WordPress inactive plugins. $data .= "\n" . '-- WordPress Inactive Plugins' . "\n\n"; foreach ( $plugins as $plugin_path => $plugin ) { if ( in_array( $plugin_path, $active_plugins, true ) ) { continue; } $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $data .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } return $data; } /** * Get Multisite Plugins info. * * @since 1.6.6 * * @return string */ private function multisite_plugins() { $data = ''; if ( ! is_multisite() ) { return $data; } $updates = get_plugin_updates(); // WordPress Multisite active plugins. $data = "\n" . '-- Network Active Plugins' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option( 'active_sitewide_plugins', [] ); foreach ( $plugins as $plugin_path ) { $plugin_base = plugin_basename( $plugin_path ); if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { continue; } $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $plugin = get_plugin_data( $plugin_path ); $data .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } return $data; } /** * Get Server info. * * @since 1.6.6 * * @return string */ private function server_info() { global $wpdb; // Server configuration (really just versions). $data = "\n" . '-- Webserver Configuration' . "\n\n"; $data .= 'PHP Version: ' . PHP_VERSION . "\n"; $data .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; $data .= 'Webserver Info: ' . ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : '' ) . "\n"; // PHP configs... now we're getting to the important stuff. $data .= "\n" . '-- PHP Configuration' . "\n\n"; $data .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; $data .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; $data .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; $data .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; $data .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; $data .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; $data .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; // PHP extensions and such. $data .= "\n" . '-- PHP Extensions' . "\n\n"; $data .= 'cURL: ' . ( function_exists( 'curl_init' ) ? 'Supported' : 'Not Supported' ) . "\n"; $data .= 'fsockopen: ' . ( function_exists( 'fsockopen' ) ? 'Supported' : 'Not Supported' ) . "\n"; $data .= 'SOAP Client: ' . ( class_exists( 'SoapClient', false ) ? 'Installed' : 'Not Installed' ) . "\n"; $data .= 'Suhosin: ' . ( extension_loaded( 'suhosin' ) ? 'Installed' : 'Not Installed' ) . "\n"; // Session stuff. $data .= "\n" . '-- Session Configuration' . "\n\n"; $data .= 'Session: ' . ( isset( $_SESSION ) ? 'Enabled' : 'Disabled' ) . "\n"; // The rest of this is only relevant if session is enabled. if ( isset( $_SESSION ) ) { $data .= 'Session Name: ' . esc_html( ini_get( 'session.name' ) ) . "\n"; $data .= 'Cookie Path: ' . esc_html( ini_get( 'session.cookie_path' ) ) . "\n"; $data .= 'Save Path: ' . esc_html( ini_get( 'session.save_path' ) ) . "\n"; $data .= 'Use Cookies: ' . ( ini_get( 'session.use_cookies' ) ? 'On' : 'Off' ) . "\n"; $data .= 'Use Only Cookies: ' . ( ini_get( 'session.use_only_cookies' ) ? 'On' : 'Off' ) . "\n"; } return $data; } /** * Get Lite Connect status info string. * * @since 1.7.5 * * @return string */ private function get_lite_connect_info() { $lc_enabled = wpforms_setting( 'lite-connect-enabled' ); $lc_enabled_since = wpforms_setting( 'lite-connect-enabled-since' ); $date = date_i18n( 'M j, Y @ g:ia', $lc_enabled_since + get_option( 'gmt_offset' ) * 3600 ); if ( $lc_enabled ) { $string = $lc_enabled_since ? 'Backup is enabled since ' . $date : 'Backup is enabled'; } else { $string = $lc_enabled_since ? 'Backup is not enabled. Previously was enabled since ' . $date : 'Backup is not enabled'; } return $string; } } ActionScheduler.php 0000644 00000002571 15134162217 0010340 0 ustar 00 <?php namespace WPForms\Admin\Tools\Views; use ActionScheduler_AdminView; /** * Class ActionScheduler view. * * @since 1.6.6 */ class ActionScheduler extends View { /** * View slug. * * @since 1.6.6 * * @var string */ protected $slug = 'action-scheduler'; /** * Init view. * * @since 1.6.6 */ public function init() { if ( $this->admin_view_exists() ) { ActionScheduler_AdminView::instance()->process_admin_ui(); } } /** * Get link to the view. * * @since 1.6.9 * * @return string */ public function get_link() { return add_query_arg( [ 's' => 'wpforms', ], parent::get_link() ); } /** * Get view label. * * @since 1.6.6 * * @return string */ public function get_label() { return esc_html__( 'Scheduled Actions', 'wpforms-lite' ); } /** * Checking user capability to view. * * @since 1.6.6 * * @return bool */ public function check_capability() { return wpforms_current_user_can(); } /** * Display view content. * * @since 1.6.6 */ public function display() { if ( ! $this->admin_view_exists() ) { return; } ( new ActionSchedulerList() )->display_page(); } /** * Check if ActionScheduler_AdminView class exists. * * @since 1.6.6 * * @return bool */ private function admin_view_exists() { return class_exists( 'ActionScheduler_AdminView' ); } } Import.php 0000644 00000017311 15134162217 0006534 0 ustar 00 <?php namespace WPForms\Admin\Tools\Views; use WPForms\Helpers\File; use WPForms\Admin\Tools\Importers; use WPForms\Admin\Tools\Tools; use WPForms_Form_Handler; /** * Class Import. * * @since 1.6.6 */ class Import extends View { /** * View slug. * * @since 1.6.6 * * @var string */ protected $slug = 'import'; /** * Registered importers. * * @since 1.6.6 * * @var array */ public $importers = []; /** * Checking user capability to view. * * @since 1.6.6 * * @return bool */ public function check_capability() { return wpforms_current_user_can( 'create_forms' ); } /** * Init view. * * @since 1.6.6 */ public function init() { add_action( 'wpforms_tools_init', [ $this, 'import_process' ] ); $this->importers = ( new Importers() )->get_importers(); } /** * Get view label. * * @since 1.6.6 * * @return string */ public function get_label() { return esc_html__( 'Import', 'wpforms-lite' ); } /** * Import process. * * @since 1.6.6 */ public function import_process() { if ( empty( $_POST['action'] ) || //phpcs:ignore WordPress.Security.NonceVerification $_POST['action'] !== 'import_form' || //phpcs:ignore WordPress.Security.NonceVerification empty( $_FILES['file']['tmp_name'] ) || ! isset( $_POST['submit-import'] ) || //phpcs:ignore WordPress.Security.NonceVerification ! $this->verify_nonce() ) { return; } $this->process(); } /** * Import view content. * * @since 1.6.6 */ public function display() { $this->success_import_message(); $this->wpforms_block(); $this->other_forms_block(); } /** * Success import message. * * @since 1.6.6 */ private function success_import_message() { if ( isset( $_GET['wpforms_notice'] ) && $_GET['wpforms_notice'] === 'forms-imported' ) { //phpcs:ignore WordPress.Security.NonceVerification.Recommended ?> <div class="updated notice is-dismissible"> <p> <?php esc_html_e( 'Import was successfully finished.', 'wpforms-lite' ); ?> <?php if ( wpforms_current_user_can( 'view_forms' ) ) { printf( wp_kses( /* translators: %s - Forms list page URL. */ __( 'You can go and <a href="%s">check your forms</a>.', 'wpforms-lite' ), [ 'a' => [ 'href' => [] ] ] ), esc_url( admin_url( 'admin.php?page=wpforms-overview' ) ) ); } ?> </p> </div> <?php } } /** * WPForms section. * * @since 1.6.6 */ private function wpforms_block() { ?> <div class="wpforms-setting-row tools"> <h4><?php esc_html_e( 'WPForms Import', 'wpforms-lite' ); ?></h4> <p><?php esc_html_e( 'Select a WPForms export file.', 'wpforms-lite' ); ?></p> <form method="post" enctype="multipart/form-data" action="<?php echo esc_attr( $this->get_link() ); ?>"> <div class="wpforms-file-upload"> <input type="file" name="file" id="wpforms-tools-form-import" class="inputfile" data-multiple-caption="{count} <?php esc_attr_e( 'files selected', 'wpforms-lite' ); ?>" accept=".json" /> <label for="wpforms-tools-form-import"> <span class="fld"><span class="placeholder"><?php esc_html_e( 'No file chosen', 'wpforms-lite' ); ?></span></span> <strong class="wpforms-btn wpforms-btn-md wpforms-btn-light-grey"> <i class="fa fa-upload"></i><?php esc_html_e( 'Choose a file…', 'wpforms-lite' ); ?> </strong> </label> </div> <br> <input type="hidden" name="action" value="import_form"> <button name="submit-import" class="wpforms-btn wpforms-btn-md wpforms-btn-orange"> <?php esc_html_e( 'Import', 'wpforms-lite' ); ?> </button> <?php $this->nonce_field(); ?> </form> </div> <?php } /** * WPForms section. * * @since 1.6.6 */ private function other_forms_block() { ?> <div class="wpforms-setting-row tools" id="wpforms-importers"> <h4><?php esc_html_e( 'Import from Other Form Plugins', 'wpforms-lite' ); ?></h4> <p><?php esc_html_e( 'Not happy with other WordPress contact form plugins?', 'wpforms-lite' ); ?></p> <p><?php esc_html_e( 'WPForms makes it easy for you to switch by allowing you import your third-party forms with a single click.', 'wpforms-lite' ); ?></p> <div class="wpforms-importers-wrap"> <?php if ( empty( $this->importers ) ) { ?> <p><?php esc_html_e( 'No form importers are currently enabled.', 'wpforms-lite' ); ?> </p> <?php } else { ?> <form action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>"> <span class="choicesjs-select-wrap"> <select class="choicesjs-select" name="provider" required> <option value=""><?php esc_html_e( 'Select previous contact form plugin...', 'wpforms-lite' ); ?></option> <?php foreach ( $this->importers as $importer ) { $status = ''; if ( empty( $importer['installed'] ) ) { $status = esc_html__( 'Not Installed', 'wpforms-lite' ); } elseif ( empty( $importer['active'] ) ) { $status = esc_html__( 'Not Active', 'wpforms-lite' ); } printf( '<option value="%s" %s>%s %s</option>', esc_attr( $importer['slug'] ), ! empty( $status ) ? 'disabled' : '', esc_html( $importer['name'] ), ! empty( $status ) ? '(' . esc_html( $status ) . ')' : '' //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } ?> </select> </span> <br /> <input type="hidden" name="page" value="<?php echo esc_attr( Tools::SLUG ); ?>"> <input type="hidden" name="view" value="importer"> <button class="wpforms-btn wpforms-btn-md wpforms-btn-orange"> <?php esc_html_e( 'Import', 'wpforms-lite' ); ?> </button> </form> <?php } ?> </div> </div> <?php } /** * Import processing. * * @since 1.6.6 */ private function process() { // Add filter of the link rel attr to avoid JSON damage. add_filter( 'wp_targeted_link_rel', '__return_empty_string', 50, 1 ); $ext = ''; if ( isset( $_FILES['file']['name'] ) ) { $ext = strtolower( pathinfo( sanitize_text_field( wp_unslash( $_FILES['file']['name'] ) ), PATHINFO_EXTENSION ) ); } if ( $ext !== 'json' ) { wp_die( esc_html__( 'Please upload a valid .json form export file.', 'wpforms-lite' ), esc_html__( 'Error', 'wpforms-lite' ), [ 'response' => 400, ] ); } $tmp_name = isset( $_FILES['file']['tmp_name'] ) ? sanitize_text_field( $_FILES['file']['tmp_name'] ) : ''; //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- wp_unslash() breaks upload on Windows. $forms = json_decode( File::remove_utf8_bom( file_get_contents( $tmp_name ) ), true ); if ( empty( $forms ) || ! is_array( $forms ) ) { wp_die( esc_html__( 'Form data cannot be imported.', 'wpforms-lite' ), esc_html__( 'Error', 'wpforms-lite' ), [ 'response' => 400, ] ); } foreach ( $forms as $form ) { $title = ! empty( $form['settings']['form_title'] ) ? $form['settings']['form_title'] : ''; $desc = ! empty( $form['settings']['form_desc'] ) ? $form['settings']['form_desc'] : ''; $new_id = wp_insert_post( [ 'post_title' => $title, 'post_status' => 'publish', 'post_type' => 'wpforms', 'post_excerpt' => $desc, ] ); if ( $new_id ) { $form['id'] = $new_id; wp_update_post( [ 'ID' => $new_id, 'post_content' => wpforms_encode( $form ), ] ); } if ( ! empty( $form['settings']['form_tags'] ) ) { wp_set_post_terms( $new_id, implode( ',', (array) $form['settings']['form_tags'] ), WPForms_Form_Handler::TAGS_TAXONOMY ); } } wp_safe_redirect( add_query_arg( [ 'wpforms_notice' => 'forms-imported' ] ) ); exit; } } ActionSchedulerList.php 0000644 00000004160 15134162217 0011170 0 ustar 00 <?php namespace WPForms\Admin\Tools\Views; use ActionScheduler as Scheduler; use ActionScheduler_ListTable; /** * Action Scheduler list table. * * @since 1.7.6 */ class ActionSchedulerList extends ActionScheduler_ListTable { /** * ActionSchedulerList constructor. * * @since 1.7.6 */ public function __construct() { parent::__construct( Scheduler::store(), Scheduler::logger(), Scheduler::runner() ); $this->process_actions(); } /** * Display the table heading. * * @since 1.7.6 */ protected function display_header() { ?> <h1><?php echo esc_html__( 'Scheduled Actions', 'wpforms-lite' ); ?></h1> <p> <?php echo sprintf( wp_kses( /* translators: %s - Action Scheduler website URL. */ __( 'WPForms is using the <a href="%s" target="_blank" rel="noopener noreferrer">Action Scheduler</a> library, which allows it to queue and process bigger tasks in the background without making your site slower for your visitors. Below you can see the list of all tasks and their status. This table can be very useful when debugging certain issues.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'rel' => [], 'target' => [], ], ] ), 'https://actionscheduler.org/' ); ?> </p> <p> <?php echo esc_html__( 'Action Scheduler library is also used by other plugins, like WP Mail SMTP and WooCommerce, so you might see tasks that are not related to our plugin in the table below.', 'wpforms-lite' ); ?> </p> <?php // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( ! empty( $_GET['s'] ) ) { ?> <div id="wpforms-reset-filter"> <?php echo wp_kses( sprintf( /* translators: %s - search term. */ __( 'Search results for <strong>%s</strong>', 'wpforms-lite' ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended sanitize_text_field( wp_unslash( $_GET['s'] ) ) ), [ 'strong' => [], ] ); ?> <a href="<?php echo esc_url( remove_query_arg( 's' ) ); ?>"> <span class="reset fa fa-times-circle"></span> </a> </div> <?php } } }
| ver. 1.4 |
Github
|
.
| PHP 8.2.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка