/** * Initialize the plugin by setting localization and loading public scripts * and styles. * * @since 1.0 */ protected function __construct() { $this->register_hook_callbacks(); $this->modules = array('WPMOLY_Settings' => WPMOLY_Settings::get_instance(), 'WPMOLY_Cache' => WPMOLY_Cache::get_instance(), 'WPMOLY_L10n' => WPMOLY_L10n::get_instance(), 'WPMOLY_Utils' => WPMOLY_Utils::get_instance(), 'WPMOLY_Movies' => WPMOLY_Movies::get_instance(), 'WPMOLY_Headbox' => WPMOLY_Headbox::get_instance(), 'WPMOLY_Search' => WPMOLY_Search::get_instance(), 'WPMOLY_Collections' => WPMOLY_Collections::get_instance(), 'WPMOLY_Genres' => WPMOLY_Genres::get_instance(), 'WPMOLY_Actors' => WPMOLY_Actors::get_instance(), 'WPMOLY_Archives' => WPMOLY_Archives::get_instance(), 'WPMOLY_Shortcodes' => WPMOLY_Shortcodes::get_instance(), 'WPMOLY_Legacy' => WPMOLY_Legacy::get_instance()); $this->widgets = array('WPMOLY_Statistics_Widget', 'WPMOLY_Taxonomies_Widget', 'WPMOLY_Details_Widget', 'WPMOLY_Movies_Widget'); }
/** * Movie Detail shortcode. This shortcode supports aliases. * * @since 1.1 * * @param array Shortcode attributes * @param string Shortcode content * @param string Shortcode tag name * * @return string Shortcode display */ public static function movie_detail_shortcode($atts = array(), $content = null, $tag = null) { // Is this an alias? if (!is_null($tag) && "{$tag}_shortcode" != __FUNCTION__) { $atts['key'] = str_replace('movie_', '', $tag); } $atts = self::filter_shortcode_atts('movie_detail', $atts); $movie_id = WPMOLY_Shortcodes::find_movie_id($atts['id'], $atts['title']); if (is_null($movie_id)) { return $content; } $atts['movie_id'] = $movie_id; // Caching $name = apply_filters('wpmoly_cache_name', 'movie_detail_shortcode', $atts); $content = WPMOLY_Cache::output($name, function () use($atts, $content) { extract($atts); if (!function_exists("wpmoly_get_movie_{$key}")) { return $content; } $content = call_user_func("wpmoly_get_movie_{$key}", $movie_id); $format = !$raw ? 'html' : 'raw'; $content = apply_filters("wpmoly_format_movie_{$key}", $content, $format); return $content; }, $echo = false); return $content; }