Exemple #1
0
 /**
  * Get the form value of a single placeholder
  *
  * Static version (element value placeholders will not be replaced)
  *
  * @param string $matches
  * @return string The the form value
  */
 public static function getPlaceholderValue2($matches)
 {
     $original = $matches[0];
     // Process any exact matches
     switch ($original) {
         case '{ip}':
             return iphorm_get_user_ip();
         case '{post_id}':
             return iphorm_get_current_post_id();
         case '{post_title}':
             return iphorm_get_current_post_title();
         case '{url}':
             return iphorm_get_current_url();
         case '{user_display_name}':
             $currentUser = wp_get_current_user();
             if ($currentUser->ID == 0) {
                 return '';
             } else {
                 return $currentUser->display_name;
             }
         case '{user_email}':
             $currentUser = wp_get_current_user();
             if ($currentUser->ID == 0) {
                 return '';
             } else {
                 return $currentUser->user_email;
             }
         case '{user_login}':
             $currentUser = wp_get_current_user();
             if ($currentUser->ID == 0) {
                 return '';
             } else {
                 return $currentUser->user_login;
             }
         case '{referring_url}':
             return isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
         case '{current_date}':
         case '{submit_date}':
             return date_i18n('l, jS F Y');
         case '{current_time}':
         case '{submit_time}':
             return date_i18n('g:i a');
         case '{admin_email}':
             return get_bloginfo('admin_email');
     }
     // Process variable tags
     if (stripos($original, '|') !== false) {
         $stripped = preg_replace('/(^{|}$)/', '', $original);
         $parts = explode('|', $stripped);
         switch ($parts[0]) {
             case 'current_date':
             case 'submit_date':
             case 'current_time':
             case 'submit_time':
                 return date_i18n($parts[1]);
         }
     }
     return $original;
 }
Exemple #2
0
echo $formId;
?>
" <?php 
echo $form->getCss('formInner');
?>
>
            <input type="hidden" name="iphorm_id" value="<?php 
echo esc_attr($formId);
?>
" />
            <input type="hidden" name="iphorm_uid" value="<?php 
echo esc_attr($formUniqueId);
?>
" />
            <input type="hidden" name="form_url" value="<?php 
echo esc_attr(iphorm_get_current_url());
?>
" />
            <input type="hidden" name="referring_url" value="<?php 
echo esc_attr(iphorm_get_http_referer());
?>
" />
            <input type="hidden" name="post_id" value="<?php 
echo esc_attr(iphorm_get_current_post_id());
?>
" />
            <input type="hidden" name="post_title" value="<?php 
echo esc_attr(iphorm_get_current_post_title());
?>
" />
            <?php