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


PHP Utilities::sanitizeOutput方法代碼示例

本文整理匯總了PHP中Utilities::sanitizeOutput方法的典型用法代碼示例。如果您正苦於以下問題:PHP Utilities::sanitizeOutput方法的具體用法?PHP Utilities::sanitizeOutput怎麽用?PHP Utilities::sanitizeOutput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Utilities的用法示例。


在下文中一共展示了Utilities::sanitizeOutput方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sanitizeOutput

 /**
  * Sanitize data to avoid tag replacement
  * 
  * @param mixed data
  * 
  * @return string
  * 
  */
 public static function sanitizeOutput($data)
 {
     return self::sanitize(Utilities::sanitizeOutput($data));
 }
開發者ID:eheb,項目名稱:renater-decide,代碼行數:12,代碼來源:Template.class.php

示例2: replace


//.........這裏部分代碼省略.........
                 // Is there any negation ?
                 $andpart = trim($andpart);
                 if (substr($andpart, 0, 1) == '!') {
                     $neg = true;
                     $andpart = trim(substr($andpart, 1));
                 }
                 // Resolve compared value
                 $value = $placeholder_resolver($andpart);
                 // Placeholder not (yet) available, cannot choose, leave part as is
                 if (is_null($value)) {
                     $leftand[] = ($neg ? '!' : '') . $andpart . ($op != 'bool' ? $op . $ov : '');
                     $smatch = false;
                     break;
                 }
                 // Cast value to scalar
                 if (is_object($value)) {
                     $value = true;
                 }
                 if (is_array($value)) {
                     $value = count($value);
                 }
                 // Cast value to compare to
                 if ($ov == 'true') {
                     $ov = true;
                 } else {
                     if ($ov == 'false') {
                         $ov = false;
                     } else {
                         if (is_float($ov)) {
                             $ov = (double) $ov;
                         } else {
                             if (is_numeric($ov)) {
                                 $ov = (int) $ov;
                             } else {
                                 if (is_string($ov)) {
                                     if (preg_match('`^(["\'])(.*)\\1$`', $ov, $m)) {
                                         $ov = $m[2];
                                     }
                                 }
                             }
                         }
                     }
                 }
                 // Run the test
                 switch ($op) {
                     case '==':
                         $smatch &= $value == $ov;
                         break;
                     case '!=':
                         $smatch &= $value != $ov;
                         break;
                     case '<':
                         $smatch &= $value < $ov;
                         break;
                     case '<=':
                         $smatch &= $value <= $ov;
                         break;
                     case '>':
                         $smatch &= $value > $ov;
                         break;
                     case '>=':
                         $smatch &= $value >= $ov;
                         break;
                     case 'bool':
                     default:
                         $smatch &= (bool) $value;
                 }
             }
             // Any test that we couldn't run ? Then leave what's not resolved for later, reduce value otherwise
             if (count($leftand)) {
                 $leftor[] = implode('&', $leftand);
             } else {
                 if ($smatch) {
                     $match = true;
                     break;
                 }
             }
         }
         // Part of the test remains, set it for next replace
         if (!$match && count($leftor)) {
             return '{if:' . implode('|', $leftor) . '}' . $ifcontent . ($elsecontent ? '{else}' . $elsecontent : '') . '{endif}';
         }
         // Return fitting content
         return $match ? $ifcontent : $elsecontent;
     }, $translation);
     // Basic placeholder replacement
     foreach ($placeholders as $k => $v) {
         $translation = preg_replace_callback('`\\{(([^:\\}]+:)?' . $k . '(\\.[a-z0-9_\\(\\)]+)*)\\}`iU', function ($m) use($placeholder_resolver) {
             if (substr($m[0], 0, 4) == '{if:') {
                 return $m[0];
             }
             // Remaining ifs
             $v = $placeholder_resolver($m[1]);
             return substr($m[0], 0, 5) == '{raw:' ? $v : Utilities::sanitizeOutput($v);
             // Ensure sanity
         }, $translation);
     }
     // Return new translation object for further replacements
     return new self($translation);
 }
開發者ID:eheb,項目名稱:renater-foodle,代碼行數:101,代碼來源:Lang.class.php

示例3: TokenHasBadFormatException

if (!Utilities::isValidUID($token)) {
    throw new TokenHasBadFormatException($token);
}
$lang = array_key_exists('lang', $_REQUEST) ? $_REQUEST['lang'] : null;
$available = Lang::getAvailableLanguages();
if (!array_key_exists($lang, $available)) {
    $lang = Lang::getCode();
}
$url = '?s=translate_email&amp;token=' . $token . '&amp;lang=';
if (count($available) > 1) {
    echo '<div class="buttons">';
    foreach ($available as $id => $dfn) {
        if ($id == $lang) {
            echo '<span class="selected">' . Utilities::sanitizeOutput($dfn['name']) . '</span>';
        } else {
            echo '<a href="' . $url . $id . '">' . Utilities::sanitizeOutput($dfn['name']) . '</a>';
        }
    }
    echo '</div>';
}
$translatable = TranslatableEmail::fromToken($token);
$translation = $translatable->translate($lang);
/*
 * Do not call Template::sanitizeOutput on email contents after that because
 * TranslatableEmail::translate calls Translation::replace which itself calls
 * Utilities::sanitizeOutput, use Template::sanitize instead !
 */
$subject = array_filter($translation->subject->out());
?>
    
    <dl>
開發者ID:eheb,項目名稱:renater-decide,代碼行數:31,代碼來源:translate_email_page.php

示例4: method_exists

    ?>
</pre>
    <?php 
}
?>
    
    <div class="report">
    <?php 
if (Config::get('support_email')) {
    ?>
        {tr:you_can_report_exception_by_email} : <a href="mailto:<?php 
    echo Config::get('support_email');
    ?>
?subject=Exception <?php 
    echo method_exists($exception, 'getUid') ? Utilities::sanitizeOutput($exception->getUid()) : '';
    ?>
">{tr:report_exception}</a>
    <?php 
} else {
    if (method_exists($exception, 'getUid')) {
        ?>
        {tr:you_can_report_exception} : <?php 
        echo Utilities::sanitizeOutput($exception->getUid());
        ?>
    <?php 
    }
}
?>
    </div>
</div>
開發者ID:eheb,項目名稱:renater-decide,代碼行數:30,代碼來源:exception.php


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