This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ChatController extends AppController { | |
public $components = array( | |
'WebSocket', | |
); | |
public function send() { | |
$this->autoRender = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Available find keys: | |
* 'category': adding creteria with name of category. | |
*/ | |
class CategorizeBehavior extends ModelBehavior { | |
public $defaultSettings = array( | |
'key' => 'category', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Post extends AppModel { | |
/** | |
* Usage: | |
* $nextPost = $this->Post->getNext(1); | |
*/ | |
public function getNext($id) { | |
$greater = $this->find('first', array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$defautlOptions = array( | |
'model' => null, // Inflector::classify($controller) by default | |
'display' => ':displayField', // ルートのスラグに適応されるフィールド。モデルのdisplayFieldがデフォルト | |
'lookup' => ':primaryKey', // コントローラのアクション引数、URLの指定のpass($id)に渡すべきフィールド。モデルのプライマリーキーがデフォルト。 | |
'cacheConfig' => 'default', // 使用するキャッシュのコンフィグ名。falseを指定するとキャッシュしない。 | |
'recursive' => -1, // モデルのクエリでのrecursiveの値 | |
'named' => ':displayField', // スラグのパラメータ名。/post/:title のtitleに当たるもの。 | |
'identity' => ':name', // インスタンスの名前。デフォルトはモデル名。キャッシュの操作に使う |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Usage | |
// php upgrade.php on app dir or plugin root | |
class App { | |
public static function __callStatic($method, $params) { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AppController extends Controller { | |
public $components = array( | |
'Auth' => array( | |
'authenticate' => array( | |
'TwitterKit.TwitterOauth', | |
), | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$start_time = microtime(true); | |
?> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> | |
<style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Report extends AppModel { | |
// set true when type => daily was affected | |
private $__dailyReportAffected = false; | |
/* | |
some implemetations... | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class AppShell extends Shell { | |
public $Controller; | |
/** | |
* Loads a Controller in order to use features what Controller has. | |
* | |
* @return Controller loaded controller object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// almost same output can be seen at: | |
// http://jsonformatter.curiousconcept.com/ | |
class JsonDebug { | |
function format($json, $output = false) { | |
$depth = 0; | |
$length = strlen($json); | |
$result = ''; | |
for ($n = 0; $n < $length; $n++) { | |
$c = $json{$n}; |