/
link.php
153 lines (123 loc) · 3.54 KB
/
link.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
/*
* This plugin uses parts of JCE extension by Ryan Demmer.
* @copyright Copyright (C) 2005 - 2011 Ryan Demmer. All rights reserved.
* @copyright Copyright (C) 2003 - 2011, CKSource - Frederico Knabben. All rights reserved.
* @license GNU/GPL
* CKEditor extension 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.
*/
// no direct access
//defined('_CKE_EXT') or die('Restricted access');
// Set flag that this is an extension parent
defined( '_JEXEC' ) or die( 'Restricted access' );
// Load class dependencies
require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'plugin.php');
require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'browser.php');
require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'document.php');
//require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'tabs.php');
require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'view.php');
require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'extensions.php');
require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'token.php');
require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'utility.php');
//require_once (dirname(__FILE__).DIRECTORY_SEPARATOR.'popups.php');
class WFLinkPlugin extends WFEditorPlugin
{
/*
* @var varchar
*/
var $extensions = array();
var $popups = array();
var $tabs = array();
/**
* Constructor activating the default information of the class
*
* @access protected
*/
function __construct()
{
parent::__construct();
$this->setXHR(array($this, 'getLinks'));
// check the user/group has editor permissions
$this->checkPlugin() or die(JError::raiseError(403, JText::_('ERROR_403')));
}
/**
* Returns a reference to a plugin object
*
* This method must be invoked as:
* <pre> $advlink = &AdvLink::getInstance();</pre>
*
* @access public
* @return JCE The editor object.
* @since 1.5
*/
function &getInstance()
{
static $instance;
if (!is_object($instance)) {
$instance = new WFLinkPlugin();
}
return $instance;
}
function display()
{
parent::display();
$document =& WFDocument::getInstance();
//$document->addScript(array('link'), 'plugins');
$document->addStyleSheet(array('link'), 'plugins');
// $settings = $this->getSettings();
// $document->addScriptDeclaration('LinkDialog.settings='.json_encode($settings).';');
/*$tabs =& WFTabs::getInstance(array(
'base_path' => CKE_PLUGINS
));
// Add tabs
$tabs->addTab('link', 1);
$tabs->addTab('advanced', $this->getParam('link_tabs_advanced', 1));
*/
// Load Popups instance
/*$popups =& WFPopupsExtension::getInstance(array(
'text' => false
));
*/
$browser =& $this->getBrowser();
$browser->display();
}
function getBrowser()
{
static $browser;
if (!is_object($browser)) {
$browser =& WFBrowserExtension::getInstance('link');
}
return $browser;
}
function getLinks($args)
{
$browser =& $this->getBrowser();
return $browser->getLinks($args);
}
function getLinkBrowser()
{
$browser =& $this->getBrowser();
return $browser->getLinkBrowser();
}
function getSettings()
{
$params = $this->getParams();
$settings = array(
'params' => array(
'defaults' => $this->getDefaults()
),
'file_browser' => $params->get('link_file_browser', 1)
);
return parent::getSettings($settings);
}
function getDefaults()
{
$defaults = array(
'targetlist' => 'default'
);
return parent::getDefaults($defaults);
}
}