Posts

Showing posts with the label function

Disable back button of any browser in javascript

Hi Friends I was working on web application in which we have to disable browser back button,so search number solution in stackoverflow and found best suitable solution for it.I wanted to share that code ,so that developer can save time on searching. history.pushState(null, null, document.URL); window.addEventListener('popstate', function () { history.pushState(null, null, document.URL); });

casting vs is_numeric in php

The casting is to define data type to specific variable in which may be set or going to be set example: $sam = (string)$_POST['name'];  here (string) is the casting type in php.The casting type can be used as sanitizing the varible from sql injection. $val = (int)$_GET['id']; is better then $val = $_GET['id']  ; The is_numeric is function used to validate the integer variable. The casting is faster then is_numeric ,because is_numeric returns boolean (true or false) and its a function where casting returns  numeric value.

list of sanitize function in wordpress

The sanitize php function works with two different function in wordpress they are filter and sanitize email. apply_filters function apply_filters( $tag, $value ) { global $wp_filter, $merged_filters, $wp_current_filter; $args = array(); // Do 'all' actions first if ( isset($wp_filter['all']) ) { $wp_current_filter[] = $tag; $args = func_get_args(); _wp_call_all_hook($args); } if ( !isset($wp_filter[$tag]) ) { if ( isset($wp_filter['all']) ) array_pop($wp_current_filter); return $value; } if ( !isset($wp_filter['all']) ) $wp_current_filter[] = $tag; // Sort if ( !isset( $merged_filters[ $tag ] ) ) { ksort($wp_filter[$tag]); $merged_filters[ $tag ] = true; } reset( $wp_filter[ $tag ] ); if ( empty($args) ) $args = func_get_args(); do { foreach( (array) current($wp_filter[$tag]) as $the_ ) if ( !is_null($the_['function']) ){ $args[1] = $value; $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_[...

jquery coding standard

Introduction Anybody can write code. With a few months of programming experience, you can write 'working applications'. Making it work is easy, but doing it the right way requires more work, than just making it work. Believe it, majority of the programmers write 'working code', but not ‘good code'. Writing 'good code' is an art and you must learn and practice it. Everyone may have different definitions for the term ‘good code’. But the following are the characteristics of good code. Reliable Maintainable Efficient Most of the developers are inclined towards writing code for higher performance, compromising reliability and maintainability. But considering the long term ROI (Return On Investment), efficiency and performance comes below reliability and maintainability. If your code is not reliable and maintainable, you will be spending lot of time to identify issues, trying to understand code etc throughout the life of your application....