Ejemplo n.º 1
0
<?php

/*
Plugin Name: Rotor Markdown Editor
Author: Ryan McCue
Author URI: http://ryanmccue.info/
Description: Replaces your content editor with a Markdown editor with live previewing!
License: GPL
Version: 0.2-dev
*/
require_once dirname(__FILE__) . '/saver.php';
Rotor_MarkdownEditor::bootstrap();
class Rotor_MarkdownEditor
{
    public static function bootstrap()
    {
        // add_filter('screen_layout_columns', array(__CLASS__, 'force_columns'));
        add_filter('add_meta_boxes', array(__CLASS__, 'maybe_switch_editor'), 10, 2);
        add_filter('wp_insert_post_data', array(__CLASS__, 'generate_post_content'), 10, 2);
        add_filter('save_post', array(__CLASS__, 'save_post'), 10, 2);
        $saver = new Rotor_MarkdownEditor_Saver();
    }
    /**
     * Disable TinyMCE if the current post is Markdown
     *
     * @wp-action add_meta_boxes
     * @param string $post_type
     * @param WP_Post $post
     */
    public static function maybe_switch_editor($post_type, $post)
    {
Ejemplo n.º 2
0
 private function is_markdown($id)
 {
     return Rotor_MarkdownEditor::post_is_markdown($id);
 }