/** * */ public static function im_slider($atts = null, $content = null) { $multiplier_cycle_number = 10; $multiple_params = array(array('heading' => __('Slide Content {{1}}', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter the Embedded code here (Shortcodes and HTML suported).', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'slide_{{1}}', 'type' => 'textarea')); if ($atts == 'generator') { $params = array(array('heading' => __('Controls Style', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select Controls Style.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'controls_type', 'value' => array(__('Both Pagination', MISS_ADMIN_TEXTDOMAIN) => 'circles', __('Arrow buttons on sides', MISS_ADMIN_TEXTDOMAIN) => 'arrows', __('Arrow buttons in top right corner', MISS_ADMIN_TEXTDOMAIN) => 'arrows_top', __('Arrows Buttons and Pagination', MISS_ADMIN_TEXTDOMAIN) => 'all'), 'type' => 'dropdown'), array('heading' => __('Number of Slides', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select the number of slides you wish to display. Slides are the selectable areas which change the content.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'multiplier', 'value' => range(1, $multiplier_cycle_number), 'type' => 'dropdown')); $params = array_merge($params, miss_vc_multiple_params($multiplier_cycle_number, $multiple_params)); return array('name' => __('Flex Slider', MISS_ADMIN_TEXTDOMAIN), 'base' => 'im_slider', 'icon' => 'im-icon-transmission-2', 'category' => __('Theme Short-Codes', MISS_ADMIN_TEXTDOMAIN), 'params' => $params); } extract(shortcode_atts(array('controls_type' => 'arrows', 'multiplier' => ''), $atts)); $i = 1; foreach ($multiple_params as $key => $value) { $value['param_name'] = str_replace('{{1}}', $i, $value['param_name']); $atts[$value['param_name']] = !isset($atts[$value['param_name']]) || $atts[$value['param_name']] === false ? '' : $atts[$value['param_name']]; $i++; } $out = '<div class="flexslider im-transform im-animate-element fade-in">'; $out .= '<ul class="slides">'; for ($i = 1; $i <= $multiplier; $i++) { $out .= '<li cass="default">'; $out .= do_shortcode($atts['slide_' . $i]); $out .= '</li>'; } $out .= '</ul>'; $out .= '</div>'; return '<div class="flex_slideshow_container ' . $controls_type . '">' . $out . '</div>'; }
/** * */ public static function im_audioplayer($atts = null, $content = null) { $multiplier_cycle_number = 10; $multiple_params = array(array('heading' => __('Track title {{1}}', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Please specify track title.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'title_{{1}}', 'type' => 'textfield'), array('heading' => __('Artist title {{1}}', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can specify custom artist title.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'artist_{{1}}', 'type' => 'textfield'), array('heading' => __('Artist/Track {{1}} Image URL', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can upload the custom artist / track image you wish to use here.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'image_{{1}}', 'type' => 'attach_image'), array('heading' => __('Audio File {{1}}', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Please upload track (mp3).', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'track_{{1}}', 'type' => 'attach_image'), array('heading' => __('Audio OGG File {{1}} (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Please upload track (ogg).', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'oga_{{1}}', 'type' => 'attach_image'), array('heading' => __('Buy URL {{1}} (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can specify buy URL.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'buy_{{1}}', 'type' => 'textfield'), array('heading' => __('Price {{1}} (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can specify price.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'price_{{1}}', 'type' => 'textfield'), array('heading' => __('Rating {{1}} (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can specify price.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'rating_{{1}}', 'type' => 'dropdown', 'value' => array('No Display Rating' => '', '1' => '1', '1.5' => '1.5', '2' => '2', '2.5' => '2.5', '3' => '3', '3.5' => '3.5', '4' => '4', '4.5' => '4.5', '5' => '5'))); if ($atts == 'generator') { $params = array(array('heading' => __('Buy label (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can specify the buy label for this album', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'buy_label', 'value' => '', 'type' => 'textfield'), array('heading' => __('Description', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can add custom description.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'description', 'value' => '', 'type' => 'textarea'), array('heading' => __('Currency symbol (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can specify custom currency symbol (eg. $, £)', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'currency', 'value' => '', 'type' => 'textfield'), array('heading' => __('Autoplay', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Check this for automatic playback', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'autoplay', 'value' => array(__('Enable Autoplay', MISS_ADMIN_TEXTDOMAIN) => 'true'), 'type' => 'checkbox'), array('heading' => __('Number of tracks', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select how many tracks you wish to play.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'multiplier', 'value' => range(1, $multiplier_cycle_number), 'type' => 'dropdown'), array("type" => "dropdown", "heading" => __("Viewport Animation", "js_composer"), "param_name" => "animation", "value" => miss_js_composer_css_animation(), "description" => __("Viewport animation will be triggered when this element is being viewed when you scroll page down. you only need to choose the animation style from this option. please note that this only works in moderns. We have disabled this feature in touch devices to increase browsing speed.", "js_composer")), array('heading' => __('Tracks to show', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select how many tracks you wish to display.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'limit', 'value' => range(1, $multiplier_cycle_number), 'type' => 'dropdown')); $params = array_merge($params, miss_vc_multiple_params($multiplier_cycle_number, $multiple_params)); return array('name' => __('Audio Player', MISS_ADMIN_TEXTDOMAIN), 'base' => 'im_audioplayer', 'icon' => 'im-icon-music-3', 'category' => __('Theme Short-Codes', MISS_ADMIN_TEXTDOMAIN), 'params' => $params); } global $wp_query, $irish_framework_params; extract(shortcode_atts(array('cover' => '', 'buy_label' => '', 'autoplay' => 'false', 'currency' => '', 'description' => '', 'multiplier' => '', 'animation' => '', 'limit' => '1'), $atts)); if ($animation != '') { $animation = ' im-animate-element ' . $animation . ' '; } $shortcode_id = self::_shortcode_id(); $out = ''; if ($shortcode_id == '1') { // register styles wp_enqueue_style(MISS_PREFIX . '-css-ttw', THEME_ASSETS . '/plugins/ttw/css/style.css', array(), false, 'screen'); // wp_enqueue_style( MISS_PREFIX . '-css-ttw-demo', THEME_ASSETS .'/plugins/ttw/css/demo.css', array(), false, 'screen'); // register scripts wp_enqueue_script(MISS_PREFIX . '-jplayer', THEME_ASSETS . '/plugins/jquery-jplayer/jquery.jplayer.js', array('jquery'), THEME_VERSION); wp_enqueue_script(MISS_PREFIX . '-ttw', THEME_ASSETS . '/plugins/ttw/js/ttw-music-player.js', array('jquery'), THEME_VERSION); } $group = 'styled_img_group_' . rand(1, 1000); $i = 0; $out .= '<script>'; $tracks = ''; for ($i = 1; $i <= $multiplier; $i++) { foreach ($multiple_params as $key => $value) { $value['param_name'] = str_replace('{{1}}', $i, $value['param_name']); $atts[$value['param_name']] = !isset($atts[$value['param_name']]) || $atts[$value['param_name']] === false ? '' : $atts[$value['param_name']]; } if (is_numeric($atts['track_' . $i])) { $atts['track_' . $i] = wp_get_attachment_url($atts['track_' . $i]); } if (is_numeric($atts['oga_' . $i])) { $atts['oga_' . $i] = wp_get_attachment_url($atts['oga_' . $i]); } if (is_numeric($atts['image_' . $i])) { $atts['image_' . $i] = wp_get_attachment_url($atts['image_' . $i]); } $tracks .= "{\n\t\t mp3:'" . $atts['track_' . $i] . "',\n\t\t oga:'" . $atts['oga_' . $i] . "',\n\t\t title:'" . $atts['title_' . $i] . "',\n\t\t artist:'" . $atts['artist_' . $i] . "',\n\t\t rating:'" . $atts['rating_' . $i] . "',\n\t\t buy:'" . $atts['buy_' . $i] . "',\n\t\t price:'" . $atts['price_' . $i] . "',\n\t\t duration:'',\n\t\t cover:'" . $atts['image_' . $i] . "'\n\t\t\t},"; } $out .= "\njQuery(document).ready(function(){\n var ap_description_{$shortcode_id} = '" . stripslashes($description) . "';\n var ap_playlist" . $shortcode_id . " =[ {$tracks} ];\n jQuery('#ap_{$shortcode_id}').ttwMusicPlayer(ap_playlist" . $shortcode_id . ", {\n autoPlay:{$autoplay},\n autoplay:{$autoplay},\n currencySymbol:'{$currency}',\n buyText:'{$buy_label}',\n tracksToShow:'{$limit}',\n auto_advance:true,\n description: ap_description_{$shortcode_id}\n });\n});\n"; $out .= '</script>'; $out .= '<div class="row-fluid audioplayer' . $animation . '" id="audioplayer-' . $shortcode_id . '">'; // $out .= '<div class="span12"><img src="' . $cover . '" /></div>'; $out .= '<div class="span12">'; $out .= '<div id="ap_' . $shortcode_id . '"></div>'; $out .= '</div>'; $out .= '</div><!-- /#audioplayer-' . $shortcode_id . ' -->'; return $out; }
/** * */ public static function im_contactform($atts = null, $content = null) { $multiplier_cycle_number = 15; $multiple_params = array(array('heading' => __('{{1}} Field Type', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select here type for this field', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'type_{{1}}', 'value' => array(__('Textfield', MISS_ADMIN_TEXTDOMAIN) => 'textfield', __('E-mail', MISS_ADMIN_TEXTDOMAIN) => 'email', __('Textarea', MISS_ADMIN_TEXTDOMAIN) => 'textarea', __('Checkbox', MISS_ADMIN_TEXTDOMAIN) => 'checkbox', __('Radio', MISS_ADMIN_TEXTDOMAIN) => 'radio', __('Select', MISS_ADMIN_TEXTDOMAIN) => 'select'), 'type' => 'dropdown'), array('heading' => __('{{1}} Field Label', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Type here name (Label) for this field', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'label_{{1}}', 'type' => 'textfield'), array('heading' => __('{{1}} Field Values', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Only for Field Type: checkbox, radio, select. You can add several values. Separate values bu comma. Example: I agree, I do not agree, ...', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'values_{{1}}', 'type' => 'textfield'), array('heading' => __('{{1}} Required Field', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Check here if field is required', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'required_{{1}}', 'type' => 'checkbox', 'value' => array(__('Required', MISS_ADMIN_TEXTDOMAIN) => 'required'))); if ($atts == 'generator') { $params = array(array('heading' => __('Your E-mail', MISS_ADMIN_TEXTDOMAIN), 'description' => __('E-mail address that will receive the message from this form.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'email', 'value' => '', 'type' => 'textfield'), array('heading' => __('Subject', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can place a custom subject line here. This is the subject that you will see in your emails.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'subject', 'value' => '', 'type' => 'textfield'), array('heading' => __('Success Message', MISS_ADMIN_TEXTDOMAIN), 'description' => __('When the form is submitted successfully this message will be displayed to the user. Common examples would be, "Thanks you" or something similar.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'success', 'value' => '', 'type' => 'textfield'), array('heading' => __('Spam Protection', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can choose whether to use a captcha for spam protection or the akismet plugin. If using akismet then make sure you sign up with their service and have the akismet plugin enabled.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'spam', 'value' => array(__('Captcha', MISS_ADMIN_TEXTDOMAIN) => 'captcha', __('Akismet', MISS_ADMIN_TEXTDOMAIN) => 'akismet'), 'type' => 'checkbox'), array('heading' => __('Autoresponder', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Check here for automatically respond for user which uses this form', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'autoresponder', 'value' => array(__('Enable', MISS_ADMIN_TEXTDOMAIN) => 'true'), 'type' => 'checkbox'), array('heading' => __('From Name (Autoresponder)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Name that will be displayed in a auto response letter.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'autoresponder_name', 'type' => 'textfield', 'dependency' => array('element' => 'autoresponder', 'value' => array('true'))), array('heading' => __('From E-mail (Autoresponder)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('E-mail that will be displayed in a auto response letter.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'autoresponder_email', 'type' => 'textfield', 'dependency' => array('element' => 'autoresponder', 'value' => array('true'))), array('heading' => __('Subject (Autoresponder)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Subject that will be displayed in a auto response letter.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'autoresponder_subject', 'type' => 'textfield', 'dependency' => array('element' => 'autoresponder', 'value' => array('true'))), array('heading' => __('Message (Autoresponder)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Message that will be displayed in a auto response letter.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'autoresponder_message', 'type' => 'textarea', 'dependency' => array('element' => 'autoresponder', 'value' => array('true'))), array('heading' => __('Number Of Fields', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select how many fields you want.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'multiplier', 'value' => range(1, $multiplier_cycle_number), 'type' => 'dropdown')); $params = array_merge($params, miss_vc_multiple_params($multiplier_cycle_number, $multiple_params)); return array('name' => __('Custom Contact Form', MISS_ADMIN_TEXTDOMAIN), 'base' => 'im_contactform', 'icon' => 'im-icon-envelop', 'category' => __('Theme Short-Codes', MISS_ADMIN_TEXTDOMAIN), 'params' => $params); } /* START check all variables and set default values */ miss_stripslashes(); $out = ''; extract(shortcode_atts(array('email' => '', 'subject' => '', 'success' => '', 'spam' => '', 'autoresponder' => '', 'autoresponder_name' => '', 'autoresponder_email' => '', 'autoresponder_subject' => '', 'autoresponder_message' => '', 'sidebar' => false, 'multiplier' => 1), $atts)); $i = 1; for ($i = 1; $i <= $multiplier; $i++) { foreach ($multiple_params as $key => $value) { $value['param_name'] = str_replace('{{1}}', $i, $value['param_name']); $atts[$value['param_name']] = (isset($atts[$value['param_name']]) and $atts[$value['param_name']] != '') ? $atts[$value['param_name']] : ''; } } $spam = explode(',', $spam); $akismet = in_array('akismet', $spam) ? 'true' : ''; $captcha = in_array('captcha', $spam) ? 'true' : ''; $form_id = self::_shortcode_id(); $miss_form_id = 'miss_form' . $form_id; $url = add_query_arg(array()) . '#' . $miss_form_id; $form_inputs = array(); $form_inputs['miss_email'] = is_email(trim($email)) ? trim($email) : get_option('admin_email'); $form_inputs['miss_subject'] = !empty($subject) ? $subject : ''; $form_inputs['success'] = !empty($success) ? $success : 'mail_sent'; $form_inputs['akismet'] = $akismet == 'true' ? true : false; $form_inputs['sidebar'] = !empty($sidebar) ? true : false; if ($autoresponder == 'true') { $name = !empty($autoresponder_name) ? $autoresponder_name : get_bloginfo('name'); $email = !empty($autoresponder_email) ? trim($autoresponder_email) : $form_inputs['miss_email']; $subject = !empty($autoresponder_subject) ? $autoresponder_subject : false; $message = !empty($autoresponder_message) ? $autoresponder_message : false; $form_inputs['autoresponder'][] = array('name' => $name, 'email' => $email, 'subject' => $subject, 'message' => $message); } if (isset($_POST['_miss_form_nonajax_response']['errored_fields'])) { foreach ($_POST['_miss_form_nonajax_response']['errored_fields'] as $key => $value) { $errored_fields[$value] = $value; } } /* END check all variables and set default values */ /* START assembling output variable */ $out .= '<div id="' . $miss_form_id . '" class="miss_form">'; $out .= '<form action="' . esc_url_raw($url) . '" method="post">'; $out .= isset($_POST['_miss_form_nonajax_response']) && $_POST['_miss_form_nonajax_response']['id'] == $form_id && (!$_POST['_miss_form_nonajax_response']['sidebar'] || empty($_POST['_miss_form_nonajax_response']['errored_fields'])) ? $_POST['_miss_form_nonajax_response']['messages'] : ''; $out .= '<div class="row-fluid">'; for ($i = 1; $i <= $multiplier; $i++) { $field = ''; $if_textarea_container = ''; $field_id = 'miss_field' . $i . $form_id; $atts['required_' . $i] = empty($atts['required_' . $i]) ? false : ($atts['type_' . $i] == 'email' ? 'email' : 'true'); $atts['label_' . $i] = $atts['required_' . $i] != '' ? $atts['label_' . $i] . ' *' : $atts['label_' . $i]; if (isset($errored_fields)) { $required_error = !in_array($field_id, $errored_fields) ? '' : 'required_error'; } else { $required_error = ''; } if ($atts['type_' . $i] == 'textarea') { $span = 'span12 '; $if_textarea_container = '</div><!-- class="row-fluid" --><div class="row-fluid">'; } elseif (!$form_inputs['sidebar']) { $span = 'span4 '; } else { $span = 'span6 '; } /* START check field type $atts['type_' . $i] (textarea, checkbox, select ...) and set $field variable */ if ($atts['type_' . $i] == 'textarea') { $field = '<textarea name="' . $field_id . '" id="' . $field_id . '" class="span12 ' . $required_error . ' ' . ($atts['required_' . $i] ? ' required' : '') . '" rows="5" cols="40" placeholder="' . $atts['label_' . $i] . '">' . (isset($_POST[$field_id]) ? esc_attr($_POST[$field_id]) : '') . '</textarea>'; } elseif ($atts['type_' . $i] == 'textfield' || $atts['type_' . $i] == 'email') { $field = '<input type="text" name="' . $field_id . '" id="' . $field_id . '" size="auto" class="span12 ' . $required_error . ' ' . ($atts['required_' . $i] ? ' required' : '') . '" value="' . (isset($_POST[$field_id]) ? esc_attr($_POST[$field_id]) : '') . '" placeholder="' . $atts['label_' . $i] . '"/>'; } elseif ($atts['type_' . $i] == 'radio') { if (explode(',', $atts['values_' . $i])) { $options = explode(',', $atts['values_' . $i]); $field .= '<label for="' . $field_id . '">' . $atts['label_' . $i] . '</label>'; foreach ($options as $key => $value) { $radio_id = $field_id . '_' . $key; $field .= '<div class="connector"><input type="radio" name="' . $field_id . '" id="' . $radio_id . '" class="styled ' . $required_error . ' ' . ($atts['required_' . $i] ? ' required' : '') . '"' . (!isset($_POST[$field_id]) ? $key == 0 ? ' checked="checked"' : '' : ($_POST[$field_id] == $key ? ' checked="checked"' : '')) . ' value="' . $key . '" /> <label for="' . $radio_id . '" class="radio_label">' . trim($value) . '</label></div>'; } } } elseif ($atts['type_' . $i] == 'checkbox') { if (explode(',', $atts['values_' . $i])) { $options = explode(',', $atts['values_' . $i]); $field .= '<label for="' . $field_id . '">' . $atts['label_' . $i] . '</label>'; foreach ($options as $key => $value) { $value = trim($value); $radio_id = $field_id . '_' . $key; $field .= '<div class="connector"><input type="checkbox" name="' . $radio_id . '[' . $key . ']" id="' . $radio_id . '" class="styled ' . $required_error . ' ' . ($atts['required_' . $i] ? ' required' : '') . '"' . (!isset($_POST[$radio_id]) ? '' : ($_POST[$radio_id][$key] == $value ? ' checked="checked"' : '')) . ' value="' . $value . '" /> <label for="' . $radio_id . '" class="radio_label">' . trim($value) . '</label></div>'; } } } elseif ($atts['type_' . $i] == 'select') { if (explode(',', $atts['values_' . $i])) { $options = explode(',', $atts['values_' . $i]); $field .= '<label for="' . $field_id . '">' . $atts['label_' . $i] . '</label>'; $field .= '<select name="' . $field_id . '" id="' . $field_id . '" class="span12' . $required_error . ($atts['required_' . $i] ? ' required' : '') . '">'; foreach ($options as $key => $value) { $field .= '<option value="' . trim($value) . '"' . (!isset($_POST[$field_id]) ? '' : ($_POST[$field_id] == $value ? ' selected="selected"' : '')) . '>' . trim($value) . '</option>'; } $field .= '<select>'; } } else { $field = ''; } /* END check field type (textarea, ..., select) and set $field variable */ $options = isset($options) && is_array($options) && count($options) > 0 ? $options : false; $form_inputs['fields'][$field_id] = array('type' => $atts['type_' . $i], 'label' => $atts['label_' . $i], 'required' => $atts['required_' . $i], 'value' => $options); $out .= $if_textarea_container . '<div class="' . $span . $atts['type_' . $i] . '_field' . '">' . $field . '</div><!-- class="' . $span . $atts['type_' . $i] . '_field' . '" -->' . $if_textarea_container; } // for ($i = 1; $i <= $multiplier; $i++ ) /* close previous row and open new row for captcha_and_submit */ $out .= '</div><!-- class="row-fluid" --><div class="row-fluid captcha_and_submit">'; if ($captcha == 'true') { $field_id = 'miss_field' . $i . $form_id; if (isset($errored_fields)) { $required_error = !in_array($field_id, $errored_fields) ? '' : ' required_error'; } $out .= '<div class="span8 captcha_field">'; $num1 = rand(1, 10); $num2 = rand(1, 10); $label = $num1 . ' + ' . $num2; $out .= '<input type="text" name="' . $field_id . '" id="' . $field_id . '" class="span6 required' . $required_error . '" value="' . (isset($_POST[$field_id]) ? esc_attr($_POST[$field_id]) : '') . '" placeholder="' . __('Sum *', MISS_ADMIN_TEXTDOMAIN) . '" />'; $out .= '<label class="span6" for="' . $field_id . '"> ' . $label . ' </label>'; $out .= '</div><!-- class="captcha_field" -->'; $form_inputs['fields'][$field_id] = array('type' => 'captcha', 'label' => $label, 'required' => 'captcha'); $form_inputs['fields'][$field_id]['captcha'] = $num1 + $num2; } $out .= '<div class="span4 submit_field">'; $out .= '<input type="submit" value="' . __('Submit', MISS_TEXTDOMAIN) . '" class="contact_form_submit styled_button" />'; $out .= '<div class="miss_contact_feedback">'; $out .= '<img src="' . esc_url(THEME_IMAGES_ASSETS . '/dummy/transparent.gif') . '" style="background-image: url(' . THEME_IMAGES_ASSETS . '/preloaders/preloader.gif);" alt="Loading">'; $out .= '</div>'; $out .= '</div><!-- class="submit_field" -->'; $encode_form_inputs = miss_encode($form_inputs, $serialize = true); $out .= '<div class="" style="display:none;">'; $out .= '<input type="hidden" name="_miss_form" value="' . $form_id . '">'; $out .= '<input type="hidden" name="_miss_form_encode" value="' . $encode_form_inputs . '">'; $out .= '</div>'; $out .= '</div>'; /* close row captcha_and_submit */ $out .= '</form>'; $out .= '</div><!-- id="' . $miss_form_id . '" class="miss_form" -->'; /* END assembling output variable */ return $out; }
/** * */ public static function im_map($atts = null, $content = null) { if ($atts == 'generator') { $params = array(array('heading' => __('Title', MISS_ADMIN_TEXTDOMAIN), 'description' => __('title of your map.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'title', 'value' => '', 'type' => 'textfield'), array('heading' => __('Width', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Type out the width of your map.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'width', 'value' => '', 'type' => 'textfield'), array('heading' => __('Height', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Type out the height of your map.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'height', 'value' => '', 'type' => 'textfield'), array('heading' => __('Zoom', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select an initial zoom value for your map.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'zoom', 'value' => range(1, 18), 'type' => 'dropdown'), array('heading' => __('Map Type', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select which type of map you would like to use.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'type', 'value' => array(__('Roadmap', MISS_ADMIN_TEXTDOMAIN) => 'ROADMAP', __('Satellite', MISS_ADMIN_TEXTDOMAIN) => 'SATELLITE', __('Hybrid', MISS_ADMIN_TEXTDOMAIN) => 'HYBRID', __('Terrain', MISS_ADMIN_TEXTDOMAIN) => 'TERRAIN'), 'type' => 'dropdown'), array('heading' => __('Number of Markers', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select how many markers you wish to display on your map.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'multiplier', 'min' => 1, 'max' => 5, 'step' => 1, 'unit' => __('markers', MISS_ADMIN_TEXTDOMAIN), 'type' => 'range')); $multiple_params = array(array('heading' => __('Address {{1}}', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Type out the address for your marker.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'address_{{1}}', 'type' => 'textfield'), array('heading' => __('Placemark {{1}}', MISS_ADMIN_TEXTDOMAIN), 'description' => __('You can upload custom marker.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'placemark_{{1}}', 'type' => 'attach_image'), array('heading' => __('Description {{1}}', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Type out the information you would like to display when your marker is clicked on.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'descr_{{1}}', 'type' => 'textfield')); $params = array_merge($params, miss_vc_multiple_params(5, $multiple_params)); return array('name' => __('Google Map', MISS_ADMIN_TEXTDOMAIN), 'base' => 'im_map', 'icon' => 'im-icon-location', 'category' => __('Theme Short-Codes', MISS_ADMIN_TEXTDOMAIN), 'params' => $params); } global $wp_query, $irish_framework_params; extract(shortcode_atts(array('title' => '', 'width' => '400', 'height' => '300', 'zoom' => '4', 'type' => 'ROADMAP', 'multiplier' => '1'), $atts)); $shortcode_id = self::_shortcode_id(); $map_id = 'vc_gmap_id_' . $shortcode_id; $out = ''; if ($shortcode_id == 1) { // Load google maps api wp_enqueue_script(MISS_PREFIX . '-mapsapi', 'http://maps.googleapis.com/maps/api/js?v=3.0&sensor=false', array('jquery'), THEME_VERSION, true); } $width = substr_count($width, '%') ? $width : str_replace('px', '', strtolower($width)) . 'px'; $height = str_replace(array('px', '%'), array('', ''), strtolower($height)) . 'px'; // Output our map container $out .= '<div id="' . $map_id . '" class = "msmw_map" style = "width: ' . $width . '; height: ' . $height . ';"></div>'; $out .= '<script type = "text/javascript">'; $out .= 'jQuery(document).ready(function(){'; $out .= '"use strict";'; // Setup options // Manual: https://developers.google.com/maps/documentation/javascript/ // Controls: https://developers.google.com/maps/documentation/javascript/controls $out .= 'var options' . $map_id . ' = {'; $out .= 'zoom: ' . $zoom . ','; $out .= 'scrollwheel: false,'; $out .= 'panControl: false,'; $out .= 'mapTypeControl: false,'; $out .= 'zoomControl: true,'; $out .= 'zoomControlOptions: {style: google.maps.ZoomControlStyle.SMALL, position: google.maps.ControlPosition.RIGHT_CENTER},'; $out .= 'scaleControl: false,'; $out .= 'mapTypeId: google.maps.MapTypeId.' . $type; $out .= '};'; for ($i = 1; $i <= $multiplier; $i++) { $address = $atts['address_' . $i]; $placemark = wp_get_attachment_url($atts['placemark_' . $i]); $info_content = $atts['descr_' . $i]; if (!empty($placemark)) { $image_path = explode($_SERVER['SERVER_NAME'], $placemark); if (!empty($image_path[1])) { $image_path = $_SERVER['DOCUMENT_ROOT'] . $image_path[1]; $image_size = @getimagesize($image_path); } else { $image_size = @getimagesize($placemark); } $placemark_sizes = $image_size; } // Setup a new Geocode for the current marker address $out .= 'var address' . $i . ' = "";'; $out .= 'var g' . $i . ' = new google.maps.Geocoder();'; $out .= 'g' . $i . '.geocode({ "address" : "' . $address . '" }, function (results, status) {'; $out .= 'if (status === google.maps.GeocoderStatus.OK) {'; $out .= 'address' . $i . ' = results[0].geometry.location;'; // Center map on last marker added $out .= 'map' . $map_id . '.setCenter(results[0].geometry.location);'; // Setup Marker $out .= 'var marker' . $i . ' = new google.maps.Marker({'; $out .= ' position: address' . $i . ','; if (!empty($placemark)) { $out .= 'icon: {'; $out .= 'url: "' . $placemark . '",'; $out .= 'size: new google.maps.Size(' . $placemark_sizes[0] . ', ' . $placemark_sizes[1] . '),'; $out .= 'origin: new google.maps.Point(0,0),'; $out .= 'anchor: new google.maps.Point(0, ' . $placemark_sizes[1] . ')'; $out .= '},'; $out .= 'shape: {'; $out .= 'scale: [' . $placemark_sizes[0] . '],'; $out .= 'type: "circle"'; $out .= '},'; $out .= 'shadow: {'; $out .= 'size: new google.maps.Size(' . $placemark_sizes[0] . ', ' . $placemark_sizes[1] . '),'; $out .= 'origin: new google.maps.Point(0,0),'; $out .= 'anchor: new google.maps.Point(0, ' . $placemark_sizes[1] . ')'; $out .= '},'; } $out .= 'map: map' . $map_id . ','; $out .= 'clickable: true'; $out .= '});'; // Setup info window for marker $out .= 'var boxText' . $i . ' = document.createElement("div");'; $out .= 'boxText' . $i . '.style.cssText = "border: none";'; $out .= 'boxText' . $i . '.innerHTML = "' . $info_content . '";'; $out .= 'var infowindow' . $i . ' = new google.maps.InfoWindow({ content: boxText' . $i . ' });'; // $out .= 'var infowindow'.$i.' = new google.maps.InfoWindow({ content: "'.$info_content.'" });'; $out .= 'google.maps.event.addListener(marker' . $i . ', "click", function() {'; $out .= 'infowindow' . $i . '.open(map' . $map_id . ', marker' . $i . ');'; $out .= 'infowindow' . $i . '.setZoom(18);'; $out .= '});'; $out .= '}'; $out .= '});'; } // Initialize map $out .= 'var map' . $map_id . ' = new google.maps.Map(document.getElementById("' . $map_id . '"), options' . $map_id . ');'; $out .= '});'; $out .= '</script>'; $head = '<div class="absolute"> <div class="container"> <section class="row"> <header class="section-header span12"> <h1 class="header"> <span>' . $title . '</span> </h1> </header> </section> </div> </div>'; $out = '<!--start_raw-->' . $head . $out . '<!--end_raw-->'; return $out; }
/** * */ public static function im_googlechart($atts = null, $content = null) { $multiplier_cycle_number = 20; $multiple_params = array(array('heading' => __('{{1}} Item Title (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter item title that will be displayed as legend', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'indicator_name_{{1}}', 'type' => 'textfield'), array('heading' => __('{{1}} Item Values', MISS_ADMIN_TEXTDOMAIN), "description" => __('Enter item values separated by coma. Example : 10, 12.5, 15, 13', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'indicator_values_{{1}}', 'type' => 'textarea')); if ($atts == 'generator') { $params = array(array('heading' => __('Chart Type', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select chart type', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'type', 'value' => array(__('Line Chart', MISS_ADMIN_TEXTDOMAIN) => 'LineChart', __('Smooth Line Chart', MISS_ADMIN_TEXTDOMAIN) => 'LineChartFunction', __('Scatter Chart', MISS_ADMIN_TEXTDOMAIN) => 'PointsChart', __('Area Chart', MISS_ADMIN_TEXTDOMAIN) => 'AreaChart', __('Stepped Area Chart', MISS_ADMIN_TEXTDOMAIN) => 'SteppedAreaChart', __('Pie Chart', MISS_ADMIN_TEXTDOMAIN) => 'PieChart', __('Pie Chart 3D', MISS_ADMIN_TEXTDOMAIN) => 'PieChart3D', __('Column Chart', MISS_ADMIN_TEXTDOMAIN) => 'ColumnChart', __('Bar Chart', MISS_ADMIN_TEXTDOMAIN) => 'BarChart', __('Candlestick', MISS_ADMIN_TEXTDOMAIN) => 'CandlestickChart'), 'type' => 'dropdown'), array("type" => "dropdown", "heading" => __("Viewport Animation", "js_composer"), "param_name" => "animation", "value" => miss_js_composer_css_animation(), "description" => __("Viewport animation will be triggered when this element is being viewed when you scroll page down. you only need to choose the animation style from this option. please note that this only works in moderns. We have disabled this feature in touch devices to increase browsing speed.", "js_composer")), array('heading' => __('Chart Title (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Displayed caption above the chart or leave blank to hide.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'title', 'value' => '', 'type' => 'textfield'), array('heading' => __('Horisontal (x) Axis Title (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter title for X axis or leave blank to hide.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'h_axis_title', 'value' => '', 'type' => 'textfield'), array('heading' => __('Vertical (y) Axis Title (optional)', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter title for Y axis or leave blank to hide.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'v_axis_title', 'value' => '', 'type' => 'textfield'), array('heading' => __('Chart Height', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter height of the chart box in pixels.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'chart_h', 'value' => '400', 'min' => 100, 'max' => 800, 'step' => 10, 'unit' => __('px', MISS_ADMIN_TEXTDOMAIN), 'type' => 'range'), array('heading' => __('Disable Legend', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Disable chart legend.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'disable_legend', 'type' => 'checkbox', 'value' => array(__('Check this option to disable chart legend', MISS_ADMIN_TEXTDOMAIN) => 'true')), array('heading' => __('Elements for x-axis', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Enter list of the elements elements for x-axis separated by commas. Example 1: 2010, 2011, 2012, 2013 <br />Example 2: September, October, November, December', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'h_axis_marks', 'type' => 'textarea'), array('heading' => __('Number of Items', MISS_ADMIN_TEXTDOMAIN), 'description' => __('Select how many items you wish to display.', MISS_ADMIN_TEXTDOMAIN), 'param_name' => 'multiplier', 'value' => 1, 'min' => 1, 'max' => $multiplier_cycle_number, 'step' => 1, 'unit' => __('charts', MISS_ADMIN_TEXTDOMAIN), 'type' => 'range')); $params = array_merge($params, miss_vc_multiple_params($multiplier_cycle_number, $multiple_params)); return array('name' => __('Google Chart', MISS_ADMIN_TEXTDOMAIN), 'base' => 'im_googlechart', 'icon' => 'im-icon-stats-up', 'category' => __('Theme Short-Codes', MISS_ADMIN_TEXTDOMAIN), 'params' => $params); } $out = ''; $variables = ''; extract(shortcode_atts(array('type' => 'LineChart', 'title' => '', 'v_axis_title' => '', 'h_axis_title' => '', 'h_axis_marks' => '', 'disable_legend' => false, 'indicator_name' => '', 'chart_w' => '', 'chart_h' => '400', 'multiplier' => '', 'animation' => ''), $atts)); if ($animation != '') { $animation = ' im-animate-element ' . $animation . ' '; } $additional_params = ''; if ($type == 'LineChartFunction') { $type = 'LineChart'; $additional_params .= "curveType: \"function\",\n"; } elseif ($type == 'PointsChart') { $type = 'LineChart'; $additional_params .= 'lineWidth: 0, '; } elseif ($type == 'PieChart3D') { $type = 'PieChart'; $additional_params .= "is3D: true,\n"; } $additional_params .= $disable_legend == false ? '' : 'legend: "none",'; $i = 1; foreach ($multiple_params as $key => $value) { $value['param_name'] = str_replace('{{1}}', $i, $value['param_name']); $atts[$value['param_name']] = !isset($atts[$value['param_name']]) || $atts[$value['param_name']] === false ? '' : $atts[$value['param_name']]; $i++; } $variables .= 'var data = google.visualization.arrayToDataTable(['; //Adding Title $variables .= '["' . $h_axis_title . '"'; for ($j = 1; $j <= $multiplier; $j++) { // Define Static Keys if (!isset($atts['indicator_name_' . $j])) { $atts['indicator_name_' . $j] = ""; } if (isset($atts['indicator_values_' . $j])) { $variables .= ', "' . $atts['indicator_name_' . $j] . '"'; $atts['indicator_values_' . $j] = explode(',', $atts['indicator_values_' . $j]) ? explode(',', $atts['indicator_values_' . $j]) : array(); } } $variables .= ']'; // Generating Data $h_axis_marks = explode(',', $h_axis_marks) ? explode(',', $h_axis_marks) : array(); $chart_point_value = 0; foreach ($h_axis_marks as $h_axis_mark) { $variables .= ',['; $variables .= '"' . trim($h_axis_mark) . '"'; for ($i = 1; $i <= $multiplier; $i++) { $variables .= isset($atts['indicator_values_' . $i][$chart_point_value]) && $atts['indicator_values_' . $i][$chart_point_value] != '' ? ', ' . $atts['indicator_values_' . $i][$chart_point_value] : ', ' . 0; } $variables .= ']'; $chart_point_value++; } $variables .= ']);'; $variables .= ' var options = { title: "' . $title . '", vAxis: {title: "' . $v_axis_title . '"}, hAxis: {title: "' . $h_axis_title . '"}, backgroundColor: "transparent", pointSize: 4, ' . $additional_params . ' }; '; $shortcode_id = self::_shortcode_id(); $chart_h = $chart_h != '' ? substr_count(strtolower($chart_h), 'px') ? $chart_h : $chart_h . 'px' : '400px'; $out = ''; if ($shortcode_id == '1') { // register styles $out .= '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; } $shortcode_id = 'chart_' . $shortcode_id; $out .= ' <div id="' . $shortcode_id . '" class="g_chart' . $animation . '" style="width: ' . $chart_w . '; height: ' . $chart_h . ';"></div> <script type="text/javascript"> jQuery(document).ready( function () { var ' . $shortcode_id . '_width = jQuery("#' . $shortcode_id . '").parent().width(); jQuery("#' . $shortcode_id . '").css("width", ' . $shortcode_id . '_width + "px" ); }); google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { ' . $variables . ' var chart = new google.visualization.' . $type . '(document.getElementById("' . $shortcode_id . '")); chart.draw(data, options); } </script> '; return $out; }