mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
#4686: download_shortcodes
: Consistency for agreement text alert box
Extract all accesses of the `agree_text` pref and reformat the value into a JavaScript `alert()` box Uses the new `e_parse::toAttributes()` method Fixes: #4686
This commit is contained in:
@@ -14,10 +14,14 @@
|
|||||||
* $Author$
|
* $Author$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
e107::plugLan('download', 'front', true);
|
e107::plugLan('download', 'front', true);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* download_shortcodes
|
* download_shortcodes
|
||||||
*/
|
*/
|
||||||
@@ -35,11 +39,44 @@ class download_shortcodes extends e_shortcode
|
|||||||
/**
|
/**
|
||||||
* download_shortcodes constructor
|
* download_shortcodes constructor
|
||||||
*/
|
*/
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
parent::__construct();
|
||||||
$this->pref = e107::getPref();
|
$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()
|
public function breadcrumb()
|
||||||
{
|
{
|
||||||
@@ -107,16 +144,18 @@ class download_shortcodes extends e_shortcode
|
|||||||
if (!empty($this->var['d_count']))
|
if (!empty($this->var['d_count']))
|
||||||
{
|
{
|
||||||
$url = e107::url('download', 'category', $this->var);
|
$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()
|
public function sc_download_cat_main_description()
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$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()
|
public function sc_download_cat_main_icon()
|
||||||
@@ -160,18 +199,19 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
if ($parm == 'raw')
|
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']))
|
if (!empty($this->dlsubrow['d_count']))
|
||||||
{
|
{
|
||||||
$url = e107::url('download', 'category', $this->dlsubrow);
|
$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>";
|
// 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']))
|
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 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()
|
function sc_download_cat_sub_icon()
|
||||||
@@ -239,7 +279,7 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
if ($parm == 'raw')
|
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']))
|
if (!empty($this->dlsubsubrow['d_count']))
|
||||||
@@ -247,11 +287,11 @@ class download_shortcodes extends e_shortcode
|
|||||||
$url = e107::url('download', 'category', $this->dlsubsubrow);
|
$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--')));
|
// /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']
|
// 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']))
|
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 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()
|
function sc_download_cat_subsub_icon()
|
||||||
@@ -361,36 +401,42 @@ class download_shortcodes extends e_shortcode
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function sc_download_list_name($parm = '')
|
function sc_download_list_name($parm = '')
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
if ($parm == "nolink")
|
if ($parm == "nolink")
|
||||||
{
|
{
|
||||||
return $tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT');
|
return $tp->toHTML($this->var['download_name'], true, 'LINKTEXT');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($parm == "request")
|
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'])
|
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
|
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;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = e107::url('download', 'item', $this->var);
|
$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>";
|
// 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();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
return $tp->toDate($this->var['download_datestamp'], "short");
|
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'])
|
if ($parm == "link" && $this->var['download_thumb'])
|
||||||
{
|
{
|
||||||
$url = e107::url('download', 'item', $this->var);
|
$url = e107::url('download', 'item', $this->var);
|
||||||
|
|
||||||
return "<a href='" . $url . "'>" . $img . "</a>";
|
return "<a href='" . $url . "'>" . $img . "</a>";
|
||||||
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$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();
|
$tp = e107::getParser();
|
||||||
$img = '';
|
$img = '';
|
||||||
|
|
||||||
$agreetext = !empty($this->pref['agree_text']) ? $tp->toAttribute($tp->toJSON($tp->toText($this->pref['agree_text'],FALSE,'DESCRIPTION'), 'str')) : '';
|
|
||||||
|
|
||||||
if (defined('IMAGE_DOWNLOAD'))
|
if (defined('IMAGE_DOWNLOAD'))
|
||||||
{
|
{
|
||||||
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_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>';
|
// $img = '<i class="icon-download"></i>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->var['download_mirror_type'])
|
return "<a" . $tp->toAttributes([
|
||||||
{
|
"class" => "e-tip",
|
||||||
return "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/download.php?mirror.".$this->var['download_id']."'>{$img}</a>";
|
"title" => defined("LAN_DOWNLOAD") ? LAN_DOWNLOAD : null,
|
||||||
}
|
"href" => $this->var['download_mirror_type'] ?
|
||||||
else
|
e_PLUGIN_ABS . "download/download.php?mirror." . $this->var['download_id'] :
|
||||||
{
|
$tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this),
|
||||||
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}",true, $this); // $this->sc_download_request_url();
|
"onclick" => $this->getAgreeTextAsHtmlEventAttribute(),
|
||||||
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>");
|
]) . ">$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>");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -554,6 +597,7 @@ class download_shortcodes extends e_shortcode
|
|||||||
if ($parm == "link" && $this->var['download_image'])
|
if ($parm == "link" && $this->var['download_image'])
|
||||||
{
|
{
|
||||||
$url = e107::url('download', 'item', $this->var);
|
$url = e107::url('download', 'item', $this->var);
|
||||||
|
|
||||||
return "<a title=\"" . LAN_dl_53 . "\" href='" . $url . "'>" . $img . "</a>";
|
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>";
|
// 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()
|
function sc_download_list_nextprev()
|
||||||
{
|
{
|
||||||
global $nextprev_parms;
|
global $nextprev_parms;
|
||||||
|
|
||||||
return e107::getParser()->parseTemplate("{NEXTPREV={$nextprev_parms}}");
|
return e107::getParser()->parseTemplate("{NEXTPREV={$nextprev_parms}}");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_total_amount()
|
function sc_download_list_total_amount()
|
||||||
{
|
{
|
||||||
global $dltdownloads;
|
global $dltdownloads;
|
||||||
|
|
||||||
return intval($dltdownloads) . " " . LAN_dl_16;
|
return intval($dltdownloads) . " " . LAN_dl_16;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_list_total_files()
|
function sc_download_list_total_files()
|
||||||
{
|
{
|
||||||
global $dlft;
|
global $dlft;
|
||||||
|
|
||||||
return intval($dlft) . " " . strtolower(LAN_FILES);
|
return intval($dlft) . " " . strtolower(LAN_FILES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// View ****************************************************************************************
|
// View ****************************************************************************************
|
||||||
|
|
||||||
|
|
||||||
@@ -622,6 +667,7 @@ class download_shortcodes extends e_shortcode
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_name($parm = '')
|
function sc_download_view_name($parm = '')
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
@@ -649,19 +695,13 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
$tp = e107::getParser();
|
$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" . $tp->toAttributes([
|
||||||
{
|
"href" => $url,
|
||||||
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>";
|
"onclick" => $this->getAgreeTextAsHtmlEventAttribute(),
|
||||||
// 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>";
|
"title" => defined('LAN_dl_46') ? LAN_dl_46 : null,
|
||||||
}
|
]) . ">{$this->var['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>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_author()
|
function sc_download_view_author()
|
||||||
@@ -671,18 +711,18 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_view_authoremail()
|
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()
|
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 = '')
|
function sc_download_view_description($parm = '')
|
||||||
{
|
{
|
||||||
$maxlen = ($parm ? intval($parm) : 0);
|
$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)
|
if ($maxlen)
|
||||||
{
|
{
|
||||||
@@ -797,35 +837,23 @@ class download_shortcodes extends e_shortcode
|
|||||||
$img = e107::getParser()->toGlyph('fa-download', $parm); // '<i class="icon-download"></i>';
|
$img = e107::getParser()->toGlyph('fa-download', $parm); // '<i class="icon-download"></i>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($this->pref['agree_flag']))
|
$url = $tp->parseTemplate("{DOWNLOAD_REQUEST_URL}", true, $this); //$this->sc_download_request_url();
|
||||||
{
|
|
||||||
$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();
|
|
||||||
|
|
||||||
if (varset($parm['type']) == 'href')
|
if (varset($parm['type']) == 'href')
|
||||||
{
|
{
|
||||||
return $url;
|
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'])
|
return "<a" . $tp->toAttributes([
|
||||||
{
|
"href" => $url,
|
||||||
if ($this->var['download_mirror_type'])
|
"onclick" => $this->getAgreeTextAsHtmlEventAttribute()
|
||||||
{
|
]) . ">$img</a>";
|
||||||
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>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_download_view_filesize()
|
function sc_download_view_filesize()
|
||||||
@@ -838,6 +866,7 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
$options = array('label' => ' ', 'template' => 'RATE|VOTES|STATUS');
|
$options = array('label' => ' ', 'template' => 'RATE|VOTES|STATUS');
|
||||||
|
|
||||||
return $frm->rate("download", $this->var['download_id'], $options);
|
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 = e_PLUGIN_ABS."download/download.php?action=report&id=".$this->var['download_id'];
|
||||||
$url = e107::url('download', 'report', $this->var);
|
$url = e107::url('download', 'report', $this->var);
|
||||||
|
|
||||||
return "<a href='" . $url . "'>" . LAN_dl_45 . "</a>";
|
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_name'];
|
||||||
$text .= ($this->var['download_category_description']) ? " [ " . $this->var['download_category_description'] . " ]" : "";
|
$text .= ($this->var['download_category_description']) ? " [ " . $this->var['download_category_description'] . " ]" : "";
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,7 +963,7 @@ class download_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_download_mirror_description()
|
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()
|
function sc_download_mirror_filesize()
|
||||||
@@ -955,8 +986,6 @@ class download_shortcodes extends e_shortcode
|
|||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$img = '';
|
$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'))
|
if (defined('IMAGE_DOWNLOAD'))
|
||||||
{
|
{
|
||||||
$img = "<img src='" . IMAGE_DOWNLOAD . "' alt='" . LAN_DOWNLOAD . "' title='" . LAN_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>';
|
$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()
|
function sc_download_mirror_requests()
|
||||||
@@ -1071,6 +1104,7 @@ class download_shortcodes extends e_shortcode
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$class .= ' disabled';
|
$class .= ' disabled';
|
||||||
|
|
||||||
return "<a class='" . $class . "' href='#' >" . $icon . " " . LAN_PREVIOUS . "</a>\n";
|
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);
|
$url = $url = e107::url('download', 'item', $dlrowrow);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return "<a class='" . $class . "' href='" . $url . "' title=\"" . $dlrowrow['download_name'] . "\">" . LAN_NEXT . " " . $icon . "</a>\n";
|
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";
|
// 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
|
else
|
||||||
{
|
{
|
||||||
$class .= ' disabled';
|
$class .= ' disabled';
|
||||||
|
|
||||||
return "<a class='" . $class . "' href='#' >" . LAN_NEXT . " " . $icon . "</a>\n";
|
return "<a class='" . $class . "' href='#' >" . LAN_NEXT . " " . $icon . "</a>\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1175,7 +1208,6 @@ class download_shortcodes extends e_shortcode
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@@ -1185,6 +1217,7 @@ class download_shortcodes extends e_shortcode
|
|||||||
// list($ret[TRUE],$ret[FALSE]) = explode(chr(1), $source.chr(1)); //XXX ???
|
// list($ret[TRUE],$ret[FALSE]) = explode(chr(1), $source.chr(1)); //XXX ???
|
||||||
// if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE]; //XXX ???
|
// if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE]; //XXX ???
|
||||||
$parms = array('legacy' => "{e_IMAGE}icons/");
|
$parms = array('legacy' => "{e_IMAGE}icons/");
|
||||||
|
|
||||||
return e107::getParser()->toIcon($source, $parms);
|
return e107::getParser()->toIcon($source, $parms);
|
||||||
//return "<img src='".e_IMAGE."icons/{$ret[($count!=0)]}' alt='*'/>";
|
//return "<img src='".e_IMAGE."icons/{$ret[($count!=0)]}' alt='*'/>";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user