To make life easier, this has been moved over to a wiki.
Please visit the wiki :)
<?php defined('SYSPATH') OR die('No direct access allowed.'); | |
class form extends form_Core { | |
public static function open($action = NULL, $attr = array(), $hidden = NULL) | |
{ | |
$form = parent::open($action, $attr); | |
empty($hidden) or $form .= '<div class="superfluous_markup_to_conform_to_standards">'.rtrim(form::hidden($hidden)).'</div>'; | |
/* Expanded form of a bookmarklet for extracting rev=canonical OR tinyurling a page */ | |
(function(){ | |
var url=document.location; | |
var links=document.getElementsByTagName('link'); | |
var found=0; | |
for(var i = 0, l; l = links[i]; i++) { | |
if (l.getAttribute('rev') == 'canonical' || (/alternate short/).exec(l.getAttribute('rel'))) { | |
found=l.getAttribute('href'); | |
break; | |
} |
// Options passed to all configures | |
// --prefix is already set, and based on the php version | |
$config_options_all = array( | |
//'--disable-all', | |
'--disable-cgi', | |
'--enable-cli', | |
); | |
// Options passed to version (branch) specific configures | |
// Example: array('5.3' => '--enable-intl', '5.2' => ''); |
To make life easier, this has been moved over to a wiki.
Please visit the wiki :)
<?php | |
$apiBase = 'http://api.microsofttranslator.com/V2/Http.svc'; | |
$appId = 'yourappid'; | |
$text = 'Een hoge boom vangt veel wind'; | |
$streamContext = stream_context_create(array('http' => array( | |
'method' => 'POST', | |
'content' => '', | |
'header' => implode("\r\n", array('Content-Type: text/xml', 'Content-Length: 0')), |
<?php defined('SYSPATH') or die('No direct script access.'); | |
/** | |
* JSON helper class | |
* | |
* Examples: | |
* $j = JSON::decode('{"Organization": "Kohana"}'); // Good | |
* $j = JSON::decode("{'Organization': 'Kohana'}"); // Invalid | |
* $j = JSON::decode('{"Organization": "Kohana"}', NULL, 1); // depth stack exceeded | |
* | |
* @package Kohana |
<?php | |
class Example { | |
public static $member = "Hi Gordon!"; | |
public $another = "Aww :("; | |
} | |
// Works fine | |
$ref = new ReflectionProperty("Example", "member"); | |
var_dump( $ref->getValue() ); |
<?php | |
/** | |
* LazyestXMLParser xml parser class | |
* | |
* @access public | |
*/ | |
class LazyestXMLParser { | |
var $arrOutput = array(); |
[15:56] <@salathe> do you think anyone would mind if we deprecated __autoload ? | |
[15:56] <@philip__> why? | |
[15:57] <@Derick> ?! | |
[15:57] <cyth> because __autoload sucks compared to spl_register | |
[15:57] <@Derick> it works | |
[15:57] <@Derick> print also sucks over echo | |
[15:58] <cyth> yeah but it's kind of bad practice | |
[15:58] <cyth> you could be clobering third party autoloaders | |
[15:58] <@Derick> not every project cares | |
[15:58] <@bjori> not every project uses third party autoloaders |
<?php | |
function iterator_map($iterator, $callback) | |
{ | |
$result = array(); | |
foreach ($iterator as $key => $current) { | |
$result[$key] = $callback($current, $key, $iterator); | |
} | |
return $result; | |
} |