mirror of
https://github.com/Mibew/mibew.git
synced 2025-01-31 13:24:41 +03:00
Remove unused "jsString" Handlebars.php helper
This commit is contained in:
parent
ae7ee06031
commit
55587f67fe
@ -1,44 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is a part of Mibew Messenger.
|
||||
*
|
||||
* Copyright 2005-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
namespace Mibew\Handlebars\Helper;
|
||||
|
||||
use Handlebars\Context;
|
||||
use Handlebars\Helper as HelperInterface;
|
||||
use Handlebars\Template;
|
||||
|
||||
/**
|
||||
* Escapes special characters to use result as a valid JavaScript string
|
||||
* enclosed with single quotes (') or duouble quotes (").
|
||||
*
|
||||
* Example of usage:
|
||||
* <code>
|
||||
* var a = "{{#jsString}}some string to escape{{/jsString}}";
|
||||
* </code>
|
||||
*/
|
||||
class JsStringHelper implements HelperInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function execute(Template $template, Context $context, $args, $source)
|
||||
{
|
||||
return str_replace("\n", "\\n", addslashes($template->render($context)));
|
||||
}
|
||||
}
|
@ -47,7 +47,6 @@ class Helpers extends BaseHelpers
|
||||
$this->add('ifEven', new Helper\IfEvenHelper());
|
||||
$this->add('ifOdd', new Helper\IfOddHelper());
|
||||
$this->add('generatePagination', new Helper\GeneratePaginationHelper());
|
||||
$this->add('jsString', new Helper\JsStringHelper());
|
||||
$this->add('repeat', new Helper\RepeatHelper());
|
||||
$this->add('replace', new Helper\ReplaceHelper());
|
||||
$this->add('formatDate', new Helper\FormatDateHelper());
|
||||
|
Loading…
Reference in New Issue
Block a user