Skip to content

Instantly share code, notes, and snippets.

View ChrisFrench's full-sized avatar

Chris French ChrisFrench

  • Hellosign / Dropbox
  • San Diego, CA
View GitHub Profile
@ChrisFrench
ChrisFrench / gist:4275209
Created December 13, 2012 09:22
Accessing the Custom Fields in Joomla User Profile
<?php
$user = JFactory::getUser();
$profile = JUserHelper::getProfile($user->id);
var_dump($profile);
//each plugin adds its own object loaded with an array so you can access your fields like this
echo $profile->profile['address1'];
?>
@ChrisFrench
ChrisFrench / gist:5461452
Created April 25, 2013 17:17
validation.php
<?php
/**
* Verifies that all the required form fields are completed
* if any fail verification, set
* $object->error = true
* $object->message .= '<li>x item failed verification</li>'
*
* @param unknown $submitted_values array post data
* @return unknown_type
@ChrisFrench
ChrisFrench / send.php
Created January 11, 2013 21:10
Sending email with sendgrid
include 'sg/SendGrid_loader.php';
//Getting the elements from the form
//
$guestName = $_REQUEST['guestName'] ;
$accomodationPlans = $_REQUEST['accomodationPlans'] ;
$favoriteLoveSong = $_REQUEST['favoriteLoveSong'] ;
$bestContact = $_REQUEST['bestContact'] ;
$message = $_REQUEST['message'] ;
@ChrisFrench
ChrisFrench / customcategorieslist.php
Created November 26, 2012 23:34
How to use Joomla Categories System in a custom Component, and Have custom select list
JTable::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_categories/tables' );
JModel::addIncludePath( JPATH_ADMINISTRATOR.'/components/com_categories/models' );
$model = JModel::getInstance('Categories','CategoriesModel');
$model->setState('list.select','a.id, a.title, a.alias, a.note, a.published, a.params');
$app = JFactory::getApplication();
$app -> setUserState('com_categories.categories.filter.extension', 'com_yourapp.yoursection');
$items = $model -> getItems();
@ChrisFrench
ChrisFrench / addingmenuitemsviaphptienda.php
Created November 1, 2012 00:33
Adding items to the menu in Tienda or any other Dioscouri Library App
function onBeforeDisplayAdminComponentTienda() {
DSC::load('DSCMenu', 'library.menu');
$url = 'index.php?option=com_tienda&view=campaigns';
$bar = DSCMenu::getInstance('submenu');
$bar -> addEntry('Campaigns', $url);
$bar = DSCMenu::getInstance('leftmenu_campaign');
@ChrisFrench
ChrisFrench / gist:3173236
Created July 24, 2012 23:03
Trying to get Jform working
<?php
if(version_compare(JVERSION,'1.6.0','ge')) {
//I had to add a new XML file because the plugin XML for some reason fails to load. try to fix this later to only core plugin.
$path = JPATH_SITE.'/plugins/'.$row->folder.'/'.$row->element.'/jform/'.$row->element.'.xml';
//ok we get a jForm Object from the new file
$form = JForm::getInstance("paymentplugin", $path);
//we now need the data, so lets use the rows params and put them in an object.
$registry = new JRegistry;
$registry->loadString($row->params);
//for some reason the above method for me is returning NULL, which is just stupid. if you echo $row->params and copy it and put it below it loads
@ChrisFrench
ChrisFrench / gist:3021913
Created June 30, 2012 02:36
Creating a Pie Chart - HighRoller
<?php
$chartdata = array();
$chartdata[] = array( 'fivestar' , 15 );
$chartdata[] = array( 'fourstar' , 5 );
$chartdata[] = array( 'threestar' , 25 );
$chartdata[] = array( 'twostar' , 35 );
$chartdata[] = array( 'onestar' , 25 );
// HIGHROLLER PIE CHART
@ChrisFrench
ChrisFrench / xeditableexample.php
Created December 19, 2014 18:39
xeditableexample.php
<?php $publishStates = array(array('value' => 'draft', 'text' => 'draft'), array('value' => 'unpublished', 'text' => 'unpublished'), array('value' => 'published', 'text' => 'published')) ;
<?php foreach($paginated->items as $item) { ?>
<?php $xEditable = new \Dsc\Html\xEditable($item, '/admin/pages/page/edit/inline'); ?>
<?php echo $xEditable->field('title'); ?>
<?php echo $xEditable->field('slug'); ?>
<?php echo $xEditable->field('any.deep.value'); ?>
<?php
namespace Api\Site\Controllers;
class Menu extends Auth {
public function getMenu() {
$array = $this->getInputs();
<?php
namespace Api\Site\Controllers;
class Base extends \Dsc\Controller {
public function getInputs() {
$array = (array) json_decode( file_get_contents('php://input') );
if(empty($array)) {