當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Hooks::execute方法代碼示例

本文整理匯總了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));
}
開發者ID:alecgorge,項目名稱:TopHat,代碼行數:23,代碼來源:cc-redirect.php

示例2: setupPostHandles

 /**
  * Sets up hooks for form submission.
  */
 public static function setupPostHandles()
 {
     if (!empty($_POST['cc_form'])) {
         Hooks::execute('post_' . $_POST['cc_form']);
     }
 }
開發者ID:alecgorge,項目名稱:TopHat,代碼行數:9,代碼來源:cc-hooks.php

示例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;
 }
開發者ID:alecgorge,項目名稱:TopHat,代碼行數:12,代碼來源:cc-validate.php


注:本文中的Hooks::execute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。