本文整理汇总了PHP中Hooks::filter方法的典型用法代码示例。如果您正苦于以下问题:PHP Hooks::filter方法的具体用法?PHP Hooks::filter怎么用?PHP Hooks::filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hooks
的用法示例。
在下文中一共展示了Hooks::filter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: desc
public static function desc($vars)
{
if (!empty($vars)) {
$desc = substr(strip_tags(htmlspecialchars_decode($vars) . ". " . self::$desc), 0, 150);
} else {
$desc = substr(self::$desc, 0, 150);
}
$desc = Hooks::filter('site_desc_filter', $desc);
return $desc;
}
示例2: format
public static function format($post, $id)
{
// split post for readmore...
$post = Typo::Xclean($post);
$more = explode('[[--readmore--]]', $post);
//print_r($more);
if (count($more) > 1) {
$post = explode('[[--readmore--]]', $post);
$post = $post[0] . " <a href=\"" . Url::post($id) . "\">" . READ_MORE . "</a>";
} else {
$post = $post;
}
$post = Hooks::filter('post_content_filter', $post);
return $post;
}
示例3: switch
case 'add':
# code...
$data[] = '';
switch (isset($_POST['submit'])) {
case true:
# code...
// check token first
if (!isset($_POST['token']) || !Token::isExist($_POST['token'])) {
// VALIDATE ALL
$alertred[] = TOKEN_NOT_EXIST;
}
//cleanup first
$title = Typo::cleanX($_POST['title']);
$title = Hooks::filter('post_submit_title_filter', $title);
$content = Typo::cleanX($_POST['content']);
$content = Hooks::filter('post_submit_content_filter', $content);
if (!isset($title) || $title == "") {
$alertred[] = TITLE_CANNOT_EMPTY;
}
if (isset($alertred)) {
$data['alertred'] = $alertred;
} else {
if (!isset($_POST['date']) || $_POST['date'] == "") {
# code...
$date = date("Y-m-d H:i:s");
} else {
$date = $_POST['date'];
}
$vars = array('title' => $title, 'cat' => Typo::int($_POST['cat']), 'content' => $content, 'date' => $date, 'type' => 'post', 'author' => Session::val('username'), 'status' => Typo::int($_POST['status']));
//print_r($vars);
Posts::insert($vars);