Skip to content

Instantly share code, notes, and snippets.

View thinkerytim's full-sized avatar

Tim Kramer thinkerytim

View GitHub Profile
@thinkerytim
thinkerytim / JoomlaValetDriver.php
Created April 5, 2017 04:29
Laravel Valet Driver for Joomla
<?php
class JoomlaValetDriver extends ValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@thinkerytim
thinkerytim / JLangFileConvert.php
Created February 24, 2011 00:08
revised and improved
<?php
// JOOMLA LANGUAGE FILE UPDATER
// CONVERTS JOOMLA 1.5 FILES TO JOOMLA 1.6 FORMAT
// AND THEN MODIFIES ALL JTEXT USAGES TO FIT NEW FORMAT
//
// THIS IS INTENDED TO BE USED BY JOOMLA DEVELOPERS ON THEIR OWN CODE REPOSITORY
// NOT AGAINST A FULL JOOMLA SITE!
//
// COPYRIGHT 2011 THE THINKERY LLC
<?php
// Google Maps API key
$key = key; // Google API key
$mapaddress = urlencode($listing['street_number'] . " " . $listing['street_direction'] . " " . $listing['street'] . " " . $listing['street_suffix'] . " " . $listing['street_suffix2'] . ", " . $listing['city'] . ", " . $listing['state'] . " " . $listing['zip']);
function geocoder($mapaddress){
global $key;
// Desired address
$url = "http://maps.google.com/maps/geo?q=$mapaddress&output=xml&key=$key";
<?php
$tempdir = sys_get_temp_dir();
echo "Your temp directory is: " . $tempdir . "<br />";
$perms = fileperms($tempdir);
if (($perms & 0xC000) == 0xC000) {
// Socket
$info = 's';
<?php
$tempdir = sys_get_temp_dir();
echo "Your temp directory is: " . $tempdir . "<br />";
$perms = fileperms($tempdir);
if (($perms & 0xC000) == 0xC000) {
// Socket
$info = 's';
# Hot Property to Intellectual Property SQL migrations
# DO THE COMPANY INSERTS
INSERT INTO jos_iproperty_companies (name, street, city, postcode, fax, phone, email, website, icon, ip_source)
SELECT name, address, suburb, postcode, fax, telephone, email, website, photo, id FROM jos_hp_companies WHERE 1
# DO THE AGENT INSERTS
INSERT INTO jos_iproperty_agents (fname, lname, company, email, mobile, website, user_id, icon, ip_source)
SELECT SUBSTRING_INDEX(name, ' ', 1), SUBSTRING_INDEX(name, ' ', -1), company, email, mobile, desc, user, photo, id FROM jos_hp_agents WHERE 1
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
select column_name from information_schema.columns where table_name='table' INTO outfile '/tmp/tmp.csv'
<?php
function filename_safe($filename) {
$temp = $filename;
$temp = strtolower($temp);
$temp = str_replace(" ", "_", $temp);
// Loop through string
$result = '';
for ($i=0; $i<strlen($temp); $i++) {
if (preg_match('([0-9]|[a-z]|_)', $temp[$i])) {