Exemple #1
1
    echo isset($action_control->action_options['limit']) ? esc_attr($action_control->action_options['limit']) : '99';
    ?>
" data-actiontype="<?php 
    echo esc_attr($action_control->id_base);
    ?>
"></a></li>
<?php 
    unset($actions_icon);
}
?>
                </ul>
            </div>
            <div class="frm_no_actions">
                <div class="inner_actions">
                    <img src="<?php 
echo FrmAppHelper::plugin_url() . '/images/sketch_arrow1.png';
?>
" alt=""/>
                    <div class="clear"></div>
                    <?php 
_e('Click an action to add it to this form', 'formidable');
?>
                </div>
            </div>
            <?php 
FrmFormActionsController::list_actions($form, $values);
?>
        </div>

        <div id="html_settings" class="tabs-panel <?php 
echo $a == 'html_settings' ? ' frm_block' : ' frm_hidden';
 public static function jquery_css_url($theme_css)
 {
     if ($theme_css == -1) {
         return;
     }
     $uploads = wp_upload_dir();
     if (!$theme_css or $theme_css == '' or $theme_css == 'ui-lightness') {
         $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css';
     } else {
         if (preg_match('/^http.?:\\/\\/.*\\..*$/', $theme_css)) {
             $css_file = $theme_css;
         } else {
             $file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css';
             if (file_exists($uploads['basedir'] . $file_path)) {
                 if (is_ssl() and !preg_match('/^https:\\/\\/.*\\..*$/', $uploads['baseurl'])) {
                     $uploads['baseurl'] = str_replace('http://', 'https://', $uploads['baseurl']);
                 }
                 $css_file = $uploads['baseurl'] . $file_path;
             } else {
                 $css_file = 'http' . (is_ssl() ? 's' : '') . '://ajax.googleapis.com/ajax/libs/jqueryui/1.7.3/themes/' . $theme_css . '/jquery-ui.css';
             }
         }
     }
     return $css_file;
 }
 /**
  * @covers FrmAppController::load_wp_admin_style
  */
 public function test_load_wp_admin_style()
 {
     $this->set_admin_screen();
     ob_start();
     do_action('admin_enqueue_scripts');
     do_action('admin_print_styles');
     $styles = ob_get_contents();
     ob_end_clean();
     $this->assertNotEmpty($styles);
     $this->assertTrue(strpos($styles, FrmAppHelper::plugin_url() . '/css/frm_fonts.css') !== false, 'The frm_fonts stylesheet is missing');
 }
 public static function jquery_css_url($theme_css)
 {
     if ($theme_css == -1) {
         return;
     }
     if (!$theme_css || $theme_css == '' || $theme_css == 'ui-lightness') {
         $css_file = FrmAppHelper::plugin_url() . '/css/ui-lightness/jquery-ui.css';
     } else {
         if (preg_match('/^http.?:\\/\\/.*\\..*$/', $theme_css)) {
             $css_file = $theme_css;
         } else {
             $uploads = self::get_upload_base();
             $file_path = '/formidable/css/' . $theme_css . '/jquery-ui.css';
             if (file_exists($uploads['basedir'] . $file_path)) {
                 $css_file = $uploads['baseurl'] . $file_path;
             } else {
                 $css_file = FrmAppHelper::jquery_ui_base_url() . '/themes/' . $theme_css . '/jquery-ui.min.css';
             }
         }
     }
     return $css_file;
 }
 /**
  * @covers FrmAppHelper::plugin_url
  */
 function test_plugin_url()
 {
     $url = FrmAppHelper::plugin_url();
     $this->assertNotEmpty($url);
 }
 public static function show_form_button($id)
 {
     if ($id != 'content') {
         return;
     }
     echo '<a href="#TB_inline?width=450&height=550&inlineId=frm_insert_form" class="thickbox" title="' . __("Add Formidable Form", 'formidable') . '"><img src="' . esc_url(FrmAppHelper::plugin_url() . '/images/form_16.png') . '" alt="' . __("Add Formidable Form", 'formidable') . '" /></a>';
 }
 public static function front_head()
 {
     $version = FrmAppHelper::plugin_version();
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_register_script('formidable', FrmAppHelper::plugin_url() . "/js/formidable{$suffix}.js", array('jquery'), $version, true);
     wp_register_script('jquery-placeholder', FrmAppHelper::plugin_url() . '/js/jquery/jquery.placeholder.js', array('jquery'), '2.0.7', true);
     if (FrmAppHelper::is_admin()) {
         // don't load this in back-end
         return;
     }
     FrmAppHelper::localize_script('front');
     FrmStylesController::enqueue_css('register');
 }
<div class="wrap upgrade_to_pro">
	<h1 class="frm_pro_heading">
		<img src="<?php 
echo esc_url(FrmAppHelper::plugin_url());
?>
/images/logo.png" alt="Upgrade to Pro" />
		<span class="alignright">Save time and make life easier. Upgrade to Pro.</span>
		<span class="clear"></span>
	</h1>

	<div class="clear"></div>

	<p>Enhance your basic Formidable forms with a plethora of Pro field types and features. Create advanced forms and data-driven applications in no time at all.</p>
	<p>Are you collecting data offline? Streamline your business by using your forms to get online. Whether you need surveys, polls, client contracts, mortgage calculators, or directories, we've got you covered. Save time by allowing clients to return and make changes to their own submissions, or let them contribute content to your site. Generate more leads by adding headings and page breaks, only showing the fields you need, and letting your clients repeat a section of fields as many times as they need.</p>
	<p>Projects that once seemed impossible are within your reach with Pro. That project you’ve been dreaming of pursuing? Chances are <strong>Formidable Pro can handle it</strong>.</p><br/>

	<table class="wp-list-table widefat fixed striped frm_pricing">
		<thead>
			<tr>
				<th></th>
			<?php 
foreach ($pro_pricing as $price_info) {
    ?>
				<th>
					<h3><?php 
    echo esc_attr(ucfirst($price_info['name']));
    ?>
</h3>
					<h4>$<?php 
    echo esc_attr($price_info['price']);
    ?>
 public static function replace_shortcodes($content, $entry, $shortcodes, $display = false, $show = 'one', $odd = '', $args = array())
 {
     global $frm_field, $frm_entry_meta, $post, $frmpro_settings;
     if ($display) {
         $param_value = $display->frm_type == 'id' ? $entry->id : $entry->item_key;
         if ($entry->post_id) {
             $detail_link = get_permalink($entry->post_id);
         } else {
             $param = isset($display->frm_param) && !empty($display->frm_param) ? $display->frm_param : 'entry';
             if ($post) {
                 $detail_link = add_query_arg($param, $param_value, get_permalink($post->ID));
             } else {
                 $detail_link = add_query_arg($param, $param_value);
             }
             //if( FrmProAppHelper::rewriting_on() && $frmpro_settings->permalinks )
             //    $detail_link = get_permalink($post->ID) .$param_value .'/';
         }
     }
     foreach ($shortcodes[0] as $short_key => $tag) {
         $conditional = preg_match('/^\\[if/s', $shortcodes[0][$short_key]) ? true : false;
         $atts = shortcode_parse_atts($shortcodes[3][$short_key]);
         if (!empty($shortcodes[3][$short_key])) {
             $tag = str_replace($conditional ? '[if ' : '[', '', $shortcodes[0][$short_key]);
             $tag = str_replace(']', '', $tag);
             $tags = explode(' ', $tag);
             if (is_array($tags)) {
                 $tag = $tags[0];
             }
         } else {
             $tag = $shortcodes[2][$short_key];
         }
         switch ($tag) {
             case 'entry_count':
                 $content = str_replace($shortcodes[0][$short_key], isset($args['record_count']) ? $args['record_count'] : '', $content);
                 break;
             case 'detaillink':
                 if ($display and $detail_link) {
                     $content = str_replace($shortcodes[0][$short_key], $detail_link, $content);
                 }
                 break;
             case 'id':
                 $content = str_replace($shortcodes[0][$short_key], $entry->id, $content);
                 break;
             case 'post-id':
             case 'post_id':
                 $content = str_replace($shortcodes[0][$short_key], $entry->post_id, $content);
                 break;
             case 'key':
                 $content = str_replace($shortcodes[0][$short_key], $entry->item_key, $content);
                 break;
             case 'ip':
                 $content = str_replace($shortcodes[0][$short_key], $entry->ip, $content);
                 break;
             case 'user_agent':
             case 'user-agent':
                 $entry->description = maybe_unserialize($entry->description);
                 $content = str_replace($shortcodes[0][$short_key], $entry->description['browser'], $content);
                 break;
             case 'created_at':
             case 'created-at':
             case 'updated_at':
             case 'updated-at':
                 if (!isset($atts['format'])) {
                     $atts['format'] = get_option('date_format');
                     $time_format = false;
                 } else {
                     $time_format = ' ';
                 }
                 $this_tag = str_replace('-', '_', $tag);
                 if ($conditional) {
                     $atts['short_key'] = $shortcodes[0][$short_key];
                     $content = self::check_conditional_shortcode($content, $entry->{$this_tag}, $atts, $tag);
                 } else {
                     if (isset($atts['time_ago'])) {
                         $date = FrmProAppHelper::human_time_diff(strtotime($entry->{$this_tag}));
                     } else {
                         $date = FrmProAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format);
                     }
                     $content = str_replace($shortcodes[0][$short_key], $date, $content);
                 }
                 unset($this_tag);
                 break;
             case 'created_by':
             case 'created-by':
             case 'updated_by':
             case 'updated-by':
                 $this_tag = str_replace('-', '_', $tag);
                 $replace_with = self::get_display_value($entry->{$this_tag}, (object) array('type' => 'user_id'), $atts);
                 if ($conditional) {
                     $atts['short_key'] = $shortcodes[0][$short_key];
                     $content = self::check_conditional_shortcode($content, $entry->{$this_tag}, $atts, $tag);
                 } else {
                     $content = str_replace($shortcodes[0][$short_key], $replace_with, $content);
                 }
                 unset($this_tag);
                 unset($replace_with);
                 break;
             case 'evenodd':
                 $content = str_replace($shortcodes[0][$short_key], $odd, $content);
                 break;
             case 'siteurl':
                 $content = str_replace($shortcodes[0][$short_key], FrmAppHelper::site_url(), $content);
                 break;
             case 'frmurl':
                 $content = str_replace($shortcodes[0][$short_key], FrmAppHelper::plugin_url(), $content);
                 break;
             case 'sitename':
                 $content = str_replace($shortcodes[0][$short_key], get_option('blogname'), $content);
                 break;
             case 'get':
                 if (isset($atts['param'])) {
                     $param = $atts['param'];
                     $replace_with = FrmAppHelper::get_param($param);
                     if (is_array($replace_with)) {
                         $replace_with = implode(', ', $replace_with);
                     }
                     $content = str_replace($shortcodes[0][$short_key], $replace_with, $content);
                     unset($param);
                     unset($replace_with);
                 }
                 break;
             default:
                 if ($tag == 'deletelink') {
                     $page_id = isset($atts['page_id']) ? $atts['page_id'] : ($post ? $post->ID : 0);
                     if (!isset($atts['label'])) {
                         $atts['label'] = false;
                     }
                     $delete_atts = $atts;
                     $delete_atts['id'] = $entry->id;
                     $delete_atts['page_id'] = $page_id;
                     $replace_with = FrmProEntriesController::entry_delete_link($delete_atts);
                     unset($delete_atts);
                     $field = false;
                 } else {
                     if ($tag == 'editlink') {
                         $replace_with = '';
                         $link_text = isset($atts['label']) ? $atts['label'] : false;
                         if (!$link_text) {
                             $link_text = isset($atts['link_text']) ? $atts['link_text'] : __('Edit');
                         }
                         $class = isset($atts['class']) ? $atts['class'] : '';
                         $page_id = isset($atts['page_id']) ? $atts['page_id'] : ($post ? $post->ID : 0);
                         if (isset($atts['location']) && $atts['location'] == 'front' || isset($atts['prefix']) && !empty($atts['prefix']) || isset($atts['page_id']) && !empty($atts['page_id'])) {
                             $edit_atts = $atts;
                             $edit_atts['id'] = $entry->id;
                             $delete_atts['page_id'] = $page_id;
                             $replace_with = FrmProEntriesController::entry_edit_link($edit_atts);
                         } else {
                             if ($entry->post_id) {
                                 $replace_with = get_edit_post_link($entry->post_id);
                             } else {
                                 if (current_user_can('frm_edit_entries')) {
                                     $replace_with = esc_url(admin_url('admin.php?page=formidable-entries&frm_action=edit&id=' . $entry->id));
                                 }
                             }
                             if (!empty($replace_with)) {
                                 $replace_with = '<a href="' . $replace_with . '" class="frm_edit_link ' . $class . '">' . $link_text . '</a>';
                             }
                         }
                         unset($class);
                     } else {
                         $field = $frm_field->getOne($tag);
                     }
                 }
                 $sep = isset($atts['sep']) ? $atts['sep'] : ', ';
                 if (!isset($field)) {
                     $field = false;
                 }
                 if ($field) {
                     $replace_with = FrmProEntryMetaHelper::get_post_or_meta_value($entry, $field, $atts);
                     $atts['entry_id'] = $entry->id;
                     $atts['entry_key'] = $entry->item_key;
                     $atts['post_id'] = $entry->post_id;
                     $replace_with = apply_filters('frmpro_fields_replace_shortcodes', $replace_with, $tag, $atts, $field);
                 }
                 if ($field and $field->type == 'file') {
                     //size options are thumbnail, medium, large, or full, label
                     $size = isset($atts['size']) ? $atts['size'] : (isset($atts['show']) ? $atts['show'] : 'thumbnail');
                     $inc_html = (isset($atts['html']) and $atts['html']) ? true : false;
                     $inc_links = (isset($atts['links']) and $atts['links']) ? true : false;
                     $sep = isset($atts['sep']) ? $atts['sep'] : ' ';
                     $show_filename = (isset($atts['show_filename']) and $atts['show_filename']) ? true : false;
                     if ($size != 'id' && !empty($replace_with)) {
                         $replace_with = FrmProFieldsHelper::get_media_from_id($replace_with, $size, array('html' => $inc_html, 'links' => $inc_links, 'show_filename' => $show_filename));
                     } else {
                         if (is_array($replace_with)) {
                             $replace_with = array_filter($replace_with);
                         }
                     }
                     unset($size);
                 }
                 if (isset($replace_with) and is_array($replace_with)) {
                     $replace_with = implode($sep, $replace_with);
                 }
                 if ($conditional) {
                     if (!isset($replace_with)) {
                         $replace_with = '';
                     }
                     $replace_with = apply_filters('frm_conditional_value', $replace_with, $atts, $field, $tag);
                     $start_pos = strpos($content, $shortcodes[0][$short_key]);
                     if ($start_pos !== false) {
                         $start_pos_len = strlen($shortcodes[0][$short_key]);
                         $end_pos = strpos($content, '[/if ' . $tag . ']', $start_pos);
                         $end_pos_len = strlen('[/if ' . $tag . ']');
                         if ($end_pos !== false) {
                             if (empty($replace_with)) {
                                 $total_len = $end_pos + $end_pos_len - $start_pos;
                                 $content = substr_replace($content, '', $start_pos, $total_len);
                             } else {
                                 $content = substr_replace($content, '', $end_pos, $end_pos_len);
                                 $content = substr_replace($content, '', $start_pos, $start_pos_len);
                             }
                         }
                     }
                 } else {
                     if ($field) {
                         if (isset($atts['show']) and $atts['show'] == 'field_label') {
                             $replace_with = $field->name;
                         } else {
                             if (isset($atts['show']) and $atts['show'] == 'description') {
                                 $replace_with = $field->description;
                             } else {
                                 if (empty($replace_with) and $replace_with != '0') {
                                     $replace_with = '';
                                     if ($field->type == 'number') {
                                         $replace_with = '0';
                                     }
                                 } else {
                                     $replace_with = FrmProFieldsHelper::get_display_value($replace_with, $field, $atts);
                                 }
                             }
                         }
                     }
                     if (isset($atts['sanitize'])) {
                         $replace_with = sanitize_title_with_dashes($replace_with);
                     }
                     if (isset($atts['sanitize_url'])) {
                         if (seems_utf8($replace_with)) {
                             $replace_with = utf8_uri_encode($replace_with, 200);
                         }
                         $replace_with = urlencode(htmlentities($replace_with));
                     }
                     if (isset($atts['truncate'])) {
                         if (isset($atts['more_text'])) {
                             $more_link_text = $atts['more_text'];
                         } else {
                             $more_link_text = isset($atts['more_link_text']) ? $atts['more_link_text'] : '. . .';
                         }
                         if ($display and $display->frm_show_count == 'dynamic') {
                             $more_link_text = ' <a href="' . $detail_link . '">' . $more_link_text . '</a>';
                             $replace_with = FrmAppHelper::truncate($replace_with, (int) $atts['truncate'], 3, $more_link_text);
                         } else {
                             $replace_with = wp_specialchars_decode(strip_tags($replace_with), ENT_QUOTES);
                             $part_one = substr($replace_with, 0, (int) $atts['truncate']);
                             $part_two = substr($replace_with, (int) $atts['truncate']);
                             if (!empty($part_two)) {
                                 $replace_with = $part_one . '<a href="#" onclick="jQuery(this).next().css(\'display\', \'inline\');jQuery(this).css(\'display\', \'none\');return false;" class="frm_text_exposed_show"> ' . $more_link_text . '</a><span style="display:none;">' . $part_two . '</span>';
                             }
                         }
                     }
                     if (isset($atts['clickable'])) {
                         $replace_with = make_clickable($replace_with);
                     }
                     if (!isset($replace_with)) {
                         $replace_with = '';
                     }
                     $content = str_replace($shortcodes[0][$short_key], $replace_with, $content);
                 }
                 unset($replace_with);
                 if (isset($field)) {
                     unset($field);
                 }
         }
         unset($atts);
         unset($conditional);
     }
     return $content;
 }
 public static function render_meta_box_content($post)
 {
     global $frm_vars;
     $count = isset($frm_vars['post_forms']) ? count($frm_vars['post_forms']) : 0;
     $i = 1;
     echo '<p>';
     foreach ((array) $frm_vars['post_forms'] as $form) {
         if ($i != 1) {
             echo ' | ';
         }
         $i++;
         echo '<a href="javascript:frm_create_post_entry(' . $form->id . ',' . $post->ID . ')">' . FrmAppHelper::truncate($form->name, 15) . '</a>';
         unset($form);
     }
     unset($i);
     echo '</p>';
     echo "<script type='text/javascript'>function frm_create_post_entry(id,post_id){\njQuery('#frm_create_entry p').replaceWith('<img src=\"" . FrmAppHelper::plugin_url() . "/images/wpspin_light.gif\" alt=\"" . __('Loading&hellip;') . "\" />');\njQuery.ajax({type:'POST',url:'" . admin_url('admin-ajax.php') . "',data:'action=frm_create_post_entry&id='+id+'&post_id='+post_id,\nsuccess:function(msg){jQuery('#frm_create_entry').fadeOut('slow');}\n});\n};</script>";
 }
Exemple #11
0
 public static function replace_shortcodes($html, $form, $title = false, $description = false, $values = array())
 {
     foreach (array('form_name' => $title, 'form_description' => $description, 'entry_key' => true) as $code => $show) {
         if ($code == 'form_name') {
             $replace_with = $form->name;
         } else {
             if ($code == 'form_description') {
                 if (apply_filters('frm_use_wpautop', true)) {
                     $replace_with = wpautop(str_replace('<br>', '<br />', $form->description));
                 } else {
                     $replace_with = $form->description;
                 }
             } else {
                 if ($code == 'entry_key' and isset($_GET) and isset($_GET['entry'])) {
                     $replace_with = $_GET['entry'];
                 }
             }
         }
         if (FrmAppHelper::is_true($show) && $replace_with != '') {
             $html = str_replace('[if ' . $code . ']', '', $html);
             $html = str_replace('[/if ' . $code . ']', '', $html);
         } else {
             $html = preg_replace('/(\\[if\\s+' . $code . '\\])(.*?)(\\[\\/if\\s+' . $code . '\\])/mis', '', $html);
         }
         $html = str_replace('[' . $code . ']', $replace_with, $html);
     }
     //replace [form_key]
     $html = str_replace('[form_key]', $form->form_key, $html);
     //replace [frmurl]
     $html = str_replace('[frmurl]', FrmAppHelper::plugin_url(), $html);
     if (strpos($html, '[button_label]')) {
         $replace_with = apply_filters('frm_submit_button', $title, $form);
         $html = str_replace('[button_label]', $replace_with, $html);
     }
     $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values);
     if (strpos($html, '[if back_button]')) {
         $html = preg_replace('/(\\[if\\s+back_button\\])(.*?)(\\[\\/if\\s+back_button\\])/mis', '', $html);
     }
     if (strpos($html, '[if save_draft]')) {
         $html = preg_replace('/(\\[if\\s+save_draft\\])(.*?)(\\[\\/if\\s+save_draft\\])/mis', '', $html);
     }
     return $html;
 }
 /**
  * Get the value to replace a few standard shortcodes
  *
  * @since 2.0
  * @return string
  */
 public static function dynamic_default_values($tag, $atts = array(), $return_array = false)
 {
     $new_value = '';
     switch ($tag) {
         case 'admin_email':
             $new_value = get_option('admin_email');
             break;
         case 'siteurl':
             $new_value = FrmAppHelper::site_url();
             break;
         case 'frmurl':
             $new_value = FrmAppHelper::plugin_url();
             break;
         case 'sitename':
             $new_value = FrmAppHelper::site_name();
             break;
         case 'get':
             $new_value = self::process_get_shortcode($atts, $return_array);
             break;
     }
     return $new_value;
 }
 public static function admin_js()
 {
     $version = FrmAppHelper::plugin_version();
     FrmAppHelper::load_admin_wide_js(false);
     wp_register_script('formidable_admin', FrmAppHelper::plugin_url() . '/js/formidable_admin.js', array('formidable_admin_global', 'formidable', 'jquery', 'jquery-ui-core', 'jquery-ui-draggable', 'jquery-ui-sortable', 'bootstrap_tooltip', 'bootstrap-multiselect'), $version, true);
     wp_register_style('formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css', array(), $version);
     wp_register_script('bootstrap_tooltip', FrmAppHelper::plugin_url() . '/js/bootstrap.min.js', array('jquery'), '3.3.4');
     // load multselect js
     wp_register_script('bootstrap-multiselect', FrmAppHelper::plugin_url() . '/js/bootstrap-multiselect.js', array('jquery', 'bootstrap_tooltip'), '0.9.8', true);
     $page = FrmAppHelper::simple_get('page', 'sanitize_title');
     $post_type = FrmAppHelper::simple_get('post_type', 'sanitize_title');
     global $pagenow;
     if (strpos($page, 'formidable') === 0 || $pagenow == 'edit.php' && $post_type == 'frm_display') {
         wp_enqueue_script('admin-widgets');
         wp_enqueue_style('widgets');
         wp_enqueue_script('formidable');
         wp_enqueue_script('formidable_admin');
         FrmAppHelper::localize_script('admin');
         wp_enqueue_style('formidable-admin');
         add_thickbox();
         wp_register_script('formidable-editinplace', FrmAppHelper::plugin_url() . '/js/jquery/jquery.editinplace.packed.js', array('jquery'), '2.3.0');
     } else {
         if ($pagenow == 'post.php' || $pagenow == 'post-new.php' && $post_type == 'frm_display') {
             if (isset($_REQUEST['post_type'])) {
                 $post_type = sanitize_title($_REQUEST['post_type']);
             } else {
                 if (isset($_REQUEST['post']) && absint($_REQUEST['post'])) {
                     $post = get_post(absint($_REQUEST['post']));
                     if (!$post) {
                         return;
                     }
                     $post_type = $post->post_type;
                 } else {
                     return;
                 }
             }
             if ($post_type == 'frm_display') {
                 wp_enqueue_script('jquery-ui-draggable');
                 wp_enqueue_script('formidable_admin');
                 wp_enqueue_style('formidable-admin');
                 FrmAppHelper::localize_script('admin');
             }
         } else {
             if ($pagenow == 'widgets.php') {
                 FrmAppHelper::load_admin_wide_js();
             }
         }
     }
 }
 /**
  * Load the JS file on non-Formidable pages in the admin area
  * @since 2.0
  */
 public static function load_admin_wide_js($load = true)
 {
     $version = FrmAppHelper::plugin_version();
     wp_register_script('formidable_admin_global', FrmAppHelper::plugin_url() . '/js/formidable_admin_global.js', array('jquery'), $version);
     wp_localize_script('formidable_admin_global', 'frmGlobal', array('updating_msg' => __('Please wait while your site updates.', 'formidable'), 'deauthorize' => __('Are you sure you want to deauthorize Formidable Forms on this site?', 'formidable'), 'url' => FrmAppHelper::plugin_url(), 'loading' => __('Loading&hellip;'), 'nonce' => wp_create_nonce('frm_ajax')));
     if ($load) {
         wp_enqueue_script('formidable_admin_global');
     }
 }
Exemple #15
0
}
?>
			</select>
			<input type="button" id="frm_create_template_button" class="button-secondary" value="<?php 
esc_attr_e('Load Template', 'formidable');
?>
" />
		</p>

    	<div class="alignleft sketch3">
	        <div class="alignright"><?php 
_e('3. Save your form', 'formidable');
?>
</div>
			<img src="<?php 
echo esc_url(FrmAppHelper::plugin_url() . '/images/sketch_arrow3.png');
?>
" alt="" />
	    </div>
    	<div class="clear"></div>
    </div>
<ul id="new_fields" class="frm_sorting inside">
<?php 
if (isset($values['fields']) && !empty($values['fields'])) {
    $count = 0;
    foreach ($values['fields'] as $field) {
        $count++;
        $field_name = 'item_meta[' . $field['id'] . ']';
        $html_id = FrmFieldsHelper::get_html_id($field);
        require FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php';
        unset($field, $field_name);
 public static function custom_css($message = '', $style = null)
 {
     wp_enqueue_style('codemirror', FrmAppHelper::plugin_url() . '/css/codemirror.css');
     wp_enqueue_script('codemirror', FrmAppHelper::plugin_url() . '/js/codemirror/codemirror.js', array(), '4.7');
     wp_enqueue_script('codemirror-css', FrmAppHelper::plugin_url() . '/js/codemirror/css.js', array('codemirror'), '4.7');
     if (!isset($style)) {
         $frm_style = new FrmStyle();
         $style = $frm_style->get_default_style();
     }
     include FrmAppHelper::plugin_path() . '/classes/views/styles/custom_css.php';
 }
 public static function import_choices()
 {
     if (!current_user_can('frm_edit_forms')) {
         wp_die();
     }
     $field_id = absint($_REQUEST['field_id']);
     global $current_screen, $hook_suffix;
     // Catch plugins that include admin-header.php before admin.php completes.
     if (empty($current_screen) && function_exists('set_current_screen')) {
         $hook_suffix = '';
         set_current_screen();
     }
     if (function_exists('register_admin_color_schemes')) {
         register_admin_color_schemes();
     }
     $hook_suffix = $admin_body_class = '';
     if (get_user_setting('mfold') == 'f') {
         $admin_body_class .= ' folded';
     }
     if (function_exists('is_admin_bar_showing') && is_admin_bar_showing()) {
         $admin_body_class .= ' admin-bar';
     }
     if (is_rtl()) {
         $admin_body_class .= ' rtl';
     }
     $admin_body_class .= ' admin-color-' . sanitize_html_class(get_user_option('admin_color'), 'fresh');
     $prepop = array();
     FrmFieldsHelper::get_bulk_prefilled_opts($prepop);
     $field = FrmField::getOne($field_id);
     wp_enqueue_script('utils');
     wp_enqueue_style('formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css');
     FrmAppHelper::load_admin_wide_js();
     include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php';
     wp_die();
 }
Exemple #18
0
    private function migrate_to_11()
    {
        global $wpdb;
        $forms = FrmDb::get_results($this->forms, array(), 'id, options');
        $sending = __('Sending', 'formidable');
        $img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
        $old_default_html = <<<DEFAULT_HTML
<div class="frm_submit">
[if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
<input type="submit" value="[button_label]" [button_action] />
<img class="frm_ajax_loading" src="{$img}" alt="{$sending}" style="visibility:hidden;" />
</div>
DEFAULT_HTML;
        unset($sending, $img);
        $new_default_html = FrmFormsHelper::get_default_html('submit');
        $draft_link = FrmFormsHelper::get_draft_link();
        foreach ($forms as $form) {
            $form->options = maybe_unserialize($form->options);
            if (!isset($form->options['submit_html']) || empty($form->options['submit_html'])) {
                continue;
            }
            if ($form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html) {
                $form->options['submit_html'] = $new_default_html;
                $wpdb->update($this->forms, array('options' => serialize($form->options)), array('id' => $form->id));
            } else {
                if (!strpos($form->options['submit_html'], 'save_draft')) {
                    $form->options['submit_html'] = preg_replace('~\\<\\/div\\>(?!.*\\<\\/div\\>)~', $draft_link . "\r\n</div>", $form->options['submit_html']);
                    $wpdb->update($this->forms, array('options' => serialize($form->options)), array('id' => $form->id));
                }
            }
            unset($form);
        }
        unset($forms);
    }
Exemple #19
0
                }
                ?>
    </div>
<?php 
            } else {
                if ($field['type'] == 'captcha') {
                    if (empty($frm_settings->pubkey)) {
                        ?>
    <div class="howto frm_no_captcha_text"><?php 
                        printf(__('Your captcha will not appear on your form until you %1$sset up%2$s the Site and Private Keys', 'formidable'), '<a href="?page=formidable-settings">', '</a>');
                        ?>
</div>
    <?php 
                    }
                    ?>
	<img src="<?php 
                    echo esc_url(FrmAppHelper::plugin_url() . '/images/recaptcha.png');
                    ?>
" class="recaptcha_placeholder" alt="reCaptcha"/>
    <input type="hidden" name="<?php 
                    echo esc_attr($field_name);
                    ?>
" value="1" />
<?php 
                } else {
                    do_action('frm_display_added_fields', $field);
                }
            }
        }
    }
}
.with_frm_style .chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0;}
.with_frm_style .chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl;}
.with_frm_style .chosen-rtl .chosen-single-with-deselect span{margin-left:38px;}
.with_frm_style .chosen-rtl .chosen-single div{right:auto;left:3px;}
.with_frm_style .chosen-rtl .chosen-single abbr{right:auto;left:26px;}
.with_frm_style .chosen-rtl .chosen-choices li{float:right;}
.with_frm_style .chosen-rtl .chosen-choices li.search-field input[type="text"]{direction:rtl;}
.with_frm_style .chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px;}
.with_frm_style .chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px;}
.with_frm_style .chosen-rtl.chosen-container-single-nosearch .chosen-search, .with_frm_style .chosen-rtl .chosen-drop{left:9999px;}
.with_frm_style .chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0;}
.with_frm_style .chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0;}
.with_frm_style .chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none;}
.with_frm_style .chosen-rtl .chosen-search input[type="text"]{padding:4px 5px 4px 20px;background:white url('<?php 
echo FrmAppHelper::plugin_url();
?>
/pro/images/chosen-sprite.png') no-repeat -30px -20px;background:url('<?php 
echo FrmAppHelper::plugin_url();
?>
/pro/images/chosen-sprite.png') no-repeat -30px -20px;direction:rtl;}
.with_frm_style .chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px;}
.with_frm_style .chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px;}

@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi){
.with_frm_style .chosen-rtl .chosen-search input[type="text"], .with_frm_style .chosen-container-single .chosen-single abbr, .with_frm_style .chosen-container-single .chosen-single div b, .with_frm_style .chosen-container-single .chosen-search input[type="text"], .with_frm_style .chosen-container-multi .chosen-choices .search-choice .search-choice-close, .with_frm_style .chosen-container .chosen-results-scroll-down span, .with_frm_style .chosen-container .chosen-results-scroll-up span{background-image:url('<?php 
echo FrmAppHelper::plugin_url();
?>
/pro/images/chosen-sprite2x.png') !important;background-size:52px 37px !important;background-repeat:no-repeat !important;}
}
<?php 
echo $custom_css;
Exemple #21
-1
    function upgrade($old_db_version = false)
    {
        global $wpdb;
        //$frm_db_version is the version of the database we're moving to
        $frm_db_version = FrmAppHelper::$db_version;
        $old_db_version = (double) $old_db_version;
        if (!$old_db_version) {
            $old_db_version = get_option('frm_db_version');
        }
        if ($frm_db_version != $old_db_version) {
            require_once ABSPATH . 'wp-admin/includes/upgrade.php';
            $charset_collate = '';
            if ($wpdb->has_cap('collation')) {
                if (!empty($wpdb->charset)) {
                    $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
                }
                if (!empty($wpdb->collate)) {
                    $charset_collate .= " COLLATE {$wpdb->collate}";
                }
            }
            /* Create/Upgrade Fields Table */
            $sql = "CREATE TABLE {$this->fields} (\n                id int(11) NOT NULL auto_increment,\n                field_key varchar(255) default NULL,\n                name text default NULL,\n                description text default NULL,\n                type text default NULL,\n                default_value longtext default NULL,\n                options longtext default NULL,\n                field_order int(11) default 0,\n                required int(1) default NULL,\n                field_options longtext default NULL,\n                form_id int(11) default NULL,\n                created_at datetime NOT NULL,\n                PRIMARY KEY  (id),\n                KEY form_id (form_id),\n                UNIQUE KEY field_key (field_key)\n              ) {$charset_collate};";
            dbDelta($sql);
            /* Create/Upgrade Forms Table */
            $sql = "CREATE TABLE {$this->forms} (\n                id int(11) NOT NULL auto_increment,\n                form_key varchar(255) default NULL,\n                name varchar(255) default NULL,\n                description text default NULL,\n                parent_form_id int(11) default NULL,\n                logged_in tinyint(1) default NULL,\n                editable tinyint(1) default NULL,\n                is_template tinyint(1) default 0,\n                default_template tinyint(1) default 0,\n                status varchar(255) default NULL,\n                prli_link_id int(11) default NULL,\n                options longtext default NULL,\n                created_at datetime NOT NULL,\n                PRIMARY KEY  (id),\n                UNIQUE KEY form_key (form_key)\n              ) {$charset_collate};";
            dbDelta($sql);
            /* Create/Upgrade Items Table */
            $sql = "CREATE TABLE {$this->entries} (\n                id int(11) NOT NULL auto_increment,\n                item_key varchar(255) default NULL,\n                name varchar(255) default NULL,\n                description text default NULL,\n                ip text default NULL,\n                form_id int(11) default NULL,\n                post_id int(11) default NULL,\n                user_id int(11) default NULL,\n                parent_item_id int(11) default NULL,\n                is_draft tinyint(1) default 0,\n                updated_by int(11) default NULL,\n                created_at datetime NOT NULL,\n                updated_at datetime NOT NULL,\n                PRIMARY KEY  (id),\n                KEY form_id (form_id),\n                KEY post_id (post_id),\n                KEY user_id (user_id),\n                KEY parent_item_id (parent_item_id),\n                UNIQUE KEY item_key (item_key)\n              ) {$charset_collate};";
            dbDelta($sql);
            /* Create/Upgrade Meta Table */
            $sql = "CREATE TABLE {$this->entry_metas} (\n                id int(11) NOT NULL auto_increment,\n                meta_value longtext default NULL,\n                field_id int(11) NOT NULL,\n                item_id int(11) NOT NULL,\n                created_at datetime NOT NULL,\n                PRIMARY KEY  (id),\n                KEY field_id (field_id),\n                KEY item_id (item_id)\n              ) {$charset_collate};";
            dbDelta($sql);
            /**** MIGRATE DATA ****/
            if ($frm_db_version >= 1.03 and $old_db_version < 1.03) {
                global $frm_entry;
                $all_entries = $frm_entry->getAll();
                foreach ($all_entries as $ent) {
                    $opts = maybe_unserialize($ent->description);
                    if (is_array($opts) and in_array($opts['ip'])) {
                        $wpdb->update($this->entries, array('ip' => $opts['ip']), array('id' => $ent->id));
                    }
                }
            }
            if ($frm_db_version >= 4 and $old_db_version < 4) {
                global $frm_entry_meta;
                $user_ids = $frm_entry_meta->getAll("fi.type='user_id'");
                foreach ($user_ids as $user_id) {
                    $wpdb->update($this->entries, array('user_id' => $user_id->meta_value), array('id' => $user_id->item_id));
                }
            }
            if ($frm_db_version >= 6 and $old_db_version < 6) {
                $fields = $wpdb->get_results("SELECT id, field_options FROM {$this->fields} WHERE type not in ('hidden', 'user_id', 'break', 'divider', 'html', 'captcha', 'form')");
                $default_html = <<<DEFAULT_HTML
<div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
    <label class="frm_pos_[label_position]">[field_name]
        <span class="frm_required">[required_label]</span>
    </label>
    [input]
    [if description]<div class="frm_description">[description]</div>[/if description]
</div>
DEFAULT_HTML;
                $old_default_html = <<<DEFAULT_HTML
<div id="frm_field_[id]_container" class="form-field [required_class] [error_class]">
    <label class="frm_pos_[label_position]">[field_name]
        <span class="frm_required">[required_label]</span>
    </label>
    [input]
    [if description]<p class="frm_description">[description]</p>[/if description]
</div>
DEFAULT_HTML;
                $new_default_html = FrmFieldsHelper::get_default_html('text');
                foreach ($fields as $field) {
                    $field->field_options = maybe_unserialize($field->field_options);
                    if (!isset($field->field_options['custom_html']) || empty($field->field_options['custom_html']) || $field->field_options['custom_html'] == $default_html || $field->field_options['custom_html'] == $old_default_html) {
                        $field->field_options['custom_html'] = $new_default_html;
                        $wpdb->update($this->fields, array('field_options' => maybe_serialize($field->field_options)), array('id' => $field->id));
                    }
                    unset($field);
                }
                unset($default_html);
                unset($old_default_html);
                unset($fields);
            }
            if ($frm_db_version >= 11 and $old_db_version < 11) {
                $forms = $wpdb->get_results("SELECT id, options FROM {$this->forms}");
                $sending = __('Sending', 'formidable');
                $img = FrmAppHelper::plugin_url() . '/images/ajax_loader.gif';
                $old_default_html = <<<DEFAULT_HTML
<div class="frm_submit">
[if back_button]<input type="submit" value="[back_label]" name="frm_prev_page" formnovalidate="formnovalidate" [back_hook] />[/if back_button]
<input type="submit" value="[button_label]" [button_action] />
<img class="frm_ajax_loading" src="{$img}" alt="{$sending}" style="visibility:hidden;" />
</div>
DEFAULT_HTML;
                unset($sending);
                unset($img);
                $new_default_html = FrmFormsHelper::get_default_html('submit');
                $draft_link = FrmFormsHelper::get_draft_link();
                foreach ($forms as $form) {
                    $form->options = maybe_unserialize($form->options);
                    if (!isset($form->options['submit_html']) or empty($form->options['submit_html'])) {
                        continue;
                    }
                    if ($form->options['submit_html'] != $new_default_html && $form->options['submit_html'] == $old_default_html) {
                        $form->options['submit_html'] = $new_default_html;
                        $wpdb->update($this->forms, array('options' => serialize($form->options)), array('id' => $form->id));
                    } else {
                        if (!strpos($form->options['submit_html'], 'save_draft')) {
                            $form->options['submit_html'] = preg_replace('~\\<\\/div\\>(?!.*\\<\\/div\\>)~', $draft_link . "\r\n</div>", $form->options['submit_html']);
                            $wpdb->update($this->forms, array('options' => serialize($form->options)), array('id' => $form->id));
                        }
                    }
                    unset($form);
                }
                unset($forms);
            }
            /**** ADD/UPDATE DEFAULT TEMPLATES ****/
            if (class_exists('FrmXMLController')) {
                FrmXMLController::add_default_templates();
            }
            /***** SAVE DB VERSION *****/
            update_option('frm_db_version', $frm_db_version);
        }
        do_action('frm_after_install');
    }
Exemple #22
-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'));
     }
 }