Skip to content

Commit edc3f33

Browse files
committed
1.0.12 stable
0 parents  commit edc3f33

File tree

72 files changed

+5293
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+5293
-0
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# MVC Override Plugin
2+
3+
Allows to override core classes or methods
4+
5+
*See for more information:* http://gruz.org.ua/en/about-joomla/29-joomla-extensions/30-joomla-25-mvc-override-modify-core-behavour-without-modifing-core-files.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
4+
* @license GNU General Public License version 2 or later; see LICENSE.txt
5+
*/
6+
7+
// No direct access
8+
defined('_JEXEC') or die;
9+
10+
jimport('joomla.application.component.view');
11+
12+
/**
13+
* HTML Article View class for the Content component
14+
*
15+
* @package Joomla.Site
16+
* @subpackage com_content
17+
* @since 1.5
18+
*/
19+
class ContentViewArticle extends ContentViewArticleDefault
20+
{
21+
22+
function display($tpl = null)
23+
{
24+
// Initialise variables.
25+
$app = JFactory::getApplication();
26+
$user = JFactory::getUser();
27+
$userId = $user->get('id');
28+
$dispatcher = JDispatcher::getInstance();
29+
30+
$this->item = $this->get('Item');
31+
/*##mygruz20130223191637 {
32+
It was:
33+
It became:*/
34+
$this->item->title = '['.$this->item->title.']';
35+
/*##mygruz20130223191637 } */
36+
$this->print = JRequest::getBool('print');
37+
$this->state = $this->get('State');
38+
$this->user = $user;
39+
40+
// Check for errors.
41+
if (count($errors = $this->get('Errors'))) {
42+
JError::raiseWarning(500, implode("\n", $errors));
43+
44+
return false;
45+
}
46+
47+
// Create a shortcut for $item.
48+
$item = &$this->item;
49+
50+
// Add router helpers.
51+
$item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id;
52+
$item->catslug = $item->category_alias ? ($item->catid.':'.$item->category_alias) : $item->catid;
53+
$item->parent_slug = $item->category_alias ? ($item->parent_id.':'.$item->parent_alias) : $item->parent_id;
54+
55+
// TODO: Change based on shownoauth
56+
$item->readmore_link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
57+
58+
// Merge article params. If this is single-article view, menu params override article params
59+
// Otherwise, article params override menu item params
60+
$this->params = $this->state->get('params');
61+
$active = $app->getMenu()->getActive();
62+
$temp = clone ($this->params);
63+
64+
// Check to see which parameters should take priority
65+
if ($active) {
66+
$currentLink = $active->link;
67+
// If the current view is the active item and an article view for this article, then the menu item params take priority
68+
if (strpos($currentLink, 'view=article') && (strpos($currentLink, '&id='.(string) $item->id))) {
69+
// $item->params are the article params, $temp are the menu item params
70+
// Merge so that the menu item params take priority
71+
$item->params->merge($temp);
72+
// Load layout from active query (in case it is an alternative menu item)
73+
if (isset($active->query['layout'])) {
74+
$this->setLayout($active->query['layout']);
75+
}
76+
}
77+
else {
78+
// Current view is not a single article, so the article params take priority here
79+
// Merge the menu item params with the article params so that the article params take priority
80+
$temp->merge($item->params);
81+
$item->params = $temp;
82+
83+
// Check for alternative layouts (since we are not in a single-article menu item)
84+
// Single-article menu item layout takes priority over alt layout for an article
85+
if ($layout = $item->params->get('article_layout')) {
86+
$this->setLayout($layout);
87+
}
88+
}
89+
}
90+
else {
91+
// Merge so that article params take priority
92+
$temp->merge($item->params);
93+
$item->params = $temp;
94+
// Check for alternative layouts (since we are not in a single-article menu item)
95+
// Single-article menu item layout takes priority over alt layout for an article
96+
if ($layout = $item->params->get('article_layout')) {
97+
$this->setLayout($layout);
98+
}
99+
}
100+
101+
$offset = $this->state->get('list.offset');
102+
103+
// Check the view access to the article (the model has already computed the values).
104+
if ($item->params->get('access-view') != true && (($item->params->get('show_noauth') != true && $user->get('guest') ))) {
105+
106+
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
107+
108+
return;
109+
110+
}
111+
112+
if ($item->params->get('show_intro', '1')=='1') {
113+
$item->text = $item->introtext.' '.$item->fulltext;
114+
}
115+
elseif ($item->fulltext) {
116+
$item->text = $item->fulltext;
117+
}
118+
else {
119+
$item->text = $item->introtext;
120+
}
121+
$item->text = 'I\'m overriding a single function, display()';
122+
//
123+
// Process the content plugins.
124+
//
125+
JPluginHelper::importPlugin('content');
126+
$results = $dispatcher->trigger('onContentPrepare', array ('com_content.article', &$item, &$this->params, $offset));
127+
128+
$item->event = new stdClass();
129+
$results = $dispatcher->trigger('onContentAfterTitle', array('com_content.article', &$item, &$this->params, $offset));
130+
$item->event->afterDisplayTitle = trim(implode("\n", $results));
131+
132+
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_content.article', &$item, &$this->params, $offset));
133+
$item->event->beforeDisplayContent = trim(implode("\n", $results));
134+
135+
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_content.article', &$item, &$this->params, $offset));
136+
$item->event->afterDisplayContent = trim(implode("\n", $results));
137+
138+
// Increment the hit counter of the article.
139+
if (!$this->params->get('intro_only') && $offset == 0) {
140+
$model = $this->getModel();
141+
$model->hit();
142+
}
143+
144+
//Escape strings for HTML output
145+
$this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx'));
146+
147+
$this->_prepareDocument();
148+
if ( version_compare( JVERSION, '3.0', 'ge' ) ) {
149+
parent::display($tpl);
150+
} else {
151+
JView::display($tpl);
152+
}
153+
}
154+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
/**
3+
* @package Joomla.Site
4+
* @subpackage com_users
5+
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
6+
* @license GNU General Public License version 2 or later; see LICENSE.txt
7+
*/
8+
9+
defined('_JEXEC') or die;
10+
11+
/**
12+
* Registration controller class for Users.
13+
*
14+
* @package Joomla.Site
15+
* @subpackage com_users
16+
* @since 1.6
17+
*/
18+
class UsersControllerRegistration extends UsersControllerRegistrationDefault
19+
{
20+
/**
21+
* Method to register a user.
22+
*
23+
* @since 1.6
24+
*/
25+
public function register()
26+
{
27+
die('This is my override '.__METHOD__.' at '.__FILE__);
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<extension version="2.5" type="file" method="upgrade">
3+
<name>en_GB_mvcoverride_language_pack</name>
4+
<version>2016-05-20 15:13</version>
5+
<creationDate>2016-05-20 15:13</creationDate>
6+
<author>AryGroup</author>
7+
<email>arygroup@gmail.com</email>
8+
<authorUrl>http://arygroup.ga</authorUrl>
9+
<copyright>Copyright (C) 2004-2016 Gruz. All rights reserved.</copyright>
10+
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
11+
<description>en-GB MVC Override Plugin language pack</description>
12+
<scriptfile>scriptfile.php</scriptfile>
13+
<fileset>
14+
<files target="plugins/system/mvcoverride/language/en-GB" folder="plugins/system/mvcoverride/language/en-GB">
15+
<file>en-GB.plg_system_mvcoverride.ini</file>
16+
<file>en-GB.plg_system_mvcoverride.sys.ini</file>
17+
</files>
18+
</fileset>
19+
<updateservers>
20+
<server type="extension" priority="1" name="en_GB_mvcoverride_language_pack">http://gruz.org.ua/images/stories/files/mvcoverride/update_en-GB.xml</server>
21+
</updateservers>
22+
</extension>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
PLG_SYSTEM_MVCOVERRIDE="System - MVC Override"
3+
PLG_SYSTEM_MVCOVERRIDE_DESC="Allows almost any php class or method to be overriden. Please make sure the plugin is the first by ordering, as other plugins may load classes before this plugin. In this case the plugin will not be able to override already loaded classes.<br />If your options cause a fatal error, you can temporary disable the plugin using ?mvcoverride_disable=1 or &mvcoverride_disable=1 in your URL."
4+
PLG_SYSTEM_MVCOVERRIDE_LABLE_DEFAULT_RULE_GROUP_NAME="Group of rules"
5+
PLG_SYSTEM_MVCOVERRIDE_LABEL_SWITCH_ACTIVE_RULES="Switch rules"
6+
PLG_SYSTEM_MVCOVERRIDE_LABEL_SWITCH_ACTIVE_RULES_DESC="Choose either to use a set of fields, or a textarea fields (easier for copy/paste, no special files to be created)"
7+
PLG_SYSTEM_MVCOVERRIDE_OPTION_TEXTAREA="Textarea"
8+
PLG_SYSTEM_MVCOVERRIDE_OPTION_FIELDS="Set of fields"
9+
PLG_SYSTEM_MVCOVERRIDE_LABEL_TEXTAREA="<b>Format example</b>.<br>You may set <br/ one or several> rules separated by<br/<b>-.-.-.-.-</b><br/> <textarea readonly style='height:190px;font-size:8px;'>basePath:|:components/com_content/views/article/view.html.php\nclassName:|:ContentViewArticle\noption:|:com_content\nscope:|:site\nchangePrivate:|:0\nincludes:|:tmp/m1.php,tmp/m2.php\ncode:|:class ContentViewArticle extends ContentViewArticleDefault\n{\n\tfunction display($tpl = null)\n\t{\n\t\tJFactory::getApplication()->enqueueMessage('If you see this message, then ovveride works', 'message');\n\t\tparent::display($tpl);\n\t}\n}\n-.-.-.-.-\nbasePath:|:components/com_content/models/article.php\nclassName:|:ContentModelArticle\noption:|:com_content\nscope:|:site\nchangePrivate:|:0\nincludes:|:\ncode:|:class ContentModelArticle extends ContentModelArticleDefault {\n\tpublic function getItem($pk = null) {\n\t\t$temp = parent::getItem($pk);\n\t\t$temp->introtext = '<div style=\'border:1px solid red;\'>'.$temp->introtext.'</div>';\n\t\treturn $temp;\n\t}\n}</textarea>"
10+
PLG_SYSTEM_MVCOVERRIDE_LABEL_RULE_ENABLED="Run the rule?"
11+
PLG_SYSTEM_MVCOVERRIDE_LABEL_RULE_ENABLED_DESC="You can disable a rule but have settings saved for later usage or for an example"
12+
PLG_SYSTEM_MVCOVERRIDE_OPTION_BACKEND_ONLY="Backend only"
13+
PLG_SYSTEM_MVCOVERRIDE_OPTION_ALWAYS="Always"
14+
PLG_SYSTEM_MVCOVERRIDE_OPTION_BOTH="Both"
15+
PLG_SYSTEM_MVCOVERRIDE_OPTION_ADMIN="Admin"
16+
PLG_SYSTEM_MVCOVERRIDE_OPTION_SITE="Site"
17+
PLG_SYSTEM_MVCOVERRIDE_LABEL_SHOW_DEBUG_INFO="Show debug information"
18+
PLG_SYSTEM_MVCOVERRIDE_LABEL_SHOW_DEBUG_INFO_DESC="Wrong plugin settings can raise errors such as a wrong file path or invalid PHP code to execute. It's recommended to have the debug on to test new settings, otherwise it may happen, that your settings just don't work and you have no idea why."
19+
PLG_SYSTEM_MVCOVERRIDE_LABEL_BASECLASSPATH="Base Class Path"
20+
PLG_SYSTEM_MVCOVERRIDE_LABEL_BASECLASSPATH_DESC="Path to the file containing the class to override. Start path from slash / to use absolute path. Otherwise the path will be considered as relative to the Joomla root. It's recommended to use relative path."
21+
PLG_SYSTEM_MVCOVERRIDE_LABEL_OVERRIDECLASSPATH="Override Class Path"
22+
PLG_SYSTEM_MVCOVERRIDE_LABEL_OVERRIDECLASSPATH_DESC="Path to the file containing the overrider class. Start path from slash / to use absolute path. Otherwise the path will be considered as relative to the plugin override folder <b>JOOMLAROOT/plugins/system/mvcoverride/code/</b>.<br /> This folder is proposed to store all override files in one place. It's also recommended to duplicate Joomla folder structure in the folder.<br />I.e. you want to override the following file <b>JOOMLAROOT/components/com_content/views/article/view.html.php</b>. Then place your overrider file here <b>JOOMLAROOT/plugins/system/mvcoverride/code/com_content/views/article/view.html.php</b> to keep things clear."
23+
PLG_SYSTEM_MVCOVERRIDE_LABEL_BASECLASSNAME="Base Class Name"
24+
PLG_SYSTEM_MVCOVERRIDE_LABEL_BASECLASSNAME_DESC="Name of the base class to be overridden.<br />I.e. <b>ContentViewArticle</b>"
25+
PLG_SYSTEM_MVCOVERRIDE_LABEL_OPTION="Option (optional)"
26+
PLG_SYSTEM_MVCOVERRIDE_LABEL_OPTION_DESC="Option parameter for the component where the class should be loaded. If left blank, the class will always be loaded."
27+
PLG_SYSTEM_MVCOVERRIDE_LABEL_SCOPE="Scope"
28+
PLG_SYSTEM_MVCOVERRIDE_LABEL_SCOPE_DESC="The scope to load the class in"
29+
PLG_SYSTEM_MVCOVERRIDE_LABEL_MAKEEXTENDABLE="Make Extendable"
30+
PLG_SYSTEM_MVCOVERRIDE_LABEL_MAKEEXTENDABLE_DESC="Changes all private methods in the base class to protected methods which allows the subclass to extend the base class better. This is not recommended unless you really need it."
31+
PLG_SYSTEM_MVCOVERRIDE_LABEL_SUPPORTINGFILES="Supporting Files"
32+
PLG_SYSTEM_MVCOVERRIDE_LABEL_SUPPORTINGFILES_DESC="Enter paths to any files that should be included before loading the base and override classes. One path per line. Can be absolute or relative to Joomla root."
33+
PLG_SYSTEM_MVCOVERRIDE_EVAL_FAILED="Execution of eval failed. Error and code: "
34+
PLG_SYSTEM_MVCOVERRIDE_LABEL_DEFAULT_RULE_GROUP_NAME="Default set of rules"
35+
PLG_SYSTEM_MVCOVERRIDE_CLASS_IS_ALREADY_DECLARED="Class is already declared"
36+
PLG_SYSTEM_MVCOVERRIDE_LABEL_BRUTE_MODE="Expert mode"
37+
PLG_SYSTEM_MVCOVERRIDE_LABEL_BRUTE_MODE_DESC="Some extensions use not Joomla Framework, but direct PHP require_once/include_once commands. Such extension files can be overridden only using this mode. If enabled, then the target file (the core joomla/extension one) is temporary renamed, then an empty file is created and loaded instead, and finally the original file is placed back. Normally this should not cause problems, but who knows. So use this option with care only if you do really need it."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
PLG_SYSTEM_MVCOVERRIDE="System - MVC Override"
3+
PLG_SYSTEM_MVCOVERRIDE_DESC="Allows almost any php class or method to be overriden. Please make sure the plugin is the first by ordering, as other plugins may load classes before this plugin. In this case the plugin will not be able to override already loaded classes."
4+
GJ_INSTALL_ORDERING_SET="The plugin is set to be executed before all other plugns"
5+
GJ_INSTALL_ORDERING_SET_FAILED="Cound not set plugin ordering"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
// No direct access
3+
defined('_JEXEC') or die('Restricted access');
4+
5+
/**
6+
* Script file
7+
*/
8+
9+
class en_GB_mvcoverride_language_packInstallerScript {
10+
function __construct() {
11+
}
12+
/**
13+
* method to install the component
14+
*
15+
* @return void
16+
*/
17+
function install($parent) {
18+
// $parent is the class calling this method
19+
//$parent->getParent()->setRedirectURL('index.php?option=com_helloworld');
20+
}
21+
22+
/**
23+
* method to uninstall the component
24+
*
25+
* @return void
26+
*/
27+
function uninstall($parent) {
28+
// $parent is the class calling this method
29+
//echo '<p>' . JText::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '</p>';
30+
}
31+
32+
/**
33+
* method to update the component
34+
*
35+
* @return void
36+
*/
37+
function update($parent) {
38+
// $parent is the class calling this method
39+
//echo '<p>' . JText::_('COM_HELLOWORLD_UPDATE_TEXT') . '</p>';
40+
}
41+
42+
/**
43+
* method to run before an install/update/uninstall method
44+
*
45+
* @return void
46+
*/
47+
function preflight($type, $parent) {
48+
// $parent is the class calling this method
49+
// $type is the type of change (install, update or discover_install)
50+
//echo '<p>' . JText::_('COM_HELLOWORLD_PREFLIGHT_' . $type . '_TEXT') . '</p>';
51+
}
52+
53+
/**
54+
* method to run after an install/update/uninstall method
55+
*
56+
* Remove old language pack bad installations
57+
*
58+
* @return void
59+
*/
60+
function postflight($type, $parent) {
61+
$name = get_class($this);
62+
$extension = JTable::getInstance('extension');
63+
$manifest = $parent->getParent()->getManifest();
64+
$element_to_del = str_replace(' ','',(string)$manifest->description);
65+
$eid = $extension->find(
66+
array(
67+
'element' => strtolower($element_to_del)
68+
// , 'type' => strtolower('file'),
69+
//~ 'client_id' => strtolower($current_update->get('client_id')),
70+
//~ 'folder' => strtolower($current_update->get('folder'))
71+
));
72+
if (!empty($eid)) {
73+
$extension->delete($eid);
74+
}
75+
// $parent is the class calling this method
76+
// $type is the type of change (install, update or discover_install)
77+
//echo '<p>' . JText::_('COM_HELLOWORLD_POSTFLIGHT_' . $type . '_TEXT') . '</p>';
78+
}
79+
private function installExtensions ($parent) {
80+
81+
}
82+
83+
}
84+
?>

extensions/gjfields/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# GJFields - additional JFrom fields for Joomla
2+
3+
Provides a set of additiona JForm fileds. I.e. Variablefield is a self-reproducing JFrom field, which supports variable fields and groups of fields. Alas, no nested groups allowed.
4+
5+
*See for more information:* http://gruz.org.ua/about-joomla/29-joomla-extensions/34-joomla-self-reproducing-jfrom-field.html

extensions/gjfields/article.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* @package GJFileds
4+
*
5+
* @copyright Copyright (C) All rights reversed.
6+
* @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL or later
7+
*/
8+
9+
defined('JPATH_BASE') or die;
10+
// Legacy support for AutoReadMore. Should be removed together with the next autoreadmore versions
11+
if (!class_exists('JFormFieldModalArticle')) { include ('modalarticle.php'); }
12+
class JFormFieldModal_Article extends JFormFieldModalArticle { }

0 commit comments

Comments
 (0)