Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yuya-matsushima's full-sized avatar
🏢
Working from Office

Yuya Matsushima yuya-matsushima

🏢
Working from Office
View GitHub Profile
<?php
/*
Plugin Name: 上州nize Posts(仮)
Plugin URI: http://www.e2esound.com/
Description: 投稿内容を上州弁ぽくします。
Version: 焼きまんじゅう
Author: Yuya Terajima
Author URI: http://www.e2esound.com/
*/
@yuya-matsushima
yuya-matsushima / MY_Controller.php
Created March 29, 2011 15:00
MY_Controller.php
<?php
class MY_Controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
@yuya-matsushima
yuya-matsushima / blog.php
Created April 4, 2011 03:45
seezoo1.0.1のfeed配信用アクションの追加
<?php
/**
* RSS2.0/RSS1.0/Atom feed配信
* @access public
* @params string
*/
function feed($mode = 'rss2')
{
$site_title = $this->init_model->get_site_info()->site_title;
$blog_title = $this->blog_model->get_blog_info()->page_title;
@yuya-matsushima
yuya-matsushima / blog_model.php
Created April 4, 2011 03:53
seezoo1.0.1のfeed配信機能追加用の追加メソッド
<?php
/**
* blogページのmeta情報取得
*/
function get_blog_meta()
{
$sql =
'SELECT '
. 'PV.page_title, '
. 'PV.meta_title, '
@yuya-matsushima
yuya-matsushima / SplFileInfo::isHoge().ph
Created April 11, 2011 19:58
SplFileInfoのisFile(),isLink()の挙動がおかしい?
<?php
//ファイルは実際に存在
$dat = '../sample.dat';
$file = new SplFileInfo($dat);
switch(TRUE)
{
case $file->isDir():
echo 'ディレクトリです。', "<br>";
@yuya-matsushima
yuya-matsushima / sample.php
Created April 21, 2011 21:51
ModelからModel呼び出し検証用
<?php
class Sample extends CI_Controller
{
function __construct()
{
parent::__construct();
}
function index()
{
@yuya-matsushima
yuya-matsushima / main_model.php
Created April 21, 2011 21:53
ModelからModel呼び出し検証用
<?php
class Main_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
function main_add($a, $b, $c)
{
@yuya-matsushima
yuya-matsushima / sub_model.php
Created April 21, 2011 21:55
ModelからModel呼び出し検証用
<?php
class Sub_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
function sub_add($a, $b)
{
@yuya-matsushima
yuya-matsushima / MY_Model.php
Created May 1, 2011 07:38
MY_Modelの魔法の言葉の話し
<?php
class MY_Model extends CI_Model
{
protected $tbl;
public function __construct()
{
parent::__construct();
// Model名からテーブル名取得
$this->tbl = substr(strtolower(get_class($this)), 0, -6);
@yuya-matsushima
yuya-matsushima / MY_Unit_test.php
Created May 1, 2011 14:28
unit_testをCLIから実行し、テストが失敗した場合には、失敗したテストを表示
<?php if( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Unit_test extends CI_Unit_test
{
public function __construct()
{
parent::__construct();
}
public function report($result = array())