function weaveriip_show_disclaimer() { $text = weaverii_pro_getopt('wvr_disclaimer'); if (!empty($text)) { echo '<div class="weaver-comment-disclaimer">' . do_shortcode($text) . '</div>'; } }
function weaveriip_sc_shortcode($args = '') { extract(shortcode_atts(array('id' => '', 'v1' => '', 'v2' => '', 'v3' => '', 'v4' => '', 'v5' => '', 'v6' => '', 'v7' => '', 'v8' => '', 'v9' => '', 'php' => ''), $args)); $text = "[*** ERROR: weaveriip_sc undefined id: '{$id}' *** ]"; $out = ''; // no php yet if ($php != '') { if (function_exists('weaveriip_php_do_eval')) { $out = weaveriip_php_do_eval($php); } else { $out = '[**** ERROR: weaveriip_sc: php not allowed ****]'; } } for ($i = 1; $i <= weaverii_pro_getopt('wvpsc_num_opts'); $i++) { // look for our id $base = 'wvpsc_' . $i . '_'; $cur_id = weaverii_pro_getopt($base . 'id'); if ($cur_id == $id) { $text = weaverii_pro_getopt($base . 'text'); break; } } for ($i = 1; $i <= 9; $i++) { // process parameters $name = 'v' . $i; if (${$name} != '') { $text = str_replace("%{$name}%", ${$name}, $text); // replace params } } if ($out != '') { $text = str_replace('%php%', $out, $text); } return do_shortcode($text); }
function weaveriip_buttons_show_list() { global $weaveriip_buttons_services; if (!weaverii_pro_isset('buttons')) { weaveriip_init_buttons(); // just in case! } $buttons = weaverii_pro_getopt('buttons'); $baseurl = get_template_directory_uri(); /* from codex example */ ?> <div> <table class='even-odd'> <tr> <td style="font-weight:bold;padding:5px;"></td> <td style="font-weight:bold;padding:5px;"><small>Image</small></td> <td style="font-weight:bold;padding:5px;"><small>Button Image - Full URL <span style="font-weight:normal">(required)</span></small></td> <td style="font-weight:bold;padding:5px;"><small>Hover Text Description</small></td> <td style="font-weight:bold;padding:5px;"><small>Link - Full URL</</td> <td style="font-weight:bold;padding:5px;"><small>New<br />Page</small></td> </tr> <?php for ($i = 0; $i < $buttons['maxbuttons']; $i++) { if ($i & 1) { echo "<tr>\n"; } else { echo "<tr style=\"background:#eee;\">\n"; } $id = 'b' . $i; ?> <td> <?php echo $i + 1; ?> </td> <?php if ($buttons[$id . '_img_url'] == '') { // special case - no link echo ' <td style="padding:5px;"><img src="' . trailingslashit($baseurl) . 'includes/pro/images/default-button.png" alt="no link" /></td>' . "\n"; } else { echo ' <td style="padding:5px;"><img src="' . $buttons[$id . '_img_url'] . '" alt="button" /></td>' . "\n"; } ?> <td> <input type="text" name="<?php echo $id; ?> _img_url" id="<?php echo $id; ?> _img_url" style="width:240px;height:20px;" class="regular-text" value="<?php echo esc_textarea($buttons[$id . '_img_url']); ?> " /><?php weaverii_media_lib_button($id . '_img_url'); ?> </td> <td style="width:200px;padding-left:10px; padding-right:10px;"> <input type="text" name="<?php echo $id; ?> _hover" id="<?php echo $id; ?> _hover" style="width:200px;height:20px;" class="regular-text" value="<?php echo esc_textarea($buttons[$id . '_hover']); ?> " /> </td> <td style="padding:5px;"> <input type="text" name="<?php echo $id; ?> _link_url" id="<?php echo $id; ?> _link_url" style="width:240px;height:20px;" class="regular-text" value="<?php echo esc_textarea($buttons[$id . '_link_url']); ?> " /> </td> <td style="padding:5px;"> <input type="checkbox" name="<?php echo $id; ?> _blank" id="<?php echo $id; ?> _blank" <?php echo $buttons[$id . '_blank'] ? "checked" : ""; ?> /> </td> <?php } // end for ?> </table> </div> <?php }
$add_html = weaverii_getopt('wii_menu_addhtml'); if (!empty($add_html)) { echo '<div class="menu-add">'; $add_div = false; echo do_shortcode($add_html); $add_enddiv = true; } if (weaverii_pro_getopt('wvp_add_social_to_menu') > 0) { if ($add_div) { echo '<div class="menu-add">'; } $add_div = false; if ($add_enddiv) { echo '<br class="mad-br" />'; } $val = weaverii_pro_getopt('wvp_add_social_to_menu'); $width = $val * 28; echo do_shortcode(sprintf('<span style="width:%spx; padding-right:4px;display:inline-block;">[weaver_social number=%d]</span>', $width, $val)); $add_enddiv = true; } if (weaverii_getopt('wii_menu_addsearch')) { if ($add_div) { echo '<div class="menu-add">'; } $add_div = false; if ($add_enddiv) { echo '<br class="mad-br" />'; } if (function_exists('weaverii_plus_search_form')) { echo '<span class="menu-add-search">'; echo weaverii_plus_search_form('', 120);
function weaveriip_slider_shortcode($args = '') { extract(shortcode_atts(array('id' => '1'), $args)); if (!weaverii_pro_getopt('slider_enable')) { return "<strong>[weaver_slider] shortcode used, but option not enabled.</strong>"; } $sname = 'slider' . $id; if (!weaverii_pro_isset($sname . '_menu')) { return "<strong>[weaver_slider id={$id}] shortcode used, but Slider {$id} not defined.</strong>"; } //if (weaverii_use_mobile('any') && weaverii_pro_getopt($sname . '_hidemobile')) { // return ''; //} $out = "<!-- Weaver Slider Shortcode -->\n"; $out .= '<div id="weaver-slider' . $id . "\" class=\"weaver-slider\">\n"; if (weaverii_pro_getopt($sname . '_menu') != '') { $menu_items = wp_get_nav_menu_items(weaverii_pro_getopt($sname . '_menu')); $menu_list = '<ul id="menu-' . $sname . '">'; $img_num = 1; foreach ((array) $menu_items as $key => $menu_item) { $title = $menu_item->title; $url = $menu_item->url; $target = $menu_item->target; if ($target == '') { $target = '_self'; } $img_url = weaverii_pro_getopt($sname . '_img' . $img_num); if ($img_url == '') { if (weaverii_pro_getopt($sname . '_vertical')) { $img_url = weaverii_relative_url('includes/pro/images/' . $img_num . '-v.jpg'); } else { $img_url = weaverii_relative_url('includes/pro/images/' . $img_num . '.jpg'); } } $menu_list .= '<li>'; if (!weaverii_pro_getopt($sname . '_hidetext')) { $menu_text = '<span class="weaver-link-' . $sname . '">' . $title . '</span>'; } else { $menu_text = ''; } $menu_list .= '<a href="' . $url . '" title="' . $title . '" style="text-decoration:none;" target="' . $target . '">' . $menu_text . '<img src="' . $img_url . '" alt="' . $title . '" /></a></li>' . "\n"; $img_num++; if ($img_num > weaverii_pro_getopt($sname . '_number_images')) { break; } } for (; $img_num <= weaverii_pro_getopt($sname . '_number_images'); $img_num++) { $img_url = weaverii_pro_getopt($sname . '_img' . $img_num); if ($img_url == '') { if (weaverii_pro_getopt($sname . '_vertical')) { $img_url = weaverii_relative_url('includes/pro/images/' . $img_num . '-v.jpg'); } else { $img_url = weaverii_relative_url('includes/pro/images/' . $img_num . '.jpg'); } } $menu_list .= '<li><img src="' . $img_url . '" alt="slider image" /></li>' . "\n"; } $menu_list .= '</ul>'; } else { $menu_list = "<h3>[weaver_slider id={$id}]: Menu not yet selected or defined.</h3>\n"; } // $menu_list now ready to output $out .= $menu_list; $out .= "\n" . '</div> <!-- #weaver-slider' . $id . " -->\n"; //$out .= '<div style="clear:both;"></div>' . "\n"; /* compressSize = (MenuWidth-ImageWidth) / (NumImages-1) (just for horizontal - use 50 for vertical) */ $compressSize = (weaverii_pro_getopt($sname . '_menu_width') - weaverii_pro_getopt($sname . '_img_width')) / (weaverii_pro_getopt($sname . '_number_images') - 1); $vertical = 'false'; if (weaverii_pro_getopt($sname . '_vertical')) { $compressSize = weaverii_pro_getopt($sname . '_vert_compress'); $vertical = 'true'; } if (!weaverii_pro_getopt($sname . '_noeffects')) { // no js for this menu $out .= "<script type=\"text/javascript\">window.addEvent('load', function(){\nnew BySlideMenu({\n'container' : 'menu-{$sname}',\n'selector' : 'li',\n'compressSize' : {$compressSize},\n'vertical' : {$vertical}\n}); });</script>\n"; } return $out; }
function weaveriip_header_gadget_code($which = 0) { /* This is called from header.php, and will insert code into the #branding div of the header. */ global $weaverii_cur_page_ID; if (!weaverii_pro_isset('hdr_num_opts')) { weaveriip_header_init(); } // echo("<!-- Weaver II Pro Header Gadgets - Page ID: $weaverii_cur_page_ID; -->\n"); $lim = weaverii_pro_getopt('hdr_num_opts'); if ($which < 1) { // coming from header, not shortcode $max = weaverii_pro_getopt('hdr_use_for_header'); if ($max != '' && $max < $lim) { $lim = $max; } } for ($i = 1; $i <= $lim; $i++) { if ($which > 0 && $which != $i) { continue; } $x = 0; $y = 0; $img = ''; $imgalt = ''; $text = ''; $textstyle = ''; $link = ''; $linkalt = ''; $base = 'hdr_' . $i . '_'; if (weaverii_pro_getopt($base . 'hidemobile') && weaverii_use_mobile('mobile')) { continue; } if (weaverii_pro_getopt($base . 'hidetablet') && weaverii_use_mobile('tablet')) { continue; } if (weaverii_pro_isset($base . 'page')) { $page = weaverii_pro_getopt($base . 'page'); if ($page != '' && $page != $weaverii_cur_page_ID) { continue; } // show only on one page, but not this one. if (weaverii_is_checked_page_opt('wvr_plus_hidecustomheader')) { // maybe skip if (!($page != '' && $page == $weaveriip_cur_page_ID)) { continue; } } } if (weaverii_pro_isset($base . 'x')) { $x = weaverii_pro_getopt($base . 'x'); } $xunits = weaverii_pro_isset($base . '_xunits') ? weaverii_pro_getopt($base . '_xunits') : 'px'; if ($xunits == '') { $xunits = 'px'; } if (weaverii_pro_isset($base . 'y')) { $y = weaverii_pro_getopt($base . 'y'); } $yunits = weaverii_pro_isset($base . '_yunits') ? weaverii_pro_getopt($base . '_yunits') : 'px'; if ($yunits == '') { $yunits = 'px'; } if (weaverii_pro_isset($base . 'img')) { $img = weaverii_pro_getopt($base . 'img'); } if (weaverii_pro_isset($base . 'imgalt')) { $imgalt = weaverii_pro_getopt($base . 'imgalt'); } if (weaverii_pro_isset($base . 'text')) { $text = do_shortcode(weaverii_pro_getopt($base . 'text')); } if (weaverii_pro_isset($base . 'textstyle')) { $textstyle = weaverii_pro_getopt($base . 'textstyle'); } if (weaverii_pro_isset($base . 'link')) { $link = weaverii_pro_getopt($base . 'link'); } if (weaverii_pro_isset($base . 'linkalt')) { $linkalt = weaverii_pro_getopt($base . 'linkalt'); } if (weaverii_pro_isset($base . 'newpage')) { $newpage = weaverii_pro_getopt($base . 'newpage'); } if ($img == '' && $text == '' && $textstyle == '') { continue; } echo '<span id="wvr_gadget_' . $i . '" class="wvr_gadget" style="position:absolute;z-index:4;left:' . $x . $xunits . ';top:' . $y . $yunits . ';' . $textstyle . '">'; if ($link != '') { $target = $newpage ? ' target="_blank"' : ''; echo '<a href="' . $link . '" title="' . $linkalt . '"' . $target . ' style="color:inherit;">'; } if ($img != '') { echo '<img class="wvr_gadget_img" src="' . $img . '" title="' . $imgalt . '" alt="' . $imgalt . '" />'; } if ($text != '') { echo $text; } if ($link != '') { echo "</a>"; } echo "</span>\n"; } ?> <?php }
function weaveriip_social_generate_code($height = 24, $number = 1000, $is_widget = true, $tag = 'span') { global $weaveriip_social_services; if (!weaverii_pro_isset('social')) { weaveriip_init_social(); } $soc = weaverii_pro_getopt('social'); $out = ''; // need to sort the buttons according to the order field. This code may not be the best way to do this, // but it was easier that figuring sorting the array of services. $sorted = array(); $active_services = array(); foreach ($weaveriip_social_services as $service) { // find all active buttons $id = $service['icon']; if (!isset($soc[$id . '_use']) || !$soc[$id . '_use']) { // not set to use continue; } $order = $soc[$id . '_order']; if ($order == '') { $order = 100000; } $sorted[$id] = $order; array_push($active_services, $service); // order doesn't matter here, so just push } asort($sorted); // sort the list of service names $sorted_ids = array_keys($sorted); // get the keys into an array - will be a sorted list of services $displayed = 0; $rm = $is_widget ? '6' : '0'; $out .= '<' . $tag . ' class="weaver-social" >'; foreach ($sorted_ids as $use_id) { foreach ($active_services as $service) { // find the active service that matches the next sorted id $id = $service['icon']; if ($id != $use_id) { continue; } $title = $soc[$id . '_hover']; // $service['blurb']; $url = $soc[$id . '_url']; $custom = isset($soc[$id . '_custom']) ? $soc[$id . '_custom'] : ''; if ($custom != '') { $imgsrc = $custom; } else { $imgsrc = apply_filters('weaverii-social-dir', weaverii_relative_url('includes/pro/social/1/')) . $id . '.png'; } $target = '_blank'; if (isset($soc[$id . '_stay']) && $soc[$id . '_stay']) { $target = '_self'; } $out .= '<a class="wvr-social-a" href="' . $url . '" target="' . $target . '" title="' . $title . '">' . '<img class="wvr-social-img" style="margin-right:' . $rm . 'px; width:' . $height . 'px !important;" src="' . $imgsrc . '" height="' . $height . '" width="' . $height . '" title="' . $title . '" alt="' . $title . '" /></a>' . "\n"; if (++$displayed >= $number) { $out .= '</' . $tag . '>' . "\n"; return $out; // bail when display number reached } break; } } // end foreach $out .= '</' . $tag . '>' . "\n"; if ($is_widget) { $out .= '<div style="clear:both;"></div>' . "\n"; } return $out; }
function weaveriip_social_show_list() { global $weaveriip_social_services; if (!weaverii_pro_isset('social')) { weaveriip_init_social(); // make sane } $soc = weaverii_pro_getopt('social'); // fetch the sub list $baseurl = trailingslashit(get_template_directory_uri()); /* from codex example */ ?> <div> <table class='even-odd'> <tr> <td><strong><small>Use</small></strong></td> <td style="text-align:center;font-weight:bold;"><small>Display<br />Order</small></td> <td></td> <td style="font-weight:bold;"><small>Social Site Description</small></td> <td style="font-weight:bold;"><small>Full URL link to your account</</td> <td style="font-weight:bold;"><small>Stay<br />on page</</td> </tr> <?php $i = 1; foreach ($weaveriip_social_services as $service) { if ($i++ & 1) { $rowbg = '#eee'; } else { $rowbg = 'transparent'; } echo "<tr style=\"background:{$rowbg};\">\n"; $id = $service['icon']; if (!isset($soc[$id . '_use'])) { $soc[$id . '_use'] = ''; } if (!isset($soc[$id . '_url'])) { $soc[$id . '_url'] = ''; } if (!isset($soc[$id . '_order'])) { $soc[$id . '_order'] = ''; } if (!isset($soc[$id . '_hover'])) { $soc[$id . '_hover'] = ''; } if (!isset($soc[$id . '_stay'])) { $soc[$id . '_stay'] = ''; } if (!isset($soc[$id . '_custom'])) { $soc[$id . '_custom'] = ''; } ?> <td style="padding:5px;"> <input type="checkbox" name="<?php echo $id; ?> _use" id="<?php echo $id; ?> _use" <?php echo $soc[$id . '_use'] ? "checked" : ""; ?> /> </td> <td style="padding:5px;"> <input type="text" name="<?php echo $id; ?> _order" id="<?php echo $id; ?> _order" style="width:50px;height:20px;" class="regular-text" value="<?php weaverii_esc_textarea($soc[$id . '_order']); ?> " /> </td> <?php if ($service['icon'][0] == '_') { if ($soc[$id . '_custom'] == '') { $img = '<img src="' . apply_filters('weaverii-social-dir', $baseurl . 'includes/pro/social/1/') . 'button-white.png" height="28" width="28" alt="white button" />'; } else { $img = '<img src="' . $soc[$id . '_custom'] . '" height="28" width="28" alt="custom button" />'; } } else { $img = '<img src="' . apply_filters('weaverii-social-dir', $baseurl . 'includes/pro/social/1/') . $service['icon'] . '.png" height="28" width="28" alt="social button" />'; } if ($service['site'][0] == '#') { // special case - no link echo '<td style="padding:5px;">' . $img . '</td>' . "\n"; echo '<td style="width:340px;padding-left:10px; padding-right:10px;">'; ?> <input type="text" name="<?php echo $id; ?> _hover" id="<?php echo $id; ?> _hover" style="width:340px;height:20px;" class="regular-text" value="<?php weaverii_esc_textarea($soc[$id . '_hover']); ?> " /></td> <?php } else { echo '<td style="padding:5px;"><a href="http://' . $service['site'] . '" target="_blank">' . $img . '</td>' . "\n"; ?> <td style="width:340px;padding-left:10px; padding-right:10px;"><input type="text" name="<?php echo $id; ?> _hover" id="<?php echo $id; ?> _hover" style="width:340px;height:20px;" class="regular-text" value="<?php weaverii_esc_textarea($soc[$id . '_hover']); ?> " /></td> <?php // echo '<td style="width:340px;padding-left:10px; padding-right:10px;">' . $service['blurb'] . "</td>\n"; } ?> <td style="padding:5px;"> <?php if ($service['site'][0] == '#') { // special case - no link echo substr($service['site'], 1) . '<br />'; } ?> <input type="text" name="<?php echo $id; ?> _url" id="<?php echo $id; ?> _url" style="width:280px;height:20px;" class="regular-text" value="<?php weaverii_esc_textarea($soc[$id . '_url']); ?> " /> </td> <td style="padding:5px;"> <input type="checkbox" name="<?php echo $id; ?> _stay" id="<?php echo $id; ?> _stay" <?php echo $soc[$id . '_stay'] ? "checked" : ""; ?> /> </td> <?php if ($service['icon'][0] == '_') { echo "<tr style=\"background:{$rowbg};\">\n"; ?> <td colspan> </td><td colspan="2"><small>Custom Icon URL:</td><td style="width:340px;padding-left:10px; padding-right:10px;"> <input type="text" name="<?php echo $id; ?> _custom" id="<?php echo $id; ?> _custom" style="width:300px;" class="regular-text" value="<?php weaverii_esc_textarea($soc[$id . '_custom']); ?> " /><?php weaverii_media_lib_button($id . '_custom'); ?> </td><td> <small>Suggested size: 32x32 px</td></tr> <?php } echo "</tr>\n"; } // end foreach ?> </table> </div> <?php }
function weaveriip_header_add($i) { $opt_base = 'hdr_' . $i . '_'; if ($i & 1) { echo "<div style=\"width:99%;background:#eee;padding:4px;border-right:2px solid #eee;\">\n"; } else { echo "<div style=\"width:99%;padding:4px;border:1px solid #ddd;\">\n"; } ?> <strong><?php echo $i; ?> - </strong><em>Add item over header</em> <?php if (!weaverii_pro_getopt($opt_base . 'hidemobile') && weaverii_pro_getopt($opt_base . 'x') > 300 && weaverii_pro_getopt($opt_base . '_xunits') != '%') { echo ' <small style="color:red;font-weight:bold;padding-left:30px;">Warning: X position too far right for Mobile View. Recommend →</small>'; } else { echo '<span style="padding-right:200px;"> </span>'; } ?> <input type="checkbox" name="<?php echo $opt_base . 'hidemobile'; ?> " id="<?php echo $opt_base . 'hidemobile'; ?> " <?php echo weaverii_pro_getopt($opt_base . 'hidemobile'); ?> > <small>Hide if Phone or Small Tablet View.</small> <input type="checkbox" name="<?php echo $opt_base . 'hidetablet'; ?> " id="<?php echo $opt_base . 'hidetablet'; ?> " <?php echo weaverii_pro_getopt($opt_base . 'hidetablet'); ?> > <small>Hide if Large Tablet View.</small> <div style="margin-left:12px;"> <strong>X position: </strong> <input name="<?php echo $opt_base . 'x'; ?> " id="<?php echo $opt_base . 'x'; ?> " type="text" style="width:40px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'x')); ?> " /> <select id="<?php echo $opt_base . '_xunits'; ?> " name="<?php echo $opt_base . '_xunits'; ?> "> <?php $selected = weaverii_pro_getopt($opt_base . '_xunits'); echo '<option ' . ($selected == 'px' || $selected == '' ? 'selected="selected"' : '') . ' value="px">' . ' px ' . '</option>' . "\n"; echo '<option ' . ($selected == '%' ? 'selected="selected"' : '') . ' value="%">' . ' % ' . '</option>' . "\n"; ?> </select> <small>from left</small> <strong>Y position: </strong> <input name="<?php echo $opt_base . 'y'; ?> " id="<?php echo $opt_base . 'y'; ?> " type="text" style="width:40px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'y')); ?> " /> <select id="<?php echo $opt_base . '_yunits'; ?> " name="<?php echo $opt_base . '_yunits'; ?> "> <?php $selected = weaverii_pro_getopt($opt_base . '_yunits'); echo '<option ' . ($selected == 'px' || $selected == '' ? 'selected="selected"' : '') . ' value="px">' . ' px ' . '</option>' . "\n"; echo '<option ' . ($selected == '%' ? 'selected="selected"' : '') . ' value="%">' . ' % ' . '</option>' . "\n"; ?> </select> <small>from top</small> <strong><small>Show only on Page: </small></strong> <input name="<?php echo $opt_base . 'page'; ?> " id="<?php echo $opt_base . 'page'; ?> " type="text" style="width:80px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'page')); ?> " /> <small>Specify Page ID #, blank for all</small> <br /> <strong>Image URL:</strong> <input name="<?php echo $opt_base . 'img'; ?> " id="<?php echo $opt_base . 'img'; ?> " type="text" style="width:200px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'img')); ?> " /> <?php weaverii_media_lib_button($opt_base . 'img'); ?> <em>Image Title:</em> <input name="<?php echo $opt_base . 'imgalt'; ?> " id="<?php echo $opt_base . 'imgalt'; ?> " type="text" style="width:150px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'imgalt')); ?> " /> <small>Image URL and optional title attribute.</small> <br> <strong>Text:</strong> <input name="<?php echo $opt_base . 'text'; ?> " id="<?php echo $opt_base . 'text'; ?> " type="text" style="width:360px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'text')); ?> " /> <small>Arbitrary text, including HTML. Supports shortcodes.</small> <br /><strong>Extra CSS styling:</strong> <input name="<?php echo $opt_base . 'textstyle'; ?> " id="<?php echo $opt_base . 'textstyle'; ?> " type="text" style="width:180px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'textstyle')); ?> " /> <small>Optional CSS <em>styling</em> to wrap entire item (will be added in <span style="<em>styling</em>"> tag.).</small> <br> <strong>Link URL:</strong> <input name="<?php echo $opt_base . 'link'; ?> " id="<?php echo $opt_base . 'link'; ?> " type="text" style="width:200px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'link')); ?> " /> <em>Link Description:</em> <input name="<?php echo $opt_base . 'linkalt'; ?> " id="<?php echo $opt_base . 'linkalt'; ?> " type="text" style="width:150px;height:20px;" class="regular-text" value="<?php echo esc_textarea(weaverii_pro_getopt($opt_base . 'linkalt')); ?> " /> <input type="checkbox" name="<?php echo $opt_base . 'newpage'; ?> " id="<?php echo $opt_base . 'newpage'; ?> " <?php echo weaverii_pro_getopt($opt_base . 'newpage'); ?> > <small>New Page</small> <small> - Define if you want item to link.</small> <br /> </div> <?php echo "</div>\n"; }
function weaveriip_value_row($th, $id, $desc, $width = '') { $style = ''; if ($width != '') { $style = ' style="width:' . $width . ';"'; } ?> <tr> <th scope="row" align="right"<?php echo $style . '>' . $th; ?> : </th> <td> <input type="text" style="width:60px;height:22px;" class="regular-text" name="<?php echo $id; ?> " id="<?php echo $id; ?> " value="<?php weaverii_esc_textarea(weaverii_pro_getopt($id)); ?> " /> </td> <td style="padding-left: 10px"><small><?php echo $desc; ?> </small></td> </tr> <?php }
function weaveriip_slider_sform($i) { global $weaveriip_slider_opts; $sname = 'slider' . $i; if ($i & 1) { echo "<div style=\"width:99%;background:#eee;padding:4px;border-right:2px solid #eee;\">\n"; } else { echo "<div style=\"width:99%;padding:4px;border:1px solid #ddd;\">\n"; } $menus = get_terms('nav_menu', array('hide_empty' => false)); // get defined custom menus $menu_selected = weaverii_pro_isset($sname . '_menu') ? weaverii_pro_getopt($sname . '_menu') : ''; ?> <div><span style="color:blue;font-weight:bold;font-size:120%;">Slider <?php echo $i; ?> </span> <em>Shortcode:</em> <strong><code>[weaver_slider id=<?php echo $i; ?> ]</code></strong> | <em>Note (where used, for example):</em> <input name="<?php echo $sname; ?> _note" id="<?php echo $sname; ?> _note" type="text" style="width:250px;height:22px;" class="regular-text" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_note')); ?> " /> </div> <br /> <table class="optiontable"> <tr> <th scope="row" align="right" style="width:20%;">Select Menu: </th> <td> <?php // If no irect the user to go and create some. if (!$menus) { echo sprintf('No menus have been created yet. Please use <a href="$s">Appearance→Menus</a> to create some.', admin_url('nav-menus.php')); } else { ?> <select id="<?php echo $sname . '_menu'; ?> " name="<?php echo $sname . '_menu'; ?> "> <?php foreach ($menus as $menu) { $selected = $menu_selected == $menu->term_id ? ' selected="selected"' : ''; echo '<option' . $selected . ' value="' . $menu->term_id . '">' . $menu->name . '</option>' . "\n"; } } ?> </select> </td> <td style="padding-left: 10px"><small>Select a custom menu to use for this slider. Sub-menus are not supported!.</small></td> </tr> <tr> <th scope="row" align="right" style="width:20%;">Hide Menu Text: </th> <td> <input type="checkbox" name="<?php echo $sname; ?> _hidetext" id="<?php echo $sname; ?> _hidetext" <?php echo weaverii_pro_getopt($sname . '_hidetext') ? "checked" : ""; ?> /> </td> <td style="padding-left: 10px"><small>Hide standard Menu names over each image. Useful if your image contains the Menu name.</small></td> </tr> <tr> <th scope="row" align="right" style="width:20%;">Hide on Mobile View: </th> <td> <input type="checkbox" name="<?php echo $sname; ?> _hidemobile" id="<?php echo $sname; ?> _hidemobile" <?php echo weaverii_pro_getopt($sname . '_hidemobile') ? "checked" : ""; ?> /> </td> <td style="padding-left: 10px"><small>Hide this slider on all mobile devices. Useful in combination with Main Options: Header: Hide Header Image on Normal View to show alternate header on mobile devices.</small></td> </tr> <tr> <th scope="row" align="right" style="width:20%;">Auto-Hide Primary Menu: </th> <td> <input type="checkbox" name="<?php echo $sname; ?> _hidemenu" id="<?php echo $sname; ?> _hidemenu" <?php echo weaverii_pro_getopt($sname . '_hidemenu') ? "checked" : ""; ?> /> </td> <td style="padding-left: 10px"><small>Automatically hide Primary Menu on desktop or wide displays (slider on desktops, regular menu on mobile).</small></td> </tr> <tr> <th scope="row" align="right">Number of Images in Menu: </th> <td> <input name="<?php echo $sname; ?> _number_images" id="<?php echo $sname; ?> _number_images" type="text" style="width:60px;height:22px;" class="regular-text" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_number_images')); ?> " /> <td style="padding-left: 10px"><small>Number of Images in Menu (must be between 2 and 8). Default is 7.</small></td> </td> </tr> <tr> <th scope="row" align="right">Menu Width: </th> <td> <input name="<?php echo $sname; ?> _menu_width" id="<?php echo $sname; ?> _menu_width" type="text" style="width:60px;height:22px;" class="regular-text" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_menu_width')); ?> " /> <td style="padding-left: 10px"><small>Overall width of Slider Menu (in px). <em>(Typically matches image width for vertical menus, theme width for horizontal menus.)</em></small></td> </td> </tr> <tr> <th scope="row" align="right">Width of each image: </th> <td> <input name="<?php echo $sname; ?> _img_width" id="<?php echo $sname; ?> _img_width" type="text" style="width:60px;height:22px;" class="regular-text" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img_width')); ?> " /> <td style="padding-left: 10px"><small>Enter the width of each image (in px). For horizontal sliders, this will affect the exact look of the slider effect. The default 320 works well with 7 horizontal images. For vertical sliders, this will be the width of the slider. <em>Use 210 width for slider in text widget with default sidebar. (130 is good matching height.)</em></small></td> </td> </tr> <tr> <th scope="row" align="right">Height of each image: </th> <td> <input name="<?php echo $sname; ?> _img_height" id="<?php echo $sname; ?> _img_height" type="text" style="width:60px;height:22px;" class="regular-text" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img_height')); ?> " /> <td style="padding-left: 10px"><small>Enter the height of each image (in px). This will determine the height of your slider menu. Default is 200. Limits are 25 and 1000.</small></td> </td> </tr> <tr> <th scope="row" align="right" style="width:20%;">Vertical Menu: </th> <td> <input type="checkbox" name="<?php echo $sname; ?> _vertical" id="<?php echo $sname; ?> _vertical" <?php echo weaverii_pro_getopt($sname . '_vertical') ? "checked" : ""; ?> /> </td> <td style="padding-left: 10px"><small>Check for vertical menu.</small> <strong>|</strong> Compressed height for each image: <input name="<?php echo $sname; ?> _vert_compress" id="<?php echo $sname; ?> _vert_compress" type="text" style="width:40px;height:20px;" class="regular-text" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_vert_compress')); ?> " /> <small>This value, image height, and number of images interact to determine total height of vertical menu. Not used for horizontal menus.</small> </td> </tr> <tr> <th scope="row" align="right" style="width:20%;">Images Only, No Sliding: </th> <td> <input type="checkbox" name="<?php echo $sname; ?> _noeffects" id="<?php echo $sname; ?> _noeffects" <?php echo weaverii_pro_getopt($sname . '_noeffects') ? "checked" : ""; ?> /> </td> <td style="padding-left: 10px"><small>Disable sliding effects. You will get an image menu only. You will have to adjust image sizes to fit.</small> </td> </tr> <tr> <th scope="row" align="right">CSS for Menu Text: </th> <td> </td> <td> <span style="padding-left: 10px"><small>You can control the font characteristics of the Slider Menu Text by editing this CSS. (Clear to blank to restore defaults.)</small></span> <br /> <textarea name="<?php echo $sname; ?> _text_font" rows=2 style="width: 95%"><?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_text_font')); ?> </textarea> </td> </td> </tr> <tr> <th scope="row" align="right">Slider Menu CSS: </th> <td> </td> <td> <span style="padding-left: 10px"><small>Edit this CSS to change menu margins, etc. Use <code>border:0;</code> for no borders. Clear to blank to restore default.</small></span> <br /> <textarea name="<?php echo $sname; ?> _borders" rows=1 style="width: 95%"><?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_borders')); ?> </textarea> </td> </td> </tr> </table> <h3>Slider Image Locations</h3> <p> Specify URLs for images for the menu. Each image should be <?php echo weaveriip_default_int(weaverii_pro_getopt($sname . '_img_height'), 25, 1024, 200); ?> px high and <?php echo weaveriip_default_int(weaverii_pro_getopt($sname . '_img_width'), 25, 1024, 320); ?> px wide. The most reliable place to keep your Slider images is in your Media Library. Click the small image icon to open the Medial Library selection dialog. Click "Insert into Post" to add URL. You can also enter any URL directly into the URL box below. If you have < 8 images, just leave the excess image links blank.</p> <table class="optiontable" style="padding-left:3%; padding-right:3%;"> <tr> <td> 1. Enter URL: <input type="text" name="<?php echo $sname; ?> _img1" id="<?php echo $sname; ?> _img1" size="55" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img1')); ?> " /><?php weaverii_media_lib_button($sname . '_img1'); ?> </td> <td> 2. Enter URL: <input type="text" name="<?php echo $sname; ?> _img2" id="<?php echo $sname; ?> _img2" size="55" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img2')); ?> " /><?php weaverii_media_lib_button($sname . '_img2'); ?> </td> </tr> <tr> <td> 3. Enter URL: <input type="text" name="<?php echo $sname; ?> _img3" id="<?php echo $sname; ?> _img3" size="55" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img3')); ?> " /><?php weaverii_media_lib_button($sname . '_img3'); ?> </td> <td> 4. Enter URL: <input type="text" name="<?php echo $sname; ?> _img4" id="<?php echo $sname; ?> _img4" size="55" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img4')); ?> " /><?php weaverii_media_lib_button($sname . '_img4'); ?> </td> </tr> <tr> <td> 5. Enter URL: <input type="text" name="<?php echo $sname; ?> _img5" id="<?php echo $sname; ?> _img5" size="55" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img5')); ?> " /><?php weaverii_media_lib_button($sname . '_img5'); ?> </td> <td> 6. Enter URL: <input type="text" name="<?php echo $sname; ?> _img6" id="<?php echo $sname; ?> _img6" size="55" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img6')); ?> " /><?php weaverii_media_lib_button($sname . '_img6'); ?> </td> </tr> <tr> <td> 7. Enter URL: <input type="text" name="<?php echo $sname; ?> _img7" id="<?php echo $sname; ?> _img7" size="55" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img7')); ?> " /><?php weaverii_media_lib_button($sname . '_img7'); ?> </td> <td> 8. Enter URL: <input type="text" name="<?php echo $sname; ?> _img8" id="<?php echo $sname; ?> _img8" size="55" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($sname . '_img8')); ?> " /><?php weaverii_media_lib_button($sname . '_img8'); ?> </td> </tr> </table> <input class="button-primary" type="submit" name="weaverii_pro_save_pro" value="Save Slider Options"/> </div> <?php }
function weaveriip_sc_add($i) { $opt_base = 'wvpsc_' . $i . '_'; if ($i & 1) { echo "<div style=\"width:99%;background:#eee;padding:4px;border-right:2px solid #eee;\">\n"; } else { echo "<div style=\"width:99%;padding:4px;border:1px solid #ddd;\">\n"; } ?> <strong><em>Define Custom Shortcode</em></strong> <?php if (weaverii_pro_getopt($opt_base . 'id') != '') { echo ' To use, add <code>[weaver_sc id="' . trim(weaverii_pro_getopt($opt_base . 'id')) . '"]</code> wherever shortcodes are supported.'; } ?> <br /><div style="margin-left:12px;"> <strong>Shortcode ID:</strong> <input name="<?php echo $opt_base . 'id'; ?> " id="<?php echo $opt_base . 'id'; ?> " type="text" style="width:100px;height:20px;" class="regular-text" value="<?php weaverii_esc_textarea(weaverii_pro_getopt($opt_base . 'id')); ?> " /> <small>Enter an ID name for your shortcode - your choice (will be filtered to valid format)</small><br /> <strong>Shortcode definition:</strong><br /> <textarea name="<?php echo $opt_base . 'text'; ?> " rows=4 style="width: 600px"><?php weaverii_esc_textarea(weaverii_pro_getopt($opt_base . 'text')); ?> </textarea> <br> </div> <?php echo "</div>\n"; }
function weaveriip_buttons_generate_code($start = 1, $end = 64, $list = '') { if (!weaverii_pro_isset('buttons')) { return 'No buttons defined.'; } $buttons = weaverii_pro_getopt('buttons'); $maxbuttons = $buttons['maxbuttons']; $out = ''; if ($start < 1) { $start = 1; } // stay sane if ($end > $maxbuttons) { $end = $maxbuttons; } $out .= '<div class="weaver-buttons">'; if ($list != '') { // list specified - it has priority $list_vals = explode(',', trim($list)); foreach ($list_vals as $item) { $out .= weaveriip_buttons_button($buttons, trim($item)); } } else { // start:end for ($i = $start; $i <= $end; $i++) { $out .= weaveriip_buttons_button($buttons, $i); } // end for } $out .= '</div>' . "\n"; return $out; }
function weaveriip_totalcss_output_style($sout) { if (!weaverii_pro_isset('wvp_css')) { weaveriip_totalcss_init(); } weaverii_f_write($sout, "/* Weaver II Pro Total CSS */\n"); global $weaveriip_css; foreach ($weaveriip_css as $option => $val) { $css = weaverii_pro_getopt($val['id']); if ($css) { weaverii_f_write($sout, $val['tag'] . $css . "\n"); } } }