function update($new_instance, $old_instance)
 {
     $instance = $old_instance;
     $instance['title'] = strip_tags($new_instance['title']);
     $instance['testimonial'] = strip_tags($new_instance['testimonial']);
     $instance['from'] = strip_tags($new_instance['from']);
     wpml_register_string(THEMESLUG, 'Testimonial', strip_tags($new_instance['testimonial']));
     wpml_register_string(THEMESLUG, 'From', strip_tags($new_instance['from']));
     return $instance;
 }
    }
}
function wpml_register_string($context, $name, $value)
{
    if (function_exists('icl_register_string') && trim($value)) {
        icl_register_string($context, $name, $value);
    }
}
$get_options = get_option(THEME_SLUG . '_' . 'slideshow');
$flex_count = $get_options['flex_custom_slider_count'] + 1;
for ($z = 0; $z < $flex_count; $z++) {
    if ($flex_count = $get_options['flex_custom_slider_count']) {
        wpml_register_string(THEME_NAME, 'Flex Caption_' . $z, stripslashes($get_options['flex_custom_slider_caption_' . $z]));
    }
}
wpml_register_string(THEME_NAME, 'Copyright Footer Text', stripslashes(wt_get_option('footer', 'copyright')));
function wt_set_custom_post_types_admin_order($wp_query)
{
    if (is_admin()) {
        // Get the post type from the query
        $post_type = $wp_query->query['post_type'];
        if ($post_type == 'POST_TYPE') {
            // 'orderby' value can be any column name
            $wp_query->set('orderby', 'title');
            // 'order' value can be ASC or DESC
            $wp_query->set('order', 'ASC');
        }
    }
}
add_filter('pre_get_posts', 'wt_set_custom_post_types_admin_order');
function wt_get_excluded_pages()
function slideShow()
{
    global $wpdb;
    $table = $wpdb->prefix . 'ultimatum_slides';
    $upldir = wp_upload_dir();
    $uplurl = $upldir['baseurl'];
    $uplurl = $uplurl . '/slideShow/';
    if ($_POST) {
        if ($_POST["images"]) {
            foreach ($_POST["images"] as $key => $value) {
                $images[$key]["image"] = $value;
                $images[$key]["title"] = $_POST["title"][$key];
                wpml_register_string('Ultimatum Slideshow', 'Slide-' . $_POST["name"] . '- Title ' . $images[$key]["title"], $images[$key]["title"]);
                $images[$key]["text"] = $_POST["text"][$key];
                wpml_register_string('Ultimatum Slideshow', 'Slide-' . $_POST["name"] . '- Title ' . $images[$key]["title"], $images[$key]["text"]);
                $images[$key]["link"] = $_POST["link"][$key];
                wpml_register_string('Ultimatum Slideshow', 'Slide-' . $_POST["name"] . '- Title ' . $images[$key]["title"], $images[$key]["link"]);
                $images[$key]["video"] = $_POST["video"][$key];
                wpml_register_string('Ultimatum Slideshow', 'Slide-' . $_POST["name"] . '- Title ' . $images[$key]["title"], $images[$key]["video"]);
                $images[$key]["target"] = $_POST["target"][$key];
            }
        }
        $image = serialize($images);
        $q = "REPLACE INTO {$table} VALUES('{$_GET['id']}','{$_POST['name']}','{$image}')";
        $wpdb->query($q);
    }
    if (isset($_GET["id"])) {
        $s = "SELECT * FROM {$table} WHERE id='{$_GET['id']}'";
        $f = $wpdb->get_row($s, ARRAY_A);
        $images = unserialize($f["images"]);
    }
    ?>
	
	<form action="" method="post">
	<?php 
    _e('Gallery Name', THEME_ADMIN_LANG_DOMAIN);
    ?>
 : <input type="text" name="name" value="<?php 
    echo $f["name"];
    ?>
" />
	<input type="submit" class="button-primary" value="<?php 
    _e('Save', THEME_ADMIN_LANG_DOMAIN);
    ?>
"/>
	<div id="file_upload">
	
    <ul class="files" id="sortable">
        <li class="ui-state-default file_upload_template" style="display:none;"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
        <table>
         <tr valign="top">
         <td style="width:22px;"><div class="drag"></div></td>
         <td>
        <table class="fuploadd"><tr>
            <td class="file_upload_preview"></td>
            <td class="file_name"></td>
            <td class="file_size"></td>
            <td class="file_upload_progress"><div></div></td>
            <td class="file_upload_start"><button class="button-primary"><?php 
    _e('Start', THEME_ADMIN_LANG_DOMAIN);
    ?>
</button></td>
            <td class="file_upload_cancel"><button class="button-primary"><?php 
    _e('Cancel', THEME_ADMIN_LANG_DOMAIN);
    ?>
</button></td>
         </tr></table>
</td></tr></table>
        </li>
        <li class="ui-state-default file_download_template" style="display:none;">
        <table>
         <tr valign="top">
         <td style="width:22px;"><div class="drag"></div></td>
         <td>
         <table class="fuploadd" cellspacing="0">
         	<tr valign="top">
         	<td>
            <span class="file_download_preview">
            </span>
             <span class="file_download_delete" colspan="2"><button class="button-secondary centered" role="button" title="<?php 
    _e('Delete', THEME_ADMIN_LANG_DOMAIN);
    ?>
">
				<?php 
    _e('Delete', THEME_ADMIN_LANG_DOMAIN);
    ?>
				</button></span>
            </td>
           
           
            <td class="slide_details"></td>
            <td class="slide_text"></td>
            </tr>
         </table>
         </td></tr></table>
            
        </li>
        <?php 
    if ($images) {
        foreach ($images as $image) {
            ?>
        <li class="file_download_template" data-id="<?php 
            echo $image["image"];
            ?>
" ><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
        
         <table>
         <tr valign="top">
         <td style="width:22px;"><div class="drag"></div></td>
         <td>
         <table class="fuploadd" cellspacing="0">
         <tr valign="top">
         <td>
           <span class="file_download_preview">
           		<a target="_blank" href="<?php 
            echo $uplurl;
            echo $f["id"];
            ?>
/<?php 
            echo $image["image"];
            ?>
">
            	<img src="<?php 
            echo $uplurl;
            echo $f["id"];
            ?>
/thumbnails/<?php 
            echo $image["image"];
            ?>
">
            	<input type="hidden" name="images[]" value="<?php 
            echo $image["image"];
            ?>
"></a>
            	</span>
            	<span class="file_download_delete">
            	<button class="button-secondary centered" role="button" title="<?php 
            _e('Delete', THEME_ADMIN_LANG_DOMAIN);
            ?>
">
				<?php 
            _e('Delete', THEME_ADMIN_LANG_DOMAIN);
            ?>
				</button>
			</span>
            </td>
			<td class="slide_details">
            	<?php 
            _e('Title', THEME_ADMIN_LANG_DOMAIN);
            ?>
<br /><input name="title[]" type="text" class="widefat" value="<?php 
            echo $image["title"];
            ?>
"/><br/>
            	<?php 
            _e('Link', THEME_ADMIN_LANG_DOMAIN);
            ?>
<br /><input name="link[]" type="text" class="widefat" value="<?php 
            echo $image["link"];
            ?>
"/><br/>
            	<?php 
            _e('Video', THEME_ADMIN_LANG_DOMAIN);
            ?>
<br /><input name="video[]" type="text" class="widefat" value="<?php 
            echo $image["video"];
            ?>
"/><br/>
            	
            </td>
            <td class="slide_text"><?php 
            _e('Slide Text', THEME_ADMIN_LANG_DOMAIN);
            ?>
<br /><textarea name="text[]" rows="5" cols="50"><?php 
            echo $image["text"];
            ?>
</textarea></td>
            </tr>
            
         </table>
         </td></tr></table>
            
        </li>
        <?php 
        }
    }
    ?>
    </ul>
    <div class="file_upload_overall_progress"><div style="display:none;"></div></div>
    <div class="file_upload_buttons">
        <button class="file_upload_start button-primary"><?php 
    _e('Start All', THEME_ADMIN_LANG_DOMAIN);
    ?>
</button> 
        <button class="file_upload_cancel button-primary"><?php 
    _e('Cancel All', THEME_ADMIN_LANG_DOMAIN);
    ?>
</button> 
        <button class="file_download_delete button-primary"><?php 
    _e('Delete All', THEME_ADMIN_LANG_DOMAIN);
    ?>
</button>
    </div>
    </form>
    <br><br>
    <form action="<?php 
    echo THEME_ADMIN_URI;
    ?>
/ajax/upload.php?id=<?php 
    echo $_GET["id"];
    ?>
" method="post" enctype="multipart/form-data">
    	<input type="hidden" name="id" value="<?php 
    echo $_GET["id"];
    ?>
" />
        <input type="file" name="file[]" multiple>
        <button type="submit"><?php 
    _e('Upload', THEME_ADMIN_LANG_DOMAIN);
    ?>
</button>
        <div class="file_upload_label"><?php 
    _e('Upload files', THEME_ADMIN_LANG_DOMAIN);
    ?>
</div>
    </form>
    </div>
	<?php 
}
    } else {
        return rtrim(get_bloginfo('url'), '/') . '/';
    }
}
#
#	WPML String Register
#
function wpml_register_string($context, $name, $value)
{
    if (function_exists('icl_register_string') && trim($value)) {
        icl_register_string($context, $name, $value);
    }
}
#
#	WPML Get Registered String
#
function wpml_t($context, $name, $original_value)
{
    if (function_exists('icl_t')) {
        return icl_t($context, $name, $original_value);
    } else {
        return $original_value;
    }
}
#
#	String Registration
#
wpml_register_string(THEMESLUG, 'Footer Copyright Text', stripslashes(get_option(THEMESLUG . '_footer_copy')));
wpml_register_string(THEMESLUG, 'Breadcrumb Menu Text', get_option(THEMESLUG . '_breadcrumb_text'));
wpml_register_string(THEMESLUG, 'Free code space for advanced users ', stripslashes(get_option(THEMESLUG . '_header_text')));
Exemple #5
0
<?php

wpml_register_string(THEME_NAME, 'Top Area Html Code', stripslashes(theme_get_option('general', 'top_area_html')));
wpml_register_string(THEME_NAME, 'Portfolio More Button Text', theme_get_option('portfolio', 'more_button_text'));
wpml_register_string(THEME_NAME, 'Copyright Footer Text', stripslashes(theme_get_option('footer', 'copyright')));
wpml_register_string(THEME_NAME, 'Footer Right Area Html Code', stripslashes(theme_get_option('footer', 'footer_right_area_html')));
function suffusion_set_translatable_fields()
{
    global $suffusion_translatable_fields, $suffusion_unified_options;
    $suffusion_translatable_fields = array("suf_home_text", "suf_nav_page_tab_title", "suf_nav_cat_tab_title", "suf_nav_links_tab_title", "suf_breadcrumb_separator", "suf_navt_home_text", "suf_navt_page_tab_title", "suf_navt_cat_tab_title", "suf_navt_links_tab_title", "suf_excerpt_custom_more_text", "suf_seo_title_separator", "suf_comment_label_name", "suf_comment_label_name_req", "suf_comment_label_email", "suf_comment_label_email_req", "suf_comment_label_uri", "suf_comment_label_your_comment", "suf_sbtab_categories_title", "suf_sbtab_archives_title", "suf_sbtab_Links_title", "suf_sbtab_meta_title", "suf_sbtab_pages_title", "suf_sbtab_recent_comments_title", "suf_sbtab_recent_posts_title", "suf_sbtab_search_title", "suf_sbtab_tag_cloud_title", "suf_sbtab_custom_tab_1_title", "suf_sbtab_custom_tab_2_title", "suf_sbtab_custom_tab_3_title", "suf_sbtab_custom_tab_4_title", "suf_sbtab_custom_tab_5_title", "suf_sbtab_custom_tab_6_title", "suf_sbtab_custom_tab_7_title", "suf_sbtab_custom_tab_8_title", "suf_sbtab_custom_tab_9_title", "suf_sbtab_custom_tab_10_title", "suf_custom_rss_title_1", "suf_custom_rss_title_2", "suf_custom_rss_title_3", "suf_custom_atom_title_1", "suf_custom_atom_title_2", "suf_custom_atom_title_3", "suf_wa_tbrh_open_text", "suf_wa_tbrh_close_text", "suf_mag_headline_title", "suf_mag_excerpts_title", "suf_mag_excerpt_full_story_text", "suf_mag_catblocks_title", "suf_mag_catblocks_see_all_text", "suf_sitemap_label_pages", "suf_sitemap_label_categories", "suf_sitemap_label_authors", "suf_sitemap_label_yarchives", "suf_sitemap_label_marchives", "suf_sitemap_label_warchives", "suf_sitemap_label_darchives", "suf_sitemap_label_tags", "suf_sitemap_label_posts", "suf_nr_lib_title", "suf_nr_lib_curr_title", "suf_nr_lib_unread_title", "suf_nr_lib_completed_title", "suf_nr_single_added_text", "suf_nr_single_started_text", "suf_nr_single_finished_text", "suf_nr_wid_curr_title", "suf_nr_wid_unread_title", "suf_nr_wid_completed_title", "suf_404_title", "suf_seo_meta_description", "suf_seo_meta_keywords", "suf_uprof_post_info_content", "suf_sbtab_custom_tab_1_contents", "suf_sbtab_custom_tab_2_contents", "suf_sbtab_custom_tab_3_contents", "suf_sbtab_custom_tab_4_contents", "suf_sbtab_custom_tab_5_contents", "suf_sbtab_custom_tab_6_contents", "suf_sbtab_custom_tab_7_contents", "suf_sbtab_custom_tab_8_contents", "suf_sbtab_custom_tab_9_contents", "suf_sbtab_custom_tab_10_contents", "suf_nr_no_books_text", "suf_nr_lib_curr_text", "suf_nr_lib_unread_text", "suf_nr_lib_completed_text", "suf_404_content", "suf_footer_left", "suf_footer_center");
    if (is_admin()) {
        global $suffusion_interactive_text_fields;
        foreach ($suffusion_translatable_fields as $field) {
            $display = $suffusion_interactive_text_fields[$field] . "|{$field}";
            wpml_register_string('suffusion-interactive', $display, $suffusion_unified_options[$field]);
        }
    }
}
 function rt_save_page_templates()
 {
     $savedTemplates = $_POST;
     $savedTemplates_Array = array();
     //Class For Templates
     $templates = new stdClass();
     $box = 0;
     $template = 0;
     foreach ($savedTemplates as $key => $value) {
         $jump = stristr($key, '_template_name') == TRUE && $value == "" ? true : false;
         if (!$jump) {
             //template name and ID
             if (stristr($key, '_template_name') == TRUE) {
                 $template = str_replace('_template_name', '', $key);
                 $templates->templates[$template] = new stdClass();
                 $templates->templates[$template]->templateID = $template;
                 $templates->templates[$template]->templateName = $value;
                 //save the templates as an array
                 $savedTemplates_Array[$template] = $value;
             }
             //Page layout - sidebar selection
             if (stristr($key, $templates->templates[$template]->templateID . '_sidebarSelection') == TRUE && $templates->templates[$template]->templateName) {
                 $box++;
                 $templates->templates[$template]->sidebar = $value;
             }
             //group id
             if (stristr($key, 'theGroupID_') == TRUE) {
                 $group_id = $value;
             }
             //home page boxes
             if (stristr($key, '_home_page_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'home_page_box';
                 $templates->templates[$template]->contents[$box]->layout = $value[0];
                 $templates->templates[$template]->contents[$box]->content_id = $value[1];
             }
             //product list
             if (stristr($key, '_product_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'product_box';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->item_width = $value["item_width"];
                 $templates->templates[$template]->contents[$box]->pagination = isset($value["pagination"]) ? $value["pagination"] : "";
                 $templates->templates[$template]->contents[$box]->ajax_scroller = isset($value["ajax_scroller"]) ? $value["ajax_scroller"] : "";
                 $templates->templates[$template]->contents[$box]->list_orderby = $value["list_orderby"];
                 $templates->templates[$template]->contents[$box]->list_order = $value["list_order"];
                 $templates->templates[$template]->contents[$box]->item_per_page = $value["item_per_page"];
                 $templates->templates[$template]->contents[$box]->categories = isset($value["categories"]) ? $value["categories"] : "";
             }
             if (class_exists('Woocommerce')) {
                 //woo product list
                 if (stristr($key, '_woo_products_box') == TRUE) {
                     $box++;
                     $templates->templates[$template]->contents[$box] = new stdClass();
                     //create new sub class
                     $templates->templates[$template]->contents[$box]->group_id = $group_id;
                     // group id
                     $templates->templates[$template]->contents[$box]->content_type = 'woo_products_box';
                     $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                     $templates->templates[$template]->contents[$box]->item_width = $value["item_width"];
                     $templates->templates[$template]->contents[$box]->list_orderby = $value["list_orderby"];
                     $templates->templates[$template]->contents[$box]->list_order = $value["list_order"];
                     $templates->templates[$template]->contents[$box]->item_per_page = $value["item_per_page"];
                     $templates->templates[$template]->contents[$box]->categories = isset($value["categories"]) ? $value["categories"] : "";
                 }
             }
             //portfolio list
             if (stristr($key, '_portfolio_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'portfolio_box';
                 $templates->templates[$template]->contents[$box]->layout = $value[0];
                 $templates->templates[$template]->contents[$box]->item_width = $value[1];
                 $templates->templates[$template]->contents[$box]->pagination = isset($value["pagination"]) ? $value["pagination"] : "";
                 $templates->templates[$template]->contents[$box]->portf_list_orderby = $value["portf_list_orderby"];
                 $templates->templates[$template]->contents[$box]->portf_list_order = $value["portf_list_order"];
                 $templates->templates[$template]->contents[$box]->item_per_page = $value["item_per_page"];
                 $templates->templates[$template]->contents[$box]->filterable = isset($value["filterable"]) ? $value["filterable"] : "";
             }
             //portfolio categories
             if (stristr($key, '_portfolio_categories') == TRUE) {
                 $templates->templates[$template]->contents[$box]->categories = $value;
             }
             //sidebar boxes
             if (stristr($key, 'sidebar_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'sidebar_box';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->sidebar_id = $value["sidebar_id"];
                 $templates->templates[$template]->contents[$box]->widget_box_width = $value["widget_box_width"];
             }
             //default content
             if (stristr($key, 'default_content') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'default_content';
                 $templates->templates[$template]->contents[$box]->layout = "one";
                 $templates->templates[$template]->contents[$box]->heading = $value["heading"];
             }
             //all content boxes
             if (stristr($key, '_all_content_boxes') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'all_content_boxes';
                 $templates->templates[$template]->contents[$box]->content_id = isset($value["content_id"]) ? $value["content_id"] : "";
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->item_width = $value["item_width"];
                 $templates->templates[$template]->contents[$box]->list_orderby = $value["list_orderby"];
                 $templates->templates[$template]->contents[$box]->list_order = $value["list_order"];
             }
             //banner box
             if (stristr($key, '_banner_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'banner_box';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->text = $value["text"];
                 $templates->templates[$template]->contents[$box]->button_text = $value["button_text"];
                 //wpml register string
                 wpml_register_string(THEMESLUG, 'Text for Banner ' . $templates->templates[$template]->templateID . $group_id, $value["text"]);
                 wpml_register_string(THEMESLUG, 'Button Text for Banner ' . $templates->templates[$template]->templateID . $group_id, $value["button_text"]);
                 wpml_register_string(THEMESLUG, 'Button Link for Banner ' . $templates->templates[$template]->templateID . $group_id, $value["button_link"]);
                 $templates->templates[$template]->contents[$box]->button_link = $value["button_link"];
             }
             //Slider box
             if (stristr($key, '_slider_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'slider_box';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->slider_script = $value["slider_script"];
                 $templates->templates[$template]->contents[$box]->content_id = isset($value["content_id"]) ? $value["content_id"] : "";
                 $templates->templates[$template]->contents[$box]->slider_timeout = $value["slider_timeout"];
                 $templates->templates[$template]->contents[$box]->slider_height = $value["slider_height"];
                 $templates->templates[$template]->contents[$box]->image_resize = $value["image_resize"];
                 $templates->templates[$template]->contents[$box]->image_crop = $value["image_crop"];
                 $templates->templates[$template]->contents[$box]->list_orderby = $value["list_orderby"];
                 $templates->templates[$template]->contents[$box]->list_order = $value["list_order"];
                 $templates->templates[$template]->contents[$box]->slider_buttons = $value["slider_buttons"];
                 $templates->templates[$template]->contents[$box]->slider_thumbs = isset($value["slider_thumbs"]) ? $value["slider_thumbs"] : "";
                 $templates->templates[$template]->contents[$box]->thumbs_width = $value["thumbs_width"];
                 $templates->templates[$template]->contents[$box]->thumbs_height = $value["thumbs_height"];
                 $templates->templates[$template]->contents[$box]->slider_effect = $value["slider_effect"];
             }
             //Revolution Slider box
             if (stristr($key, '_revolution_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->content_type = 'revolution_box';
                 $templates->templates[$template]->contents[$box]->slider_id = $value["slider_id"];
             }
             //google map
             if (stristr($key, '_google_map') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'google_map';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->map_url = $value["map_url"];
                 $templates->templates[$template]->contents[$box]->height = $value["height"];
                 //wpml register string
                 wpml_register_string(THEMESLUG, 'Map URL ' . $templates->templates[$template]->templateID . $group_id, stripslashes($value["map_url"]));
             }
             //contact form
             if (stristr($key, '_contact_form') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'contact_form';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->title = $value["title"];
                 $templates->templates[$template]->contents[$box]->email = $value["email"];
                 $templates->templates[$template]->contents[$box]->shortcode = $value["shortcode"];
                 $templates->templates[$template]->contents[$box]->description = $value["description"];
                 //wpml register string
                 wpml_register_string(THEMESLUG, 'Text for Contact Form ' . $templates->templates[$template]->templateID . $group_id, $value["title"]);
                 wpml_register_string(THEMESLUG, 'Description for Contact Form ' . $templates->templates[$template]->templateID . $group_id, $value["description"]);
             }
             //contact info box
             if (stristr($key, '_contact_info_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'contact_info_box';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->contact_title = $value["contact_title"];
                 $templates->templates[$template]->contents[$box]->contact_text = $value["contact_text"];
                 $templates->templates[$template]->contents[$box]->address = $value["address"];
                 $templates->templates[$template]->contents[$box]->phone = $value["phone"];
                 $templates->templates[$template]->contents[$box]->email = $value["email"];
                 $templates->templates[$template]->contents[$box]->support_email = $value["support_email"];
                 $templates->templates[$template]->contents[$box]->fax = $value["fax"];
                 //wpml register string
                 wpml_register_string(THEMESLUG, 'Title for Contact Info ' . $templates->templates[$template]->templateID . $group_id, $value["contact_title"]);
                 wpml_register_string(THEMESLUG, 'Text for Contact Info ' . $templates->templates[$template]->templateID . $group_id, $value["contact_text"]);
                 wpml_register_string(THEMESLUG, 'Address for Contact Info ' . $templates->templates[$template]->templateID . $group_id, $value["address"]);
                 wpml_register_string(THEMESLUG, 'Phone for Contact Info ' . $templates->templates[$template]->templateID . $group_id, $value["phone"]);
                 wpml_register_string(THEMESLUG, 'Email for Contact Info ' . $templates->templates[$template]->templateID . $group_id, $value["email"]);
                 wpml_register_string(THEMESLUG, 'Support Email for Contact Info ' . $templates->templates[$template]->templateID . $group_id, $value["support_email"]);
                 wpml_register_string(THEMESLUG, 'Fax for Contact Info ' . $templates->templates[$template]->templateID . $group_id, $value["fax"]);
             }
             //heading bar
             if (stristr($key, '_heading_bar') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'heading_bar';
                 $templates->templates[$template]->contents[$box]->heading = $value["heading"];
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 //wpml register string
                 wpml_register_string(THEMESLUG, 'Heading ' . $templates->templates[$template]->templateID . $group_id, $value["heading"]);
             }
             //blog posts
             if (stristr($key, '_blog_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'blog_box';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->pagination = isset($value["pagination"]) ? $value["pagination"] : "";
                 $templates->templates[$template]->contents[$box]->list_orderby = $value["list_orderby"];
                 $templates->templates[$template]->contents[$box]->list_order = $value["list_order"];
                 $templates->templates[$template]->contents[$box]->item_per_page = $value["item_per_page"];
                 $templates->templates[$template]->contents[$box]->categories = isset($value["categories"]) ? $value["categories"] : "";
             }
             //code box
             if (stristr($key, '_code_box') == TRUE) {
                 $box++;
                 $templates->templates[$template]->contents[$box] = new stdClass();
                 //create new sub class
                 $templates->templates[$template]->contents[$box]->group_id = $group_id;
                 // group id
                 $templates->templates[$template]->contents[$box]->content_type = 'code_box';
                 $templates->templates[$template]->contents[$box]->layout = $value["layout"];
                 $templates->templates[$template]->contents[$box]->heading = $value["heading"];
                 $templates->templates[$template]->contents[$box]->code_space = $value["code_space"];
                 $templates->templates[$template]->contents[$box]->transparent = isset($value["transparent"]) ? $value["transparent"] : "";
                 $templates->templates[$template]->contents[$box]->no_padding = isset($value["no_padding"]) ? $value["no_padding"] : "";
                 //wpml register string
                 wpml_register_string(THEMESLUG, 'Title for Code Box ' . $templates->templates[$template]->templateID . $group_id, $value["heading"]);
                 wpml_register_string(THEMESLUG, 'Description for Code Box ' . $templates->templates[$template]->templateID . $group_id, $value["code_space"]);
             }
             //line up boxes 	templateid_50758_line_up_boxes
             if (stristr($key, $templates->templates[$template]->templateID . '_line_up_boxes') == TRUE && $templates->templates[$template]->templateName) {
                 $box++;
                 $templates->templates[$template]->lineup = $value;
             }
         }
         //save the object
         update_option('rt_page_layouts', $templates);
         //save the template names array
         update_option('rt_template_names_array', $savedTemplates_Array);
     }
 }
 function update($new_instance, $old_instance)
 {
     $instance = $old_instance;
     $instance['title'] = strip_tags($new_instance['title']);
     $instance['address'] = $new_instance['address'];
     $instance['phone_1'] = strip_tags($new_instance['phone_1']);
     $instance['phone_2'] = strip_tags($new_instance['phone_2']);
     $instance['fax_1'] = strip_tags($new_instance['fax_1']);
     $instance['fax_2'] = strip_tags($new_instance['fax_2']);
     $instance['mail_1'] = strip_tags($new_instance['mail_1']);
     $instance['mail_2'] = strip_tags($new_instance['mail_2']);
     $instance['support_mail_1'] = strip_tags($new_instance['support_mail_1']);
     $instance['support_mail_2'] = strip_tags($new_instance['support_mail_2']);
     $instance['contact_form_link'] = strip_tags($new_instance['contact_form_link']);
     $instance['map_link'] = strip_tags($new_instance['map_link']);
     $instance['contact_form_link_text'] = strip_tags($new_instance['contact_form_link_text']);
     $instance['map_link_text'] = strip_tags($new_instance['map_link_text']);
     wpml_register_string(THEMESLUG, 'Address', strip_tags($new_instance['address']));
     wpml_register_string(THEMESLUG, 'Phone 1', strip_tags($new_instance['phone_1']));
     wpml_register_string(THEMESLUG, 'Phone 2', strip_tags($new_instance['phone_2']));
     wpml_register_string(THEMESLUG, 'Fax 1', strip_tags($new_instance['fax_1']));
     wpml_register_string(THEMESLUG, 'Fax 2', strip_tags($new_instance['fax_2']));
     wpml_register_string(THEMESLUG, 'Email 1', strip_tags($new_instance['mail_1']));
     wpml_register_string(THEMESLUG, 'Email 2', strip_tags($new_instance['mail_2']));
     wpml_register_string(THEMESLUG, 'Support Email 1', strip_tags($new_instance['support_mail_1']));
     wpml_register_string(THEMESLUG, 'Support Email 2', strip_tags($new_instance['support_mail_2']));
     wpml_register_string(THEMESLUG, 'Map Link', strip_tags($new_instance['map_link']));
     wpml_register_string(THEMESLUG, 'Contact Form Link', strip_tags($new_instance['contact_form_link']));
     wpml_register_string(THEMESLUG, 'Map Link Text', strip_tags($new_instance['map_link_text']));
     wpml_register_string(THEMESLUG, 'Contact Form Link Text', strip_tags($new_instance['contact_form_link_text']));
     return $instance;
 }
function formBuilder()
{
    screen_icon();
    echo '<div class="wrap">';
    ?>
	<h2>Forms</h2>
	<p><?php 
    echo '<a href="admin.php?page=wonder-forms" class="button-primary">' . __('Back to Forms Panel', THEME_ADMIN_LANG_DOMAIN) . '</a>';
    ?>
</p>
	<?php 
    global $wpdb;
    $table = $wpdb->prefix . 'ultimatum_forms';
    if ($_POST) {
        foreach ($_POST as $key => $value) {
            if ($key !== 'name' && $key !== 'notify' && $key !== 'thank' && $key !== 'button') {
                $field[$key] = $value;
            }
            if ($key == 'button') {
                wpml_register_string('Ultimatum Forms', 'Form-' . $_POST["name"] . '- Button (' . $value . ')', $value);
            }
            if ($key == 'button') {
                wpml_register_string('Ultimatum Forms', 'Form-' . $_POST["name"] . '- ThankYou (' . $value . ')', $value);
            }
        }
        // WMPL
        foreach ($field['properties'] as $keey => $element) {
            foreach ($element as $key => $value) {
                if ($key == 'label') {
                    wpml_register_string('Ultimatum Forms', 'Form-' . $_POST['name'] . '- Label (' . $value . ')', $value);
                }
                if ($key == 'values') {
                    wpml_register_string('Ultimatum Forms', 'Form-' . $_POST['name'] . '- Values (' . $element['label'] . ')', $value);
                }
            }
        }
        // WPML
        $fields = serialize($field);
        if (!isset($_GET["id"])) {
            $insert = "INSERT INTO {$table} (`name`,`notify`,`thank`,`fields`,`button`) VALUES ('{$_POST['name']}','{$_POST['notify']}','{$_POST['thank']}','{$fields}','{$_POST['button']}')";
        } else {
            $insert = "REPLACE INTO {$table} (`id`,`name`,`notify`,`thank`,`fields`,`button`) VALUES ('{$_POST['id']}','{$_POST['name']}','{$_POST['notify']}','{$_POST['thank']}','{$fields}','{$_POST['button']}')";
        }
        $res = $wpdb->query($insert);
        $id = $wpdb->insert_id;
        if (!isset($_GET["id"])) {
            $url = curPageURL() . '&id=' . $id;
            ?>
			<script language="JavaScript">
				parent.location.href='<?php 
            echo $url;
            ?>
';
			</script>
			<?php 
        }
    }
    $fields = false;
    $fetch = false;
    if (isset($_GET["id"])) {
        $query = "SELECT * FROM {$table} WHERE `id`='{$_GET['id']}'";
        $fetch = $wpdb->get_row($query, ARRAY_A);
        $fields = unserialize($fetch["fields"]);
    }
    ?>
	<table class="widefat">
	<thead>
		<tr><th><?php 
    _e('Form Properties', THEME_ADMIN_LANG_DOMAIN);
    ?>
</th><th style="text-align:right"></th></tr>
	</thead>
	<tbody>
		<tr valign="top">
		<td>
		<div id="form_builder_panel">
			<form method="post" action="" class="fancy">
				<table class="form_options">
					<tr>
						<td style="border:none">
		        		  <strong><?php 
    _e('Form Name', THEME_ADMIN_LANG_DOMAIN);
    ?>
: </strong>
		        		 </td>
		        		 <td style="border:none">
		        		  <input type="text" name="name" value="<?php 
    echo $fetch["name"];
    ?>
" />
		        		 </td>
					</tr>
					<tr>
						<td style="border:none"><strong><?php 
    _e('Notify Email', THEME_ADMIN_LANG_DOMAIN);
    ?>
:</strong></td>
						<td style="border:none"><input type="text" name="notify" value="<?php 
    echo $fetch["notify"];
    ?>
" /></td>
						
					</tr>
					<tr>
						<td style="border:none"><strong><?php 
    _e('Button Text', THEME_ADMIN_LANG_DOMAIN);
    ?>
:</strong></td>
						<td style="border:none"><input type="text" name="button" value="<?php 
    echo $fetch["button"];
    ?>
" /></td>
					</tr>
					<tr>
						<td style="border:none"><strong><?php 
    _e('Thank You Page or Message', THEME_ADMIN_LANG_DOMAIN);
    ?>
:</strong>
						<br /><small><?php 
    _e('if message contains http it will try redirect and if not it will show an ajax response in forms place.', THEME_ADMIN_LANG_DOMAIN);
    ?>
</small></td>
						<td style="border:none"><textarea name="thank"><?php 
    echo $fetch["thank"];
    ?>
</textarea></td>
						
					</tr>
					
				</table>
				<fieldset class='sml'>
					<legend><?php 
    _e('Form Fields', THEME_ADMIN_LANG_DOMAIN);
    ?>
</legend>
						<ol>
						<?php 
    if ($fields) {
        include 'formbuilder.php';
        $items = $fb->build($fields);
        if (!empty($items)) {
            foreach ($items as $key => $value) {
                $fb->elements($items[$key], $key);
            }
        }
    }
    ?>
						</ol>
				</fieldset>
				
				<input type="hidden" name="id" value="<?php 
    echo $fetch['id'];
    ?>
" />
		      	<input type="submit" class="button-primary" value="<?php 
    _e('Save Form', THEME_ADMIN_LANG_DOMAIN);
    ?>
" />
		     </form>
     	</div>
		</td>
		<td width="252">
		<div id="form_builder_nav">
			<ul id="form_builder_toolbox">
				<li id='textarea' class='toolbox'><?php 
    _e('Text Area', THEME_ADMIN_LANG_DOMAIN);
    ?>
</li>
				<li id='textbox' class='toolbox'><?php 
    _e('Text Box', THEME_ADMIN_LANG_DOMAIN);
    ?>
</li>
				<li id='dropdown' class='toolbox'><?php 
    _e('Drop Down', THEME_ADMIN_LANG_DOMAIN);
    ?>
</li>
				<li id='checkbox' class='toolbox'><?php 
    _e('Check Box', THEME_ADMIN_LANG_DOMAIN);
    ?>
</li>
				<li id='radio' class='toolbox'><?php 
    _e('Radio Button', THEME_ADMIN_LANG_DOMAIN);
    ?>
</li>
			</ul>
			<ul id="form_builder_properties">
				<li><?php 
    _e('Select an element to display its options', THEME_ADMIN_LANG_DOMAIN);
    ?>
</li>
			</ul>
			
		</div>
		</td>
		</tr>
		</tbody>
		</table>
      <?php 
    echo '</div>';
}