WP MVC plugin framework
Please check – http://wpmvc.org/
Looks like outdated but very good idea…
No More Passwords: Log Into WordPress with a QR Code
Check out the implementation details here
http://www.jackreichert.com/2012/01/22/no-more-passwords-log-into-wordpress-using-a-qr-code/
Here you will get a list of all constants defined in core WordPress.
http://wpengineer.com/2382/wordpress-constants-overview/
There is a dedicated smashing magazine subdomain for wordpress.
See – http://wp.smashingmagazine.com/
They have separate RSS feed also at – http://rss1.smashingmagazine.com/feed/?f=wp-std
Using the below code in your themes functions.php would add a new phone validation to your Contact Form 7 Plugin. The following code can also be used as a reference to add any other validation to the Contact Form 7 Plugin.
/* Contact Form 7 Phone Validation */
if(function_exists('wpcf7_add_shortcode')){
wpcf7_add_shortcode( 'phone', 'wpcf7_phone_shortcode_handler', true );
wpcf7_add_shortcode( 'phone*', 'wpcf7_phone_shortcode_handler', true );
}
function wpcf7_phone_shortcode_handler( $tag ) {
if ( ! is_array( $tag ) )
return '';
$type = $tag['type'];
$name = $tag['name'];
$options = (array) $tag['options'];
$values = (array) $tag['values'];
if ( empty( $name ) )
return '';
$atts = '';
$id_att = '';
$class_att = '';
$size_att = '';
$maxlength_att = '';
$tabindex_att = '';
$title_att = '';
$class_att .= ' wpcf7-text';
if ( 'phone' == $type || 'phone*' == $type )
$class_att .= ' wpcf7-validates-as-phone';
if ( 'phone*' == $type )
$class_att .= ' wpcf7-validates-as-required';
foreach ( $options as $option ) {
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
$id_att = $matches[1];
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
$class_att .= ' ' . $matches[1];
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
$size_att = (int) $matches[1];
$maxlength_att = (int) $matches[2];
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
$value = (string) reset( $values );
if ( wpcf7_script_is() && preg_grep( '%^watermark$%', $options ) ) {
$class_att .= ' wpcf7-use-title-as-watermark';
$title_att .= sprintf( ' %s', $value );
$value = '';
}
if ( wpcf7_is_posted() && isset( $_POST[$name] ) )
$value = stripslashes_deep( $_POST[$name] );
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
if ( $size_att )
$atts .= ' size="' . $size_att . '"';
else
$atts .= ' size="40"'; // default size
if ( $maxlength_att )
$atts .= ' maxlength="' . $maxlength_att . '"';
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
if ( $title_att )
$atts .= sprintf( ' title="%s"', trim( esc_attr( $title_att ) ) );
$html = '';
$validation_error = wpcf7_get_validation_error( $name );
$html = '' . $html . $validation_error . '';
return $html;
}
add_filter( 'wpcf7_validate_phone', 'wpcf7_phone_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_phone*', 'wpcf7_phone_validation_filter', 10, 2 );
function wpcf7_phone_validation_filter( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
$_POST[$name] = trim( strtr( (string) $_POST[$name], "\n", " " ) );
if ( 'phone' == $type || 'phone*' == $type ) {
if ( 'phone*' == $type && '' == $_POST[$name] ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
} elseif ( '' != $_POST[$name] && ! is_telnum( $_POST[$name] ) ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_phone' );
}
}
return $result;
}
function is_telnum($telnum)
{
$regexp = '/^[0-9\+\-\)\(\d\s]{7,}$/'; // Change the regex here suiting your phone number format
if(preg_match($regexp, $telnum))
return true;
else
return false;
}
/* Tag generator */
function wpcf7_add_tag_generator_phone() {
if( function_exists('wpcf7_add_tag_generator') ){
wpcf7_add_tag_generator( 'phone', __( 'Phone field', 'wpcf7' ),
'wpcf7-tg-pane-phone', 'wpcf7_tg_pane_phone_' );
}
}
function wpcf7_tg_pane_phone_( &$contact_form ) {
wpcf7_tg_pane_phone( 'phone' );
}
function wpcf7_tg_pane_phone( $type = 'phone' ) { ?>
<div id="wpcf7-tg-pane-" class="hidden">
'Phone number format is invalid',
'default' => 'The phone number format is invalid.'
) ;
return $message;
}
Save Database Queries for Analysis
http://codex.wordpress.org/es:Editing_wp-config.php#Save_queries_for_analysis
Radhe 4:52 pm on February 7, 2012 Permalink | Log in to Reply
Need to check this out – http://wordpress.org/extend/plugins/wp-mvc/