本文整理汇总了PHP中sfOutputEscaper类的典型用法代码示例。如果您正苦于以下问题:PHP sfOutputEscaper类的具体用法?PHP sfOutputEscaper怎么用?PHP sfOutputEscaper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了sfOutputEscaper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
}
开发者ID:lendji4000,项目名称:compose,代码行数:38,代码来源:ModeSelectTreeStrategy.php
示例2: setup
/**
* SetUp
*/
public function setup()
{
$this->initPlugins();
// Escaper
sfOutputEscaper::markClassesAsSafe(array('sfFeed'));
$this->enablePlugins('sfDoctrineGuardPlugin');
}
开发者ID:pycmam,项目名称:neskuchaik.ru,代码行数:10,代码来源:ProjectConfiguration.class.php
示例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));
}
开发者ID:seven07ve,项目名称:vendorepuestos,代码行数:18,代码来源:sfOutputEscaperGetterDecorator.class.php
示例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();
}
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:32,代码来源:sfPHPView.class.php
示例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';
}
开发者ID:runopencode,项目名称:diem-extended,代码行数:8,代码来源:dmFrontPluginConfiguration.class.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;
}
开发者ID:te-koyama,项目名称:openpne,代码行数:8,代码来源:opJsonApiHelper.php
示例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')));
}
}
开发者ID:nakanohiroshi3,项目名称:opTimelinePlugin,代码行数:9,代码来源:components.class.php
示例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();
}
开发者ID:rafaelgou,项目名称:sfThemePlugin,代码行数:25,代码来源:ThemeHelper.php
示例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);
}
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:10,代码来源:opColorConfig.class.php
示例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);
}
开发者ID:nykopol,项目名称:sfExtraDoctrinePagerPlugin,代码行数:16,代码来源:sfExtraDoctrinePager.class.php
示例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);
}
开发者ID:Kazuhiro-Murota,项目名称:OpenPNE3,代码行数:21,代码来源:opConfig.class.php
示例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'));
}
开发者ID:ru-easyfinance,项目名称:EasyFinance,代码行数:17,代码来源:ProjectConfiguration.class.php
示例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;
}
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:20,代码来源:LeaveCommentCell.php
示例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);
}
开发者ID:kawahara,项目名称:opChatPlugin,代码行数:14,代码来源:PluginChatContentTable.class.php
示例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);
}
开发者ID:yankeemedia,项目名称:symfony1,代码行数:37,代码来源:sfOutputEscaperObjectDecorator.class.php
示例16: setConfigWidget
protected function setConfigWidget()
{
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Escaping'));
$application = $this->memberApplication->getApplication();
$settings = $application->getSettings();
foreach ($settings as $key => $setting) {
$param = array();
$choices = array();
$validatorBool = new sfValidatorBoolean();
$param['IsRequired'] = $validatorBool->clean($setting['required']);
$param['Caption'] = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $setting['displayName']);
if (empty($setting['datatype']) || $setting['datatype'] == 'HIDDEN') {
continue;
}
switch ($setting['datatype']) {
case 'BOOL':
$param['FormType'] = 'radio';
$choices = array('1' => 'Yes', '0' => 'No');
break;
case 'ENUM':
$param['FormType'] = 'select';
$enumValues = array();
if (!is_array($setting['enumValues'])) {
continue;
}
foreach ($setting['enumValues'] as $value) {
$enumValues[$value['value']] = $value['displayValue'];
}
$choices = $enumValues;
break;
default:
$param['FormType'] = 'input';
$param['ValueType'] = '';
}
$this->widgetSchema[$key] = opFormItemGenerator::generateWidget($param, $choices);
$this->validatorSchema[$key] = opFormItemGenerator::generateValidator($param, array_keys($choices));
if ($setting['defaultValue']) {
$this->setDefault($key, $setting['defaultValue']);
}
}
$userSettings = $this->memberApplication->getUserSettings();
foreach ($userSettings as $name => $value) {
if (!empty($value)) {
$this->setDefault($name, $value);
}
}
}
开发者ID:rysk92,项目名称:opOpenSocialPlugin,代码行数:47,代码来源:ApplicationUserSettingForm.class.php
示例17: initialize
public function initialize()
{
if ($this->configuration instanceof sfApplicationConfiguration) {
if (sfNestedCommentConfig::isRoutesRegister()) {
if (in_array('sfNestedComment', sfConfig::get('sf_enabled_modules', array()))) {
$this->dispatcher->connect('routing.load_configuration', array('sfNestedCommentRouting', 'listenToRoutingLoadConfigurationEvent'));
}
if (in_array('sfNestedCommentAdmin', sfConfig::get('sf_enabled_modules', array()))) {
$this->dispatcher->connect('routing.load_configuration', array('sfNestedCommentRouting', 'addRouteForNestedCommentAdmin'));
}
}
sfOutputEscaper::markClassAsSafe('sfNestedCommentsRenderer');
if (sfNestedCommentConfig::isUsePluginPurifier()) {
self::registerHTMLPurifier();
}
}
}
开发者ID:nibsirahsieu,项目名称:sfNestedCommentPlugin,代码行数:19,代码来源:sfNestedCommentPluginConfiguration.class.php
示例18: toArray
/**
* Returns an array representation of the view parameters.
*
* @return array An array of view parameters
*
* @throws InvalidArgumentException
*/
public function toArray()
{
$event = $this->dispatcher->filter(new sfEvent($this, 'template.filter_parameters'), $this->getAll());
$parameters = $event->getReturnValue();
$attributes = array();
if ($this->isEscaped()) {
$attributes['sf_data'] = sfOutputEscaper::escape($this->getEscapingMethod(), $parameters);
foreach ($attributes['sf_data'] as $key => $value) {
$attributes[$key] = $value;
}
} else {
if (in_array($this->getEscaping(), array('off', false), true)) {
$attributes = $parameters;
$attributes['sf_data'] = sfOutputEscaper::escape(ESC_RAW, $parameters);
} else {
throw new InvalidArgumentException(sprintf('Unknown strategy "%s".', $this->getEscaping()));
}
}
return $attributes;
}
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:27,代码来源:sfViewParameterHolder.class.php
示例19: op_include_pager_navigation
/**
* Includes a navigation for paginated list
*
* @param sfPager $pager
* @param string $internal_uri
* @param array $options
*/
function op_include_pager_navigation($pager, $internal_uri, $options = array())
{
$uri = url_for($internal_uri);
if (isset($options['use_current_query_string']) && $options['use_current_query_string']) {
$options['query_string'] = sfContext::getInstance()->getRequest()->getCurrentQueryString();
$pageFieldName = isset($options['page_field_name']) ? $options['page_field_name'] : 'page';
$options['query_string'] = preg_replace('/' . $pageFieldName . '=\\d\\&*/', '', $options['query_string']);
unset($options['page_field_name']);
unset($options['use_current_query_string']);
}
if (isset($options['query_string'])) {
$options['link_options']['query_string'] = $options['query_string'];
unset($options['query_string']);
}
$params = array('pager' => $pager, 'internalUri' => $internal_uri, 'options' => new opPartsOptionHolder($options));
$pager = sfOutputEscaper::unescape($pager);
if ($pager instanceof sfReversibleDoctrinePager) {
include_partial('global/pagerReversibleNavigation', $params);
} else {
include_partial('global/pagerNavigation', $params);
}
}
开发者ID:shotaatago,项目名称:OpenPNE3,代码行数:29,代码来源:opUtilHelper.php
示例20: offsetGet
/**
* Returns the element associated with the offset supplied (as required by the ArrayAccess interface).
*
* @param string $offset The offset of the value to get
*
* @return mixed The escaped value
*/
public function offsetGet($offset)
{
return sfOutputEscaper::escape($this->escapingMethod, $this->value[$offset]);
}
开发者ID:sensorsix,项目名称:app,代码行数:11,代码来源:sfOutputEscaperIteratorDecorator.class.php
注:本文中的sfOutputEscaper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论