public static function init() { if (!class_exists('Mustache_Autoloader')) { require dirname(__FILE__) . '/Mustache/Autoloader.php'; } Mustache_Autoloader::register(); self::$dir = dirname(__FILE__) . '/Admin/templates'; $m_opts = array('extension' => 'html'); self::$engine = new Mustache_Engine(array('loader' => new Mustache_Loader_FilesystemLoader(self::$dir, $m_opts), 'partials_loader' => new Mustache_Loader_FilesystemLoader(self::$dir, $m_opts), 'helpers' => array('format_date' => array(__CLASS__, 'helper_format_date'), 'edit_link' => array(__CLASS__, 'helper_edit_link'), 'permalink' => array(__CLASS__, 'helper_permalink')))); }
public function render_parent_meta_box($post) { $kids = get_children(array('post_parent' => $post->ID, 'post_status' => $this->drafter->get_status_val())); // turn kids into a basic array and replace author id with author nicename $kids = array_values($kids); $kids = array_map(create_function('$kid', '$kid->post_author = get_the_author_meta(\'user_nicename\', $kid->post_author);return $kid;'), $kids); echo DPR_Mustachio::render('meta_box/_parent', array('kids' => $kids)); }