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
<?php | |
/** | |
* PHP script to zip folder using RecursiveDirectoryIterator PHP function | |
*/ | |
// Get real path for folder | |
$folder_to_zip = realpath("path-to-folder"); | |
//saving zip | |
$zipname = "zip-file-name.zip"; |
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
<?php | |
/** | |
* PHP script for zip directory recursive function | |
*/ | |
//source: http://ramui.com/articles/php-zip-files-and-directory.html | |
function recurse_zip($src,&$zip,$path_length) { | |
$dir = opendir($src); | |
while(false !== ( $file = readdir($dir)) ) { | |
if (( $file != '.' ) && ( $file != '..' )) { |
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
<?php | |
/** | |
* Importing tables structures and data using php | |
*/ | |
function backup_database( $tables = '*' ){ | |
try{ | |
$conn = mysqli_connect($host_name, $username, $password, $dbname); | |
//get all of the tables | |
if($tables == '*') { | |
$tables = array(); |
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
<?php | |
/** | |
* this wordpress script is for accepting the excerpt function with html format along with css design. | |
*/ | |
// child custom excerpt length | |
function custom_excerpt_length( $length ) { | |
return 199; | |
} | |
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); |
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
<?php | |
/** | |
* import db via Command Line Interface (CLI) PHP | |
*/ | |
define('DBUSER','DBUSER'); | |
define('DBPASSWD','DBPASSWRD'); | |
define('DATABASE','DBNAME'); | |
define('HOST','host'); | |
$filename = "backup-" . date("d-m-Y") . ".sql.gz"; |
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
<?php | |
/** | |
* The below function will help to load template file from plugin directory of wordpress | |
* Extracted from : http://wordpress.stackexchange.com/questions/94343/get-template-part-from-plugin | |
*/ | |
define('PLUGIN_DIR_PATH','Your-plugin-directory-path'); | |
function ccm_get_template_part($slug, $name = null) { | |
do_action("ccm_get_template_part_{$slug}", $slug, $name); |
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
<?php | |
/** | |
* Fetch Latitude and Longitude | |
* Need google api key with geo code enabled | |
*/ | |
function get_lat_long($address){ | |
$address = str_replace(", ", ",+", $address); | |
$address = str_replace("+", "+", $address); | |
$address = str_replace(" ", "+", $address); |
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
<?php | |
/** | |
* remove malicious code | |
* Removing a string in a PHP file with Start and End | |
*/ | |
set_time_limit(0); | |
define('ABSPATH', dirname( __FILE__ ) ); |
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
<?php (defined('BASEPATH')) OR exit('No direct script access allowed'); | |
/** | |
* Router Class | |
* | |
* Parses URIs and determines routing | |
* | |
* @package CodeIgniter | |
* @subpackage Libraries | |
* @author ashokmhrj |
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
<?php | |
/** | |
* Wordpress pagination | |
* paginate_links | |
* https://codex.wordpress.org/Function_Reference/paginate_links | |
*/ | |
function wp_pagination($echo = true) { | |
global $wp_query; | |
$big = 999999999; // need an unlikely integer |
OlderNewer