PageRenderTime 50ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/184.168.182.1/wp-content/plugins/contact-form-7/admin/admin.php

https://gitlab.com/endomorphosis/falkenstein
PHP | 518 lines | 384 code | 133 blank | 1 comment | 59 complexity | 2a3245166572e7d2134d5ee659820824 MD5 | raw file
  1. <?php
  2. require_once WPCF7_PLUGIN_DIR . '/admin/admin-functions.php';
  3. add_action( 'admin_menu', 'wpcf7_admin_menu', 9 );
  4. function wpcf7_admin_menu() {
  5. $icon_url = wpcf7_plugin_url( 'admin/images/menu-icon.png' );
  6. if ( defined( 'MP6' ) && MP6
  7. || version_compare( get_bloginfo( 'version' ), '3.8-dev', '>=' ) ) {
  8. $icon_url = '';
  9. }
  10. add_object_page( __( 'Contact Form 7', 'contact-form-7' ),
  11. __( 'Contact', 'contact-form-7' ),
  12. 'wpcf7_read_contact_forms', 'wpcf7',
  13. 'wpcf7_admin_management_page', $icon_url );
  14. $edit = add_submenu_page( 'wpcf7',
  15. __( 'Edit Contact Form', 'contact-form-7' ),
  16. __( 'Contact Forms', 'contact-form-7' ),
  17. 'wpcf7_read_contact_forms', 'wpcf7',
  18. 'wpcf7_admin_management_page' );
  19. add_action( 'load-' . $edit, 'wpcf7_load_contact_form_admin' );
  20. $addnew = add_submenu_page( 'wpcf7',
  21. __( 'Add New Contact Form', 'contact-form-7' ),
  22. __( 'Add New', 'contact-form-7' ),
  23. 'wpcf7_edit_contact_forms', 'wpcf7-new',
  24. 'wpcf7_admin_add_new_page' );
  25. add_action( 'load-' . $addnew, 'wpcf7_load_contact_form_admin' );
  26. }
  27. add_filter( 'set-screen-option', 'wpcf7_set_screen_options', 10, 3 );
  28. function wpcf7_set_screen_options( $result, $option, $value ) {
  29. $wpcf7_screens = array(
  30. 'cfseven_contact_forms_per_page' );
  31. if ( in_array( $option, $wpcf7_screens ) )
  32. $result = $value;
  33. return $result;
  34. }
  35. function wpcf7_load_contact_form_admin() {
  36. global $plugin_page;
  37. $action = wpcf7_current_action();
  38. if ( 'save' == $action ) {
  39. $id = $_POST['post_ID'];
  40. check_admin_referer( 'wpcf7-save-contact-form_' . $id );
  41. if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) )
  42. wp_die( __( 'You are not allowed to edit this item.', 'contact-form-7' ) );
  43. if ( ! $contact_form = wpcf7_contact_form( $id ) ) {
  44. $contact_form = new WPCF7_ContactForm();
  45. $contact_form->initial = true;
  46. }
  47. $contact_form->title = trim( $_POST['wpcf7-title'] );
  48. $contact_form->locale = trim( $_POST['wpcf7-locale'] );
  49. $form = trim( $_POST['wpcf7-form'] );
  50. $mail = array(
  51. 'subject' => trim( $_POST['wpcf7-mail-subject'] ),
  52. 'sender' => trim( $_POST['wpcf7-mail-sender'] ),
  53. 'body' => trim( $_POST['wpcf7-mail-body'] ),
  54. 'recipient' => trim( $_POST['wpcf7-mail-recipient'] ),
  55. 'additional_headers' => trim( $_POST['wpcf7-mail-additional-headers'] ),
  56. 'attachments' => trim( $_POST['wpcf7-mail-attachments'] ),
  57. 'use_html' =>
  58. isset( $_POST['wpcf7-mail-use-html'] ) && 1 == $_POST['wpcf7-mail-use-html']
  59. );
  60. $mail_2 = array(
  61. 'active' =>
  62. isset( $_POST['wpcf7-mail-2-active'] ) && 1 == $_POST['wpcf7-mail-2-active'],
  63. 'subject' => trim( $_POST['wpcf7-mail-2-subject'] ),
  64. 'sender' => trim( $_POST['wpcf7-mail-2-sender'] ),
  65. 'body' => trim( $_POST['wpcf7-mail-2-body'] ),
  66. 'recipient' => trim( $_POST['wpcf7-mail-2-recipient'] ),
  67. 'additional_headers' => trim( $_POST['wpcf7-mail-2-additional-headers'] ),
  68. 'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ),
  69. 'use_html' =>
  70. isset( $_POST['wpcf7-mail-2-use-html'] ) && 1 == $_POST['wpcf7-mail-2-use-html']
  71. );
  72. $messages = isset( $contact_form->messages ) ? $contact_form->messages : array();
  73. foreach ( wpcf7_messages() as $key => $arr ) {
  74. $field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
  75. if ( isset( $_POST[$field_name] ) )
  76. $messages[$key] = trim( $_POST[$field_name] );
  77. }
  78. $additional_settings = trim( $_POST['wpcf7-additional-settings'] );
  79. $props = apply_filters( 'wpcf7_contact_form_admin_posted_properties',
  80. compact( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ) );
  81. foreach ( (array) $props as $key => $prop )
  82. $contact_form->{$key} = $prop;
  83. $query = array();
  84. $query['message'] = ( $contact_form->initial ) ? 'created' : 'saved';
  85. $contact_form->save();
  86. $query['post'] = $contact_form->id;
  87. $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
  88. wp_safe_redirect( $redirect_to );
  89. exit();
  90. }
  91. if ( 'copy' == $action ) {
  92. $id = empty( $_POST['post_ID'] )
  93. ? absint( $_REQUEST['post'] )
  94. : absint( $_POST['post_ID'] );
  95. check_admin_referer( 'wpcf7-copy-contact-form_' . $id );
  96. if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) )
  97. wp_die( __( 'You are not allowed to edit this item.', 'contact-form-7' ) );
  98. $query = array();
  99. if ( $contact_form = wpcf7_contact_form( $id ) ) {
  100. $new_contact_form = $contact_form->copy();
  101. $new_contact_form->save();
  102. $query['post'] = $new_contact_form->id;
  103. $query['message'] = 'created';
  104. }
  105. $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
  106. wp_safe_redirect( $redirect_to );
  107. exit();
  108. }
  109. if ( 'delete' == $action ) {
  110. if ( ! empty( $_POST['post_ID'] ) )
  111. check_admin_referer( 'wpcf7-delete-contact-form_' . $_POST['post_ID'] );
  112. elseif ( ! is_array( $_REQUEST['post'] ) )
  113. check_admin_referer( 'wpcf7-delete-contact-form_' . $_REQUEST['post'] );
  114. else
  115. check_admin_referer( 'bulk-posts' );
  116. $posts = empty( $_POST['post_ID'] )
  117. ? (array) $_REQUEST['post']
  118. : (array) $_POST['post_ID'];
  119. $deleted = 0;
  120. foreach ( $posts as $post ) {
  121. $post = new WPCF7_ContactForm( $post );
  122. if ( empty( $post ) )
  123. continue;
  124. if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id ) )
  125. wp_die( __( 'You are not allowed to delete this item.', 'contact-form-7' ) );
  126. if ( ! $post->delete() )
  127. wp_die( __( 'Error in deleting.', 'contact-form-7' ) );
  128. $deleted += 1;
  129. }
  130. $query = array();
  131. if ( ! empty( $deleted ) )
  132. $query['message'] = 'deleted';
  133. $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
  134. wp_safe_redirect( $redirect_to );
  135. exit();
  136. }
  137. $_GET['post'] = isset( $_GET['post'] ) ? $_GET['post'] : '';
  138. $post = null;
  139. if ( 'wpcf7-new' == $plugin_page && isset( $_GET['locale'] ) ) {
  140. $post = wpcf7_get_contact_form_default_pack( array(
  141. 'locale' => $_GET['locale'] ) );
  142. } elseif ( ! empty( $_GET['post'] ) ) {
  143. $post = wpcf7_contact_form( $_GET['post'] );
  144. }
  145. if ( $post && current_user_can( 'wpcf7_edit_contact_form', $post->id ) ) {
  146. wpcf7_add_meta_boxes( $post->id );
  147. } else {
  148. $current_screen = get_current_screen();
  149. if ( ! class_exists( 'WPCF7_Contact_Form_List_Table' ) )
  150. require_once WPCF7_PLUGIN_DIR . '/admin/includes/class-contact-forms-list-table.php';
  151. add_filter( 'manage_' . $current_screen->id . '_columns',
  152. array( 'WPCF7_Contact_Form_List_Table', 'define_columns' ) );
  153. add_screen_option( 'per_page', array(
  154. 'label' => __( 'Contact Forms', 'contact-form-7' ),
  155. 'default' => 20,
  156. 'option' => 'cfseven_contact_forms_per_page' ) );
  157. }
  158. if ( $post ) {
  159. WPCF7_ContactForm::set_current( $post );
  160. }
  161. }
  162. add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts' );
  163. function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
  164. if ( false === strpos( $hook_suffix, 'wpcf7' ) )
  165. return;
  166. wp_enqueue_style( 'contact-form-7-admin',
  167. wpcf7_plugin_url( 'admin/css/styles.css' ),
  168. array(), WPCF7_VERSION, 'all' );
  169. if ( wpcf7_is_rtl() ) {
  170. wp_enqueue_style( 'contact-form-7-admin-rtl',
  171. wpcf7_plugin_url( 'admin/css/styles-rtl.css' ),
  172. array(), WPCF7_VERSION, 'all' );
  173. }
  174. wp_enqueue_script( 'wpcf7-admin-taggenerator',
  175. wpcf7_plugin_url( 'admin/js/taggenerator.js' ),
  176. array( 'jquery' ), WPCF7_VERSION, true );
  177. wp_enqueue_script( 'wpcf7-admin',
  178. wpcf7_plugin_url( 'admin/js/scripts.js' ),
  179. array( 'jquery', 'postbox', 'wpcf7-admin-taggenerator' ),
  180. WPCF7_VERSION, true );
  181. $current_screen = get_current_screen();
  182. wp_localize_script( 'wpcf7-admin', '_wpcf7', array(
  183. 'screenId' => $current_screen->id,
  184. 'generateTag' => __( 'Generate Tag', 'contact-form-7' ),
  185. 'pluginUrl' => wpcf7_plugin_url(),
  186. 'tagGenerators' => wpcf7_tag_generators() ) );
  187. }
  188. function wpcf7_admin_management_page() {
  189. if ( $post = wpcf7_get_current_contact_form() ) {
  190. $post_id = $post->initial ? -1 : $post->id;
  191. require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
  192. require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
  193. return;
  194. }
  195. $list_table = new WPCF7_Contact_Form_List_Table();
  196. $list_table->prepare_items();
  197. ?>
  198. <div class="wrap">
  199. <?php screen_icon(); ?>
  200. <h2><?php
  201. echo esc_html( __( 'Contact Forms', 'contact-form-7' ) );
  202. echo ' <a href="' . esc_url( menu_page_url( 'wpcf7-new', false ) ) . '" class="add-new-h2">' . esc_html( __( 'Add New', 'contact-form-7' ) ) . '</a>';
  203. if ( ! empty( $_REQUEST['s'] ) ) {
  204. echo sprintf( '<span class="subtitle">'
  205. . __( 'Search results for &#8220;%s&#8221;', 'contact-form-7' )
  206. . '</span>', esc_html( $_REQUEST['s'] ) );
  207. }
  208. ?></h2>
  209. <?php do_action( 'wpcf7_admin_notices' ); ?>
  210. <form method="get" action="">
  211. <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
  212. <?php $list_table->search_box( __( 'Search Contact Forms', 'contact-form-7' ), 'wpcf7-contact' ); ?>
  213. <?php $list_table->display(); ?>
  214. </form>
  215. </div>
  216. <?php
  217. }
  218. function wpcf7_admin_add_new_page() {
  219. if ( $post = wpcf7_get_current_contact_form() ) {
  220. $post_id = -1;
  221. require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
  222. require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
  223. return;
  224. }
  225. $available_locales = wpcf7_l10n();
  226. $default_locale = get_locale();
  227. if ( ! isset( $available_locales[$default_locale] ) ) {
  228. $default_locale = 'en_US';
  229. }
  230. ?>
  231. <div class="wrap">
  232. <?php screen_icon(); ?>
  233. <h2><?php echo esc_html( __( 'Add New Contact Form', 'contact-form-7' ) ); ?></h2>
  234. <?php do_action( 'wpcf7_admin_notices' ); ?>
  235. <h3><?php echo esc_html( sprintf( __( 'Use the default language (%s)', 'contact-form-7' ), $available_locales[$default_locale] ) ); ?></h3>
  236. <p><a href="<?php echo esc_url( add_query_arg( array( 'locale' => $default_locale ), menu_page_url( 'wpcf7-new', false ) ) ); ?>" class="button button-primary" /><?php echo esc_html( __( 'Add New', 'contact-form-7' ) ); ?></a></p>
  237. <?php unset( $available_locales[$default_locale] ); ?>
  238. <h3><?php echo esc_html( __( 'Or', 'contact-form-7' ) ); ?></h3>
  239. <form action="" method="get">
  240. <input type="hidden" name="page" value="wpcf7-new" />
  241. <select name="locale">
  242. <option value="" selected="selected"><?php echo esc_html( __( '(select language)', 'contact-form-7' ) ); ?></option>
  243. <?php foreach ( $available_locales as $code => $locale ) : ?>
  244. <option value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $locale ); ?></option>
  245. <?php endforeach; ?>
  246. </select>
  247. <input type="submit" class="button" value="<?php echo esc_attr( __( 'Add New', 'contact-form-7' ) ); ?>" />
  248. </form>
  249. </div>
  250. <?php
  251. }
  252. function wpcf7_add_meta_boxes( $post_id ) {
  253. add_meta_box( 'formdiv', __( 'Form', 'contact-form-7' ),
  254. 'wpcf7_form_meta_box', null, 'form', 'core' );
  255. add_meta_box( 'maildiv', __( 'Mail', 'contact-form-7' ),
  256. 'wpcf7_mail_meta_box', null, 'mail', 'core' );
  257. add_meta_box( 'mail2div', __( 'Mail (2)', 'contact-form-7' ),
  258. 'wpcf7_mail_meta_box', null, 'mail_2', 'core',
  259. array(
  260. 'id' => 'wpcf7-mail-2',
  261. 'name' => 'mail_2',
  262. 'use' => __( 'Use mail (2)', 'contact-form-7' ) ) );
  263. add_meta_box( 'messagesdiv', __( 'Messages', 'contact-form-7' ),
  264. 'wpcf7_messages_meta_box', null, 'messages', 'core' );
  265. add_meta_box( 'additionalsettingsdiv', __( 'Additional Settings', 'contact-form-7' ),
  266. 'wpcf7_additional_settings_meta_box', null, 'additional_settings', 'core' );
  267. do_action( 'wpcf7_add_meta_boxes', $post_id );
  268. }
  269. /* Misc */
  270. add_action( 'wpcf7_admin_notices', 'wpcf7_admin_updated_message' );
  271. function wpcf7_admin_updated_message() {
  272. if ( empty( $_REQUEST['message'] ) )
  273. return;
  274. if ( 'created' == $_REQUEST['message'] )
  275. $updated_message = esc_html( __( 'Contact form created.', 'contact-form-7' ) );
  276. elseif ( 'saved' == $_REQUEST['message'] )
  277. $updated_message = esc_html( __( 'Contact form saved.', 'contact-form-7' ) );
  278. elseif ( 'deleted' == $_REQUEST['message'] )
  279. $updated_message = esc_html( __( 'Contact form deleted.', 'contact-form-7' ) );
  280. if ( empty( $updated_message ) )
  281. return;
  282. ?>
  283. <div id="message" class="updated"><p><?php echo $updated_message; ?></p></div>
  284. <?php
  285. }
  286. add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 );
  287. function wpcf7_plugin_action_links( $links, $file ) {
  288. if ( $file != WPCF7_PLUGIN_BASENAME )
  289. return $links;
  290. $settings_link = '<a href="' . menu_page_url( 'wpcf7', false ) . '">'
  291. . esc_html( __( 'Settings', 'contact-form-7' ) ) . '</a>';
  292. array_unshift( $links, $settings_link );
  293. return $links;
  294. }
  295. add_action( 'wpcf7_admin_notices', 'wpcf7_cf7com_links', 9 );
  296. function wpcf7_cf7com_links() {
  297. $links = '<div class="cf7com-links">'
  298. . '<a href="' . esc_url_raw( __( 'http://contactform7.com/docs/', 'contact-form-7' ) ) . '" target="_blank">'
  299. . esc_html( __( 'Docs', 'contact-form-7' ) ) . '</a> - '
  300. . '<a href="' . esc_url_raw( __( 'http://contactform7.com/faq/', 'contact-form-7' ) ) . '" target="_blank">'
  301. . esc_html( __( 'FAQ', 'contact-form-7' ) ) . '</a> - '
  302. . '<a href="' . esc_url_raw( __( 'http://contactform7.com/support/', 'contact-form-7' ) ) . '" target="_blank">'
  303. . esc_html( __( 'Support', 'contact-form-7' ) ) . '</a> - '
  304. . '<a href="' . esc_url_raw( __( 'http://contactform7.com/donate/', 'contact-form-7' ) ) . '" target="_blank">'
  305. . esc_html( __( 'Donate', 'contact-form-7' ) ) . '</a>'
  306. . '</div>';
  307. echo apply_filters( 'wpcf7_cf7com_links', $links );
  308. }
  309. add_action( 'admin_notices', 'wpcf7_old_wp_version_error', 9 );
  310. function wpcf7_old_wp_version_error() {
  311. global $plugin_page;
  312. if ( 'wpcf7' != substr( $plugin_page, 0, 5 ) ) {
  313. return;
  314. }
  315. $wp_version = get_bloginfo( 'version' );
  316. if ( ! version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) )
  317. return;
  318. ?>
  319. <div class="error">
  320. <p><?php echo sprintf( __( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ), WPCF7_VERSION, WPCF7_REQUIRED_WP_VERSION, admin_url( 'update-core.php' ) ); ?></p>
  321. </div>
  322. <?php
  323. }
  324. add_action( 'wpcf7_admin_notices', 'wpcf7_welcome_panel', 2 );
  325. function wpcf7_welcome_panel() {
  326. global $plugin_page;
  327. if ( 'wpcf7' != $plugin_page || ! empty( $_GET['post'] ) ) {
  328. return;
  329. }
  330. $classes = 'welcome-panel';
  331. $vers = (array) get_user_meta( get_current_user_id(),
  332. 'wpcf7_hide_welcome_panel_on', true );
  333. if ( wpcf7_version_grep( wpcf7_version( 'only_major=1' ), $vers ) ) {
  334. $classes .= ' hidden';
  335. }
  336. ?>
  337. <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
  338. <?php wp_nonce_field( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
  339. <a class="welcome-panel-close" href="<?php echo esc_url( menu_page_url( 'wpcf7', false ) ); ?>"><?php echo esc_html( __( 'Dismiss', 'contact-form-7' ) ); ?></a>
  340. <div class="welcome-panel-content">
  341. <div class="welcome-panel-column-container">
  342. <div class="welcome-panel-column">
  343. <h4><?php echo esc_html( __( 'Contact Form 7 Needs Your Support', 'contact-form-7' ) ); ?></h4>
  344. <p class="message"><?php echo esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you. If you enjoy using Contact Form 7 and find it useful, please consider making a donation.", 'contact-form-7' ) ); ?></p>
  345. <p><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/donate/', 'contact-form-7' ) ); ?>" class="button button-primary" target="_blank"><?php echo esc_html( __( 'Donate', 'contact-form-7' ) ); ?></a></p>
  346. </div>
  347. <div class="welcome-panel-column">
  348. <h4><?php echo esc_html( __( 'Get Started', 'contact-form-7' ) ); ?></h4>
  349. <ul>
  350. <li><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/getting-started-with-contact-form-7/', 'contact-form-7' ) ); ?>" target="_blank"><?php echo esc_html( __( "Getting Started with Contact Form 7", 'contact-form-7' ) ); ?></a></li>
  351. <li><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/admin-screen/', 'contact-form-7' ) ); ?>" target="_blank"><?php echo esc_html( __( "Admin Screen", 'contact-form-7' ) ); ?></a></li>
  352. <li><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/tag-syntax/', 'contact-form-7' ) ); ?>" target="_blank"><?php echo esc_html( __( "How Tags Work", 'contact-form-7' ) ); ?></a></li>
  353. <li><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/setting-up-mail/', 'contact-form-7' ) ); ?>" target="_blank"><?php echo esc_html( __( "Setting Up Mail", 'contact-form-7' ) ); ?></a></li>
  354. </ul>
  355. </div>
  356. <div class="welcome-panel-column">
  357. <h4><?php echo esc_html( __( 'Did You Know?', 'contact-form-7' ) ); ?></h4>
  358. <ul>
  359. <li><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/spam-filtering-with-akismet/', 'contact-form-7' ) ); ?>" target="_blank"><?php echo esc_html( __( "Spam Filtering with Akismet", 'contact-form-7' ) ); ?></a></li>
  360. <li><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/save-submitted-messages-with-flamingo/', 'contact-form-7' ) ); ?>" target="_blank"><?php echo esc_html( __( "Save Messages with Flamingo", 'contact-form-7' ) ); ?></a></li>
  361. <li><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/selectable-recipient-with-pipes/', 'contact-form-7' ) ); ?>" target="_blank"><?php echo esc_html( __( "Selectable Recipient with Pipes", 'contact-form-7' ) ); ?></a></li>
  362. <li><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/tracking-form-submissions-with-google-analytics/', 'contact-form-7' ) ); ?>" target="_blank"><?php echo esc_html( __( "Tracking with Google Analytics", 'contact-form-7' ) ); ?></a></li>
  363. </ul>
  364. </div>
  365. </div>
  366. </div>
  367. </div>
  368. <?php
  369. }
  370. add_action( 'wp_ajax_wpcf7-update-welcome-panel', 'wpcf7_admin_ajax_welcome_panel' );
  371. function wpcf7_admin_ajax_welcome_panel() {
  372. check_ajax_referer( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce' );
  373. $vers = get_user_meta( get_current_user_id(),
  374. 'wpcf7_hide_welcome_panel_on', true );
  375. if ( empty( $vers ) || ! is_array( $vers ) ) {
  376. $vers = array();
  377. }
  378. if ( empty( $_POST['visible'] ) ) {
  379. $vers[] = WPCF7_VERSION;
  380. }
  381. $vers = array_unique( $vers );
  382. update_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', $vers );
  383. wp_die( 1 );
  384. }
  385. ?>