コード例 #1
0
 function ypop_get_icon_data($icon)
 {
     $icon_list = YIT_Plugin_Common::get_icon_list();
     $icon_data = '';
     if ($icon != '') {
         $ic = explode(':', $icon);
         if (count($ic) < 2) {
             return $icon_data;
         }
         $icon_code = array_search($ic[1], $icon_list[$ic[0]]);
         if ($icon_code) {
             $icon_code = strpos($icon_code, '\\') === 0 ? '&#x' . substr($icon_code, 1) . ';' : $icon_code;
         }
         $icon_data = 'data-font="' . esc_attr($ic[0]) . '" data-name="' . esc_attr($icon_code) . '" data-key="' . esc_attr($ic[1]) . '" data-icon="' . $icon_code . '"';
     }
     return $icon_data;
 }
コード例 #2
0
        function form($instance)
        {
            global $icons_name;
            $defaults = array('title' => '', 'phone' => '', 'icon_type' => 'icon', 'text' => '', 'class' => '');
            $icon_list = YIT_Plugin_Common::get_icon_list();
            $instance = wp_parse_args((array) $instance, $defaults);
            $current_icon = isset($instance['icon']) ? YIT_Icon()->get_icon_data($instance['icon']) : '';
            ?>

            <p>
                <label for="<?php 
            esc_attr($this->get_field_id('title'));
            ?>
"><?php 
            _e('Title', 'yit');
            ?>
</label>
                <input class="widefat" type="text" id="<?php 
            echo esc_attr($this->get_field_id('title'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('title'));
            ?>
" value="<?php 
            echo esc_attr($instance['title']);
            ?>
" />
            </p>

            <p>
                <label for="<?php 
            esc_attr($this->get_field_id('phone'));
            ?>
"><?php 
            _e('Phone', 'yit');
            ?>
</label>
                <input class="widefat" type="text" id="<?php 
            echo esc_attr($this->get_field_id('phone'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('phone'));
            ?>
" value="<?php 
            echo esc_attr($instance['phone']);
            ?>
" />
            </p>

             <p>
                <label for="<?php 
            esc_attr($this->get_field_id('class'));
            ?>
"><?php 
            _e('Extra Class', 'yit');
            ?>
</label>
                <input class="widefat" type="text" id="<?php 
            echo esc_attr($this->get_field_id('class'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('class'));
            ?>
" value="<?php 
            echo esc_attr($instance['class']);
            ?>
" />
            </p>

            <div class="widget-icon-manager">
                <div class="icon-manager-wrapper">
                    <label for="<?php 
            echo esc_attr($this->get_field_id('icon'));
            ?>
"><?php 
            _e('Icon', 'yit');
            ?>
</label>
                    <div class="icon-manager-text">
                        <div class="icon-preview" <?php 
            echo $current_icon;
            ?>
></div>
                        <input type="text" id="<?php 
            echo esc_attr($this->get_field_id('icon'));
            ?>
" class="icon-text" name="<?php 
            echo esc_attr($this->get_field_name('icon'));
            ?>
" value="<?php 
            echo esc_attr($instance['icon']);
            ?>
" />
                    </div>


                    <div class="icon-manager">
                        <ul class="icon-list-wrapper">
                            <?php 
            foreach ($icon_list as $font => $icons) {
                foreach ($icons as $key => $icon) {
                    ?>
                                    <li data-font="<?php 
                    echo $font;
                    ?>
" data-icon="<?php 
                    echo strpos($key, '\\') === 0 ? '&#x' . substr($key, 1) . ';' : $key;
                    ?>
" data-key="<?php 
                    echo $key;
                    ?>
" data-name="<?php 
                    echo $icon;
                    ?>
"></li>
                                <?php 
                }
            }
            ?>
                        </ul>
                    </div>
                </div>
            </div>

            <p>
                <label for="<?php 
            echo esc_attr($this->get_field_id('text'));
            ?>
"><?php 
            _e('Text ( you can use html )', 'yit');
            ?>
</label>
                <textarea class="widefat" id="<?php 
            echo esc_attr($this->get_field_id('text'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('text'));
            ?>
" cols="20" rows="16"><?php 
            echo esc_attr($instance['text']);
            ?>
</textarea>
            </p>

        <?php 
        }
コード例 #3
0
/**
 * Awesome Icon Admin View
 *
 * @package	Yithemes
 * @author Emanuela Castorina <*****@*****.**>
 * @since 1.0.0
 */
extract($args);
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$current_options = wp_parse_args($args['value'], $args['std']);
$current_icon = YIT_Icon()->get_icon_data($current_options['icon']);
$current_icon = YIT_Icon()->get_icon_data($std['icon']);
$options['icon'] = YIT_Plugin_Common::get_icon_list();
?>



<div id="<?php 
echo $id;
?>
-container" <?php 
if (isset($deps)) {
    ?>
data-field="<?php 
    echo $id;
    ?>
" data-dep="<?php 
    echo $deps['ids'];
コード例 #4
0
 * This file belongs to the YIT Plugin Framework.
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$no_form_plugin = '';
$inquiry_form = '';
$yit_contact_form = '';
$contact_form_7 = '';
$active_plugins = array('none' => __('None', 'ywctm'));
if (function_exists('YIT_Contact_Form')) {
    $active_plugins['yit-contact-form'] = __('YIT Contact Form', 'ywctm');
}
if (function_exists('wpcf7_contact_form')) {
    $active_plugins['contact-form-7'] = __('Contact Form 7', 'ywctm');
}
if (function_exists('YIT_Contact_Form') || function_exists('wpcf7_contact_form')) {
    $inquiry_form = array('name' => __('Inquiry form', 'ywctm'), 'type' => 'select', 'desc' => __('Choose one among activated plugins to display an inquiry form in product page', 'ywctm'), 'options' => $active_plugins, 'default' => 'none', 'id' => 'ywctm_inquiry_form_type');
    $yit_contact_form = array('name' => '', 'type' => 'select', 'desc' => __('Choose the form to display', 'ywctm'), 'options' => apply_filters('yit_get_contact_forms', array()), 'id' => 'ywctm_inquiry_yit_contact_form_id', 'class' => 'yit-contact-form');
    $contact_form_7 = array('name' => '', 'type' => 'select', 'desc' => __('Choose the form to display', 'ywctm'), 'options' => apply_filters('wpcf7_get_contact_forms', array()), 'id' => 'ywctm_inquiry_contact_form_7_id', 'class' => 'contact-form-7');
} else {
    $no_form_plugin = __('To use this feature, YIT Contact Form or Contact Form 7 must be installed and activated.', 'ywctm');
}
return array('premium' => array('catalog_mode_premium_section_title_price' => array('name' => __('Product Price', 'ywctm'), 'type' => 'title', 'desc' => '', 'id' => 'ywctm_premium_title_price'), 'catalog_mode_premium_hide_price' => array('name' => __('Product Price', 'ywctm'), 'type' => 'checkbox', 'desc' => __('Hide', 'ywctm'), 'id' => 'ywctm_hide_price', 'default' => 'no', 'checkboxgroup' => 'start'), 'catalog_mode_premium_exclude_products' => array('name' => '', 'type' => 'checkbox', 'desc' => __('Exclude selected products (See "Exclusions" tab)', 'ywctm'), 'id' => 'ywctm_exclude_hide_price', 'default' => 'no', 'checkboxgroup' => ''), 'catalog_mode_premium_exclude_products_reverse' => array('name' => '', 'type' => 'checkbox', 'desc' => __('Reverse Exclusion List (Restrict Catalog Mode to selected items only)', 'ywctm'), 'id' => 'ywctm_exclude_hide_price_reverse', 'default' => 'no', 'checkboxgroup' => 'end'), 'catalog_mode_premium_price_alternative_text' => array('name' => __('Alternative text', 'ywctm'), 'type' => 'text', 'desc' => __('This text will replace price (Optional)', 'ywctm'), 'id' => 'ywctm_exclude_price_alternative_text', 'default' => ''), 'catalog_mode_premium_hide_price_users' => array('name' => __('Target users', 'ywctm'), 'type' => 'select', 'desc' => __('Users who will not see the price and the add to cart button', 'ywctm'), 'options' => array('all' => __('All users', 'ywctm'), 'unregistered' => __('Unregistered users only', 'ywctm')), 'default' => 'all', 'id' => 'ywctm_hide_price_users'), 'catalog_mode_premium_section_end_price' => array('type' => 'sectionend', 'id' => 'ywctm_premium_end_price'), 'catalog_mode_premium_section_title_form' => array('name' => __('Inquiry Form', 'ywctm'), 'type' => 'title', 'desc' => $no_form_plugin, 'id' => 'ywctm_premium_title_form'), 'catalog_mode_premium_inquiry_form' => $inquiry_form, 'catalog_mode_premium_yit_contact_form' => $yit_contact_form, 'catalog_mode_premium_contact_form_7' => $contact_form_7, 'catalog_mode_premium_section_end_form' => array('type' => 'sectionend', 'id' => 'ywctm_premium_end_form'), 'catalog_mode_premium_section_title_button' => array('name' => __('Custom Button', 'ywctm'), 'type' => 'title', 'desc' => '', 'id' => 'ywctm_premium_title_button'), 'catalog_mode_premium_enable_custom_button' => array('name' => __('Custom button', 'ywctm'), 'type' => 'checkbox', 'desc' => __('Show in product details page', 'ywctm'), 'id' => 'ywctm_custom_button', 'default' => 'no', 'checkboxgroup' => 'start'), 'catalog_mode_premium_enable_custom_button_loop' => array('name' => __('Custom button', 'ywctm'), 'type' => 'checkbox', 'desc' => __('Show in shop page', 'ywctm'), 'id' => 'ywctm_custom_button_loop', 'default' => 'no', 'checkboxgroup' => 'end'), 'catalog_mode_premium_custom_button_text' => array('name' => __('Button text', 'ywctm'), 'type' => 'text', 'desc' => '', 'id' => 'ywctm_button_text'), 'catalog_mode_premium_custom_button_color' => array('name' => __('Color', 'ywctm'), 'type' => 'color', 'desc' => __('Color of the text (Optional)', 'ywctm'), 'id' => 'ywctm_button_color'), 'catalog_mode_premium_custom_button_hover' => array('name' => __('Hover Color', 'ywctm'), 'type' => 'color', 'desc' => __('Color of the text on hover (Optional)', 'ywctm'), 'id' => 'ywctm_button_hover'), 'catalog_mode_premium_custom_button_icon' => array('name' => __('Icon', 'ywctm'), 'type' => 'icon', 'desc' => __('Show optional icon', 'ywctm'), 'options' => array('select' => array('none' => __('None', 'ywctm'), 'icon' => __('Theme Icon', 'ywctm'), 'custom' => __('Custom Icon', 'ywctm')), 'icon' => YIT_Plugin_Common::get_icon_list()), 'id' => 'ywctm_button_icon', 'default' => array('select' => 'none', 'icon' => 'retinaicon-font:retina-the-essentials-082', 'custom' => '')), 'catalog_mode_premium_custom_button_url_type' => array('name' => __('URL Protocol Type', 'ywctm'), 'type' => 'select', 'desc' => __('Specify the type of the URL (Optional)', 'ywctm'), 'options' => array('generic' => __('Generic URL', 'ywctm'), 'mailto' => __('E-mail address', 'ywctm'), 'tel' => __('Phone number', 'ywctm'), 'skype' => __('Skype contact', 'ywctm')), 'default' => 'generic', 'id' => 'ywctm_button_url_type'), 'catalog_mode_premium_custom_button_url' => array('name' => __('URL Link', 'ywctm'), 'type' => 'text', 'desc' => __('Specify the URL (Optional)', 'ywctm'), 'id' => 'ywctm_button_url', 'default' => ''), 'catalog_mode_premium_section_end_button' => array('type' => 'sectionend', 'id' => 'ywctm_premium_end_button'), 'catalog_mode_premium_section_title_review' => array('name' => __('Reviews', 'ywctm'), 'type' => 'title', 'desc' => '', 'id' => 'ywctm_premium_title_review'), 'catalog_mode_premium_disable_review' => array('name' => __('Product Reviews', 'ywctm'), 'type' => 'select', 'desc' => '', 'id' => 'ywctm_disable_review', 'default' => 'no', 'options' => array('no' => __('Enabled', 'ywctm'), 'all' => __('Disabled for all users', 'ywctm'), 'unregistered' => __('Disabled only for unregistered users', 'ywctm'))), 'catalog_mode_premium_section_end_review' => array('type' => 'sectionend', 'id' => 'ywctm_premium_end_review')));
コード例 #5
0
<?php

/**
 * This file belongs to the YIT Framework.
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */
/**
 * Return an array with the options for Theme Options > Shop > Single Product Page
 *
 * @package Yithemes
 * @author Andrea Grillo <*****@*****.**>
 * @author Antonio La Rocca <*****@*****.**>
 * @author Francesco Licandro <*****@*****.**>
 * @since 2.0.0
 * @return mixed array
 *
 */
return array(array('type' => 'title', 'name' => __('Single Product Page', 'yit'), 'desc' => ''), array('id' => 'shop-single-product-nav', 'type' => 'onoff', 'name' => __('Show nav prev/next link', 'yit'), 'desc' => __('Say if you want to show product navigation', 'yit'), 'std' => 'yes'), array('id' => 'shop-nav-in-category', 'type' => 'onoff', 'name' => __('Nav in same category', 'yit'), 'desc' => __('Select it to navigate in the same product category of the displayed product', 'yit'), 'std' => 'no', 'deps' => array('ids' => 'shop-single-product-nav', 'values' => 'yes')), array('id' => 'shop-single-product-name', 'type' => 'onoff', 'name' => __('Show name', 'yit'), 'desc' => __('Say if you want to show product name', 'yit'), 'std' => 'yes'), array('id' => 'shop-single-product-price', 'type' => 'onoff', 'name' => __('Show price', 'yit'), 'desc' => __('Select if you want to show price.', 'yit'), 'std' => 'yes'), array('id' => 'shop-single-add-to-cart', 'type' => 'onoff', 'name' => __('Show button add to cart', 'yit'), 'desc' => __('Select if you want to show purchase button.', 'yit'), 'std' => 'yes'), array('id' => 'shop-single-show-wishlist', 'type' => 'onoff', 'name' => __('Show wishlist button', 'yit'), 'desc' => __('Say if you want to show wishlist button.', 'yit'), 'std' => 'yes'), array('id' => 'shop-single-share', 'type' => 'onoff', 'name' => __('Show share link', 'yit'), 'desc' => __('Say if you want to show link for sharing product.', 'yit'), 'std' => 'yes'), array('id' => 'shop-single-compare', 'type' => 'onoff', 'name' => __('Show compare button', 'yit'), 'desc' => __('Say if you want to show compare button.', 'yit'), 'std' => 'yes'), array('id' => 'shop-single-metas', 'type' => 'onoff', 'name' => __('Show product metas (categories and tags)', 'yit'), 'desc' => __('Say if you want to show product metas in your single product page. It also remove Brands if you are using WooCommerce Brands Addon.', 'yit'), 'std' => 'yes'), array('id' => 'shop-remove-reviews', 'type' => 'onoff', 'name' => __('Remove reviews tab', 'yit'), 'desc' => __('Say if you want to remove reviews tab from all products', 'yit'), 'std' => 'no'), array('type' => 'title', 'name' => __('Related products', 'yit'), 'desc' => ''), array('id' => 'shop-show-related', 'type' => 'onoff', 'name' => __('Show related products', 'yit'), 'desc' => __('Select if you want to display Related Products.', 'yit'), 'std' => 'yes'), array('id' => 'shop-related-slider', 'type' => 'onoff', 'name' => __('Enable related slider', 'yit'), 'desc' => __('Select if you want to show related products as slider.', 'yit'), 'std' => 'no', 'deps' => array('ids' => 'shop-show-related', 'values' => 'yes')), array('id' => 'shop-show-custom-related', 'type' => 'onoff', 'name' => __('Custom Related Products number', 'yit'), 'desc' => __('Select if you want to customize the number of Related Products. Note: if you are already using a custom filter to do that, please don\'t enable this option', 'yit'), 'std' => 'no', 'deps' => array('ids' => 'shop-show-related', 'values' => 'yes')), array('id' => 'shop-number-related', 'type' => 'number', 'name' => __('Number of Related Products', 'yit'), 'desc' => __('Set the total numbers of the related products displayed, on the product detail page. Note: related products are displayed randomly from Woocommerce. Sometimes the number of related products could be less than the number of items selected. This number depends from the query plugin, not from the theme.', 'yit'), 'std' => 3, 'deps' => array('ids' => 'shop-show-custom-related', 'values' => 'yes')), !function_exists('YIT_Contact_Form') ? false : array('type' => 'title', 'name' => __('Inquiry Form Options', 'yit'), 'desc' => ''), !function_exists('YIT_Contact_Form') ? false : array('id' => 'shop-inquiry-title', 'type' => 'text', 'name' => __('Inquiry box title', 'yit'), 'desc' => __('Set inquiry box title', 'yit'), 'std' => __('Send an inquiry', 'yit')), !function_exists('YIT_Contact_Form') ? false : array('id' => 'shop-inquiry-title-icon', 'type' => 'icon-list', 'options' => array('select' => array('icon' => __('Theme Icon', 'yit'), 'custom' => __('Custom Icon', 'yit'), 'none' => __('None', 'yit')), 'icon' => YIT_Plugin_Common::get_icon_list()), 'name' => __('Show inquiry icon', 'yit'), 'desc' => __('Select the icon for inquiry box title. Note: Custom icon size will be scaled to 25x25', 'yit'), 'std' => array('select' => 'icon', 'icon' => 'retinaicon-font:retina-the-essentials-082', 'custom' => '')), !function_exists('YIT_Contact_Form') ? false : array('id' => 'shop-single-product-contact-form', 'type' => 'select', 'name' => __('Inquiry form', 'yit'), 'desc' => __('Select contact form type. Note: First you must create one contact form on plugin YIT Contact Form', 'yit'), 'options' => apply_filters('yit_get_contact_forms', array()), 'std' => false));
コード例 #6
0
ファイル: icon-list.php プロジェクト: lieison/IndustriasFenix
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-3.0.txt
 */
/**
 * Icon Manager
 *
 * @package    Yithemes
 * @author     Emanuela Castorina <*****@*****.**>
 * @since      1.0.0
 */
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$icon_list = YIT_Plugin_Common::get_icon_list();
?>
<div class="fieldset" id="<?php 
echo $var[0] . '-' . $var[2];
?>
-container" <?php 
if (isset($var[1]['deps'])) {
    ?>
data-field="<?php 
    echo $var[0] . '-' . $var[2];
    ?>
" data-dep="<?php 
    echo $var[1]['deps']['ids'] . '-' . $var[2];
    ?>
" data-value="<?php 
    echo $var[1]['deps']['values'];
コード例 #7
0
 /**
  * Add new icon style
  *
  * @since  2.0.0
  * @author Andrea Grillo <*****@*****.**>
  */
 function yit_change_newsletter_cta_default_args($shortcodes)
 {
     if (function_exists('YIT_Newsletter') && isset($shortcodes['newsletter_cta']['attributes']['icon_form'])) {
         $shortcodes['newsletter_cta']['attributes']['icon_form'] = array('title' => __('Newsletter Form Icon', 'yit'), 'type' => 'icon-list', 'options' => YIT_Plugin_Common::get_icon_list(), 'std' => '');
     }
     return $shortcodes;
 }
コード例 #8
0
    /**
     * Walker::start_el(&$output, $object, $depth = 0, $args = Array, $current_object_id = 0)
     *
     * @see    Walker::start_el()
     * @since  1.0.0
     *
     * @param string       $output            Passed by reference. Used to append additional content.
     * @param object       $item              Menu item data object.
     * @param int          $depth             Depth of menu item. Used for padding. (Default = 0)
     * @param array|object $args              An argument array
     * @param int          $current_object_id The id of current object. Default = 0)
     *
     * @return void
     * @author Simone D'Amico <*****@*****.**>
     */
    function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0)
    {
        global $_wp_nav_menu_max_depth;
        $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
        $indent = $depth ? str_repeat("\t", $depth) : '';
        ob_start();
        $item_id = esc_attr($item->ID);
        $removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce');
        $original_title = '';
        if ('taxonomy' == $item->type) {
            $original_title = get_term_field('name', $item->object_id, $item->object, 'raw');
            if (is_wp_error($original_title)) {
                $original_title = false;
            }
        } elseif ('post_type' == $item->type) {
            $original_object = get_post($item->object_id);
            $original_title = $original_object->post_title;
        }
        $classes = array('menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr($item->object), 'menu-item-edit-' . ($item_id == YIT_Request()->get('edit-menu-item') ? 'active' : 'inactive'));
        $title = $item->title;
        if (!empty($item->_invalid)) {
            $classes[] = 'menu-item-invalid';
            /* translators: %s: title of menu item which is invalid */
            $title = sprintf(__('%s (Invalid)', 'yit'), $item->title);
        } elseif (isset($item->post_status) && 'draft' == $item->post_status) {
            $classes[] = 'pending';
            /* translators: %s: title of menu item in draft status */
            $title = sprintf(__('%s (Pending)', 'yit'), $item->title);
        }
        $title = empty($item->label) ? $title : $item->label;
        // $awesome = YIT_Plugin_Common::get_awesome_icons();
        $icon_list = YIT_Plugin_Common::get_icon_list();
        ?>
    <li id="menu-item-<?php 
        echo $item_id;
        ?>
" class="<?php 
        echo implode(' ', $classes);
        ?>
">
        <dl class="menu-item-bar">
            <dt class="menu-item-handle">
                <span class="item-title"><?php 
        echo esc_html($title);
        ?>
</span>
					<span class="item-controls">
						<span class="item-type"><?php 
        echo esc_html($item->type_label);
        ?>
</span>
						<span class="item-order hide-if-js">
							<a href="<?php 
        echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'move-up-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'));
        ?>
" class="item-move-up"><abbr title="<?php 
        esc_attr_e('Move up');
        ?>
">&#8593;</abbr></a>
							|
							<a href="<?php 
        echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'move-down-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'));
        ?>
" class="item-move-down"><abbr title="<?php 
        esc_attr_e('Move down');
        ?>
">&#8595;</abbr></a>
						</span>
						<a class="item-edit" id="edit-<?php 
        echo $item_id;
        ?>
" title="<?php 
        esc_attr_e('Edit Menu Item', 'yit');
        ?>
" href="<?php 
        echo $item_id == YIT_Request()->get('edit-menu-item') ? admin_url('nav-menus.php') : esc_url(add_query_arg('edit-menu-item', $item_id, remove_query_arg($removed_args, admin_url('nav-menus.php#menu-item-settings-' . $item_id))));
        ?>
"><?php 
        _e('Edit Menu Item', 'yit');
        ?>
</a>
					</span>
            </dt>
        </dl>

        <div class="menu-item-settings" id="menu-item-settings-<?php 
        echo $item_id;
        ?>
">
            <?php 
        if ('custom' == $item->type) {
            ?>
                <p class="field-url description description-wide">
                    <label for="edit-menu-item-url-<?php 
            echo $item_id;
            ?>
">
                        <?php 
            _e('URL', 'yit');
            ?>
<br />
                        <input type="text" id="edit-menu-item-url-<?php 
            echo $item_id;
            ?>
" class="widefat code edit-menu-item-url" name="menu-item-url[<?php 
            echo $item_id;
            ?>
]" value="<?php 
            echo esc_attr($item->url);
            ?>
" />
                    </label>
                </p>
            <?php 
        }
        ?>
            <p class="description description-thin">
                <label for="edit-menu-item-title-<?php 
        echo $item_id;
        ?>
">
                    <?php 
        _e('Navigation Label', 'yit');
        ?>
<br />
                    <input type="text" id="edit-menu-item-title-<?php 
        echo $item_id;
        ?>
" class="widefat edit-menu-item-title" name="menu-item-title[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item->title);
        ?>
" />
                </label>
            </p>
            <p class="description description-thin">
                <label for="edit-menu-item-attr-title-<?php 
        echo $item_id;
        ?>
">
                    <?php 
        _e('Title Attribute', 'yit');
        ?>
<br />
                    <input type="text" id="edit-menu-item-attr-title-<?php 
        echo $item_id;
        ?>
" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item->post_excerpt);
        ?>
" />
                </label>
            </p>
            <p class="field-link-target description">
                <label for="edit-menu-item-target-<?php 
        echo $item_id;
        ?>
">
                    <input type="checkbox" id="edit-menu-item-target-<?php 
        echo $item_id;
        ?>
" value="_blank" name="menu-item-target[<?php 
        echo $item_id;
        ?>
]"<?php 
        checked($item->target, '_blank');
        ?>
 />
                    <?php 
        _e('Open link in a new window/tab', 'yit');
        ?>
                </label>
            </p>
            <p class="field-css-classes description description-thin">
                <label for="edit-menu-item-classes-<?php 
        echo $item_id;
        ?>
">
                    <?php 
        _e('CSS Classes (optional)', 'yit');
        ?>
<br />
                    <input type="text" id="edit-menu-item-classes-<?php 
        echo $item_id;
        ?>
" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr(implode(' ', $item->classes));
        ?>
" />
                </label>
            </p>

            <p class="field-xfn description description-thin">
                <label for="edit-menu-item-xfn-<?php 
        echo $item_id;
        ?>
">
                    <?php 
        _e('Link Relationship (XFN)', 'yit');
        ?>
<br />
                    <input type="text" id="edit-menu-item-xfn-<?php 
        echo $item_id;
        ?>
" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item->xfn);
        ?>
" />
                </label>
            </p>
            <p class="field-description description description-wide">
                <label for="edit-menu-item-description-<?php 
        echo $item_id;
        ?>
">
                    <?php 
        _e('Description', 'yit');
        ?>
<br />
                    <textarea id="edit-menu-item-description-<?php 
        echo $item_id;
        ?>
" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php 
        echo $item_id;
        ?>
]"><?php 
        echo esc_html($item->description);
        // textarea_escaped
        ?>
</textarea>
                    <span class="description"><?php 
        _e('The description will be displayed in the menu if the current theme supports it.', 'yit');
        ?>
</span>
                </label>
            </p>



            <!-- custom code -->
            <?php 
        $custom_fields = YIT_Registry::get_instance()->{'navmenu'}->fields;
        ?>
            <?php 
        if (!empty($custom_fields)) {
            ?>


                <div class="clear"></div>
                <p style="margin-top: 20px"><strong><?php 
            _e('Customize menu', 'yit');
            ?>
</strong></p>


                <?php 
            foreach ($custom_fields as $id => $field) {
                ?>
                    <p class="description description-<?php 
                echo $field['width'];
                ?>
">
                        <label for="edit-menu-item-<?php 
                echo $id;
                ?>
-<?php 
                echo $item_id;
                ?>
">
                            <?php 
                _e($field['label'], 'yit');
                ?>

                            <?php 
                if ($field['type'] == 'input') {
                    ?>
                                <input type="text" id="edit-menu-item-<?php 
                    echo $id;
                    ?>
-<?php 
                    echo $item_id;
                    ?>
" class="widefat code" name="menu-item-<?php 
                    echo $id;
                    ?>
[<?php 
                    echo $item_id;
                    ?>
]" value="<?php 
                    if (isset($item->{$id})) {
                        echo esc_attr($item->{$id});
                    }
                    ?>
" />
                            <?php 
                } elseif ($field['type'] == 'textarea') {
                    ?>
                                <textarea id="edit-menu-item-<?php 
                    echo $id;
                    ?>
-<?php 
                    echo $item_id;
                    ?>
" class="widefat" rows="3" cols="20" name="menu-item-<?php 
                    echo $id;
                    ?>
[<?php 
                    echo $item_id;
                    ?>
]"><?php 
                    if (isset($item->{$id})) {
                        echo esc_html($item->{$id});
                    }
                    // textarea_escaped
                    ?>
</textarea>
                                <span class="description"><?php 
                    _e($field['description'], 'yit');
                    ?>
</span>
                            <?php 
                } elseif ($field['type'] == 'text') {
                    ?>
                                <input type="text" id="edit-menu-item-<?php 
                    echo $id;
                    ?>
-<?php 
                    echo $item_id;
                    ?>
" name="menu-item-<?php 
                    echo $id;
                    ?>
[<?php 
                    echo $item_id;
                    ?>
]"   class="widefat code" value="<?php 
                    if (isset($item->{$id})) {
                        echo esc_html(trim($item->{$id}));
                    }
                    ?>
"/>
                                <span class="description"><?php 
                    _e($field['description'], 'yit');
                    ?>
</span>
                            <?php 
                } elseif ($field['type'] == 'select-icon') {
                    ?>
                                <div class="icon-manager-wrapper">
                                    <div class="icon-manager-text">
                                        <div class="icon-preview"></div>
                                        <input type="text" id="edit-menu-item-<?php 
                    echo $id;
                    ?>
-<?php 
                    echo $item_id;
                    ?>
" class="icon-text" data-sfx="icon" name="menu-item-<?php 
                    echo $id;
                    ?>
[<?php 
                    echo $item_id;
                    ?>
]" value="<?php 
                    if (isset($item->{$id})) {
                        echo esc_attr($item->{$id});
                    }
                    ?>
" />
                                    </div>
                                    <div class="icon-manager">
                                        <ul id="edit-menu-item-<?php 
                    echo $id;
                    ?>
-<?php 
                    echo $item_id;
                    ?>
" class="icon-list-wrapper" >
                                            <?php 
                    foreach ($icon_list as $font => $icons) {
                        foreach ($icons as $key => $icon) {
                            ?>
                                                    <li data-font="<?php 
                            echo esc_attr($font);
                            ?>
" data-icon="<?php 
                            echo strpos($key, '\\') === 0 ? '&#x' . substr($key, 1) : $key;
                            ?>
" data-key="<?php 
                            echo esc_attr($key);
                            ?>
" data-name="<?php 
                            echo esc_attr($icon);
                            ?>
" value="<?php 
                            echo $font . ':' . $icon;
                            ?>
" <?php 
                            echo selected($item->{$id}, $font . ':' . $icon);
                            ?>
></li>
                                                <?php 
                        }
                    }
                    ?>
                                        </ul>
                                    </div>
                                </div>
                            <?php 
                } elseif ($field['type'] == 'upload') {
                    ?>
                                <input type="text" id="edit-menu-item-<?php 
                    echo $id;
                    ?>
-<?php 
                    echo $item_id;
                    ?>
" class="widefat code menu-custom-field menu-custom-field-upload"  data-sfx="background" value="<?php 
                    if (isset($item->{$id})) {
                        echo esc_attr($item->{$id});
                    }
                    ?>
" />
                                <input type="button" value="<?php 
                    _e('Upload', 'yit');
                    ?>
" id="edit-menu-item-<?php 
                    echo $id;
                    ?>
-<?php 
                    echo $item_id;
                    ?>
-button" class="upload_button button" />
                            <?php 
                }
                ?>
                        </label>
                    </p>
                <?php 
            }
            ?>
            <?php 
        }
        ?>
            <!-- /custom code -->



            <div class="menu-item-actions description-wide submitbox">
                <?php 
        if ('custom' != $item->type && $original_title !== false) {
            ?>
                    <p class="link-to-original">
                        <?php 
            printf(__('Original: %s', 'yit'), '<a href="' . esc_attr($item->url) . '">' . esc_html($original_title) . '</a>');
            ?>
                    </p>
                <?php 
        }
        ?>
                <a class="item-delete submitdelete deletion" id="delete-<?php 
        echo $item_id;
        ?>
" href="<?php 
        echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'delete-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'delete-menu_item_' . $item_id));
        ?>
"><?php 
        _e('Remove', 'yit');
        ?>
</a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php 
        echo $item_id;
        ?>
" href="<?php 
        echo esc_url(add_query_arg(array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg($removed_args, admin_url('nav-menus.php'))));
        ?>
#menu-item-settings-<?php 
        echo $item_id;
        ?>
"><?php 
        _e('Cancel', 'yit');
        ?>
</a>
            </div>

            <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item_id);
        ?>
" />
            <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item->object_id);
        ?>
" />
            <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item->object);
        ?>
" />
            <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item->menu_item_parent);
        ?>
" />
            <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item->menu_order);
        ?>
" />
            <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php 
        echo $item_id;
        ?>
]" value="<?php 
        echo esc_attr($item->type);
        ?>
" />
        </div><!-- .menu-item-settings-->
        <ul class="menu-item-transport"></ul>
        <?php 
        $output .= ob_get_clean();
    }
コード例 #9
0
        function form($instance)
        {
            global $icons_name;
            /* Impostazioni di default del widget */
            $defaults = array('title' => '', 'icon_type' => 'icon', 'icon' => '', 'image' => '', 'align' => '', 'link' => '', 'text' => '', 'autop' => false);
            $icon_type_option_list = array('icon' => __('Theme Icon', 'yit'), 'custom' => __('Custom Icon', 'yit'), 'none' => __('None', 'yit'));
            $icon_list = YIT_Plugin_Common::get_icon_list();
            $instance = wp_parse_args((array) $instance, $defaults);
            $current_icon = YIT_Icon()->get_icon_data($instance['icon']);
            ?>

            <p>
                <label for="<?php 
            esc_attr($this->get_field_id('title'));
            ?>
"><?php 
            _e('Title', 'yit');
            ?>
</label>
                <input class="widefat" type="text" id="<?php 
            echo esc_attr($this->get_field_id('title'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('title'));
            ?>
" value="<?php 
            echo esc_attr($instance['title']);
            ?>
" />
            </p>

            <p class="widget_select_action">
                <label for="<?php 
            echo esc_attr($this->get_field_id('icon_type'));
            ?>
"><?php 
            _e('Icon Type', 'yit');
            ?>
</label>
                <select id="<?php 
            echo esc_attr($this->get_field_id('icon_type'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('icon_type'));
            ?>
" class="widget_icon_type">
                    <?php 
            foreach ($icon_type_option_list as $key => $type) {
                ?>
                        <option value="<?php 
                echo esc_attr($key);
                ?>
" <?php 
                selected($instance['icon_type'], $key);
                ?>
><?php 
                echo $type;
                ?>
</option>
                    <?php 
            }
            ?>
                </select>
                <span><?php 
            _e('Choose the type of icon', 'yit');
            ?>
</span>
            </p>

            <div class="widget-icon-manager">
                <div class="icon-manager-wrapper">
                    <label for="<?php 
            echo esc_attr($this->get_field_id('icon'));
            ?>
"><?php 
            _e('Icon', 'yit');
            ?>
</label>
                    <div class="icon-manager-text">
                        <div class="icon-preview" <?php 
            echo $current_icon;
            ?>
></div>
                        <input type="text" id="<?php 
            echo esc_attr($this->get_field_id('icon'));
            ?>
" class="icon-text" name="<?php 
            echo esc_attr($this->get_field_name('icon'));
            ?>
" value="<?php 
            echo esc_attr($instance['icon']);
            ?>
" />
                    </div>


                    <div class="icon-manager">
                        <ul class="icon-list-wrapper">
                            <?php 
            foreach ($icon_list as $font => $icons) {
                foreach ($icons as $key => $icon) {
                    ?>
                                    <li data-font="<?php 
                    echo esc_attr($font);
                    ?>
" data-icon="<?php 
                    echo strpos($key, '\\') === 0 ? '&#x' . substr($key, 1) . ';' : $key;
                    ?>
" data-key="<?php 
                    echo esc_attr($key);
                    ?>
" data-name="<?php 
                    echo esc_attr($icon);
                    ?>
"></li>
                                <?php 
                }
            }
            ?>
                        </ul>
                    </div>
                </div>
            </div>


            <p class="widget_custom_icon">
                <label for="<?php 
            echo esc_attr($this->get_field_id('image'));
            ?>
"><?php 
            _e('Image', 'yit');
            ?>
</label>
                <input type="text" id="<?php 
            echo esc_attr($this->get_field_id('image'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('image'));
            ?>
" value="<?php 
            echo esc_attr($instance['image']);
            ?>
" />
                <input type="button" value="Upload" id="<?php 
            echo esc_attr($this->get_field_id('image'));
            ?>
-button" class="upload_button button" />
            </p>

            <p>
                <label for="<?php 
            echo esc_attr($this->get_field_id('align'));
            ?>
"><?php 
            _e('Image Alignment', 'yit');
            ?>
</label>
                <select id="<?php 
            echo esc_attr($this->get_field_id('align'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('align'));
            ?>
">
                    <option value="left"<?php 
            selected($instance['align'], 'left');
            ?>
><?php 
            _e('Left', 'yit');
            ?>
</option>
                    <option value="center"<?php 
            selected($instance['align'], 'center');
            ?>
><?php 
            _e('Center', 'yit');
            ?>
</option>
                    <option value="right"<?php 
            selected($instance['align'], 'right');
            ?>
><?php 
            _e('Right', 'yit');
            ?>
</option>
                </select>
            </p>

            <p>
                <label for="<?php 
            echo esc_attr($this->get_field_id('link'));
            ?>
"><?php 
            _e('Link Image', 'yit');
            ?>
</label>
                <input type="text" id="<?php 
            echo esc_attr($this->get_field_id('link'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('link'));
            ?>
" value="<?php 
            echo esc_attr($instance['link']);
            ?>
" />
            </p>

            <p>
                <label for="<?php 
            echo esc_attr($this->get_field_id('text'));
            ?>
"><?php 
            _e('Text ( you can use html )', 'yit');
            ?>
</label>
                <textarea class="widefat" id="<?php 
            echo esc_attr($this->get_field_id('text'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('text'));
            ?>
" cols="20" rows="16"><?php 
            echo $instance['text'];
            ?>
</textarea>
            </p>

            <p>
                <label for="<?php 
            echo esc_attr($this->get_field_id('autop'));
            ?>
"><?php 
            _e('Automatically add paragraphs', 'yit');
            ?>
</label>
                <input type="checkbox" id="<?php 
            echo esc_attr($this->get_field_id('autop'));
            ?>
" name="<?php 
            echo esc_attr($this->get_field_name('autop'));
            ?>
" value="1"<?php 
            if ($instance['autop']) {
                echo 'checked="checked"';
            }
            ?>
 />
            </p>

        <?php 
        }