first commit
This commit is contained in:
73
components/com_jce/editor/extensions/aggregator/audio.php
Normal file
73
components/com_jce/editor/extensions/aggregator/audio.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2019 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class WFAggregatorExtension_Audio extends WFAggregatorExtension
|
||||
{
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array(
|
||||
'format' => 'video',
|
||||
));
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$document = WFDocument::getInstance();
|
||||
$document->addScript('audio', 'extensions/aggregator/audio/js');
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getParams()
|
||||
{
|
||||
$plugin = WFEditorPlugin::getInstance();
|
||||
|
||||
return array(
|
||||
'controls' => (int) $plugin->getParam('aggregator.audio.controls', 1),
|
||||
'loop' => (int) $plugin->getParam('aggregator.audio.loop', 0),
|
||||
'autoplay' => (int) $plugin->getParam('aggregator.audio.autoplay', 0),
|
||||
'muted' => (int) $plugin->getParam('aggregator.audio.mute', 0)
|
||||
);
|
||||
}
|
||||
|
||||
public function getEmbedData($data, $url)
|
||||
{
|
||||
$params = $this->getParams();
|
||||
|
||||
$default = array(
|
||||
'controls' => 1,
|
||||
'loop' => 0,
|
||||
'autoplay' => 0,
|
||||
'muted' => 0
|
||||
);
|
||||
|
||||
foreach($params as $name => $value) {
|
||||
if ($default[$name] === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($value !== '') {
|
||||
$data[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$data['src'] = $url;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
40
components/com_jce/editor/extensions/aggregator/audio.xml
Normal file
40
components/com_jce/editor/extensions/aggregator/audio.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.4" type="plugin" group="jce" method="upgrade">
|
||||
<name>WF_AGGREGATOR_AUDIO_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_AGGREGATOR_AUDIO_DESC</description>
|
||||
<files>
|
||||
<filename>audio.php</filename>
|
||||
<folder>audio</folder>
|
||||
</files>
|
||||
<fields name="audio">
|
||||
<fieldset name="aggregator.audio">
|
||||
<field name="controls" type="yesno" default="1" label="WF_AGGREGATOR_AUDIO_CONTROLS" description="WF_AGGREGATOR_AUDIO_CONTROLS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="loop" type="yesno" default="0" label="WF_AGGREGATOR_AUDIO_LOOP" description="WF_AGGREGATOR_AUDIO_LOOP_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="autoplay" type="yesno" default="0" label="WF_AGGREGATOR_AUDIO_AUTOPLAY" description="WF_AGGREGATOR_AUDIO_AUTOPLAY_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="mute" type="yesno" default="0" label="WF_AGGREGATOR_AUDIO_MUTE" description="WF_AGGREGATOR_AUDIO_MUTE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<plugins></plugins>
|
||||
</extension>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,2 @@
|
||||
/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
|
||||
WFAggregator.add("audio",{params:{},props:{autoplay:0,loop:0,controls:1,mute:0},setup:function(){$.each(this.params,function(k,v){$("#audio_"+k).val(v).filter(":checkbox, :radio").prop("checked",!!v)})},getTitle:function(){return this.title||this.name},getType:function(){return"audio"},isSupported:function(v){return!1}});
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class WFAggregatorExtension_Dailymotion extends WFAggregatorExtension
|
||||
{
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array(
|
||||
'format' => 'video',
|
||||
));
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$document = WFDocument::getInstance();
|
||||
$document->addScript('dailymotion', 'extensions/aggregator/dailymotion/js');
|
||||
$document->addStyleSheet('dailymotion', 'extensions/aggregator/dailymotion/css');
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
$plugin = WFEditorPlugin::getInstance();
|
||||
|
||||
return $plugin->checkAccess('aggregator.dailymotion.enable', 1);
|
||||
}
|
||||
|
||||
public function getParams()
|
||||
{
|
||||
$plugin = WFEditorPlugin::getInstance();
|
||||
|
||||
return array(
|
||||
'width' => $plugin->getParam('aggregator.dailymotion.width', 480),
|
||||
'height' => $plugin->getParam('aggregator.dailymotion.height', 270),
|
||||
);
|
||||
}
|
||||
|
||||
public function getEmbedData($data, $url)
|
||||
{
|
||||
$params = $this->getParams();
|
||||
|
||||
$default = array(
|
||||
'width' => 480,
|
||||
'height' => 270
|
||||
);
|
||||
|
||||
foreach($params as $name => $value) {
|
||||
if (isset($default[$name]) && $value === $default[$name]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($name === 'width' || $name == 'height') {
|
||||
$data[$name] = $value;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.4" type="plugin" group="jce" method="upgrade">
|
||||
<name>WF_AGGREGATOR_DAILYMOTION_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_AGGREGATOR_DAILYMOTION_DESC</description>
|
||||
<files>
|
||||
<filename>dailymotion</filename>
|
||||
<folder>dailymotion</folder>
|
||||
</files>
|
||||
<fields name="dailymotion">
|
||||
<fieldset name="aggregator.dailymotion">
|
||||
<field name="enable" type="yesno" default="1" label="WF_LABEL_EXTENSION_ENABLE" description="WF_LABEL_EXTENSION_ENABLE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="width" type="number" default="400" class="input-small" label="WF_LABEL_WIDTH" />
|
||||
<field name="height" type="number" default="225" class="input-small" label="WF_LABEL_HEIGHT" />
|
||||
</fieldset>
|
||||
</fields>
|
||||
<plugins></plugins>
|
||||
</extension>
|
||||
@@ -0,0 +1 @@
|
||||
#dailymotion_player_size{width:150px!important}#dailymotion_player_size_custom{width:65px!important}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,2 @@
|
||||
/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
|
||||
WFAggregator.add("dailymotion",{params:{width:480,height:270,autoPlay:!1},props:{autoPlay:0,start:0},setup:function(){$("#dailymotion_autoPlay").prop("checked",this.params.autoPlay),$("#dailymotion_player_size").on("change",function(){var v=parseInt(this.value,10);$("#dailymotion_player_size_custom").toggleClass("uk-hidden",!!this.value),v&&($("#width").val(v),$("#height").val(Math.round(9*v/16)))}),$("#dailymotion_player_size_custom").on("change",function(){var v=parseInt(this.value,10);v&&($("#width").val(v),$("#height").val(Math.round(16*v/9)))})},getTitle:function(){return this.title||this.name},getType:function(){return"iframe"},isSupported:function(v){return"object"==typeof v&&(v=v.src||v.data||""),!!/dai\.?ly(motion)?(\.com)?/.test(v)&&"dailymotion"},getValues:function(src){var self=this,data={},args={},id="";src.indexOf("=")!==-1&&$.extend(args,Wf.String.query(src)),$("input[id], select[id]","#dailymotion_options").each(function(){var k=$(this).attr("id"),v=$(this).val();k=k.substr(k.indexOf("_")+1),$(this).is(":checkbox")&&(v=$(this).is(":checked")?1:0),k.indexOf("player_size")===-1&&self.props[k]!==v&&""!==v&&(args[k]=v)});var m=src.match(/dai\.?ly(motion\.com)?\/(embed)?\/?(swf|video)?\/?([a-z0-9]+)_?/);m&&(id=m.pop()),src="https://www.dailymotion.com/embed/video/"+id;var query=$.param(args);return query&&(src=src+(/\?/.test(src)?"&":"?")+query),data.src=src,$.extend(data,{frameborder:0,allowfullscreen:"allowfullscreen"}),data},setValues:function(data){var self=this,src=data.src||data.data||"",id="";if(!src)return data;var query=Wf.String.query(src);$.each(query,function(key,val){return self.props[key]==val||void(data["dailymotion_"+key]=val)}),src=src.replace(/&/g,"&");var m=src.match(/dai\.?ly(motion\.com)?\/(embed)?\/?(swf|video)?\/?([a-z0-9]+)_?/);return m&&(id=m.pop()),data.src="https://www.dailymotion.com/embed/video/"+id,data},getAttributes:function(src){var args={},data=this.setValues({src:src})||{};return $.each(data,function(k,v){"src"!=k&&(args["dailymotion_"+k]=v)}),$.extend(args,{src:data.src||src,width:this.params.width,height:this.params.height}),args},setAttributes:function(){},onSelectFile:function(){},onInsert:function(){}});
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('_WF_EXT') or die('RESTRICTED');
|
||||
?>
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="dailymotion_autoPlay" title="<?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_AUTOPLAY_DESC') ?>"
|
||||
class="tooltip uk-form-label uk-width-1-5"><?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_AUTOPLAY') ?></label>
|
||||
<div class="uk-width-4-5">
|
||||
<div class="uk-form-controls uk-width-1-5">
|
||||
<input type="checkbox" id="dailymotion_autoPlay" />
|
||||
</div>
|
||||
|
||||
<label for="dailymotion_start" title="<?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_START_DESC') ?>"
|
||||
class="tooltip uk-form-label uk-width-1-5"><?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_START') ?></label>
|
||||
<div class="uk-form-controls uk-width-1-5">
|
||||
<input id="dailymotion_start" type="number" value="" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label class="uk-form-label uk-width-1-5"
|
||||
title="<?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_SIZE'); ?>"><?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_SIZE'); ?></label>
|
||||
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
<select id="dailymotion_player_size">
|
||||
<option value="320"><?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_SIZE_SMALL'); ?></option>
|
||||
<option value="480"><?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_SIZE_MEDIUM'); ?></option>
|
||||
<option value="560"><?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_SIZE_LARGE'); ?></option>
|
||||
<option value=""><?php echo JText::_('WF_AGGREGATOR_DAILYMOTION_SIZE_CUSTOM'); ?></option>
|
||||
</select>
|
||||
|
||||
<input type="number" id="dailymotion_player_size_custom" class="uk-hidden uk-margin-small-left" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
76
components/com_jce/editor/extensions/aggregator/video.php
Normal file
76
components/com_jce/editor/extensions/aggregator/video.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2019 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class WFAggregatorExtension_Video extends WFAggregatorExtension
|
||||
{
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array(
|
||||
'format' => 'video',
|
||||
));
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$document = WFDocument::getInstance();
|
||||
$document->addScript('video', 'extensions/aggregator/video/js');
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getParams()
|
||||
{
|
||||
$plugin = WFEditorPlugin::getInstance();
|
||||
|
||||
return array(
|
||||
'width' => $plugin->getParam('aggregator.video.width', ''),
|
||||
'height' => $plugin->getParam('aggregator.video.height', ''),
|
||||
|
||||
'controls' => (int) $plugin->getParam('aggregator.video.controls', 1),
|
||||
'loop' => (int) $plugin->getParam('aggregator.video.loop', 0),
|
||||
'autoplay' => (int) $plugin->getParam('aggregator.video.autoplay', 0),
|
||||
'muted' => (int) $plugin->getParam('aggregator.video.mute', 0)
|
||||
);
|
||||
}
|
||||
|
||||
public function getEmbedData($data, $url)
|
||||
{
|
||||
$params = $this->getParams();
|
||||
|
||||
$default = array(
|
||||
'controls' => 1,
|
||||
'loop' => 0,
|
||||
'autoplay' => 0,
|
||||
'muted' => 0
|
||||
);
|
||||
|
||||
foreach($params as $name => $value) {
|
||||
if ($default[$name] === $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($value !== '') {
|
||||
$data[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$data['src'] = $url;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
39
components/com_jce/editor/extensions/aggregator/video.xml
Normal file
39
components/com_jce/editor/extensions/aggregator/video.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.4" type="plugin" group="jce" method="upgrade">
|
||||
<name>WF_AGGREGATOR_VIDEO_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_AGGREGATOR_VIDEO_DESC</description>
|
||||
<files>
|
||||
<filename>video.php</filename>
|
||||
</files>
|
||||
<fields name="video">
|
||||
<fieldset name="aggregator.video">
|
||||
<field name="controls" type="yesno" default="1" label="WF_AGGREGATOR_VIDEO_CONTROLS" description="WF_AGGREGATOR_VIDEO_CONTROLS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="loop" type="yesno" default="0" label="WF_AGGREGATOR_VIDEO_LOOP" description="WF_AGGREGATOR_VIDEO_LOOP_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="autoplay" type="yesno" default="0" label="WF_AGGREGATOR_VIDEO_AUTOPLAY" description="WF_AGGREGATOR_VIDEO_AUTOPLAY_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="mute" type="yesno" default="0" label="WF_AGGREGATOR_VIDEO_MUTE" description="WF_AGGREGATOR_VIDEO_MUTE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<plugins></plugins>
|
||||
</extension>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,2 @@
|
||||
/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
|
||||
WFAggregator.add("video",{params:{},props:{autoplay:0,loop:0,controls:1,mute:0},setup:function(){$.each(this.params,function(k,v){$("#video_"+k).val(v).filter(":checkbox, :radio").prop("checked",!!v)})},getTitle:function(){return this.title||this.name},getType:function(){return"video"},isSupported:function(v){return!1}});
|
||||
92
components/com_jce/editor/extensions/aggregator/vimeo.php
Normal file
92
components/com_jce/editor/extensions/aggregator/vimeo.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class WFAggregatorExtension_Vimeo extends WFAggregatorExtension
|
||||
{
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array(
|
||||
'format' => 'video',
|
||||
));
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$document = WFDocument::getInstance();
|
||||
$document->addScript('vimeo', 'extensions/aggregator/vimeo/js');
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
$plugin = WFEditorPlugin::getInstance();
|
||||
|
||||
return $plugin->checkAccess('aggregator.vimeo.enable', 1);
|
||||
}
|
||||
|
||||
public function getParams()
|
||||
{
|
||||
$plugin = WFEditorPlugin::getInstance();
|
||||
|
||||
return array(
|
||||
'width' => $plugin->getParam('aggregator.vimeo.width', 400),
|
||||
'height' => $plugin->getParam('aggregator.vimeo.height', 225),
|
||||
|
||||
'color' => (string) $plugin->getParam('aggregator.vimeo.color', ''),
|
||||
'loop' => (int) $plugin->getParam('aggregator.vimeo.loop', 0),
|
||||
'autoplay' => (int) $plugin->getParam('aggregator.vimeo.autoplay', 0),
|
||||
'intro' => (int) $plugin->getParam('aggregator.vimeo.intro', 0),
|
||||
'title' => (int) $plugin->getParam('aggregator.vimeo.title', 0),
|
||||
'byline' => (int) $plugin->getParam('aggregator.vimeo.byline', 0),
|
||||
'portrait' => (int) $plugin->getParam('aggregator.vimeo.portrait', 0),
|
||||
'fullscreen' => (int) $plugin->getParam('aggregator.vimeo.fullscreen', 1),
|
||||
'dnt' => (int) $plugin->getParam('aggregator.vimeo.dnt', 0),
|
||||
);
|
||||
}
|
||||
|
||||
public function getEmbedData($data, $url)
|
||||
{
|
||||
$params = $this->getParams();
|
||||
|
||||
$default = array(
|
||||
'width' => 560,
|
||||
'height' => 315,
|
||||
'controls' => 1,
|
||||
'loop' => 0,
|
||||
'autoplay' => 0,
|
||||
'rel' => 1,
|
||||
'modestbranding' => 0,
|
||||
'privacy' => 0
|
||||
);
|
||||
|
||||
foreach($params as $name => $value) {
|
||||
if (isset($default[$name]) && $value === $default[$name]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($name === 'width' || $name == 'height') {
|
||||
$data[$name] = $value;
|
||||
continue;
|
||||
}
|
||||
|
||||
$query[$name] = $value;
|
||||
}
|
||||
|
||||
if (!empty($options)) {
|
||||
$data['query'] = http_build_query($options);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
69
components/com_jce/editor/extensions/aggregator/vimeo.xml
Normal file
69
components/com_jce/editor/extensions/aggregator/vimeo.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.4" type="plugin" group="jce" method="upgrade">
|
||||
<name>WF_AGGREGATOR_VIMEO_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_AGGREGATOR_VIMEO_DESC</description>
|
||||
<files>
|
||||
<filename>vimeo.php</filename>
|
||||
<folder>vimeo</folder>
|
||||
</files>
|
||||
<fields name="vimeo">
|
||||
<fieldset name="aggregator.vimeo">
|
||||
<field name="enable" type="yesno" default="1" label="WF_LABEL_EXTENSION_ENABLE" description="WF_LABEL_EXTENSION_ENABLE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="width" type="number" default="400" class="input-small" label="WF_LABEL_WIDTH" description="WF_AGGREGATOR_VIMEO_WIDTH_DESC" />
|
||||
<field name="height" type="number" default="225" class="input-small" label="WF_LABEL_HEIGHT" description="WF_AGGREGATOR_VIMEO_HEIGHT_DESC" />
|
||||
|
||||
<field name="color" type="color" size="10" default="" label="WF_AGGREGATOR_VIMEO_COLOR" description="WF_AGGREGATOR_VIMEO_COLOR_DESC" />
|
||||
|
||||
<field name="intro" type="yesno" default="0" label="WF_AGGREGATOR_VIMEO_INTRO" description="WF_AGGREGATOR_VIMEO_INTRO_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="portrait" type="yesno" default="0" label="WF_AGGREGATOR_VIMEO_PORTRAIT" description="WF_AGGREGATOR_VIMEO_PORTRAIT_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="title" type="yesno" default="0" label="WF_AGGREGATOR_VIMEO_INTROTITLE" description="WF_AGGREGATOR_VIMEO_INTROTITLE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="byline" type="yesno" default="0" label="WF_AGGREGATOR_VIMEO_BYLINE" description="WF_AGGREGATOR_VIMEO_BYLINE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="autoplay" type="yesno" default="0" label="WF_AGGREGATOR_VIMEO_AUTOPLAY" description="WF_AGGREGATOR_VIMEO_AUTOPLAY_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="loop" type="yesno" default="0" label="WF_AGGREGATOR_VIMEO_LOOP" description="WF_AGGREGATOR_VIMEO_LOOP_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="fullscreen" type="yesno" default="1" label="WF_AGGREGATOR_VIMEO_FULLSCREEN" description="WF_AGGREGATOR_VIMEO_FULLSCREEN_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="dnt" type="yesno" default="0" label="WF_AGGREGATOR_VIMEO_DNT" description="WF_AGGREGATOR_VIMEO_DNT_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<plugins></plugins>
|
||||
</extension>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,2 @@
|
||||
/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
|
||||
WFAggregator.add("vimeo",{params:{width:480,height:480,embed:!0},props:{color:"",autoplay:0,loop:0,fullscreen:1,dnt:0},setup:function(){$("#vimeo_embed").toggle(this.params.embed),$.each(this.params,function(k,v){$("#vimeo_"+k).val(v).filter(":checkbox, :radio").prop("checked",!!v)})},getTitle:function(){return this.title||this.name},getType:function(){return"iframe"},isSupported:function(v){return"object"==typeof v&&(v=v.src||v.data||""),!!/vimeo(.+)?\/(.+)/.test(v)&&(!/\/external\//.test(v)&&"vimeo")},getValues:function(src){var self=this,data={},args={},id="";if(src.indexOf("=")!==-1&&$.extend(args,Wf.String.query(src)),$("input, select","#vimeo_options").not("#vimeo_embed").each(function(){var k=$(this).attr("id"),v=$(this).val();k=k.substr(k.indexOf("_")+1),$(this).is(":checkbox")&&(v=$(this).is(":checked")?1:0),self.props[k]!=v&&""!==v&&("color"===k&&"#"===v.charAt(0)&&(v=v.substr(1)),args[k]=v)}),args.clip_id)id=args.clip_id;else{var id="",hash="",matches=/vimeo\.com\/([0-9]+)\/?([a-z0-9]+)?/.exec(src);if(matches&&tinymce.is(matches,"array")){var id=matches[1];matches.length>2&&(hash=matches[2])}id+=hash?"?h="+hash:""}src="https://player.vimeo.com/video/"+id;var query=$.param(args);return query&&(src=src+(/\?/.test(src)?"&":"?")+query),data.src=src,$.extend(data,{frameborder:0}),0!==args.fullscreen&&$.extend(data,{allowfullscreen:!0}),data},setValues:function(data){var self=this,src=data.src||data.data||"",id="";if(!src)return data;var query=Wf.String.query(src);if(src=src.replace(/&/g,"&"),/moogaloop.swf/.test(src))data.vimeo_embed=!0,id=query.clip_id,delete query.clip_id,delete data.clip_id,$.each(["portrait","title","byline"],function(i,s){delete data["show_"+s]});else{var id="",hash="",matches=/vimeo\.com\/(?:\w+\/){0,3}((?:[0-9]+\b)(?:\/[a-z0-9]+)?)/.exec(src);if(matches&&"array"==$.type(matches)){var params=matches[1].split("/"),id=params[0];2==params.length&&(hash=params[1]),id+=hash?"/"+hash:""}}return $.each(query,function(key,val){return self.props[key]===val||("color"==key&&"#"!==val.charAt(0)&&(val="#"+val),"autoplay"==key&&(val=parseInt(val,10)),void(data["vimeo_"+key]=val))}),src="https://vimeo.com/"+id,$.each(data,function(key,val){/^iframe_(allow|frameborder|allowfullscreen)/.test(key)&&delete data[key]}),data.src=src,data},getAttributes:function(src){var args={},data=this.setValues({src:src})||{};return $.each(data,function(k,v){"src"!=k&&(args["vimeo_"+k]=v)}),$.extend(args,{src:data.src||src,width:this.params.width,height:this.params.height}),args},setAttributes:function(){},onSelectFile:function(){},onInsert:function(){}});
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('_WF_EXT') or die('RESTRICTED');
|
||||
?>
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="vimeo_color" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_COLOR_DESC') ?>"
|
||||
class="tooltip uk-form-label uk-width-1-5"><?php echo JText::_('WF_AGGREGATOR_VIMEO_COLOR') ?></label>
|
||||
|
||||
<div class="uk-form-controls uk-width-1-5">
|
||||
<input type="text" id="vimeo_color" class="color"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
|
||||
<label for="vimeo_intro" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_INTRO_DESC') ?>"
|
||||
class="tooltip uk-form-label uk-width-1-5"><?php echo JText::_('WF_AGGREGATOR_VIMEO_INTRO') ?></label>
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
<input type="checkbox" id="vimeo_portrait" />
|
||||
<label for="vimeo_portrait" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_PORTRAIT_DESC') ?>"
|
||||
class="tooltip uk-margin-right"><?php echo JText::_('WF_AGGREGATOR_VIMEO_PORTRAIT') ?></label>
|
||||
|
||||
<input type="checkbox" id="vimeo_title" />
|
||||
<label for="vimeo_title" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_INTROTITLE_DESC') ?>"
|
||||
class="tooltip uk-margin-right"><?php echo JText::_('WF_AGGREGATOR_VIMEO_INTROTITLE') ?></label>
|
||||
|
||||
<input type="checkbox" id="vimeo_byline" />
|
||||
<label for="vimeo_byline" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_BYLINE_DESC') ?>"
|
||||
class="tooltip"><?php echo JText::_('WF_AGGREGATOR_VIMEO_BYLINE') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="vimeo_special"
|
||||
class="uk-form-label uk-width-1-5"><?php echo JText::_('WF_AGGREGATOR_VIMEO_SPECIAL') ?></label>
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
|
||||
<input type="checkbox" id="vimeo_autoplay"/>
|
||||
<label for="vimeo_autoplay" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_AUTOPLAY_DESC') ?>"
|
||||
class="tooltip uk-margin-right"><?php echo JText::_('WF_AGGREGATOR_VIMEO_AUTOPLAY') ?></label>
|
||||
|
||||
<input type="checkbox" id="vimeo_loop"/>
|
||||
<label for="vimeo_loop" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_LOOP_DESC') ?>"
|
||||
class="tooltip uk-margin-right"><?php echo JText::_('WF_AGGREGATOR_VIMEO_LOOP') ?></label>
|
||||
|
||||
<input type="checkbox" id="vimeo_fullscreen" checked="checked"/>
|
||||
<label for="vimeo_fullscreen" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_FULLSCREEN_DESC') ?>"
|
||||
class="tooltip"><?php echo JText::_('WF_AGGREGATOR_VIMEO_FULLSCREEN') ?></label>
|
||||
|
||||
<input type="checkbox" id="vimeo_dnt" />
|
||||
<label for="vimeo_dnt" title="<?php echo JText::_('WF_AGGREGATOR_VIMEO_DNT_DESC') ?>"
|
||||
class="tooltip"><?php echo JText::_('WF_AGGREGATOR_VIMEO_DNT') ?></label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
91
components/com_jce/editor/extensions/aggregator/youtube.php
Normal file
91
components/com_jce/editor/extensions/aggregator/youtube.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class WFAggregatorExtension_Youtube extends WFAggregatorExtension
|
||||
{
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(array(
|
||||
'format' => 'video',
|
||||
));
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
$document = WFDocument::getInstance();
|
||||
$document->addScript('youtube', 'extensions/aggregator/youtube/js');
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
$plugin = WFEditorPlugin::getInstance();
|
||||
|
||||
return $plugin->checkAccess('aggregator.youtube.enable', 1);
|
||||
}
|
||||
|
||||
public function getParams()
|
||||
{
|
||||
$plugin = WFEditorPlugin::getInstance();
|
||||
|
||||
return array(
|
||||
'width' => $plugin->getParam('aggregator.youtube.width', 560),
|
||||
'height' => $plugin->getParam('aggregator.youtube.height', 315),
|
||||
|
||||
'controls' => (int) $plugin->getParam('aggregator.youtube.controls', 1),
|
||||
'loop' => (int) $plugin->getParam('aggregator.youtube.loop', 0),
|
||||
'autoplay' => (int) $plugin->getParam('aggregator.youtube.autoplay', 0),
|
||||
'rel' => (int) $plugin->getParam('aggregator.youtube.related', 1),
|
||||
'modestbranding' => (int) $plugin->getParam('aggregator.youtube.modestbranding', 0),
|
||||
'privacy' => (int) $plugin->getParam('aggregator.youtube.privacy', 0),
|
||||
);
|
||||
}
|
||||
|
||||
public function getEmbedData($data)
|
||||
{
|
||||
$params = $this->getParams();
|
||||
|
||||
$default = array(
|
||||
'width' => 560,
|
||||
'height' => 315,
|
||||
'controls' => 1,
|
||||
'loop' => 0,
|
||||
'autoplay' => 0,
|
||||
'rel' => 1,
|
||||
'modestbranding' => 0,
|
||||
'privacy' => 0
|
||||
);
|
||||
|
||||
$options = array();
|
||||
|
||||
foreach($params as $name => $value) {
|
||||
if (isset($default[$name]) && $value === $default[$name]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($name === 'width' || $name == 'height') {
|
||||
$data[$name] = $value;
|
||||
continue;
|
||||
}
|
||||
|
||||
$options[$name] = $value;
|
||||
}
|
||||
|
||||
if (!empty($options)) {
|
||||
$data['query'] = http_build_query($options);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
57
components/com_jce/editor/extensions/aggregator/youtube.xml
Normal file
57
components/com_jce/editor/extensions/aggregator/youtube.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.4" type="plugin" group="jce" method="upgrade">
|
||||
<name>WF_AGGREGATOR_YOUTUBE_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_AGGREGATOR_YOUTUBE_DESC</description>
|
||||
<files>
|
||||
<filename>youtube.php</filename>
|
||||
<folder>youtube</folder>
|
||||
</files>
|
||||
<fields name="youtube">
|
||||
<fieldset name="aggregator.youtube">
|
||||
<field name="enable" type="yesno" default="1" label="WF_LABEL_EXTENSION_ENABLE" description="WF_LABEL_EXTENSION_ENABLE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="width" type="number" default="560" class="input-small" label="WF_LABEL_WIDTH" description="WF_AGGREGATOR_YOUTUBE_WIDTH_DESC" />
|
||||
<field name="height" type="number" default="315" class="input-small" label="WF_LABEL_HEIGHT" description="WF_AGGREGATOR_YOUTUBE_HEIGHT_DESC" />
|
||||
|
||||
<field name="controls" type="yesno" default="1" label="WF_AGGREGATOR_YOUTUBE_CONTROLS" description="WF_AGGREGATOR_YOUTUBE_CONTROLS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="related" type="yesno" default="1" label="WF_AGGREGATOR_YOUTUBE_RELATED" description="WF_AGGREGATOR_YOUTUBE_RELATED_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="loop" type="yesno" default="1" label="WF_AGGREGATOR_YOUTUBE_LOOP" description="WF_AGGREGATOR_YOUTUBE_LOOP_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="autoplay" type="yesno" default="0" label="WF_AGGREGATOR_YOUTUBE_AUTOPLAY" description="WF_AGGREGATOR_YOUTUBE_AUTOPLAY_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="privacy" type="yesno" default="0" label="WF_AGGREGATOR_YOUTUBE_PRIVACY" description="WF_AGGREGATOR_YOUTUBE_PRIVACY_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="modestbranding" type="yesno" default="0" label="WF_AGGREGATOR_YOUTUBE_MODESTBRANDING" description="WF_AGGREGATOR_YOUTUBE_MODESTBRANDING_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<plugins></plugins>
|
||||
</extension>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,2 @@
|
||||
/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
|
||||
WFAggregator.add("youtube",{params:{width:560,height:315,embed:!0},props:{rel:1,autoplay:0,controls:1,modestbranding:0,enablejsapi:0,loop:0,playlist:"",start:"",end:"",privacy:0},setup:function(){$.each(this.params,function(k,v){$("#youtube_"+k).val(v).filter(":checkbox, :radio").prop("checked",!!v)})},getTitle:function(){return this.title||this.name},getType:function(){return $("#youtube_embed:visible").is(":checked")?"flash":"iframe"},isSupported:function(v){return"object"==typeof v&&(v=v.src||v.data||""),!!/youtu(\.)?be(.+)?\/(.+)/.test(v)&&"youtube"},getValues:function(src){var id,self=this,data={},args={},type=this.getType(),query={},u=this.parseURL(src);u.query&&(query=Wf.String.query(u.query)),$.extend(args,query),src=src.replace(/^(http:)?\/\//,"https://"),$(":input","#youtube_options").not("#youtube_embed, #youtube_https, #youtube_privacy").each(function(){var k=$(this).attr("id"),v=$(this).val();return!k||(k=k.substr(k.indexOf("_")+1),$(this).is(":checkbox")&&(v=$(this).is(":checked")?1:0),void(self.props[k]!=v&&""!==v&&(args[k]=v)))}),src=src.replace(/youtu(\.)?be([^\/]+)?\/(.+)/,function(a,b,c,d){return d=d.replace(/(watch\?v=|v\/|embed\/)/,""),b&&!c&&(c=".com"),id=d.replace(/([^\?&#]+)/,function($0,$1){return $1}),"youtube"+c+"/"+("iframe"==type?"embed":"v")+"/"+d}),id&&args.loop&&!args.playlist&&(args.playlist=id),src=$("#youtube_privacy").is(":checked")?src.replace(/youtube\./,"youtube-nocookie."):src.replace(/youtube-nocookie\./,"youtube."),"iframe"==type?$.extend(data,{allowfullscreen:!0,frameborder:0}):$.extend(!0,data,{param:{allowfullscreen:!0,wmode:"opaque"}}),$(".uk-repeatable","#youtube_params").each(function(){var key=$('input[name^="youtube_params_name"]',this).val(),value=$('input[name^="youtube_params_value"]',this).val();""!==key&&""!==value&&(args[key]=value)});var q=$.param(args);return q&&(src=src+(/\?/.test(src)?"&":"?")+q),data.src=src,data},parseURL:function(url){var o={};return url=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(url),$.each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],function(i,v){var s=url[i];s&&(o[v]=s)}),o},setValues:function(data){var self=this,id="",src=data.src||data.data||"",query={};if(!src)return data;var u=this.parseURL(src);if(u.query&&(query=Wf.String.query(u.query)),src="https://"+u.host+u.path,src.indexOf("youtube-nocookie")!==-1&&(data.youtube_privacy=1),query.v)id=query.v,delete query.v;else{var s=/\/?(embed|v)?\/([\w-]+)\b/.exec(u.path);s&&"array"===$.type(s)&&(id=s.pop())}return $.each(query,function(key,val){try{val=decodeURIComponent(val)}catch(e){}return"autoplay"==key&&(val=parseInt(val,10)),"playlist"==key&&val==id||("wmode"==key||(self.props[key]===val||(data["youtube_"+key]=val,void delete data[key])))}),src=src.replace(/youtu(\.)?be([^\/]+)?\/(.+)/,function(a,b,c,d){var args="youtube";if(b&&(args+=".com"),c&&(args+=c),args+="/embed",args+="/"+id,u.anchor){var s=u.anchor;s=s.replace(/(\?|&)(.+)/,""),args+="#"+s}return args}).replace(/\/\/youtube/i,"//www.youtube"),$.each(data,function(key,val){/^iframe_(allow|frameborder|allowfullscreen)/.test(key)&&delete data[key]}),data.src=src,data},getAttributes:function(src){var args={},data=this.setValues({src:src})||{};return $.each(data,function(k,v){"src"!==k&&(args["youtube_"+k]=v)}),args=$.extend(args,{src:data.src||src,width:this.params.width,height:this.params.height})},setAttributes:function(){},onSelectFile:function(){},onInsert:function(){}});
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('_WF_EXT') or die('RESTRICTED');
|
||||
?>
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<div class="uk-width-4-10">
|
||||
<input type="checkbox" id="youtube_controls" checked />
|
||||
<label for="youtube_controls" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_CONTROLS_DESC') ?>" class="tooltip">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_CONTROLS') ?>
|
||||
</label>
|
||||
</div>
|
||||
<div class="uk-width-6-10">
|
||||
<input type="checkbox" id="youtube_loop" />
|
||||
<label for="youtube_loop" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_LOOP_DESC') ?>" class="tooltip">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_LOOP') ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<div class="uk-width-4-10">
|
||||
<input type="checkbox" id="youtube_autoplay" />
|
||||
<label for="youtube_autoplay" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_AUTOPLAY_DESC') ?>" class="tooltip">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_AUTOPLAY') ?>
|
||||
</label>
|
||||
</div>
|
||||
<div class="uk-width-6-10">
|
||||
<input type="checkbox" id="youtube_privacy" />
|
||||
<label for="youtube_privacy" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_PRIVACY_DESC') ?>" class="tooltip">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_PRIVACY') ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<div class="uk-width-4-10 uk-grid uk-grid-collapse">
|
||||
<input type="checkbox" id="youtube_modestbranding" checked />
|
||||
<label for="youtube_modestbranding" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_MODESTBRANDING_DESC') ?>" class="tooltip">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_MODESTBRANDING') ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="uk-width-6-10 uk-grid uk-grid-collapse">
|
||||
<label for="youtube_rel" class="uk-form-label uk-width-1-5 tooltip" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_RELATED_DESC') ?>">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_RELATED') ?>
|
||||
</label>
|
||||
|
||||
<select id="youtube_rel">
|
||||
<option value="1">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_RELATED_ALL') ?>
|
||||
</option>
|
||||
<option value="0">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_RELATED_CHANNEL') ?>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-grid uk-grid-small">
|
||||
<label for="youtube_start" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_START_DESC') ?>" class="tooltip uk-form-label uk-width-2-10">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_START') ?>
|
||||
</label>
|
||||
|
||||
<div class="uk-form-controls uk-width-2-10">
|
||||
<input type="number" id="youtube_start" />
|
||||
</div>
|
||||
<div class="uk-width-6-10">
|
||||
<label for="youtube_end" class="uk-form-label uk-width-2-10" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_END_DESC') ?>" class="tooltip">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_END') ?>
|
||||
</label>
|
||||
<div class="uk-form-controls uk-width-3-10">
|
||||
<input type="number" id="youtube_end" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-grid uk-grid-small">
|
||||
<label for="youtube_playlist" class="uk-form-label uk-width-1-5" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_PLAYLIST_DESC') ?>" class="tooltip">
|
||||
<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_PLAYLIST') ?>
|
||||
</label>
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
<input type="text" id="youtube_playlist" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="youtube_params" class="uk-form-label uk-width-1-5 hastip" title="<?php echo JText::_('WF_AGGREGATOR_YOUTUBE_PARAMS_DESC'); ?>"><?php echo JText::_('WF_AGGREGATOR_YOUTUBE_PARAMS'); ?></label>
|
||||
<div class="uk-width-4-5" id="youtube_params">
|
||||
<div class="uk-form-row uk-repeatable">
|
||||
<div class="uk-form-controls uk-grid uk-grid-small uk-width-9-10">
|
||||
<label class="uk-form-label uk-width-1-6"><?php echo JText::_('WF_LABEL_NAME'); ?></label>
|
||||
<div class="uk-form-controls uk-width-1-3">
|
||||
<input type="text" name="youtube_params_name[]" />
|
||||
</div>
|
||||
<label class="uk-form-label uk-width-1-6"><?php echo JText::_('WF_LABEL_VALUE'); ?></label>
|
||||
<div class="uk-form-controls uk-width-1-3">
|
||||
<input type="text" name="youtube_params_value[]" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-form-controls uk-margin-small-left">
|
||||
<button type="button" class="uk-button uk-button-link uk-repeatable-create"><i class="uk-icon-plus"></i></button>
|
||||
<button type="button" class="uk-button uk-button-link uk-repeatable-delete"><i class="uk-icon-trash"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
958
components/com_jce/editor/extensions/filesystem/joomla.php
Normal file
958
components/com_jce/editor/extensions/filesystem/joomla.php
Normal file
@@ -0,0 +1,958 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
jimport('joomla.filesystem.folder');
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
class WFJoomlaFileSystem extends WFFileSystem
|
||||
{
|
||||
private static $restricted = array(
|
||||
'administrator', 'bin', 'cache', 'components', 'cli', 'includes', 'language', 'layouts', 'libraries', 'logs', 'media', 'modules', 'plugins', 'templates', 'tmp', 'xmlrpc',
|
||||
);
|
||||
|
||||
private static $allowroot = false;
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct($config = array())
|
||||
{
|
||||
parent::__construct($config);
|
||||
|
||||
$safe_mode = false;
|
||||
|
||||
// check for safe mode
|
||||
if (function_exists('ini_get')) {
|
||||
$safe_mode = ini_get('safe_mode');
|
||||
// assume safe mode if can't check ini
|
||||
} else {
|
||||
$safe_mode = true;
|
||||
}
|
||||
|
||||
$this->setProperties(array(
|
||||
'local' => true,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the base directory.
|
||||
*
|
||||
* @return string base dir
|
||||
*/
|
||||
public function getBaseDir()
|
||||
{
|
||||
return WFUtility::makePath(JPATH_SITE, $this->getRootDir());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full base url.
|
||||
*
|
||||
* @return string base url
|
||||
*/
|
||||
public function getBaseURL()
|
||||
{
|
||||
return WFUtility::makePath(JURI::root(true), $this->getRootDir());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full user directory path. Create if required.
|
||||
*
|
||||
* @param string The base path
|
||||
*
|
||||
* @return Full path to folder
|
||||
*/
|
||||
public function getRootDir()
|
||||
{
|
||||
static $root;
|
||||
|
||||
if (!isset($root)) {
|
||||
$root = parent::getRootDir();
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
// list of restricted directories
|
||||
$restricted = $wf->getParam('filesystem.joomla.restrict_dir', self::$restricted);
|
||||
|
||||
// explode to array
|
||||
if (is_string($restricted)) {
|
||||
self::$restricted = explode(',', $restricted);
|
||||
} else {
|
||||
self::$restricted = $restricted;
|
||||
}
|
||||
|
||||
// is root allowed?
|
||||
self::$allowroot = (bool) $wf->getParam('filesystem.joomla.allow_root', 0);
|
||||
|
||||
// set $root to empty if it is allowed
|
||||
if (self::$allowroot) {
|
||||
$root = '';
|
||||
} else {
|
||||
// Revert to default if empty
|
||||
if (empty($root)) {
|
||||
$root = 'images';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($root)) {
|
||||
// Create the folder
|
||||
$full = WFUtility::makePath(JPATH_SITE, $root);
|
||||
|
||||
if (!JFolder::exists($full)) {
|
||||
$this->folderCreate($full);
|
||||
}
|
||||
|
||||
// Fallback
|
||||
$root = JFolder::exists($full) ? $root : 'images';
|
||||
}
|
||||
}
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemGetRootDir', array(&$root));
|
||||
|
||||
return $root;
|
||||
}
|
||||
|
||||
public function toAbsolute($path)
|
||||
{
|
||||
return WFUtility::makePath($this->getBaseDir(), $path);
|
||||
}
|
||||
|
||||
public function toRelative($path, $isabsolute = true)
|
||||
{
|
||||
// path is absolute
|
||||
$base = $this->getBaseDir();
|
||||
|
||||
// path is relative to Joomla! root, eg: images/folder
|
||||
if ($isabsolute === false) {
|
||||
$base = $this->getRootDir();
|
||||
}
|
||||
|
||||
if (function_exists('mb_substr')) {
|
||||
$path = mb_substr($path, mb_strlen($base));
|
||||
} else {
|
||||
$path = substr($path, strlen($base));
|
||||
}
|
||||
|
||||
$path = WFUtility::cleanPath($path);
|
||||
|
||||
return ltrim($path, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether FTP mode is enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFtp()
|
||||
{
|
||||
// Initialize variables
|
||||
jimport('joomla.client.helper');
|
||||
$FTPOptions = JClientHelper::getCredentials('ftp');
|
||||
|
||||
return $FTPOptions['enabled'] == 1;
|
||||
}
|
||||
|
||||
public function getTotalSize($path, $recurse = true)
|
||||
{
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
$total = 0;
|
||||
|
||||
if (strpos($path, $this->getBaseDir()) === false) {
|
||||
$path = $this->toAbsolute($path);
|
||||
}
|
||||
|
||||
if (JFolder::exists($path)) {
|
||||
$files = JFolder::files($path, '.', $recurse, true, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html', 'thumbs.db'));
|
||||
|
||||
foreach ($files as $file) {
|
||||
$total += filesize($file);
|
||||
}
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of files in a folder.
|
||||
*
|
||||
* @return int File total
|
||||
*
|
||||
* @param string $path Absolute path to folder
|
||||
*/
|
||||
public function countFiles($path, $recurse = false)
|
||||
{
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
if (strpos($path, $this->getBaseDir()) === false) {
|
||||
$path = $this->toAbsolute($path);
|
||||
}
|
||||
|
||||
if (JFolder::exists($path)) {
|
||||
$files = JFolder::files($path, '.', $recurse, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html', 'thumbs.db'));
|
||||
|
||||
return count($files);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of folders in a folder.
|
||||
*
|
||||
* @return int Folder total
|
||||
*
|
||||
* @param string $path Absolute path to folder
|
||||
*/
|
||||
public function countFolders($path)
|
||||
{
|
||||
jimport('joomla.filesystem.folder');
|
||||
|
||||
if (strpos($path, $this->getBaseDir()) === false) {
|
||||
$path = $this->toAbsolute($path);
|
||||
}
|
||||
|
||||
if (JFolder::exists($path)) {
|
||||
$folders = JFolder::folders($path, '.', false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX'));
|
||||
|
||||
return count($folders);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getFolders($relative, $filter = '', $sort = '', $limit = 25, $start = 0, $depth = 0)
|
||||
{
|
||||
$path = $this->toAbsolute($relative);
|
||||
$path = WFUtility::fixPath($path);
|
||||
|
||||
if (!JFolder::exists($path)) {
|
||||
$relative = '/';
|
||||
$path = $this->getBaseDir();
|
||||
}
|
||||
|
||||
$list = JFolder::folders($path, $filter, $depth, true);
|
||||
|
||||
$folders = array();
|
||||
|
||||
if (!empty($list)) {
|
||||
// Sort alphabetically by default
|
||||
natcasesort($list);
|
||||
|
||||
foreach ($list as $item) {
|
||||
$item = rawurldecode($item);
|
||||
|
||||
// clean path to remove multiple slashes
|
||||
$item = WFUtility::cleanPath($item);
|
||||
|
||||
$name = WFUtility::mb_basename($item);
|
||||
$name = WFUtility::convertEncoding($name);
|
||||
|
||||
$break = false;
|
||||
|
||||
if (self::$allowroot) {
|
||||
foreach (self::$restricted as $val) {
|
||||
if ($item === WFUtility::makePath($path, $val)) {
|
||||
$break = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($break) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$id = WFUtility::makePath($relative, $name, '/');
|
||||
|
||||
if ($depth) {
|
||||
$id = $this->toRelative($item);
|
||||
$id = WFUtility::convertEncoding($id);
|
||||
$name = $id;
|
||||
}
|
||||
|
||||
// trim leading slash
|
||||
$id = ltrim($id, '/');
|
||||
|
||||
$data = array(
|
||||
'id' => $id,
|
||||
'name' => $name,
|
||||
'writable' => is_writable($item) || $this->isFtp(),
|
||||
'type' => 'folders',
|
||||
'properties' => $this->getFolderDetails($id),
|
||||
);
|
||||
|
||||
$folders[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sort && strpos($sort, 'extension') === false) {
|
||||
$folders = self::sortItemsByKey($folders, $sort);
|
||||
}
|
||||
|
||||
return $folders;
|
||||
}
|
||||
|
||||
public function getFiles($relative, $filter = '', $sort = '', $limit = 25, $start = 0, $depth = 0)
|
||||
{
|
||||
$path = $this->toAbsolute($relative);
|
||||
$path = WFUtility::fixPath($path);
|
||||
|
||||
if (!JFolder::exists($path)) {
|
||||
$relative = '/';
|
||||
$path = $this->getBaseDir();
|
||||
}
|
||||
|
||||
// excluded files
|
||||
$exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'index.html');
|
||||
|
||||
$list = JFolder::files($path, $filter, $depth, true, $exclude);
|
||||
|
||||
$files = array();
|
||||
|
||||
// get the total files in the list
|
||||
$count = count($list);
|
||||
|
||||
if (!empty($list)) {
|
||||
// Sort alphabetically by default
|
||||
natcasesort($list);
|
||||
|
||||
foreach ($list as $item) {
|
||||
$item = rawurldecode($item);
|
||||
|
||||
$name = WFUtility::mb_basename($item);
|
||||
$name = WFUtility::convertEncoding($name);
|
||||
|
||||
// create relative file
|
||||
$id = WFUtility::makePath($relative, $name, '/');
|
||||
|
||||
// check for file validity - prevent display of files with invalid encoding that have been "cleaned"
|
||||
if (!is_file(WFUtility::makePath($this->getBaseDir(), $id, '/'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($depth) {
|
||||
$id = $this->toRelative($item);
|
||||
$id = WFUtility::convertEncoding($id);
|
||||
$name = $id;
|
||||
}
|
||||
|
||||
// get basename of file name
|
||||
$name = WFUtility::mb_basename($name);
|
||||
|
||||
// create url
|
||||
$url = WFUtility::makePath($this->getRootDir(), $id, '/');
|
||||
|
||||
// remove leading slash
|
||||
$url = ltrim($url, '/');
|
||||
|
||||
$data = array(
|
||||
'id' => $id,
|
||||
'url' => $url,
|
||||
'name' => $name,
|
||||
'writable' => is_writable($item) || $this->isFtp(),
|
||||
'type' => 'files',
|
||||
'extension' => WFUtility::getExtension($name),
|
||||
'properties' => $this->getFileDetails($id, $count),
|
||||
);
|
||||
|
||||
$files[] = $data;
|
||||
}
|
||||
}
|
||||
|
||||
if ($sort) {
|
||||
$files = self::sortItemsByKey($files, $sort);
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
public function searchItems($relative, $query = '', $filetypes = array(), $sort = '', $depth = 3)
|
||||
{
|
||||
$result = array(
|
||||
'folders' => array(),
|
||||
'files' => array(),
|
||||
);
|
||||
|
||||
// get folder list
|
||||
$folders = $this->getFolders($relative, '', 0, 0, $sort, 3);
|
||||
|
||||
// filter based on passed in query
|
||||
foreach ($folders as $folder) {
|
||||
if (preg_match("/$query/u", $folder['id'])) {
|
||||
$result['folders'][] = $folder;
|
||||
}
|
||||
}
|
||||
|
||||
$filter = '';
|
||||
|
||||
// create filter for filetypes
|
||||
if (!empty($filestypes)) {
|
||||
$filter .= '\.(?i)(' . implode('|', $filetypes) . ')$';
|
||||
}
|
||||
|
||||
// get file list
|
||||
$files = $this->getFiles($relative, $filter, 0, 0, $sort, 3);
|
||||
|
||||
// filter based on passed in query
|
||||
foreach ($files as $files) {
|
||||
if (preg_match("/$query/u", $files['id'])) {
|
||||
$result['files'][] = $files;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a folders properties.
|
||||
*
|
||||
* @return array Array of properties
|
||||
*
|
||||
* @param string $dir Folder relative path
|
||||
* @param string $types File Types
|
||||
*/
|
||||
public function getFolderDetails($dir)
|
||||
{
|
||||
clearstatcache();
|
||||
|
||||
if (is_array($dir)) {
|
||||
$dir = isset($dir['id']) ? $dir['id'] : '';
|
||||
}
|
||||
|
||||
if (empty($dir)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$path = $this->toAbsolute(rawurldecode($dir));
|
||||
$date = @filemtime($path);
|
||||
|
||||
return array('modified' => $date, 'size' => '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source directory of a file path.
|
||||
*/
|
||||
public function getSourceDir($path)
|
||||
{
|
||||
// return nothing if absolute $path
|
||||
if (preg_match('#^(file|http(s)?):\/\/#', $path)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// directory path relative base directory
|
||||
if ($this->is_dir($path)) {
|
||||
return $path;
|
||||
}
|
||||
|
||||
// directory path relative to site root
|
||||
if (is_dir(WFUtility::makePath(JPATH_SITE, $path))) {
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($path, mb_strlen($this->getRootDir()));
|
||||
}
|
||||
|
||||
return substr($path, strlen($this->getRootDir()));
|
||||
}
|
||||
|
||||
// file url relative to site root
|
||||
if (is_file(WFUtility::makePath(JPATH_SITE, $path))) {
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr(dirname($path), mb_strlen($this->getRootDir()));
|
||||
}
|
||||
|
||||
return substr(dirname($path), strlen($this->getRootDir()));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
public function isMatch($needle, $haystack)
|
||||
{
|
||||
return $needle == $haystack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return constituent parts of a file path eg: base directory, file name.
|
||||
*
|
||||
* @param $path Relative or absolute path
|
||||
*/
|
||||
public function pathinfo($path)
|
||||
{
|
||||
return pathinfo($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a files properties.
|
||||
*
|
||||
* @return array Array of properties
|
||||
*
|
||||
* @param string $file File relative path
|
||||
*/
|
||||
public function getFileDetails($file, $count = 1)
|
||||
{
|
||||
clearstatcache();
|
||||
|
||||
if (is_array($file)) {
|
||||
$file = isset($file['id']) ? $file['id'] : '';
|
||||
}
|
||||
|
||||
if (empty($file)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$path = $this->toAbsolute(rawurldecode($file));
|
||||
$url = WFUtility::makePath($this->getBaseUrl(), rawurldecode($file));
|
||||
|
||||
$date = @filemtime($path);
|
||||
$size = @filesize($path);
|
||||
|
||||
$data = array(
|
||||
'size' => $size,
|
||||
'modified' => $date,
|
||||
);
|
||||
|
||||
$data['preview'] = WFUtility::cleanPath($url, '/');
|
||||
|
||||
if (preg_match('#\.(jpg|jpeg|bmp|gif|tiff|png|svg)#i', $file)) {
|
||||
$image = array();
|
||||
|
||||
if ($count <= 100) {
|
||||
if (preg_match('#\.svg$#i', $file)) {
|
||||
$svg = @simplexml_load_file($path);
|
||||
|
||||
if ($svg && isset($svg['viewBox'])) {
|
||||
list($start_x, $start_y, $end_x, $end_y) = explode(' ', $svg['viewBox']);
|
||||
|
||||
$width = (int) $end_x;
|
||||
$height = (int) $end_y;
|
||||
|
||||
if ($width && $height) {
|
||||
$image['width'] = $width;
|
||||
$image['height'] = $height;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list($image['width'], $image['height']) = @getimagesize($path);
|
||||
}
|
||||
}
|
||||
|
||||
$data['preview'] .= '?' . $date;
|
||||
|
||||
return array_merge_recursive($data, $image);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function checkRestrictedDirectory($path)
|
||||
{
|
||||
if (self::$allowroot) {
|
||||
foreach (self::$restricted as $name) {
|
||||
$restricted = $this->toAbsolute($name);
|
||||
|
||||
$match = false;
|
||||
|
||||
if (function_exists('mb_substr')) {
|
||||
$match = (mb_substr($path, 0, mb_strlen($restricted)) === $restricted);
|
||||
} else {
|
||||
$match = (substr($path, 0, strlen($restricted)) === $restricted);
|
||||
}
|
||||
|
||||
if ($match === true) {
|
||||
throw new Exception('Access to the target directory is restricted');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the relative file(s).
|
||||
*
|
||||
* @param $files the relative path to the file name or comma seperated list of multiple paths
|
||||
*
|
||||
* @return string $error on failure
|
||||
*/
|
||||
public function delete($src)
|
||||
{
|
||||
$path = $this->toAbsolute($src);
|
||||
|
||||
// get error class
|
||||
$result = new WFFileSystemResult();
|
||||
|
||||
// check path does not fall within a restricted folder
|
||||
$this->checkRestrictedDirectory($path);
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemBeforeDelete', array(&$path));
|
||||
|
||||
if (is_file($path)) {
|
||||
$result->type = 'files';
|
||||
$result->state = JFile::delete($path);
|
||||
} elseif (is_dir($path)) {
|
||||
$result->type = 'folders';
|
||||
|
||||
if ($this->countFiles($path) > 0 || $this->countFolders($path) > 0) {
|
||||
$result->message = JText::sprintf('WF_MANAGER_FOLDER_NOT_EMPTY', WFUtility::mb_basename($path));
|
||||
} else {
|
||||
$result->state = JFolder::delete($path);
|
||||
}
|
||||
}
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemAfterDelete', array($path, $result->state));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename a file.
|
||||
*
|
||||
* @param string $src The relative path of the source file
|
||||
* @param string $dest The name of the new file
|
||||
*
|
||||
* @return string $error
|
||||
*/
|
||||
public function rename($src, $dest)
|
||||
{
|
||||
$src = $this->toAbsolute(rawurldecode($src));
|
||||
$dir = WFUtility::mb_dirname($src);
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemBeforeRename', array(&$src, &$dest));
|
||||
|
||||
$result = new WFFileSystemResult();
|
||||
|
||||
if (is_file($src)) {
|
||||
$ext = WFUtility::getExtension($src);
|
||||
$file = $dest . '.' . $ext;
|
||||
$path = WFUtility::makePath($dir, $file);
|
||||
|
||||
// check path does not fall within a restricted folder
|
||||
$this->checkRestrictedDirectory($path);
|
||||
|
||||
$result->type = 'files';
|
||||
$result->state = JFile::move($src, $path);
|
||||
$result->path = $path;
|
||||
// include original source path
|
||||
$result->source = $src;
|
||||
} elseif (is_dir($src)) {
|
||||
$path = WFUtility::makePath($dir, $dest);
|
||||
|
||||
$result->type = 'folders';
|
||||
$result->state = JFolder::move($src, $path);
|
||||
$result->path = $path;
|
||||
// include original source path
|
||||
$result->source = $src;
|
||||
}
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemAfterRename', array(&$result));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a file.
|
||||
*
|
||||
* @param string $files The relative file or comma seperated list of files
|
||||
* @param string $dest The relative path of the destination dir
|
||||
*
|
||||
* @return string $error on failure
|
||||
*/
|
||||
public function copy($file, $destination)
|
||||
{
|
||||
$result = new WFFileSystemResult();
|
||||
|
||||
// trim to remove leading slash
|
||||
$file = trim($file, '/');
|
||||
|
||||
$src = $this->toAbsolute($file);
|
||||
// destination relative path
|
||||
$dest = WFUtility::makePath($destination, WFUtility::mb_basename($file));
|
||||
// destination full path
|
||||
$dest = $this->toAbsolute($dest);
|
||||
|
||||
// check destination path does not fall within a restricted folder
|
||||
$this->checkRestrictedDirectory($dest);
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemBeforeCopy', array(&$src, &$dest));
|
||||
|
||||
// src is a file
|
||||
if (is_file($src)) {
|
||||
$result->type = 'files';
|
||||
$result->state = JFile::copy($src, $dest);
|
||||
$result->path = $dest;
|
||||
// include original source path
|
||||
$result->source = $src;
|
||||
} elseif (is_dir($src)) {
|
||||
// Folders cannot be copied into themselves as this creates an infinite copy / paste loop
|
||||
if ($file === $destination) {
|
||||
$result->message = JText::_('WF_MANAGER_COPY_INTO_ERROR');
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result->type = 'folders';
|
||||
$result->state = JFolder::copy($src, $dest);
|
||||
$result->path = $dest;
|
||||
// include original source path
|
||||
$result->source = $src;
|
||||
}
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemAfterCopy', array(&$result));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a file.
|
||||
*
|
||||
* @param string $files The relative file or comma seperated list of files
|
||||
* @param string $dest The relative path of the destination dir
|
||||
*
|
||||
* @return string $error on failure
|
||||
*/
|
||||
public function move($file, $destination)
|
||||
{
|
||||
$result = new WFFileSystemResult();
|
||||
|
||||
// trim to remove leading slash
|
||||
$file = trim($file, '/');
|
||||
|
||||
$src = $this->toAbsolute($file);
|
||||
// destination relative path
|
||||
$dest = WFUtility::makePath($destination, WFUtility::mb_basename($file));
|
||||
// destination full path
|
||||
$dest = $this->toAbsolute($dest);
|
||||
|
||||
// check destination path does not fall within a restricted folder
|
||||
$this->checkRestrictedDirectory($dest);
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemBeforeMove', array(&$src, &$dest));
|
||||
|
||||
if ($src != $dest) {
|
||||
// src is a file
|
||||
if (is_file($src)) {
|
||||
$result->type = 'files';
|
||||
$result->state = JFile::move($src, $dest);
|
||||
$result->path = $dest;
|
||||
// include original source path
|
||||
$result->source = $src;
|
||||
} elseif (is_dir($src)) {
|
||||
// Folders cannot be copied into themselves as this creates an infinite copy / paste loop
|
||||
if ($file === $destination) {
|
||||
$result->message = JText::_('WF_MANAGER_COPY_INTO_ERROR');
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result->type = 'folders';
|
||||
$result->state = JFolder::move($src, $dest);
|
||||
$result->path = $dest;
|
||||
// include original source path
|
||||
$result->source = $src;
|
||||
}
|
||||
}
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemAfterMove', array(&$result));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* New folder base function. A wrapper for the JFolder::create function.
|
||||
*
|
||||
* @param string $folder The folder to create
|
||||
*
|
||||
* @return bool true on success
|
||||
*/
|
||||
public function folderCreate($folder)
|
||||
{
|
||||
if (is_dir($folder)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (@JFolder::create($folder)) {
|
||||
$buffer = '<html><body bgcolor="#FFFFFF"></body></html>';
|
||||
JFile::write($folder . '/index.html', $buffer);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* New folder.
|
||||
*
|
||||
* @param string $dir The base dir
|
||||
* @param string $new_dir The folder to be created
|
||||
*
|
||||
* @return string $error on failure
|
||||
*/
|
||||
public function createFolder($dir, $new)
|
||||
{
|
||||
// relative new folder path
|
||||
$dir = WFUtility::makePath(rawurldecode($dir), $new);
|
||||
// full folder path
|
||||
$path = $this->toAbsolute($dir);
|
||||
|
||||
// check path does not fall within a restricted folder
|
||||
$this->checkRestrictedDirectory($path);
|
||||
|
||||
$result = new WFFileSystemResult();
|
||||
|
||||
$result->state = $this->folderCreate($path);
|
||||
$result->path = $path;
|
||||
$result->type = 'folders';
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemCreateFolder', array($path, $result->state));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getDimensions($file)
|
||||
{
|
||||
$path = $this->toAbsolute(utf8_decode(rawurldecode($file)));
|
||||
|
||||
$data = array(
|
||||
'width' => '',
|
||||
'height' => '',
|
||||
);
|
||||
if (file_exists($path)) {
|
||||
$dim = @getimagesize($path);
|
||||
$data = array(
|
||||
'width' => $dim[0],
|
||||
'height' => $dim[1],
|
||||
);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function upload($method, $src, $dir, $name, $chunks = 1, $chunk = 0)
|
||||
{
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// full destination directory path
|
||||
$path = $this->toAbsolute(rawurldecode($dir));
|
||||
// full file path
|
||||
$dest = WFUtility::makePath($path, $name);
|
||||
|
||||
// check destination path does not fall within a restricted folder
|
||||
$this->checkRestrictedDirectory($dest);
|
||||
|
||||
// check for safe mode
|
||||
$safe_mode = false;
|
||||
|
||||
if (function_exists('ini_get')) {
|
||||
$safe_mode = ini_get('safe_mode');
|
||||
} else {
|
||||
$safe_mode = true;
|
||||
}
|
||||
|
||||
$result = new WFFileSystemResult();
|
||||
|
||||
// get overwrite state
|
||||
$conflict = $this->get('upload_conflict', 'overwrite');
|
||||
// get suffix
|
||||
$suffix = $this->get('upload_suffix', '_copy');
|
||||
|
||||
if ($conflict == 'unique') {
|
||||
// get extension
|
||||
$extension = WFUtility::getExtension($name);
|
||||
// get name without extension
|
||||
$name = WFUtility::stripExtension($name);
|
||||
// create tmp copy
|
||||
$tmpname = $name;
|
||||
|
||||
$x = 1;
|
||||
|
||||
while (JFile::exists($dest)) {
|
||||
if (strpos($suffix, '$') !== false) {
|
||||
$tmpname = $name . str_replace('$', $x, $suffix);
|
||||
} else {
|
||||
$tmpname .= $suffix;
|
||||
}
|
||||
|
||||
$dest = WFUtility::makePath($path, $tmpname . '.' . $extension);
|
||||
|
||||
++$x;
|
||||
}
|
||||
}
|
||||
|
||||
$app->triggerEvent('onWfFileSystemBeforeUpload', array(&$src, &$dest));
|
||||
|
||||
// create object to pass to joomla event
|
||||
$object_file = new JObject(array(
|
||||
'name' => WFUtility::mb_basename($dest),
|
||||
'tmp_name' => $src,
|
||||
'filepath' => $dest,
|
||||
));
|
||||
|
||||
// vars for Joomla events
|
||||
$vars = array('com_jce.file', &$object_file, true, array());
|
||||
|
||||
// trigger Joomla event before upload
|
||||
$app->triggerEvent('onContentBeforeSave', $vars);
|
||||
|
||||
if (JFile::upload($src, $dest, false, true)) {
|
||||
$result->state = true;
|
||||
$result->path = $dest;
|
||||
}
|
||||
|
||||
$app->triggerEvent('onWfFileSystemAfterUpload', array(&$result));
|
||||
|
||||
// update $object_file
|
||||
$object_file->name = WFUtility::mb_basename($result->path);
|
||||
$object_file->filepath = $result->path;
|
||||
|
||||
// trigger Joomla event after upload
|
||||
$app->triggerEvent('onContentAfterSave', $vars);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function exists($path)
|
||||
{
|
||||
return $this->is_dir($path) || $this->is_file($path);
|
||||
}
|
||||
|
||||
public function read($file)
|
||||
{
|
||||
$path = $this->toAbsolute(rawurldecode($file));
|
||||
|
||||
return file_get_contents($path);
|
||||
}
|
||||
|
||||
public function write($file, $content)
|
||||
{
|
||||
$path = $this->toAbsolute(rawurldecode($file));
|
||||
|
||||
// check path does not fall within a restricted folder
|
||||
$this->checkRestrictedDirectory($path);
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemBeforeWrite', array(&$path, &$content));
|
||||
|
||||
$result = JFile::write($path, $content);
|
||||
|
||||
JFactory::getApplication()->triggerEvent('onWfFileSystemAfterWrite', array($path, $result));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function is_file($path)
|
||||
{
|
||||
$path = $this->toAbsolute($path);
|
||||
return is_file($path);
|
||||
}
|
||||
|
||||
public function is_dir($path)
|
||||
{
|
||||
$path = $this->toAbsolute($path);
|
||||
return is_dir($path);
|
||||
}
|
||||
}
|
||||
40
components/com_jce/editor/extensions/filesystem/joomla.xml
Normal file
40
components/com_jce/editor/extensions/filesystem/joomla.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.8">
|
||||
<name>WF_FILESYSTEM_JOOMLA_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_FILESYSTEM_JOOMLA_DESC</description>
|
||||
<files></files>
|
||||
<fields>
|
||||
<fieldset name="filesystem.joomla">
|
||||
<field name="allow_root" type="radio" default="0" label="WF_PARAM_ALLOW_ROOT" description="WF_PARAM_ALLOW_ROOT_DESC" class="btn-group btn-group-yesno">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="restrict_dir" type="customlist" default="administrator,bin,cache,components,cli,includes,language,layouts,libraries,logs,media,modules,plugins,templates,tmp,xmlrpc" multiple="true" label="WF_PARAM_DIRECTORY_RESTRICTED" description="WF_PARAM_DIRECTORY_RESTRICTED_DESC" layout="joomla.form.field.list-fancy-select" showon="allow_root:1">
|
||||
<option value="administrator">administrator</option>
|
||||
<option value="bin">bin</option>
|
||||
<option value="cache">cache</option>
|
||||
<option value="components">components</option>
|
||||
<option value="cli">cli</option>
|
||||
<option value="includes">includes</option>
|
||||
<option value="language">language</option>
|
||||
<option value="layouts">layouts</option>
|
||||
<option value="libraries">libraries</option>
|
||||
<option value="logs">logs</option>
|
||||
<option value="media">media</option>
|
||||
<option value="modules">modules</option>
|
||||
<option value="plugins">plugins</option>
|
||||
<option value="templates">templates</option>
|
||||
<option value="tmp">tmp</option>
|
||||
<option value="xmlrpc">xmlrpc</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</extension>
|
||||
1
components/com_jce/editor/extensions/index.html
Normal file
1
components/com_jce/editor/extensions/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
1
components/com_jce/editor/extensions/links/index.html
Normal file
1
components/com_jce/editor/extensions/links/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
118
components/com_jce/editor/extensions/links/joomlalinks.php
Normal file
118
components/com_jce/editor/extensions/links/joomlalinks.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('_WF_EXT') or die('RESTRICTED');
|
||||
|
||||
class WFLinkBrowser_Joomlalinks
|
||||
{
|
||||
public $_option = array();
|
||||
public $_adapters = array();
|
||||
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct($options = array())
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
jimport('joomla.filesystem.folder');
|
||||
jimport('joomla.filesystem.file');
|
||||
|
||||
$path = __DIR__ . '/joomlalinks';
|
||||
|
||||
// Get all files
|
||||
$files = JFolder::files($path, '\.(php)$');
|
||||
|
||||
if (!empty($files)) {
|
||||
foreach ($files as $file) {
|
||||
$name = basename($file, '.php');
|
||||
|
||||
if (!$this->checkOptionAccess($name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip weblinks if it doesn't exist!
|
||||
if ($name == 'weblinks' && !JComponentHelper::isEnabled('com_weblinks')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
require_once $path . '/' . $file;
|
||||
|
||||
$classname = 'Joomlalinks' . ucfirst($name);
|
||||
|
||||
if (class_exists($classname)) {
|
||||
$this->_adapters[] = new $classname();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkOptionAccess($option)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
$option = str_replace('com_', '', $option);
|
||||
|
||||
if ($option === "contact") {
|
||||
$option = "contacts";
|
||||
}
|
||||
|
||||
return (int) $wf->getParam('links.joomlalinks.' . $option, 1) === 1;
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
// Load css
|
||||
$document = WFDocument::getInstance();
|
||||
$document->addStyleSheet(array('joomlalinks'), 'extensions/links/joomlalinks/css');
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
return (bool) $wf->getParam('links.joomlalinks.enable', 1);
|
||||
}
|
||||
|
||||
public function getOption()
|
||||
{
|
||||
foreach ($this->_adapters as $adapter) {
|
||||
$this->_option[] = $adapter->getOption();
|
||||
}
|
||||
|
||||
return $this->_option;
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
$list = '';
|
||||
|
||||
foreach ($this->_adapters as $adapter) {
|
||||
$list .= $adapter->getList();
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getLinks($args)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
foreach ($this->_adapters as $adapter) {
|
||||
if ($adapter->getOption() == $args->option) {
|
||||
|
||||
if (!$this->checkOptionAccess($args->option)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return $adapter->getLinks($args);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
75
components/com_jce/editor/extensions/links/joomlalinks.xml
Normal file
75
components/com_jce/editor/extensions/links/joomlalinks.xml
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.4" type="plugin" group="jce" method="upgrade">
|
||||
<name>WF_LINKS_JOOMLALINKS_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_LINKS_JOOMLALINKS_DESC</description>
|
||||
<files>
|
||||
<filename>joomlalinks.php</filename>
|
||||
<folder>joomlalinks</folder>
|
||||
</files>
|
||||
<!--params group="links">
|
||||
<field name="joomlalinks" type="yesno" label="WF_LABEL_EXTENSION_ENABLE" description="WF_LABEL_EXTENSION_ENABLE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
</params-->
|
||||
<fields name="joomlalinks">
|
||||
<fieldset name="links.joomlalinks">
|
||||
<field name="content" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_CONTENT" description="WF_LINKS_JOOMLALINKS_PARAM_CONTENT_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="article_alias" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_ARTICLE_ALIAS" description="WF_LINKS_JOOMLALINKS_PARAM_ARTICLE_ALIAS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="article_unpublished" type="yesno" default="0" label="WF_LINKS_JOOMLALINKS_PARAM_ARTICLE_UNPUBLISHED" description="WF_LINKS_JOOMLALINKS_PARAM_ARTICLE_UNPUBLISHED_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="static" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_UNCATEGORIZED" description="WF_LINKS_JOOMLALINKS_PARAM_UNCATEGORIZED_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="contacts" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_CONTACT" description="WF_LINKS_JOOMLALINKS_PARAM_CONTACT_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="weblinks" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_WEBLINKS" description="WF_LINKS_JOOMLALINKS_PARAM_WEBLINKS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="weblinks_alias" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_WEBLINKS_ALIAS" description="WF_LINKS_JOOMLALINKS_PARAM_WEBLINKS_ALIAS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="menu" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_MENU" description="WF_LINKS_JOOMLALINKS_PARAM_MENU_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="tags" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_TAGS" description="WF_LINKS_JOOMLALINKS_PARAM_TAGS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="tags_alias" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_PARAM_TAGS_ALIAS" description="WF_LINKS_JOOMLALINKS_PARAM_TAGS_ALIAS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="itemid" type="yesno" default="1" label="WF_LINKS_JOOMLALINKS_ITEMID" description="WF_LINKS_JOOMLALINKS_ITEMID_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="sef_url" type="yesno" default="0" label="WF_LINKS_JOOMLALINKS_SEF_URL" description="WF_LINKS_JOOMLALINKS_SEF_URL_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<plugins></plugins>
|
||||
</extension>
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JoomlalinksContact extends JObject
|
||||
{
|
||||
private $option = 'com_contact';
|
||||
|
||||
/**
|
||||
* Returns a reference to a editor object.
|
||||
*
|
||||
* This method must be invoked as:
|
||||
* <pre> $browser =JContentEditor::getInstance();</pre>
|
||||
*
|
||||
* @return JCE The editor object
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getInstance($options = array())
|
||||
{
|
||||
static $instance;
|
||||
|
||||
if (!is_object($instance)) {
|
||||
$instance = new self($options);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getOption()
|
||||
{
|
||||
return $this->option;
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return '<li id="index.php?option=com_contact" class="folder contact nolink"><div class="uk-tree-row"><a href="#"><span class="uk-tree-icon"></span><span class="uk-tree-text">' . JText::_('WF_LINKS_JOOMLALINKS_CONTACTS') . '</span></a></div></li>';
|
||||
}
|
||||
|
||||
public function getLinks($args)
|
||||
{
|
||||
$items = array();
|
||||
$view = isset($args->view) ? $args->view : '';
|
||||
|
||||
$language = '';
|
||||
|
||||
// create a new RouteHelper instance
|
||||
$router = new JHelperRoute();
|
||||
|
||||
switch ($view) {
|
||||
default:
|
||||
$categories = WFLinkBrowser::getCategory('com_contact', 1, $this->get('category_alias', 1));
|
||||
|
||||
foreach ($categories as $category) {
|
||||
// language
|
||||
if (isset($category->language)) {
|
||||
$language = $category->language;
|
||||
}
|
||||
|
||||
$url = JHelperRoute::getCategoryRoute($category->id, $language, 'com_contact');
|
||||
|
||||
// convert to SEF
|
||||
$url = self::route($url);
|
||||
|
||||
$items[] = array(
|
||||
'id' => 'index.php?option=com_contact&view=category&id=' . $category->id,
|
||||
'url' => $url,
|
||||
'name' => $category->title . ' / ' . $category->alias,
|
||||
'class' => 'folder contact',
|
||||
);
|
||||
}
|
||||
break;
|
||||
case 'category':
|
||||
$categories = WFLinkBrowser::getCategory('com_contact', $args->id, $this->get('category_alias', 1));
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$children = WFLinkBrowser::getCategory('com_contact', $category->id, $this->get('category_alias', 1));
|
||||
|
||||
// language
|
||||
if (isset($category->language)) {
|
||||
$language = $category->language;
|
||||
}
|
||||
|
||||
if ($children) {
|
||||
$id = JHelperRoute::getCategoryRoute($category->id, $language, 'com_contact');
|
||||
} else {
|
||||
$id = JHelperRoute::getCategoryRoute($category->slug, $language, 'com_contact');
|
||||
}
|
||||
|
||||
// convert to SEF
|
||||
$url = self::route($id);
|
||||
|
||||
$items[] = array(
|
||||
'url' => $url,
|
||||
'id' => $id,
|
||||
'name' => $category->title . ' / ' . $category->alias,
|
||||
'class' => 'folder content',
|
||||
);
|
||||
}
|
||||
|
||||
$contacts = self::getContacts($args->id);
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
// language
|
||||
if (isset($contact->language)) {
|
||||
$language = $contact->language;
|
||||
}
|
||||
|
||||
$id = $router->getRoute($contact->id, 'com_contact.contact', '', $language, $args->id);
|
||||
$id = self::route($id);
|
||||
|
||||
$items[] = array(
|
||||
'id' => $id,
|
||||
'name' => $contact->name . ' / ' . $contact->alias,
|
||||
'class' => 'file',
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function route($url)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
if ((bool) $wf->getParam('links.joomlalinks.sef_url', 0)) {
|
||||
$url = WFLinkHelper::route($url);
|
||||
}
|
||||
|
||||
// remove Itemid if "home"
|
||||
$url = WFLinkHelper::removeHomeItemId($url);
|
||||
|
||||
// remove Itemid
|
||||
if ((bool) $wf->getParam('links.joomlalinks.itemid', 1) === false) {
|
||||
$url = WFLinkHelper::removeItemId($url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
private static function getContacts($id)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('id, name, alias, language')->from('#__contact_details')->where(array('catid=' . (int) $id, 'published = 1'));
|
||||
|
||||
if (!$user->authorise('core.admin')) {
|
||||
$query->where('access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')');
|
||||
}
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JoomlalinksContent extends JObject
|
||||
{
|
||||
private $option = 'com_content';
|
||||
|
||||
/**
|
||||
* Returns a reference to a editor object.
|
||||
*
|
||||
* This method must be invoked as:
|
||||
* <pre> $browser =JContentEditor::getInstance();</pre>
|
||||
*
|
||||
* @return JCE The editor object
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getInstance($options = array())
|
||||
{
|
||||
static $instance;
|
||||
|
||||
if (!is_object($instance)) {
|
||||
$instance = new self($options);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getOption()
|
||||
{
|
||||
return $this->option;
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return '<li id="index.php?option=com_content" class="folder content nolink"><div class="uk-tree-row"><a href="#"><span class="uk-tree-icon"></span><span class="uk-tree-text">' . JText::_('WF_LINKS_JOOMLALINKS_CONTENT') . '</span></a></div></li>';
|
||||
}
|
||||
|
||||
public function getLinks($args)
|
||||
{
|
||||
$items = array();
|
||||
$view = isset($args->view) ? $args->view : '';
|
||||
|
||||
$language = '';
|
||||
|
||||
// create a new RouteHelper instance
|
||||
$router = new JHelperRoute();
|
||||
|
||||
switch ($view) {
|
||||
// get top-level categories
|
||||
default:
|
||||
$articles = array();
|
||||
|
||||
if (!isset($args->id)) {
|
||||
$args->id = 1;
|
||||
}
|
||||
|
||||
$categories = WFLinkBrowser::getCategory('com_content', $args->id);
|
||||
|
||||
// get any articles in this category (in Joomla! 1.6+ a category can contain sub-categories and articles)
|
||||
$articles = self::getArticles($args->id);
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$url = '';
|
||||
|
||||
if (isset($category->language)) {
|
||||
$language = $category->language;
|
||||
}
|
||||
|
||||
$id = JHelperRoute::getCategoryRoute($category->id, $language, 'com_content');
|
||||
|
||||
if (strpos($id, 'index.php?Itemid=') !== false) {
|
||||
$url = self::getMenuLink($id);
|
||||
$id = 'index.php?option=com_content&view=category&id=' . $category->id;
|
||||
}
|
||||
|
||||
$items[] = array(
|
||||
'url' => self::route($url),
|
||||
'id' => $id,
|
||||
'name' => $category->title . ' / ' . $category->alias,
|
||||
'class' => 'folder content',
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($articles)) {
|
||||
// output article links
|
||||
foreach ($articles as $article) {
|
||||
if (isset($article->language)) {
|
||||
$language = $article->language;
|
||||
}
|
||||
|
||||
$id = $router->getRoute($article->slug, 'com_content.article', '', $language, $article->catslug);
|
||||
$id = self::route($id);
|
||||
|
||||
$items[] = array(
|
||||
'id' => $id,
|
||||
'name' => $article->title . ' / ' . $article->alias,
|
||||
'class' => 'file',
|
||||
);
|
||||
|
||||
$anchors = self::getAnchors($article->content);
|
||||
|
||||
foreach ($anchors as $anchor) {
|
||||
$items[] = array(
|
||||
'id' => $id . '#' . $anchor,
|
||||
'name' => '#' . $anchor,
|
||||
'class' => 'file anchor',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
// get articles and / or sub-categories
|
||||
case 'category':
|
||||
// get any articles in this category (in Joomla! 1.6+ a category can contain sub-categories and articles)
|
||||
$articles = self::getArticles($args->id);
|
||||
|
||||
// get sub-categories
|
||||
$categories = WFLinkBrowser::getCategory('com_content', $args->id);
|
||||
|
||||
if (count($categories)) {
|
||||
foreach ($categories as $category) {
|
||||
// check for sub-categories
|
||||
$sub = WFLinkBrowser::getCategory('com_content', $category->id);
|
||||
|
||||
// language
|
||||
if (isset($category->language)) {
|
||||
$language = $category->language;
|
||||
}
|
||||
|
||||
$url = '';
|
||||
$id = JHelperRoute::getCategoryRoute($category->id, $language, 'com_content');
|
||||
|
||||
// get sub-categories
|
||||
if (count($sub)) {
|
||||
$url = $id;
|
||||
$id = 'index.php?option=com_content&view=section&id=' . $category->id;
|
||||
// no sub-categories, get articles for category
|
||||
} else {
|
||||
// no com_content, might be link like index.php?ItemId=1
|
||||
if (strpos($id, 'index.php?Itemid=') !== false) {
|
||||
$url = $id; //$id;
|
||||
$id = 'index.php?option=com_content&view=category&id=' . $category->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($url, 'index.php?Itemid=') !== false) {
|
||||
$url = self::getMenuLink($url);
|
||||
}
|
||||
|
||||
$items[] = array(
|
||||
'url' => self::route($url),
|
||||
'id' => $id,
|
||||
'name' => $category->title . ' / ' . $category->alias,
|
||||
'class' => 'folder content',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// output article links
|
||||
foreach ($articles as $article) {
|
||||
// language
|
||||
if (isset($article->language)) {
|
||||
$language = $article->language;
|
||||
}
|
||||
|
||||
$id = $router->getRoute($article->slug, 'com_content.article', '', $language, $article->catslug);
|
||||
$id = self::route($id);
|
||||
|
||||
$items[] = array(
|
||||
'id' => $id,
|
||||
'name' => $article->title . ' / ' . $article->alias,
|
||||
'class' => 'file' . ($article->state ? '' : ' unpublished uk-text-muted'),
|
||||
);
|
||||
|
||||
$anchors = self::getAnchors($article->content);
|
||||
|
||||
foreach ($anchors as $anchor) {
|
||||
$items[] = array(
|
||||
'id' => $id . '#' . $anchor,
|
||||
'name' => '#' . $anchor,
|
||||
'class' => 'file anchor',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getMenuLink($url)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
// resolve the url from the menu link
|
||||
if ($wf->getParam('links.joomlalinks.article_resolve_alias', 1)) {
|
||||
// get itemid
|
||||
preg_match('#Itemid=([\d]+)#', $url, $matches);
|
||||
// get link from menu
|
||||
if (count($matches) > 1) {
|
||||
$menu = JTable::getInstance('menu');
|
||||
$menu->load($matches[1]);
|
||||
|
||||
if ($menu->link) {
|
||||
return $menu->link . '&Itemid=' . $menu->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
private function getArticles($id)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$case = '';
|
||||
|
||||
if ($wf->getParam('links.joomlalinks.article_alias', 1)) {
|
||||
//sqlsrv changes
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when1 .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $a_id . ' END as slug';
|
||||
|
||||
$case_when2 = ' CASE WHEN ';
|
||||
$case_when2 .= $query->charLength('b.alias', '!=', '0');
|
||||
$case_when2 .= ' THEN ';
|
||||
$c_id = $query->castAsChar('b.id');
|
||||
$case_when2 .= $query->concatenate(array($c_id, 'b.alias'), ':');
|
||||
$case_when2 .= ' ELSE ';
|
||||
$case_when2 .= $c_id . ' END as catslug';
|
||||
|
||||
$case = ',' . $case_when1 . ',' . $case_when2;
|
||||
}
|
||||
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
|
||||
$query->select('a.id AS slug, b.id AS catslug, a.alias, a.state, a.title AS title, a.access, ' . $query->concatenate(array('a.introtext', 'a.fulltext')) . ' AS content, a.language' . $case);
|
||||
$query->from('#__content AS a');
|
||||
$query->innerJoin('#__categories AS b ON b.id = ' . (int) $id);
|
||||
|
||||
$query->where('a.catid = ' . (int) $id);
|
||||
|
||||
if ($wf->getParam('links.joomlalinks.article_unpublished', 0) == 1) {
|
||||
$query->where('(a.state = 0 OR a.state = 1)');
|
||||
} else {
|
||||
$query->where('a.state = 1');
|
||||
}
|
||||
|
||||
if (!$user->authorise('core.admin')) {
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
$query->where('b.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
$query->order('a.title');
|
||||
|
||||
$db->setQuery($query, 0);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
private static function getAnchors($content)
|
||||
{
|
||||
preg_match_all('#<a([^>]+)(name|id)="([a-z]+[\w\-\:\.]*)"([^>]*)>#i', $content, $matches, PREG_SET_ORDER);
|
||||
|
||||
$anchors = array();
|
||||
|
||||
if (!empty($matches)) {
|
||||
foreach ($matches as $match) {
|
||||
if (strpos($match[0], 'href') === false) {
|
||||
$anchors[] = $match[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $anchors;
|
||||
}
|
||||
|
||||
private static function route($url)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
if ((bool) $wf->getParam('links.joomlalinks.sef_url', 0)) {
|
||||
$url = WFLinkHelper::route($url);
|
||||
}
|
||||
|
||||
// remove Itemid if "home"
|
||||
$url = WFLinkHelper::removeHomeItemId($url);
|
||||
|
||||
// remove Itemid if set
|
||||
if ((bool) $wf->getParam('links.joomlalinks.itemid', 1) === false) {
|
||||
$url = WFLinkHelper::removeItemId($url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
.unpublished .uk-icon::before{content:"\e99d"}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.2 KiB |
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
347
components/com_jce/editor/extensions/links/joomlalinks/menu.php
Normal file
347
components/com_jce/editor/extensions/links/joomlalinks/menu.php
Normal file
@@ -0,0 +1,347 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JoomlalinksMenu extends JObject
|
||||
{
|
||||
private $option = 'com_menu';
|
||||
|
||||
/**
|
||||
* Returns a reference to a editor object.
|
||||
*
|
||||
* This method must be invoked as:
|
||||
* <pre> $browser =JContentEditor::getInstance();</pre>
|
||||
*
|
||||
* @return JCE The editor object
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getInstance($options = array())
|
||||
{
|
||||
static $instance;
|
||||
|
||||
if (!is_object($instance)) {
|
||||
$instance = new self($options);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getOption()
|
||||
{
|
||||
return $this->option;
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return '<li id="index.php?option=com_menu" class="folder menu nolink"><div class="uk-tree-row"><a href="#"><span class="uk-tree-icon"></span><span class="uk-tree-text">' . JText::_('WF_LINKS_JOOMLALINKS_MENU') . '</span></a></div></li>';
|
||||
}
|
||||
|
||||
public function getLinks($args)
|
||||
{
|
||||
$items = array();
|
||||
$view = isset($args->view) ? $args->view : '';
|
||||
switch ($view) {
|
||||
// create top-level (non-linkable) menu types
|
||||
default:
|
||||
$types = self::getMenuTypes();
|
||||
foreach ($types as $type) {
|
||||
$items[] = array(
|
||||
'id' => 'index.php?option=com_menu&view=menu&type=' . $type->id,
|
||||
'name' => $type->title,
|
||||
'class' => 'folder menu nolink',
|
||||
);
|
||||
}
|
||||
break;
|
||||
// get menus and sub-menus
|
||||
case 'menu':
|
||||
$type = isset($args->type) ? $args->type : 0;
|
||||
$id = $type ? 0 : $args->id;
|
||||
|
||||
$menus = self::getMenu($id, $type);
|
||||
|
||||
foreach ($menus as $menu) {
|
||||
$class = array();
|
||||
|
||||
// bypass errors in menu parameters syntax
|
||||
try {
|
||||
$params = new JRegistry($menu->params);
|
||||
} catch (Exception $e) {
|
||||
$params = new JRegistry();
|
||||
}
|
||||
|
||||
switch ($menu->type) {
|
||||
case 'separator':
|
||||
if (!$menu->link) {
|
||||
$class[] = 'nolink';
|
||||
}
|
||||
|
||||
$link = '';
|
||||
break;
|
||||
|
||||
case 'alias':
|
||||
// If this is an alias use the item id stored in the parameters to make the link.
|
||||
$link = 'index.php?Itemid=' . $params->get('aliasoptions');
|
||||
break;
|
||||
|
||||
default:
|
||||
// resolve link
|
||||
$link = $this->resolveLink($menu);
|
||||
break;
|
||||
}
|
||||
|
||||
$children = (int) self::getChildren($menu->id);
|
||||
$title = isset($menu->name) ? $menu->name : $menu->title;
|
||||
|
||||
if ($children) {
|
||||
$class = array_merge($class, array('folder', 'menu'));
|
||||
} else {
|
||||
$class[] = 'file';
|
||||
}
|
||||
|
||||
if ($params->get('secure')) {
|
||||
$link = self::toSSL($link);
|
||||
}
|
||||
|
||||
// language
|
||||
if (isset($menu->language)) {
|
||||
$link .= $this->getLangauge($menu->language);
|
||||
}
|
||||
|
||||
$items[] = array(
|
||||
'id' => $children ? 'index.php?option=com_menu&view=menu&id=' . $menu->id : $link,
|
||||
'url' => self::route($link),
|
||||
'name' => $title . ' / ' . $menu->alias,
|
||||
'class' => implode(' ', $class),
|
||||
);
|
||||
}
|
||||
break;
|
||||
// get menu items
|
||||
case 'submenu':
|
||||
$menus = self::getMenu($args->id);
|
||||
foreach ($menus as $menu) {
|
||||
if ($menu->type == 'menulink') {
|
||||
//$menu = AdvlinkMenu::_alias($menu->id);
|
||||
}
|
||||
|
||||
$children = (int) self::getChildren($menu->id);
|
||||
|
||||
$title = isset($menu->name) ? $menu->name : $menu->title;
|
||||
|
||||
// get params
|
||||
$params = new JRegistry($menu->params);
|
||||
|
||||
// resolve link
|
||||
$link = $this->resolveLink($menu);
|
||||
|
||||
// language
|
||||
if (isset($menu->language)) {
|
||||
$link .= $this->getLangauge($menu->language);
|
||||
}
|
||||
|
||||
if ($params->get('secure')) {
|
||||
$link = self::toSSL($link);
|
||||
}
|
||||
|
||||
$items[] = array(
|
||||
'id' => self::route($link),
|
||||
'name' => $title . ' / ' . $menu->alias,
|
||||
'class' => $children ? 'folder menu' : 'file',
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert link to SSL.
|
||||
*
|
||||
* @param type $link
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function toSSL($link)
|
||||
{
|
||||
if (strcasecmp(substr($link, 0, 4), 'http') && (strpos($link, 'index.php?') !== false)) {
|
||||
$uri = JURI::getInstance();
|
||||
|
||||
// Get prefix
|
||||
$prefix = $uri->toString(array('host', 'port'));
|
||||
|
||||
// trim slashes
|
||||
$link = trim($link, '/');
|
||||
|
||||
// Build the URL.
|
||||
$link = 'https://' . $prefix . '/' . $link;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
private function resolveLink($menu)
|
||||
{
|
||||
// get link from menu object
|
||||
$link = $menu->link;
|
||||
|
||||
// internal link
|
||||
if ($link && strpos($link, 'index.php') === 0) {
|
||||
if ((int) $this->get('menu_resolve_alias', 1)) {
|
||||
// no Itemid
|
||||
if (strpos($link, 'Itemid=') === false) {
|
||||
$link .= '&Itemid=' . $menu->id;
|
||||
}
|
||||
// short link
|
||||
} else {
|
||||
$link = 'index.php?Itemid=' . $menu->id;
|
||||
}
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
private static function getMenuTypes()
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select('*')->from('#__menu_types')->where('client_id = 0')->order('title');
|
||||
|
||||
$db->setQuery($query, 0);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
private static function getAlias($id)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select('params')->from('#__menu')->where('id = ' . (int) $id);
|
||||
|
||||
$db->setQuery($query, 0);
|
||||
$params = new JRegistry($db->loadResult());
|
||||
|
||||
$query->clear();
|
||||
$query->select('id, name, link, alias')->from('#__menu')->where(array('published = 1', 'id = ' . (int) $params->get('menu_item')));
|
||||
|
||||
if (!$user->authorise('core.admin')) {
|
||||
$query->where('access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')');
|
||||
}
|
||||
|
||||
$query->order('name');
|
||||
|
||||
$db->setQuery($query, 0);
|
||||
|
||||
return $db->loadObject();
|
||||
}
|
||||
|
||||
private static function getChildren($id)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select('COUNT(id)')->from('#__menu')->where(array('published = 1', 'client_id = 0'));
|
||||
|
||||
if (!$user->authorise('core.admin')) {
|
||||
$query->where('access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')');
|
||||
}
|
||||
|
||||
if ($id) {
|
||||
$query->where('parent_id = ' . (int) $id);
|
||||
}
|
||||
|
||||
$db->setQuery($query, 0);
|
||||
|
||||
return $db->loadResult();
|
||||
}
|
||||
|
||||
private static function getMenu($parent = 0, $type = 0)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$query->select('m.*')->from('#__menu AS m');
|
||||
|
||||
if ($type) {
|
||||
$query->innerJoin('#__menu_types AS s ON s.id = ' . (int) $type);
|
||||
$query->where('m.menutype = s.menutype');
|
||||
}
|
||||
|
||||
if ($parent == 0) {
|
||||
$parent = 1;
|
||||
}
|
||||
|
||||
$query->where(array('m.published = 1', 'm.parent_id = ' . (int) $parent));
|
||||
|
||||
if (!$user->authorise('core.admin')) {
|
||||
$query->where('m.access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')');
|
||||
}
|
||||
|
||||
// only site menu items
|
||||
$query->where('m.client_id = 0');
|
||||
|
||||
$query->order('m.lft ASC');
|
||||
|
||||
$db->setQuery($query, 0);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
private function getLangauge($language)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$link = '';
|
||||
|
||||
$query->select('a.sef AS sef');
|
||||
$query->select('a.lang_code AS lang_code');
|
||||
$query->from('#__languages AS a');
|
||||
$db->setQuery($query);
|
||||
$langs = $db->loadObjectList();
|
||||
|
||||
foreach ($langs as $lang) {
|
||||
if ($language == $lang->lang_code) {
|
||||
$language = $lang->sef;
|
||||
$link .= '&lang=' . $language;
|
||||
}
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
private static function route($url)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
if ((bool) $wf->getParam('links.joomlalinks.sef_url', 0)) {
|
||||
$url = WFLinkHelper::route($url);
|
||||
}
|
||||
|
||||
// remove Itemid if "home"
|
||||
$url = WFLinkHelper::removeHomeItemId($url);
|
||||
|
||||
// remove Itemid
|
||||
if ((bool) $wf->getParam('links.joomlalinks.itemid', 1) === false) {
|
||||
$url = WFLinkHelper::removeItemId($url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
150
components/com_jce/editor/extensions/links/joomlalinks/tags.php
Normal file
150
components/com_jce/editor/extensions/links/joomlalinks/tags.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JoomlalinksTags extends JObject
|
||||
{
|
||||
private $option = 'com_tags';
|
||||
|
||||
/**
|
||||
* Returns a reference to a editor object.
|
||||
*
|
||||
* This method must be invoked as:
|
||||
* <pre> $browser =JContentEditor::getInstance();</pre>
|
||||
*
|
||||
* @return JCE The editor object
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getInstance($options = array())
|
||||
{
|
||||
static $instance;
|
||||
|
||||
if (!is_object($instance)) {
|
||||
$instance = new self($options);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getOption()
|
||||
{
|
||||
return $this->option;
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return '<li id="index.php?option=com_tags" class="folder content nolink"><div class="uk-tree-row"><a href="#"><span class="uk-tree-icon"></span><span class="uk-tree-text">' . JText::_('WF_LINKS_JOOMLALINKS_TAGS') . '</span></a></div></li>';
|
||||
}
|
||||
|
||||
public function getLinks($args)
|
||||
{
|
||||
require_once JPATH_SITE . '/components/com_tags/helpers/route.php';
|
||||
|
||||
$items = array();
|
||||
$view = isset($args->view) ? $args->view : '';
|
||||
|
||||
$language = '';
|
||||
|
||||
// create a new RouteHelper instance
|
||||
$router = new JHelperRoute();
|
||||
|
||||
$tags = array();
|
||||
|
||||
if (!isset($args->id)) {
|
||||
$args->id = 1;
|
||||
}
|
||||
|
||||
// get any articles in this category (in Joomla! 1.6+ a category can contain sub-categories and articles)
|
||||
$tags = self::getTags($args->id);
|
||||
|
||||
if (!empty($tags)) {
|
||||
// output article links
|
||||
foreach ($tags as $tag) {
|
||||
if (isset($tag->language)) {
|
||||
$language = $tag->language;
|
||||
}
|
||||
|
||||
$id = $router->getRoute($tag->slug, 'com_tags.tag', '', $language);
|
||||
$id = $this->route($id);
|
||||
|
||||
$items[] = array(
|
||||
'id' => $id,
|
||||
'name' => $tag->title . ' / ' . $tag->alias,
|
||||
'class' => 'file',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getTags($id)
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('a.id, a.title, a.alias');
|
||||
|
||||
if ($wf->getParam('links.joomlalinks.tag_alias', 1)) {
|
||||
$case_when_item_alias = ' CASE WHEN ';
|
||||
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when_item_alias .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when_item_alias .= ' ELSE ';
|
||||
$case_when_item_alias .= $a_id . ' END as slug';
|
||||
$query->select($case_when_item_alias);
|
||||
}
|
||||
|
||||
$query->from('#__tags AS a');
|
||||
$query->where('a.alias <> ' . $db->quote('root'));
|
||||
$query->where($db->qn('a.published') . ' = 1');
|
||||
|
||||
if (!$user->authorise('core.admin')) {
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
if (JLanguageMultilang::isEnabled()) {
|
||||
$tag = JFactory::getLanguage()->getTag();
|
||||
$query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')');
|
||||
}
|
||||
|
||||
$query->order('a.title');
|
||||
|
||||
$db->setQuery($query, 0);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
private static function route($url)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
if ((bool) $wf->getParam('links.joomlalinks.sef_url', 0)) {
|
||||
$url = WFLinkHelper::route($url);
|
||||
}
|
||||
|
||||
// remove Itemid if "home"
|
||||
$url = WFLinkHelper::removeHomeItemId($url);
|
||||
|
||||
// remove Itemid
|
||||
if ((bool) $wf->getParam('links.joomlalinks.itemid', 1) === false) {
|
||||
$url = WFLinkHelper::removeItemId($url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
class JoomlalinksWeblinks extends JObject
|
||||
{
|
||||
private $option = 'com_weblinks';
|
||||
|
||||
/**
|
||||
* Returns a reference to a editor object.
|
||||
*
|
||||
* This method must be invoked as:
|
||||
* <pre> $browser =JContentEditor::getInstance();</pre>
|
||||
*
|
||||
* @return JCE The editor object
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getInstance($options = array())
|
||||
{
|
||||
static $instance;
|
||||
|
||||
if (!is_object($instance)) {
|
||||
$instance = new self($options);
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getOption()
|
||||
{
|
||||
return $this->option;
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return '<li id="index.php?option=com_weblinks&view=categories" class="folder menu nolink"><div class="uk-tree-row"><a href="#"><span class="uk-tree-icon"></span><span class="uk-tree-text">' . JText::_('WF_LINKS_JOOMLALINKS_WEBLINKS') . '</span></a></div></li>';
|
||||
}
|
||||
|
||||
public function getLinks($args)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
$items = array();
|
||||
|
||||
if (!defined('JPATH_PLATFORM')) {
|
||||
require_once JPATH_SITE . '/includes/application.php';
|
||||
}
|
||||
|
||||
require_once JPATH_SITE . '/components/com_weblinks/helpers/route.php';
|
||||
|
||||
$language = '';
|
||||
|
||||
switch ($args->view) {
|
||||
// Get all WebLink categories
|
||||
default:
|
||||
case 'categories':
|
||||
$categories = WFLinkBrowser::getCategory('com_weblinks', 1, $wf->getParam('links.joomlalinks.category_alias', 1));
|
||||
|
||||
foreach ($categories as $category) {
|
||||
$url = '';
|
||||
|
||||
if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
|
||||
// language
|
||||
if (isset($category->language)) {
|
||||
$language = $category->language;
|
||||
}
|
||||
|
||||
$id = WeblinksHelperRoute::getCategoryRoute($category->id, $language);
|
||||
|
||||
if (strpos($id, 'index.php?Itemid=') !== false) {
|
||||
$url = $id;
|
||||
$id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
|
||||
}
|
||||
} else {
|
||||
$itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
|
||||
$id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
|
||||
}
|
||||
|
||||
$items[] = array(
|
||||
'url' => self::route($url),
|
||||
'id' => $id,
|
||||
'name' => $category->title . ' / ' . $category->alias,
|
||||
'class' => 'folder weblink',
|
||||
);
|
||||
}
|
||||
break;
|
||||
// Get all links in the category
|
||||
case 'category':
|
||||
$categories = WFLinkBrowser::getCategory('com_weblinks', $args->id, $wf->getParam('links.joomlalinks.category_alias', 1));
|
||||
|
||||
if (count($categories)) {
|
||||
foreach ($categories as $category) {
|
||||
$children = WFLinkBrowser::getCategory('com_weblinks', $category->id, $wf->getParam('links.joomlalinks.category_alias', 1));
|
||||
|
||||
$url = '';
|
||||
|
||||
if ($children) {
|
||||
$id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
|
||||
} else {
|
||||
if (method_exists('WeblinksHelperRoute', 'getCategoryRoute')) {
|
||||
// language
|
||||
if (isset($category->language)) {
|
||||
$language = $category->language;
|
||||
}
|
||||
|
||||
$id = WeblinksHelperRoute::getCategoryRoute($category->id, $language);
|
||||
|
||||
if (strpos($id, 'index.php?Itemid=') !== false) {
|
||||
$url = $id;
|
||||
$id = 'index.php?option=com_weblinks&view=category&id=' . $category->id;
|
||||
}
|
||||
} else {
|
||||
$itemid = WFLinkBrowser::getItemId('com_weblinks', array('categories' => null, 'category' => $category->id));
|
||||
$id = 'index.php?option=com_weblinks&view=category&id=' . $category->id . $itemid;
|
||||
}
|
||||
}
|
||||
|
||||
$items[] = array(
|
||||
'url' => self::route($url),
|
||||
'id' => $id,
|
||||
'name' => $category->title . ' / ' . $category->alias,
|
||||
'class' => 'folder weblink',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$weblinks = self::getWeblinks($args->id);
|
||||
|
||||
foreach ($weblinks as $weblink) {
|
||||
// language
|
||||
if (isset($weblink->language)) {
|
||||
$language = $weblink->language;
|
||||
}
|
||||
|
||||
$id = WeblinksHelperRoute::getWeblinkRoute($weblink->slug, $weblink->catslug, $language);
|
||||
|
||||
if (defined('JPATH_PLATFORM')) {
|
||||
$id .= '&task=weblink.go';
|
||||
}
|
||||
|
||||
$items[] = array(
|
||||
'id' => self::route($id),
|
||||
'name' => $weblink->title . ' / ' . $weblink->alias,
|
||||
'class' => 'file',
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
public static function getWeblinks($id)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
$db = JFactory::getDBO();
|
||||
$user = JFactory::getUser();
|
||||
|
||||
$dbquery = $db->getQuery(true);
|
||||
|
||||
$section = JText::_('Web Links');
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$case = '';
|
||||
|
||||
if ((int) $wf->getParam('links.joomlalinks.weblinks_alias', 1)) {
|
||||
//sqlsrv changes
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $dbquery->charLength('a.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$a_id = $dbquery->castAsChar('a.id');
|
||||
$case_when1 .= $dbquery->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $a_id . ' END as slug';
|
||||
|
||||
$case_when2 = ' CASE WHEN ';
|
||||
$case_when2 .= $dbquery->charLength('b.alias', '!=', '0');
|
||||
$case_when2 .= ' THEN ';
|
||||
$c_id = $dbquery->castAsChar('b.id');
|
||||
$case_when2 .= $dbquery->concatenate(array($c_id, 'b.alias'), ':');
|
||||
$case_when2 .= ' ELSE ';
|
||||
$case_when2 .= $c_id . ' END as catslug';
|
||||
|
||||
$case .= ',' . $case_when1 . ',' . $case_when2;
|
||||
}
|
||||
|
||||
$query->select('a.id AS slug, b.id AS catslug, a.title AS title, a.description AS text, a.url, a.alias, a.language' . $case);
|
||||
|
||||
$query->from('#__weblinks AS a');
|
||||
$query->innerJoin('#__categories AS b ON b.id = ' . (int) $id);
|
||||
$query->where('a.catid = ' . (int) $id);
|
||||
|
||||
$query->where('a.state = 1');
|
||||
|
||||
if (!$user->authorise('core.admin')) {
|
||||
$query->where('b.access IN (' . implode(',', $user->getAuthorisedViewLevels()) . ')');
|
||||
}
|
||||
|
||||
$query->where('b.published = 1');
|
||||
$query->order('a.title');
|
||||
|
||||
$db->setQuery($query, 0);
|
||||
|
||||
return $db->loadObjectList();
|
||||
}
|
||||
|
||||
private static function route($url)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
if ($wf->getParam('links.joomlalinks.sef_url', 0)) {
|
||||
$url = WFLinkHelper::route($url);
|
||||
}
|
||||
|
||||
// remove Itemid if "home"
|
||||
$url = WFLinkHelper::removeHomeItemId($url);
|
||||
|
||||
// remove Itemid
|
||||
if ((bool) $wf->getParam('links.joomlalinks.itemid', 1) === false) {
|
||||
$url = WFLinkHelper::removeItemId($url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
1
components/com_jce/editor/extensions/popups/index.html
Normal file
1
components/com_jce/editor/extensions/popups/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
63
components/com_jce/editor/extensions/popups/jcemediabox.php
Normal file
63
components/com_jce/editor/extensions/popups/jcemediabox.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('_WF_EXT') or die('RESTRICTED');
|
||||
|
||||
class WFPopupsExtension_Jcemediabox
|
||||
{
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if (self::isEnabled()) {
|
||||
$scripts = array();
|
||||
|
||||
$document = WFDocument::getInstance();
|
||||
|
||||
$document->addScript('jcemediabox', 'extensions/popups/jcemediabox/js');
|
||||
$document->addStyleSheet('jcemediabox', 'extensions/popups/jcemediabox/css');
|
||||
}
|
||||
}
|
||||
|
||||
public function getParams()
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
return array(
|
||||
'width' => 600,
|
||||
'album' => '#jcemediabox_popup_group',
|
||||
'multiple' => '#jcemediabox_popup_title,#jcemediabox_popup_caption',
|
||||
'attribute' => $wf->getParam('popups.jcemediabox.attribute', 'data-mediabox'),
|
||||
'popup_group' => $wf->getParam('popups.jcemediabox.popup_group', ''),
|
||||
'popup_icon' => $wf->getParam('popups.jcemediabox.popup_icon', 1),
|
||||
'popup_icon_position' => $wf->getParam('popups.jcemediabox.popup_icon_position', ''),
|
||||
'popup_autopopup' => $wf->getParam('popups.jcemediabox.popup_autopopup', ''),
|
||||
'popup_hide' => $wf->getParam('popups.jcemediabox.popup_hide', 0),
|
||||
'popup_mediatype' => $wf->getParam('popups.jcemediabox.popup_mediatype', ''),
|
||||
);
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
if ((JPluginHelper::isEnabled('system', 'jcemediabox') || JPluginHelper::isEnabled('system', 'wf_lightcase')) && $wf->getParam('popups.jcemediabox.enable', 1) == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function checkVersion()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
74
components/com_jce/editor/extensions/popups/jcemediabox.xml
Normal file
74
components/com_jce/editor/extensions/popups/jcemediabox.xml
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.4" type="plugin" group="jce" method="upgrade">
|
||||
<name>WF_POPUPS_JCEMEDIABOX_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_POPUPS_JCEMEDIABOX_DESC</description>
|
||||
<files>
|
||||
<file>jcemediabox.php</file>
|
||||
<folder>jcemediabox</folder>
|
||||
</files>
|
||||
<fields name="jcemediabox">
|
||||
<fieldset name="jcemediabox">
|
||||
<field name="enable" type="yesno" default="1" label="WF_LABEL_EXTENSION_ENABLE" description="WF_LABEL_EXTENSION_ENABLE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="popup_group" type="text" default="" label="WF_POPUPS_JCEMEDIABOX_GROUP" description="WF_POPUPS_JCEMEDIABOX_GROUP_DESC" />
|
||||
|
||||
<field name="popup_icon" type="yesno" default="1" label="WF_POPUPS_JCEMEDIABOX_ICON" description="WF_POPUPS_JCEMEDIABOX_ICON_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="popup_icon_position" type="list" default="" label="WF_POPUPS_JCEMEDIABOX_ICON_POSITION" description="WF_POPUPS_JCEMEDIABOX_ICON_POSITION_DESC">
|
||||
<option value="">WF_OPTION_NOT_SET</option>
|
||||
<option value="icon-left">WF_OPTION_LEFT</option>
|
||||
<option value="icon-right">WF_OPTION_RIGHT</option>
|
||||
<option value="icon-top-left">WF_OPTION_TOP_LEFT</option>
|
||||
<option value="icon-top-right">WF_OPTION_TOP_RIGHT</option>
|
||||
<option value="icon-bottom-left">WF_OPTION_BOTTOM_LEFT</option>
|
||||
<option value="icon-bottom-right">WF_OPTION_BOTTOM_RIGHT</option>
|
||||
</field>
|
||||
|
||||
<field name="popup_autopopup" type="list" default="" label="WF_POPUPS_JCEMEDIABOX_AUTO" description="WF_POPUPS_JCEMEDIABOX_AUTO_DESC">
|
||||
<option value="">WF_OPTION_NOT_SET</option>
|
||||
<option value="autopopup-single">WF_POPUPS_JCEMEDIABOX_AUTO_SINGLE</option>
|
||||
<option value="autopopup-multiple">WF_POPUPS_JCEMEDIABOX_AUTO_MULTIPLE</option>
|
||||
</field>
|
||||
|
||||
<field name="popup_hide" type="yesno" default="0" label="WF_POPUPS_JCEMEDIABOX_HIDE" description="WF_POPUPS_JCEMEDIABOX_HIDE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="popup_mediatype" type="list" default="" label="WF_POPUPS_JCEMEDIABOX_MEDIATYPE" description="WF_POPUPS_JCEMEDIABOX_MEDIATYPE_DESC">
|
||||
<option value="">WF_OPTION_NOT_SET</option>
|
||||
<option value="text/html">WF_POPUPS_JCEMEDIABOX_INTERNAL</option>
|
||||
<option value="iframe">WF_POPUPS_JCEMEDIABOX_EXTERNAL</option>
|
||||
<option value="image">WF_POPUPS_JCEMEDIABOX_IMAGE</option>
|
||||
<option value="application/x-shockwave-flash">WF_POPUPS_JCEMEDIABOX_FLASH</option>
|
||||
<option value="video/quicktime">WF_POPUPS_JCEMEDIABOX_QUICKTIME</option>
|
||||
<option value="application/x-mplayer2">WF_POPUPS_JCEMEDIABOX_WINDOWSMEDIA</option>
|
||||
<option value="video/divx">WF_POPUPS_JCEMEDIABOX_DIVX</option>
|
||||
<option value="application/x-director">WF_POPUPS_JCEMEDIABOX_DIRECTOR</option>
|
||||
<option value="audio/x-pn-realaudio-plugin">WF_POPUPS_JCEMEDIABOX_REAL</option>
|
||||
<option value="video/mp4">WF_POPUPS_JCEMEDIABOX_VIDEO_MP4</option>
|
||||
<option value="audio/mp3">WF_POPUPS_JCEMEDIABOX_AUDIO_MP3</option>
|
||||
<option value="video/webm">WF_POPUPS_JCEMEDIABOX_VIDEO_WEBM</option>
|
||||
<option value="audio/webm">WF_POPUPS_JCEMEDIABOX_AUDIO_WEBM</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
<media></media>
|
||||
<plugins>link,imgmanager_ext,mediamanager,filemanager</plugins>
|
||||
<languages></languages>
|
||||
</extension>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
#jcemediabox_popup_height,#jcemediabox_popup_width{width:65px}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('_WF_EXT') or die('RESTRICTED');
|
||||
|
||||
?>
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="jcemediabox_popup_title" class="uk-form-label uk-width-1-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_OPTION_TITLE_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_OPTION_TITLE'); ?></label>
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
<input id="jcemediabox_popup_title" class="uk-input-multiple" type="text" class="text" value="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="jcemediabox_popup_caption" class="uk-form-label uk-width-1-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_CAPTION_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_CAPTION'); ?></label>
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
<input id="jcemediabox_popup_caption" class="uk-input-multiple" type="text" class="text" value="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="jcemediabox_popup_group" class="uk-form-label uk-width-1-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_GROUP_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_GROUP'); ?></label>
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
<input id="jcemediabox_popup_group" type="text" class="text" value="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label class="hastip uk-form-label uk-width-1-5" title="<?php echo JText::_('WF_LABEL_DIMENSIONS_DESC'); ?>">
|
||||
<?php echo JText::_('WF_LABEL_DIMENSIONS'); ?>
|
||||
</label>
|
||||
<div class="uk-form-controls uk-grid uk-grid-collapse uk-width-4-5 uk-form-constrain">
|
||||
|
||||
<div class="uk-form-controls">
|
||||
<input type="text" id="jcemediabox_popup_width" value="" class="uk-text-center" />
|
||||
</div>
|
||||
|
||||
<div class="uk-form-controls">
|
||||
<strong class="uk-form-label uk-text-center uk-vertical-align-middle">×</strong>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-controls">
|
||||
<input type="text" id="jcemediabox_popup_height" value="" class="uk-text-center" />
|
||||
</div>
|
||||
|
||||
<label class="uk-form-label">
|
||||
<input class="uk-constrain-checkbox" type="checkbox" checked />
|
||||
<?php echo JText::_('WF_LABEL_PROPORTIONAL'); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="jcemediabox_popup_icon" class="uk-form-label uk-width-1-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_ICON_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_ICON'); ?></label>
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
<div class="uk-width-1-5">
|
||||
<select id="jcemediabox_popup_icon">
|
||||
<option value="0"><?php echo JText::_('JNO'); ?></option>
|
||||
<option value="1" selected="selected"><?php echo JText::_('JYES'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-3-5 uk-margin-left">
|
||||
<label for="jcemediabox_popup_icon_position" class="uk-form-label uk-width-2-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_ICON_POSITION_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_ICON_POSITION'); ?></label>
|
||||
<div class="uk-form-controls uk-width-3-5">
|
||||
<select id="jcemediabox_popup_icon_position">
|
||||
<option value=""><?php echo JText::_('WF_OPTION_NOT_SET'); ?></option>
|
||||
<option value="zoom-left"><?php echo JText::_('WF_OPTION_LEFT'); ?></option>
|
||||
<option value="zoom-right"><?php echo JText::_('WF_OPTION_RIGHT'); ?></option>
|
||||
<option value="zoom-top-left"><?php echo JText::_('WF_OPTION_TOP_LEFT'); ?></option>
|
||||
<option value="zoom-top-right"><?php echo JText::_('WF_OPTION_TOP_RIGHT'); ?></option>
|
||||
<option value="zoom-bottom-left"><?php echo JText::_('WF_OPTION_BOTTOM_LEFT'); ?></option>
|
||||
<option value="zoom-bottom-right"><?php echo JText::_('WF_OPTION_BOTTOM_RIGHT'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="jcemediabox_popup_hide" class="uk-form-label uk-width-1-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_HIDE_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_HIDE'); ?></label>
|
||||
<div class="uk-form-controls uk-width-4-5">
|
||||
<div class="uk-width-1-5">
|
||||
<select id="jcemediabox_popup_hide">
|
||||
<option value="0"><?php echo JText::_('JNO'); ?></option>
|
||||
<option value="1"><?php echo JText::_('JYES'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="uk-width-3-5 uk-margin-left">
|
||||
<label for="jcemediabox_popup_autopopup" class="uk-form-label uk-width-2-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_AUTO_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_AUTO'); ?></label>
|
||||
<div class="uk-form-controls uk-width-3-5">
|
||||
<select id="jcemediabox_popup_autopopup">
|
||||
<option value=""><?php echo JText::_('WF_OPTION_NOT_SET'); ?></option>
|
||||
<option value="autopopup-single"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_AUTO_SINGLE'); ?></option>
|
||||
<option value="autopopup-multiple"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_AUTO_MULTIPLE'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="jcemediabox_popup_mediatype" class="uk-form-label uk-width-1-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_MEDIATYPE_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_MEDIATYPE'); ?></label>
|
||||
<div class="uk-form-controls uk-width-2-5">
|
||||
<select id="jcemediabox_popup_mediatype">
|
||||
<option value=""><?php echo JText::_('WF_OPTION_NOT_SET'); ?></option>
|
||||
<option value="text/html"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_INTERNAL'); ?></option>
|
||||
<option value="iframe"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_EXTERNAL'); ?></option>
|
||||
<option value="image"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_IMAGE'); ?></option>
|
||||
<option value="video/youtube"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_YOUTUBE'); ?></option>
|
||||
<option value="video/vimeo"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_VIMEO'); ?></option>
|
||||
<option value="application/x-shockwave-flash"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_FLASH'); ?></option>
|
||||
<option value="video/quicktime"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_QUICKTIME'); ?></option>
|
||||
<option value="application/x-mplayer2"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_WINDOWSMEDIA'); ?></option>
|
||||
<option value="video/divx"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_DIVX'); ?></option>
|
||||
<option value="application/x-director"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_DIRECTOR'); ?></option>
|
||||
<option value="audio/x-pn-realaudio-plugin"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_REAL'); ?></option>
|
||||
<option value="video/mp4"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_VIDEO_MP4'); ?></option>
|
||||
<option value="audio/mp3"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_AUDIO_MP3'); ?></option>
|
||||
<option value="video/webm"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_VIDEO_WEBM'); ?></option>
|
||||
<option value="audio/webm"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_AUDIO_WEBM'); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-form-row uk-grid uk-grid-small">
|
||||
<label for="jcemediabox_popup_params" class="uk-form-label uk-width-1-5 hastip" title="<?php echo JText::_('WF_POPUPS_JCEMEDIABOX_PARAMS_DESC'); ?>"><?php echo JText::_('WF_POPUPS_JCEMEDIABOX_PARAMS'); ?></label>
|
||||
<div class="uk-width-4-5" id="jcemediabox_popup_params">
|
||||
<div class="uk-form-row uk-repeatable">
|
||||
<div class="uk-form-controls uk-grid uk-grid-small uk-width-9-10">
|
||||
<label class="uk-form-label uk-width-1-6"><?php echo JText::_('WF_LABEL_NAME'); ?></label>
|
||||
<div class="uk-form-controls uk-width-1-3">
|
||||
<input type="text" name="jcemediabox_popup_params_name[]" />
|
||||
</div>
|
||||
<label class="uk-form-label uk-width-1-6"><?php echo JText::_('WF_LABEL_VALUE'); ?></label>
|
||||
<div class="uk-form-controls uk-width-1-3">
|
||||
<input type="text" name="jcemediabox_popup_params_value[]" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="uk-form-controls uk-margin-small-left">
|
||||
<button class="uk-button uk-button-link uk-repeatable-create" aria-label="<?php echo JText::_('WF_LABEL_ADD'); ?>" title="<?php echo JText::_('WF_LABEL_ADD'); ?>"><i class="uk-icon-plus"></i></button>
|
||||
<button class="uk-button uk-button-link uk-repeatable-delete" aria-label="<?php echo JText::_('WF_LABEL_REMOVE'); ?>" title="<?php echo JText::_('WF_LABEL_REMOVE'); ?>"><i class="uk-icon-trash"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Adapted from the Joomla Search.categories plugin - plugins/search/categories/categories.php
|
||||
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
|
||||
*
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Categories search plugin.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class PlgWfSearchCategories extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 3.1
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Determine areas searchable by this plugin.
|
||||
*
|
||||
* @return array An array of search areas.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function onContentSearchAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'categories' => 'PLG_SEARCH_CATEGORIES_CATEGORIES',
|
||||
);
|
||||
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search content (categories).
|
||||
*
|
||||
* The SQL must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav.
|
||||
*
|
||||
* @param string $text Target search string.
|
||||
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
|
||||
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
|
||||
* @param mixed $areas An array if the search is to be restricted to areas or null to search all areas.
|
||||
*
|
||||
* @return array Search results.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$user = JFactory::getUser();
|
||||
$app = JFactory::getApplication();
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$searchText = $text;
|
||||
|
||||
if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$limit = $this->params->def('search_limit', 50);
|
||||
$text = trim($text);
|
||||
|
||||
if ($text === '') {
|
||||
return array();
|
||||
}
|
||||
|
||||
switch ($ordering) {
|
||||
case 'alpha':
|
||||
$order = 'a.title ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
case 'popular':
|
||||
case 'newest':
|
||||
case 'oldest':
|
||||
default:
|
||||
$order = 'a.title DESC';
|
||||
}
|
||||
|
||||
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// SQLSRV changes.
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $a_id . ' END as slug';
|
||||
|
||||
$query->select('a.title, a.description AS text, a.id AS catid, a.created_time, a.language, ' . $case_when);
|
||||
$query->from('#__categories AS a');
|
||||
$query->where(
|
||||
'(a.title LIKE ' . $text . ' OR a.description LIKE ' . $text . ') AND a.published = 1 AND a.extension = '
|
||||
. $db->quote('com_content') . 'AND a.access IN (' . $groups . ')'
|
||||
);
|
||||
|
||||
$query->group('a.id, a.title, a.description, a.alias, a.created_time');
|
||||
$query->order($order);
|
||||
|
||||
$db->setQuery($query, 0, $limit);
|
||||
|
||||
try
|
||||
{
|
||||
$rows = $db->loadObjectList();
|
||||
} catch (RuntimeException $e) {
|
||||
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
|
||||
}
|
||||
|
||||
if ($rows) {
|
||||
foreach ($rows as $i => $row) {
|
||||
$rows[$i]->href = JHelperRoute::getCategoryRoute($row->slug, $row->language, 'com_content');
|
||||
$rows[$i]->section = JText::_('JCATEGORY');
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Adapted from the Joomla Search.contacts plugin - plugins/search/contacts/contacts.php
|
||||
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
|
||||
*
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Contacts search plugin.
|
||||
*/
|
||||
class PlgWfSearchContacts extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Determine areas searchable by this plugin.
|
||||
*
|
||||
* @return array An array of search areas.
|
||||
*/
|
||||
public function onContentSearchAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'contacts' => 'PLG_SEARCH_CONTACTS_CONTACTS'
|
||||
);
|
||||
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search content (contacts).
|
||||
*
|
||||
* The SQL must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav.
|
||||
*
|
||||
* @param string $text Target search string.
|
||||
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
|
||||
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
|
||||
* @param string $areas An array if the search is to be restricted to areas or null to search all areas.
|
||||
*
|
||||
* @return array Search results.
|
||||
*/
|
||||
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$app = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
|
||||
// create a new RouteHelper instance
|
||||
$router = new JHelperRoute();
|
||||
|
||||
if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$limit = $this->params->def('search_limit', 50);
|
||||
|
||||
$text = trim($text);
|
||||
|
||||
if ($text === '')
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$section = JText::_('PLG_SEARCH_CONTACTS_CONTACTS');
|
||||
|
||||
switch ($ordering)
|
||||
{
|
||||
case 'alpha':
|
||||
$order = 'a.name ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$order = 'c.title ASC, a.name ASC';
|
||||
break;
|
||||
|
||||
case 'popular':
|
||||
case 'newest':
|
||||
case 'oldest':
|
||||
default:
|
||||
$order = 'a.name DESC';
|
||||
}
|
||||
|
||||
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// SQLSRV changes.
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $a_id . ' END as slug';
|
||||
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $query->charLength('c.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$c_id = $query->castAsChar('c.id');
|
||||
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $c_id . ' END as catslug';
|
||||
|
||||
$query->select(
|
||||
'a.name AS title, a.con_position, a.misc, a.language, '
|
||||
. $case_when . ',' . $case_when1 . ', '
|
||||
. $query->concatenate(array('a.name', 'a.con_position', 'a.misc'), ',') . ' AS text'
|
||||
);
|
||||
$query->from('#__contact_details AS a')
|
||||
->join('INNER', '#__categories AS c ON c.id = a.catid')
|
||||
->where(
|
||||
'(a.name LIKE ' . $text . ' OR a.misc LIKE ' . $text . ' OR a.con_position LIKE ' . $text
|
||||
. ' OR a.address LIKE ' . $text . ' OR a.suburb LIKE ' . $text . ' OR a.state LIKE ' . $text
|
||||
. ' OR a.country LIKE ' . $text . ' OR a.postcode LIKE ' . $text . ' OR a.telephone LIKE ' . $text
|
||||
. ' OR a.fax LIKE ' . $text . ') AND a.published = 1 AND c.published = 1 '
|
||||
. ' AND a.access IN (' . $groups . ') AND c.access IN (' . $groups . ')'
|
||||
)
|
||||
->order($order);
|
||||
|
||||
$db->setQuery($query, 0, $limit);
|
||||
|
||||
try
|
||||
{
|
||||
$rows = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$rows = array();
|
||||
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
|
||||
}
|
||||
|
||||
if ($rows)
|
||||
{
|
||||
// create a new RouteHelper instance
|
||||
$router = new JHelperRoute();
|
||||
|
||||
foreach ($rows as $key => $row)
|
||||
{
|
||||
$rows[$key]->href = $router->getRoute($row->slug, 'com_contact.contact', '', $row->language, $row->catslug);
|
||||
$rows[$key]->text = $row->title;
|
||||
$rows[$key]->text .= $row->con_position ? ', ' . $row->con_position : '';
|
||||
$rows[$key]->text .= $row->misc ? ', ' . $row->misc : '';
|
||||
|
||||
$rows[$key]->section = $section;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Adapted from the Joomla Search.content plugin - plugins/search/content/content.php
|
||||
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
|
||||
*
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Content search plugin.
|
||||
*
|
||||
*/
|
||||
class PlgWfSearchContent extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Determine areas searchable by this plugin.
|
||||
*
|
||||
* @return array An array of search areas.
|
||||
*
|
||||
*/
|
||||
public function onContentSearchAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'content' => 'JGLOBAL_ARTICLES',
|
||||
);
|
||||
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search content (articles).
|
||||
* The SQL must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav.
|
||||
*
|
||||
* @param string $text Target search string.
|
||||
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
|
||||
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
|
||||
* @param mixed $areas An array if the search it to be restricted to areas or null to search all areas.
|
||||
*
|
||||
* @return array Search results.
|
||||
*
|
||||
*/
|
||||
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$serverType = $db->getServerType();
|
||||
$app = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$tag = JFactory::getLanguage()->getTag();
|
||||
|
||||
$searchText = $text;
|
||||
|
||||
if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas()))) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$limit = $this->params->def('search_limit', 50);
|
||||
|
||||
$nullDate = $db->getNullDate();
|
||||
$date = JFactory::getDate();
|
||||
$now = $date->toSql();
|
||||
|
||||
$text = trim($text);
|
||||
|
||||
if ($text === '') {
|
||||
return array();
|
||||
}
|
||||
|
||||
$relevance = array();
|
||||
|
||||
switch ($phrase) {
|
||||
case 'exact':
|
||||
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
|
||||
$wheres2 = array();
|
||||
$wheres2[] = 'a.title LIKE ' . $text;
|
||||
$wheres2[] = 'a.introtext LIKE ' . $text;
|
||||
$wheres2[] = 'a.fulltext LIKE ' . $text;
|
||||
|
||||
$relevance[] = ' CASE WHEN ' . $wheres2[0] . ' THEN 5 ELSE 0 END ';
|
||||
|
||||
$where = '(' . implode(') OR (', $wheres2) . ')';
|
||||
break;
|
||||
|
||||
case 'all':
|
||||
case 'any':
|
||||
default:
|
||||
$words = explode(' ', $text);
|
||||
$wheres = array();
|
||||
|
||||
foreach ($words as $word) {
|
||||
$word = $db->quote('%' . $db->escape($word, true) . '%', false);
|
||||
$wheres2 = array();
|
||||
$wheres2[] = 'LOWER(a.title) LIKE LOWER(' . $word . ')';
|
||||
$wheres2[] = 'LOWER(a.introtext) LIKE LOWER(' . $word . ')';
|
||||
$wheres2[] = 'LOWER(a.fulltext) LIKE LOWER(' . $word . ')';
|
||||
|
||||
$relevance[] = ' CASE WHEN ' . $wheres2[0] . ' THEN 5 ELSE 0 END ';
|
||||
|
||||
$wheres[] = implode(' OR ', $wheres2);
|
||||
}
|
||||
|
||||
$where = '(' . implode(($phrase === 'all' ? ') AND (' : ') OR ('), $wheres) . ')';
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($ordering) {
|
||||
case 'oldest':
|
||||
$order = 'a.created ASC';
|
||||
break;
|
||||
|
||||
case 'popular':
|
||||
$order = 'a.hits DESC';
|
||||
break;
|
||||
|
||||
case 'alpha':
|
||||
$order = 'a.title ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$order = 'c.title ASC, a.title ASC';
|
||||
break;
|
||||
|
||||
case 'newest':
|
||||
default:
|
||||
$order = 'a.created DESC';
|
||||
break;
|
||||
}
|
||||
|
||||
$rows = array();
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Search articles.
|
||||
if ($limit > 0) {
|
||||
//sqlsrv changes
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when1 .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $a_id . ' END as slug';
|
||||
|
||||
$case_when2 = ' CASE WHEN ';
|
||||
$case_when2 .= $query->charLength('b.alias', '!=', '0');
|
||||
$case_when2 .= ' THEN ';
|
||||
$c_id = $query->castAsChar('b.id');
|
||||
$case_when2 .= $query->concatenate(array($c_id, 'b.alias'), ':');
|
||||
$case_when2 .= ' ELSE ';
|
||||
$case_when2 .= $c_id . ' END as catslug';
|
||||
|
||||
$case = ',' . $case_when1 . ',' . $case_when2;
|
||||
|
||||
if (!empty($relevance)) {
|
||||
$query->select(implode(' + ', $relevance) . ' AS relevance');
|
||||
$order = ' relevance DESC, ' . $order;
|
||||
}
|
||||
|
||||
$query->select('a.id AS slug, b.id AS catslug, a.alias, a.state, a.title AS title, a.access, ' . $query->concatenate(array('a.introtext', 'a.fulltext')) . ' AS text, a.language' . $case);
|
||||
$query->from('#__content AS a');
|
||||
$query->innerJoin('#__categories AS b ON b.id = a.catid');
|
||||
$query->where('(' . $where . ') AND a.state = 1 AND b.published = 1');
|
||||
|
||||
if (!$user->authorise('core.admin')) {
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
$query->where('b.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
$query->order($order);
|
||||
|
||||
$db->setQuery($query, 0, $limit);
|
||||
|
||||
try
|
||||
{
|
||||
$rows = $db->loadObjectList();
|
||||
} catch (RuntimeException $e) {
|
||||
$rows = array();
|
||||
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
|
||||
}
|
||||
|
||||
if ($rows) {
|
||||
// create a new RouteHelper instance
|
||||
$router = new JHelperRoute();
|
||||
|
||||
foreach ($rows as $key => $row) {
|
||||
$rows[$key]->href = $router->getRoute($row->slug, 'com_content.article', '', $row->language, $row->catslug);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Adapted from the Joomla Search.tags plugin - plugins/search/tags/tags.php
|
||||
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
|
||||
*
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
/**
|
||||
* Tags search plugin.
|
||||
*
|
||||
*/
|
||||
class PlgWfSearchTags extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Determine areas searchable by this plugin.
|
||||
*
|
||||
* @return array An array of search areas.
|
||||
*
|
||||
*/
|
||||
public function onContentSearchAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'tags' => 'PLG_SEARCH_TAGS_TAGS'
|
||||
);
|
||||
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search content (tags).
|
||||
*
|
||||
* The SQL must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav.
|
||||
*
|
||||
* @param string $text Target search string.
|
||||
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
|
||||
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
|
||||
* @param string $areas An array if the search is to be restricted to areas or null to search all areas.
|
||||
*
|
||||
* @return array Search results.
|
||||
*
|
||||
* @since 3.3
|
||||
*/
|
||||
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$app = JFactory::getApplication();
|
||||
$user = JFactory::getUser();
|
||||
$lang = JFactory::getLanguage();
|
||||
|
||||
$section = JText::_('PLG_SEARCH_TAGS_TAGS');
|
||||
$limit = $this->params->def('search_limit', 50);
|
||||
|
||||
if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$text = trim($text);
|
||||
|
||||
if ($text === '')
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
|
||||
|
||||
switch ($ordering)
|
||||
{
|
||||
case 'alpha':
|
||||
$order = 'a.title ASC';
|
||||
break;
|
||||
|
||||
case 'newest':
|
||||
$order = 'a.created_time DESC';
|
||||
break;
|
||||
|
||||
case 'oldest':
|
||||
$order = 'a.created_time ASC';
|
||||
break;
|
||||
|
||||
case 'popular':
|
||||
default:
|
||||
$order = 'a.title DESC';
|
||||
}
|
||||
|
||||
$query->select('a.id, a.title, a.alias, a.note, a.published, a.access'
|
||||
. ', a.checked_out, a.checked_out_time, a.created_user_id'
|
||||
. ', a.path, a.parent_id, a.level, a.lft, a.rgt'
|
||||
. ', a.language, a.created_time AS created, a.description');
|
||||
|
||||
$case_when_item_alias = ' CASE WHEN ';
|
||||
$case_when_item_alias .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when_item_alias .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when_item_alias .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when_item_alias .= ' ELSE ';
|
||||
$case_when_item_alias .= $a_id . ' END as slug';
|
||||
$query->select($case_when_item_alias);
|
||||
|
||||
$query->from('#__tags AS a');
|
||||
$query->where('a.alias <> ' . $db->quote('root'));
|
||||
|
||||
$query->where('(a.title LIKE ' . $text . ' OR a.alias LIKE ' . $text . ')');
|
||||
|
||||
$query->where($db->qn('a.published') . ' = 1');
|
||||
|
||||
if (!$user->authorise('core.admin'))
|
||||
{
|
||||
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
$query->order($order);
|
||||
|
||||
$db->setQuery($query, 0, $limit);
|
||||
|
||||
try
|
||||
{
|
||||
$rows = $db->loadObjectList();
|
||||
}
|
||||
catch (RuntimeException $e)
|
||||
{
|
||||
$rows = array();
|
||||
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
|
||||
}
|
||||
|
||||
if ($rows)
|
||||
{
|
||||
// create a new RouteHelper instance
|
||||
$router = new JHelperRoute();
|
||||
|
||||
foreach ($rows as $key => $row)
|
||||
{
|
||||
$rows[$key]->href = $router->getRoute($row->slug, 'com_tags.tag', '', $row->language);
|
||||
$rows[$key]->text = ($row->description !== '' ? $row->description : $row->title);
|
||||
$rows[$key]->text .= $row->note;
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
*
|
||||
* Adapted from the Joomla Search.weblinks plugin - plugins/search/weblinks/weblinks.php
|
||||
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
|
||||
*
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
require_once JPATH_SITE . '/components/com_weblinks/helpers/route.php';
|
||||
|
||||
/**
|
||||
* Weblinks search plugin.
|
||||
*
|
||||
*/
|
||||
class PlgWfSearchWeblinks extends JPlugin
|
||||
{
|
||||
/**
|
||||
* Load the language file on instantiation.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
/**
|
||||
* Determine areas searchable by this plugin.
|
||||
*
|
||||
* @return array An array of search areas.
|
||||
*
|
||||
*/
|
||||
public function onContentSearchAreas()
|
||||
{
|
||||
static $areas = array(
|
||||
'weblinks' => 'PLG_SEARCH_WEBLINKS_WEBLINKS'
|
||||
);
|
||||
|
||||
return $areas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search content (weblinks).
|
||||
*
|
||||
* The SQL must return the following fields that are used in a common display
|
||||
* routine: href, title, section, created, text, browsernav
|
||||
*
|
||||
* @param string $text Target search string.
|
||||
* @param string $phrase Matching option (possible values: exact|any|all). Default is "any".
|
||||
* @param string $ordering Ordering option (possible values: newest|oldest|popular|alpha|category). Default is "newest".
|
||||
* @param mixed $areas An array if the search it to be restricted to areas or null to search all areas.
|
||||
*
|
||||
* @return array Search results.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
|
||||
{
|
||||
$db = JFactory::getDbo();
|
||||
$groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
|
||||
|
||||
$searchText = $text;
|
||||
|
||||
if (is_array($areas))
|
||||
{
|
||||
if (!array_intersect($areas, array_keys($this->onContentSearchAreas())))
|
||||
{
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
$limit = $this->params->def('search_limit', 50);
|
||||
$state = array();
|
||||
|
||||
$text = trim($text);
|
||||
|
||||
if ($text == '')
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
switch ($phrase)
|
||||
{
|
||||
case 'exact':
|
||||
$text = $db->quote('%' . $db->escape($text, true) . '%', false);
|
||||
$wheres2 = array();
|
||||
$wheres2[] = 'a.url LIKE ' . $text;
|
||||
$wheres2[] = 'a.description LIKE ' . $text;
|
||||
$wheres2[] = 'a.title LIKE ' . $text;
|
||||
$where = '(' . implode(') OR (', $wheres2) . ')';
|
||||
break;
|
||||
|
||||
case 'all':
|
||||
case 'any':
|
||||
default:
|
||||
$words = explode(' ', $text);
|
||||
$wheres = array();
|
||||
|
||||
foreach ($words as $word)
|
||||
{
|
||||
$word = $db->quote('%' . $db->escape($word, true) . '%', false);
|
||||
$wheres2 = array();
|
||||
$wheres2[] = 'a.url LIKE ' . $word;
|
||||
$wheres2[] = 'a.description LIKE ' . $word;
|
||||
$wheres2[] = 'a.title LIKE ' . $word;
|
||||
$wheres[] = implode(' OR ', $wheres2);
|
||||
}
|
||||
|
||||
$where = '(' . implode(($phrase == 'all' ? ') AND (' : ') OR ('), $wheres) . ')';
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($ordering)
|
||||
{
|
||||
case 'oldest':
|
||||
$order = 'a.created ASC';
|
||||
break;
|
||||
|
||||
case 'popular':
|
||||
$order = 'a.hits DESC';
|
||||
break;
|
||||
|
||||
case 'alpha':
|
||||
$order = 'a.title ASC';
|
||||
break;
|
||||
|
||||
case 'category':
|
||||
$order = 'c.title ASC, a.title ASC';
|
||||
break;
|
||||
|
||||
case 'newest':
|
||||
default:
|
||||
$order = 'a.created DESC';
|
||||
}
|
||||
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// SQLSRV changes.
|
||||
$case_when = ' CASE WHEN ';
|
||||
$case_when .= $query->charLength('a.alias', '!=', '0');
|
||||
$case_when .= ' THEN ';
|
||||
$a_id = $query->castAsChar('a.id');
|
||||
$case_when .= $query->concatenate(array($a_id, 'a.alias'), ':');
|
||||
$case_when .= ' ELSE ';
|
||||
$case_when .= $a_id . ' END as slug';
|
||||
|
||||
$case_when1 = ' CASE WHEN ';
|
||||
$case_when1 .= $query->charLength('c.alias', '!=', '0');
|
||||
$case_when1 .= ' THEN ';
|
||||
$c_id = $query->castAsChar('c.id');
|
||||
$case_when1 .= $query->concatenate(array($c_id, 'c.alias'), ':');
|
||||
$case_when1 .= ' ELSE ';
|
||||
$case_when1 .= $c_id . ' END as catslug';
|
||||
|
||||
$query->select('a.title AS title, a.created AS created, a.url, a.description AS text, a.language, ' . $case_when . "," . $case_when1)
|
||||
->from('#__weblinks AS a')
|
||||
->join('INNER', '#__categories as c ON c.id = a.catid')
|
||||
->where('(' . $where . ') AND a.state = 1 AND c.published = 1 AND c.access IN (' . $groups . ')')
|
||||
->order($order);
|
||||
|
||||
$db->setQuery($query, 0, $limit);
|
||||
$rows = $db->loadObjectList();
|
||||
|
||||
if ($rows)
|
||||
{
|
||||
foreach ($rows as $key => $row)
|
||||
{
|
||||
$rows[$key]->href = WeblinksHelperRoute::getWeblinkRoute($row->slug, $row->catslug, $row->language);
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
1
components/com_jce/editor/extensions/search/css/link.css
Normal file
1
components/com_jce/editor/extensions/search/css/link.css
Normal file
@@ -0,0 +1 @@
|
||||
#search-browser,#searchbox{position:relative}#search-browser button{padding:0 .5em}#search-browser button .uk-icon{margin:auto}#searchbox{z-index:1}div#search-browser input[type=checkbox],div#search-browser input[type=radio]{vertical-align:middle}.phrases-box input[type=radio]{margin:-3px 5px 0 0}#searchbox input{border-top-right-radius:0;border-bottom-right-radius:0;margin:0}#searchbox+div{margin-left:-1px;padding:0}#search-button{border-top-left-radius:0;border-bottom-left-radius:0}#search-clear{display:none}#search-clear.uk-active{display:block}#search-browser .uk-icon-spinner{display:none;right:0}#search-browser.loading .uk-icon-spinner{display:block;opacity:1}#search-result{width:100%;height:100%;position:absolute;display:none;overflow:auto;overflow-x:hidden;margin:2px 0}#search-result dl{margin:5px 0;padding:10px}#search-result dl dt{cursor:pointer;font-weight:700;text-overflow:ellipsis;overflow:hidden;white-space:pre;text-decoration:underline}div#search-browser div#search-result dl.odd{background-color:#F5F5F5}div#search-browser div#search-result dl dd.anchor{line-height:32px;cursor:pointer}div#search-browser #search-options{width:100%;padding:5px;margin:2px 0 0}div#search-browser #search-options fieldset{margin:0;padding:0}div#search-browser #search-options fieldset>div{margin:5px 0}div#search-browser #search-options label{min-width:40px}#search-options-button{line-height:1}#search-options .search_only ul{list-style:none;padding:0;margin:0}#search-options .search_only ul li{display:inline-block}@media (max-width:375px){#search-button span{display:none}}
|
||||
1
components/com_jce/editor/extensions/search/index.html
Normal file
1
components/com_jce/editor/extensions/search/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
||||
2
components/com_jce/editor/extensions/search/js/link.js
Normal file
2
components/com_jce/editor/extensions/search/js/link.js
Normal file
@@ -0,0 +1,2 @@
|
||||
/* jce - 2.9.32 | 2022-11-01 | https://www.joomlacontenteditor.net | Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
|
||||
var WFLinkSearch=WFExtensions.add("LinkSearch",{options:{element:"#search-input",button:"#search-button",clear:"#search-clear",empty:"No Results",onClick:$.noop},init:function(options){$.extend(this.options,options);var self=this,el=this.options.element,btn=this.options.button;$(btn).on("click",function(e){self.search(),e.preventDefault()}).button({icons:{primary:"uk-icon-search"}}),$("#search-clear").on("click",function(e){$(this).hasClass("uk-active")&&($(this).removeClass("uk-active"),$(el).val(""),$("#search-result").empty().hide())}),$("#search-options-button").on("click",function(e){e.preventDefault(),$(this).addClass("uk-active");var $p=$("#search-options").parent();$("#search-options").height($p.parent().height()-$p.outerHeight()-15).toggle()}).on("close",function(){$(this).removeClass("uk-active"),$("#search-options").hide()}),$(el).on("change keyup",function(){""===this.value&&($("#search-result").empty().hide(),$("#search-clear").removeClass("uk-active"))})},search:function(){var self=this,s=this.options,el=s.element,$p=(s.button,$("#search-result").parent()),query=$(el).val();query&&!$(el).hasClass("placeholder")&&($("#search-clear").removeClass("uk-active"),$("#search-browser").addClass("loading"),query=$.trim(query.replace(/[\///<>#]/g,"")),Wf.JSON.request("doSearch",{json:[query]},function(results){if(results){if(results.error)return void Wf.Dialog.alert(results.error);$("#search-result").empty(),results.length?($.each(results,function(i,values){console.log(values),$.each(values,function(name,items){$("<h3>"+name+"</h3>").appendTo("#search-result"),$.each(items,function(i,item){var $dl=$('<dl class="uk-margin-small" />').appendTo("#search-result");$('<dt class="link uk-margin-small" />').text(item.title).on("click",function(){$.isFunction(self.options.onClick)&&self.options.onClick.call(this,Wf.String.decode(item.link))}).prepend('<i class="uk-icon uk-icon-file-text-o uk-margin-small-right" />').appendTo($dl),$('<dd class="text">'+item.text+"</dd>").appendTo($dl),item.anchors&&$.each(item.anchors,function(i,a){$('<dd class="anchor"><i role="presentation" class="uk-icon uk-icon-anchor uk-margin-small-right"></i>#'+a+"</dd>").on("click",function(){self.options.onClick.call(this,Wf.String.decode(item.link)+"#"+a)}).appendTo($dl)})})})}),$("dl:odd","#search-result").addClass("odd")):$("#search-result").append("<p>"+s.empty+"</p>"),$("#search-options-button").trigger("close"),$("#search-result").height($p.parent().height()-$p.outerHeight()-5).show()}$("#search-browser").removeClass("loading"),$("#search-clear").addClass("uk-active")},self))}});
|
||||
459
components/com_jce/editor/extensions/search/link.php
Normal file
459
components/com_jce/editor/extensions/search/link.php
Normal file
@@ -0,0 +1,459 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (c) 2009-2022 Ryan Demmer. All rights reserved
|
||||
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* JCE is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses
|
||||
*/
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
use Joomla\String\StringHelper;
|
||||
|
||||
class WFLinkSearchExtension extends WFSearchExtension
|
||||
{
|
||||
private $enabled = array();
|
||||
|
||||
protected function loadDefaultAdapter($plugin)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
|
||||
// create component name from plugin - special case for "contacts"
|
||||
$component = ($plugin == 'contacts') ? 'com_contact' : 'com_' . $plugin;
|
||||
|
||||
// check for associated component
|
||||
if (!JComponentHelper::isEnabled($component)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$adapter = __DIR__ . '/adapter/' . $plugin . '/' . $plugin . '.php';
|
||||
|
||||
if (!is_file($adapter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
require_once $adapter;
|
||||
|
||||
// create classname, eg: PlgSearchContent
|
||||
$className = 'PlgWfSearch' . ucfirst($plugin);
|
||||
|
||||
if (!class_exists($className)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// simple plugin config
|
||||
$config = array(
|
||||
'name' => $plugin,
|
||||
'type' => 'search',
|
||||
'params' => array(
|
||||
'search_limit' => 10
|
||||
),
|
||||
);
|
||||
|
||||
// Joomla 4
|
||||
if (method_exists($app, 'getDispatcher')) {
|
||||
$dispatcher = $app->getDispatcher();
|
||||
$instance = new $className($dispatcher, (array) $config);
|
||||
$instance->registerListeners();
|
||||
} else {
|
||||
$dispatcher = JEventDispatcher::getInstance();
|
||||
$instance = new $className($dispatcher, (array) $config);
|
||||
}
|
||||
|
||||
$this->enabled[] = $plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor activating the default information of the class.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$request = WFRequest::getInstance();
|
||||
|
||||
$request->setRequest(array($this, 'doSearch'));
|
||||
$request->setRequest(array($this, 'getAreas'));
|
||||
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
// get plugins
|
||||
$plugins = $wf->getParam('search.link.plugins', array());
|
||||
|
||||
// set defaults if empty
|
||||
if (empty($plugins)) {
|
||||
$plugins = array('categories', 'contacts', 'content', 'tags');
|
||||
}
|
||||
|
||||
// list core adapters
|
||||
$adapters = array('categories', 'contacts', 'content', 'tags', 'weblinks');
|
||||
|
||||
// check and load external search plugins
|
||||
foreach ($plugins as $plugin) {
|
||||
// process core search plugins
|
||||
if (in_array($plugin, $adapters)) {
|
||||
$this->loadDefaultAdapter($plugin);
|
||||
continue;
|
||||
}
|
||||
|
||||
// plugin must be enabled
|
||||
if (!JPluginHelper::isEnabled('search', $plugin)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check plugin imports correctly - plugin may have a db entry, but is missing files
|
||||
if (JPluginHelper::importPlugin('search', $plugin)) {
|
||||
$this->enabled[] = $plugin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function display()
|
||||
{
|
||||
parent::display();
|
||||
|
||||
$document = WFDocument::getInstance();
|
||||
$document->addScript(array('link'), 'extensions.search.js');
|
||||
$document->addStylesheet(array('link'), 'extensions.search.css');
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
return (bool) $wf->getParam('search.link.enable', 1) && !empty($this->enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the search areas.
|
||||
*/
|
||||
public function getAreas()
|
||||
{
|
||||
$app = JFactory::getApplication('site');
|
||||
|
||||
$areas = array();
|
||||
$results = array();
|
||||
|
||||
$searchareas = $app->triggerEvent('onContentSearchAreas');
|
||||
|
||||
foreach ($searchareas as $area) {
|
||||
if (is_array($area)) {
|
||||
$areas = array_merge($areas, $area);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($areas as $k => $v) {
|
||||
$results[$k] = JText::_($v);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/*
|
||||
* Truncate search text
|
||||
* This method uses portions of components/com_finder/views/search/tmpl/default_result.php
|
||||
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
|
||||
*/
|
||||
private function truncateText($text, $searchword)
|
||||
{
|
||||
// Calculate number of characters to display around the result
|
||||
$term_length = StringHelper::strlen($searchword);
|
||||
|
||||
$lang = JFactory::getLanguage();
|
||||
$desc_length = $lang->getSearchDisplayedCharactersNumber();
|
||||
|
||||
$pad_length = $term_length < $desc_length ? (int) floor(($desc_length - $term_length) / 2) : 0;
|
||||
|
||||
// Find the position of the search term
|
||||
$pos = $term_length ? StringHelper::strpos(StringHelper::strtolower($text), StringHelper::strtolower($searchword)) : false;
|
||||
|
||||
// Find a potential start point
|
||||
$start = ($pos && $pos > $pad_length) ? $pos - $pad_length : 0;
|
||||
|
||||
// Find a space between $start and $pos, start right after it.
|
||||
$space = StringHelper::strpos($text, ' ', $start > 0 ? $start - 1 : 0);
|
||||
$start = ($space && $space < $pos) ? $space + 1 : $start;
|
||||
|
||||
$text = JHtml::_('string.truncate', StringHelper::substr($text, $start), $desc_length, false);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare search content by clean and truncating
|
||||
* This method uses portions of SearchHelper::prepareSearchContent from administrator/components/com_search/helpers/search.php
|
||||
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
|
||||
*/
|
||||
public function prepareSearchContent($text, $searchword)
|
||||
{
|
||||
// Replace line breaking tags with whitespace.
|
||||
$text = preg_replace("'<(br[^/>]*?/|hr[^/>]*?/|/(div|h[1-6]|li|p|td))>'si", ' ', $text);
|
||||
|
||||
// clean text
|
||||
$text = htmlspecialchars(strip_tags($text));
|
||||
|
||||
// remove shortcode
|
||||
$text = preg_replace('#{.+?}#', '', $text);
|
||||
|
||||
// truncate text based around searchword
|
||||
$text = $this->truncateText($text, $searchword);
|
||||
|
||||
// highlight searchword
|
||||
$text = preg_replace('#\b(' . preg_quote($searchword, '#') . ')\b#i', '<mark>$1</mark>', $text);
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/*
|
||||
* Render Search fields
|
||||
* This method uses portions of SearchViewSearch::display from components/com_search/views/search/view.html.php
|
||||
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
public function render()
|
||||
{
|
||||
if (!$this->isEnabled()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// built select lists
|
||||
$orders = array();
|
||||
$orders[] = JHtml::_('select.option', 'newest', JText::_('WF_SEARCH_NEWEST_FIRST'));
|
||||
$orders[] = JHtml::_('select.option', 'oldest', JText::_('WF_SEARCH_OLDEST_FIRST'));
|
||||
$orders[] = JHtml::_('select.option', 'popular', JText::_('WF_SEARCH_MOST_POPULAR'));
|
||||
$orders[] = JHtml::_('select.option', 'alpha', JText::_('WF_SEARCH_ALPHABETICAL'));
|
||||
$orders[] = JHtml::_('select.option', 'category', JText::_('WF_CATEGORY'));
|
||||
|
||||
$lists = array();
|
||||
$lists['ordering'] = JHtml::_('select.genericlist', $orders, 'ordering', 'class="inputbox"', 'value', 'text');
|
||||
|
||||
$searchphrases = array();
|
||||
$searchphrases[] = JHtml::_('select.option', 'all', JText::_('WF_SEARCH_ALL_WORDS'));
|
||||
$searchphrases[] = JHtml::_('select.option', 'any', JText::_('WF_SEARCH_ANY_WORDS'));
|
||||
$searchphrases[] = JHtml::_('select.option', 'exact', JText::_('WF_SEARCH_EXACT_PHRASE'));
|
||||
$lists['searchphrase'] = JHtml::_('select.radiolist', $searchphrases, 'searchphrase', '', 'value', 'text', 'all');
|
||||
|
||||
$view = $this->getView(array('name' => 'search', 'layout' => 'search'));
|
||||
|
||||
$view->searchareas = self::getAreas();
|
||||
$view->lists = $lists;
|
||||
|
||||
$view->display();
|
||||
}
|
||||
|
||||
private static function getSearchAreaFromUrl($url)
|
||||
{
|
||||
$query = parse_url($url, PHP_URL_QUERY);
|
||||
|
||||
if (empty($query)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
parse_str($query, $values);
|
||||
|
||||
if (!array_key_exists('option', $values)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$language = JFactory::getLanguage();
|
||||
|
||||
$option = $values['option'];
|
||||
|
||||
// load system language file
|
||||
$language->load($option . '.sys', JPATH_ADMINISTRATOR);
|
||||
$language->load($option, JPATH_ADMINISTRATOR);
|
||||
|
||||
return JText::_($option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process search.
|
||||
*
|
||||
* @param type $query Search query
|
||||
* @return array Search Results
|
||||
*
|
||||
* This method uses portions of SearchController::search from components/com_search/controller.php
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved
|
||||
*/
|
||||
public function doSearch($query)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
$results = array();
|
||||
|
||||
if (empty($query)) {
|
||||
return $results;
|
||||
}
|
||||
|
||||
// search area
|
||||
$area = null;
|
||||
|
||||
// available search areas
|
||||
$areas = $this->getAreas();
|
||||
|
||||
// query using a specific plugin
|
||||
if (strpos($query, ':') !== false) {
|
||||
preg_match('#^(' . implode('|', $areas) . ')\:(.+)#', $query, $matches);
|
||||
|
||||
if ($matches) {
|
||||
$area = array($matches[1]);
|
||||
$query = $matches[2];
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('JSite')) {
|
||||
// Load JSite class
|
||||
JLoader::register('JSite', JPATH_SITE . '/includes/application.php');
|
||||
}
|
||||
|
||||
$app = JFactory::getApplication('site');
|
||||
$filter = JFilterInput::getInstance();
|
||||
$router = $app::getRouter('site');
|
||||
|
||||
// get router mode
|
||||
$sef = (int) $wf->getParam('search.link.sef_url', 0);
|
||||
|
||||
$limit = (int) $wf->getParam('search.link.limit', 50);
|
||||
|
||||
// set router off so a raw url is returned by the Search plugin
|
||||
if ($router) {
|
||||
//$router->setMode(0);
|
||||
}
|
||||
|
||||
// slashes cause errors, <> get stripped anyway later on. # causes problems.
|
||||
$searchword = trim(str_replace(array('#', '>', '<', '\\'), '', $filter->clean($query)));
|
||||
|
||||
$ordering = null;
|
||||
$searchphrase = 'all';
|
||||
|
||||
// if searchword enclosed in double quotes, strip quotes and do exact match
|
||||
if (substr($searchword, 0, 1) == '"' && substr($searchword, -1) == '"') {
|
||||
$searchword = substr($searchword, 1, -1);
|
||||
$searchphrase = 'exact';
|
||||
}
|
||||
|
||||
$searchphrase = $app->input->post->getWord('searchphrase', $searchphrase);
|
||||
|
||||
// get passed through ordering
|
||||
$ordering = $app->input->post->getWord('ordering', $ordering);
|
||||
|
||||
// get passed through area
|
||||
$area = $app->input->post->getCmd('areas', (array) $area);
|
||||
|
||||
if (empty($area)) {
|
||||
$area = null;
|
||||
}
|
||||
|
||||
// trigger search on loaded plugins
|
||||
$searches = $app->triggerEvent('onContentSearch', array(
|
||||
$searchword,
|
||||
$searchphrase,
|
||||
$ordering,
|
||||
$area,
|
||||
));
|
||||
|
||||
$rows = array();
|
||||
|
||||
foreach ($searches as $search) {
|
||||
$rows = array_merge((array) $rows, (array) $search);
|
||||
}
|
||||
|
||||
// get first 10
|
||||
$rows = array_slice($rows, 0, $limit);
|
||||
|
||||
$areas = array();
|
||||
|
||||
for ($i = 0, $count = count($rows); $i < $count; ++$i) {
|
||||
$row = &$rows[$i];
|
||||
|
||||
if (empty($row->href) || empty($row->title)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$area = isset($row->section) ? $row->section : self::getSearchAreaFromUrl($row->href);
|
||||
|
||||
if (!isset($areas[$area])) {
|
||||
$areas[$area] = array();
|
||||
}
|
||||
|
||||
$result = new StdClass;
|
||||
|
||||
if ($searchphrase == 'exact') {
|
||||
$searchwords = array($searchword);
|
||||
$needle = $searchword;
|
||||
} else {
|
||||
$searchworda = preg_replace('#\xE3\x80\x80#s', ' ', $searchword);
|
||||
$searchwords = preg_split("/\s+/u", $searchworda);
|
||||
$needle = $searchwords[0];
|
||||
}
|
||||
|
||||
// get anchors if any...
|
||||
$row->anchors = self::getAnchors($row->text);
|
||||
|
||||
// prepare and truncate search text
|
||||
$row->text = $this->prepareSearchContent($row->text, $needle);
|
||||
|
||||
// remove base url
|
||||
if (JURI::base(true) && strpos($row->href, JURI::base(true)) !== false) {
|
||||
$row->href = substr_replace($row->href, '', 0, strlen(JURI::base(true)) + 1);
|
||||
}
|
||||
|
||||
// remove the alias or ItemId from a link
|
||||
$row->href = self::route($row->href);
|
||||
|
||||
$result->title = $row->title;
|
||||
$result->text = $row->text;
|
||||
$result->link = $row->href;
|
||||
|
||||
if (!empty($row->anchors)) {
|
||||
$result->anchors = $row->anchors;
|
||||
}
|
||||
|
||||
$areas[$area][] = $result;
|
||||
}
|
||||
|
||||
if (!empty($areas)) {
|
||||
$results[] = $areas;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
private static function route($url)
|
||||
{
|
||||
$wf = WFEditorPlugin::getInstance();
|
||||
|
||||
if ((bool) $wf->getParam('search.link.remove_alias', 0)) {
|
||||
$url = WFLinkHelper::route($url);
|
||||
}
|
||||
|
||||
// remove Itemid if "home"
|
||||
$url = WFLinkHelper::removeHomeItemId($url);
|
||||
|
||||
// remove Itemid if set
|
||||
if ((bool) $wf->getParam('search.link.itemid', 1) === false) {
|
||||
$url = WFLinkHelper::removeItemId($url);
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
private static function getAnchors($content)
|
||||
{
|
||||
preg_match_all('#<a([^>]+)(name|id)="([a-z]+[\w\-\:\.]*)"([^>]*)>#i', $content, $matches, PREG_SET_ORDER);
|
||||
|
||||
$anchors = array();
|
||||
|
||||
if (!empty($matches)) {
|
||||
foreach ($matches as $match) {
|
||||
if (strpos($match[0], 'href') === false) {
|
||||
$anchors[] = $match[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $anchors;
|
||||
}
|
||||
}
|
||||
36
components/com_jce/editor/extensions/search/link.xml
Normal file
36
components/com_jce/editor/extensions/search/link.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" ?>
|
||||
<extension version="3.4" type="plugin" group="jce" method="upgrade">
|
||||
<name>WF_LINK_SEARCH_TITLE</name>
|
||||
<version>2.9.32</version>
|
||||
<creationDate>01-11-2022</creationDate>
|
||||
<author>Ryan Demmer</author>
|
||||
<authorEmail>info@joomlacontenteditor.net</authorEmail>
|
||||
<authorUrl>https://www.joomlacontenteditor.net/</authorUrl>
|
||||
<copyright>Copyright (C) 2006 - 2022 Ryan Demmer. All rights reserved</copyright>
|
||||
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
|
||||
<description>WF_LINK_SEARCH_DESC</description>
|
||||
<files>
|
||||
<filename>link.php</filename>
|
||||
<folder>link</folder>
|
||||
</files>
|
||||
<fields name="link">
|
||||
<fieldset name="link">
|
||||
<field name="enable" type="yesno" default="1" label="WF_LABEL_EXTENSION_ENABLE" description="WF_LABEL_EXTENSION_ENABLE_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="plugins" type="searchplugins" multiple="true" label="WF_PARAM_LINK_SEARCH_PLUGINS" description="WF_PARAM_LINK_SEARCH_PLUGINS_DESC" default="categories,contacts,content,weblinks,tags" layout="joomla.form.field.list-fancy-select" />
|
||||
<field name="remove_alias" type="yesno" default="0" label="WF_LINK_SEARCH_REMOVE_ALIAS" description="WF_LINK_SEARCH_REMOVE_ALIAS_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field name="itemid" type="yesno" default="1" label="WF_LINK_SEARCH_ITEMID" description="WF_LINK_SEARCH_ITEMID_DESC">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
<plugins>link</plugins>
|
||||
<media></media>
|
||||
<languages></languages>
|
||||
</extension>
|
||||
Reference in New Issue
Block a user