Exemplo n.º 1
0
function slider_image_box()
{
    global $slider_image, $post;
    echo '<input type="hidden" name="sticky_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
    echo '<table class="form-table">';
    foreach ($slider_image['fields'] as $field) {
        // get current post meta data
        $meta = get_post_meta($post->ID, $field['id'], true);
        $post_num = htmlentities($_GET['post']);
        echo '<tr>', '<th style="width:60%"><label for="', $field['id'], '">', $field['name'], '</label></th>', '<td>';
        switch ($field['type']) {
            case 'text':
                echo '<input class="upload input-text-1" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? remove_html_slashes($meta) : remove_html_slashes($field['std']), '" sstyle="width: 140px;"/>
						<div id="', $field['id'], '_button" class="upload-button upload-logo" style="padding: 10px 0 0 15px;"><a class="pex-button"><img src="' . THEME_IMAGE_CPANEL_URL . 'btn-browse-1.png"/></a></div>
						<script type="text/javascript">
							jQuery(document).ready(function($){ bordeaux.loadUploader(jQuery("div#', $field['id'], '_button"), "' . THEME_FUNCTIONS_URL . 'upload-handler.php", "' . THEME_UPLOADS_URL . '");});
						</script>';
                break;
        }
        echo '<td>', '</tr>';
    }
    echo '</table>';
}
Exemplo n.º 2
0
function show_box_funtion($fields, $first = 'no', $width = '60')
{
    global $post, $post_id;
    if ($first == "yes") {
        echo '<input type="hidden" name="sticky_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
    }
    if ($width != 0) {
        echo '<table class="form-table">';
    }
    foreach ($fields['fields'] as $field) {
        // get current post meta data
        $meta = get_post_meta($post->ID, $field['id'], true);
        //$post_num = htmlentities($_GET['post']);
        if ($width != 0) {
            echo '<tr>';
            echo '<th style="width:', $width, '%"><label for="', $field['id'], '">', $field['name'], '</label></th>';
            echo '<td>';
        }
        switch ($field['type']) {
            case 'text':
                echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" ', $meta ? ' ' : '', ' value="', $meta ? remove_html_slashes($meta) : remove_html_slashes($field['std']), '"/> ';
                break;
            case 'datepicker':
                echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" ', $meta ? ' ' : '', ' value="', $meta ? date("m/d/y, H:i", remove_html_slashes($meta)) : remove_html_slashes($field['std']), '"/> ';
                break;
            case 'slider_image_box':
                echo '<input class="upload input-text-1 ot-upload-field" type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? remove_html_slashes($meta) : remove_html_slashes($field['std']), '" style="width: 140px;"/><a href="#" class="ot-upload-button">Button</a>';
                break;
            case 'image_select':
                ot_gallery_image_select($field['id'], $meta);
                break;
            case 'checkbox':
                echo '<input type="checkbox" value="1" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
                break;
            case 'sidebar_select_box':
                $sidebar_names = get_option(THEME_NAME . "_sidebar_names");
                $sidebar_names = explode("|*|", $sidebar_names);
                echo '	<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                echo "<option value=\"\">Default</option>";
                foreach ($sidebar_names as $sidebar_name) {
                    if ($meta == $sidebar_name) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($sidebar_name != "") {
                        echo "<option value=\"" . $sidebar_name . "\" " . $selected . ">" . $sidebar_name . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'sidebar_select_box_small':
                $sidebar_names = get_option(THEME_NAME . "_sidebar_names");
                $sidebar_names = explode("|*|", $sidebar_names);
                if ($meta == "default") {
                    $selected = "selected=\"selected\"";
                } else {
                    $selected = "";
                }
                echo '	<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                echo "<option value=\"off\">Off</option>";
                echo "<option value=\"default\" " . $selected . ">Default</option>";
                foreach ($sidebar_names as $sidebar_name) {
                    if ($meta == $sidebar_name) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($sidebar_name != "") {
                        echo "<option value=\"" . $sidebar_name . "\" " . $selected . ">" . $sidebar_name . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'category_select':
                global $wpdb;
                $data = get_terms("category", 'parent=0&hide_empty=0');
                echo '	<select name="', $field['id'], '[]" id="', $field['id'], '" style="min-width:200px; min-height:200px;" multiple>';
                foreach ($data as $key => $d) {
                    if (is_array($meta) && in_array($d->term_id, $meta)) {
                        $selected = ' selected';
                    } else {
                        $selected = '';
                    }
                    echo "<option value=\"" . $d->term_id . "\" " . $selected . ">" . $d->name . "</option>";
                }
                echo '	</select>';
                break;
            case 'breaking_cat':
                global $wpdb;
                $data = get_terms("category", 'parent=0&hide_empty=0');
                if ($meta == "slider_off" || !$meta) {
                    $selected = "selected=\"selected\"";
                }
                echo '	<select name="', $field['id'], '[]" id="', $field['id'], '" style="min-width:200px; min-height:200px;" multiple>';
                echo '<option value="slider_off" ' . $selected . '>' . __("Off", THEME_NAME) . '</option>';
                foreach ($data as $key => $d) {
                    if (is_array($meta) && in_array($d->term_id, $meta)) {
                        $selected = ' selected';
                    } else {
                        $selected = '';
                    }
                    echo "<option value=\"" . $d->term_id . "\" " . $selected . ">" . $d->name . "</option>";
                }
                echo '	</select>';
                break;
            case 'category_select_2':
                global $wpdb;
                $data = get_terms("category", 'parent=0&hide_empty=0');
                echo '	<select class="home-cat-select" name="', $field['id'], '[]" id="', $field['id'], '" style="min-width:200px; min-height:200px;" multiple disabled>';
                foreach ($data as $key => $d) {
                    if (is_array($meta) && in_array($d->term_id, $meta)) {
                        $selected = ' selected';
                    } else {
                        $selected = '';
                    }
                    echo "<option value=\"" . $d->term_id . "\" " . $selected . ">" . $d->name . "</option>";
                }
                echo '	</select>';
                break;
            case 'layer_slider_select':
                // Get WPDB Object
                global $wpdb;
                // Table name
                $table_name = $wpdb->prefix . "layerslider";
                // Get sliders
                $sliders = $wpdb->get_results("SELECT * FROM {$table_name}\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE flag_hidden = '0' AND flag_deleted = '0'\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY id ASC LIMIT 200");
                echo '	<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                if (!empty($sliders)) {
                    foreach ($sliders as $key => $item) {
                        $name = empty($item->name) ? 'Unnamed' : $item->name;
                        if ($meta == $item->id) {
                            $selected = 'selected="selected"';
                        } else {
                            $selected = '';
                        }
                        echo '<option value="' . $item->id . '" ' . $selected . '>' . $name . '</option>';
                    }
                }
                if (empty($sliders)) {
                    echo '<option value="">' . __("You didn't create a slider yet.", THEME_NAME) . '</option>';
                }
                echo '	</select>';
                echo '	<br/><br/>Sliders You can create with LayerSlider WP (included with the theme). By creating homepage slider, choose <strong>Light</strong> skin. And set The slider size <strong>950px x 350px.</strong>';
                break;
            case 'sidebar_position_box':
                $positions = array('Right', 'Left');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'slider_type':
                $positions = array('Menu Card Items', 'Shop Items', 'Both');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'small_large':
                $positions = array('Small', 'Large');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'large_small':
                $positions = array('Large', 'Small');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'yes_no':
                $positions = array('Yes', 'No');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'no_yes':
                $positions = array('No', 'Yes');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'reviews_style':
                $positions = array('1', '2');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'color':
                echo '<input class="color" type="text" name="', $field['id'], '" id="', $field['id'], '" ', $meta ? ' ' : '', ' value="', $meta ? remove_html_slashes($meta) : remove_html_slashes($field['std']), '"/> ';
                break;
            case 'comment_select':
                $positions = array('Under The Post', 'New Tab');
                $val = array('under', 'new');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $k => $position) {
                    if ($meta == strtolower($val[$k])) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($val[$k]) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'days':
                $positions = array('1 day', '2 days', '3 days', '7 days', '14 days', '21 days');
                $val = array('1', '2', '3', '7', '14', '21');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $k => $position) {
                    if ($meta == strtolower($val[$k])) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($val[$k]) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'gallery_style':
                $positions = array('Default', 'LightBox');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'show_hide':
                $positions = array('Show', 'Hide');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'hide_show':
                $positions = array('Hide', 'Show');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'image_size_box':
                $positions = array('Large', 'Small');
                echo '<select name="', $field['id'], '" id="', $field['id'], '" style="min-width:200px;">';
                foreach ($positions as $position) {
                    if ($meta == strtolower($position)) {
                        $selected = "selected=\"selected\"";
                    } else {
                        $selected = "";
                    }
                    if ($position != "") {
                        echo "<option value=\"" . strtolower($position) . "\" " . $selected . ">" . $position . "</option>";
                    }
                }
                echo '	</select>';
                break;
            case 'textarea':
                echo '<textarea name="', $field['id'], '" id="', $field['id'], '" ', $meta ? ' ' : '', ' style="width:400px; height:100px;">', $meta ? remove_html_slashes($meta) : remove_html_slashes($field['std']), '</textarea>';
                break;
            case 'home_drag_drop':
                global $OTfields;
                $OTfields = new OrangeThemesManagment(THEME_FULL_NAME, THEME_NAME);
                get_template_part(THEME_FUNCTIONS . "drag-drop");
                $options = $OTfields->get_options();
                echo '
					<div style="vertical-align:top;clear: both;">
						' . $OTfields->print_options() . '
					</div>
				
';
                break;
            case 'google_map':
                echo '
				    <div id="map-canvas"></div>

				    <p>' . __("Left click on the map to add markers. Right click on the marker to remove it!", THEME_NAME) . '</p>
				    <input type="hidden" class="ot-coordinates" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? remove_html_slashes($meta) : remove_html_slashes($field['std']), '"/>
					<script type="text/javascript">';
                $markers = json_decode($meta);
                echo '
						var mapOptions = { zoom: 11, mapTypeId: google.maps.MapTypeId.ROADMAP };
						var markerBounds = new google.maps.LatLngBounds();
						var map = new google.maps.Map(document.getElementById(\'map-canvas\'),mapOptions);';
                if (is_array($markers)) {
                    $i = 0;
                    foreach ($markers as $marker) {
                        if ($marker->lb && $marker->mb) {
                            echo '
										cord = new google.maps.LatLng(' . $marker->lb . ',' . $marker->mb . ');
										addMarker(cord);
										markerBounds.extend(cord);';
                            $i++;
                        }
                    }
                }
                if (!isset($i)) {
                    echo 'if(navigator.geolocation) {
						 		navigator.geolocation.getCurrentPosition(function(position) {
						      	var pos = new google.maps.LatLng(position.coords.latitude,
						                                       position.coords.longitude);

						      	var infowindow = new google.maps.InfoWindow({
						        	map: map,
						        	position: pos,
						        	content: "Whereabouts"
						      	});

						      	map.setCenter(pos);
						    }, function() {
						      	handleNoGeolocation(true);
						    	});
						  	} else {
						    	handleNoGeolocation(false);
						  	}
					';
                } else {
                    if ($i == 1) {
                        echo 'map.setZoom(11);
						map.setCenter(cord);';
                    } else {
                        echo 'map.fitBounds(markerBounds);';
                    }
                }
                echo '
					 google.maps.event.addDomListener(window, \'load\', initialize);
					</script>
				';
                break;
        }
        if ($width != 0) {
            echo '<td>', '</tr>';
        }
    }
    if ($width != 0) {
        echo '</table>';
    }
}
Exemplo n.º 3
0
function aweber_form()
{
    $keys = get_option(THEME_NAME . "_aweber_keys");
    if (isset($_POST["email"])) {
        $email = is_email($_POST["email"]);
    }
    if (isset($_POST["u_name"])) {
        $u_name = esc_textarea($_POST["u_name"]);
    }
    if (isset($_POST["listID"])) {
        $listID = remove_html_slashes($_POST["listID"]);
    }
    $ip = $_SERVER['REMOTE_ADDR'];
    extract($keys);
    if ($email && $u_name && $listID) {
        try {
            $aweber = new AWeberAPI($consumer_key, $consumer_secret);
            $account = $aweber->getAccount($access_key, $access_secret);
            $account_id = $account->id;
            $listURL = "/accounts/{$account_id}/lists/{$listID}";
            $list = $account->loadFromUrl($listURL);
            # create a subscriber
            $params = array('email' => $email, 'ip_address' => $ip, 'name' => $u_name);
            $subscribers = $list->subscribers;
            $new_subscriber = $subscribers->create($params);
        } catch (AWeberAPIException $exc) {
            print 'Error: ' . $exc->message . '';
            exit(1);
        }
    }
    die;
}
Exemplo n.º 4
0
function contact_handler($atts, $content = null, $code = "")
{
    $RES_HTML = '';
    extract(shortcode_atts(array('target_email' => ''), $atts));
    $mail_to = get_option('admin_email');
    if ($target_email) {
        $mail_to = $target_email;
    }
    $website = '';
    $email = '';
    $u_name = '';
    $message = '';
    if (isset($_POST["website"])) {
        $website = remove_html_slashes($_POST["website"]);
    }
    if (isset($_POST["email"])) {
        $email = remove_html_slashes($_POST["email"]);
    }
    if (isset($_POST["u_name"])) {
        $u_name = remove_html_slashes($_POST["u_name"]);
    }
    if (isset($_POST["message"])) {
        $message = remove_html_slashes($_POST["message"]);
    }
    $ip = $_SERVER['REMOTE_ADDR'];
    $error = "";
    if (isset($_POST["addnew"])) {
        $addnew = $_POST["addnew"];
        // show error message when submit form
        if ($addnew) {
            $before = "<tr><td colspan=\"2\"><div class=\"top-error-message\">";
            $after = "</div></td></tr>";
            if (!$u_name) {
                $error .= $before . __('Please enter your name!', THEME_DOMAIN) . $after;
            }
            if (!$email) {
                $error .= $before . __('Please enter your e-mail!', THEME_DOMAIN) . $after;
            }
            if ($email && !preg_match("/@/i", "{$email}")) {
                $error .= $before . __('Please enter a valid e-mail!', THEME_DOMAIN) . $after;
            }
            if (!$message) {
                $error .= $before . __('Please enter your message!', THEME_DOMAIN) . $after;
            }
        }
    }
    // is submit message and has no error, then send email
    if (isset($addnew) && !$error) {
        $subject = __('From', THEME_DOMAIN) . " " . get_bloginfo('name') . " " . __('Contact Page', THEME_DOMAIN);
        $eol = "\n";
        $mime_boundary = md5(time());
        $headers = "From: " . $email . " <" . $email . ">" . $eol;
        //$headers .= "Reply-To: ".$email."<".$email.">".$eol;
        $headers .= "Message-ID: <" . time() . "-" . $email . ">" . $eol;
        $headers .= "X-Mailer: PHP v" . phpversion() . $eol;
        $headers .= 'MIME-Version: 1.0' . $eol;
        $headers .= "Content-Type: text/html; charset=UTF-8; boundary=\"" . $mime_boundary . "\"" . $eol . $eol;
        ob_start();
        printf(__('Message:', THEME_DOMAIN));
        ?>
 <?php 
        echo $message;
        ?>
<div style="padding-top:100px;">
<?php 
        printf(__('Name:', THEME_DOMAIN));
        ?>
 <?php 
        echo $u_name;
        ?>
<br/>
<?php 
        printf(__('Website:', THEME_DOMAIN));
        ?>
 <?php 
        echo $website;
        ?>
<br/>
<?php 
        printf(__('E-mail:', THEME_DOMAIN));
        ?>
 <?php 
        echo $email;
        ?>
<br/>
<?php 
        printf(__('IP Address:', THEME_DOMAIN));
        ?>
 <?php 
        echo $ip;
        ?>
<br/>
</div>
		<?php 
        $message = ob_get_clean();
        wp_mail($mail_to, $subject, $message, $headers);
    }
    // check add new && error
    ?>

<?php 
    // javascript for validate form
    ?>

<?php 
    $RES_HTML = '
<script language = "Javascript">
		
	function Validate() 
	{

		var errors = "";
		var reason_name = "";
		var reason_mail = "";
		var reason_message = "";


		reason_name += validateName(document.getElementById("contact-form").u_name);
		reason_mail += validateEmail(document.getElementById("contact-form").email);
		reason_message += validateMessage(document.getElementById("contact-form").message);



		if (reason_name != "") 
		{
			jQuery("#name_error").text(reason_name).fadeIn(1000);
			jQuery("#name_input").addClass("input-error-1");
			document.getElementById("name_error").style.display = "block";
			errors = "Error";
		}
		else{
			jQuery("#name_input").removeClass("input-text-1-error");
			document.getElementById("name_error").style.display = "none";
		}


		if (reason_mail != "") 
		{
			jQuery("#mail_error").text(reason_mail).fadeIn(1000);
			jQuery("#mail_input").addClass("input-error-1");
			document.getElementById("mail_error").style.display = "block";
			errors = "Error";
		}
		else{
			jQuery("#mail_input").removeClass("input-text-1-error");
			document.getElementById("mail_error").style.display = "none";
		}
		
		if (reason_message != "") 
		{
			jQuery("#message_error").text(reason_message).fadeIn(1000);
			jQuery("#message_input").addClass("input-error-1");
			document.getElementById("message_error").style.display = "block";
			errors = "Error";
		}
		else{
			jQuery("#message_input").removeClass("input-text-1-error");
			document.getElementById("message_error").style.display = "none";
		}
		
		if (errors != ""){
			return false;
		}
		
		document.getElementById("contact-form").submit(); return false;
	}
	
		function validateName(fld) 
	{

		var error = "";
		
		if (fld.value == "")
		{
			error = "' . __("You didn't enter your name.", THEME_DOMAIN) . '\\n";
		}
		else if ((fld.value.length < 2) || (fld.value.length > 50))
		{
			error = "' . __("Name has a wrong length.", THEME_DOMAIN) . '\\n";
		}


		return error;
	}
	
		function validateEmail(fld) 
	{

		var error="";
		var illegalChars = /^[^@]+@[^@.]+\\.[^@]*\\w\\w$/;
		
		if (fld.value == ""){
			error = "' . __("You didn't enter email address.", THEME_DOMAIN) . '\\n";
		}
		else if ( fld.value.match( illegalChars ) == null){
			error = "' . __("The email address contains illegal characters.", THEME_DOMAIN) . '\\n";
		}


		return error;

	}
	
	function validateMessage(fld) 
	{

		var error = "";
		
		if (fld.value == "")
		{
			error = "' . __("You didn't enter message.", THEME_DOMAIN) . '\\n";
		}
		else if (fld.value.length<3)
		{
			error = "' . __("The message is to short.", THEME_DOMAIN) . '\\n";
		}


		return error;
	}

		
	</script>';
    ?>

	<?php 
    if ($mail_to) {
        ?>
					
		<?php 
        if (!isset($addnew) || $error) {
            ?>
		
		<?php 
            $RES_HTML .= '
		<form method="post" class="contact-form" id="contact-form" name="contact-form" action="">
			<input type="hidden"  name="addnew" value="yes" />
			<table>	
				' . $error . '
				<tr>
					<td class="label">' . __('Name', THEME_DOMAIN) . '</td>
					<td>
						<input type="text" name="u_name" value="' . $u_name . '" class="input-text-1" id="name_input" />
						<div class="input-error-1-label" id="name_error" style="display: none;"></div>

					</td>
				</tr>
				<tr><td class="spacer-1" colspan="2"></td></tr>
				<tr>
					<td class="label">' . __('E-mail', THEME_DOMAIN) . '</td>
					<td>
						<input type="text" name="email" value="' . $email . '" class="input-text-1" id="mail_input"/>
						<div class="input-error-1-label" id="mail_error" style="display: none;"></div>
					</td>
				</tr>
				<tr><td class="spacer-1" colspan="2"></td></tr>
				<tr>
					<td class="label">' . __('Website', THEME_DOMAIN) . '</td>
					<td>
						<input type="text" name="website" value="' . $website . '" class="input-text-1"/>
					</td>
				</tr>
				<tr><td class="spacer-1" colspan="2"></td></tr>
				<tr>
					<td class="label">' . __('Comment', THEME_DOMAIN) . '</td>
					<td>
						<textarea name="message" id="message_input" class="text-area-1">' . $message . '</textarea>
						<div class="input-error-1-label" id="message_error" style="display: none;"></div>
					</td>
				</tr>
				<tr><td class="spacer-1" colspan="2"></td></tr>
				<tr>
					<td></td>
					<td> 
						<p class="show-all"><a href="javascript:{}" onclick="return Validate(); submitform();" class="btn-1 btn-1-color-default"><span>' . __('Send contact form', THEME_DOMAIN) . '</span></a></p>
					</td>
				</tr>
			</table>
		</form>';
            ?>
		
		<?php 
        }
        //addnew_error
        ?>
	
		
		<?php 
        if (isset($addnew) && !$error) {
            ?>
			<?php 
            $RES_HTML .= '<div class="contact-success">
				<p><span>' . __('Thanks!', THEME_DOMAIN) . '</span></p>
				<p>' . __('Your message has been sent!', THEME_DOMAIN) . '</p>
			</div>';
            ?>
		<?php 
        }
        // addnew_error
        ?>
	<?php 
    }
    // mail_to
    ?>
													

<?php 
    return $RES_HTML;
}
Exemplo n.º 5
0
    /**
     *	Prints a textarea.
     *
     *	EXAMPLE:
     *	-----------------------------------------------------------------
     *	array(
     *		"type" => "textarea",
     *		"title" => "Homepage text block",
     *		"sub_title" => "Text:",
     *		"id" => $orange_themes_managment->themeslug."_homepage_text_bock_txt",
     *		//if needed you can set a protection
     *		"protected" => array(
     *			array("id" => $orange_themes_managment->themeslug."_homepage_text_blocks_enabled", "value" => "on")
     *		)
     *	),
     */
    function print_textarea($value)
    {
        if (isset($value['std'])) {
            $default = $value['std'];
        } else {
            $default = false;
        }
        if (isset($value['protected'][0]["id"])) {
            $protectedValue = $value['protected'][0]["id"];
        } else {
            $protectedValue = false;
        }
        $protected_value = $this->get_field_value($protectedValue, $default);
        if (isset($value['protected'][0]["id"]) && $value['protected'][0]["id"] != "" && $protected_value == $value['protected'][0]["value"] || !isset($value['protected'][0]["id"])) {
            $input_value = $this->get_field_value($value['id'], $default);
            ?>
		<?php 
            if (isset($value['home']) && $value['home'] == "yes") {
                ?>
<div class="input-item-full-width-inside clearfix"><?php 
            } else {
                ?>
			<div class="input-item-full-width clearfix">
		<?php 
            }
            ?>
				<label><?php 
            echo $value['title'];
            ?>
</label>
				<?php 
            if (isset($value['info'])) {
                echo orange_themes_info_message($value['info']);
            }
            ?>
				<span class="textarea"><textarea name="<?php 
            echo $value['id'];
            ?>
"  id="<?php 
            echo $value['id'];
            ?>
" class="ot-textarea"><?php 
            echo $input_value;
            ?>
</textarea></span>
				<?php 
            if (isset($value['sample'])) {
                ?>
					<label style="font-size:10px; margin-top: 30px; left: 0px; position: absolute;"><strong>Sample:</strong> <?php 
                echo remove_html_slashes($value['sample']);
                ?>
</label>
				<?php 
            }
            ?>
			</div>
		<?php 
        }
    }
Exemplo n.º 6
0
<?php

$banner_type = get_option(THEME_NAME . "_banner_type");
$banner_image = get_option(THEME_NAME . "_banner_image");
$banner_text = stripslashes(get_option(THEME_NAME . "_banner_text"));
$banner_text_image_txt = remove_html_slashes(get_option(THEME_NAME . "_banner_text_image_txt"));
$banner_text_image_img = get_option(THEME_NAME . "_banner_text_image_img");
if (!$banner_image) {
    $banner_image = get_template_directory_uri() . "/images/custom-banner.png";
}
if (!$banner_text_image_img) {
    $banner_text_image_img = get_template_directory_uri() . "/images/custom-banner.png";
}
?>
	
<?php 
if ($banner_type == "image") {
    //Image Banner
    ?>
		<div id="popup_content" style="display:none;">
			<a href="#" id="baner_close">Close</a>
			<img src="<?php 
    echo $banner_image;
    ?>
" />
		</div>
<?php 
} else {
    if ($banner_type == "text") {
        //Text Banner
        ?>