public function load($template) { if (is_object($template)) { return $template; } else { if (file_exists($template)) { $form = new Digitalus_Content_Form(); $view = $form->getView(); $templateName = basename($template); $layoutPath = Digitalus_Toolbox_String::getParentFromPath($template); $view->addScriptPath($layoutPath); $fileContents = $view->render($templateName); $cleanFile = preg_replace('/(<\\?{1}[pP\\s]{1}.+\\?>)/', '', $fileContents); return simplexml_load_string($cleanFile); } else { return simplexml_load_string($template); } } }
/** * this function renames a folder * * @param string $path - the full path * @param string $newName - the new name */ public static function renameFolder($path, $newName) { $path = self::getMediaPath($path); //get the new name $parent = Digitalus_Toolbox_String::getParentFromPath($path); $newpath = $parent . '/' . $newName; if (Digitalus_Filesystem_Dir::rename($path, $newpath)) { return $newpath; } return false; }
/** * Rename Folder Action * * @return void */ public function renameFolderAction() { $filepath = Digitalus_Filter_Post::get('filepath'); $folderName = Digitalus_Filter_Post::get('folder_name'); Digitalus_Media::renameFolder($filepath, $folderName); $folder = Digitalus_Toolbox_String::addUnderscores(Digitalus_Toolbox_String::getParentFromPath($filepath) . '/' . $folderName); $this->_request->setParam('folder', $folder); $this->_forward('open-folder'); }