public function __construct($directory_path, $web_path)
 {
     if (!$directory_path) {
         throw new InvalidArgumentException(_e('Please specify the directory path'));
     }
     if (!$web_path) {
         throw new InvalidArgumentException(_e('Please specify the web path'));
     }
     self::$directory_path = $directory_path;
     self::$web_path = $web_path;
     $this->load_class_dependencies();
     add_action('init', array(__CLASS__, 'check_post'));
     add_action('wp_ajax_' . self::AJAXHOOK, array(__CLASS__, 'check_ajax'));
     add_shortcode(PhpCodeForPosts_Shortcode::get_shortcode(), array('PhpCodeForPosts_Shortcode', 'handle_shortcode'));
     if (is_multisite()) {
         add_shortcode(PhpCodeForPosts_Shortcode::get_multisite_shortcode(), array('PhpCodeForPosts_Shortcode', 'handle_multisite_shortcode'));
     }
     add_filter('widget_text', 'do_shortcode', 5, 1);
     if (PhpCodeForPosts::$options->get_option('content_filter')) {
         add_filter('the_content', array('PhpCodeForPosts_Shortcode', 'handle_extra_shortcode'), 0, 1);
     }
     if (PhpCodeForPosts::$options->get_option('content_filter')) {
         add_filter('widget_text', array('PhpCodeForPosts_Shortcode', 'handle_extra_shortcode'), 0, 1);
     }
 }
Пример #2
0
 public function get_multisite_display_shortcode()
 {
     return sprintf('[%s snippet=%s]', PhpCodeForPosts_Shortcode::get_multisite_shortcode(), $this->get_id());
 }