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 | |
namespace console\controllers; | |
use Yii; | |
/** | |
* Controller to Generate base models | |
* NOTE : make sure you are using Development Environment. | |
* @author digitize |
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 | |
/** | |
* Common Settings for widgets across whole project | |
* @reference : http://www.yiiframework.com/doc/api/1.1/CWidgetFactory | |
* Based on Bootstrap CSS class | |
*/ | |
return array( | |
'components' => array( | |
'widgetFactory' => array( // Default properties for some widgets |
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 | |
// Set a veriable for redirection (Optional) | |
$redirect_to = ''; | |
/** | |
* WordPress Auto login script | |
*/ | |
if(!is_user_logged_in()) | |
{ |
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 | |
/** | |
* Prepend taxonomy name before feed title for Articles | |
* This will work for any custom post type or custom taxonomy | |
*/ | |
function add_feed_item_title($content) | |
{ | |
global $wp_query; | |
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 | |
/** | |
* Remove query string from static resource | |
* @param type $src | |
* @return type | |
*/ | |
function _remove_script_version($src) | |
{ | |
$return = $src; |
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 | |
/** | |
* If any category is deleted move all attached posts into trash | |
*/ | |
function trash_category_posts($object_id, $tt_ids) | |
{ | |
/** | |
* 1. Check the post_type | |
* 2. Check the action is delete or delete-tag | |
* 3. Check the taxonomy type is "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 | |
/** | |
* Trim output of html | |
*/ | |
function trim_output($buffer) | |
{ | |
// Replace key with their values. | |
$replace = array( | |
"#<!--.*?-->#s" => "", // strip comments |
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 | |
/** | |
* Category Ratio: Get Posts base on Custom % per category it means that each category. | |
* | |
* Get Category ratio from Settings like below. | |
* $category_ratio = array(category_id for selected category => inserted category ratio); | |
* | |
* NOTE: Most important the total of category ratio for all the selected categories must be 100% | |
* (this you need to set using JavaScript logic on back admin) otherwise it will create problem. |
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
# Clone entire site. | |
wget --content-disposition --execute robots=off --recursive --no-parent --continue --no-clobber http://example.com | |
# Remove query string from a static resource. | |
for i in `find $1 -type f -name "*\?*"`; do mv $i `echo $i | cut -d? -f1`; done |
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 | |
/** | |
* Creates a directory according to given id and parent dir path | |
* @params integer $id this id will decide which directory to return or create and then return | |
* @params string $parent this will decide what is the path of the directory. | |
*/ | |
function createDir($id, $parent) | |
{ | |
$nd_dirlimit = 100; | |
$mod = ceil($id / $nd_dirlimit) - 1; |
OlderNewer