public static function edit_entry_ajax()
 {
     $id = FrmAppHelper::get_param('id');
     $entry_id = FrmAppHelper::get_param('entry_id', false);
     $post_id = FrmAppHelper::get_param('post_id', false);
     global $frm_vars;
     $frm_vars['ajax_edit'] = $entry_id ? $entry_id : true;
     $_GET['entry'] = $entry_id;
     if ($post_id and is_numeric($post_id)) {
         global $post;
         if (!$post) {
             $post = get_post($post_id);
         }
     }
     FrmAppHelper::load_scripts(array('formidable'));
     echo "<script type='text/javascript'>\n/*<![CDATA[*/\njQuery(document).ready(function(\$){\n\$('#frm_form_" . $id . "_container .frm-show-form').submit(window.frmOnSubmit);\n});\n/*]]>*/\n</script>";
     echo FrmFormsController::get_form_shortcode(compact('id', 'entry_id'));
     $frm_vars['ajax_edit'] = false;
     //if(!isset($_POST) or (!isset($_POST['action']) and !isset($_POST['frm_action])))
     //    echo FrmProEntriesController::footer_js();
     die;
 }
예제 #2
0
 public static function input_html($field, $echo = true)
 {
     global $frm_settings, $frm_vars;
     $class = '';
     //$field['type'];
     if (is_admin() && (!isset($frm_vars['preview']) || !$frm_vars['preview']) && !in_array($field['type'], array('scale', 'radio', 'checkbox', 'data'))) {
         $class .= 'dyn_default_value';
     }
     $add_html = '';
     if (isset($field['size']) and $field['size'] > 0) {
         if (!in_array($field['type'], array('textarea', 'select', 'data', 'time', 'hidden'))) {
             $add_html .= ' size="' . $field['size'] . '"';
         }
         $class .= " auto_width";
     }
     if (isset($field['max']) && !in_array($field['type'], array('textarea', 'rte', 'hidden')) && !empty($field['max']) && (!is_admin() || !isset($_GET) || !isset($_GET['page']) || $_GET['page'] != 'formidable')) {
         $add_html .= ' maxlength="' . $field['max'] . '"';
     }
     if (!is_admin() or defined('DOING_AJAX') or !isset($_GET) or !isset($_GET['page']) or $_GET['page'] == 'formidable-entries') {
         /*if(isset($field['required']) and $field['required']){
               $action = isset($_REQUEST['frm_action']) ? 'frm_action' : 'action';
               $action = FrmAppHelper::get_param($action);
               
               //if($field['type'] != 'checkbox')
               //    $add_html .= ' required="required"';
                   
               if($field['type'] == 'file' and $action == 'edit'){
                   //don't add the required class if this is a file upload when editing
               }else{
                   $class .= " required";
               }
               unset($action);
           }*/
         if (isset($field['clear_on_focus']) and $field['clear_on_focus'] and !empty($field['default_value'])) {
             if ($frm_settings->use_html and !in_array($field['type'], array('select', 'radio', 'checkbox', 'hidden'))) {
                 $add_html .= ' placeholder="' . esc_attr($field['default_value']) . '"';
                 FrmAppHelper::load_scripts('jquery-placeholder');
             } else {
                 if (!$frm_settings->use_html) {
                     $val = str_replace(array("\r\n", "\n"), '\\r', addslashes(str_replace('&#039;', "'", esc_attr($field['default_value']))));
                     $add_html .= ' onfocus="frmClearDefault(' . "'" . $val . "'" . ',this)" onblur="frmReplaceDefault(' . "'" . $val . "'" . ',this)"';
                     if ($field['value'] == $field['default_value']) {
                         $class .= ' frm_default';
                     }
                 }
             }
         }
     }
     if (isset($field['input_class']) and !empty($field['input_class'])) {
         $class .= ' ' . $field['input_class'];
     }
     $class = apply_filters('frm_field_classes', $class, $field);
     if (!empty($class)) {
         $add_html .= ' class="' . trim($class) . '"';
     }
     if (isset($field['shortcodes']) && !empty($field['shortcodes'])) {
         foreach ($field['shortcodes'] as $k => $v) {
             if ('opt' === $k || !is_numeric($k) && strpos($add_html, " {$k}=")) {
                 continue;
             }
             if (is_numeric($k) && strpos($v, '=')) {
                 $add_html .= ' ' . $v;
             } else {
                 $add_html .= ' ' . $k . '="' . $v . '"';
             }
             unset($k, $v);
         }
     }
     if ($echo) {
         echo $add_html;
     }
     return $add_html;
 }
예제 #3
-1
 public static function footer_js($location = 'footer')
 {
     global $frm_settings, $frm_vars;
     if ($frm_vars['load_css'] and (!is_admin() or defined('DOING_AJAX')) and $frm_settings->load_style != 'none') {
         if (isset($frm_vars['css_loaded']) && $frm_vars['css_loaded']) {
             $css = apply_filters('get_frm_stylesheet', array());
         } else {
             $css = apply_filters('get_frm_stylesheet', array('frm-forms' => FrmAppHelper::plugin_url() . '/css/frm_display.css'));
         }
         if (!empty($css)) {
             echo "\n" . '<script type="text/javascript">';
             foreach ((array) $css as $css_key => $file) {
                 echo 'jQuery("head").append(unescape("%3Clink rel=\'stylesheet\' id=\'' . ($css_key + (isset($frm_vars['css_loaded']) ? $frm_vars['css_loaded'] : false)) . '-css\' href=\'' . $file . '\' type=\'text/css\' media=\'all\' /%3E"));';
                 //wp_enqueue_style($css_key);
                 unset($css_key);
                 unset($file);
             }
             unset($css);
             echo '</script>' . "\n";
         }
     }
     if ((!is_admin() or defined('DOING_AJAX')) and $location != 'header' and !empty($frm_vars['forms_loaded'])) {
         //load formidable js
         FrmAppHelper::load_scripts(array('formidable'));
     }
 }