添加到 trunk

+YUCHENG HU+

git-svn-id: https://svn.code.sf.net/p/hawebs/svn@338 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
YuCheng Hu
2010-06-16 20:05:52 +00:00
parent 7f28ae6e54
commit 2196b3d762
900 changed files with 29551 additions and 11777 deletions
@@ -1,85 +1,85 @@
<?php
/**
* @version $Id: example.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Example Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationExample extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgAuthenticationExample(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
/*
* Here you would do whatever you need for an authentication routine with the credentials
*
* In this example the mixed variable $return would be set to false
* if the authentication routine fails or an integer userid of the authenticated
* user if the routine passes
*/
$success = true;
if ($success)
{
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
// You may also define other variables:
/*
$yourUser = YourClass::getUser( $credentials );
$response->email = $yourUser->email;
$response->fullname = $yourUser->name;
*/
return true;
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Could not authenticate';
return false;
}
}
}
<?php
/**
* @version $Id: example.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Example Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationExample extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgAuthenticationExample(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
/*
* Here you would do whatever you need for an authentication routine with the credentials
*
* In this example the mixed variable $return would be set to false
* if the authentication routine fails or an integer userid of the authenticated
* user if the routine passes
*/
$success = true;
if ($success)
{
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
// You may also define other variables:
/*
$yourUser = YourClass::getUser( $credentials );
$response->email = $yourUser->email;
$response->fullname = $yourUser->name;
*/
return true;
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Could not authenticate';
return false;
}
}
}
@@ -3,7 +3,7 @@
<name>Authentication - Example</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
+106 -106
View File
@@ -1,106 +1,106 @@
<?php
/**
* @version $Id: gmail.php 11236 2008-11-02 02:44:35Z ian $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* GMail Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationGMail extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgAuthenticationGMail(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
$message = '';
$success = 0;
if(function_exists('curl_init'))
{
if(strlen($credentials['username']) && strlen($credentials['password']))
{
$curl = curl_init('https://mail.google.com/mail/feed/atom');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
//curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_USERPWD, $credentials['username'].':'.$credentials['password']);
$result = curl_exec($curl);
$code = curl_getinfo ($curl, CURLINFO_HTTP_CODE);
switch($code)
{
case 200:
$message = 'Access Granted';
$success = 1;
break;
case 401:
$message = 'Access Denied';
break;
default:
$message = 'Result unknown, access denied.';
break;
}
}
else {
$message = 'Username or password blank';
}
}
else {
$message = 'curl isn\'t installed';
}
if ($success)
{
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
$response->email = $credentials['username'];
$response->fullname = $credentials['username'];
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Failed to authenticate: ' . $message;
}
}
}
<?php
/**
* @version $Id: gmail.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* GMail Authentication Plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationGMail extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgAuthenticationGMail(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
$message = '';
$success = 0;
if(function_exists('curl_init'))
{
if(strlen($credentials['username']) && strlen($credentials['password']))
{
$curl = curl_init('https://mail.google.com/mail/feed/atom');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
//curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_USERPWD, $credentials['username'].':'.$credentials['password']);
$result = curl_exec($curl);
$code = curl_getinfo ($curl, CURLINFO_HTTP_CODE);
switch($code)
{
case 200:
$message = 'Access Granted';
$success = 1;
break;
case 401:
$message = 'Access Denied';
break;
default:
$message = 'Result unknown, access denied.';
break;
}
}
else {
$message = 'Username or password blank';
}
}
else {
$message = 'curl isn\'t installed';
}
if ($success)
{
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
$response->email = $credentials['username'];
$response->fullname = $credentials['username'];
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Failed to authenticate: ' . $message;
}
}
}
@@ -3,7 +3,7 @@
<name>Authentication - GMail</name>
<author>Joomla! Project</author>
<creationDate>February 2006</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
+105 -105
View File
@@ -1,105 +1,105 @@
<?php
/**
* @version $Id: joomla.php 10709 2008-08-21 09:58:52Z eddieajau $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Joomla Authentication plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationJoomla extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgAuthenticationJoomla(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
jimport('joomla.user.helper');
// Joomla does not like blank passwords
if (empty($credentials['password']))
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Empty password not allowed';
return false;
}
// Initialize variables
$conditions = '';
// Get a database object
$db =& JFactory::getDBO();
$query = 'SELECT `id`, `password`, `gid`'
. ' FROM `#__users`'
. ' WHERE username=' . $db->Quote( $credentials['username'] )
;
$db->setQuery( $query );
$result = $db->loadObject();
if($result)
{
$parts = explode( ':', $result->password );
$crypt = $parts[0];
$salt = @$parts[1];
$testcrypt = JUserHelper::getCryptedPassword($credentials['password'], $salt);
if ($crypt == $testcrypt) {
$user = JUser::getInstance($result->id); // Bring this in line with the rest of the system
$response->email = $user->email;
$response->fullname = $user->name;
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Invalid password';
}
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'User does not exist';
}
}
}
<?php
/**
* @version $Id: joomla.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage JFramework
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Joomla Authentication plugin
*
* @package Joomla
* @subpackage JFramework
* @since 1.5
*/
class plgAuthenticationJoomla extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgAuthenticationJoomla(& $subject, $config) {
parent::__construct($subject, $config);
}
/**
* This method should handle any authentication and report back to the subject
*
* @access public
* @param array $credentials Array holding the user credentials
* @param array $options Array of extra options
* @param object $response Authentication response object
* @return boolean
* @since 1.5
*/
function onAuthenticate( $credentials, $options, &$response )
{
jimport('joomla.user.helper');
// Joomla does not like blank passwords
if (empty($credentials['password']))
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Empty password not allowed';
return false;
}
// Initialize variables
$conditions = '';
// Get a database object
$db =& JFactory::getDBO();
$query = 'SELECT `id`, `password`, `gid`'
. ' FROM `#__users`'
. ' WHERE username=' . $db->Quote( $credentials['username'] )
;
$db->setQuery( $query );
$result = $db->loadObject();
if($result)
{
$parts = explode( ':', $result->password );
$crypt = $parts[0];
$salt = @$parts[1];
$testcrypt = JUserHelper::getCryptedPassword($credentials['password'], $salt);
if ($crypt == $testcrypt) {
$user = JUser::getInstance($result->id); // Bring this in line with the rest of the system
$response->email = $user->email;
$response->fullname = $user->name;
$response->status = JAUTHENTICATE_STATUS_SUCCESS;
$response->error_message = '';
} else {
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'Invalid password';
}
}
else
{
$response->status = JAUTHENTICATE_STATUS_FAILURE;
$response->error_message = 'User does not exist';
}
}
}
@@ -3,7 +3,7 @@
<name>Authentication - Joomla</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@
<name>Authentication - LDAP</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@
<name>Authentication - OpenID</name>
<author>Joomla! Project</author>
<creationDate>February 2006</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
@@ -12,22 +12,22 @@
<files>
<filename plugin="openid">openid.php</filename>
</files>
<params>
<param name="usermode" type="radio" default="2" label="Convert old usernames" description="OPENID_USERMODE_DESC">
<option value="2">Yes</option>
<option value="1">No</option>
</param>
<param name="phishing-resistant" type="radio" default="0" label="Require Policy phishing resistant" description="PHISHING_RESISTANT_DESC">
<option value="1">Yes</option>
<option value="0">No</option>
<params>
<param name="usermode" type="radio" default="2" label="Convert old usernames" description="OPENID_USERMODE_DESC">
<option value="2">Yes</option>
<option value="1">No</option>
</param>
<param name="phishing-resistant" type="radio" default="0" label="Require Policy phishing resistant" description="PHISHING_RESISTANT_DESC">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<param name="multi-factor" type="radio" default="0" label="Require Policy multi factor" description="MULTI_FACTOR_DESC">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<option value="1">Yes</option>
<option value="0">No</option>
</param>
<param name="multi-factor-physical" type="radio" default="0" label="Require Policy multi factor physical" description="MULTI_FACTOR_PHYSICAL_DESC">
<option value="1">Yes</option>
<option value="0">No</option>
</param>
</params>
</install>
<option value="1">Yes</option>
<option value="0">No</option>
</param>
</params>
</install>
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@
<name>Content - Email Cloaking</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
+148 -148
View File
@@ -1,148 +1,148 @@
<?php
/**
* @version $Id: example.php 10714 2008-08-21 10:10:14Z eddieajau $
* @package Joomla
* @subpackage Content
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Example Content Plugin
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class plgContentExample extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param object $params The object that holds the plugin parameters
* @since 1.5
*/
function plgContentExample( &$subject, $params )
{
parent::__construct( $subject, $params );
}
/**
* Example prepare content method
*
* Method is called by the view
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
*/
function onPrepareContent( &$article, &$params, $limitstart )
{
global $mainframe;
}
/**
* Example after display title method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayTitle( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onBeforeDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example after display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before save content method
*
* Method is called right before content is saved into the database.
* Article object is passed by reference, so any changes will be saved!
* NOTE: Returning false will abort the save with an error.
* You can set the error by calling $article->setError($message)
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return bool If false, abort the save
*/
function onBeforeContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
/**
* Example after save content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return void
*/
function onAfterContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
}
<?php
/**
* @version $Id: example.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage Content
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Example Content Plugin
*
* @package Joomla
* @subpackage Content
* @since 1.5
*/
class plgContentExample extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param object $params The object that holds the plugin parameters
* @since 1.5
*/
function plgContentExample( &$subject, $params )
{
parent::__construct( $subject, $params );
}
/**
* Example prepare content method
*
* Method is called by the view
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
*/
function onPrepareContent( &$article, &$params, $limitstart )
{
global $mainframe;
}
/**
* Example after display title method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayTitle( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onBeforeDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example after display content method
*
* Method is called by the view and the results are imploded and displayed in a placeholder
*
* @param object The article object. Note $article->text is also available
* @param object The article params
* @param int The 'page' number
* @return string
*/
function onAfterDisplayContent( &$article, &$params, $limitstart )
{
global $mainframe;
return '';
}
/**
* Example before save content method
*
* Method is called right before content is saved into the database.
* Article object is passed by reference, so any changes will be saved!
* NOTE: Returning false will abort the save with an error.
* You can set the error by calling $article->setError($message)
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return bool If false, abort the save
*/
function onBeforeContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
/**
* Example after save content method
* Article is passed by reference, but after the save, so no changes will be saved.
* Method is called right after the content is saved
*
*
* @param object A JTableContent object
* @param bool If the content is just about to be created
* @return void
*/
function onAfterContentSave( &$article, $isNew )
{
global $mainframe;
return true;
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>Content - Example</name>
<author>Joomla! Project</author>
<creationDate>July 2007</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
+86 -86
View File
@@ -1,87 +1,87 @@
<?php
/**
* @version $Id: loadmodule.php 11646 2009-03-01 19:34:56Z ian $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onPrepareContent', 'plgContentLoadModule' );
/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule( &$row, &$params, $page=0 )
{
$db =& JFactory::getDBO();
// simple performance check to determine whether bot should process further
if ( JString::strpos( $row->text, 'loadposition' ) === false ) {
return true;
}
// Get plugin info
$plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
// expression to search for
$regex = '/{loadposition\s*.*?}/i';
$pluginParams = new JParameter( $plugin->params );
// check whether plugin has been unpublished
if ( !$pluginParams->get( 'enabled', 1 ) ) {
$row->text = preg_replace( $regex, '', $row->text );
return true;
}
// find all instances of plugin and put in $matches
preg_match_all( $regex, $row->text, $matches );
// Number of plugins
$count = count( $matches[0] );
// plugin only processes if there are any instances of the plugin in the text
if ( $count ) {
// Get plugin parameters
$style = $pluginParams->def( 'style', -2 );
plgContentProcessPositions( $row, $matches, $count, $regex, $style );
}
}
function plgContentProcessPositions ( &$row, &$matches, $count, $regex, $style )
{
for ( $i=0; $i < $count; $i++ )
{
$load = str_replace( 'loadposition', '', $matches[0][$i] );
$load = str_replace( '{', '', $load );
$load = str_replace( '}', '', $load );
$load = trim( $load );
$modules = plgContentLoadPosition( $load, $style );
$row->text = str_replace($matches[0][$i], $modules, $row->text );
}
// removes tags without matching module positions
$row->text = preg_replace( $regex, '', $row->text );
}
function plgContentLoadPosition( $position, $style=-2 )
{
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$params = array('style'=>$style);
$contents = '';
foreach (JModuleHelper::getModules($position) as $mod) {
$contents .= $renderer->render($mod, $params);
}
return $contents;
<?php
/**
* @version $Id: loadmodule.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onPrepareContent', 'plgContentLoadModule' );
/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule( &$row, &$params, $page=0 )
{
$db =& JFactory::getDBO();
// simple performance check to determine whether bot should process further
if ( JString::strpos( $row->text, 'loadposition' ) === false ) {
return true;
}
// Get plugin info
$plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
// expression to search for
$regex = '/{loadposition\s*.*?}/i';
$pluginParams = new JParameter( $plugin->params );
// check whether plugin has been unpublished
if ( !$pluginParams->get( 'enabled', 1 ) ) {
$row->text = preg_replace( $regex, '', $row->text );
return true;
}
// find all instances of plugin and put in $matches
preg_match_all( $regex, $row->text, $matches );
// Number of plugins
$count = count( $matches[0] );
// plugin only processes if there are any instances of the plugin in the text
if ( $count ) {
// Get plugin parameters
$style = $pluginParams->def( 'style', -2 );
plgContentProcessPositions( $row, $matches, $count, $regex, $style );
}
}
function plgContentProcessPositions ( &$row, &$matches, $count, $regex, $style )
{
for ( $i=0; $i < $count; $i++ )
{
$load = str_replace( 'loadposition', '', $matches[0][$i] );
$load = str_replace( '{', '', $load );
$load = str_replace( '}', '', $load );
$load = trim( $load );
$modules = plgContentLoadPosition( $load, $style );
$row->text = str_replace($matches[0][$i], $modules, $row->text );
}
// removes tags without matching module positions
$row->text = preg_replace( $regex, '', $row->text );
}
function plgContentLoadPosition( $position, $style=-2 )
{
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('module');
$params = array('style'=>$style);
$contents = '';
foreach (JModuleHelper::getModules($position) as $mod) {
$contents .= $renderer->render($mod, $params);
}
return $contents;
}
@@ -3,7 +3,7 @@
<name>Content - Load Modules</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@
<name>Content - Pagebreak</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
File diff suppressed because it is too large Load Diff
@@ -3,7 +3,7 @@
<name>Content - Page Navigation</name>
<author>Joomla! Project</author>
<creationDate>January 2006</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
+66 -66
View File
@@ -1,67 +1,67 @@
<?php
/**
* @version $Id: vote.php 10381 2008-06-01 03:35:53Z pasamio $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onBeforeDisplayContent', 'plgContentVote' );
function plgContentVote( &$row, &$params, $page=0 )
{
$uri = & JFactory::getURI();
$id = $row->id;
$html = '';
if (isset($row->rating_count) && $params->get( 'show_vote' ) && !$params->get( 'popup' ))
{
JPlugin::loadLanguage( 'plg_content_vote' );
$html .= '<form method="post" action="' . $uri->toString( ) . '">';
$img = '';
// look for images in template if available
$starImageOn = JHTML::_('image.site', 'rating_star.png', '/images/M_images/' );
$starImageOff = JHTML::_('image.site', 'rating_star_blank.png', '/images/M_images/' );
for ($i=0; $i < $row->rating; $i++) {
$img .= $starImageOn;
}
for ($i=$row->rating; $i < 5; $i++) {
$img .= $starImageOff;
}
$html .= '<span class="content_rating">';
$html .= JText::_( 'User Rating' ) .':'. $img .'&nbsp;/&nbsp;';
$html .= intval( $row->rating_count );
$html .= "</span>\n<br />\n";
if (!$params->get( 'intro_only' ))
{
$html .= '<span class="content_vote">';
$html .= JText::_( 'Poor' );
$html .= '<input type="radio" alt="vote 1 star" name="user_rating" value="1" />';
$html .= '<input type="radio" alt="vote 2 star" name="user_rating" value="2" />';
$html .= '<input type="radio" alt="vote 3 star" name="user_rating" value="3" />';
$html .= '<input type="radio" alt="vote 4 star" name="user_rating" value="4" />';
$html .= '<input type="radio" alt="vote 5 star" name="user_rating" value="5" checked="checked" />';
$html .= JText::_( 'Best' );
$html .= '&nbsp;<input class="button" type="submit" name="submit_vote" value="'. JText::_( 'Rate' ) .'" />';
$html .= '<input type="hidden" name="task" value="vote" />';
$html .= '<input type="hidden" name="option" value="com_content" />';
$html .= '<input type="hidden" name="cid" value="'. $id .'" />';
$html .= '<input type="hidden" name="url" value="'. $uri->toString( ) .'" />';
$html .= '</span>';
}
$html .= '</form>';
}
return $html;
<?php
/**
* @version $Id: vote.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$mainframe->registerEvent( 'onBeforeDisplayContent', 'plgContentVote' );
function plgContentVote( &$row, &$params, $page=0 )
{
$uri = & JFactory::getURI();
$id = $row->id;
$html = '';
if (isset($row->rating_count) && $params->get( 'show_vote' ) && !$params->get( 'popup' ))
{
JPlugin::loadLanguage( 'plg_content_vote' );
$html .= '<form method="post" action="' . $uri->toString( ) . '">';
$img = '';
// look for images in template if available
$starImageOn = JHTML::_('image.site', 'rating_star.png', '/images/M_images/' );
$starImageOff = JHTML::_('image.site', 'rating_star_blank.png', '/images/M_images/' );
for ($i=0; $i < $row->rating; $i++) {
$img .= $starImageOn;
}
for ($i=$row->rating; $i < 5; $i++) {
$img .= $starImageOff;
}
$html .= '<span class="content_rating">';
$html .= JText::_( 'User Rating' ) .':'. $img .'&nbsp;/&nbsp;';
$html .= intval( $row->rating_count );
$html .= "</span>\n<br />\n";
if (!$params->get( 'intro_only' ))
{
$html .= '<span class="content_vote">';
$html .= JText::_( 'Poor' );
$html .= '<input type="radio" alt="vote 1 star" name="user_rating" value="1" />';
$html .= '<input type="radio" alt="vote 2 star" name="user_rating" value="2" />';
$html .= '<input type="radio" alt="vote 3 star" name="user_rating" value="3" />';
$html .= '<input type="radio" alt="vote 4 star" name="user_rating" value="4" />';
$html .= '<input type="radio" alt="vote 5 star" name="user_rating" value="5" checked="checked" />';
$html .= JText::_( 'Best' );
$html .= '&nbsp;<input class="button" type="submit" name="submit_vote" value="'. JText::_( 'Rate' ) .'" />';
$html .= '<input type="hidden" name="task" value="vote" />';
$html .= '<input type="hidden" name="option" value="com_content" />';
$html .= '<input type="hidden" name="cid" value="'. $id .'" />';
$html .= '<input type="hidden" name="url" value="'. $uri->toString( ) .'" />';
$html .= '</span>';
}
$html .= '</form>';
}
return $html;
}
+1 -1
View File
@@ -3,7 +3,7 @@
<name>Content - Vote</name>
<author>Joomla! Project</author>
<creationDate>November 2005</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
+97 -97
View File
@@ -1,97 +1,97 @@
<?php
/**
* @version $Id: image.php 12542 2009-07-22 17:40:48Z ian $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Editor Image buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonImage extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgButtonImage(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$params =& JComponentHelper::getParams('com_media');
//Find out who has permission to upload and change the acl to let them.
$acl = & JFactory::getACL();
switch ($params->get('allowed_media_usergroup'))
{
case '1':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
break;
case '2':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
break;
case '3':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
$acl->addACL( 'com_media', 'upload', 'users', 'author' );
break;
case '4':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
$acl->addACL( 'com_media', 'upload', 'users', 'author' );
$acl->addACL( 'com_media', 'upload', 'users', 'registered' );
break;
}
//Make sure the user is authorized to view this page
$user = & JFactory::getUser();
if (!$user->authorize( 'com_media', 'popup' )) {
return;
}
$doc =& JFactory::getDocument();
$template = $mainframe->getTemplate();
$link = 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name='.$name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Image'));
$button->set('name', 'image');
$button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}");
return $button;
}
}
<?php
/**
* @version $Id: image.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Editor Image buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonImage extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgButtonImage(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$params =& JComponentHelper::getParams('com_media');
//Find out who has permission to upload and change the acl to let them.
$acl = & JFactory::getACL();
switch ($params->get('allowed_media_usergroup'))
{
case '1':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
break;
case '2':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
break;
case '3':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
$acl->addACL( 'com_media', 'upload', 'users', 'author' );
break;
case '4':
$acl->addACL( 'com_media', 'upload', 'users', 'publisher' );
$acl->addACL( 'com_media', 'upload', 'users', 'editor' );
$acl->addACL( 'com_media', 'upload', 'users', 'author' );
$acl->addACL( 'com_media', 'upload', 'users', 'registered' );
break;
}
//Make sure the user is authorized to view this page
$user = & JFactory::getUser();
if (!$user->authorize( 'com_media', 'popup' )) {
return;
}
$doc =& JFactory::getDocument();
$template = $mainframe->getTemplate();
$link = 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;e_name='.$name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Image'));
$button->set('name', 'image');
$button->set('options', "{handler: 'iframe', size: {x: 570, y: 400}}");
return $button;
}
}
@@ -3,7 +3,7 @@
<name>Button - Image</name>
<author>Joomla! Project</author>
<creationDate>August 2004</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
@@ -1,68 +1,68 @@
<?php
/**
* @version $Id: pagebreak.php 10709 2008-08-21 09:58:52Z eddieajau $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Editor Pagebreak buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonPagebreak extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgButtonPagebreak(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$doc = & JFactory::getDocument();
$template = $mainframe->getTemplate();
$link = 'index.php?option=com_content&amp;task=ins_pagebreak&amp;tmpl=component&amp;e_name='.$name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Pagebreak'));
$button->set('name', 'pagebreak');
$button->set('options', "{handler: 'iframe', size: {x: 400, y: 85}}");
return $button;
}
<?php
/**
* @version $Id: pagebreak.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Editor Pagebreak buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonPagebreak extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgButtonPagebreak(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$doc = & JFactory::getDocument();
$template = $mainframe->getTemplate();
$link = 'index.php?option=com_content&amp;task=ins_pagebreak&amp;tmpl=component&amp;e_name='.$name;
JHTML::_('behavior.modal');
$button = new JObject();
$button->set('modal', true);
$button->set('link', $link);
$button->set('text', JText::_('Pagebreak'));
$button->set('name', 'pagebreak');
$button->set('options', "{handler: 'iframe', size: {x: 400, y: 85}}");
return $button;
}
}
@@ -3,7 +3,7 @@
<name>Button - Pagebreak</name>
<author>Joomla! Project</author>
<creationDate>August 2004</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
@@ -1,83 +1,83 @@
<?php
/**
* @version $Id: readmore.php 10709 2008-08-21 09:58:52Z eddieajau $
* @package Joomla
* @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Editor Readmore buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonReadmore extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgButtonReadmore(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* readmore button
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$doc =& JFactory::getDocument();
$template = $mainframe->getTemplate();
// button is not active in specific content components
$getContent = $this->_subject->getContent($name);
$present = JText::_('ALREADY EXISTS', true) ;
$js = "
function insertReadmore(editor) {
var content = $getContent
if (content.match(/<hr\s+id=(\"|')system-readmore(\"|')\s*\/*>/i)) {
alert('$present');
return false;
} else {
jInsertEditorText('<hr id=\"system-readmore\" />', editor);
}
}
";
$doc->addScriptDeclaration($js);
$button = new JObject();
$button->set('modal', false);
$button->set('onclick', 'insertReadmore(\''.$name.'\');return false;');
$button->set('text', JText::_('Readmore'));
$button->set('name', 'readmore');
// TODO: The button writer needs to take into account the javascript directive
//$button->set('link', 'javascript:void(0)');
$button->set('link', '#');
return $button;
}
<?php
/**
* @version $Id: readmore.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Joomla! 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.
* See COPYRIGHT.php for copyright notices and details.
*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.plugin.plugin' );
/**
* Editor Readmore buton
*
* @package Editors-xtd
* @since 1.5
*/
class plgButtonReadmore extends JPlugin
{
/**
* Constructor
*
* For php4 compatability we must not use the __constructor as a constructor for plugins
* because func_get_args ( void ) returns a copy of all passed arguments NOT references.
* This causes problems with cross-referencing necessary for the observer design pattern.
*
* @param object $subject The object to observe
* @param array $config An array that holds the plugin configuration
* @since 1.5
*/
function plgButtonReadmore(& $subject, $config)
{
parent::__construct($subject, $config);
}
/**
* readmore button
* @return array A two element array of ( imageName, textToInsert )
*/
function onDisplay($name)
{
global $mainframe;
$doc =& JFactory::getDocument();
$template = $mainframe->getTemplate();
// button is not active in specific content components
$getContent = $this->_subject->getContent($name);
$present = JText::_('ALREADY EXISTS', true) ;
$js = "
function insertReadmore(editor) {
var content = $getContent
if (content.match(/<hr\s+id=(\"|')system-readmore(\"|')\s*\/*>/i)) {
alert('$present');
return false;
} else {
jInsertEditorText('<hr id=\"system-readmore\" />', editor);
}
}
";
$doc->addScriptDeclaration($js);
$button = new JObject();
$button->set('modal', false);
$button->set('onclick', 'insertReadmore(\''.$name.'\');return false;');
$button->set('text', JText::_('Readmore'));
$button->set('name', 'readmore');
// TODO: The button writer needs to take into account the javascript directive
//$button->set('link', 'javascript:void(0)');
$button->set('link', '#');
return $button;
}
}
@@ -3,7 +3,7 @@
<name>Button - Readmore</name>
<author>Joomla! Project</author>
<creationDate>March 2006</creationDate>
<copyright>Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.</copyright>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -6,8 +6,8 @@
<author></author>
<authorEmail>N/A</authorEmail>
<authorUrl></authorUrl>
<copyright>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</copyright>
<license>LGPL</license>
<copyright>Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<description>This loads a basic text entry field</description>
<files>
<filename plugin="none">none.php</filename>

Some files were not shown because too many files have changed in this diff Show More