<div class="post-link"> <p><?php echo $link_title; ?> </p> <a href="<?php echo $link_url; ?> " title="<?php echo $link_title; ?> "><?php echo url_to_domain($link_url); ?> </a> </div> <!-- /post-link --> <?php } elseif ($format == 'gallery') { ?> <div class="featured-media"> <?php baskerville_flexslider('post-image'); ?>
$validate_title = FALSE; $validate_description = FALSE; $validate_type = FALSE; $validate_allergens = FALSE; // validate class if ($_POST['recipe-class'] >= 1 && $_POST['recipe-class'] <= 3) { $validate_class = TRUE; $link_class = $_POST['recipe-class']; } else { $link_class = 0; } // validate url if (!filter_var($_POST['recipe-link'], FILTER_VALIDATE_URL) === false) { $validate_url = TRUE; $link_url = $_POST['recipe-link']; $link_domain = url_to_domain($_POST['recipe-link']); $no_link = FALSE; } // validate image if (empty($_POST['recipe-image']) || $_POST['recipe-image'] == "" || !filter_var($_POST['recipe-image'], FILTER_VALIDATE_URL) === false) { $validate_image = TRUE; $link_image = $_POST['recipe-image']; $no_image = FALSE; } // validate title if (!empty($_POST['recipe-title'])) { $validate_title = TRUE; $link_title = $_POST['recipe-title']; $no_title = FALSE; } // validate description
return $host; } // function: get page title form url function get_title($url) { $str = file_get_contents($url); if (strlen($str) > 0) { $str = trim(preg_replace('/\\s+/', ' ', $str)); // supports line breaks inside <title> preg_match("/\\<title\\>(.*)\\<\\/title\\>/i", $str, $title); // ignore case return $title[1]; } } $link_url = "http://www.food.com/recipe/baked-buffalo-thighs-45329"; $link_domain = url_to_domain($link_url); $link_image = "/images/cook_something_logo.png"; $link_description = "No default description is avaialable from this site. Please contact webmaster@HelpMeCookSomething.com and we will try to get this fixed."; $tags = get_meta_tags($link_url); switch ($link_domain) { // allrecipes.com case "allrecipes.com": // get title $link_title = get_title($link_url); // set default image $link_image = "http://images.media-allrecipes.com/ar-images/ARlogo.svg"; foreach ($tags as $key => $value) { //echo "'$key' = *$value* <br>"; // site debugging // get description if (strpos($key, 'description') !== false) { $link_description = $value;
function ask_about_product() { $form_data = get_option('wdm_form_data'); ?> <br /> <!-- Page styles --> <?php // wp_enqueue_style("wdm-contact-css", plugins_url("css/contact.css", __FILE__)); wp_enqueue_style("wdm-juery-css", plugins_url("css/wdm-jquery-ui.css", __FILE__)); ?> <?php if (is_singular('product')) { ?> <div id="contact-form" title="<?php _e("Product Enquiry", "wdm-product-enquiry"); ?> " style="display:none;"> <form id="enquiry-form" action="#" method="POST"> <label id="wdm_product_name" for='product_name'> <?php echo get_the_title(); ?> </label> <div class="wdm-pef-form-row"> <label for='contact-name'>*<?php _e("Name:", "wdm-product-enquiry"); ?> </label> <input type='text' id='contact-name' class='contact-input' name='wdm_customer_name' value=""/> </div> <div class="wdm-pef-form-row"> <label for='contact-email'>*<?php _e("Email:", "wdm-product-enquiry"); ?> </label> <input type='text' id='contact-email' class='contact-input' name='wdm_customer_email' /> </div> <div class="wdm-pef-form-row"> <label for='contact-subject'><?php _e("Subject:", "wdm-product-enquiry"); ?> </label> <input type='text' id='contact-subject' class='contact-input' name='wdm_subject' value='' /> </div> <div class="wdm-pef-form-row"> <label for='contact-message'>*<?php _e("Enquiry:", "wdm-product-enquiry"); ?> </label> <textarea id='contact-message' class='contact-input' name='wdm_enquiry' cols='40' rows='4' style="resize:none"></textarea> </div> <?php if (!empty($form_data['enable_send_mail_copy'])) { ?> <div class="wdm-pef-send-copy"> <input type='checkbox' id='contact-cc' name='cc' value='1' /> <span class='contact-cc'> <?php _e("Send me a copy", "wdm-product-enquiry"); ?> </span> </div> <?php } ?> <div id="errors"></div> <div class="wdm-enquiry-action-btns"> <button id="send-btn" type='submit' class='contact-send contact-button' ><?php _e("Send", "wdm-product-enquiry"); ?> </button> <button id="cancel" type='button' class='contact-cancel contact-button' ><?php _e("Cancel", "wdm-product-enquiry"); ?> </button> </div> <?php echo wp_nonce_field('enquiry_action', 'product_enquiry', true, false); ?> </form> <?php $site_url = site_url(); $domain_name = htmlspecialchars(url_to_domain($site_url)); $domain_name_value = ord($domain_name); if ($domain_name_value >= 97 && $domain_name_value <= 102) { $display_url = "https://wisdmlabs.com/"; $display_message = 'WordPress Development Experts'; $prefix = "Brought to you by WisdmLabs: "; $suffix = ""; } else { if ($domain_name_value >= 103 && $domain_name_value <= 108) { $display_url = "https://wisdmlabs.com/wordpress-development-services/plugin-development/"; $display_message = 'Expert WordPress Plugin Developer'; $prefix = "Brought to you by WisdmLabs: "; $suffix = ""; } elseif ($domain_name_value >= 109 && $domain_name_value <= 114) { $display_url = "https://wisdmlabs.com/woocommerce-extension-development-customization-services/"; $display_message = 'Expert WooCommerce Developer'; $prefix = "Brought to you by WisdmLabs: "; $suffix = ""; } else { $display_url = "https://wisdmlabs.com/woocommerce-product-enquiry-pro/"; $display_message = 'WooCommerce Enquiry Plugin'; $prefix = ""; $suffix = " by WisdmLabs"; } } ?> <div class='contact-bottom'><a href='#' onclick="return false;"><?php echo $prefix; ?> </a><a href='<?php echo $display_url; ?> ' target='_blank' rel='nofollow'><?php echo $display_message; ?> </a><a href='#' onclick="return false;"><?php echo $suffix; ?> </a></div> </div> <!-- preload the images --> <div id="loading" style='display:none'> <div id="send_mail"><p><?php _e("Sending...", "wdm-product-enquiry"); ?> </p> <img src='<?php echo plugins_url("img/contact/loading.gif", __FILE__); ?> ' alt='' /> </div> </div> <?php } ?> <!-- Load JavaScript files --> <?php wp_enqueue_script("jquery"); wp_enqueue_script("jquery-ui-core", array("jquery")); wp_enqueue_script("jquery-ui-dialog", array("jquery")); wp_enqueue_script("wdm-validate", plugins_url("js/wdm_jquery.validate.min.js", __FILE__)); //wp_enqueue_script("wdm-validate", plugins_url("js/jquery.validate.min.js", __FILE__)); wp_enqueue_script("wdm-contact", plugins_url("js/contact.js", __FILE__), array("jquery")); wp_localize_script('wdm-contact', 'object_name', array('ajaxurl' => admin_url('admin-ajax.php'), 'product_name' => get_the_title(), 'wdm_customer_name' => __('Name is required.', 'wdm-product-enquiry'), 'wdm_customer_email' => __('Enter valid Email Id.', 'wdm-product-enquiry'), 'wdm_enquiry' => __('Enquiry length must be atleast 10 characters.', 'wdm-product-enquiry'))); }