add_action('init', 'CrayonWP::allowed_tags', 11); if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) { /* XXX This is called first to match Crayons, then higher priority replaces after other filters. Prevents Crayon from being formatted by the filters, and also keeps original comment formatting. */ add_filter('comment_text', 'CrayonWP::pre_comment_text', 1); add_filter('comment_text', 'CrayonWP::comment_text', 100); } // This ensures Crayons are not formatted by WP filters. Other plugins should specify priorities between 1 and 100. add_filter('get_the_excerpt', 'CrayonWP::pre_excerpt', 1); add_filter('get_the_excerpt', 'CrayonWP::post_get_excerpt', 100); add_filter('the_excerpt', 'CrayonWP::post_excerpt', 100); add_action('template_redirect', 'CrayonWP::wp_head', 0); if (CrayonGlobalSettings::val(CrayonSettings::TAG_EDITOR_FRONT)) { add_filter('comment_form_defaults', 'CrayonWP::tinymce_comment_enable'); } } else { // Update between versions CrayonWP::update(); // For marking a post as containing a Crayon add_action('update_post', 'CrayonWP::save_post', 10, 2); add_action('save_post', 'CrayonWP::save_post', 10, 2); add_filter('wp_insert_post_data', 'CrayonWP::filter_post_data', '99', 2); } register_activation_hook(__FILE__, 'CrayonWP::install'); register_deactivation_hook(__FILE__, 'CrayonWP::uninstall'); if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) { add_action('comment_post', 'CrayonWP::save_comment', 10, 2); add_action('edit_comment', 'CrayonWP::save_comment', 10, 2); } add_filter('init', 'CrayonWP::init_ajax'); }
public static function admin_init() { // Load default settings if they don't exist self::load_settings(); // Update db CrayonWP::update(); // General // Some of these will the $editor arguments, if TRUE it will alter for use in the Tag Editor self::add_section(self::GENERAL, crayon__('General')); self::add_field(self::GENERAL, crayon__('Theme'), 'theme'); self::add_field(self::GENERAL, crayon__('Font'), 'font'); self::add_field(self::GENERAL, crayon__('Metrics'), 'metrics'); self::add_field(self::GENERAL, crayon__('Toolbar'), 'toolbar'); self::add_field(self::GENERAL, crayon__('Lines'), 'lines'); self::add_field(self::GENERAL, crayon__('Code'), 'code'); self::add_field(self::GENERAL, crayon__('Tags'), 'tags'); self::add_field(self::GENERAL, crayon__('Languages'), 'langs'); self::add_field(self::GENERAL, crayon__('Files'), 'files'); self::add_field(self::GENERAL, crayon__('Tag Editor'), 'tag_editor'); self::add_field(self::GENERAL, crayon__('Misc'), 'misc'); // Debug self::add_section(self::DEBUG, crayon__('Debug')); self::add_field(self::DEBUG, crayon__('Errors'), 'errors'); self::add_field(self::DEBUG, crayon__('Log'), 'log'); // ABOUT self::add_section(self::ABOUT, crayon__('About')); $image = '<div id="crayon-logo"> <img src="' . plugins_url(CRAYON_LOGO, __FILE__) . '" /><br/></div>'; self::add_field(self::ABOUT, $image, 'info'); }