/** * Load template data * * Loops through each body class for the current template, checks for a method of * the same name as the class, and calls that method if it exists * * @return void */ public function load() { /** * Global variable to store template data. * * Place the following at the top of your template file as an alternative to calling * `tpl_data()` or `get_tpl_data()` functions for each individual data key * `global $template_data;` * `extract( $template_data, EXTR_SKIP );` * * @global array template_data */ global $template_data; // Add `common` to class array so that it loads for every template self::$classes = get_body_class('common'); foreach (self::$classes as $class) { $class = str_replace('-', '_', $class); if (method_exists($this, $class)) { call_user_func(array($this, $class)); } } // Push template data out to global variable $template_data = array_merge(self::$data, self::$data_replace); }