Skip to content

Instantly share code, notes, and snippets.

View realityking's full-sized avatar

Rouven Weßling realityking

View GitHub Profile
@realityking
realityking / gist:1346705
Created November 8, 2011 00:56
index.html creator
#!/usr/bin/php
<?php
if (php_sapi_name() != "cli") {
echo "Error: phptidy has to be run on command line with CLI SAPI\n";
exit(1);
}
function getDirectory($path = '.', $level = 0) {
// Directories to ignore when listing output.
@realityking
realityking / gist:1401435
Created November 28, 2011 18:32
Joomla autoloader naming convention
-All classes have to start with a J to be considered by the autoloader
-Class names have to be camel cased
-Every uppercase letter marks a new folder
-If there's only one part it is repetead
Examples:
-JDatabase would have to be in database/database.php
-JDatabaseExporter would have to be in database/exporter.php
-JDatabaseExporterCvs would have to be in database/exporter/cvs.php
@realityking
realityking / gist:2314303
Created April 5, 2012 21:30
Joomla! patches that will help with 3.0
@realityking
realityking / gist:2768598
Created May 22, 2012 11:57
Proposed database changes for Joomla 3.0

This is mostly thinking based on MySQL, we'll have to change the MS SQL version accordingly.

Drop the following fields:

  • #__content.title_alias It's been marked as deprecated since 1.6.0 (?).

Change the following tables to InnoDB:

  • #__banners
  • #__banner_clients
  • #__categories
  • #__contact_details
@realityking
realityking / gist:2775329
Created May 23, 2012 13:49
SQL migration Joomla 3.0
# Drop deprecated columns
ALTER TABLE `#__content` DROP `title_alias`;
ALTER TABLE `#__content` DROP `sectionid`;
ALTER TABLE `#__users` DROP `usertype`;
ALTER TABLE `#__session` DROP `usertype`;
ALTER TABLE `#__users` DROP KEY `whosonline`;
# Change tables for which we want to support foreign keys or transactions to InnoDB
abstract class JAccessHelper
{
public static function getActionsForAsset($asset, $section = 'component')
{
$user = JFactory::getUser();
$result = new JObject;
$actions = JAccess::getActions($asset, $section);
foreach ($actions as $action)
@realityking
realityking / gist:3025255
Created June 30, 2012 19:48
Things in Joomla 2.5 that should go
-JGithub API
-plg_authentican_gmail
-plg_content_geshi
-plg_user_profile
-com_banners
-com_newsfeeds
-com_weblinks
-mod_version (inline into the templates again)
-mod_stats
-mod_feed (both)
@realityking
realityking / JHtmlBatchTest.php
Created July 2, 2012 12:58
Unit tests to be moved to the CMS
<?php
/**
* @package Joomla.UnitTest
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
require_once JPATH_PLATFORM . '/legacy/html/batch.php';
<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="1.3.4">
<file name="/Users/rouven/Sites/joomla-cms/administrator/components/com_admin/views/profile/tmpl/edit.php">
<error line="36" column="1" severity="error" message="Tabs must be used to indent lines; spaces are not allowed" source="Joomla.WhiteSpace.DisallowSpaceIndent.SpaceUsed"/>
<error line="37" column="1" severity="error" message="Tabs must be used to indent lines; spaces are not allowed" source="Joomla.WhiteSpace.DisallowSpaceIndent.SpaceUsed"/>
<error line="38" column="1" severity="error" message="Tabs must be used to indent lines; spaces are not allowed" source="Joomla.WhiteSpace.DisallowSpaceIndent.SpaceUsed"/>
<error line="39" column="1" severity="error" message="Tabs must be used to indent lines; spaces are not allowed" source="Joomla.WhiteSpace.DisallowSpaceIndent.SpaceUsed"/>
<error line="40" column="1" severity="error" message="Tabs must be used to indent lines; spaces are not allowed" source="Joomla.WhiteSpace.DisallowSp
@realityking
realityking / gist:3490578
Created August 27, 2012 17:25
Fast ZIP extraction for Joomla
$zip = new ZipArchive;
$return = $zip->open($archive);
if ($return === true)
{
// Make sure the destination folder exists
if (!JFolder::create($destination))
{
if (class_exists('JError'))
{
return JError::raiseWarning(100, 'Unable to create destination');