本文整理汇总了PHP中tools::sanitizeTechString方法的典型用法代码示例。如果您正苦于以下问题:PHP tools::sanitizeTechString方法的具体用法?PHP tools::sanitizeTechString怎么用?PHP tools::sanitizeTechString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools
的用法示例。
在下文中一共展示了tools::sanitizeTechString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setName
/**
* Set theme name
* @param string $name
*/
public function setName($name)
{
if (!empty($name)) {
$this->name = \tools::sanitizeTechString($name);
} else {
throw new \Exception(t('Name can\'t be empty', FALSE));
}
}
示例2: setId
/**
* Set Block ID
* @param string $id
* @return block object
*/
public function setId($id)
{
$id = \tools::sanitizeTechString($id);
if (!empty($id)) {
$this->id = $id;
} else {
throw new \Exception(t('ID can\'t be empty', FALSE));
}
return $this;
}
示例3: addThemeAction
/**
* Add a theme to the site
* @param string $thememodule
* @param string $name
* @param string $template
* @param string $patterntype
* @param string $url
* @return false
*/
protected function addThemeAction($thememodule, $name, $patterntype, $template, $url = '')
{
$name = \tools::sanitizeTechString($name);
if (!is_dir(PROFILE_PATH . $thememodule . '/themes/' . $name)) {
\tools::createDirectory(PROFILE_PATH . $thememodule . '/themes/' . $name, 0777);
if ($patterntype === 'template' && !empty($template)) {
list($oldModule, $oldName) = explode(';', $template);
$theme = array();
foreach (\app::$devices as $device) {
$theme[$device['name']] = \theme::get($oldModule, $oldName, $device['name']);
$theme[$device['name']]->setModule($thememodule);
$theme[$device['name']]->setName($name);
$theme[$device['name']]->onMove('theme', $thememodule, $name, $device['name'], TRUE);
}
if (is_dir('modules/' . $thememodule . '/themes/' . $oldName . '/')) {
\tools::copy_dir('modules/' . $thememodule . '/themes/' . $oldName . '/', PROFILE_PATH . $thememodule . '/themes/' . $name . '/');
} else {
\tools::copy_dir(PROFILE_PATH . $thememodule . '/themes/' . $oldName . '/', PROFILE_PATH . $thememodule . '/themes/' . $name . '/');
}
foreach (\app::$devices as $device) {
$theme[$device['name']]->save();
}
} else {
$theme = new \theme('container', $name, $thememodule);
$theme->save();
}
/* Set theme in preview mode */
setcookie('THEMEMODULE', $thememodule, time() + 60 * 60 * 24 * 30, '/');
setcookie('THEME', $name, time() + 60 * 60 * 24 * 30, '/');
$return = array('eval' => 'top.window.location.reload()', 'notification' => t('The Theme has been created'), 'notificationType' => 'positive');
} else {
$return = array('notification' => t('The Theme has not been created, theme already exists'), 'notificationType' => 'negative');
}
return $this->returnResult($return);
}