-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,136 changed files
with
16,341 additions
and
619,272 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Yiistrap | ||
======== | ||
Yiistrap Docs | ||
============= | ||
|
||
Twitter Bootstrap for Yii Demo site. | ||
Documentation for Yiistrap, Twitter Bootstrap for Yii. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
// require application params | ||
$params = require(__DIR__ . '/params.php'); | ||
|
||
// application configuration | ||
return array( | ||
// application base path | ||
'basePath' => realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'), | ||
// application name | ||
'name' => $params['app.name'], | ||
// application language | ||
'language' => 'en', | ||
// components to preload | ||
'preload' => array('log'), | ||
// path aliases | ||
'aliases' => array( | ||
'bootstrap' => realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '../vendor/yii-twbs/yiistrap'), | ||
), | ||
// paths to import | ||
'import' => array( | ||
'application.models.*', | ||
'application.components.*', | ||
'bootstrap.helpers.*', | ||
), | ||
// application components | ||
'components' => array( | ||
'bootstrap' => array( | ||
'class' => 'bootstrap.components.TbApi', | ||
), | ||
'errorHandler' => array( | ||
'errorAction' => 'site/error', | ||
), | ||
'less' => array( | ||
'class' => 'ext.less.components.Less', | ||
'mode' => $params['less.mode'], | ||
'options' => $params['less.options'], | ||
'files' => $params['less.files'], | ||
), | ||
'log' => array( | ||
'class' => 'CLogRouter', | ||
'routes' => array( | ||
array( | ||
'class' => 'CFileLogRoute', | ||
'levels' => 'error, warning', | ||
), | ||
// uncomment the following to show log messages on web pages | ||
/* | ||
array( | ||
'class'=>'CWebLogRoute', | ||
), | ||
*/ | ||
), | ||
), | ||
'urlManager' => array( | ||
'urlFormat' => 'path', | ||
'showScriptName' => false, | ||
'caseSensitive' => false, | ||
'rules' => $params['urlManager.rules'], | ||
), | ||
'user' => array( | ||
'allowAutoLogin' => true, | ||
), | ||
), | ||
// application parameters | ||
'params' => $params, | ||
); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
/** | ||
* Html class file. | ||
* Helper that contains logic for rendering of HTML elements. | ||
*/ | ||
|
||
class Html extends CHtml | ||
{ | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,249 @@ | ||
<?php | ||
/** | ||
* global.php file. | ||
* Global shorthand functions for commonly used Yii methods. | ||
* @author Christoffer Niska <[email protected]> | ||
* @copyright Copyright © Christoffer Niska 2013- | ||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License | ||
*/ | ||
|
||
defined('DS') or define('DS', DIRECTORY_SEPARATOR); | ||
|
||
/** | ||
* Returns the application instance. | ||
* @return CWebApplication | ||
*/ | ||
function app() | ||
{ | ||
return Yii::app(); | ||
} | ||
|
||
/** | ||
* Returns the application parameter with the given name. | ||
* @param $name | ||
* @return mixed | ||
*/ | ||
function param($name) | ||
{ | ||
return isset(Yii::app()->params[$name]) ? Yii::app()->params[$name] : null; | ||
} | ||
|
||
/** | ||
* Returns the client script instance. | ||
* @return CClientScript | ||
*/ | ||
function cs() | ||
{ | ||
return Yii::app()->getClientScript(); | ||
} | ||
|
||
/** | ||
* Returns the main database connection. | ||
* @return CDbConnection | ||
*/ | ||
function db() | ||
{ | ||
return Yii::app()->getDb(); | ||
} | ||
|
||
/** | ||
* Returns the formatter instance. | ||
* @return CFormat | ||
*/ | ||
function format() | ||
{ | ||
return Yii::app()->getFormat(); | ||
} | ||
|
||
/** | ||
* Returns the request instance. | ||
* @return CHttpRequest | ||
*/ | ||
function request() | ||
{ | ||
return Yii::app()->getRequest(); | ||
} | ||
|
||
/** | ||
* Returns the session instance. | ||
* @return CHttpSession | ||
*/ | ||
function session() | ||
{ | ||
return Yii::app()->getSession(); | ||
} | ||
|
||
/** | ||
* Returns the web user instance for the logged in user. | ||
* @return CWebUser | ||
*/ | ||
function user() | ||
{ | ||
return Yii::app()->getUser(); | ||
} | ||
|
||
/** | ||
* Translates the given string using Yii::t(). | ||
* @param $category | ||
* @param $message | ||
* @param array $params | ||
* @param string $source | ||
* @param string $language | ||
* @return string | ||
*/ | ||
function t($category, $message, $params = array(), $source = null, $language = null) | ||
{ | ||
return Yii::t($category, $message, $params, $source, $language); | ||
} | ||
|
||
/** | ||
* Returns the base URL for the given URL. | ||
* @param string $url | ||
* @return string | ||
*/ | ||
function baseUrl($url = '') | ||
{ | ||
static $baseUrl; | ||
if (!isset($baseUrl)) | ||
$baseUrl = Yii::app()->request->baseUrl; | ||
return $baseUrl . '/' . ltrim($url, '/'); | ||
} | ||
|
||
/** | ||
* Registers the given CSS file. | ||
* @param $url | ||
* @param string $media | ||
*/ | ||
function css($url, $media = '') | ||
{ | ||
Yii::app()->clientScript->registerCssFile(baseUrl($url), $media); | ||
} | ||
|
||
/** | ||
* Registers the given JavaScript file. | ||
* @param $url | ||
* @param null $position | ||
*/ | ||
function js($url, $position = null) | ||
{ | ||
Yii::app()->clientScript->registerScriptFile(baseUrl($url), $position); | ||
} | ||
|
||
/** | ||
* Escapes the given string using CHtml::encode(). | ||
* @param $text | ||
* @return string | ||
*/ | ||
function e($text) | ||
{ | ||
return CHtml::encode($text); | ||
} | ||
|
||
/** | ||
* Returns the escaped value of a model attribute. | ||
* @param $model | ||
* @param $attribute | ||
* @param null $defaultValue | ||
* @return string | ||
*/ | ||
function v($model, $attribute, $defaultValue = null) | ||
{ | ||
return CHtml::encode(CHtml::value($model, $attribute, $defaultValue)); | ||
} | ||
|
||
/** | ||
* Purifies the given HTML. | ||
* @param $text | ||
* @return string | ||
*/ | ||
function purify($text) | ||
{ | ||
static $purifier; | ||
if (!isset($purifier)) | ||
$purifier = new CHtmlPurifier; | ||
return $purifier->purify($text); | ||
} | ||
|
||
/** | ||
* Returns the given markdown text as purified HTML. | ||
* @param $text | ||
* @return string | ||
*/ | ||
function markdown($text) | ||
{ | ||
static $parser; | ||
if (!isset($parser)) | ||
$parser = new MarkdownParser; | ||
return $parser->safeTransform($text); | ||
} | ||
|
||
/** | ||
* Creates an image tag using CHtml::image(). | ||
* @param $src | ||
* @param string $alt | ||
* @param array $htmlOptions | ||
* @return string | ||
*/ | ||
function img($src, $alt = '', $htmlOptions = array()) | ||
{ | ||
return CHtml::image(baseUrl($src), $alt, $htmlOptions); | ||
} | ||
|
||
/** | ||
* Creates a link to the given url using CHtml::link(). | ||
* @param $text | ||
* @param string $url | ||
* @param array $htmlOptions | ||
* @return string | ||
*/ | ||
function l($text, $url = '#', $htmlOptions = array()) | ||
{ | ||
return CHtml::link($text, $url, $htmlOptions); | ||
} | ||
|
||
/** | ||
* Creates a relative URL using CUrlManager::createUrl(). | ||
* @param $route | ||
* @param array $params | ||
* @param string $ampersand | ||
* @return mixed | ||
*/ | ||
function url($route, $params = array(), $ampersand = '&') | ||
{ | ||
return Yii::app()->urlManager->createUrl($route, $params, $ampersand); | ||
} | ||
|
||
/** | ||
* Encodes the given object using json_encode(). | ||
* @param mixed $value | ||
* @param integer $options | ||
* @return string | ||
*/ | ||
function je($value, $options = 0) | ||
{ | ||
return json_encode($value, $options); | ||
} | ||
|
||
/** | ||
* Decodes the given JSON string using json_decode(). | ||
* @param $string | ||
* @param boolean $assoc | ||
* @param integer $depth | ||
* @param integer $options | ||
* @return mixed | ||
*/ | ||
function jd($string, $assoc = true, $depth = 512, $options = 0) | ||
{ | ||
return json_decode($string, $assoc, $depth, $options); | ||
} | ||
|
||
/** | ||
* Dumps the given variable using CVarDumper::dumpAsString(). | ||
* @param mixed $var | ||
* @param int $depth | ||
* @param bool $highlight | ||
*/ | ||
function dump($var, $depth = 10, $highlight = true) | ||
{ | ||
echo CVarDumper::dumpAsString($var, $depth, $highlight); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.