本文整理汇总了PHP中sfOutputEscaper类的典型用法代码示例。如果您正苦于以下问题:PHP sfOutputEscaper类的具体用法?PHP sfOutputEscaper怎么用?PHP sfOutputEscaper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfOutputEscaper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Méthode permettant d'afficher l'arbre à partir de celui passé en paramètre.
*
* @param ITree $tree
* @param array $options
* @param $key
*
* @return mixed|string
*/
public function render(ITree $tree, array $options, $key)
{
$this->defaults($tree, $tree->getRoot());
if ($key != null && !isset($options["baseId"])) {
$options["id"] = $this->options["id"] . "_" . $key;
$options["baseId"] = $this->options["id"];
} elseif ($key != null && isset($options["baseId"])) {
$options["id"] = $options["baseId"] . "_" . $key;
}
if ($key != null && isset($options["selected"])) {
$options["selected"] = isset($options["selected"][$key]) ? $options["selected"][$key] : "";
}
$options = array_merge($this->options, $options);
$build = function ($tree) use(&$build, &$options, $key) {
$output = is_string($options['rootOpen']) ? $options['rootOpen'] : $options['rootOpen']($tree);
$nodes = $tree instanceof ITreeViewerItem && $tree->isRoot() ? array($tree) : $tree;
/** @var ITreeViewerItem $node */
foreach ($nodes as $node) {
$output .= is_string($options['childOpen']) ? $options['childOpen'] : $options['childOpen']($node, $node->getType(), $key);
$output .= $options['nodeDecorator']($node);
if (count($node->getChildren()) > 0) {
$output .= $build($node->getChildren());
}
$output .= is_string($options['childClose']) ? $options['childClose'] : $options['childClose']($node);
}
return $output . (is_string($options['rootClose']) ? $options['rootClose'] : $options['rootClose']($tree));
};
return html_entity_decode(sfOutputEscaper::unescape(get_component("eitreeviewer", "displaySelectMode", array("root" => $tree, "html" => $build($tree->getRoot()), "options" => $options, "key" => $key, "tree" => $this))), ENT_QUOTES, "UTF-8");
}
示例2: setup
/**
* SetUp
*/
public function setup()
{
$this->initPlugins();
// Escaper
sfOutputEscaper::markClassesAsSafe(array('sfFeed'));
$this->enablePlugins('sfDoctrineGuardPlugin');
}
示例3: get
/**
* Returns the escaped value associated with the key supplied.
*
* Typically (using this implementation) the raw value is obtained using the
* {@link getRaw()} method, escaped and the result returned.
*
* @param string $key The key to retieve
* @param string $escapingMethod The escaping method (a PHP function) to use
*
* @return mixed The escaped value
*/
public function get($key, $escapingMethod = null)
{
if (!$escapingMethod) {
$escapingMethod = $this->escapingMethod;
}
return sfOutputEscaper::escape($escapingMethod, $this->getRaw($key));
}
示例4: renderFile
/**
* Renders the presentation.
*
* @param string Filename
*
* @return string File content
*/
protected function renderFile($_sfFile)
{
if (sfConfig::get('sf_logging_enabled')) {
$this->getContext()->getLogger()->info('{sfView} render "' . $_sfFile . '"');
}
$this->loadCoreAndStandardHelpers();
$_escaping = $this->getEscaping();
if ($_escaping === false || $_escaping === 'bc') {
$vars = $this->attributeHolder->getAll();
extract($vars);
}
if ($_escaping !== false) {
$sf_data = sfOutputEscaper::escape($this->getEscapingMethod(), $this->attributeHolder->getAll());
if ($_escaping === 'both') {
foreach ($sf_data as $_key => $_value) {
${$_key} = $_value;
}
}
}
// render
ob_start();
ob_implicit_flush(0);
require $_sfFile;
return ob_get_clean();
}
示例5: configure
public function configure()
{
sfConfig::set('dm_front_dir', realpath(dirname(__FILE__) . "/.."));
sfConfig::set('dm_context_type', 'front');
sfOutputEscaper::markClassesAsSafe(array('dmFrontPageBaseHelper', 'dmFrontLayoutHelper', 'dmHelper', 'dmHtmlTag', 'dmFrontToolBarView', 'dmMenu'));
require_once sfConfig::get('dm_core_dir') . '/lib/config/dmFactoryConfigHandler.php';
require_once sfConfig::get('dm_front_dir') . '/lib/config/dmFrontRoutingConfigHandler.php';
}
示例6: op_api_force_escape
function op_api_force_escape($text)
{
if (!sfConfig::get('sf_escaping_strategy')) {
// escape body even if escaping method is disabled.
$text = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $text);
}
return $text;
}
示例7: executeSmtMemberTimelineBy1
public function executeSmtMemberTimelineBy1(sfWebRequest $request)
{
$this->memberId = $request->getParameter('id');
$this->activityData = Doctrine_Query::create()->from('ActivityData ad')->where('ad.in_reply_to_activity_id IS NULL')->andWhere('ad.member_id = ?', $this->memberId)->andWhere('ad.foreign_table IS NULL')->andWhere('ad.foreign_id IS NULL')->andWhere('ad.public_flag = ?', 1)->orderBy('ad.id DESC')->limit(1)->execute();
if ($this->activityData) {
$this->createdAt = $this->activityData[0]->getCreatedAt();
$this->body = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), opTimelinePluginUtil::screenNameReplace($this->activityData[0]->getBody(), sfConfig::get('op_base_url')));
}
}
示例8: get_theme_partial
/**
* Evaluates and returns a partial.
* The syntax is similar to the one of include_partial
*
* <b>Example:</b>
* <code>
* echo get_partial('mypartial', array('myvar' => 12345));
* </code>
*
* @param string $templateName partial name
* @param array $vars variables to be made accessible to the partial
*
* @return string result of the partial execution
* @see include_partial
*/
function get_theme_partial($templateName, $vars = array())
{
$context = sfContext::getInstance();
$actionName = '_' . $templateName;
$class = 'sfThemePartialView';
$current_theme = $context->getConfiguration()->getPluginConfiguration('sfThemePlugin')->getThemeManager()->getCurrentTheme();
$view = new $class($context, $current_theme, $actionName, '');
$view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ? sfOutputEscaper::unescape($vars) : $vars);
return $view->render();
}
示例9: get
public static function get($name, $default = '#000000', $app = null)
{
if (is_null($app)) {
$app = sfConfig::get('sf_app');
}
$configName = 'op_' . $app . '_color_config_' . $name;
$result = sfConfig::get($configName, $default);
sfContext::getInstance()->getConfiguration()->loadHelpers('Escaping');
return sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $result);
}
示例10: __construct
/**
* Construct method
* @param string $class Doctrine class name
* @param integer $maxPerPage Number of row per page
* @param array $options array of options
*/
public function __construct($class, $maxPerPage = 10, $options = array())
{
$this->widgetSchema = new sfWidgetPagerSchema();
$this->widgetSchema->setPager($this);
$this->options = $options;
$this->setup();
$this->validateRequiredOptions();
sfOutputEscaper::markClassesAsSafe(array('sfExtraDoctrinePager'));
parent::__construct($class, $maxPerPage);
}
示例11: get
/**
* Retrieves a config parameter.
*
* @param string $name A config parameter name
* @param mixed $default A default config parameter value
*
* @return mixed A config parameter value
*/
public static function get($name, $default = null)
{
$setting = self::getConfigurationSetting();
$result = null;
if (isset($setting[$name])) {
$result = Doctrine::getTable('SnsConfig')->get($name, $default);
if (is_null($result)) {
$result = self::getDefaultValue($name);
}
}
sfContext::getInstance()->getConfiguration()->loadHelpers('Escaping');
return sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $result);
}
示例12: setup
/**
* SetUp
*/
public function setup()
{
$this->initPlugins();
// Escaper
sfOutputEscaper::markClassesAsSafe(array('DateTime'));
// г-но, но без этого Zend_Mail_Message raw письма по русски не читает
// @see http://framework.zend.com/issues/browse/ZF-3591
@ini_set('iconv.internal_encoding', 'UTF-8');
// Событие на получение "из контекста" обменника валют
// @see sfContext::__call
$this->dispatcher->connect('context.method_not_found', array(__CLASS__, 'getMyCurrencyExchange'));
// Обработка события "конфигурация подключения"
$this->dispatcher->connect('doctrine.configure_connection', array(__CLASS__, 'doctrineConnectionConfigurationEvent'));
}
示例13: trimComment
/**
* Trim comment to 30 characters
*
* @param string $comment
* @return string
*/
protected function trimComment($comment)
{
if (strlen($comment) > 30) {
$escape = sfConfig::get('sf_escaping_strategy');
if ($escape) {
$comment = sfOutputEscaper::unescape($comment);
}
$comment = substr($comment, 0, 30) . '...';
if ($escape) {
$comment = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $comment);
}
}
return $comment;
}
示例14: getListJson
public function getListJson($controller, $contents)
{
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Helper', 'Tag', 'Escaping', 'opUtil'));
$result = array();
foreach ($contents as $content) {
$data = array('number' => $content->number, 'member_url' => $controller->genUrl('@obj_member_profile?id=' . $content->member_id), 'member_name' => $content->Member->name, 'command' => $content->command, 'body' => $content->body, 'created_at' => $content->created_at);
foreach ($data as &$d) {
$d = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $d);
}
$data['body'] = op_auto_link_text($data['body']);
$result[] = $data;
}
return json_encode($result);
}
示例15: __call
/**
* Magic PHP method that intercepts method calls, calls them on the objects
* that is being escaped and escapes the result.
*
* The calling of the method is changed slightly to accommodate passing a
* specific escaping strategy. An additional parameter is appended to the
* argument list which is the escaping strategy. The decorator will remove
* and use this parameter as the escaping strategy if it begins with 'esc_'
* (the prefix all escaping helper functions have).
*
* For example if an object, $o, implements methods a() and b($arg):
*
* $o->a() // Escapes the return value of a()
* $o->a(ESC_RAW) // Uses the escaping method ESC_RAW with a()
* $o->b('a') // Escapes the return value of b('a')
* $o->b('a', ESC_RAW); // Uses the escaping method ESC_RAW with b('a')
*
* @param string $method The method on the object to be called
* @param array $args An array of arguments to be passed to the method
*
* @return mixed The escaped value returned by the method
*/
public function __call($method, $args)
{
if (count($args) > 0) {
$escapingMethod = $args[count($args) - 1];
if (is_string($escapingMethod) && substr($escapingMethod, 0, 4) === 'esc_') {
array_pop($args);
} else {
$escapingMethod = $this->escapingMethod;
}
} else {
$escapingMethod = $this->escapingMethod;
}
$value = call_user_func_array(array($this->value, $method), $args);
return sfOutputEscaper::escape($escapingMethod, $value);
}