mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Merge pull request #4688 from Deltik/fix/4686
New API to concatenate an array of HTML attributes
This commit is contained in:
@@ -313,6 +313,7 @@ class e_parse
|
||||
if ($bool === false)
|
||||
{
|
||||
$this->multibyte = false;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -632,6 +633,7 @@ class e_parse
|
||||
/**
|
||||
* Check for umatched 'dangerous' HTML tags
|
||||
* (these can destroy page layout where users are able to post HTML)
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $tagList - if empty, uses default list of input tags. Otherwise a CSV list of tags to check (any type)
|
||||
*
|
||||
@@ -684,6 +686,7 @@ class e_parse
|
||||
/**
|
||||
* Takes a multi-dimensional array and converts the keys to a list of routing paths.
|
||||
* paths are the key and value are the top most key.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
@@ -727,8 +730,6 @@ class e_parse
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function toForm($text)
|
||||
{
|
||||
|
||||
@@ -839,6 +840,7 @@ class e_parse
|
||||
$text = e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
|
||||
$text = str_replace('<!-- >', '', $text); // cleanup
|
||||
$parse->setMode('default');
|
||||
|
||||
return $text;
|
||||
|
||||
}
|
||||
@@ -1109,6 +1111,7 @@ class e_parse
|
||||
/**
|
||||
* Universal text/bbcode/html truncate method.
|
||||
* new in v2.3.1
|
||||
*
|
||||
* @param $text
|
||||
* @param int $length
|
||||
* @param string $ending
|
||||
@@ -1131,6 +1134,11 @@ class e_parse
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text String to truncate.
|
||||
* @param integer $length Length of returned string, including ellipsis.
|
||||
* @param string $ending It will be used as Ending and appended to the trimmed string.
|
||||
* @param boolean $exact If false, $text will not be cut mid-word
|
||||
* @return string Trimmed string.
|
||||
* @deprecated Soon to be made private. Use $tp->truncate() instead.
|
||||
* CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
@@ -1138,11 +1146,6 @@ class e_parse
|
||||
* Truncate a HTML string
|
||||
*
|
||||
* Cuts a string to the length of $length and adds the value of $ending if the text is longer than length.
|
||||
* @param string $text String to truncate.
|
||||
* @param integer $length Length of returned string, including ellipsis.
|
||||
* @param string $ending It will be used as Ending and appended to the trimmed string.
|
||||
* @param boolean $exact If false, $text will not be cut mid-word
|
||||
* @return string Trimmed string.
|
||||
*/
|
||||
public function html_truncate($text, $length = 100, $ending = '...', $exact = true)
|
||||
{
|
||||
@@ -1237,19 +1240,15 @@ class e_parse
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated for public use. Will be made private. Use $tp->truncate() instead.
|
||||
* Truncate a string of text to a maximum length $len append the string $more if it was truncated
|
||||
* Uses current CHARSET for utf-8, returns $len characters rather than $len bytes
|
||||
*
|
||||
* @param string $text string to process
|
||||
* @param integer $len length of characters to be truncated
|
||||
* @param string $more string which will be added if truncation
|
||||
* @return string Always returns text.
|
||||
* @deprecated for public use. Will be made private. Use $tp->truncate() instead.
|
||||
* Truncate a string of text to a maximum length $len append the string $more if it was truncated
|
||||
* Uses current CHARSET for utf-8, returns $len characters rather than $len bytes
|
||||
*
|
||||
*/
|
||||
public function text_truncate($text, $len = 200, $more = ' ... ')
|
||||
{
|
||||
@@ -1336,6 +1335,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Replace text represenation of website urls and email addresses with clickable equivalents.
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $type email|url
|
||||
* @param array $opts options. (see below)
|
||||
@@ -1409,6 +1409,7 @@ class e_parse
|
||||
/**
|
||||
* Strips block tags from html.
|
||||
* ie. <p> <div> <blockquote> <h1> <h2> <h3> etc are removed.
|
||||
*
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
@@ -1425,7 +1426,8 @@ class e_parse
|
||||
return strip_tags($html, $parm);
|
||||
}
|
||||
|
||||
public function stripAttributes($s, $allowedattr = array()) {
|
||||
public function stripAttributes($s, $allowedattr = array())
|
||||
{
|
||||
|
||||
if (preg_match_all("/<[^>]*\\s([^>]*)\\/*>/msiU", $s, $res, PREG_SET_ORDER))
|
||||
{
|
||||
@@ -1709,6 +1711,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Check if a string begins with a preformatter flag.
|
||||
*
|
||||
* @param $str
|
||||
* @return bool
|
||||
*/
|
||||
@@ -1838,39 +1841,70 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Use it on html attributes to avoid breaking markup .
|
||||
*
|
||||
* @param string $text
|
||||
* @param bool $pure True to skip the text mutation by {@see e_parse::replaceConstants()}
|
||||
* @example echo "<a href='#' title='".$tp->toAttribute($text)."'>Hello</a>";
|
||||
*/
|
||||
public function toAttribute($text)
|
||||
public function toAttribute($text, $pure = false)
|
||||
{
|
||||
|
||||
// URLs posted without HTML access may have an & in them.
|
||||
|
||||
// Xhtml compliance.
|
||||
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
|
||||
$text = htmlspecialchars((string) $text, ENT_QUOTES, 'UTF-8');
|
||||
|
||||
if(!preg_match('/&#|\'|"|<|>/s', $text))
|
||||
if (!$pure && !preg_match('/&#|\'|"|<|>/s', $text))
|
||||
{
|
||||
$text = $this->replaceConstants($text);
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
else
|
||||
|
||||
/**
|
||||
* Build a series of HTML attributes from the provided array
|
||||
*
|
||||
* Because of legacy loose typing client code usages, values that are {@see empty()} will not be added to the
|
||||
* concatenated HTML attribute string except when the key is `value`, the key begins with `data-`, or the value is
|
||||
* a number.
|
||||
*
|
||||
* @param array $attributes Key-value pairs of HTML attributes. The value must not be HTML-encoded. If the value is
|
||||
* boolean true, the value will be set to the key (e.g. `['required' => true]` becomes
|
||||
* "required='required'").
|
||||
* @param bool $pure True to skip the text mutation by {@see e_parse::replaceConstants()}
|
||||
* @return string The HTML attributes to concatenate inside an HTML tag
|
||||
* @see e_parseTest::testToAttributesMixedPureAndReplaceConstants() for an example of how to use this method
|
||||
*/
|
||||
public function toAttributes($attributes, $pure = false)
|
||||
{
|
||||
return $text;
|
||||
$stringifiedAttributes = [];
|
||||
|
||||
foreach ($attributes as $key => $value)
|
||||
{
|
||||
if ($value === true && (strpos($key, 'data-') !== 0))
|
||||
{
|
||||
$value = $key;
|
||||
}
|
||||
if (!empty($value) || is_numeric($value) || $key === "value" || strpos($key, 'data-') === 0)
|
||||
{
|
||||
$stringifiedAttributes[] = $key . "='" . $this->toAttribute($value, $pure) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
return count($stringifiedAttributes) > 0 ? " " . implode(" ", $stringifiedAttributes) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten a multi-dimensional associative array with slashes.
|
||||
*
|
||||
* Based on Illuminate\Support\Arr::dot()
|
||||
* @copyright Copyright (c) Taylor Otwell
|
||||
* @license https://github.com/illuminate/support/blob/master/LICENSE.md MIT License
|
||||
*
|
||||
* @param $array
|
||||
* @param string $prepend
|
||||
* @return array
|
||||
* @license https://github.com/illuminate/support/blob/master/LICENSE.md MIT License
|
||||
* @copyright Copyright (c) Taylor Otwell
|
||||
*/
|
||||
public static function toFlatArray($array, $prepend = '')
|
||||
{
|
||||
@@ -1907,7 +1941,9 @@ class e_parse
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
if (!empty($unprepend) && substr($key, 0, strlen($unprepend)) == $unprepend)
|
||||
{
|
||||
$key = substr($key, strlen($unprepend));
|
||||
}
|
||||
$parts = explode('/', $key);
|
||||
$nested = &$output;
|
||||
while (count($parts) > 1)
|
||||
@@ -1917,6 +1953,7 @@ class e_parse
|
||||
}
|
||||
$nested[array_shift($parts)] = $value;
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -2046,6 +2083,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Clean and Encode Ampersands '&' for output to browser.
|
||||
*
|
||||
* @param string $text
|
||||
* @return array|string|string[]
|
||||
*/
|
||||
@@ -2062,6 +2100,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Convert any string back to plain text.
|
||||
*
|
||||
* @param $text
|
||||
* @return array|string|string[]
|
||||
*/
|
||||
@@ -2129,6 +2168,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Retrieve img tag width and height attributes for current thumbnail.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function thumbDimensions($type = 'single')
|
||||
@@ -2145,6 +2185,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Set or Get the value of the thumbNail Width.
|
||||
*
|
||||
* @param $width (optional)
|
||||
*/
|
||||
public function thumbWidth($width = null)
|
||||
@@ -2160,6 +2201,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Set or Get the value of the thumbNailbCrop.
|
||||
*
|
||||
* @param bool $status = true/false
|
||||
*/
|
||||
public function thumbCrop($status = false)
|
||||
@@ -2176,6 +2218,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Set or Get the value of the thumbNail height.
|
||||
*
|
||||
* @param $height (optional)
|
||||
*/
|
||||
public function thumbHeight($height = null)
|
||||
@@ -2192,6 +2235,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Generated a Thumb Cache File Name from path and options.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $options
|
||||
* @param string $log (optional) - log file name
|
||||
@@ -2383,6 +2427,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Used internally to store e_HTTP_STATIC.
|
||||
*
|
||||
* @param string|null $url The static URL ie. e_HTTP_STATIC
|
||||
*/
|
||||
public function setStaticUrl($url)
|
||||
@@ -2393,6 +2438,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Generate an auto-sized Image URL.
|
||||
*
|
||||
* @param $url - path to image or leave blank for a placeholder. eg. {e_MEDIA}folder/my-image.jpg
|
||||
* @param array $options - width and height, but leaving this empty and using $this->thumbWidth() and $this->thumbHeight() is preferred. ie. {SETWIDTH: w=x&y=x}
|
||||
* @param int $options ['w'] width (optional)
|
||||
@@ -2557,6 +2603,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Split a thumb.php url into an array which can be parsed back into the thumbUrl method. .
|
||||
*
|
||||
* @param $src
|
||||
* @return array
|
||||
*/
|
||||
@@ -2608,6 +2655,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Experimental: Generate a Thumb URL for use in the img srcset attribute.
|
||||
*
|
||||
* @param string $src eg. {e_MEDIA_IMAGE}myimage.jpg
|
||||
* @param int|string|array $width - desired size in px or '2x' or '3x' or null for all or array (
|
||||
* @return string
|
||||
@@ -2628,7 +2676,6 @@ class e_parse
|
||||
}
|
||||
|
||||
|
||||
|
||||
// $encode = $this->thumbEncode();;
|
||||
if ($width == null || $width === 'all')
|
||||
{
|
||||
@@ -2728,6 +2775,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Used by thumbUrl when SEF Image URLS is active. @param $url
|
||||
*
|
||||
* @param array $options
|
||||
* @return string
|
||||
* @see e107.htaccess
|
||||
@@ -2890,6 +2938,7 @@ class e_parse
|
||||
* Replace e107 path constants
|
||||
* Note: only an ADMIN user can convert {e_ADMIN}
|
||||
* TODO - runtime cache of search/replace arrays (object property) when $mode !== ''
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $mode [optional] abs|full "full" = produce absolute URL path, e.g. http://sitename.com/e107_plugins/etc
|
||||
* 'abs' = produce truncated URL path, e.g. e107plugins/etc
|
||||
@@ -3315,6 +3364,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Convert Text to a suitable format for use in emails. eg. relative links will be replaced with full links etc.
|
||||
*
|
||||
* @param string $text
|
||||
* @param boolean $posted - if the text has been posted. (uses stripslashes etc)
|
||||
* @param string $mods - flags for text transformation.
|
||||
@@ -3394,6 +3444,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Obfuscate text from bots using Randomized encoding.
|
||||
*
|
||||
* @param $text
|
||||
* @return string
|
||||
*/
|
||||
@@ -3548,6 +3599,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Add Allowed Tags.
|
||||
*
|
||||
* @param string
|
||||
*/
|
||||
public function addAllowedTag($tag)
|
||||
@@ -3570,6 +3622,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Set Allowed Tags.
|
||||
*
|
||||
* @param $array
|
||||
*/
|
||||
public function setAllowedTags($array = array())
|
||||
@@ -3580,6 +3633,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Set Script Access
|
||||
*
|
||||
* @param $val int e_UC_MEMBER, e_UC_NOBODY, e_UC_MAINADMIN or userclass number.
|
||||
*/
|
||||
public function setScriptAccess($val)
|
||||
@@ -3620,6 +3674,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Set Allowed Attributes.
|
||||
*
|
||||
* @param $array
|
||||
*/
|
||||
public function setAllowedAttributes($array = array())
|
||||
@@ -3630,6 +3685,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Set Script Tags.
|
||||
*
|
||||
* @param $array
|
||||
*/
|
||||
public function setScriptTags($array = array())
|
||||
@@ -3660,6 +3716,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Add leading zeros to a number. eg. 3 might become 000003
|
||||
*
|
||||
* @param $num integer
|
||||
* @param $numDigits - total number of digits
|
||||
* @return string number with leading zeros.
|
||||
@@ -3671,6 +3728,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Generic variable translator for LAN definitions.
|
||||
*
|
||||
* @param $lan - string LAN
|
||||
* @param string | array $vals - either a single value, which will replace '[x]' or an array with key=>value pairs.
|
||||
* @return string
|
||||
@@ -3703,6 +3761,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Return an Array of all specific tags found in an HTML document and their attributes.
|
||||
*
|
||||
* @param $html - raw html code
|
||||
* @param $taglist - comma separated list of tags to search or '*' for all.
|
||||
* @param $header - if the $html includes the html head or body tags - it should be set to true.
|
||||
@@ -3762,6 +3821,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Glyph Embed Method Direct from svg file.
|
||||
*
|
||||
* @param string $cat far|fab|fas
|
||||
* @param string $id eg. fa-search
|
||||
* @param array $parm eg. ['fw'=>true]
|
||||
@@ -3791,6 +3851,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Parse xxxxx.glyph file to bootstrap glyph format.
|
||||
*
|
||||
* @param string $text ie. fa-xxxx, fab-xxx, fas-xxxx
|
||||
* @param array|string $options
|
||||
* @param bool $options ['size'] 2x, 3x, 4x, or 5x
|
||||
@@ -3948,8 +4009,6 @@ class e_parse
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
elseif (strpos($text, 'glyphicon-') === 0) // Bootstrap 3
|
||||
{
|
||||
@@ -4013,6 +4072,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Return a Bootstrap Badge tag
|
||||
*
|
||||
* @param $text
|
||||
* @param null $parm
|
||||
* @return string
|
||||
@@ -4028,6 +4088,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Return a Bootstrap Label tag
|
||||
*
|
||||
* @param $text
|
||||
* @param null $type
|
||||
* @return string
|
||||
@@ -4053,6 +4114,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Take a file-path and convert it to a download link.
|
||||
*
|
||||
* @param $text
|
||||
* @param array $parm
|
||||
* @return string
|
||||
@@ -4077,6 +4139,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Render an avatar based on supplied user data or current user when missing.
|
||||
*
|
||||
* @param array $userData - user data from e107_user. ie. user_image, user_id etc.
|
||||
* @param array $options
|
||||
* @param int $options ['w'] - image width in px
|
||||
@@ -4237,6 +4300,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Display an icon.
|
||||
*
|
||||
* @param string $icon
|
||||
* @example $tp->toIcon("{e_IMAGES}icons/something.png");
|
||||
*/
|
||||
@@ -4326,6 +4390,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Render an img tag.
|
||||
*
|
||||
* @param string $file
|
||||
* @param array $parm keys: legacy|w|h|alt|class|id|crop|loading
|
||||
* @param array $parm ['legacy'] Usually a legacy path like {e_FILE}
|
||||
@@ -4498,6 +4563,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Check if a string contains bbcode.
|
||||
*
|
||||
* @param $text
|
||||
* @return bool
|
||||
*/
|
||||
@@ -4533,6 +4599,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Check if a string is HTML
|
||||
*
|
||||
* @param $text
|
||||
* @return bool
|
||||
*/
|
||||
@@ -4567,6 +4634,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Check if string is json and parse or return false.
|
||||
*
|
||||
* @param $text
|
||||
* @return bool|mixed return false if not json, and json values if true.
|
||||
*/
|
||||
@@ -4636,6 +4704,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Check if a file is an video or not.
|
||||
*
|
||||
* @param $file string
|
||||
* @return boolean
|
||||
*/
|
||||
@@ -4655,6 +4724,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Check if a file is an image or not.
|
||||
*
|
||||
* @param $file string
|
||||
* @return boolean
|
||||
*/
|
||||
@@ -4707,6 +4777,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Display a Video file.
|
||||
*
|
||||
* @param string $file - format: id.type eg. x123dkax.youtube
|
||||
* @param boolean $thumbnail - set to 'tag' to return an image thumbnail and 'src' to return the src url or 'video' for a small video thumbnail.
|
||||
*/
|
||||
@@ -4865,6 +4936,7 @@ class e_parse
|
||||
/**
|
||||
* Display a Date in the browser.
|
||||
* Includes support for 'livestamp' (http://mattbradley.github.io/livestampjs/)
|
||||
*
|
||||
* @param integer $datestamp - unix timestamp
|
||||
* @param string $format - short | long | relative
|
||||
* @return string converted date (html)
|
||||
@@ -4887,6 +4959,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Parse new <x-bbcode> tags into bbcode output.
|
||||
*
|
||||
* @param bool $retainTags : when you want to replace html and retain the <bbcode> tags wrapping it.
|
||||
* @return string html
|
||||
*/
|
||||
@@ -5012,6 +5085,7 @@ class e_parse
|
||||
$filter = function($element) use ($filter)
|
||||
{
|
||||
$element = (string) $element;
|
||||
|
||||
return is_callable($filter) ? $filter($element) : filter_var($element, $filter);
|
||||
};
|
||||
if (is_array($text))
|
||||
@@ -5058,6 +5132,7 @@ class e_parse
|
||||
/**
|
||||
* Process and clean HTML from user input.
|
||||
* TODO Html5 tag support.
|
||||
*
|
||||
* @param string $html raw HTML
|
||||
* @param boolean $checkPref
|
||||
* @return string
|
||||
@@ -5306,6 +5381,7 @@ class e_parse
|
||||
|
||||
/**
|
||||
* Check for Invalid Attribute Values
|
||||
*
|
||||
* @param $value string
|
||||
* @return bool true/false
|
||||
*/
|
||||
|
@@ -79,6 +79,11 @@ class e_form
|
||||
|
||||
protected $_required_string;
|
||||
|
||||
/**
|
||||
* @var e_parse
|
||||
*/
|
||||
private $tp;
|
||||
|
||||
public function __construct($enable_tabindex = false)
|
||||
{
|
||||
e107::loadAdminIcons(); // required below.
|
||||
@@ -103,6 +108,8 @@ class e_form
|
||||
}
|
||||
|
||||
$this->_helptip = (int) e107::getPref('admin_helptip', 1);
|
||||
|
||||
$this->tp = e107::getParser();
|
||||
}
|
||||
|
||||
|
||||
@@ -1011,7 +1018,7 @@ class e_form
|
||||
// XXX - $name ?!
|
||||
// $parms = $name."|".$width."|".$height."|".$id;
|
||||
$sc_parameters = 'mode=preview&default='.$default.'&id='.$id;
|
||||
return e107::getParser()->parseTemplate('{ICONPICKER=' .$sc_parameters. '}');
|
||||
return $this->tp->parseTemplate('{ICONPICKER=' .$sc_parameters. '}');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1175,8 +1182,7 @@ class e_form
|
||||
*/
|
||||
public function avatarpicker($name, $curVal='', $options=array())
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
$pref = e107::getPref();
|
||||
|
||||
$attr = 'aw=' .$pref['im_width']. '&ah=' .$pref['im_height'];
|
||||
@@ -1254,7 +1260,7 @@ class e_form
|
||||
{
|
||||
$EAVATAR = e_AVATAR_DEFAULT;
|
||||
$text .= "<div class='alert alert-danger'>";
|
||||
$text .= e107::getParser()->lanVars(e107::getParser()->toHTML(LAN_EFORM_006, true), array('x'=>$EAVATAR));
|
||||
$text .= $this->tp->lanVars($this->tp->toHTML(LAN_EFORM_006, true), array('x'=>$EAVATAR));
|
||||
$text .= '</div>';
|
||||
}
|
||||
|
||||
@@ -1310,12 +1316,6 @@ class e_form
|
||||
*/
|
||||
public function imagepicker($name, $default, $previewURL = '', $sc_parameters = '')
|
||||
{
|
||||
|
||||
// $tp = e107::getParser();
|
||||
|
||||
// $name_id = $this->name2id($name);
|
||||
// $meta_id = $name_id."-meta";
|
||||
|
||||
if(is_string($sc_parameters))
|
||||
{
|
||||
if(strpos($sc_parameters, '=') === false)
|
||||
@@ -1373,9 +1373,7 @@ class e_form
|
||||
*/
|
||||
public function mediapicker($name, $default, $parms = '')
|
||||
{
|
||||
|
||||
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
$name_id = $this->name2id($name);
|
||||
$meta_id = $name_id. '-meta';
|
||||
|
||||
@@ -1601,7 +1599,7 @@ class e_form
|
||||
*/
|
||||
public function filepicker($name, $default, $label = '', $sc_parameters = null)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
$name_id = $this->name2id($name);
|
||||
unset($label);
|
||||
|
||||
@@ -2693,7 +2691,7 @@ class e_form
|
||||
{
|
||||
$key = $label;
|
||||
//print_a($label);
|
||||
$c = in_array($label, e107::getParser()->toDB($checked)) ? true : false;
|
||||
$c = in_array($label, $this->tp->toDB($checked));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3297,7 +3295,7 @@ class e_form
|
||||
*/
|
||||
public function search($name, $searchVal, $submitName, $filterName='', $filterArray=false, $filterVal=false)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
|
||||
$text = '<span class="input-append input-group e-search">
|
||||
'.$this->text($name, $searchVal,20,'class=search-query&placeholder='.LAN_SEARCH.'…').'
|
||||
@@ -3623,7 +3621,7 @@ var_dump($select_options);*/
|
||||
|
||||
public function submit_image($name, $value, $image, $title='', $options = array())
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
|
||||
if(!empty($options['icon']))
|
||||
{
|
||||
@@ -3758,7 +3756,7 @@ var_dump($select_options);*/
|
||||
else
|
||||
{
|
||||
$fallbackIcon = '<svg class="svg-inline--fa fa-home fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) --><path d="M280.37 148.26L96 300.11V464a16 16 0 0 0 16 16l112.06-.29a16 16 0 0 0 15.92-16V368a16 16 0 0 1 16-16h64a16 16 0 0 1 16 16v95.64a16 16 0 0 0 16 16.05L464 480a16 16 0 0 0 16-16V300L295.67 148.26a12.19 12.19 0 0 0-15.3 0zM571.6 251.47L488 182.56V44.05a12 12 0 0 0-12-12h-56a12 12 0 0 0-12 12v72.61L318.47 43a48 48 0 0 0-61 0L4.34 251.47a12 12 0 0 0-1.6 16.9l25.5 31A12 12 0 0 0 45.15 301l235.22-193.74a12.19 12.19 0 0 1 15.3 0L530.9 301a12 12 0 0 0 16.9-1.6l25.5-31a12 12 0 0 0-1.7-16.93z"></path></svg>';
|
||||
$homeIcon = ($this->_fontawesome) ? e107::getParser()->toGlyph('fa-home.glyph') : $fallbackIcon;
|
||||
$homeIcon = ($this->_fontawesome) ? $this->tp->toGlyph('fa-home.glyph') : $fallbackIcon;
|
||||
}
|
||||
|
||||
|
||||
@@ -3812,7 +3810,7 @@ var_dump($select_options);*/
|
||||
'target' => '_blank',
|
||||
'title' => LAN_EDIT,
|
||||
'href' => $url,
|
||||
]) . ">" . e107::getParser()->toGlyph('fa-edit') . '</a></span>';
|
||||
]) . ">" . $this->tp->toGlyph('fa-edit') . '</a></span>';
|
||||
}
|
||||
|
||||
return '';
|
||||
@@ -4037,22 +4035,7 @@ var_dump($select_options);*/
|
||||
*/
|
||||
private function attributes($attributes)
|
||||
{
|
||||
$stringifiedAttributes = [];
|
||||
|
||||
foreach ($attributes as $key => $value)
|
||||
{
|
||||
|
||||
if ($value === true && (strpos($key,'data-') !== 0))
|
||||
{
|
||||
$value = $key;
|
||||
}
|
||||
if (!empty($value) || is_numeric($value) || $key === "value" || strpos($key,'data-') === 0)
|
||||
{
|
||||
$stringifiedAttributes[] = $key . "='" . htmlspecialchars((string) $value, ENT_QUOTES) . "'";
|
||||
}
|
||||
}
|
||||
|
||||
return count($stringifiedAttributes) > 0 ? " ".implode(" ", $stringifiedAttributes) : "";
|
||||
return $this->tp->toAttributes($attributes, true);
|
||||
}
|
||||
|
||||
public function get_attributes($options, $name = '', $value = '')
|
||||
@@ -4454,7 +4437,6 @@ var_dump($select_options);*/
|
||||
|
||||
public function thead($fieldarray, $columnPref = array(), $querypattern = '', $requeststr = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$text = '';
|
||||
|
||||
$querypattern = strip_tags($querypattern);
|
||||
@@ -4631,7 +4613,7 @@ var_dump($select_options);*/
|
||||
|
||||
|
||||
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
|
||||
$types = explode(',',$parm['types']);
|
||||
$list = array();
|
||||
@@ -4857,7 +4839,7 @@ var_dump($select_options);*/
|
||||
}
|
||||
}
|
||||
|
||||
$source = e107::getParser()->toJSON($jsonArray, true);
|
||||
$source = $this->tp->toJSON($jsonArray, true);
|
||||
|
||||
$mode = preg_replace('/[\W]/', '', vartrue($_GET['mode']));
|
||||
|
||||
@@ -4946,7 +4928,7 @@ var_dump($select_options);*/
|
||||
}
|
||||
elseif (!empty($model)) // old way.
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
|
||||
$data = $model->getData();
|
||||
|
||||
@@ -4994,7 +4976,7 @@ var_dump($select_options);*/
|
||||
|
||||
private function renderOptions($parms, $id, $attributes)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
$cls = false;
|
||||
|
||||
$editIconDefault = deftrue('ADMIN_EDIT_ICON', $tp->toGlyph('fa-edit'));
|
||||
@@ -5134,7 +5116,7 @@ var_dump($select_options);*/
|
||||
}
|
||||
|
||||
// @see custom fields in cpage which accept json params.
|
||||
if(!empty($attributes['writeParms']) && $tmpOpt = e107::getParser()->isJSON($attributes['writeParms']))
|
||||
if(!empty($attributes['writeParms']) && $tmpOpt = $this->tp->isJSON($attributes['writeParms']))
|
||||
{
|
||||
$attributes['writeParms'] = $tmpOpt;
|
||||
unset($tmpOpt);
|
||||
@@ -5158,7 +5140,7 @@ var_dump($select_options);*/
|
||||
|
||||
$this->renderValueTrigger($field, $value, $parms, $id);
|
||||
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
switch($field) // special fields
|
||||
{
|
||||
case 'options':
|
||||
@@ -5602,7 +5584,7 @@ var_dump($select_options);*/
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = e107::getParser()->replaceConstants($value, 'full');
|
||||
$url = $this->tp->replaceConstants($value, 'full');
|
||||
}
|
||||
$name = basename($value);
|
||||
$value = '<a href="'.$url.'" title="Direct link to '.$name.'" rel="external">'.$name.'</a>';
|
||||
@@ -5640,7 +5622,7 @@ var_dump($select_options);*/
|
||||
|
||||
$vparm = array('thumb'=>'tag','w'=> vartrue($parms['thumb_aw'],'80'));
|
||||
|
||||
if($video = e107::getParser()->toVideo($value,$vparm))
|
||||
if($video = $tp->toVideo($value,$vparm))
|
||||
{
|
||||
return $video;
|
||||
}
|
||||
@@ -5653,7 +5635,7 @@ var_dump($select_options);*/
|
||||
$icon = '{e_IMAGE}filemanager/zip_32.png';
|
||||
$src = $tp->replaceConstants(vartrue($parms['pre']).$icon, 'abs');
|
||||
// return $value;
|
||||
return e107::getParser()->toGlyph('fa-file','size=2x');
|
||||
return $tp->toGlyph('fa-file','size=2x');
|
||||
// return '<img src="'.$src.'" alt="'.$value.'" class="e-thumb" title="'.$value.'" />';
|
||||
}
|
||||
|
||||
@@ -6275,7 +6257,7 @@ var_dump($select_options);*/
|
||||
$value = html_entity_decode($value, ENT_QUOTES);
|
||||
}
|
||||
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
$ret = '';
|
||||
|
||||
$parms = vartrue($attributes['writeParms'], array());
|
||||
@@ -6498,7 +6480,7 @@ var_dump($select_options);*/
|
||||
|
||||
if(!empty($parms['maxlength']) && empty($parms['post']))
|
||||
{
|
||||
$charMsg = e107::getParser()->lanVars(defset('LAN_X_CHARS_REMAINING', '[x] chars remaining'), "<span>" . $parms['maxlength'] . "</span>");
|
||||
$charMsg = $tp->lanVars(defset('LAN_X_CHARS_REMAINING', '[x] chars remaining'), "<span>" . $parms['maxlength'] . "</span>");
|
||||
$parms['post'] = "<small" . $this->attributes([
|
||||
'id' => $this->name2id($key) . "-char-count",
|
||||
'class' => 'text-muted',
|
||||
@@ -6928,7 +6910,7 @@ var_dump($select_options);*/
|
||||
case 'upload': //TODO - from method
|
||||
// TODO uploadfile SC is now processing uploads as well (add it to admin UI), write/readParms have to be added (see uploadfile.php parms)
|
||||
$disbut = varset($parms['disable_button'], '0');
|
||||
$ret = $tp->parseTemplate('{UPLOADFILE=' .(vartrue($parms['path']) ? e107::getParser()->replaceConstants($parms['path']) : e_UPLOAD)."|nowarn&trigger=etrigger_uploadfiles&disable_button={$disbut}}");
|
||||
$ret = $tp->parseTemplate('{UPLOADFILE=' .(vartrue($parms['path']) ? $tp->replaceConstants($parms['path']) : e_UPLOAD)."|nowarn&trigger=etrigger_uploadfiles&disable_button={$disbut}}");
|
||||
break;
|
||||
|
||||
case 'hidden':
|
||||
@@ -7014,7 +6996,7 @@ var_dump($select_options);*/
|
||||
foreach($parms['optArray'] as $key=>$val)
|
||||
{
|
||||
|
||||
$thumbnail = e107::getParser()->toImage($val['thumbnail'], $parms);
|
||||
$thumbnail = $this->tp->toImage($val['thumbnail'], $parms);
|
||||
$active = ($key === $value) ? ' active' : '';
|
||||
|
||||
$text .= "<div class='e-image-radio " . $class . "' >
|
||||
@@ -7055,7 +7037,7 @@ var_dump($select_options);*/
|
||||
foreach($parms['optArray'] as $key=>$val)
|
||||
{
|
||||
|
||||
$thumbnail = e107::getParser()->toImage($val,$parms);
|
||||
$thumbnail = $this->tp->toImage($val,$parms);
|
||||
$text .= "
|
||||
<div class='col-md-2 e-image-radio' >
|
||||
<label" . $this->attributes([
|
||||
@@ -7122,7 +7104,7 @@ var_dump($select_options);*/
|
||||
*/
|
||||
public function renderListForm($form_options, $tree_models, $nocontainer = false)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
$text = '';
|
||||
$formPre = '';
|
||||
$formPost = '';
|
||||
@@ -7294,7 +7276,7 @@ var_dump($select_options);*/
|
||||
*/
|
||||
public function renderGridForm($form_options, $tree_models, $nocontainer = false)
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$tp = $this->tp;
|
||||
$text = '';
|
||||
|
||||
|
||||
@@ -7516,7 +7498,7 @@ var_dump($select_options);*/
|
||||
}
|
||||
|
||||
$query = isset($form['query']) ? $form['query'] : e_QUERY ;
|
||||
$url = (isset($form['url']) ? e107::getParser()->replaceConstants($form['url'], 'abs') : e_SELF).($query ? '?'.$query : '');
|
||||
$url = (isset($form['url']) ? $this->tp->replaceConstants($form['url'], 'abs') : e_SELF).($query ? '?'.$query : '');
|
||||
$curTab = (string) varset($_GET['tab'], '0');
|
||||
|
||||
$text .= "
|
||||
@@ -7902,7 +7884,7 @@ var_dump($select_options);*/
|
||||
foreach ($forms as $fid => $form)
|
||||
{
|
||||
$query = isset($form['query']) ? $form['query'] : e_QUERY ;
|
||||
$url = (isset($form['url']) ? e107::getParser()->replaceConstants($form['url'], 'abs') : e_SELF).($query ? '?'.$query : '');
|
||||
$url = (isset($form['url']) ? $this->tp->replaceConstants($form['url'], 'abs') : e_SELF).($query ? '?'.$query : '');
|
||||
|
||||
$text .= '
|
||||
' .vartrue($form['form_pre'])."
|
||||
|
@@ -14,10 +14,14 @@
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
if (!defined('e107_INIT'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
e107::plugLan('download', 'front', true);
|
||||
|
||||
|
||||
/**
|
||||
* download_shortcodes
|
||||
*/
|
||||
@@ -35,11 +39,44 @@ class download_shortcodes extends e_shortcode
|
||||
/**
|
||||
* download_shortcodes constructor
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->pref = e107::getPref();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the download agreement text as an HTML-stripped JSON string
|
||||
*
|
||||
* Configured in Admin-UI at `/e107_plugins/download/admin_download.php?mode=main&action=settings`
|
||||
*
|
||||
* @return string|null JSON string with the contents of the "agree_text" pref reformatted without HTML
|
||||
* {@see null} if the "agree_flag" pref is not truthy or if the formatted "agree_text" is empty.
|
||||
*/
|
||||
private function getAgreeTextAsHtmlAttributeJsonString()
|
||||
{
|
||||
if (!isset($this->pref['agree_flag']) || !$this->pref['agree_flag']) return null;
|
||||
|
||||
$rawAgreeText = isset($this->pref['agree_text']) ? $this->pref['agree_text'] : "";
|
||||
$tp = e107::getParser();
|
||||
$agreeText = $tp->toJSON($tp->toText($rawAgreeText), true);
|
||||
|
||||
if (!$agreeText) return null;
|
||||
|
||||
return $agreeText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap the formatted download agreement text into an HTML JavaScript event that calls `confirm()`
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getAgreeTextAsHtmlEventAttribute()
|
||||
{
|
||||
$maybeJson = $this->getAgreeTextAsHtmlAttributeJsonString();
|
||||
|
||||
return empty($maybeJson) ? "" : "return confirm($maybeJson);";
|
||||
}
|
||||
|
||||
public function breadcrumb()
|
||||
{
|
||||
@@ -107,16 +144,18 @@ class download_shortcodes extends e_shortcode
|
||||
if (!empty($this->var['d_count']))
|
||||
{
|
||||
$url = e107::url('download', 'category', $this->var);
|
||||
return "<a href='".$url."'>".$tp->toHTML($this->var['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
|
||||
return "<a href='" . $url . "'>" . $tp->toHTML($this->var['download_category_name'], false, 'TITLE') . "</a>";
|
||||
}
|
||||
|
||||
return $tp->toHTML($this->var['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->var['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
|
||||
public function sc_download_cat_main_description()
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
return $tp->toHTML($this->var['download_category_description'], TRUE, 'DESCRIPTION');
|
||||
|
||||
return $tp->toHTML($this->var['download_category_description'], true, 'DESCRIPTION');
|
||||
}
|
||||
|
||||
public function sc_download_cat_main_icon()
|
||||
@@ -160,18 +199,19 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
if ($parm == 'raw')
|
||||
{
|
||||
return $tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->dlsubrow['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
|
||||
if (!empty($this->dlsubrow['d_count']))
|
||||
{
|
||||
$url = e107::url('download', 'category', $this->dlsubrow);
|
||||
return "<a class='".$class."' href='".$url."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
|
||||
return "<a class='" . $class . "' href='" . $url . "'>" . $tp->toHTML($this->dlsubrow['download_category_name'], false, 'TITLE') . "</a>";
|
||||
// return "<a class='".$class."' href='".e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubrow['download_category_id']."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
}
|
||||
elseif (isset($this->dlsubrow['download_category_name']))
|
||||
{
|
||||
return $tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->dlsubrow['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +222,7 @@ class download_shortcodes extends e_shortcode
|
||||
return null;
|
||||
}
|
||||
|
||||
return e107::getParser()->toHTML($this->dlsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
||||
return e107::getParser()->toHTML($this->dlsubrow['download_category_description'], true, 'DESCRIPTION');
|
||||
}
|
||||
|
||||
function sc_download_cat_sub_icon()
|
||||
@@ -239,7 +279,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
if ($parm == 'raw')
|
||||
{
|
||||
return $tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->dlsubsubrow['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
|
||||
if (!empty($this->dlsubsubrow['d_count']))
|
||||
@@ -247,11 +287,11 @@ class download_shortcodes extends e_shortcode
|
||||
$url = e107::url('download', 'category', $this->dlsubsubrow);
|
||||
// /list/category', array('id'=>$this->dlsubsubrow['download_category_id'], 'name'=> vartrue($this->dlsubsubrow['download_category_sef'],'--sef-not-set--')));
|
||||
// e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubsubrow['download_category_id']
|
||||
return "<a class='".$class."' href='".$url."'>".$tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
|
||||
return "<a class='" . $class . "' href='" . $url . "'>" . $tp->toHTML($this->dlsubsubrow['download_category_name'], false, 'TITLE') . "</a>";
|
||||
}
|
||||
elseif (!empty($this->dlsubsubrow['download_category_name']))
|
||||
{
|
||||
return $tp->toHTML($this->dlsubsubrow['download_category_name'], FALSE, 'TITLE');
|
||||
return $tp->toHTML($this->dlsubsubrow['download_category_name'], false, 'TITLE');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,7 +302,7 @@ class download_shortcodes extends e_shortcode
|
||||
return null;
|
||||
}
|
||||
|
||||
return e107::getParser()->toHTML($this->dlsubsubrow['download_category_description'], TRUE, 'DESCRIPTION');
|
||||
return e107::getParser()->toHTML($this->dlsubsubrow['download_category_description'], true, 'DESCRIPTION');
|
||||
}
|
||||
|
||||
function sc_download_cat_subsub_icon()
|
||||
@@ -361,36 +401,42 @@ class download_shortcodes extends e_shortcode
|
||||
}
|
||||
|
||||
|
||||
|
||||
function sc_download_list_name($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
|
||||
if ($parm == "nolink")
|
||||
{
|
||||
return $tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT');
|
||||
return $tp->toHTML($this->var['download_name'], true, 'LINKTEXT');
|
||||
}
|
||||
|
||||
if ($parm == "request")
|
||||
{
|
||||
$agreetext = $tp->toAttribute($tp->toJSON($tp->toText($this->pref['agree_text'],FALSE,'DESCRIPTION'), 'str'));
|
||||
$agreeTextJs = $this->getAgreeTextAsHtmlEventAttribute();
|
||||
|
||||
if ($this->var['download_mirror_type'])
|
||||
{
|
||||
$text = ($this->pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' onclick= \"return confirm({$agreetext});\">" : "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
|
||||
$href = e_PLUGIN_ABS . "download/download.php?mirror." . $this->var['download_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = ($this->pref['agree_flag'] ? "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm({$agreetext});\">" : "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_DOWNLOAD."'>");
|
||||
$href = e_PLUGIN_ABS . "download/request.php?" . $this->var['download_id'];
|
||||
}
|
||||
|
||||
$text .= $tp->toHTML($this->var['download_name'], FALSE, 'TITLE')."</a>";
|
||||
$text = "<a" . $tp->toAttributes([
|
||||
"href" => $href,
|
||||
"onclick" => $agreeTextJs,
|
||||
"title" => defined("LAN_DOWNLOAD") ? LAN_DOWNLOAD : null,
|
||||
]) . ">";
|
||||
|
||||
$text .= $tp->toHTML($this->var['download_name'], false, 'TITLE') . "</a>";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
$url = e107::url('download', 'item', $this->var);
|
||||
return "<a href='".$url."'>".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT')."</a>";
|
||||
|
||||
return "<a href='" . $url . "'>" . $tp->toHTML($this->var['download_name'], true, 'LINKTEXT') . "</a>";
|
||||
|
||||
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT')."</a>";
|
||||
}
|
||||
@@ -425,6 +471,7 @@ class download_shortcodes extends e_shortcode
|
||||
{
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
return $tp->toDate($this->var['download_datestamp'], "short");
|
||||
}
|
||||
|
||||
@@ -449,6 +496,7 @@ class download_shortcodes extends e_shortcode
|
||||
if ($parm == "link" && $this->var['download_thumb'])
|
||||
{
|
||||
$url = e107::url('download', 'item', $this->var);
|
||||
|
||||
return "<a href='" . $url . "'>" . $img . "</a>";
|
||||
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
|
||||
}
|
||||
@@ -473,8 +521,6 @@ class download_shortcodes extends e_shortcode
|
||||
$tp = e107::getParser();
|
||||
$img = '';
|
||||
|
||||
$agreetext = !empty($this->pref['agree_text']) ? $tp->toAttribute($tp->toJSON($tp->toText($this->pref['agree_text'],FALSE,'DESCRIPTION'), 'str')) : '';
|
||||
|
||||
if (defined('IMAGE_DOWNLOAD'))
|
||||
{
|
||||
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_DOWNLOAD . "' />";
|
||||
@@ -486,17 +532,14 @@ class download_shortcodes extends e_shortcode
|
||||
// $img = '<i class="icon-download"></i>';
|
||||
}
|
||||
|
||||
if ($this->var['download_mirror_type'])
|
||||
{
|
||||
return "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."'>{$img}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true, $this); // $this->sc_download_request_url();
|
||||
return (!empty($this->pref['agree_flag']) ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' onclick= \"return confirm({$agreetext});\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".$url."' >{$img}</a>");
|
||||
|
||||
// return ($this->pref['agree_flag'] ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
|
||||
}
|
||||
return "<a" . $tp->toAttributes([
|
||||
"class" => "e-tip",
|
||||
"title" => defined("LAN_DOWNLOAD") ? LAN_DOWNLOAD : null,
|
||||
"href" => $this->var['download_mirror_type'] ?
|
||||
e_PLUGIN_ABS . "download/download.php?mirror." . $this->var['download_id'] :
|
||||
$tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this),
|
||||
"onclick" => $this->getAgreeTextAsHtmlEventAttribute(),
|
||||
]) . ">$img</a>";
|
||||
}
|
||||
|
||||
|
||||
@@ -554,6 +597,7 @@ class download_shortcodes extends e_shortcode
|
||||
if ($parm == "link" && $this->var['download_image'])
|
||||
{
|
||||
$url = e107::url('download', 'item', $this->var);
|
||||
|
||||
return "<a title=\"" . LAN_dl_53 . "\" href='" . $url . "'>" . $img . "</a>";
|
||||
|
||||
// return "<a title=\"".LAN_dl_53."\" href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
|
||||
@@ -568,24 +612,25 @@ class download_shortcodes extends e_shortcode
|
||||
function sc_download_list_nextprev()
|
||||
{
|
||||
global $nextprev_parms;
|
||||
|
||||
return e107::getParser()->parseTemplate("{NEXTPREV={$nextprev_parms}}");
|
||||
}
|
||||
|
||||
function sc_download_list_total_amount()
|
||||
{
|
||||
global $dltdownloads;
|
||||
|
||||
return intval($dltdownloads) . " " . LAN_dl_16;
|
||||
}
|
||||
|
||||
function sc_download_list_total_files()
|
||||
{
|
||||
global $dlft;
|
||||
|
||||
return intval($dlft) . " " . strtolower(LAN_FILES);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// View ****************************************************************************************
|
||||
|
||||
|
||||
@@ -622,6 +667,7 @@ class download_shortcodes extends e_shortcode
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
function sc_download_view_name($parm = '')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
@@ -649,19 +695,13 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
$tp = e107::getParser();
|
||||
|
||||
$url = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); //$this->sc_download_request_url();
|
||||
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this); //$this->sc_download_request_url();
|
||||
|
||||
if (!empty($this->pref['agree_flag']))
|
||||
{
|
||||
return "<a href='".$url."' onclick= \"return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))).");\" title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<a href='".$url."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
|
||||
|
||||
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
||||
}
|
||||
return "<a" . $tp->toAttributes([
|
||||
"href" => $url,
|
||||
"onclick" => $this->getAgreeTextAsHtmlEventAttribute(),
|
||||
"title" => defined('LAN_dl_46') ? LAN_dl_46 : null,
|
||||
]) . ">{$this->var['download_name']}</a>";
|
||||
}
|
||||
|
||||
function sc_download_view_author()
|
||||
@@ -671,18 +711,18 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_view_authoremail()
|
||||
{
|
||||
return !empty($this->var['download_author_email']) ? e107::getParser()->toHTML($this->var['download_author_email'], TRUE, 'LINKTEXT') : "";
|
||||
return !empty($this->var['download_author_email']) ? e107::getParser()->toHTML($this->var['download_author_email'], true, 'LINKTEXT') : "";
|
||||
}
|
||||
|
||||
function sc_download_view_authorwebsite()
|
||||
{
|
||||
return !empty($this->var['download_author_website']) ? e107::getParser()->toHTML($this->var['download_author_website'], TRUE,'LINKTEXT') : "";
|
||||
return !empty($this->var['download_author_website']) ? e107::getParser()->toHTML($this->var['download_author_website'], true, 'LINKTEXT') : "";
|
||||
}
|
||||
|
||||
function sc_download_view_description($parm = '')
|
||||
{
|
||||
$maxlen = ($parm ? intval($parm) : 0);
|
||||
$text = ($this->var['download_description'] ? e107::getParser()->toHTML($this->var['download_description'], TRUE, 'DESCRIPTION') : "");
|
||||
$text = ($this->var['download_description'] ? e107::getParser()->toHTML($this->var['download_description'], true, 'DESCRIPTION') : "");
|
||||
|
||||
if ($maxlen)
|
||||
{
|
||||
@@ -797,35 +837,23 @@ class download_shortcodes extends e_shortcode
|
||||
$img = e107::getParser()->toGlyph('fa-download', $parm); // '<i class="icon-download"></i>';
|
||||
}
|
||||
|
||||
if(!empty($this->pref['agree_flag']))
|
||||
{
|
||||
$click = " onclick='return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],true,'emotes, no_tags'))).")'";
|
||||
}
|
||||
|
||||
$url = $url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true,$this); //$this->sc_download_request_url();
|
||||
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this); //$this->sc_download_request_url();
|
||||
|
||||
if (varset($parm['type']) == 'href')
|
||||
{
|
||||
return $url;
|
||||
}
|
||||
|
||||
$dnld_link = "<a href='".$url."'{$click}>";
|
||||
if ($this->var['download_mirror'] && $this->var['download_mirror_type'])
|
||||
{
|
||||
$url = e_PLUGIN_ABS . "download/download.php?mirror." . $this->var['download_id'];
|
||||
$img = defined('LAN_dl_66') ? LAN_dl_66 : "Select download mirror";
|
||||
}
|
||||
|
||||
if ($this->var['download_mirror'])
|
||||
{
|
||||
if ($this->var['download_mirror_type'])
|
||||
{
|
||||
return "<a href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."'>".LAN_dl_66."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $dnld_link.$img."</a>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return $dnld_link.$img."</a>";
|
||||
}
|
||||
return "<a" . $tp->toAttributes([
|
||||
"href" => $url,
|
||||
"onclick" => $this->getAgreeTextAsHtmlEventAttribute()
|
||||
]) . ">$img</a>";
|
||||
}
|
||||
|
||||
function sc_download_view_filesize()
|
||||
@@ -838,6 +866,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
$frm = e107::getForm();
|
||||
$options = array('label' => ' ', 'template' => 'RATE|VOTES|STATUS');
|
||||
|
||||
return $frm->rate("download", $this->var['download_id'], $options);
|
||||
|
||||
/*
|
||||
@@ -884,6 +913,7 @@ class download_shortcodes extends e_shortcode
|
||||
{
|
||||
//$url = e_PLUGIN_ABS."download/download.php?action=report&id=".$this->var['download_id'];
|
||||
$url = e107::url('download', 'report', $this->var);
|
||||
|
||||
return "<a href='" . $url . "'>" . LAN_dl_45 . "</a>";
|
||||
}
|
||||
|
||||
@@ -894,6 +924,7 @@ class download_shortcodes extends e_shortcode
|
||||
{
|
||||
$text = $this->var['download_category_name'];
|
||||
$text .= ($this->var['download_category_description']) ? " [ " . $this->var['download_category_description'] . " ]" : "";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
@@ -932,7 +963,7 @@ class download_shortcodes extends e_shortcode
|
||||
|
||||
function sc_download_mirror_description()
|
||||
{
|
||||
return !empty($this->mirror['dlmirror']['mirror_description']) ? e107::getParser()->toHTML($this->mirror['dlmirror']['mirror_description'], TRUE) : '';
|
||||
return !empty($this->mirror['dlmirror']['mirror_description']) ? e107::getParser()->toHTML($this->mirror['dlmirror']['mirror_description'], true) : '';
|
||||
}
|
||||
|
||||
function sc_download_mirror_filesize()
|
||||
@@ -955,8 +986,6 @@ class download_shortcodes extends e_shortcode
|
||||
$tp = e107::getParser();
|
||||
$img = '';
|
||||
|
||||
$click = !empty($this->pref['agree_text']) ? " onclick='return confirm(".$tp->toAttribute($tp->toJSON($tp->toHTML($this->pref['agree_text'],FALSE,'DESCRIPTION'))).")'" : '';
|
||||
|
||||
if (defined('IMAGE_DOWNLOAD'))
|
||||
{
|
||||
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_DOWNLOAD . "' />";
|
||||
@@ -966,7 +995,11 @@ class download_shortcodes extends e_shortcode
|
||||
$img = '<i class="icon-download"></i>';
|
||||
}
|
||||
|
||||
return "<a href='".e_PLUGIN_ABS."download/download.php?mirror.{$this->var['download_id']}.{$this->mirror['dlmirrorfile'][0]}' title='".LAN_DOWNLOAD."' {$click}>".$img."</a>";
|
||||
return "<a" . $tp->toAttributes([
|
||||
"href" => e_PLUGIN_ABS . "download/download.php?mirror.{$this->var['download_id']}.{$this->mirror['dlmirrorfile'][0]}",
|
||||
"title" => LAN_DOWNLOAD,
|
||||
"onclick" => $this->getAgreeTextAsHtmlEventAttribute(),
|
||||
]) . ">" . $img . "</a>";
|
||||
}
|
||||
|
||||
function sc_download_mirror_requests()
|
||||
@@ -1071,6 +1104,7 @@ class download_shortcodes extends e_shortcode
|
||||
else
|
||||
{
|
||||
$class .= ' disabled';
|
||||
|
||||
return "<a class='" . $class . "' href='#' >" . $icon . " " . LAN_PREVIOUS . "</a>\n";
|
||||
}
|
||||
}
|
||||
@@ -1093,8 +1127,6 @@ class download_shortcodes extends e_shortcode
|
||||
$url = $url = e107::url('download', 'item', $dlrowrow);
|
||||
|
||||
|
||||
|
||||
|
||||
return "<a class='" . $class . "' href='" . $url . "' title=\"" . $dlrowrow['download_name'] . "\">" . LAN_NEXT . " " . $icon . "</a>\n";
|
||||
|
||||
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." >></a>\n";
|
||||
@@ -1102,6 +1134,7 @@ class download_shortcodes extends e_shortcode
|
||||
else
|
||||
{
|
||||
$class .= ' disabled';
|
||||
|
||||
return "<a class='" . $class . "' href='#' >" . LAN_NEXT . " " . $icon . "</a>\n";
|
||||
|
||||
}
|
||||
@@ -1175,7 +1208,6 @@ class download_shortcodes extends e_shortcode
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@@ -1185,6 +1217,7 @@ class download_shortcodes extends e_shortcode
|
||||
// list($ret[TRUE],$ret[FALSE]) = explode(chr(1), $source.chr(1)); //XXX ???
|
||||
// if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE]; //XXX ???
|
||||
$parms = array('legacy' => "{e_IMAGE}icons/");
|
||||
|
||||
return e107::getParser()->toIcon($source, $parms);
|
||||
//return "<img src='".e_IMAGE."icons/{$ret[($count!=0)]}' alt='*'/>";
|
||||
}
|
||||
|
@@ -90,7 +90,6 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -181,6 +180,7 @@ while($row = $sql->fetch())
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testUstrpos()
|
||||
{
|
||||
@@ -415,7 +415,6 @@ while($row = $sql->fetch())
|
||||
);
|
||||
|
||||
|
||||
|
||||
$ret = [];
|
||||
foreach ($list as $mod => $val)
|
||||
{
|
||||
@@ -437,7 +436,6 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
|
||||
|
||||
function testToHTMLWithBBcode()
|
||||
{
|
||||
$tests = array(
|
||||
@@ -485,7 +483,6 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testParseTemplateWithEnabledCoreShortcodes()
|
||||
@@ -644,6 +641,7 @@ while($row = $sql->fetch())
|
||||
$this->assertSame('[html]Something "hi"[/html]', $actual);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testUstristr()
|
||||
{
|
||||
@@ -669,7 +667,6 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testToNumber()
|
||||
@@ -780,6 +777,7 @@ while($row = $sql->fetch())
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testUstrlen()
|
||||
{
|
||||
@@ -967,8 +965,8 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
public function testToJSONhelper()
|
||||
@@ -1055,6 +1053,7 @@ while($row = $sql->fetch())
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testCheckHighlighting()
|
||||
{
|
||||
@@ -1094,6 +1093,7 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testHtmlwrap()
|
||||
{
|
||||
@@ -1252,11 +1252,8 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testParseBBCodes()
|
||||
{
|
||||
@@ -1277,12 +1274,93 @@ while($row = $sql->fetch())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testToAttribute()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
public function testToAttributeReplaceConstants()
|
||||
{
|
||||
$input = "This is e_THEME: {e_THEME}";
|
||||
$expected = "This is e_THEME: ./e107_themes/";
|
||||
|
||||
$actual = $this->tp->toAttribute($input);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testToAttributeDoesNotReplaceConstantsWhenStringHasSingleQuote()
|
||||
{
|
||||
$input = "This isn't e_THEME: {e_THEME}";
|
||||
$expected = "This isn't e_THEME: {e_THEME}";
|
||||
|
||||
$actual = $this->tp->toAttribute($input);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testToAttributeDoesReplaceConstantsWhenStringHasLeftAngleBracket()
|
||||
{
|
||||
$input = "{e_THEME} <-- e_THEME";
|
||||
$expected = "./e107_themes/ <-- e_THEME";
|
||||
|
||||
$actual = $this->tp->toAttribute($input);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testToAttributeExplicitPure()
|
||||
{
|
||||
$input = "{e_THEME} <-- Not e_THEME";
|
||||
$expected = "{e_THEME} <-- Not e_THEME";
|
||||
|
||||
$actual = $this->tp->toAttribute($input, true);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testToAttributeImplicitPure()
|
||||
{
|
||||
$input = "\"It's a Wonderful Life (1946)\"";
|
||||
$expected = ""It's a Wonderful Life (1946)"";
|
||||
|
||||
$actual = $this->tp->toAttribute($input);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testToAttributesEmpty()
|
||||
{
|
||||
$input = [];
|
||||
$expected = "";
|
||||
|
||||
$actual = $this->tp->toAttributes($input);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testToAttributesOne()
|
||||
{
|
||||
$input = ["href" => "https://e107.org"];
|
||||
$expected = " href='https://e107.org'";
|
||||
|
||||
$actual = $this->tp->toAttributes($input);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testToAttributesMixedPureAndReplaceConstants()
|
||||
{
|
||||
$input = [
|
||||
"href" => "{e_THEME}",
|
||||
"title" => "I would say, \"I'm the e_THEME folder!\"",
|
||||
"alt" => "'{e_THEME}'",
|
||||
];
|
||||
$expected = " href='./e107_themes/'" .
|
||||
" title='I would say, "I'm the e_THEME folder!"'" .
|
||||
" alt=''{e_THEME}''";
|
||||
|
||||
$actual = $this->tp->toAttributes($input);
|
||||
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
public function testThumbCacheFile()
|
||||
{
|
||||
$tests = array(
|
||||
@@ -1310,8 +1388,6 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testText_truncate()
|
||||
@@ -1352,6 +1428,7 @@ while($row = $sql->fetch())
|
||||
$this->assertSame('This is a long st...', $result);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testSetThumbSize()
|
||||
{
|
||||
@@ -1655,6 +1732,7 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testUstrtolower()
|
||||
{
|
||||
@@ -1713,8 +1791,8 @@ while($row = $sql->fetch())
|
||||
$this->tp->setStaticUrl(null);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testGetUrlConstants()
|
||||
{
|
||||
@@ -1761,6 +1839,7 @@ while($row = $sql->fetch())
|
||||
$result = $this->tp->getScriptAccess();
|
||||
$this->assertEquals(e_UC_PUBLIC, $result);
|
||||
}
|
||||
|
||||
/*
|
||||
public function testGetAllowedTags()
|
||||
{
|
||||
@@ -1991,8 +2070,6 @@ while($row = $sql->fetch())
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
$result = $this->tp->getAllowedAttributes();
|
||||
$this->assertSame($expected, $result);
|
||||
|
||||
@@ -2002,6 +2079,7 @@ while($row = $sql->fetch())
|
||||
|
||||
// $this->assertTrue($true);
|
||||
}
|
||||
|
||||
/*
|
||||
public function testSetScriptTags()
|
||||
{
|
||||
@@ -2123,8 +2201,6 @@ while($row = $sql->fetch())
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function testToGlyphFallback()
|
||||
@@ -2133,6 +2209,7 @@ while($row = $sql->fetch())
|
||||
$result = $this->tp->toGlyph('fa-paypal.glyph');
|
||||
$this->assertSame("<i class='fab fa-paypal' ></i> ", $result);
|
||||
}
|
||||
|
||||
/*
|
||||
public function testToBadge()
|
||||
{
|
||||
@@ -2315,8 +2392,6 @@ while($row = $sql->fetch())
|
||||
$this->assertStringContainsString('&type=webp', $result5); // src
|
||||
|
||||
|
||||
|
||||
|
||||
$tests = array(
|
||||
0 => array(
|
||||
'src' => '{e_PLUGIN}gallery/images/butterfly.jpg',
|
||||
@@ -2406,6 +2481,7 @@ while($row = $sql->fetch())
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testIsJSON()
|
||||
{
|
||||
@@ -2440,6 +2516,7 @@ Your browser does not support the audio tag.
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testToVideo()
|
||||
{
|
||||
@@ -2513,9 +2590,6 @@ Your browser does not support the audio tag.
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function testToDate()
|
||||
{
|
||||
|
||||
@@ -2538,8 +2612,8 @@ Your browser does not support the audio tag.
|
||||
$this->assertStringContainsString('<span>24-Feb-18</span>', $custom);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public function testParseBBTags()
|
||||
{
|
||||
|
Reference in New Issue
Block a user