Пример #1
0
    public function form($instance)
    {
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $link = isset($instance['link']) ? esc_attr($instance['link']) : '';
        $background = isset($instance['background']) ? esc_attr($instance['background']) : '';
        $iconbackground = isset($instance['iconbackground']) ? esc_attr($instance['iconbackground']) : '#444444';
        $color = isset($instance['color']) ? esc_attr($instance['color']) : '#ffffff';
        $tcolor = isset($instance['tcolor']) ? esc_attr($instance['tcolor']) : '';
        $size = isset($instance['size']) ? esc_attr($instance['size']) : '28';
        if (isset($instance['info_icon'])) {
            $info_icon = esc_attr($instance['info_icon']);
        } else {
            $info_icon = '';
        }
        $image_uri = isset($instance['image_uri']) ? esc_attr($instance['image_uri']) : '';
        if (isset($instance['style'])) {
            $style = esc_attr($instance['style']);
        } else {
            $style = 'kad-circle-iconclass';
        }
        $icon_style_array = array();
        $icon_array = array();
        $icon_style_options = array(array("slug" => "kt-none", "name" => __('None', 'pinnacle')), array("slug" => "kad-circle-iconclass", "name" => __('Circle', 'pinnacle')), array("slug" => "kad-square-iconclass", "name" => __('Square', 'pinnacle')));
        $icons = kad_icon_list();
        foreach ($icons as $icon) {
            if ($info_icon == $icon) {
                $selected = ' selected="selected"';
            } else {
                $selected = "";
            }
            $icon_array[] = '<option value="' . $icon . '"' . $selected . '>' . $icon . '</option>';
        }
        foreach ($icon_style_options as $icon_style_option) {
            if ($style == $icon_style_option['slug']) {
                $selected = ' selected="selected"';
            } else {
                $selected = "";
            }
            $icon_style_array[] = '<option value="' . $icon_style_option['slug'] . '"' . $selected . '>' . $icon_style_option['name'] . '</option>';
        }
        ?>
  

    <div id="kadence_infobox_widget<?php 
        echo esc_attr($this->get_field_id('container'));
        ?>
" class="kad_img_upload_widget kad_infobox_widget">
            <p>
                <label for="<?php 
        echo $this->get_field_id('info_icon');
        ?>
"><?php 
        _e('Choose an Icon', 'pinnacle');
        ?>
</label><br />
                <select id="<?php 
        echo $this->get_field_id('info_icon');
        ?>
" class="kad_icomoon" name="<?php 
        echo $this->get_field_name('info_icon');
        ?>
"><?php 
        echo implode('', $icon_array);
        ?>
</select>
            </p>
            <p>
            <img class="kad_custom_media_image" src="<?php 
        if (!empty($instance['image_uri'])) {
            echo $instance['image_uri'];
        }
        ?>
" style="margin:0;padding:0;max-width:100px;display:block" />
            </p>
            <p>
                <label for="<?php 
        echo $this->get_field_id('image_uri');
        ?>
"><?php 
        _e('Or upload a custom icon', 'pinnacle');
        ?>
</label><br />
                <input type="text" class="widefat kad_custom_media_url" name="<?php 
        echo $this->get_field_name('image_uri');
        ?>
" id="<?php 
        echo $this->get_field_id('image_uri');
        ?>
" value="<?php 
        echo $image_uri;
        ?>
">
                <input type="button" value="<?php 
        _e('Upload', 'pinnacle');
        ?>
" class="button kad_custom_media_upload" id="kad_custom_image_uploader" />
            </p>
            <p>
            <label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title:', 'pinnacle');
        ?>
</label>
            <input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
" />
            </p>
             <p>
              <label for="<?php 
        echo $this->get_field_id('description');
        ?>
"><?php 
        _e('Description', 'pinnacle');
        ?>
</label><br />
              <textarea name="<?php 
        echo $this->get_field_name('description');
        ?>
" style="min-height: 100px;" id="<?php 
        echo $this->get_field_id('description');
        ?>
" class="widefat" ><?php 
        if (!empty($instance['description'])) {
            echo $instance['description'];
        }
        ?>
</textarea>
            </p>
            <p>
                <label for="<?php 
        echo $this->get_field_id('background');
        ?>
"><?php 
        _e('Box Background Color (e.g. = #f2f2f2)', 'pinnacle');
        ?>
</label><br />
                <input type="text" class="widefat kad-widget-colorpicker" style="width: 70px;"  name="<?php 
        echo $this->get_field_name('background');
        ?>
" id="<?php 
        echo $this->get_field_id('background');
        ?>
" value="<?php 
        echo $background;
        ?>
">
            </p>
            <p>
                <label for="<?php 
        echo $this->get_field_id('tcolor');
        ?>
"><?php 
        _e('Text Color (e.g. = #444444)', 'pinnacle');
        ?>
</label><br />
                <input type="text" class="widefat kad-widget-colorpicker" style="width: 70px;"  name="<?php 
        echo $this->get_field_name('tcolor');
        ?>
" id="<?php 
        echo $this->get_field_id('tcolor');
        ?>
" value="<?php 
        echo $tcolor;
        ?>
">
            </p>
            <p>
                <label for="<?php 
        echo $this->get_field_id('size');
        ?>
"><?php 
        _e('Icon Size (e.g. = 28)', 'pinnacle');
        ?>
</label><br />
                <input type="number" class="widefat kad_img_widget_link" name="<?php 
        echo $this->get_field_name('size');
        ?>
" id="<?php 
        echo $this->get_field_id('size');
        ?>
" value="<?php 
        echo $size;
        ?>
">
            </p>
            <p>
                <label for="<?php 
        echo $this->get_field_id('style');
        ?>
"><?php 
        _e('Icon Style', 'pinnacle');
        ?>
</label><br />
                <select id="<?php 
        echo $this->get_field_id('style');
        ?>
" style="width:100%; max-width:230px;" name="<?php 
        echo $this->get_field_name('style');
        ?>
"><?php 
        echo implode('', $icon_style_array);
        ?>
</select>
            </p>
            <p>
                <label for="<?php 
        echo $this->get_field_id('iconbackground');
        ?>
"><?php 
        _e('Icon Background Color (e.g. = #444444)', 'pinnacle');
        ?>
</label><br />
                <input type="text" class="widefat kad-widget-colorpicker" style="width: 70px;"  name="<?php 
        echo $this->get_field_name('iconbackground');
        ?>
" id="<?php 
        echo $this->get_field_id('iconbackground');
        ?>
" value="<?php 
        echo $iconbackground;
        ?>
">
            </p>
            <p>
                <label for="<?php 
        echo $this->get_field_id('color');
        ?>
"><?php 
        _e('Icon Color (e.g. = #f2f2f2)', 'pinnacle');
        ?>
</label><br />
                <input type="text" class="widefat kad-widget-colorpicker" style="width: 70px;"  name="<?php 
        echo $this->get_field_name('color');
        ?>
" id="<?php 
        echo $this->get_field_id('color');
        ?>
" value="<?php 
        echo $color;
        ?>
">
            </p>
            <p>
            <label for="<?php 
        echo $this->get_field_id('link');
        ?>
"><?php 
        _e('Link:', 'pinnacle');
        ?>
</label>
            <input class="widefat" id="<?php 
        echo $this->get_field_id('link');
        ?>
" name="<?php 
        echo $this->get_field_name('link');
        ?>
" type="text" value="<?php 
        echo $link;
        ?>
" />
            </p>

    </div>
<?php 
    }
Пример #2
0
function kad_shortcode_content()
{
    //Columns
    $virtue_shortcodes['columns'] = array('title' => __('Columns', 'virtue'), 'attr' => array('columns' => array('type' => 'radio', 'title' => __('Columns', 'virtue'), 'values' => array("span6" => '<img src="' . get_template_directory_uri() . '/assets/img/twocolumn.jpg" />' . __("Two Columns", "virtue"), "span4right" => '<img src="' . get_template_directory_uri() . '/assets/img/twocolumnright.jpg" />' . __("Two Columns offset Right", "virtue"), "span4left" => '<img src="' . get_template_directory_uri() . '/assets/img/twocolumnleft.jpg" />' . __("Two Columns offset Left", "virtue"), "span4" => '<img src="' . get_template_directory_uri() . '/assets/img/threecolumn.jpg" />' . __("Three Columns", "virtue"), "span3" => '<img src="' . get_template_directory_uri() . '/assets/img/fourcolumn.jpg" />' . __("Four Columns", "virtue")))));
    // Divider
    $virtue_shortcodes['hr'] = array('title' => __('Divider', 'virtue'), 'attr' => array('style' => array('type' => 'select', 'title' => __('Style', 'virtue'), 'default' => 'line', 'values' => array("line" => __("Line", "virtue"), "dots" => __("Dots", "virtue"), "gradient" => __("Gradient", "virtue"))), 'size' => array('type' => 'select', 'title' => __('Size', 'virtue'), 'default' => '1px', 'values' => array("1px" => "1px", "2px" => "2px", "3px" => "3px", "4px" => "4px", "5px" => "5px")), 'color' => array('type' => 'color', 'title' => __('Color', 'virtue'))));
    // Spacer
    $virtue_shortcodes['space'] = array('title' => __('Spacing', 'virtue'), 'attr' => array('size' => array('type' => 'select', 'title' => __('Size', 'virtue'), 'default' => '10px', 'values' => array("10px" => "10px", "20px" => "20px", "30px" => "30px", "40px" => "40px", "50px" => "50px"))));
    // Spacer
    $virtue_shortcodes['tabs'] = array('title' => __('Tabs', 'virtue'));
    $virtue_shortcodes['accordion'] = array('title' => __('Accordion', 'virtue'));
    $virtue_shortcodes['pullquote'] = array('title' => __('Pull-Quotes', 'virtue'), 'attr' => array('align' => array('type' => 'select', 'title' => __('Align', 'virtue'), 'default' => 'center', 'values' => array("center" => __('Center', 'virtue'), "left" => __('Left', 'virtue'), "right" => __('Right', 'virtue'))), 'content' => array('type' => 'textarea', 'title' => __('Pull-Quote Text', 'virtue'))));
    $virtue_shortcodes['blockquote'] = array('title' => __('Block-Quotes', 'virtue'), 'attr' => array('align' => array('type' => 'select', 'title' => __('Align', 'virtue'), 'default' => 'center', 'values' => array("center" => __('Center', 'virtue'), "left" => __('Left', 'virtue'), "right" => __('Right', 'virtue'))), 'content' => array('type' => 'textarea', 'title' => __('Block-Quote Text', 'virtue'))));
    $virtue_shortcodes['kt_box'] = array('title' => __('Simple Box', 'virtue'), 'attr' => array('padding_top' => array('type' => 'text', 'title' => __('Padding Top (just a number)', 'virtue'), 'default' => '15'), 'padding_bottom' => array('type' => 'text', 'title' => __('Padding Bottom (just a number)', 'virtue'), 'default' => '15'), 'padding_left' => array('type' => 'text', 'title' => __('Padding Left (just a number)', 'virtue'), 'default' => '15'), 'padding_right' => array('type' => 'text', 'title' => __('Padding Right (just a number)', 'virtue'), 'default' => '15'), 'min_height' => array('type' => 'text', 'title' => __('Min Height (just a number)', 'virtue'), 'default' => '0'), 'background' => array('type' => 'color', 'title' => __('Background Color', 'virtue'), 'default' => ''), 'opacity' => array('type' => 'select', 'title' => __('Background Color Opacity', 'virtue'), 'default' => '1', 'values' => array("1" => __('1.0', 'virtue'), "0.9" => __('0.9', 'virtue'), "0.8" => __('0.8', 'virtue'), "0.7" => __('0.7', 'virtue'), "0.6" => __('0.6', 'virtue'), "0.5" => __('0.5', 'virtue'), "0.4" => __('0.4', 'virtue'), "0.3" => __('0.3', 'virtue'), "0.2" => __('0.2', 'virtue'), "0.1" => __('0.1', 'virtue'), "0.0" => __('0.0', 'virtue'))), 'content' => array('type' => 'textarea', 'title' => __('Content Text', 'virtue'))));
    $icons = kad_icon_list();
    //Button
    $virtue_shortcodes['btn'] = array('title' => __('Button', 'virtue'), 'attr' => array('text' => array('type' => 'text', 'title' => __('Button Text', 'virtue')), 'target' => array('type' => 'checkbox', 'title' => __('Open Link In New Tab?', 'virtue')), 'tcolor' => array('type' => 'color', 'title' => __('Font Color', 'virtue'), 'default' => '#ffffff'), 'bcolor' => array('type' => 'color', 'title' => __('Button Background Color', 'virtue'), 'default' => ''), 'thovercolor' => array('type' => 'color', 'title' => __('Font Hover Color', 'virtue'), 'default' => '#ffffff'), 'bhovercolor' => array('type' => 'color', 'title' => __('Button Background Hover Color', 'virtue'), 'default' => ''), 'link' => array('type' => 'text', 'title' => __('Link URL', 'virtue')), 'size' => array('type' => 'select', 'title' => __('Button Size', 'virtue'), 'default' => '', 'values' => array("" => __('Default', 'virtue'), "large" => __('Large', 'virtue'), "small" => __('Small', 'virtue'))), 'font' => array('type' => 'select', 'title' => __('Font Family', 'virtue'), 'default' => '', 'values' => array("" => __('Default', 'virtue'), "h1-family" => __('H1 Family', 'virtue'))), 'icon' => array('type' => 'icon-select', 'title' => __('Choose an Icon (optional)', 'virtue'), 'values' => $icons)));
    $virtue_shortcodes['gmap'] = array('title' => __('Google Map', 'virtue'), 'attr' => array('address' => array('type' => 'text', 'title' => __('Address One', 'virtue')), 'title' => array('type' => 'text', 'title' => __('Address Title One', 'virtue'), 'desc' => __('Displays in Popup e.g. = Business Name', 'virtue')), 'height' => array('type' => 'text', 'title' => __('Map Height', 'virtue'), 'desc' => __('Just a number e.g. = 400', 'virtue')), 'zoom' => array('type' => 'select', 'title' => __('Map Zoom', 'virtue'), 'default' => '15', 'values' => array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10", "11" => "11", "12" => "12", "13" => "13", "14" => "14", "15" => "15", "16" => "16", "17" => "17", "18" => "18", "19" => "19", "20" => "20")), 'maptype' => array('type' => 'select', 'title' => __('Map Type', 'virtue'), 'default' => 'ROADMAP', 'values' => array("ROADMAP" => __('ROADMAP', 'virtue'), "HYBRID" => __('HYBRID', 'virtue'), "TERRAIN" => __('TERRAIN', 'virtue'), "SATELLITE" => __('SATELLITE', 'virtue'))), 'address2' => array('type' => 'text', 'title' => __('Address Two', 'virtue')), 'title2' => array('type' => 'text', 'title' => __('Address Title Two', 'virtue'), 'desc' => __('Displays in Popup e.g. = Business Name', 'virtue')), 'address3' => array('type' => 'text', 'title' => __('Address Three', 'virtue')), 'title3' => array('type' => 'text', 'title' => __('Address Title Three', 'virtue'), 'desc' => __('Displays in Popup e.g. = Business Name', 'virtue')), 'address4' => array('type' => 'text', 'title' => __('Address Four', 'virtue')), 'title4' => array('type' => 'text', 'title' => __('Address Title Four', 'virtue'), 'desc' => __('Displays in Popup e.g. = Business Name', 'virtue')), 'center' => array('type' => 'text', 'title' => __('Map Center', 'virtue'), 'desc' => __('Defaults to Address One', 'virtue'))));
    $virtue_shortcodes['icon'] = array('title' => __('Icon', 'virtue'), 'attr' => array('icon' => array('type' => 'icon-select', 'title' => __('Choose an Icon', 'virtue'), 'values' => $icons), 'size' => array('type' => 'select', 'title' => __('Icon Size', 'virtue'), 'default' => '14px', 'values' => array("5px" => "5px", "6px" => "6px", "7px" => "7px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "13px" => "13px", "14px" => "14px", "15px" => "15px", "16px" => "16px", "17px" => "17px", "18px" => "18px", "19px" => "19px", "20px" => "20px", "21px" => "21px", "22px" => "22px", "23px" => "23px", "24px" => "24px", "25px" => "25px", "26px" => "26px", "27px" => "27px", "28px" => "28px", "29px" => "29px", "30px" => "30px", "31px" => "31px", "32px" => "32px", "33px" => "33px", "34px" => "34px", "35px" => "35px", "36px" => "36px", "37px" => "37px", "38px" => "38px", "39px" => "39px", "40px" => "40px", "41px" => "41px", "42px" => "42px", "43px" => "43px", "44px" => "44px", "45px" => "45px", "46px" => "46px", "47px" => "47px", "48px" => "48px", "49px" => "49px", "50px" => "50px", "51px" => "51px", "52px" => "52px", "53px" => "53px", "54px" => "54px", "55px" => "55px", "56px" => "56px", "57px" => "57px", "58px" => "58px", "59px" => "59px", "60px" => "60px", "61px" => "61px", "62px" => "62px", "63px" => "63px", "64px" => "64px", "65px" => "65px", "66px" => "66px", "67px" => "67px", "68px" => "68px", "69px" => "69px", "70px" => "70px", "71px" => "71px", "72px" => "72px", "73px" => "73px", "74px" => "74px", "75px" => "75px", "76px" => "76px", "77px" => "77px", "78px" => "78px", "79px" => "79px", "80px" => "80px")), 'color' => array('type' => 'color', 'title' => __('Icon Color', 'virtue'), 'default' => ''), 'float' => array('type' => 'select', 'title' => __('Icon Float', 'virtue'), 'default' => '', 'values' => array("" => "none", "left" => "Left", "right" => "Right")), 'style' => array('type' => 'select', 'title' => __('Icon Style', 'virtue'), 'default' => '', 'values' => array("" => "none", "circle" => __('Circle', 'virtue'), "smcircle" => __('Small Circle', 'virtue'), "square" => __('Square', 'virtue'), "smsquare" => __('Small Square', 'virtue'))), 'background' => array('type' => 'color', 'title' => __('Background Color', 'virtue'), 'default' => '')));
    $virtue_shortcodes['iconbox'] = array('title' => __('Icon Box', 'virtue'), 'attr' => array('icon' => array('type' => 'icon-select', 'title' => __('Choose an Icon', 'virtue'), 'values' => $icons), 'iconsize' => array('type' => 'select', 'title' => __('Icon Size', 'virtue'), 'default' => '48px', 'values' => array("5px" => "5px", "6px" => "6px", "7px" => "7px", "8px" => "8px", "9px" => "9px", "10px" => "10px", "11px" => "11px", "12px" => "12px", "13px" => "13px", "14px" => "14px", "15px" => "15px", "16px" => "16px", "17px" => "17px", "18px" => "18px", "19px" => "19px", "20px" => "20px", "21px" => "21px", "22px" => "22px", "23px" => "23px", "24px" => "24px", "25px" => "25px", "26px" => "26px", "27px" => "27px", "28px" => "28px", "29px" => "29px", "30px" => "30px", "31px" => "31px", "32px" => "32px", "33px" => "33px", "34px" => "34px", "35px" => "35px", "36px" => "36px", "37px" => "37px", "38px" => "38px", "39px" => "39px", "40px" => "40px", "41px" => "41px", "42px" => "42px", "43px" => "43px", "44px" => "44px", "45px" => "45px", "46px" => "46px", "47px" => "47px", "48px" => "48px", "49px" => "49px", "50px" => "50px", "51px" => "51px", "52px" => "52px", "53px" => "53px", "54px" => "54px", "55px" => "55px", "56px" => "56px", "57px" => "57px", "58px" => "58px", "59px" => "59px", "60px" => "60px", "61px" => "61px", "62px" => "62px", "63px" => "63px", "64px" => "64px", "65px" => "65px", "66px" => "66px", "67px" => "67px", "68px" => "68px", "69px" => "69px", "70px" => "70px", "71px" => "71px", "72px" => "72px", "73px" => "73px", "74px" => "74px", "75px" => "75px", "76px" => "76px", "77px" => "77px", "78px" => "78px", "79px" => "79px", "80px" => "80px")), 'color' => array('type' => 'color', 'title' => __('Icon/Font Color', 'virtue'), 'default' => '#ffffff'), 'background' => array('type' => 'color', 'title' => __('Background Color', 'virtue'), 'default' => '#dddddd'), 'hcolor' => array('type' => 'color', 'title' => __('Hover Icon/Font Color', 'virtue'), 'default' => '#ffffff'), 'hbackground' => array('type' => 'color', 'title' => __('Hover Background Color', 'virtue'), 'default' => ''), 'link' => array('type' => 'text', 'title' => __('Link URL', 'virtue')), 'title' => array('type' => 'text', 'title' => __('Title', 'virtue')), 'description' => array('type' => 'textarea', 'title' => __('Description', 'virtue'))));
    $virtue_shortcodes['kad_youtube'] = array('title' => __('YouTube', 'virtue'), 'attr' => array('url' => array('type' => 'text', 'title' => __('Video URL', 'virtue')), 'width' => array('type' => 'text', 'title' => __('Video Width', 'virtue'), 'desc' => __('Just a number e.g. = 600', 'virtue')), 'height' => array('type' => 'text', 'title' => __('Video Height', 'virtue'), 'desc' => __('Just a number e.g. = 400', 'virtue')), 'maxwidth' => array('type' => 'text', 'title' => __('Video Max Width', 'virtue'), 'desc' => __('Keeps the responsive video from getting too large', 'virtue')), 'hidecontrols' => array('type' => 'checkbox', 'title' => __('Hide Controls', 'virtue')), 'autoplay' => array('type' => 'checkbox', 'title' => __('Auto Play', 'virtue')), 'rel' => array('type' => 'checkbox', 'title' => __('Show Related', 'pinnacle')), 'modestbranding' => array('type' => 'checkbox', 'title' => __('Modest Branding?', 'virtue'))));
    $virtue_shortcodes['kad_vimeo'] = array('title' => __('Vimeo', 'virtue'), 'attr' => array('url' => array('type' => 'text', 'title' => __('Video URL', 'virtue')), 'width' => array('type' => 'text', 'title' => __('Video Width', 'virtue'), 'desc' => __('Just a number e.g. = 600', 'virtue')), 'height' => array('type' => 'text', 'title' => __('Video Height', 'virtue'), 'desc' => __('Just a number e.g. = 400', 'virtue')), 'maxwidth' => array('type' => 'text', 'title' => __('Video Max Width', 'virtue'), 'desc' => __('Keeps the responsive video from getting too large', 'virtue')), 'autoplay' => array('type' => 'checkbox', 'title' => __('Auto Play', 'virtue'))));
    $postcategories = get_categories();
    $cat_options = array();
    $cat_options = array("" => "All");
    foreach ($postcategories as $cat) {
        $cat_options[$cat->slug] = $cat->name;
    }
    $virtue_shortcodes['blog_posts'] = array('title' => __('Blog Posts', 'virtue'), 'attr' => array('orderby' => array('type' => 'select', 'title' => __('Order By', 'virtue'), 'default' => 'date', 'values' => array("date" => __('Date', 'virtue'), "rand" => __('Random', 'virtue'), "menu_order" => __('Menu Order', 'virtue'))), 'cat' => array('type' => 'select', 'default' => '', 'title' => __('Category', 'virtue'), 'values' => $cat_options), 'items' => array('type' => 'text', 'title' => __('Number of Posts', 'virtue'))));
    //Button
    $virtue_shortcodes['kad_modal'] = array('title' => __('Modal', 'virtue'), 'attr' => array('btntitle' => array('type' => 'text', 'title' => __('Button Title', 'virtue')), 'btncolor' => array('type' => 'color', 'title' => __('Button Font Color', 'virtue'), 'default' => '#ffffff'), 'btnbackground' => array('type' => 'color', 'title' => __('Button Background Color', 'virtue'), 'default' => ''), 'btnsize' => array('type' => 'select', 'title' => __('Button Size', 'virtue'), 'default' => '', 'values' => array("" => __('Default', 'virtue'), "large" => __('Large', 'virtue'), "small" => __('Small', 'virtue'))), 'btnfont' => array('type' => 'select', 'title' => __('Font Family', 'virtue'), 'default' => '', 'values' => array("" => __('Default', 'virtue'), "h1-family" => __('H1 Family', 'virtue'))), 'title' => array('type' => 'text', 'title' => __('Modal Title', 'virtue')), 'content' => array('type' => 'textarea', 'title' => __('Modal Content', 'virtue'))));
    $virtue_shortcodes['kad_testimonial_form'] = array('title' => __('Testimonial Form', 'virtue'), 'attr' => array('location' => array('type' => 'checkbox', 'title' => __('Show Location Field?', 'virtue')), 'position' => array('type' => 'checkbox', 'title' => __('Show Position Field?', 'virtue')), 'link' => array('type' => 'checkbox', 'title' => __('Show Link Field?', 'virtue')), 'name_label' => array('type' => 'text', 'title' => __('Name Field Label', 'virtue'), 'desc' => __('Default: Name', 'virtue')), 'testimonial_label' => array('type' => 'text', 'title' => __('Testimonial Field Label', 'virtue'), 'desc' => __('Default: Testimonial', 'virtue')), 'location_label' => array('type' => 'text', 'title' => __('Location Field Label', 'virtue'), 'desc' => __('Default: Location - Optional', 'virtue')), 'position_label' => array('type' => 'text', 'title' => __('Position Field Label', 'virtue'), 'desc' => __('Default: Position or Company - optional', 'virtue')), 'link_label' => array('type' => 'text', 'title' => __('Link Field Label', 'virtue'), 'desc' => __('Default: Link - optional', 'virtue')), 'submit_label' => array('type' => 'text', 'title' => __('Submit Field Label', 'virtue'), 'desc' => __('Default: Submit', 'virtue')), 'success_message' => array('type' => 'text', 'title' => __('Success Message', 'virtue'), 'desc' => __('Default: Thank you for submitting your testimonial! It is now awaiting approval from the site admnistator. Thank you!', 'virtue'))));
    ob_start();
    ?>
	<div id="kadence-shortcode-container">
		<div id="kadence-shortcode-innercontainer" class="mfp-hide mfp-with-anim">
		 	<div class="kadenceshortcode-content">
		 		<div class="shortcodes-header">
					<div class="kadshort-header"><h3><?php 
    echo __('Virtue Shortcodes', 'virtue');
    ?>
</h3></div>
					<div class="kadshort-select"><select id="kadence-shortcodes" data-placeholder="<?php 
    _e("Choose a shortcode", 'virtue');
    ?>
">
				    <option></option>
					
					<?php 
    $kad_sc_html = '';
    $kad_options_html = '';
    foreach ($virtue_shortcodes as $shortcode => $options) {
        $kad_sc_html .= '<option value="' . $shortcode . '">' . $options['title'] . '</option>';
        $kad_options_html .= '<div class="shortcode-options" id="options-' . $shortcode . '" data-name="' . $shortcode . '">';
        if (!empty($options['attr'])) {
            foreach ($options['attr'] as $name => $attr_option) {
                $kad_options_html .= virtue_shortcode_option($name, $attr_option, $shortcode);
            }
        }
        $kad_options_html .= '</div>';
    }
    $kad_sc_html .= '</select></div></div>';
    echo $kad_sc_html . $kad_options_html;
    ?>

 				
			<div class="kad_shortcode_insert">	
				<a href="javascript:void(0);" id="kad-shortcode-insert" class="kad-addshortcode-btn" style=""><?php 
    _e("Add Shortcode", "virtue");
    ?>
</a>
			</div>
	</div> 
	</div>
	</div>
<?php 
    $output = ob_get_contents();
    ob_end_clean();
    echo $output;
}
Пример #3
0
 /**
  * Field Render Function.
  *
  * Takes the vars and outputs the HTML for the field in the settings
  *
  * @since       1.0.0
  * @access      public
  * @return      void
  */
 public function render()
 {
     $defaults = array('show' => array('title' => true, 'description' => true, 'url' => true), 'content_title' => __('Icon', 'pinnacle'));
     $this->field = wp_parse_args($this->field, $defaults);
     echo '<div class="redux-slides-accordion" data-new-content-title="' . esc_attr(sprintf(__('New %s', 'pinnacle'), $this->field['content_title'])) . '">';
     $x = 0;
     $multi = isset($this->field['multi']) && $this->field['multi'] ? ' multiple="multiple"' : "";
     if (isset($this->value) && is_array($this->value)) {
         $slides = $this->value;
         foreach ($slides as $slide) {
             if (empty($slide)) {
                 continue;
             }
             $defaults = array('icon_o' => '', 'title' => '', 'description' => '', 'sort' => '', 'target' => '', 'link' => '', 'url' => '', 'thumb' => '', 'image' => '', 'attachment_id' => '', 'height' => '', 'width' => '', 'select' => array());
             $slide = wp_parse_args($slide, $defaults);
             if (empty($slide['url']) && !empty($slide['attachment_id'])) {
                 $img = wp_get_attachment_image_src($slide['attachment_id'], 'full');
                 $slide['url'] = $img[0];
                 $slide['width'] = $img[1];
                 $slide['height'] = $img[2];
             }
             echo '<div class="redux-slides-accordion-group"><fieldset class="redux-field" data-id="' . $this->field['id'] . '"><h3><span class="redux-slides-header">' . $slide['title'] . '</span></h3><div>';
             $hide = '';
             if (empty($slide['url'])) {
                 $hide = ' hide';
             }
             echo '<div class="screenshot' . $hide . '">';
             echo '<a class="of-uploaded-image" href="' . $slide['url'] . '">';
             echo '<img class="redux-slides-image" id="image_image_id_' . $x . '" src="' . $slide['thumb'] . '" alt="" target="_blank" rel="external" />';
             echo '</a>';
             echo '</div>';
             echo '<div class="redux_slides_add_remove">';
             echo '<span class="button media_upload_button" id="add_' . $x . '">' . __('Upload Icon', 'pinnacle') . '</span>';
             $hide = '';
             if (empty($slide['url']) || $slide['url'] == '') {
                 $hide = ' hide';
             }
             echo '<span class="button remove-image' . $hide . '" id="reset_' . $x . '" rel="' . $slide['attachment_id'] . '">' . __('Remove', 'pinnacle') . '</span>';
             echo '</div>' . "\n";
             $icon_option = kad_icon_list();
             $placeholder = isset($this->field['placeholder']['icon_o']) ? esc_attr($this->field['placeholder']['icon_o']) : __('Select an Icon', 'pinnacle');
             if (isset($this->field['select2'])) {
                 // if there are any let's pass them to js
                 $select2_params = json_encode(esc_attr($this->field['select2']));
                 $select2_params = htmlspecialchars($select2_params, ENT_QUOTES);
                 echo '<input type="hidden" class="select2_params" value="' . $select2_params . '">';
             }
             echo '<select id="' . $this->field['id'] . '-icon_o" data-placeholder="' . $placeholder . '" name="' . $this->field['name'] . '[' . $x . '][icon_o]" class="redux-select-item font-icons ' . $this->field['class'] . '" rows="6" style="width:93%;">';
             echo '<option></option>';
             foreach ($icon_option as $k => $v) {
                 if (is_array($slide['icon_o'])) {
                     $selected = is_array($slide['icon_o']) && in_array($k, $slide['icon_o']) ? ' selected="selected"' : '';
                 } else {
                     $selected = selected($slide['icon_o'], $k, false);
                 }
                 echo '<option value="' . $k . '"' . $selected . '>' . $v . '</option>';
             }
             //foreach
             echo '</select>';
             echo '<ul id="' . $this->field['id'] . '-ul" class="redux-slides-list">';
             echo '<li><input type="hidden" id="' . $this->field['id'] . '-url_' . $x . '" name="' . $this->field['name'] . '[' . $x . '][url]" value="' . esc_attr($slide['url']) . '" class="full-text upload" placeholder="' . __('URL', 'pinnacle') . '" /></li>';
             echo '<li><input type="text" id="' . $this->field['id'] . '-title_' . $x . '" name="' . $this->field['name'] . '[' . $x . '][title]" value="' . esc_attr($slide['title']) . '" placeholder="' . __('Title', 'pinnacle') . '" class="full-text slide-title" /></li>';
             echo '<li><textarea name="' . $this->field['name'] . '[' . $x . '][description]" id="' . $this->field['id'] . '-description_' . $x . '" placeholder="' . __('Description', 'pinnacle') . '" class="large-text" rows="6">' . esc_attr($slide['description']) . '</textarea></li>';
             echo '<li><input type="text" id="' . $this->field['id'] . '-link_' . $x . '" name="' . $this->field['name'] . '[' . $x . '][link]" value="' . esc_attr($slide['link']) . '" placeholder="' . __('Icon Link', 'pinnacle') . '" class="full-text" /></li>';
             echo '<li><label for="' . $this->field['id'] . '-target_' . $x . '" class="icon-link-target">';
             echo '<input type="checkbox" class="checkbox-slide-target" id="' . $this->field['id'] . '-target_' . $x . '" value="1" ' . checked($slide['target'], '1', false) . ' name="' . $this->field['name'] . '[' . $x . '][target]" />';
             echo ' ' . __('Open Link in New Tab/Window', 'pinnacle') . '</label></li>';
             echo '<li><input type="hidden" class="slide-sort" name="' . $this->field['name'] . '[' . $x . '][sort]" id="' . $this->field['id'] . '-sort_' . $x . '" value="' . $slide['sort'] . '" />';
             echo '<li><input type="hidden" class="upload-id" name="' . $this->field['name'] . '[' . $x . '][attachment_id]" id="' . $this->field['id'] . '-image_id_' . $x . '" value="' . $slide['attachment_id'] . '" />';
             echo '<input type="hidden" class="upload-thumbnail" name="' . $this->field['name'] . '[' . $x . '][thumb]" id="' . $this->field['id'] . '-thumb_url_' . $x . '" value="' . $slide['thumb'] . '" readonly="readonly" />';
             echo '<input type="hidden" class="upload" name="' . $this->field['name'] . '[' . $x . '][image]" id="' . $this->field['id'] . '-image_url_' . $x . '" value="' . $slide['image'] . '" readonly="readonly" />';
             echo '<input type="hidden" class="upload-height" name="' . $this->field['name'] . '[' . $x . '][height]" id="' . $this->field['id'] . '-image_height_' . $x . '" value="' . $slide['height'] . '" />';
             echo '<input type="hidden" class="upload-width" name="' . $this->field['name'] . '[' . $x . '][width]" id="' . $this->field['id'] . '-image_width_' . $x . '" value="' . $slide['width'] . '" /></li>';
             echo '<li><a href="javascript:void(0);" class="button deletion redux-slides-remove">' . __('Delete Icon', 'pinnacle') . '</a></li>';
             echo '</ul></div></fieldset></div>';
             $x++;
         }
     }
     if ($x == 0) {
         echo '<div class="redux-slides-accordion-group"><fieldset class="redux-field" data-id="' . $this->field['id'] . '"><h3><span class="redux-slides-header">New Icon</span></h3><div>';
         $hide = ' hide';
         echo '<div class="screenshot' . $hide . '">';
         echo '<a class="of-uploaded-image" href="">';
         echo '<img class="redux-slides-image" id="image_image_id_' . $x . '" src="" alt="" target="_blank" rel="external" />';
         echo '</a>';
         echo '</div>';
         //Upload controls DIV
         echo '<div class="upload_button_div">';
         //If the user has WP3.5+ show upload/remove button
         echo '<span class="button media_upload_button" id="add_' . $x . '">' . __('Upload Icon', 'pinnacle') . '</span>';
         echo '<span class="button remove-image' . $hide . '" id="reset_' . $x . '" rel="' . $this->parent->args['opt_name'] . '[' . $this->field['id'] . '][attachment_id]">' . __('Remove', 'pinnacle') . '</span>';
         echo '</div>' . "\n";
         $icon_option = kad_icon_list();
         $placeholder = isset($this->field['placeholder']['icon_o']) ? esc_attr($this->field['placeholder']['icon_o']) : __('Select an Icon', 'pinnacle');
         if (isset($this->field['select2'])) {
             // if there are any let's pass them to js
             $select2_params = json_encode(esc_attr($this->field['select2']));
             $select2_params = htmlspecialchars($select2_params, ENT_QUOTES);
             echo '<input type="hidden" class="select2_params" value="' . $select2_params . '">';
         }
         echo '<select ' . $multi . ' id="' . $this->field['id'] . '-select" data-placeholder="' . $placeholder . '" name="' . $this->field['name'] . '[' . $x . '][icon_o]" class="redux-select-item font-icons ' . $this->field['class'] . '" rows="6" style="width:93%;">';
         echo '<option></option>';
         foreach ($icon_option as $k => $v) {
             if (is_array($this->value)) {
                 $selected = is_array($this->value) && in_array($k, $this->value) ? ' selected="selected"' : '';
             } else {
                 $selected = selected($this->value, $k, false);
             }
             echo '<option value="' . $k . '"' . $selected . '>' . $v . '</option>';
         }
         //foreach
         echo '</select>';
         echo '<ul id="' . $this->field['id'] . '-ul" class="redux-slides-list">';
         $placeholder = isset($this->field['placeholder']['url']) ? esc_attr($this->field['placeholder']['url']) : __('URL', 'pinnacle');
         echo '<li><input type="hidden" id="' . $this->field['id'] . '-url_' . $x . '" name="' . $this->field['name'] . '[' . $x . '][url]" value="" class="full-text upload" placeholder="' . $placeholder . '" /></li>';
         $placeholder = isset($this->field['placeholder']['title']) ? esc_attr($this->field['placeholder']['title']) : __('Title', 'pinnacle');
         echo '<li><input type="text" id="' . $this->field['id'] . '-title_' . $x . '" name="' . $this->field['name'] . '[' . $x . '][title]" value="" placeholder="' . $placeholder . '" class="full-text slide-title" /></li>';
         $placeholder = isset($this->field['placeholder']['description']) ? esc_attr($this->field['placeholder']['description']) : __('Description', 'pinnacle');
         echo '<li><textarea name="' . $this->field['name'] . '[' . $x . '][description]" id="' . $this->field['id'] . '-description_' . $x . '" placeholder="' . $placeholder . '" class="large-text" rows="6"></textarea></li>';
         $placeholder = isset($this->field['placeholder']['link']) ? esc_attr($this->field['placeholder']['link']) : __('Icon Link', 'pinnacle');
         echo '<li><input type="text" id="' . $this->field['id'] . '-link_' . $x . '" name="' . $this->field['name'] . '[' . $x . '][link]" value="" placeholder="' . $placeholder . '" class="full-text" /></li>';
         echo '<li><label for="' . $this->field['id'] . '-target_' . $x . '">';
         echo '<input type="checkbox" class="checkbox-slide-target" id="' . $this->field['id'] . '-target_' . $x . '" value="" ' . checked('', '1', false) . ' name="' . $this->field['name'] . '[' . $x . '][target]" />';
         echo ' ' . __('Open Link in New Tab/Window', 'pinnacle') . '</label></li>';
         echo '<li><input type="hidden" class="slide-sort" name="' . $this->field['name'] . '[' . $x . '][sort]" id="' . $this->field['id'] . '-sort_' . $x . '" value="' . $x . '" />';
         echo '<li><input type="hidden" class="upload-id" name="' . $this->field['name'] . '[' . $x . '][attachment_id]" id="' . $this->field['id'] . '-image_id_' . $x . '" value="" />';
         echo '<input type="hidden" class="upload" name="' . $this->field['name'] . '[' . $x . '][url]" id="' . $this->field['id'] . '-image_url_' . $x . '" value="" readonly="readonly" />';
         echo '<input type="hidden" class="upload-height" name="' . $this->field['name'] . '[' . $x . '][height]" id="' . $this->field['id'] . '-image_height_' . $x . '" value="" />';
         echo '<input type="hidden" class="upload-width" name="' . $this->field['name'] . '[' . $x . '][width]" id="' . $this->field['id'] . '-image_width_' . $x . '" value="" /></li>';
         echo '<li><a href="javascript:void(0);" class="button deletion redux-slides-remove">' . __('Delete Icon', 'pinnacle') . '</a></li>';
         echo '</ul></div></fieldset></div>';
     }
     echo '</div><a href="javascript:void(0);" class="button redux-slides-add2 kad_redux-icon-add button-primary" rel-id="' . $this->field['id'] . '-ul" rel-name="' . $this->field['name'] . '[title][]">' . __('Add Icon', 'pinnacle') . '</a><br/>';
 }