paths = array(); $this->paths[] = ARLIMA_PLUGIN_PATH.DIRECTORY_SEPARATOR.'templates'.DIRECTORY_SEPARATOR; $this->paths = apply_filters('arlima_template_paths', $this->paths); } /** * Returns all registered template paths * @return array */ public function getPaths() { return $this->paths; } /** * Returns all files having the extension .tmpl located in registered template paths * @return array */ public function getTemplateFiles() { $tmpls = array(); foreach($this->getPaths() as $path) { $tmpls[$path] = glob($path.DIRECTORY_SEPARATOR.'*.tmpl'); } return $tmpls; } /** * Takes a file path to somewhere inside wp-content and turns it into an url. * @param string $tmpl_file * @return string */ public function fileToUrl($tmpl_file) { $content_dir = sprintf('%swp-content%s', DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR); $tmpl_url = WP_CONTENT_URL .'/'. current( array_splice(explode($content_dir, $tmpl_file), 1,1) ); if(DIRECTORY_SEPARATOR != '/') { $tmpl_url = str_replace(DIRECTORY_SEPARATOR, '/', $tmpl_url); } return $tmpl_url; } }