This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Echo a query | |
echo nl2br(str_replace('#__','jos_',$query)); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Manipulation a JForm is easy the best place to add fields is to use the preprocessForm function | |
protected function preprocessForm(JForm $form, $data, $group = 'content') | |
{ | |
// Add some needed hidden fields | |
$fields = array('id','cid'); | |
foreach ($fields AS $field) | |
{ | |
$element = new SimpleXMLElement('<field></field>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* frontpage check | |
*/ | |
$menu = JFactory::getApplication()->getMenu(); | |
$defaultmenuitems = array($menu->getDefault()->id, $menu->getDefault(JFactory::getLanguage()->getTag())->id); | |
$isFrontpage = in_array($menu->getActive()->id, $defaultmenuitems); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected function logData($data, $type="ERROR") | |
{ | |
jimport('joomla.log.log'); | |
$types = array( | |
'EMERGENCY', | |
'ALERT', | |
'CRITICAL', | |
'ERROR', | |
'WARNING', | |
'NOTICE', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$modlist=array('modpos01','modpos02','modpos03','modpos04','modpos05'); | |
$allMods=count($modlist); | |
$show=array(); | |
$elephantInCairo=0; | |
while(count($show) < 4 && $elephantInCairo < 100) | |
{ | |
$c = rand (0 , $allMods-1); | |
if (!in_array($modlist[$c], $show)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getRowData(JTable $table) | |
{ | |
.... | |
} | |
replacing with: | |
public function getRowData($table) | |
{ | |
if (!(get_class($table) == 'JTable' || is_subclass_of($table, 'JTable'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class whatModelever extends FOFModel | |
{ | |
..... | |
/** | |
* This method runs before the $data is saved to the $table. Return false to | |
* stop saving. | |
* | |
* @param array &$data The data to save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// that is bad hack, I am accessing a by convention as private maked class variable. | |
// But you can not set the head to an empty array so that is the only way to allow to remove all scripts | |
// I am adding one script, this should have all the scripts merged into one file | |
// KEEP IN MIND THAT'S WORKING NOW (VERSION 3.3.6) BUT THAT DOES NOT MEAN IT WILL WORK ALWAYS | |
$tpath = $this->baseurl.'/templates/'.$this->template; | |
$scripts = $doc->_scripts; | |
$doc->_scripts = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Cleanup Script | |
* | |
* @package ABITDIRTY | |
* @author Robert Deutz <[email protected]> | |
* | |
* @copyright 2015 Robert Deutz | |
* @license GNU General Public License version 2 or later | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ISO-3166-1 | |
$data = array( | |
4 => array('name' => 'Afghanistan','numeric-codes' => 4,'alpha-2-codes' => 'AF','alpha-3-codes' => 'AFG'), | |
248 => array('name' => 'Åland Islands','numeric-codes' => 248,'alpha-2-codes' => 'AX','alpha-3-codes' => 'ALA'), | |
8 => array('name' => 'Albania','numeric-codes' => 8,'alpha-2-codes' => 'AL','alpha-3-codes' => 'ALB'), | |
12 => array('name' => 'Algeria','numeric-codes' => 12,'alpha-2-codes' => 'DZ','alpha-3-codes' => 'DZA'), | |
16 => array('name' => 'American Samoa','numeric-codes' => 16,'alpha-2-codes' => 'AS','alpha-3-codes' => 'ASM'), |
OlderNewer