Пример #1
0
 public function set_editor_state()
 {
     if (!defined('DOING_AJAX') || !DOING_AJAX) {
         return;
     }
     check_admin_referer('MMTL_Editor', MMTL_NONCE_NAME);
     $post_id = !empty($_POST['post_id']) ? $_POST['post_id'] : 0;
     $activate = !empty($_POST['active']);
     MMTL_Editor::get_instance()->set_active_state($activate, $post_id);
     wp_send_json_success();
 }
Пример #2
0
            wp_enqueue_style('glyphicons', plugins_url('css/glyphicons/css/glyphicons.css', MMTL_FILE), null, '1.9.2');
        }
        // Font Awesome
        if (!wp_style_is('font-awesome')) {
            wp_enqueue_style('font-awesome', plugins_url('css/font-awesome/css/font-awesome.min.css', MMTL_FILE), null, '4.5.0');
        }
        // Featherlight
        if (!wp_script_is('featherlight')) {
            wp_enqueue_script('featherlight', plugins_url('js/featherlight/featherlight.min.js', MMTL_FILE), array('jquery'), '1.3.4', true);
        }
        // jQuery UI
        if (!wp_style_is('jquery-ui-structure')) {
            wp_enqueue_style('jquery-ui-structure', plugins_url('css/jquery-ui.structure.min.css', MMTL_FILE), null, '1.11.4');
        }
        wp_enqueue_script('jquery');
        wp_enqueue_script('jquery-ui-sortable');
        wp_enqueue_script('jquery-ui-tabs');
        // Table Layout
        wp_enqueue_style('table-layout');
        wp_enqueue_style('table-layout-editor', plugins_url('css/editor.min.css', MMTL_FILE));
        wp_enqueue_style('table-layout-editor-style', plugins_url('css/editor-style.min.css', MMTL_FILE));
        wp_enqueue_script('table-layout-editor', plugins_url('js/editor/main.js', MMTL_FILE), null, false, true);
        wp_enqueue_script('table-layout-editor-common', plugins_url('js/editor/common.js', MMTL_FILE), null, false, true);
        wp_enqueue_script('table-layout-admin', plugins_url('js/admin.js', MMTL_FILE), null, false, true);
        $options = apply_filters('mmtl_options', array('post_id' => $this->get_post_id(), 'post_editor_id' => MMTL_POST_EDITOR_ID, 'ajaxurl' => admin_url('admin-ajax.php'), 'noncename' => MMTL_NONCE_NAME, 'nonce' => wp_create_nonce('MMTL_Editor'), 'confirm_delete' => __('Are you sure you want to delete this component?', 'table-layout'), 'control_label_add' => __('Add', 'table-layout'), 'control_label_edit' => __('Edit', 'table-layout'), 'control_label_copy' => __('Copy', 'table-layout'), 'control_label_delete' => __('Delete', 'table-layout'), 'control_label_toggle' => __('Toggle', 'table-layout'), 'meta_title_id' => __('ID', 'table-layout'), 'meta_title_class' => __('Class', 'table-layout'), 'meta_title_bg_image' => __('Background image', 'table-layout'), 'meta_title_push' => __('Push', 'table-layout'), 'meta_title_pull' => __('Pull', 'table-layout')));
        wp_localize_script('table-layout-admin', 'MMTL_Options', $options);
        remove_editor_styles();
    }
}
MMTL_Editor::get_instance()->init();