PluginProbe
Smart Grid-Layout Design for Contact Form 7 / 4.11
Smart Grid-Layout Design for Contact Form 7 v4.11
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.11, at admin/partials/cf7-admin-editor-display.php

125 lines 4.5 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 //do_action( 'wpcf7_admin_menu' ); //is this needed? Fires bulk validation on cf7 update?>
19 <?php
20 if('add' == $screen->action) do_action( 'load-contact_page_wpcf7-new' );
21 else do_action( 'load-toplevel_page_wpcf7' );
22 ?>
23 <div id="cf7sg-editor">
24 <div style="position:relative">
25 <a id="full-screen-cf7" class="button" href="javascript:void(0)"><span><?= __('toggle full screen','cf7-grid-layout')?></span></a>
26 </div>
27 <input type="hidden" id="is-cf7sg-form" name="is_cf7sg_form" value="true" />
28 <input type="hidden" id="wpcf7-locale" name="wpcf7-locale" value="<?php echo esc_attr( $cf7_form->locale() ); ?>" />
29 <input type="hidden" id="active-tab" name="active-tab" value="<?php echo isset( $_GET['active-tab'] ) ? (int) $_GET['active-tab'] : '0'; ?>" />
30 <?php wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id, '_wpcf7nonce' ); ?>
31
32 <div id="contact-form-editor">
33 <div class="loading-screen"><h2><?= __('Loading form editor ...','cf7-grid-layout')?><span class="spinner"></span></h2></div>
34 <div class="keyboard-interaction"><?php echo sprintf( esc_html( __cf7sg( '%s keys switch panels') ), '<span class="dashicons dashicons-leftright"></span>' ); ?></div>
35
36 <?php
37
38 $editor = new WPCF7_Editor( $cf7_form );
39 $panels = array();
40
41 if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) {
42 $panels = array(
43 'form-panel' => array(
44 'title' => __cf7sg( 'Form' ),
45 'callback' => array($this, 'grid_editor_panel') ),
46 'mail-panel' => array(
47 'title' => __cf7sg( 'Mail' ),
48 'callback' => 'wpcf7_editor_panel_mail' ),
49 'messages-panel' => array(
50 'title' => __cf7sg( 'Messages' ),
51 'callback' => 'wpcf7_editor_panel_messages' ) );
52
53 $additional_settings = trim( $cf7_form->prop( 'additional_settings' ) );
54 $additional_settings = explode( "\n", $additional_settings );
55 $additional_settings = array_filter( $additional_settings );
56 $additional_settings = count( $additional_settings );
57
58 $panels['additional-settings-panel'] = array(
59 'title' => $additional_settings
60 ? sprintf(
61 __cf7sg( 'Additional Settings (%d)' ),
62 $additional_settings )
63 : __cf7sg( 'Additional Settings' ),
64 'callback' => 'wpcf7_editor_panel_additional_settings' );
65 }
66 /**
67 * filter to add/remove panels from the cf7 post editor
68 * @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.
69 */
70 $panels = apply_filters( 'wpcf7_editor_panels', $panels );
71
72 foreach ( $panels as $id => $panel ) {
73 $editor->add_panel( $id, $panel['title'], $panel['callback'] );
74 }
75
76 $editor->display();
77 ?>
78 </div><!-- #contact-form-editor -->
79
80 <form action="" class="dummy-form" data-id="dummy">
81 <!-- DUMMY FORM to prevent some wp-core scripts from tempering with cf7 tags forms printed below-->
82 </form>
83 <?php
84
85 $tag_generator = WPCF7_TagGenerator::get_instance();
86
87 $tag_generator->print_panels( $cf7_form );
88
89 do_action( 'wpcf7_admin_footer', $cf7_form );
90
91 $dropdowns = get_option('_cf7sg_dynamic_dropdown_taxonomy',array());
92 $show_dropdown = array();
93 if( isset($dropdowns[$post_id]) ){
94 $show_dropdown = $dropdowns[$post_id];
95 }
96 ?>
97 <script type="text/javascript">
98 (function( $ ) {
99 'use strict';
100 //hide the taxonomy metabox not used on this page.
101 $(document).ready(function() {
102 <?php
103 $slugs = array();
104
105 foreach($dropdowns as $id => $all_lists){
106 //if($id == $post_id) continue;
107 foreach($all_lists as $slug => $taxonomy){
108 if(isset($slugs[$slug])){
109 continue;
110 }
111 if( $taxonomy['hierarchical'] ){
112 $hide_id = $slug.'div';
113 }else{
114 $hide_id = 'tagsdiv-'.$slug;
115 }
116
117 echo '$("#' . $hide_id . '").hide();'.PHP_EOL;
118 }
119 }
120 ?>
121 });
122 })( jQuery );
123 </script>
124 </div>
125