public function actionLicense($path) { $module = zotop::model('zotop.module'); $modules = $module->getUnInstalled(); if (empty($path) || !dir::exists($path)) { msg::error(array('content' => zotop::t('模块不存在,请确认是否已经上传该模块?'), 'description' => zotop::t("路径:{$path}"))); } $licenseFile = $path . DS . 'license.txt'; if (!file::exists($licenseFile)) { zotop::redirect('zotop/module/install', array('path' => url::encode($path))); exit; } $license = file::read($licenseFile); $page = new dialog(); $page->set('title', '许可协议'); $page->set('license', html::decode($license)); $page->set('next', zotop::url('zotop/module/install', array('path' => url::encode($path)))); $page->display(); }
public function licenseAction($id) { $module = zotop::model('zotop.module'); $modules = $module->getUnInstalled(); if (empty($id) || !isset($modules[$id])) { msg::error(zotop::t('ID为<b>{$id}</b>的模块不存在,请确认是否已经上传该模块?')); } $licenseFile = $modules[$id]['path'] . DS . 'license.txt'; if (!file::exists($licenseFile)) { zotop::redirect('zotop/module/install', array('id' => $id)); exit; } $license = file::read($licenseFile); $page = new dialog(); $page->set('title', '许可协议'); $page->set('license', html::decode($license)); $page->set('next', zotop::url('zotop/module/install', array('id' => $id))); $page->display(); }
/** * Removes all xml entities from a string * and convert them to html entities first * and remove all html entities afterwards. * * <code> * * echo xml::decode('some <em>über</em> crazy stuff'); * // output: some über crazy stuff * * </code> * * @param string $string * @return string */ public static function decode($string) { // convert xml entities to html entities $string = strtr($string, static::entities()); return html::decode($string); }
/** * Removes all html tags and encoded chars from a string * * <code> * * echo str::unhtml('some <em>crazy</em> stuff'); * // output: some uber crazy stuff * * </code> * * @param string $string * @return string The html string */ public static function unhtml($string) { return html::decode($string); }