Author URI: https://petermolnar.eu/ License: GPLv3 */ if ( ! class_exists( 'WP_PARSEDOWN' ) ) : /* get the plugin abstract class*/ include_once ( dirname(__FILE__) . '/wp-common/plugin_abstract.php' ); include_once ( dirname(__FILE__) . '/lib/parsedown/Parsedown.php'); include_once ( dirname(__FILE__) . '/lib/parsedown-extra/ParsedownExtra.php'); /** * main wp-ghost class */ class WP_PARSEDOWN extends PluginAbstract { const key_save = 'saved'; const key_delete = 'deleted'; private $parsedown = null; /** * */ public function plugin_post_construct () { $this->plugin_url = plugin_dir_url( __FILE__ ); $this->plugin_dir = plugin_dir_path( __FILE__ ); $this->common_url = $this->plugin_url . self::common_slug; $this->common_dir = $this->plugin_dir . self::common_slug; $this->admin_css_handle = $this->plugin_constant . '-admin-css'; $this->admin_css_url = $this->common_url . 'wp-admin.css'; $this->parsedown = new ParsedownExtra(); } /** * init hook function runs before admin panel hook, themeing and options read */ public function plugin_pre_init() { } /** * additional init, steps that needs the plugin options * */ public function plugin_post_init () { /* display markdown */ add_filter( 'the_content', array(&$this, 'markdown_on_the_fly'), 1 ); } /** * activation hook function, to be extended */ public function plugin_activate() { /* we leave this empty to avoid not detecting WP network correctly */ } /** * deactivation hook function, to be extended */ public function plugin_deactivate () { } /** * uninstall hook function, to be extended */ public function plugin_uninstall( $delete_options = true ) { } /** * extending admin init * */ public function plugin_extend_admin_init () { } /** * admin help panel */ public function plugin_admin_help($contextual_help, $screen_id ) { /* add our page only if the screenid is correct */ if ( strpos( $screen_id, $this->plugin_settings_page ) ) { $contextual_help = __('
Please visit the official support forum of the plugin for help.
', $this->plugin_constant ); } return $contextual_help; } /** * admin panel, the admin page displayed for plugin settings */ public function plugin_admin_panel() { /** * security, if somehow we're running without WordPress security functions */ if( ! function_exists( 'current_user_can' ) || ! current_user_can( 'manage_options' ) ){ die( ); } ?>plugin_constant ) ?>
plugin_constant ) ?>