//finfo_close($finfo); yiw_links_sliders($link, $link_url, $slide); if (preg_match('/image\\/(.*)/', $mime_type)) { echo " <Image Source=\"{$image_url}\" Title=\"{$image_title}\">"; yiw_string_("\n" . ' <Text>' . $title, $content, '</Text>' . "\n "); if ($link) { echo " <Hyperlink URL=\"{$link_url}\" Target=\"_blank\" />\n "; } echo "</Image>\n"; } if ($mime_type == 'application/x-shockwave-flash') { echo " <Flash Source=\"{$image_url}\" Title=\"{$image_title}\">\r\r\n <Image Source=\"" . get_template_directory_uri() . "/piecemaker/contents/flash-preview.png\" /> \r\r\n </Flash>\n"; } if (preg_match('/video\\/(.*)/', $mime_type)) { //echo " <Video Source=\"$image_url\" Title=\"$image_title\" Width=\"$the_image_[width]\" Height=\"$the_image_[height]\" Autoplay=\"true\"> echo " <Video Source=\"{$image_url}\" Title=\"{$image_title}\" Autoplay=\"true\">\r\r\n <Image Source=\"" . get_template_directory_uri() . "/piecemaker/contents/video-preview.jpg\" /> \r\r\n </Video>\n"; } } echo " </Contents>\n"; // array with default values $settings = array('ImageWidth' => 960, 'ImageHeight' => 315, 'LoaderColor' => "0x333333", 'InnerSideColor' => "0x222222", 'SideShadowAlpha' => 0.8, 'DropShadowAlpha' => 0.7, 'DropShadowDistance' => 25, 'DropShadowScale' => 0.95, 'DropShadowBlurX' => 40, 'DropShadowBlurY' => 4, 'MenuDistanceX' => 20, 'MenuDistanceY' => 50, 'MenuColor1' => "0x999999", 'MenuColor2' => "0x333333", 'MenuColor3' => "0xFFFFFF", 'ControlSize' => 100, 'ControlDistance' => 20, 'ControlColor1' => "0x222222", 'ControlColor2' => "0xFFFFFF", 'ControlAlpha' => 0.8, 'ControlAlphaOver' => 0.95, 'ControlsX' => 450, 'ControlsY' => 280, 'ControlsAlign' => "center", 'TooltipHeight' => 30, 'TooltipColor' => "0x222222", 'TooltipTextY' => 5, 'TooltipTextStyle' => 'P-Italic', 'TooltipTextColor' => "0xFFFFFF", 'TooltipMarginLeft' => 5, 'TooltipMarginRight' => 7, 'TooltipTextSharpness' => 50, 'TooltipTextThickness' => -100, 'InfoWidth' => 400, 'InfoBackground' => "0xFFFFFF", 'InfoBackgroundAlpha' => 0.95, 'InfoMargin' => 400, 'InfoSharpness' => 0, 'InfoThickness' => 0, 'Autoplay' => 10, 'FieldOfView' => 45); $fields = yiw_get_configuration($settings); yiw_string_(' <Settings ', implode(' ', $fields), '></Settings>'); $transitions = array('Pieces' => 9, 'Time' => 1.2, 'Transition' => 'easeInOutBack', 'Delay' => 0.1, 'DepthOffset' => 300, 'CubeDistance' => 30); $fields = yiw_get_configuration($transitions); echo "\n <Transitions>\n"; echo " <Transition " . implode(' ', $fields) . "></Transition>\n"; echo " </Transitions>\n"; echo "</Piecemaker>"; ?>
?> <div class="showcase-slide"> <div class="showcase-content"> <!-- If the slide contains multiple elements you should wrap them in a div with the class .showcase-content-wrapper. We usually wrap even if there is only one element, because it looks better. --> <div class="showcase-content-wrapper"> <?php yiw_slide_the('featured-content', array('container' => false)); ?> </div> </div> <!-- Put the caption content in a div with the class .showcase-caption --> <?php yiw_string_('<div class="showcase-caption"><p class="">', yiw_slide_get('clean-content'), '</p></div>'); ?> <div class="showcase-thumbnail"> <img src="<?php echo $thumbnail; ?> " /> </div> <!-- Put the tooltips in a div with the class .showcase-tooltips. --> <?php if (yiw_slide_get('extra_tooltip_x_pos') != '' && yiw_slide_get('extra_tooltip_y_pos') != '' && yiw_slide_get('extra_tooltip_content') != '') { } ?> <div class="showcase-tooltips">
/** * Include the custom script javascript into the theme * @since 1.0 */ function yiw_custom_js() { yiw_string_('<script type="text/javascript">', stripslashes_deep(yiw_get_option('custom_js', '')), '</script>'); }
/** * NEWSLETTER FORM * * @description * Show a newsletter form * * @example * [newsletter_form action="" label="" [label_submit=""] ] * * @params * action - the action of form * label - the label of input text * label_submit - the label of submit button * **/ function yiw_sc_newsletter_form_func($atts, $content = null) { extract(shortcode_atts(array("title" => '', "description" => '', 'action' => yiw_get_option('newsletter_form_action'), 'name' => yiw_get_option('newsletter_form_name'), 'email' => yiw_get_option('newsletter_form_email'), 'name_label' => yiw_get_option('newsletter_form_label_name'), 'email_label' => yiw_get_option('newsletter_form_label_email'), 'submit' => yiw_get_option('newsletter_form_label_submit'), 'hidden_fields' => yiw_get_option('newsletter_form_label_hidden_fields'), 'method' => yiw_get_option('newsletter_form_method')), $atts)); $html = ''; $html .= '<div class="newsletter-section group">'; $html .= '<p class="description special-font">'; $html .= yiw_string_('<strong>', $title, '</strong>', false); $html .= yiw_string_(' ', $description, '', false); $html .= '</p>'; $html .= '<form method="' . $method . '" action="' . $action . '">'; $html .= '<fieldset>'; $html .= '<ul class="group">'; $html .= '<li>'; $html .= '<label for="' . $name . '">' . $name_label . '</label>'; $html .= '<input type="text" name="' . $name . '" id="' . $name . '" class="name-field text-field autoclear" />'; $html .= '</li>'; $html .= '<li>'; $html .= '<label for="' . $email . '">' . $email_label . '</label>'; $html .= '<input type="text" name="' . $email . '" id="' . $email . '" class="email-field text-field autoclear" />'; $html .= '</li>'; $html .= '<li>'; // hidden fileds if ($hidden_fields != '') { $hidden_fields = explode('&', $hidden_fields); foreach ($hidden_fields as $field) { list($id_field, $value_field) = explode('=', $field); $html .= '<input type="hidden" name="' . $id_field . '" value="' . $value_field . '" />'; } } $html .= wp_nonce_field('mc_submit_signup_form', '_mc_submit_signup_form_nonce', false, false); $html .= '<input type="submit" value="' . $submit . '" class="submit-field" />'; $html .= '</li>'; $html .= '</ul>'; $html .= '</fieldset>'; $html .= '</form>'; $html .= '</div>'; return apply_filters('yiw_sc_newsletter_form_html', $html); }
/** * Retrieve the html of option to put inside the metabox. * * @since 1.0 * * @param array $args Set of arguments for generating the html option */ function yiw_get_option_of_metabox($args) { global $yiw_metaboxes_options; $html = ''; // default arguments $defaults = array('name' => '', 'id' => '', 'type' => 'text', 'desc' => '', 'desc_location' => 'newline', 'options' => array(), 'text' => '', 'std' => '', 'hidden' => true); $args = wp_parse_args($args, $defaults); if ($args['hidden']) { $metapost_name = '_' . $args['id']; } else { $metapost_name = $args['id']; } $post_id = isset($_GET['post']) ? $_GET['post'] : false; $option_value = $post_id != FALSE ? get_post_meta($post_id, $metapost_name, true) : $args['std']; if (empty($option_value)) { $option_value = $args['std']; } // get post type if (!isset($_GET['post_type'])) { $post_type = 'post'; } elseif (in_array($_GET['post_type'], get_post_types(array('show_ui' => true)))) { $post_type = $_GET['post_type']; } else { wp_die(__('Invalid post type')); } // save the option in the global array $yiw_metaboxes_options[$post_type][] = $metapost_name; switch ($args['type']) { case 'paragraph': $html .= yiw_string_('<p>', $args['text'], '</p>', false); break; case 'text': $html .= yiw_string_('<label for="' . $metapost_name . '">', $args['name'], '</label>', false); $html .= '<p>'; $html .= '<input type="text" name="' . $metapost_name . '" id="' . $metapost_name . '" value="' . $option_value . '" style="width:95%" />'; $html .= yiw_string_('<span class="' . $args['desc_location'] . '">', $args['desc'], '</span>', false); $html .= '</p>'; break; case 'select': $html .= yiw_string_('<label for="' . $metapost_name . '">', $args['name'], '</label>', false); $html .= '<p>'; $html .= '<select name="' . $metapost_name . '" id="' . $metapost_name . '">'; foreach ($args['options'] as $id => $value) { $html .= '<option value="' . $id . '"' . selected($option_value, $id, false) . '>' . $value . '</option>'; } $html .= '</select>'; $html .= yiw_string_('<span class="' . $args['desc_location'] . '">', $args['desc'], '</span>', false); $html .= '</p>'; break; case 'radio': $html .= yiw_string_('<label for="' . $metapost_name . '">', $args['name'], '</label>', false); $html .= '<p>'; foreach ($args['options'] as $id => $value) { $html .= '<input type="radio" name="' . $metapost_name . '" id="' . $metapost_name . '_' . $id . '" value="' . $id . '"' . checked($option_value, $id, false) . ' />'; $html .= '<label for="' . $metapost_name . '_' . $id . '"> ' . $value . '</label>'; } $html .= yiw_string_('<span class="' . $args['desc_location'] . '">', $args['desc'], '</span>', false); $html .= '</p>'; break; case 'checkbox': $html .= '<p>'; $html .= '<input type="checkbox" name="' . $metapost_name . '" id="' . $metapost_name . '" value="1"' . checked($option_value, 1, false) . ' />'; $html .= yiw_string_('<label for="' . $metapost_name . '"> ', $args['name'], '</label>', false); $html .= yiw_string_('<span class="' . $args['desc_location'] . '">', $args['desc'], '</span>', false); $html .= '</p>'; break; case 'textarea': $html .= yiw_string_('<label for="' . $metapost_name . '">', $args['name'], '</label>', false); $html .= '<p>'; $html .= '<textarea name="' . $metapost_name . '" id="' . $metapost_name . '" style="width:100%;height:200px;" />' . $option_value . '</textarea>'; $html .= yiw_string_('<span class="' . $args['desc_location'] . '">', $args['desc'], '</span>', false); $html .= '</p>'; break; case 'sep': $html .= '<hr />'; break; } $html = apply_filters('yiw_metabox_option_' . $args['type'] . '_html', $html); $html = apply_filters('yiw_metabox_option_html', $html); return $html; }
function yiw_import_theme() { global $wpdb, $yiw_wptables; $wpdb->show_errors(); if (!isset($_FILES['import-file'])) { wp_die(__("The file you have insert doesn't valid.", 'yiw')); } set_time_limit(0); switch (substr($_FILES['import-file']['name'], -3)) { case 'xml': $error = __(sprintf("The file you have insert is a WordPress eXtended RSS (WXR) file. You need to use this into the %s admin page to import this file. Here only <b>.gz</b> file are allowed.", '<a href="' . admin_url('import.php', false) . '">' . __('Tools -> Import', 'yiw') . '</a>'), 'yiw'); yiw_error_message($error); return; case 'zip': case 'rar': $error = __(sprintf("The file you have insert is a ZIP or RAR file, that it doesn't allowed in this case. Here only <b>.gz</b> file are allowed.", '<a href="' . admin_url('import.php', false) . '">' . __('Tools -> Import', 'yiw') . '</a>'), 'yiw'); yiw_error_message($error); return; } if (substr($_FILES['import-file']['name'], -2) != 'gz') { $error = __(sprintf("The file you have insert is not a valid file. Here only <b>.gz</b> file are allowed.", '<a href="' . admin_url('import.php', false) . '">' . __('Tools -> Import', 'yiw') . '</a>'), 'yiw'); yiw_error_message($error); return; } // get db encoded $content_file = file_get_contents($_FILES['import-file']['tmp_name']); $db = unserialize(base64_decode(gzuncompress($content_file))); // $url_from = array( 'siteurl' => $db['siteurl'], 'uploadsurl' => $db['uploadsurl'] ); // // $param = array( // 'type' => 'in_import', // 'url_from' => $url_from // ); array_walk_recursive($db, 'yiw_convert_url', 'in_import'); //yiw_debug($db); if (!is_array($db)) { wp_die(__('An error encoured during during import. Please try again.', 'yiw')); } // limit to avoid the MySQL gone away error $insert_limit = defined('YIW_INSERT_LIMIT') ? YIT_INSERT_LIMIT : 200; // tables foreach ($yiw_wptables as $table) { yiw_string_('<p></p><p><strong>', '// ' . $table, '</strong><br />'); // delete all row of each table $wpdb->query("TRUNCATE TABLE {$wpdb->{$table}}"); yiw_string_('', sprintf(__('Truncated %s table', 'yiw'), $wpdb->{$table}), '... Done!<br />'); // insert new data $error_data = array(); $insert = array(); foreach ($db[$table] as $id => $data) { $insert[] = yiw_makeInsertSQL($data); } // split isnert values in more ranges $insert = array_chunk($insert, $insert_limit); if (!empty($db[$table])) { foreach ($insert as $values) { $values = implode(', ', $values); $fields = implode('`, `', array_keys($db[$table][0])); //wp_die("INSERT INTO `{$wpdb->$table}` ( `$fields` ) VALUES " . $values); $wpdb->query("INSERT INTO `{$wpdb->{$table}}` ( `{$fields}` ) VALUES " . $values); } } yiw_string_('', sprintf(__('Updating %s table', 'yiw'), $wpdb->{$table}), '... Done!<br />'); } $tables = apply_filters('yit_sample_data_tables', array()); $tables = apply_filters('yit_sample_data_tables_import', $tables); if (!empty($tables)) { foreach ($tables as $table) { yiw_string_('<p></p><p><strong>', '// ' . $table, '</strong><br />'); // delete all row of each table $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}{$table}"); yiw_string_('', sprintf(__('Truncated %s table', 'yiw'), $wpdb->prefix . $table), '... Done!<br />'); // insert new data $insert = array(); foreach ($db[$table] as $id => $data) { $insert[] = yiw_makeInsertSQL($data); } // split isnert values in more ranges $insert = array_chunk($insert, $insert_limit); if (!empty($db[$table])) { foreach ($insert as $values) { $values = implode(', ', $values); $fields = implode('`, `', array_keys($db[$table][0])); //wp_die("INSERT INTO `{$wpdb->$table}` ( `$fields` ) VALUES " . $values); $wpdb->query("INSERT INTO `{$wpdb->prefix}{$table}` ( `{$fields}` ) VALUES " . $values); } } yiw_string_('', sprintf(__('Updating %s table', 'yiw'), $wpdb->prefix . $table), '... Done!<br />'); } } yiw_string_('<p></p><p><strong>', '// options', '</strong><br />'); // delete options $theme = get_option('stylesheet'); $options = array(YIW_OPTIONS_DB . "_" . get_template(), 'sidebars_widgets', 'show_on_front', 'page_on_front', 'page_for_posts', 'widget%', 'theme\\_mods\\_%'); $options = apply_filters('yiw_sample_data_options', $options); $options = apply_filters('yiw_sample_data_options_import', $options); $sql_options = array(); foreach ($options as $option) { if (strpos($option, '%') !== FALSE) { $operator = 'LIKE'; } else { $operator = '='; } $sql_options[] = "option_name {$operator} '{$option}'"; } $sql_options = implode(' OR ', $sql_options); $sql = "DELETE FROM {$wpdb->options} WHERE {$sql_options};"; if ($wpdb->query($sql)) { yiw_string_('', sprintf(__('Deleted value from %s table', 'yiw'), $wpdb->options), '... Done!<br />'); } else { yiw_string_('', sprintf(__('Error during deleting from %s table (SQL: %s)', 'yiw'), $wpdb->options, $sql), '...<br />'); } // update options $error_data = array(); $check = $wpdb->get_results("SELECT * FROM {$wpdb->options} WHERE option_id = 1", ARRAY_A); foreach ($db['options'] as $id => $option) { if (!isset($check['blog_id'])) { unset($option['blog_id']); } if ($wpdb->insert($wpdb->options, $option)) { $insert = true; } else { $insert = false; } // save the ID that has error, to show. if (!$insert) { $wpdb->print_error(); } //$error_data[] = $option['option_name']; } if ($insert) { yiw_string_('', sprintf(__('Insert new values, into %s table', 'yiw'), $wpdb->options), '... Done!</p>'); } else { yiw_string_('', sprintf(__('Error during insert new values (IDs: %s), into %s table', 'yiw'), implode($error_data, ' '), $wpdb->options), '...</p>'); } echo '</p>'; return true; }
<li<?php yiw_slide_class('slide align-' . yiw_slide_get('layout_slide')); ?> > <?php yiw_slide_the('featured-content', array('container' => false)); ?> <div class="ei-title"> <?php yiw_string_('<h2>', yiw_slide_get('title'), '</h2>'); ?> <?php yiw_string_('<h3>', yiw_slide_get('clean-content'), '</h3>'); ?> </div> </li> <?php } ?> </ul><!-- ei-slider-large --> <ul class="ei-slider-thumbs"> <li class="ei-slider-element">Current</li> <?php echo $thumbs; ?>
function yiw_module($form, $echo = true) { $fields = unserialize(yiw_get_option('contact_fields_' . $form)); if (!is_array($fields) or empty($fields)) { return null; } global $message; //echo '<pre>', print_r($fields), '</pre>'; $html = '<form id="contact-form-' . $form . '" class="contact-form" method="post" action="" enctype="multipart/form-data">' . "\n\n"; // div message feedback $html .= "\t<div class=\"usermessagea\">" . yiw_module_general_message_of($form, false) . "</div>\n"; $html .= "\t<fieldset>\n\n"; $html .= "\t\t<ul>\n\n"; // array with all messages for js validate $js_messages = array(); foreach ($fields as $id => $field) { // classes $input_class = array(); // array for print input's classes $li_class = array($field['type'] . '-field'); // array for print li's classes // errors $error_msg = ''; $error = false; $js_messages[$field['data_name']] = $field['msg_error']; if (isset($message[$form][$field['data_name']])) { $error = TRUE; $error_msg = $message[$form][$field['data_name']]; } // li class if ($field['class'] != '') { $li_class[] = " {$field['class']}"; } if ($error) { array_push($input_class, 'icon', 'error'); } $html .= "\t\t\t<li class=\"" . implode($li_class, ' ') . "\">\n"; $html .= "\t\t\t\t<label for=\"{$field['data_name']}-{$form}\">\n"; $html .= yiw_string_("\t\t\t\t\t" . '<span class="label">', yiw_get_convertTags(stripslashes_deep($field['title']), 'highlight-text'), '</span>' . "\n", false); $html .= yiw_string_("<br />\t\t\t\t\t" . '<span class="sublabel">', stripslashes_deep($field['description']), '</span><br />' . "\n", false); $html .= "\t\t\t\t</label>\n"; // if required if (isset($field['required']) and $field['required'] == 'yes') { $input_class[] = 'required'; } if (isset($field['email_validate']) and $field['email_validate'] == 'yes') { $input_class[] = 'email-validate'; } // retrive value if (isset($field['data_name']) && !$error) { $value = yiw_get_value($field['data_name']); } else { if (isset($_GET[$field['data_name']])) { $value = $_GET[$field['data_name']]; } else { $value = ''; } } // only for clean code $html .= "\t\t\t\t"; // print type of input switch ($field['type']) { // text case 'text': $html .= "<input type=\"text\" name=\"yiw_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-{$form}\" class=\"" . implode($input_class, ' ') . "\" value=\"{$value}\" />"; break; // checkbox // checkbox case 'checkbox': $checked = ''; if ($value != '' and $value) { $checked = ' checked="checked"'; } else { if ($field['already_checked'] == 'yes') { $checked = ' checked="checked"'; } } $html .= "<input type=\"checkbox\" name=\"yiw_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-{$form}\" value=\"1\" class=\"" . implode($input_class, ' ') . "\"{$checked} />"; $html .= ' ' . $field['label_checkbox']; break; // select // select case 'select': $html .= "<select name=\"yiw_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-{$form}\">\n"; // options foreach ($field['option'] as $id => $option) { $selected = ''; if ($field['option_selected'] == $id) { $selected = ' selected="selected"'; } $html .= "\t\t\t\t\t\t<option value=\"{$option}\"{$selected}>{$option}</option>\n"; } $html .= "\t\t\t\t\t</select>"; break; // textarea // textarea case 'textarea': $html .= "<textarea name=\"yiw_contact[" . $field['data_name'] . "]\" id=\"" . $field['data_name'] . "-{$form}\" rows=\"8\" cols=\"30\" class=\"" . implode($input_class, ' ') . "\">{$value}</textarea>"; break; // radio // radio case 'radio': // options foreach ($field['option'] as $i => $option) { $selected = ''; if ($field['option_selected'] == $i) { $selected = ' checked=""'; } $html .= "\t\t\t\t\t\t<input type=\"radio\" name=\"yiw_contact[{$field[data_name]}]\" id=\"{$field[data_name]}-{$form}-{$i}\" value=\"{$option}\"{$selected} /> {$option}<br />\n"; } break; // password // password case 'password': $html .= "<input type=\"password\" name=\"yiw_contact[{$field[data_name]}]\" id=\"{$field[data_name]}-{$form}\" class=\"" . implode($input_class, ' ') . "\" value=\"{$value}\" />"; break; // file // file case 'file': $html .= "<input type=\"file\" name=\"yiw_contact[{$field[data_name]}]\" id=\"{$field[data_name]}-{$form}\" class=\"" . implode($input_class, ' ') . "\" />"; break; } // only for clean code $html .= "\n"; $html .= "\t\t\t\t<div class=\"msg-error\">" . $error_msg . "</div>\n"; $html .= "\t\t\t</li>\n"; } $html .= "\t\t\t<li class=\"submit-button\">\n"; $html .= "\t\t\t\t<input type=\"text\" name=\"email_check_2\" id=\"email_check_2\" style=\"position:absolute; left:-99999px\" value=\"\" />\n"; $html .= "\t\t\t\t<input type=\"hidden\" name=\"yiw_action\" value=\"sendemail\" id=\"yiw_action\" />\n"; $html .= "\t\t\t\t<input type=\"hidden\" name=\"yiw_referer\" value=\"" . yiw_curPageURL() . "\" />\n"; $html .= "\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"" . str_replace('-', '_', $form) . "\" />\n"; $html .= "\t\t\t\t<input type=\"submit\" name=\"yiw_sendemail\" value=\"" . yiw_get_option('contact_form_submit_label_' . $form, __('send message', 'yiw')) . "\" class=\"sendmail " . yiw_get_option('contact_form_submit_alignment_' . $form, __('alignright', 'yiw')) . "\" />"; $html .= "\t\t\t</li>\n"; $html .= "\t\t</ul>\n\n"; $html .= "\t</fieldset>\n"; $html .= "</form>\n\n"; // messages for javascript validation $html .= "<script type=\"text/javascript\">\n"; $html .= "\tvar messages_form_" . str_replace('-', '_', $form) . " = {\n"; foreach ($js_messages as $id => $msg) { $html .= "\t\t{$id}: \"{$msg}\",\n"; } // remove last comma $html = str_replace("\t\t{$id}: \"{$msg}\",\n", "\t\t{$id}: \"{$msg}\"\n", $html); $html .= "\t};\n"; $html .= "</script>"; if ($echo) { echo $html; } return $html; }