';
}
/**
* Generate and output heading section HTML.
*
* @since 1.5.7
*/
public function output_section_heading() {
// Heading section.
printf(
'
%4$s
%5$s
',
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/analytics/wpforms-monsterinsights.png' ),
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/analytics/wpforms-monsterinsights@2x.png' ),
esc_attr__( 'WPForms ♥ MonsterInsights', 'wpforms-lite' ),
esc_html__( 'The Best Google Analytics Plugin for WordPress', 'wpforms-lite' ),
esc_html__( 'MonsterInsights connects WPForms to Google Analytics, providing a powerful integration with their Forms addon. MonsterInsights is a sister company of WPForms.', 'wpforms-lite' )
);
}
/**
* Generate and output heading section HTML.
*
* @since 1.5.7
*/
protected function output_section_screenshot() {
// Screenshot section.
printf(
'
%4$s
%5$s
%6$s
%7$s
',
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/analytics/screenshot-tnail.jpg' ),
esc_attr__( 'Analytics screenshot', 'wpforms-lite' ),
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/analytics/screenshot-full.jpg' ),
esc_html__( 'Track form impressions and conversions.', 'wpforms-lite' ),
esc_html__( 'View form conversion rates from WordPress.', 'wpforms-lite' ),
esc_html__( 'Complete UTM tracking with form entries.', 'wpforms-lite' ),
esc_html__( 'Automatic integration with WPForms.', 'wpforms-lite' )
);
}
/**
* Generate and output step 'Install' section HTML.
*
* @since 1.5.7
*/
protected function output_section_step_install() {
$step = $this->get_data_step_install();
if ( empty( $step ) ) {
return;
}
printf(
'
',
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/smtp/wpforms-wpmailsmtp.png' ),
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/smtp/wpforms-wpmailsmtp@2x.png' ),
esc_attr__( 'WPForms ♥ WP Mail SMTP', 'wpforms-lite' ),
esc_html__( 'Making Email Deliverability Easy for WordPress', 'wpforms-lite' ),
esc_html__( 'WP Mail SMTP allows you to easily set up WordPress to use a trusted provider to reliably send emails, including form notifications. Built by the same folks behind WPForms.', 'wpforms-lite' )
);
}
/**
* Generate and output screenshot section HTML.
*
* @since 1.5.7
*/
protected function output_section_screenshot() {
// Screenshot section.
printf(
'
',
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/' . $step['icon'] ),
esc_attr__( 'Step 1', 'wpforms-lite' ),
esc_html__( 'Install and Activate WP Mail SMTP', 'wpforms-lite' ),
esc_html__( 'Install WP Mail SMTP from the WordPress.org plugin repository.', 'wpforms-lite' ),
esc_attr( $step['button_class'] ),
esc_attr( $step['plugin'] ),
esc_attr( $step['button_action'] ),
esc_html( $step['button_text'] )
);
}
/**
* Generate and output step 'Setup' section HTML.
*
* @since 1.5.7
*/
protected function output_section_step_setup() {
$step = $this->get_data_step_setup();
if ( empty( $step ) ) {
return;
}
printf(
'
%4$s
%5$s
',
esc_attr( $step['section_class'] ),
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/' . $step['icon'] ),
esc_attr__( 'Step 2', 'wpforms-lite' ),
esc_html__( 'Set Up WP Mail SMTP', 'wpforms-lite' ),
esc_html__( 'Select and configure your mailer.', 'wpforms-lite' ),
esc_attr( $step['button_class'] ),
esc_url( admin_url( $this->config['smtp_settings'] ) ),
esc_html( $step['button_text'] )
);
}
/**
* Step 'Install' data.
*
* @since 1.5.7
*
* @return array Step data.
*/
protected function get_data_step_install() {
$step = array();
$this->output_data['all_plugins'] = get_plugins();
$this->output_data['plugin_installed'] = array_key_exists( $this->config['lite_plugin'], $this->output_data['all_plugins'] );
$this->output_data['pro_plugin_installed'] = array_key_exists( $this->config['pro_plugin'], $this->output_data['all_plugins'] );
$this->output_data['plugin_activated'] = false;
$this->output_data['plugin_setup'] = false;
if ( ! $this->output_data['plugin_installed'] && ! $this->output_data['pro_plugin_installed'] ) {
$step['icon'] = 'step-1.svg';
$step['button_text'] = esc_html__( 'Install WP Mail SMTP', 'wpforms-lite' );
$step['button_class'] = '';
$step['button_action'] = 'install';
$step['plugin'] = $this->config['lite_download_url'];
} else {
$this->output_data['plugin_activated'] = $this->is_smtp_activated();
$this->output_data['plugin_setup'] = $this->is_smtp_configured();
$step['icon'] = $this->output_data['plugin_activated'] ? 'step-complete.svg' : 'step-1.svg';
$step['button_text'] = $this->output_data['plugin_activated'] ? esc_html__( 'WP Mail SMTP Installed & Activated', 'wpforms-lite' ) : esc_html__( 'Activate WP Mail SMTP', 'wpforms-lite' );
$step['button_class'] = $this->output_data['plugin_activated'] ? 'grey disabled' : '';
$step['button_action'] = $this->output_data['plugin_activated'] ? '' : 'activate';
$step['plugin'] = $this->output_data['pro_plugin_installed'] ? $this->config['pro_plugin'] : $this->config['lite_plugin'];
}
return $step;
}
/**
* Step 'Setup' data.
*
* @since 1.5.7
*
* @return array Step data.
*/
protected function get_data_step_setup() {
$step = array();
$step['icon'] = 'step-2.svg';
$step['section_class'] = $this->output_data['plugin_activated'] ? '' : 'grey';
$step['button_text'] = esc_html__( 'Start Setup', 'wpforms-lite' );
$step['button_class'] = 'grey disabled';
if ( $this->output_data['plugin_setup'] ) {
$step['icon'] = 'step-complete.svg';
$step['section_class'] = '';
$step['button_text'] = esc_html__( 'Go to SMTP settings', 'wpforms-lite' );
} else {
$step['button_class'] = $this->output_data['plugin_activated'] ? '' : 'grey disabled';
}
return $step;
}
/**
* Ajax endpoint. Check plugin setup status.
* Used to properly init step 'Setup' section after completing step 'Install'.
*
* @since 1.5.7
*/
public function ajax_check_plugin_status() {
// Security checks.
if (
! check_ajax_referer( 'wpforms-admin', 'nonce', false ) ||
! wpforms_current_user_can()
) {
wp_send_json_error(
array(
'error' => esc_html__( 'You do not have permission.', 'wpforms-lite' ),
)
);
}
$result = array();
if ( ! $this->is_smtp_activated() ) {
wp_send_json_error(
array(
'error' => esc_html__( 'Plugin unavailable.', 'wpforms-lite' ),
)
);
}
$result['setup_status'] = (int) $this->is_smtp_configured();
$result['license_level'] = wp_mail_smtp()->get_license_type();
wp_send_json_success( $result );
}
/**
* Get $phpmailer instance.
*
* @since 1.5.7
*
* @return \PHPMailer Instance of PHPMailer.
*/
protected function get_phpmailer() {
global $phpmailer;
if ( ! is_object( $phpmailer ) || ! is_a( $phpmailer, 'PHPMailer' ) ) {
require_once ABSPATH . WPINC . '/class-phpmailer.php';
$phpmailer = new \PHPMailer( true ); // phpcs:ignore
}
return $phpmailer;
}
/**
* Whether WP Mail SMTP plugin configured or not.
*
* @since 1.5.7
*
* @return bool True if some mailer is selected and configured properly.
*/
protected function is_smtp_configured() {
if ( ! $this->is_smtp_activated() ) {
return false;
}
$phpmailer = $this->get_phpmailer();
$mailer = \WPMailSMTP\Options::init()->get( 'mail', 'mailer' );
$is_mailer_complete = wp_mail_smtp()->get_providers()->get_mailer( $mailer, $phpmailer )->is_mailer_complete();
return 'mail' !== $mailer && $is_mailer_complete;
}
/**
* Whether WP Mail SMTP plugin active or not.
*
* @since 1.5.7
*
* @return bool True if SMTP plugin is active.
*/
protected function is_smtp_activated() {
return function_exists( 'wp_mail_smtp' ) && ( is_plugin_active( $this->config['lite_plugin'] ) || is_plugin_active( $this->config['pro_plugin'] ) );
}
/**
* Redirect to SMTP settings page.
*
* @since 1.5.7
*/
public function redirect_to_smtp_settings() {
// Redirect to SMTP plugin if it is activated.
if ( $this->is_smtp_configured() ) {
wp_safe_redirect( admin_url( $this->config['smtp_settings'] ) );
exit;
}
}
}
PK #\:XX X
Challenge.phpnu W+A hooks();
}
}
/**
* Hooks.
*
* @since 1.5.0
*/
public function hooks() {
\add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
\add_action( 'wpforms_builder_init', array( $this, 'start_challenge' ) );
\add_action( 'admin_footer', array( $this, 'challenge_html' ) );
\add_action( 'wpforms_welcome_intro_after', array( $this, 'welcome_html' ) );
\add_action( 'wp_ajax_wpforms_challenge_embed_page_url', array( $this, 'get_embed_page_url_ajax' ) );
\add_action( 'wp_ajax_wpforms_challenge_save_option', array( $this, 'save_challenge_option_ajax' ) );
\add_action( 'wp_ajax_wpforms_challenge_send_contact_form', array( $this, 'send_contact_form_ajax' ) );
}
/**
* Check if the current page is related to Challenge.
*
* @since 1.5.0
*/
public function is_challenge_page() {
return \wpforms_is_admin_page()
|| $this->is_builder_page()
|| $this->is_form_embed_page();
}
/**
* Check if the current page is a forms builder page related to Challenge.
*
* @since 1.5.0
*/
public function is_builder_page() {
if ( ! \wpforms_is_admin_page( 'builder' ) ) {
return false;
}
if ( ! $this->challenge_active() ) {
return false;
}
$step = \absint( $this->get_challenge_option( 'step' ) );
$form_id = \absint( $this->get_challenge_option( 'form_id' ) );
if ( $form_id && $step < 2 ) {
return false;
}
$current_form_id = isset( $_GET['form_id'] ) ? \absint( $_GET['form_id'] ) : 0;
$is_new_form = isset( $_GET['newform'] ) ? \absint( $_GET['newform'] ) : 0;
if ( $is_new_form && 2 !== $step ) {
return false;
}
if ( ! $is_new_form && $form_id !== $current_form_id && $step >= 2 ) {
return false;
}
return true;
}
/**
* Check if the current page is a form embed page edit related to Challenge.
*
* @since 1.5.0
*/
public function is_form_embed_page() {
if ( ! \is_admin() || ! \is_user_logged_in() ) {
return false;
}
$screen = \get_current_screen();
if ( ! isset( $screen->id ) || 'page' !== $screen->id ) {
return false;
}
if ( ! $this->challenge_active() ) {
return false;
}
$step = $this->get_challenge_option( 'step' );
if ( ! \in_array( $step, array( 4, 5 ), true ) ) {
return false;
}
$embed_page = $this->get_challenge_option( 'embed_page' );
if ( isset( $screen->action ) && 'add' === $screen->action && 0 === $embed_page ) {
return true;
}
if ( isset( $_GET['post'] ) && $embed_page === \absint( $_GET['post'] ) ) {
return true;
}
return false;
}
/**
* Load scripts and styles.
*
* @since 1.5.0
*/
public function enqueue_scripts() {
if ( $this->challenge_finished() ) {
return;
}
$min = \wpforms_get_min_suffix();
if ( $this->is_challenge_page() ) {
\wp_enqueue_style(
'wpforms-challenge',
\WPFORMS_PLUGIN_URL . "assets/css/challenge{$min}.css",
array(),
\WPFORMS_VERSION
);
\wp_enqueue_script(
'wpforms-challenge-admin',
\WPFORMS_PLUGIN_URL . "assets/js/components/admin/challenge/challenge-admin{$min}.js",
array( 'jquery' ),
\WPFORMS_VERSION,
true
);
\wp_localize_script(
'wpforms-challenge-admin',
'wpforms_challenge_admin',
array(
'nonce' => \wp_create_nonce( 'wpforms_challenge_ajax_nonce' ),
'minutes_left' => \absint( $this->minutes ),
)
);
}
if ( $this->is_builder_page() || $this->is_form_embed_page() ) {
\wp_enqueue_style(
'tooltipster',
\WPFORMS_PLUGIN_URL . 'assets/css/tooltipster.css',
null,
'4.2.6'
);
\wp_enqueue_script(
'tooltipster',
\WPFORMS_PLUGIN_URL . 'assets/js/jquery.tooltipster.min.js',
array( 'jquery' ),
'4.2.6',
true
);
\wp_enqueue_script(
'wpforms-challenge-core',
\WPFORMS_PLUGIN_URL . "assets/js/components/admin/challenge/challenge-core{$min}.js",
array( 'jquery', 'tooltipster', 'wpforms-challenge-admin' ),
\WPFORMS_VERSION,
true
);
}
if ( $this->is_builder_page() ) {
\wp_enqueue_script(
'wpforms-challenge-builder',
\WPFORMS_PLUGIN_URL . "assets/js/components/admin/challenge/challenge-builder{$min}.js",
array( 'jquery', 'tooltipster', 'wpforms-challenge-core' ),
\WPFORMS_VERSION,
true
);
}
if ( $this->is_form_embed_page() ) {
\wp_enqueue_style(
'wpforms-font-awesome',
\WPFORMS_PLUGIN_URL . 'assets/css/font-awesome.min.css',
null,
'4.7.0'
);
\wp_enqueue_script(
'wpforms-challenge-embed',
\WPFORMS_PLUGIN_URL . "assets/js/components/admin/challenge/challenge-embed{$min}.js",
array( 'jquery', 'tooltipster', 'wpforms-challenge-core' ),
\WPFORMS_VERSION,
true
);
}
}
/**
* Get 'wpforms_challenge' option schema.
*
* @since 1.5.0
*/
public function get_challenge_option_schema() {
return array(
'status' => '',
'step' => 0,
'user_id' => \get_current_user_id(),
'form_id' => 0,
'embed_page' => 0,
'started_date_gmt' => '',
'finished_date_gmt' => '',
'seconds_spent' => 0,
'seconds_left' => 0,
'feedback_sent' => false,
'feedback_contact_me' => false,
);
}
/**
* Get Challenge parameter(s) from Challenge option.
*
* @since 1.5.0
*
* @param array|string|null $query Query using 'wpforms_challenge' schema keys.
*
* @return array|mixed
*/
public function get_challenge_option( $query = null ) {
if ( ! $query ) {
return \get_option( 'wpforms_challenge' );
}
if ( ! \is_array( $query ) ) {
$return_single = true;
$query = array( $query );
}
$query = \array_flip( $query );
$option = \get_option( 'wpforms_challenge' );
if ( ! $option || ! \is_array( $option ) ) {
return \array_intersect_key( $this->get_challenge_option_schema(), $query );
}
$result = \array_intersect_key( $option, $query );
if ( $return_single ) {
$result = \reset( $result );
}
return $result;
}
/**
* Set Challenge parameter(s) to Challenge option.
*
* @since 1.5.0
*
* @param array $query Query using 'wpforms_challenge' schema keys.
*/
public function set_challenge_option( $query ) {
if ( empty( $query ) || ! \is_array( $query ) ) {
return;
}
$schema = $this->get_challenge_option_schema();
$replace = \array_intersect_key( $query, $schema );
if ( ! $replace ) {
return;
}
// Validate and sanitize the data.
foreach ( $replace as $key => $value ) {
if ( \in_array( $key, array( 'step', 'user_id', 'form_id', 'embed_page', 'seconds_spent', 'seconds_left' ), true ) ) {
$replace[ $key ] = \absint( $value );
continue;
}
if ( \in_array( $key, array( 'feedback_sent', 'feedback_contact_me' ), true ) ) {
$replace[ $key ] = \wp_validate_boolean( $value );
continue;
}
$replace[ $key ] = \sanitize_text_field( $value );
}
$option = \get_option( 'wpforms_challenge' );
if ( ! $option || ! \is_array( $option ) ) {
\update_option( 'wpforms_challenge', \array_merge( $schema, $replace ) );
return;
}
\update_option( 'wpforms_challenge', \array_merge( $option, $replace ) );
}
/**
* Check if any forms are present on a site.
*
* @since 1.5.0
*/
public function website_has_forms() {
return (bool) \wpforms()->form->get( '', array( 'numberposts' => 1 ) );
}
/**
* Check if Challenge was started.
*
* @since 1.5.0
*/
public function challenge_started() {
return 'started' === $this->get_challenge_option( 'status' );
}
/**
* Check if Challenge was finished.
*
* @since 1.5.0
*/
public function challenge_finished() {
$status = $this->get_challenge_option( 'status' );
return \in_array( $status, array( 'completed', 'canceled', 'skipped' ), true );
}
/**
* Check if Challenge is in progress.
*
* @since 1.5.0
*/
public function challenge_active() {
return $this->challenge_started() && ! $this->challenge_finished();
}
/**
* Check if Challenge can be started.
*
* @since 1.5.0
*/
public function challenge_can_start() {
if ( $this->website_has_forms() ) {
return false;
}
if ( $this->challenge_started() || $this->challenge_finished() ) {
return false;
}
return true;
}
/**
* Start the Challenge in Form Builder.
*
* @since 1.5.0
*/
public function start_challenge() {
if ( ! isset( $_GET['challenge'] ) || 'start' !== $_GET['challenge'] ) {
return;
}
if ( ! $this->challenge_can_start() ) {
return;
}
$this->set_challenge_option(
array(
'status' => 'started',
'started_date_gmt' => \current_time( 'mysql', true ),
)
);
\wp_safe_redirect( \remove_query_arg( 'challenge' ) );
}
/**
* Include Challenge HTML.
*
* @since 1.5.0
*/
public function challenge_html() {
if ( $this->challenge_finished() ) {
return;
}
if ( \wpforms_is_admin_page() && ! \wpforms_is_admin_page( 'getting-started' ) && $this->challenge_can_start() ) {
$this->challenge_modal_html( 'start' );
}
if ( $this->is_builder_page() ) {
$this->challenge_modal_html( 'progress' );
$this->challenge_builder_templates_html();
}
if ( $this->is_form_embed_page() ) {
$this->challenge_modal_html( 'progress' );
$this->challenge_embed_templates_html();
}
}
/**
* Include Challenge main modal window HTML.
*
* @since 1.5.0
*
* @param string $state State of Challenge ('start' or 'progress').
*/
public function challenge_modal_html( $state ) {
?>
WPForms Challenge and get up and running within %1$d %2$s.', 'wpforms-lite' ),
\absint( $this->minutes ),
\_n( 'minute', 'minutes', \absint( $this->minutes ), 'wpforms-lite' )
),
array( 'b' => array() )
);
?>
' . \absint( $this->minutes ) .':00'
);
?>
%1$s %2$s %3$s %4$s. Share your success story with other WPForms users and help us spread the word by giving WPForms a 5-star rating (%5$s) on WordPress.org. Thanks for your support and we look forward to bringing more awesome features.', 'wpforms-lite' ),
'',
\_n( 'minute', 'minutes', \absint( $this->minutes ), 'wpforms-lite' ),
'',
\_n( 'second', 'seconds', \absint( $this->minutes ), 'wpforms-lite' ),
''
),
array(
'span' => array(
'id' => array(),
'class' => array(),
),
'b' => array(),
'i' => array(
'class' => array(),
),
)
);
?>
challenge_finished() ) {
return;
}
?>
get_var(
"SELECT ID
FROM $wpdb->posts
WHERE post_type = 'page'
AND post_name LIKE '%contact%';"
)
);
if ( $page_id ) {
$url = \get_edit_post_link( $page_id, '' );
$this->set_challenge_option( array( 'embed_page' => $page_id ) );
} else {
$url = \add_query_arg( 'post_type', 'page', \admin_url( 'post-new.php' ) );
$this->set_challenge_option( array( 'embed_page' => 0 ) );
}
\wp_send_json_success( $url );
}
/**
* Save Challenge data via AJAX.
*
* @since 1.5.0
*/
public function save_challenge_option_ajax() {
\check_admin_referer( 'wpforms_challenge_ajax_nonce' );
if ( empty( $_POST['option_data'] ) ) {
\wp_send_json_error();
}
$schema = $this->get_challenge_option_schema();
foreach ( $schema as $key => $value ) {
if ( ! empty( $_POST['option_data'][ $key ] ) ) {
$query[ $key ] = \sanitize_text_field( \wp_unslash( $_POST['option_data'][ $key ] ) );
}
}
if ( empty( $query ) ) {
\wp_send_json_error();
}
if ( ! empty( $query['status'] ) && \in_array( $query['status'], array( 'completed', 'canceled', 'skipped' ), true ) ) {
$query['finished_date_gmt'] = \current_time( 'mysql', true );
}
if ( ! empty( $query['status'] ) && 'skipped' === $query['status'] ) {
$query['started_date_gmt'] = \current_time( 'mysql', true );
$query['finished_date_gmt'] = $query['started_date_gmt'];
}
$this->set_challenge_option( $query );
\wp_send_json_success();
}
/**
* Send contact form to wpforms.com via AJAX.
*
* @since 1.5.0
*/
public function send_contact_form_ajax() {
\check_admin_referer( 'wpforms_challenge_ajax_nonce' );
$url = 'https://wpforms.com/wpforms-challenge-feedback/';
$message = ! empty( $_POST['contact_data']['message'] ) ? \sanitize_textarea_field( \wp_unslash( $_POST['contact_data']['message'] ) ) : '';
$email = '';
if ( ! empty( $_POST['contact_data']['contact_me'] ) && 'true' === $_POST['contact_data']['contact_me'] ) {
$current_user = \wp_get_current_user();
$email = $current_user->user_email;
$this->set_challenge_option( array( 'feedback_contact_me' => true ) );
}
if ( empty( $message ) && empty( $email ) ) {
\wp_send_json_error();
}
$data = array(
'body' => array(
'wpforms' => array(
'id' => 296355,
'submit' => 'wpforms-submit',
'fields' => array(
2 => $message,
3 => $email,
),
),
),
);
$response = \wp_remote_post( $url, $data );
if ( \is_wp_error( $response ) ) {
\wp_send_json_error();
}
$this->set_challenge_option( array( 'feedback_sent' => true ) );
\wp_send_json_success();
}
}
PK #\$k+\ \ AdminBarMenu.phpnu W+A hooks();
}
/**
* Register hooks.
*
* @since 1.6.0
*/
public function hooks() {
add_action( 'wp_enqueue_scripts', [ $this, 'enqueues' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueues' ] );
add_action( 'admin_bar_menu', [ $this, 'register' ], 999 );
}
/**
* Check if current user has access to see admin bar menu.
*
* @since 1.6.0
*
* @return bool
*/
public function has_access() {
$access = false;
if (
is_user_logged_in() &&
wpforms_current_user_can() &&
! wpforms_setting( 'hide-admin-bar', false )
) {
$access = true;
}
return apply_filters( 'wpforms_admin_adminbarmenu_has_access', $access );
}
/**
* Check if new notifications are available.
*
* @since 1.6.0
*
* @return bool
*/
public function has_notifications() {
return wpforms()->get( 'notifications' )->get_count();
}
/**
* Enqueue styles.
*
* @since 1.6.0
*/
public function enqueues() {
if ( ! $this->has_access() ) {
return;
}
$min = wpforms_get_min_suffix();
wp_enqueue_style(
'wpforms-admin-bar',
WPFORMS_PLUGIN_URL . "assets/css/admin-bar{$min}.css",
[],
WPFORMS_VERSION
);
}
/**
* Register and render admin menu bar items.
*
* @since 1.6.0
*
* @param \WP_Admin_Bar $wp_admin_bar WordPress Admin Bar object.
*/
public function register( \WP_Admin_Bar $wp_admin_bar ) {
if ( ! $this->has_access() ) {
return;
}
$items = apply_filters(
'wpforms_admin_adminbarmenu_register',
[
'main_menu',
'notification_menu',
'forms_menu',
'all_forms_menu',
'add_new_menu',
'community_menu',
'support_menu',
],
$wp_admin_bar
);
foreach ( $items as $item ) {
$this->{ $item }( $wp_admin_bar );
do_action( "wpforms_admin_adminbarmenu_register_{$item}_after", $wp_admin_bar );
}
}
/**
* Render primary top-level admin menu bar item.
*
* @since 1.6.0
*
* @param \WP_Admin_Bar $wp_admin_bar WordPress Admin Bar object.
*/
public function main_menu( \WP_Admin_Bar $wp_admin_bar ) {
$indicator = '';
if ( $this->has_notifications() ) {
$count = $this->has_notifications() < 10 ? $this->has_notifications() : '!';
$indicator = '
';
}
/**
* Widget content HTML if a user has no forms.
*
* @since 1.5.0
*/
public function widget_content_no_forms_html() {
$create_form_url = \add_query_arg( 'page', 'wpforms-builder', \admin_url( 'admin.php' ) );
$learn_more_url = 'https://wpforms.com/docs/creating-first-form/?utm_source=WordPress&utm_medium=link&utm_campaign=liteplugin&utm_content=dashboardwidget';
?>
forms_list_block(); ?>
get_entries_count_by_form();
if ( empty( $forms ) ) {
$this->forms_list_block_empty_html();
} else {
$this->forms_list_block_html( $forms );
}
}
/**
* Empty forms list block HTML.
*
* @since 1.5.0
*/
public function forms_list_block_empty_html() {
?>
' . esc_html__( 'We\'re sorry, the %name% is not available on your plan. Please upgrade to the PRO plan to unlock all these awesome features.', 'wpforms-lite' ) . '
',
'bonus' => '
' .
wp_kses(
__( 'Bonus: WPForms Lite users get 50% off regular price, automatically applied at checkout.', 'wpforms-lite' ),
[
'strong' => [],
'span' => [],
]
) .
'
' . esc_html__( 'We\'re sorry, the %name% is not available on your plan. Please upgrade to the Elite plan to unlock all these awesome features.', 'wpforms-lite' ) . '
',
'bonus' => '
' .
wp_kses(
__( 'Bonus: WPForms Lite users get 50% off regular price, automatically applied at checkout.', 'wpforms-lite' ),
[
'strong' => [],
'span' => [],
]
) .
'
',
'doc' => '' . esc_html__( 'Already purchased?', 'wpforms-lite' ) . '',
'button' => esc_html__( 'Upgrade to Elite', 'wpforms-lite' ),
'url' => wpforms_admin_upgrade_link( 'builder-modal', 'upgrade-elite' ),
'modal' => wpforms_get_upgrade_modal_text( 'elite' ),
],
];
return $strings;
}
/**
* Load enqueues.
*
* @since 1.5.1
*/
public function enqueues() {
$min = wpforms_get_min_suffix();
wp_enqueue_script(
'wpforms-builder-education',
WPFORMS_PLUGIN_URL . "lite/assets/js/admin/builder-education{$min}.js",
array( 'jquery', 'jquery-confirm' ),
WPFORMS_VERSION,
false
);
}
/**
* Display templates.
*
* @since 1.5.1
*/
public function templates() {
$templates = array(
array(
'name' => esc_html__( 'Request A Quote Form', 'wpforms-lite' ),
'slug' => 'request-quote',
'description' => esc_html__( 'Start collecting leads with this pre-made Request a quote form. You can add and remove fields as needed.', 'wpforms-lite' ),
),
array(
'name' => esc_html__( 'Donation Form', 'wpforms-lite' ),
'slug' => 'donation',
'description' => esc_html__( 'Start collecting donation payments on your website with this ready-made Donation form. You can add and remove fields as needed.', 'wpforms-lite' ),
),
array(
'name' => esc_html__( 'Billing / Order Form', 'wpforms-lite' ),
'slug' => 'order',
'description' => esc_html__( 'Collect payments for product and service orders with this ready-made form template. You can add and remove fields as needed.', 'wpforms-lite' ),
),
);
?>
' . esc_html__( 'We\'re sorry, the %name% is not available on your plan. Please upgrade to the PRO plan to unlock all these awesome features.', 'wpforms-lite' ) . '
',
'bonus' => '
' .
wp_kses(
__( 'Bonus: WPForms Lite users get 50% off regular price, automatically applied at checkout.', 'wpforms-lite' ),
[
'strong' => [],
'span' => [],
]
) .
'
' . esc_html__( 'We\'re sorry, the %name% is not available on your plan. Please upgrade to the Elite plan to unlock all these awesome features.', 'wpforms-lite' ) . '
',
'bonus' => '
' .
wp_kses(
__( 'Bonus: WPForms Lite users get 50% off regular price, automatically applied at checkout.', 'wpforms-lite' ),
[
'strong' => [],
'span' => [],
]
) .
'
',
esc_html__( 'Access Controls', 'wpforms-lite' ),
esc_url( WPFORMS_PLUGIN_URL . 'assets/images/lite-settings-access/pro-plus.svg' ),
esc_attr__( 'Pro+', 'wpforms-lite' ),
esc_html__( 'Access controls allows you to manage and customize access to WPForms functionality.', 'wpforms-lite' ),
esc_html__( 'You can easily grant or restrict access using the simple built-in controls, or use our official integrations with Members and User Role Editor plugins.', 'wpforms-lite' )
);
}
/**
* Generate and output section "Screenshots" row HTML.
*
* @since 1.5.8
*/
public function output_section_row_screenshots() {
$format = '