You've already forked joomla_test
							
							first commit
This commit is contained in:
		
							
								
								
									
										1
									
								
								plugins/editors/none/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								plugins/editors/none/index.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
<!DOCTYPE html><title></title>
 | 
			
		||||
							
								
								
									
										215
									
								
								plugins/editors/none/none.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										215
									
								
								plugins/editors/none/none.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,215 @@
 | 
			
		||||
<?php
 | 
			
		||||
/**
 | 
			
		||||
 * @package     Joomla.Plugin
 | 
			
		||||
 * @subpackage  Editors.none
 | 
			
		||||
 *
 | 
			
		||||
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 | 
			
		||||
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
defined('_JEXEC') or die;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Plain Textarea Editor Plugin
 | 
			
		||||
 *
 | 
			
		||||
 * @package     Joomla.Plugin
 | 
			
		||||
 * @subpackage  Editors.none
 | 
			
		||||
 * @since       1.5
 | 
			
		||||
 */
 | 
			
		||||
class PlgEditorNone extends JPlugin
 | 
			
		||||
{
 | 
			
		||||
	/**
 | 
			
		||||
	 * Method to handle the onInitEditor event.
 | 
			
		||||
	 *  - Initialises the Editor
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return  string	JavaScript Initialization string
 | 
			
		||||
	 *
 | 
			
		||||
	 * @since 1.5
 | 
			
		||||
	 */
 | 
			
		||||
	public function onInit()
 | 
			
		||||
	{
 | 
			
		||||
		$txt =	"<script type=\"text/javascript\">
 | 
			
		||||
					function insertAtCursor(myField, myValue)
 | 
			
		||||
					{
 | 
			
		||||
						if (document.selection)
 | 
			
		||||
						{
 | 
			
		||||
							// IE support
 | 
			
		||||
							myField.focus();
 | 
			
		||||
							sel = document.selection.createRange();
 | 
			
		||||
							sel.text = myValue;
 | 
			
		||||
						} else if (myField.selectionStart || myField.selectionStart == '0')
 | 
			
		||||
						{
 | 
			
		||||
							// MOZILLA/NETSCAPE support
 | 
			
		||||
							var startPos = myField.selectionStart;
 | 
			
		||||
							var endPos = myField.selectionEnd;
 | 
			
		||||
							myField.value = myField.value.substring(0, startPos)
 | 
			
		||||
								+ myValue
 | 
			
		||||
								+ myField.value.substring(endPos, myField.value.length);
 | 
			
		||||
						} else {
 | 
			
		||||
							myField.value += myValue;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				</script>";
 | 
			
		||||
 | 
			
		||||
		return $txt;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Copy editor content to form field.
 | 
			
		||||
	 *
 | 
			
		||||
	 * Not applicable in this editor.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return  void
 | 
			
		||||
	 */
 | 
			
		||||
	public function onSave()
 | 
			
		||||
	{
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get the editor content.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param   string  $id  The id of the editor field.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return  string
 | 
			
		||||
	 */
 | 
			
		||||
	public function onGetContent($id)
 | 
			
		||||
	{
 | 
			
		||||
		return "document.getElementById('$id').value;\n";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Set the editor content.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param   string  $id    The id of the editor field.
 | 
			
		||||
	 * @param   string  $html  The content to set.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return  string
 | 
			
		||||
	 */
 | 
			
		||||
	public function onSetContent($id, $html)
 | 
			
		||||
	{
 | 
			
		||||
		return "document.getElementById('$id').value = $html;\n";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param   string  $id  The id of the editor field
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return  boolean  returns true when complete
 | 
			
		||||
	 */
 | 
			
		||||
	public function onGetInsertMethod($id)
 | 
			
		||||
	{
 | 
			
		||||
		static $done = false;
 | 
			
		||||
 | 
			
		||||
		// Do this only once.
 | 
			
		||||
		if (!$done)
 | 
			
		||||
		{
 | 
			
		||||
			$doc = JFactory::getDocument();
 | 
			
		||||
			$js = "\tfunction jInsertEditorText(text, editor)
 | 
			
		||||
			{
 | 
			
		||||
				insertAtCursor(document.getElementById(editor), text);
 | 
			
		||||
			}";
 | 
			
		||||
			$doc->addScriptDeclaration($js);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Display the editor area.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param   string   $name     The control name.
 | 
			
		||||
	 * @param   string   $content  The contents of the text area.
 | 
			
		||||
	 * @param   string   $width    The width of the text area (px or %).
 | 
			
		||||
	 * @param   string   $height   The height of the text area (px or %).
 | 
			
		||||
	 * @param   integer  $col      The number of columns for the textarea.
 | 
			
		||||
	 * @param   integer  $row      The number of rows for the textarea.
 | 
			
		||||
	 * @param   boolean  $buttons  True and the editor buttons will be displayed.
 | 
			
		||||
	 * @param   string   $id       An optional ID for the textarea (note: since 1.6). If not supplied the name is used.
 | 
			
		||||
	 * @param   string   $asset    The object asset
 | 
			
		||||
	 * @param   object   $author   The author.
 | 
			
		||||
	 * @param   array    $params   Associative array of editor parameters.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return  string
 | 
			
		||||
	 */
 | 
			
		||||
	public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null, $params = array())
 | 
			
		||||
	{
 | 
			
		||||
		if (empty($id))
 | 
			
		||||
		{
 | 
			
		||||
			$id = $name;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Only add "px" to width and height if they are not given as a percentage
 | 
			
		||||
		if (is_numeric($width))
 | 
			
		||||
		{
 | 
			
		||||
			$width .= 'px';
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (is_numeric($height))
 | 
			
		||||
		{
 | 
			
		||||
			$height .= 'px';
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		$buttons = $this->_displayButtons($id, $buttons, $asset, $author);
 | 
			
		||||
		$editor  = "<textarea name=\"$name\" id=\"$id\" cols=\"$col\" rows=\"$row\" style=\"width: $width; height: $height;\">$content</textarea>" . $buttons;
 | 
			
		||||
 | 
			
		||||
		return $editor;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Displays the editor buttons.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param   string  $name     The control name.
 | 
			
		||||
	 * @param   mixed   $buttons  [array with button objects | boolean true to display buttons]
 | 
			
		||||
	 * @param   string  $asset    The object asset
 | 
			
		||||
	 * @param   object  $author   The author.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @return  string HTML
 | 
			
		||||
	 */
 | 
			
		||||
	public function _displayButtons($name, $buttons, $asset, $author)
 | 
			
		||||
	{
 | 
			
		||||
		// Load modal popup behavior
 | 
			
		||||
		JHtml::_('behavior.modal', 'a.modal-button');
 | 
			
		||||
 | 
			
		||||
		$args['name'] = $name;
 | 
			
		||||
		$args['event'] = 'onGetInsertMethod';
 | 
			
		||||
 | 
			
		||||
		$return = '';
 | 
			
		||||
		$results[] = $this->update($args);
 | 
			
		||||
 | 
			
		||||
		foreach ($results as $result)
 | 
			
		||||
		{
 | 
			
		||||
			if (is_string($result) && trim($result))
 | 
			
		||||
			{
 | 
			
		||||
				$return .= $result;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (is_array($buttons) || (is_bool($buttons) && $buttons))
 | 
			
		||||
		{
 | 
			
		||||
			$results = $this->_subject->getButtons($name, $buttons, $asset, $author);
 | 
			
		||||
 | 
			
		||||
			// This will allow plugins to attach buttons or change the behavior on the fly using AJAX
 | 
			
		||||
			$return .= "\n<div id=\"editor-xtd-buttons\" class=\"btn-toolbar pull-left\">\n";
 | 
			
		||||
			$return .= "\n<div class=\"btn-toolbar\">\n";
 | 
			
		||||
 | 
			
		||||
			foreach ($results as $button)
 | 
			
		||||
			{
 | 
			
		||||
				// Results should be an object
 | 
			
		||||
				if ($button->get('name'))
 | 
			
		||||
				{
 | 
			
		||||
					$modal		= ($button->get('modal')) ? 'class="modal-button btn"' : null;
 | 
			
		||||
					$href		= ($button->get('link')) ? 'class="btn" href="' . JUri::base() . $button->get('link') . '"' : null;
 | 
			
		||||
					$onclick	= ($button->get('onclick')) ? 'onclick="' . $button->get('onclick') . '"' : null;
 | 
			
		||||
					$title      = ($button->get('title')) ? $button->get('title') : $button->get('text');
 | 
			
		||||
					$return .= "<a " . $modal . " title=\"" . $title . "\" " . $href . " " . $onclick . " rel=\"" . $button->get('options') . "\"><i class=\"icon-" . $button->get('name') . "\"></i> " . $button->get('text') . "</a>\n";
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			$return .= "</div>\n";
 | 
			
		||||
			$return .= "</div>\n";
 | 
			
		||||
			$return .= "<div class=\"clearfix\"></div>\n";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return $return;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										19
									
								
								plugins/editors/none/none.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								plugins/editors/none/none.xml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<extension version="3.1" type="plugin" group="editors">
 | 
			
		||||
	<name>plg_editors_none</name>
 | 
			
		||||
	<version>3.0.0</version>
 | 
			
		||||
	<creationDate>August 2004</creationDate>
 | 
			
		||||
	<author></author>
 | 
			
		||||
	<authorEmail>N/A</authorEmail>
 | 
			
		||||
	<authorUrl></authorUrl>
 | 
			
		||||
	<copyright></copyright>
 | 
			
		||||
	<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
 | 
			
		||||
	<description>PLG_NONE_XML_DESCRIPTION</description>
 | 
			
		||||
	<files>
 | 
			
		||||
		<filename plugin="none">none.php</filename>
 | 
			
		||||
		<filename>index.html</filename>	</files>
 | 
			
		||||
	<languages>
 | 
			
		||||
		<language tag="en-GB">en-GB.plg_editors_none.ini</language>
 | 
			
		||||
		<language tag="en-GB">en-GB.plg_editors_none.sys.ini</language>
 | 
			
		||||
	</languages>
 | 
			
		||||
</extension>
 | 
			
		||||
		Reference in New Issue
	
	Block a user