Нет описания

class-welcome.php 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <?php
  2. /**
  3. * Welcome page class.
  4. *
  5. * This page is shown when the plugin is activated.
  6. *
  7. * @since 1.0.0
  8. */
  9. class WPForms_Welcome {
  10. /**
  11. * Hidden welcome page slug.
  12. *
  13. * @since 1.5.6
  14. */
  15. const SLUG = 'wpforms-getting-started';
  16. /**
  17. * Primary class constructor.
  18. *
  19. * @since 1.0.0
  20. */
  21. public function __construct() {
  22. add_action( 'plugins_loaded', array( $this, 'hooks' ) );
  23. }
  24. /**
  25. * Register all WP hooks.
  26. *
  27. * @since 1.5.6
  28. */
  29. public function hooks() {
  30. // If user is in admin ajax or doing cron, return.
  31. if ( wp_doing_ajax() || wp_doing_cron() ) {
  32. return;
  33. }
  34. // If user cannot manage_options, return.
  35. if ( ! wpforms_current_user_can() ) {
  36. return;
  37. }
  38. add_action( 'admin_menu', array( $this, 'register' ) );
  39. add_action( 'admin_head', array( $this, 'hide_menu' ) );
  40. add_action( 'admin_init', array( $this, 'redirect' ), 9999 );
  41. }
  42. /**
  43. * Register the pages to be used for the Welcome screen (and tabs).
  44. *
  45. * These pages will be removed from the Dashboard menu, so they will
  46. * not actually show. Sneaky, sneaky.
  47. *
  48. * @since 1.0.0
  49. */
  50. public function register() {
  51. // Getting started - shows after installation.
  52. add_dashboard_page(
  53. esc_html__( 'Welcome to WPForms', 'wpforms-lite' ),
  54. esc_html__( 'Welcome to WPForms', 'wpforms-lite' ),
  55. apply_filters( 'wpforms_welcome_cap', wpforms_get_capability_manage_options() ),
  56. self::SLUG,
  57. array( $this, 'output' )
  58. );
  59. }
  60. /**
  61. * Removed the dashboard pages from the admin menu.
  62. *
  63. * This means the pages are still available to us, but hidden.
  64. *
  65. * @since 1.0.0
  66. */
  67. public function hide_menu() {
  68. remove_submenu_page( 'index.php', self::SLUG );
  69. }
  70. /**
  71. * Welcome screen redirect.
  72. *
  73. * This function checks if a new install or update has just occurred. If so,
  74. * then we redirect the user to the appropriate page.
  75. *
  76. * @since 1.0.0
  77. */
  78. public function redirect() {
  79. // Check if we should consider redirection.
  80. if ( ! get_transient( 'wpforms_activation_redirect' ) ) {
  81. return;
  82. }
  83. // If we are redirecting, clear the transient so it only happens once.
  84. delete_transient( 'wpforms_activation_redirect' );
  85. // Check option to disable welcome redirect.
  86. if ( get_option( 'wpforms_activation_redirect', false ) ) {
  87. return;
  88. }
  89. // Only do this for single site installs.
  90. if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // WPCS: CSRF ok.
  91. return;
  92. }
  93. // Check if this is an update or first install.
  94. $upgrade = get_option( 'wpforms_version_upgraded_from' );
  95. if ( ! $upgrade ) {
  96. // Initial install.
  97. wp_safe_redirect( admin_url( 'index.php?page=' . self::SLUG ) );
  98. exit;
  99. }
  100. }
  101. /**
  102. * Getting Started screen. Shows after first install.
  103. *
  104. * @since 1.0.0
  105. */
  106. public function output() {
  107. $class = wpforms()->pro ? 'pro' : 'lite';
  108. ?>
  109. <div id="wpforms-welcome" class="<?php echo sanitize_html_class( $class ); ?>">
  110. <div class="container">
  111. <div class="intro">
  112. <div class="sullie">
  113. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/sullie.png" alt="<?php esc_attr_e( 'Sullie the WPForms mascot', 'wpforms-lite' ); ?>">
  114. </div>
  115. <div class="block">
  116. <h1><?php esc_html_e( 'Welcome to WPForms', 'wpforms-lite' ); ?></h1>
  117. <h6><?php esc_html_e( 'Thank you for choosing WPForms - the most powerful drag & drop WordPress form builder in the market.', 'wpforms-lite' ); ?></h6>
  118. </div>
  119. <a href="#" class="play-video" title="<?php esc_attr_e( 'Watch how to create your first form', 'wpforms-lite' ); ?>">
  120. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-video.png" alt="<?php esc_attr_e( 'Watch how to create your first form', 'wpforms-lite' ); ?>" class="video-thumbnail">
  121. </a>
  122. <div class="block">
  123. <h6><?php esc_html_e( 'WPForms makes it easy to create forms in WordPress. You can watch the video tutorial or read our guide on how create your first form.', 'wpforms-lite' ); ?></h6>
  124. <div class="button-wrap wpforms-clear">
  125. <div class="left">
  126. <a href="<?php echo esc_url( admin_url( 'admin.php?page=wpforms-builder' ) ); ?>" class="wpforms-btn wpforms-btn-block wpforms-btn-lg wpforms-btn-orange">
  127. <?php esc_html_e( 'Create Your First Form', 'wpforms-lite' ); ?>
  128. </a>
  129. </div>
  130. <div class="right">
  131. <a href="https://wpforms.com/docs/creating-first-form/?utm_source=WordPress&amp;utm_medium=link&amp;utm_campaign=liteplugin"
  132. class="wpforms-btn wpforms-btn-block wpforms-btn-lg wpforms-btn-grey" target="_blank" rel="noopener noreferrer">
  133. <?php esc_html_e( 'Read the Full Guide', 'wpforms-lite' ); ?>
  134. </a>
  135. </div>
  136. </div>
  137. </div>
  138. </div><!-- /.intro -->
  139. <?php do_action( 'wpforms_welcome_intro_after' ); ?>
  140. <div class="features">
  141. <div class="block">
  142. <h1><?php esc_html_e( 'WPForms Features &amp; Addons', 'wpforms-lite' ); ?></h1>
  143. <h6><?php esc_html_e( 'WPForms is both easy to use and extremely powerful. We have tons of helpful features that allow us to give you everything you need from a form builder.', 'wpforms-lite' ); ?></h6>
  144. <div class="feature-list wpforms-clear">
  145. <div class="feature-block first">
  146. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-1.png">
  147. <h5><?php esc_html_e( 'Drag &amp; Drop Form Builder', 'wpforms-lite' ); ?></h5>
  148. <p><?php esc_html_e( 'Easily create an amazing form in just a few minutes without writing any code.', 'wpforms-lite' ); ?></p>
  149. </div>
  150. <div class="feature-block last">
  151. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-2.png">
  152. <h5><?php esc_html_e( 'Form Templates', 'wpforms-lite' ); ?></h5>
  153. <p><?php esc_html_e( 'Start with pre-built form templates to save even more time.', 'wpforms-lite' ); ?></p>
  154. </div>
  155. <div class="feature-block first">
  156. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-3.png">
  157. <h5><?php esc_html_e( 'Responsive Mobile Friendly', 'wpforms-lite' ); ?></h5>
  158. <p><?php esc_html_e( 'WPForms is 100% responsive meaning it works on mobile, tablets & desktop.', 'wpforms-lite' ); ?></p>
  159. </div>
  160. <div class="feature-block last">
  161. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-4.png">
  162. <h5><?php esc_html_e( 'Smart Conditional Logic', 'wpforms-lite' ); ?></h5>
  163. <p><?php esc_html_e( 'Easily create high performance forms with our smart conditional logic.', 'wpforms-lite' ); ?></p>
  164. </div>
  165. <div class="feature-block first">
  166. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-5.png">
  167. <h5><?php esc_html_e( 'Instant Notifications', 'wpforms-lite' ); ?></h5>
  168. <p><?php esc_html_e( 'Respond to leads quickly with our instant form notification feature for your team.', 'wpforms-lite' ); ?></p>
  169. </div>
  170. <div class="feature-block last">
  171. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-6.png">
  172. <h5><?php esc_html_e( 'Entry Management', 'wpforms-lite' ); ?></h5>
  173. <p><?php esc_html_e( 'View all your leads in one place to streamline your workflow.', 'wpforms-lite' ); ?></p>
  174. </div>
  175. <div class="feature-block first">
  176. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-7.png">
  177. <h5><?php esc_html_e( 'Payments Made Easy', 'wpforms-lite' ); ?></h5>
  178. <p><?php esc_html_e( 'Easily collect payments, donations, and online orders without hiring a developer.', 'wpforms-lite' ); ?></p>
  179. </div>
  180. <div class="feature-block last">
  181. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-8.png">
  182. <h5><?php esc_html_e( 'Marketing &amp; Subscriptions', 'wpforms-lite' ); ?></h5>
  183. <p><?php esc_html_e( 'Create subscription forms and connect with your email marketing service.', 'wpforms-lite' ); ?></p>
  184. </div>
  185. <div class="feature-block first">
  186. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-9.png">
  187. <h5><?php esc_html_e( 'Easy to Embed', 'wpforms-lite' ); ?></h5>
  188. <p><?php esc_html_e( 'Easily embed your forms in blog posts, pages, sidebar widgets, footer, etc.', 'wpforms-lite' ); ?></p>
  189. </div>
  190. <div class="feature-block last">
  191. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-feature-icon-10.png">
  192. <h5><?php esc_html_e( 'Spam Protection', 'wpforms-lite' ); ?></h5>
  193. <p><?php esc_html_e( 'Our smart captcha and honeypot automatically prevent spam submissions.', 'wpforms-lite' ); ?></p>
  194. </div>
  195. </div>
  196. <div class="button-wrap">
  197. <a href="https://wpforms.com/features/?utm_source=WordPress&amp;utm_medium=link&amp;utm_campaign=liteplugin&amp;utm_content=welcome"
  198. class="wpforms-btn wpforms-btn-lg wpforms-btn-grey" rel="noopener noreferrer" target="_blank">
  199. <?php esc_html_e( 'See All Features', 'wpforms-lite' ); ?>
  200. </a>
  201. </div>
  202. </div>
  203. </div><!-- /.features -->
  204. <div class="upgrade-cta upgrade">
  205. <div class="block wpforms-clear">
  206. <div class="left">
  207. <h2><?php esc_html_e( 'Upgrade to PRO', 'wpforms-lite' ); ?></h2>
  208. <ul>
  209. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Advanced Fields', 'wpforms-lite' ); ?></li>
  210. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Conditional Logic', 'wpforms-lite' ); ?></li>
  211. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Payment Forms', 'wpforms-lite' ); ?></li>
  212. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Surveys & Polls', 'wpforms-lite' ); ?></li>
  213. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Signatures', 'wpforms-lite' ); ?></li>
  214. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Form Abandonment', 'wpforms-lite' ); ?></li>
  215. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Entry Management', 'wpforms-lite' ); ?></li>
  216. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'File Uploads', 'wpforms-lite' ); ?></li>
  217. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Geolocation', 'wpforms-lite' ); ?></li>
  218. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Conversational Forms', 'wpforms-lite' ); ?></li>
  219. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'User Registration', 'wpforms-lite' ); ?></li>
  220. <li><span class="dashicons dashicons-yes"></span> <?php esc_html_e( 'Marketing Integrations', 'wpforms-lite' ); ?></li>
  221. </ul>
  222. </div>
  223. <div class="right">
  224. <h2><span><?php esc_html_e( 'PRO', 'wpforms-lite' ); ?></span></h2>
  225. <div class="price">
  226. <span class="amount">199</span><br>
  227. <span class="term"><?php esc_html_e( 'per year', 'wpforms-lite' ); ?></span>
  228. </div>
  229. <a href="<?php echo esc_url( wpforms_admin_upgrade_link( 'welcome' ) ); ?>" rel="noopener noreferrer" target="_blank"
  230. class="wpforms-btn wpforms-btn-block wpforms-btn-lg wpforms-btn-orange wpforms-upgrade-modal">
  231. <?php esc_html_e( 'Upgrade Now', 'wpforms-lite' ); ?>
  232. </a>
  233. </div>
  234. </div>
  235. </div>
  236. <div class="testimonials upgrade">
  237. <div class="block">
  238. <h1><?php esc_html_e( 'Testimonials', 'wpforms-lite' ); ?></h1>
  239. <div class="testimonial-block wpforms-clear">
  240. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-testimonial-bill.jpg">
  241. <p><?php esc_html_e( 'WPForms is by far the easiest form plugin to use. My clients love it – it’s one of the few plugins they can use without any training. As a developer I appreciate how fast, modern, clean and extensible it is.', 'wpforms-lite' ); ?>
  242. <p>
  243. <p><strong>Bill Erickson</strong>, Erickson Web Consulting</p>
  244. </div>
  245. <div class="testimonial-block wpforms-clear">
  246. <img src="<?php echo WPFORMS_PLUGIN_URL; ?>assets/images/welcome-testimonial-david.jpg">
  247. <p><?php esc_html_e( 'As a business owner, time is my most valuable asset. WPForms allow me to create smart online forms with just a few clicks. With their pre-built form templates and the drag & drop builder, I can create a new form that works in less than 2 minutes without writing a single line of code. Well worth the investment.', 'wpforms-lite' ); ?>
  248. <p>
  249. <p><strong>David Henzel</strong>, MaxCDN</p>
  250. </div>
  251. </div>
  252. </div><!-- /.testimonials -->
  253. <div class="footer">
  254. <div class="block wpforms-clear">
  255. <div class="button-wrap wpforms-clear">
  256. <div class="left">
  257. <a href="<?php echo esc_url( admin_url( 'admin.php?page=wpforms-builder' ) ); ?>"
  258. class="wpforms-btn wpforms-btn-block wpforms-btn-lg wpforms-btn-orange">
  259. <?php esc_html_e( 'Create Your First Form', 'wpforms-lite' ); ?>
  260. </a>
  261. </div>
  262. <div class="right">
  263. <a href="<?php echo esc_url( wpforms_admin_upgrade_link( 'welcome' ) ); ?>" target="_blank" rel="noopener noreferrer"
  264. class="wpforms-btn wpforms-btn-block wpforms-btn-lg wpforms-btn-trans-green wpforms-upgrade-modal">
  265. <span class="underline">
  266. <?php esc_html_e( 'Upgrade to WPForms Pro', 'wpforms-lite' ); ?> <span class="dashicons dashicons-arrow-right"></span>
  267. </span>
  268. </a>
  269. </div>
  270. </div>
  271. </div>
  272. </div><!-- /.footer -->
  273. </div><!-- /.container -->
  274. </div><!-- /#wpforms-welcome -->
  275. <?php
  276. }
  277. }
  278. new WPForms_Welcome();