Skip to content

Instantly share code, notes, and snippets.

View asika32764's full-sized avatar

Simon Asika asika32764

View GitHub Profile
@asika32764
asika32764 / print_r_level.php
Last active August 5, 2022 01:55
Useful recursive dumping function to simulate `print_r()` but limited by level.
<?php
/**
* @copyright Copyright (C) 2011 - 2014 SMS Taiwan, Inc. All rights reserved.
* @license GNU General Public License version 2 or later;
*/
/**
* Recursive print variables and limit by level.
*
* @param mixed $data The variable you want to dump.
@asika32764
asika32764 / sql-paginarion.sql
Created November 20, 2013 06:34
MySQL 分頁查詢
SQL_CALC_FOUND_ROWS SELECT ...
SELECT FOUND_ROWS();
@asika32764
asika32764 / optiontype-example.php
Last active December 30, 2015 10:59
Option Type Example
<?php
abstract class OptionTypeHelper
{
static public function add($value, $text, $type = 'location')
{
$db = JFactory::getDbo();
$obj = new Stdclass;
@asika32764
asika32764 / class.php
Created December 21, 2013 11:30
PHPStorm File Template
/**
* Class ${NAME}
*
* @since 1.0
*/
@asika32764
asika32764 / tooltips.php
Created December 24, 2013 07:37
Joomla 3 Tooltip Bootstrap
<?php
JHtml::_('bootstrap.tooltip');
?>
<a class="hasTooltip" title="This is description" href="#" />
@asika32764
asika32764 / REST.php
Last active January 1, 2016 09:59
分成 REST 形式與 User Friendly (Alias) 形式的兩種寫法: Put it at: {FRONT-END}/components/com_flower/router.php
<?php
/**
* @package Joomla.Site
* @subpackage com_flower
* @author Simon ASika <asika32764@gmail.com>
* @copyright Copyright (C) 2013 Asikart. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access
<?php
/**
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Data;
use Psr\Cache\CacheInterface;
<?php
$params = JComponentHelper::getParams('com_bamahome');
$foo = $params->get('foo', 'bar');
@asika32764
asika32764 / facility-type.php
Created January 15, 2014 09:58
Facility & Type mapping helper
<?php
/**
* Part of crm project.
*
* @copyright Copyright (C) 2011 - 2014 SMS Taiwan, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
/**
* Class IcrmHelperType
<?php
JModelLegacy:addIncludePath(JPATH_ROOT . '/components/com_foo/models');
$model = JModelLegacy::getInstance('Item', 'FooModel', array('ignore_request' => true));
$model->setState('foo.bar', 'yoo');
$item = $model->getItem();