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
| if(!function_exists('_log')){ | |
| function _log( $message ) { | |
| if( WP_DEBUG === true ){ | |
| if( is_array( $message ) || is_object( $message ) ){ | |
| error_log( print_r( $message, true ) ); | |
| } else { | |
| error_log( $message ); | |
| } | |
| } | |
| } |
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 | |
| function query( $query ) { | |
| if ( ! $this->ready ) | |
| return false; | |
| if ( strpos($query, "CALL") === false ) | |
| { | |
| $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, true ); | |
| $this->set_charset( $this->dbh ); | |
| $this->ready = true; |
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 | |
| function check_Str_len($string) { | |
| echo stripslashes($string).'<br />'; | |
| echo strlen( stripslashes($string) ).'<br />'; | |
| } | |
| check_Str_len('843175010'); | |
| ?> |
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 | |
| global $wpdb; | |
| // @ prefix used to suppress errors, but you should do your own | |
| // error checking by checking return values from each mysql_query() | |
| // Start Transaction | |
| @mysql_query("BEGIN", $wpdb->dbh); | |
| // Do some expensive/related queries here |
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
| function smartShorten($charset='utf-8', $str, $maxlength = 140, $max_cut_len = 10) { | |
| $len = iconv_strlen($str, $charset); | |
| if ($len > $maxlength) { | |
| $str = iconv_substr($str, 0, $maxlength, $charset); | |
| $prev_space_pos = iconv_strrpos($str, ' ', $charset); | |
| if ( ($maxlength-$prev_space_pos) < $max_cut_len) { | |
| $str = iconv_substr($str, 0, $prev_space_pos, $charset); | |
| } |
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
| function jszz(s){ | |
| s=s*1000; | |
| var a=true; | |
| var n=new Date(); | |
| var w; | |
| var sMS=n.getTime(); | |
| while(a){ | |
| w=new Date(); | |
| wMS=w.getTime(); | |
| if(wMS-sMS>s) a=false; |
NewerOlder