本文整理汇总了PHP中Hooks::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Hooks::execute方法的具体用法?PHP Hooks::execute怎么用?PHP Hooks::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hooks
的用法示例。
在下文中一共展示了Hooks::execute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cc_redirect
/**
* This function allows you to redirect people.
*
* This function uses an HTTP redirect to redirect people. That means it MUST be done before anycontent is displayed! The second argument is whether or not it is relative to the root of the site. For example,
* if you should use <code>cc_redirect('http://google.com/');
* cc_redirect('cc-admin/', true);</code>
*
* @param string $url The path to redirect to.
* @param bool $relative Whether or not to redirect relative to TH_CORE
* @return null This method will never return anything.
*/
function cc_redirect($url, $relative = false)
{
$continue = true;
Hooks::execute('cc_redirect', array(&$url, &$relative, &$continue));
if ($continue === false) {
return;
}
if ($relative) {
header(sprintf('location: %s', TH_PUB_ROOT . $url));
}
header(sprintf('location: %s', $url));
}
示例2: setupPostHandles
/**
* Sets up hooks for form submission.
*/
public static function setupPostHandles()
{
if (!empty($_POST['cc_form'])) {
Hooks::execute('post_' . $_POST['cc_form']);
}
}
示例3: link
/**
* Validates an ABSOLUTE link.
*
* @param string $url The string to preform the test on.
* @return bool True if is a valid link, false otherwise.
*/
public static function link($url)
{
$r = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED);
Hooks::execute('validate_link', array(&$url, &$r));
return $r;
}