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 | |
/** | |
* @param int $position | |
* @param bool|true $echo | |
* @return bool | |
*/ | |
function the_slug($position=1,$echo=false){ | |
$url = parse_url($_SERVER['REQUEST_URI']); | |
$slugs = array_filter(explode('/',$url['path'])); |
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 | |
/** | |
* @param array $needle | |
* @param array $haystack | |
* @param $position | |
* @return array | |
*/ | |
function inject_this_array($needle=array(),$haystack=array(),$position){ | |
$new_holder1 = array_slice($haystack, 0, $position, true); | |
$new_holder2 = array_slice($haystack, $position, count($haystack)-1,true); |
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 | |
/** | |
* @param object|int|string $object | |
* @return string | |
*/ | |
function get_object_type($object){ | |
$workable = false; | |
$object_type = gettype($object); | |
switch($object_type){ |
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 | |
/** | |
* Create an element | |
*/ | |
class Element | |
{ | |
private $type; | |
private $unaryTagArray = array('area','base','br','col','command','embed','hr','img','input','keygen','link','meta','param','source','track','wbr'); | |
private $attributes; | |
private $innerHtml; |
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 | |
/** | |
* Get the HREF value of an IMG | |
* | |
* @param $g_ava | |
* | |
* @return mixed | |
*/ | |
function get_avatar_link($g_ava){ | |
if (is_string($g_ava)){ |
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 | |
function getConnection1(){ | |
$dbhost = "localhost"; | |
$dbuser = "test"; | |
$dbpass = "test"; | |
$dbname = "schema name"; | |
$dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass, array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'')); | |
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
return $dbh; | |
} |
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 | |
function generate_password($length = 64){ | |
$box_array = array( 'jhg','RTJ','ZCG','{;G','KRA','!','@','$','%','^','&','*','(',')','_','=','+' ); | |
$password=''; | |
for($x=0; $x < $length; $x++){ | |
$password .= $box_array[intval(array_rand($box_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 | |
/** | |
* replace array Values (string) with length values | |
* @param array $string | |
*/ | |
function get_string_length(&$string){ | |
if ((is_string($string)) || (is_integer($string))) | |
$string = strlen($string); | |
} |
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 | |
$imgs = get_posts("post_type=attachment&numberposts=-1"); | |
$x=0; | |
foreach($imgs as $img){ | |
$file = get_attached_file($img->ID); | |
$Image_size = getimagesize($file); | |
if(!is_array($Image_size)){ | |
wp_delete_post( $img->ID, false ); | |
echo $x .'- Deleting attachment #'.$img->ID; |
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 | |
/** | |
* Created by PhpStorm. | |
* User: wahbehw | |
* Date: 2/1/2016 | |
* Time: 9:26 AM | |
*/ | |
//namespace entity_object; |
OlderNewer