PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 4.10
Smart Grid-Layout Design for Contact Form 7 v4.10
4.18.0 4.17.0 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 4.0.0 4.0.1 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.10 4.11 4.12 4.13 4.14 All 119 releases
cf7-grid-layout / admin / partials / cf7-admin-editor-display.php

cf7-admin-editor-display.php in Smart Grid-Layout Design for Contact Form 7 4.10, at admin/partials/cf7-admin-editor-display.php

124 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Provide a admin area view for the plugin to edit contact form 7 through the visual editor
5 *
6 * This file is used to markup the admin-facing aspects of the plugin.
7 *
8 * @link http://syllogic.in
9 * @since 1.0.0
10 *
11 * @package Cf7_Grid_Layout
12 * @subpackage Cf7_Grid_Layout/admin/partials
13 */
14 $screen = get_current_screen();
15 ?>
16 <?php do_action( 'wpcf7_admin_warnings', 'wpcf7', wpcf7_current_action(), null ); ?>
17 <?php do_action( 'wpcf7_admin_notices' , 'wpcf7', wpcf7_current_action(), null ); ?>
18 <?php
19 if('add' == $screen->action) do_action( 'load-contact_page_wpcf7-new' );
20 else do_action( 'load-toplevel_page_wpcf7' );
21 ?>
22 <div id="cf7sg-editor">
23 <div style="position:relative">
24 <a id="full-screen-cf7" class="button" href="javascript:void(0)"><span><?= __('toggle full screen','cf7-grid-layout')?></span></a>
25 </div>
26 <input type="hidden" id="is-cf7sg-form" name="is_cf7sg_form" value="true" />
27 <input type="hidden" id="wpcf7-locale" name="wpcf7-locale" value="<?php echo esc_attr( $cf7_form->locale() ); ?>" />
28 <input type="hidden" id="active-tab" name="active-tab" value="<?php echo isset( $_GET['active-tab'] ) ? (int) $_GET['active-tab'] : '0'; ?>" />
29 <?php wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id, '_wpcf7nonce' ); ?>
30
31 <div id="contact-form-editor">
32 <div class="loading-screen"><h2><?= __('Loading form editor ...','cf7-grid-layout')?><span class="spinner"></span></h2></div>
33 <div class="keyboard-interaction"><?php echo sprintf( esc_html( __cf7sg( '%s keys switch panels') ), '<span class="dashicons dashicons-leftright"></span>' ); ?></div>
34
35 <?php
36
37 $editor = new WPCF7_Editor( $cf7_form );
38 $panels = array();
39
40 if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
41 $panels = array(
42 'form-panel' => array(
43 'title' => __cf7sg( 'Form' ),
44 'callback' => array($this, 'grid_editor_panel') ),
45 'mail-panel' => array(
46 'title' => __cf7sg( 'Mail' ),
47 'callback' => 'wpcf7_editor_panel_mail' ),
48 'messages-panel' => array(
49 'title' => __cf7sg( 'Messages' ),
50 'callback' => 'wpcf7_editor_panel_messages' ) );
51
52 $additional_settings = trim( $cf7_form->prop( 'additional_settings' ) );
53 $additional_settings = explode( "\n", $additional_settings );
54 $additional_settings = array_filter( $additional_settings );
55 $additional_settings = count( $additional_settings );
56
57 $panels['additional-settings-panel'] = array(
58 'title' => $additional_settings
59 ? sprintf(
60 __cf7sg( 'Additional Settings (%d)' ),
61 $additional_settings )
62 : __cf7sg( 'Additional Settings' ),
63 'callback' => 'wpcf7_editor_panel_additional_settings' );
64 }
65 /**
66 * filter to add/remove panels from the cf7 post editor
67 * @param Array $panel array of panels presented as tabs in the editor, $id => array( 'title' => $panel_title, 'callback' => $callback_function). The $callback_function must be a valid function to echo the panel html script.
68 */
69 $panels = apply_filters( 'wpcf7_editor_panels', $panels );
70
71 foreach ( $panels as $id => $panel ) {
72 $editor->add_panel( $id, $panel['title'], $panel['callback'] );
73 }
74
75 $editor->display();
76 ?>
77 </div><!-- #contact-form-editor -->
78
79 <form action="" class="dummy-form" data-id="dummy">
80 <!-- DUMMY FORM to prevent some wp-core scripts from tempering with cf7 tags forms printed below-->
81 </form>
82 <?php
83
84 $tag_generator = WPCF7_TagGenerator::get_instance();
85
86 $tag_generator->print_panels( $cf7_form );
87
88 do_action( 'wpcf7_admin_footer', $cf7_form );
89
90 $dropdowns = get_option('_cf7sg_dynamic_dropdown_taxonomy',array());
91 $show_dropdown = array();
92 if( isset($dropdowns[$post_id]) ){
93 $show_dropdown = $dropdowns[$post_id];
94 }
95 ?>
96 <script type="text/javascript">
97 (function( $ ) {
98 'use strict';
99 //hide the taxonomy metabox not used on this page.
100 $(document).ready(function() {
101 <?php
102 $slugs = array();
103
104 foreach($dropdowns as $id => $all_lists){
105 //if($id == $post_id) continue;
106 foreach($all_lists as $slug => $taxonomy){
107 if(isset($slugs[$slug])){
108 continue;
109 }
110 if( $taxonomy['hierarchical'] ){
111 $hide_id = $slug.'div';
112 }else{
113 $hide_id = 'tagsdiv-'.$slug;
114 }
115
116 echo '$("#' . $hide_id . '").hide();'.PHP_EOL;
117 }
118 }
119 ?>
120 });
121 })( jQuery );
122 </script>
123 </div>
124