Skip to content

Instantly share code, notes, and snippets.

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 4.3.2 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
* @copyright Copyright (c) 2006 - 2011 EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
@kenjis
kenjis / ip_address.php
Created August 31, 2011 23:56
CodeIgniter contoller which shows client IP address
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Ip_address extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
@kenjis
kenjis / test_ip_address.php
Created August 31, 2011 23:57
CodeIgniter contoller which tests ip_address()
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Test_ip_address extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
@kenjis
kenjis / autoload.php
Created September 21, 2011 08:05
PHPUnit for CodeIgniter Unit Testing class: http://d.hatena.ne.jp/Kenji_s/20110921/1316593782
<?php
define('BASEPATH', dirname(__FILE__) . '/../system/');
define('APPPATH', dirname(__FILE__) . '/../application/');
function autoload_core($class_name)
{
$file_name = $class_name;
if (substr($class_name, 0, 3) === 'CI_')
{
@kenjis
kenjis / CI_Unit_Test.php
Created September 21, 2011 08:07
PHPUnit for CodeIgniter Unit Testing class: http://d.hatena.ne.jp/Kenji_s/20110921/1316593782
<?php
require 'autoload.php';
class CI_Unit_Test extends PHPUnit_Framework_TestCase
{
private $test_folder;
private $test_uri;
private $count = 0;
private $tests = array();
@kenjis
kenjis / phpunit.xml
Created September 21, 2011 08:08
PHPUnit for CodeIgniter Unit Testing class: http://d.hatena.ne.jp/Kenji_s/20110921/1316593782
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="true"
stopOnFailure="false">
<php>
<server name="SERVER_NAME" value="http://example.com" />
</php>
<testsuites>
<testsuite name="CI Unit Testing Class Tests">
@kenjis
kenjis / baser_xss_patch.diff
Created September 30, 2011 04:36
XSS patch for basercms-1.6.13.1
--- basercms/baser/views/helpers/baser.php 2011-07-19 20:58:05.000000000 +0900
+++ basercms-1.6.13.1/baser/views/helpers/baser.php 2011-08-16 18:34:52.000000000 +0900
@@ -676,7 +676,7 @@
* コンテンツ名を取得する
* ・キャメルケースで取得
* ・URLのコントローラー名までを取得
- * ・ページの場合は、カテゴリ名(カテゴリがない場合はdefault)
+ * ・ページの場合は、カテゴリ名(カテゴリがない場合はDefault)
* @return string
*/
# MBTextWrapper
# at http://d.hatena.ne.jp/dayflower/20100212/1265960099
# License: NYSL
import sys, textwrap
from unicodedata import east_asian_width
__all__ = ['MBTextWrapper', 'wrap', 'fill']
def _mb_width(c):
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 3b4c72b..5bb7f60 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -79,18 +79,21 @@ Change Log
<li>Helpers
<ul>
<li>Added <samp>increment_string()</samp> to <a href="helpers/string_helper.html">String Helper</a> to turn "foo" into "foo-1" or "foo-1" into "foo-2".</li>
- <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
+ <li>Altered form helper - made action on form_open_multipart helper function call optional. Fixes (#65)</li>
@kenjis
kenjis / html2rest.py
Created October 6, 2011 14:07
html2rest for CodeIgniter User Guide
#-----------------------------------------------------------------------------
# Copyright (c) 2006-2009 Gerard Flanagan
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#