/* email list web form validation */ function custom_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'webform_client_form_125') { $form['webform-client-form-125']['email']['#element_validate'] = array('_custom_email_list_email_validate'); } } function _custom_email_list_email_validate($form, &$form_state) { $values = $form_state['values']['submitted']; require_once('is_email.inc.php'); if (!is_email($values['email'])) { form_set_error('email', t('Please enter a valid email address.')); } }
$current_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; if($_SERVER['QUERY_STRING']) { $current_url .= "?" . $_SERVER['QUERY_STRING']; } echo($current_url);
/** * Method load File into an String. * * @return string | false * @access public */ function loadFileToString($File=null) { // If file exists load file into String. if(file_exists($File)) { return implode('',file($File)); } else { return false; } // End if-elsed } // End function
<?php print base_path() . path_to_theme() ?>
example:
<img alt="" src="<?php print base_path() . path_to_theme() ?>/images/new-zerona-img.jpg" />
RewriteCond %{query_string} ^([a-zA-Z0-9\-\/\.]+)$ [NC] RewriteRule ^(.*)$ <a href="http://example.com/phrase%1" title="http://example.com/phrase%1">http://example.com/phrase%1</a>? [R=301,L]
RewriteCond %{query_string} ^\/blog\/.*$ [NC] RewriteRule ^(.*)$ <a href="http://example.com/blog/" title="http://example.com/blog/">http://example.com/blog/</a>? [L,R=301]
This takes the query string, evaluates it, and then redirects to a url and discards the query sting.
if (arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) { $nid = arg(1); }
find ./ -name "*.tar.gz" | xargs -t -n1 tar -zxvf
svn status | grep "^\?" | sed -e 's/? *//' | sed -e 's/ /\\ /g' | xargs svn add
Secure file transfers to and from local or remote systems can be initiated with the SCP UNIX command.
To use the scp command to copy files between systems, use the following command:
scp filename1 userid@hostname:filename2
where filename1 is the file on the local system that you wish to copy, userid@hostname is the userid and hostname where you wish to copy it, and filename2 is the name you want to call the file on the remote system. For example: