public function init() { $mobile = yit_get_model('mobile'); add_action('wp_enqueue_scripts', array(&$this, 'add_popup_css')); if (!yit_get_option('popup') || $mobile->isMobile()) { return; } $this->title = yit_get_option('popup_title'); $this->message = yit_get_option('popupmessage'); $this->image = yit_get_option('popup_image'); $this->newsletter = yit_get_option('popup_news_url'); if (!$this->title && !$this->message && !$this->image && !$this->newsletter) { return; } $this->site_name = sanitize_title(get_bloginfo('name')); $this->cookie_name = 'yit-popup-' . $this->site_name; $this->cookie_access = 'yit-popup-access-' . $this->site_name; add_action('wp_enqueue_scripts', array(&$this, 'add_popup_js')); $this->access_cookie = !isset($_COOKIE[$this->cookie_access]) ? false : $_COOKIE[$this->cookie_access]; $this->no_popup_cookie = !isset($_COOKIE[$this->cookie_name]) ? false : $_COOKIE[$this->cookie_name]; /** action for append popup html **/ if (!$this->access_cookie && !$this->no_popup_cookie) { add_action('yit_after_wrapper', array(&$this, 'get_html')); } }
/** * Add more shortcodes to the framework * */ function yit_add_shortcodes($shortcodes) { /** Edit attributes in existing shortcodes */ unset($shortcodes['section_blog']['attributes']['other_posts_label']); unset($shortcodes['section_services']['attributes']['show_detail_hover']); unset($shortcodes['section_services']['attributes']['show_title_hover']); unset($shortcodes['recentpost']['attributes']['date']); unset($shortcodes['recentpost']['attributes']['excerpt_length']); unset($shortcodes['recentpost']['attributes']['readmore']); $shortcodes['recentpost']['attributes']['date'] = array('title' => __('Show date', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); unset($shortcodes['popularpost']['attributes']['date']); unset($shortcodes['popularpost']['attributes']['excerpt_length']); unset($shortcodes['popularpost']['attributes']['readmore']); $shortcodes['popularpost']['attributes']['date'] = array('title' => __('Show date', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section']['attributes']['items_per_row'] = array('title' => __('Items per row', 'yit'), 'type' => 'select', 'options' => array('2' => __('2 items', 'yit'), '3' => __('3 items', 'yit'), '4' => __('4 items', 'yit'), '6' => __('6 items', 'yit')), 'std' => '4'); $shortcodes['section']['attributes']['show_services_button'] = array('title' => __('Show Button', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section']['attributes']['services_button_text'] = array('title' => __('Button Text', 'yit'), 'type' => 'text', 'std' => 'Read More'); $shortcodes['section_services']['attributes']['services_style'] = array('title' => __('Style', 'yit'), 'type' => 'select', 'options' => array('circle' => __('Circle', 'yit'), 'bandw' => __('Black & White', 'yit')), 'std' => 'circle'); $shortcodes['section']['attributes']['services_style'] = array('title' => __('Style', 'yit'), 'type' => 'select', 'options' => array('' => __('Select an option', 'yit'), 'circle' => __('Circle', 'yit'), 'bandw' => __('Black & White', 'yit')), 'std' => 'circle'); $shortcodes['section_services']['attributes']['items_per_row'] = array('title' => __('Items per row', 'yit'), 'type' => 'select', 'options' => array('2' => __('2 items', 'yit'), '3' => __('3 items', 'yit'), '4' => __('4 items', 'yit'), '6' => __('6 items', 'yit')), 'std' => '4'); $shortcodes['section_services']['attributes']['show_detail_hover'] = array('title' => __('Show detail (Circle)', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section_services']['attributes']['show_title_hover'] = array('title' => __('Show title (Circle)', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section_services']['attributes']['show_services_button'] = array('title' => __('Show Button (B.&W.)', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section_services']['attributes']['services_button_text'] = array('title' => __('Button Text (B.&W.)', 'yit'), 'type' => 'text', 'std' => 'Read More'); $shortcodes['section']['attributes']['portfolio_style'] = array('title' => __('Style', 'yit'), 'type' => 'select', 'options' => array('' => __('Select an option', 'yit'), 'slider' => __('Slider', 'yit')), 'std' => 'slider'); $shortcodes['section_portfolio']['attributes'] = array('items' => array('title' => __('N. of items', 'yit'), 'description' => __('Show all with -1', 'yit'), 'type' => 'number', 'std' => '-1'), 'title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'description' => array('title' => __('Description', 'yit'), 'type' => 'text', 'std' => ''), 'portfolio' => array('title' => __('Portfolio', 'yit'), 'type' => 'select', 'options' => yit_get_model('shortcodes')->get_portfolios(), 'std' => ''), 'show_lightbox_hover' => array('title' => __('Show lightbox hover', 'yit'), 'type' => 'checkbox', 'std' => 'no'), 'portfolio_style' => array('title' => __('Style', 'yit'), 'type' => 'select', 'options' => array('classic' => __('Classic', 'yit'), 'slider' => __('Slider', 'yit')), 'std' => 'classic')); $shortcodes['section']['attributes']['show_author'] = array('title' => __('Show author', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section_blog']['attributes']['show_author'] = array('title' => __('Show author', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section_blog']['attributes']['show_featured_image'] = array('title' => __('Show featured image (for sticky posts)', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); /** Adding Icon Type to share **/ $shortcodes['share']['attributes']['icon_type'] = array('title' => __('Icon Type', 'yit'), 'type' => 'select', 'options' => array('default' => __('Simple', 'yit'), 'fade' => __('Round', 'yit'), 'square' => __('Square', 'yit')), 'std' => 'rounded'); /** Team/accordion **/ $shortcodes['team']['attributes']['style'] = array('title' => __('Style', 'yit'), 'type' => 'select', 'options' => array('professional' => __('Professional', 'yit')), 'std' => 'professional'); /* ***** SQUARED (RUMBLE) STYLE ***** $shortcodes['team']['attributes']['sqrcols'] = array( 'title' => __('Squared columns', 'yit'), 'type' => 'text', 'std' => 'auto' ); $shortcodes['team']['attributes']['sqrsize'] = array( 'title' => __('Squared box size', 'yit'), 'type' => 'text', 'std' => '0.974' ); $shortcodes['team']['attributes']['sqrxoom'] = array( 'title' => __('Squared zoom', 'yit'), 'type' => 'text', 'std' => '1.5' ); $shortcodes['team']['attributes']['sqrslow'] = array( 'title' => __('Squared slowness', 'yit'), 'type' => 'text', 'std' => '150' ); */ $faq_categories = yit_get_faq_categories(); return array_merge($shortcodes, array('testimonials' => array('title' => __('Testimonials', 'yit'), 'description' => __('Show all post on testimonials post types', 'yit'), 'tab' => 'cpt', 'has_content' => false, 'attributes' => array('items' => array('title' => __('N. of items', 'yit'), 'description' => __('Show all with -1', 'yit'), 'type' => 'number', 'std' => '-1'), 'style' => array('title' => __('Style', 'yit'), 'type' => 'select', 'options' => array('square-style' => __('Square Style', 'yit'), 'quote-style' => __('Quote Style', 'yit'), 'circle-style' => __('Circle Style', 'yit'), 'bazar-style' => __('Bazar Style', 'yit')), 'std' => 'square-style'))), 'testimonials_slider' => array('title' => __('Testimonials slider', 'yit'), 'description' => __('Show a slider with testimonials', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('items' => array('title' => __('N. of items', 'yit'), 'type' => 'number', 'std' => ''), 'excerpt' => array('title' => __('Limit words', 'yit'), 'type' => 'number', 'std' => '32'), 'speed' => array('title' => __('Speed (ms)', 'yit'), 'type' => 'number', 'std' => '500'), 'timeout' => array('title' => __('Time out (ms)', 'yit'), 'type' => 'number', 'std' => '5000'))), 'logos_slider' => array('title' => __('Logos slider', 'yit'), 'description' => __('Show a slider with logos', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'items' => array('title' => __('N. of items', 'yit'), 'type' => 'number', 'std' => '-1'), 'height' => array('title' => __('Height (px)', 'yit'), 'type' => 'number', 'std' => '50'), 'speed' => array('title' => __('Speed (ms)', 'yit'), 'type' => 'number', 'std' => '500'))), 'social' => array('title' => __('Social', 'yit'), 'description' => __('Print a simple icon link for social', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('type' => array('title' => __('Type', 'yit'), 'type' => 'select', 'options' => array('facebook' => __('Facebook', 'yit'), 'twitter' => __('Twitter', 'yit'), 'rss' => __('RSS', 'yit'), 'flickr' => __('Flickr', 'yit'), 'linkedin' => __('LinkedIn', 'yit'), 'skype' => __('Skype', 'yit'), 'google' => __('Google', 'yit'), 'pinterest' => __('Pinterest', 'yit'), 'instagram' => __('Instagram', 'yit'), 'google' => __('Google Plus', 'yit'), 'youtube' => __('Youtube', 'yit'), 'bookmark' => __('Bookmark', 'yit'), 'mail' => __('Mail', 'yit'), 'vimeo' => __('Vimeo', 'yit'), 'vine' => __('Vine', 'yit')), 'std' => ''), 'icon_type' => array('title' => __('Icon Type', 'yit'), 'type' => 'select', 'options' => array('default' => __('Default', 'yit'), 'fade' => __('Round and Fade', 'yit'), 'square' => __('Square', 'yit')), 'std' => 'default'), 'size' => array('title' => __('Size', 'yit'), 'type' => 'select', 'options' => array('small' => __('Small', 'yit'), '' => __('Normal', 'yit')), 'std' => ''), 'href' => array('title' => __('URL', 'yit'), 'type' => 'text', 'std' => '#'), 'target' => array('title' => __('Target', 'yit'), 'type' => 'select', 'options' => array('' => __('Default', 'yit'), '_blank' => __('Blank', 'yit'), '_parent' => __('Parent', 'yit'), '_top' => __('Top', 'yit')), 'std' => ''), 'title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''))), 'random_numbers' => array('title' => __('Random numbers', 'yit'), 'description' => __('Show a icon with a block text', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('icon' => array('title' => __('Icon URL', 'yit'), 'type' => 'text', 'std' => ''), 'text' => array('title' => __('Text', 'yit'), 'type' => 'text', 'std' => ''), 'number' => array('title' => __('Number', 'yit'), 'type' => 'text', 'std' => ''), 'last' => array('title' => __('Last element', 'yit'), 'type' => 'checkbox', 'std' => 'no'))), 'box_title' => array('title' => __('Box title', 'yit'), 'description' => __('Show a title centered with line', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array()), 'faq' => array('title' => __('FAQ', 'yit'), 'description' => __('Show a Frequently Asked Questions', 'yit'), 'tab' => 'cpt', 'has_content' => false, 'attributes' => array('filter' => array('title' => __('Filterable', 'yit'), 'type' => 'checkbox', 'std' => 'yes'), 'category' => array('title' => __('Category', 'yit'), 'type' => 'checklist', 'options' => $faq_categories, 'std' => ''))), 'call_three' => array('title' => __('Call to action newsletter', 'yit'), 'description' => __('Show a message with newsletter subscription', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'incipit' => array('title' => __('Incipit', 'yit'), 'type' => 'text', 'std' => ''), 'email' => array('title' => __('E-mail', 'yit'), 'type' => 'text', 'std' => ''), 'email_label' => array('title' => __('E-mail label', 'yit'), 'type' => 'text', 'std' => 'your e-mail'), 'submit' => array('title' => __('Button text', 'yit'), 'type' => 'text', 'std' => ''), 'action' => array('title' => __('Action URL', 'yit'), 'type' => 'text', 'std' => ''), 'hidden_fields' => array('title' => __('Hidden fields', 'yit'), 'type' => 'text', 'std' => ''), 'method' => array('title' => __('Method', 'yit'), 'type' => 'select', 'options' => array('post' => __('POST', 'yit'), 'get' => __('GET', 'yit')), 'std' => 'post'))), 'logo' => array('title' => __('Logo font', 'yit'), 'description' => __('Show a text with logo style', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('size' => array('title' => __('Size of text', 'yit'), 'type' => 'number', 'std' => '44'), 'unit' => array('title' => __('Unit', 'yit'), 'type' => 'select', 'options' => array('px' => 'px', 'em' => 'em', '%' => '%'), 'std' => 'px'), 'color' => array('title' => __('Color', 'yit'), 'type' => 'colorpicker', 'std' => '#b6b6b7'))), 'numbers_sections' => array('title' => __('Numbers sections', 'yit'), 'description' => __('Show a number background with a title and text', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('number' => array('title' => __('Number', 'yit'), 'type' => 'number', 'std' => '1'), 'title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'last' => array('title' => __('Last element', 'yit'), 'type' => 'checkbox', 'std' => 'no'))), 'box_service' => array('title' => __('Box service', 'yit'), 'description' => __('Show a box with services style', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'url' => array('title' => __('URL', 'yit'), 'type' => 'text', 'std' => 'http://'), 'img' => array('title' => __('Image URL', 'yit'), 'type' => 'text', 'std' => 'http://'), 'show_title' => array('title' => __('Show Title', 'yit'), 'type' => 'checkbox', 'std' => 'yes'), 'show_content' => array('title' => __('Show Content', 'yit'), 'type' => 'checkbox', 'std' => 'yes'), 'show_services_button' => array('title' => __('Show Button', 'yit'), 'type' => 'checkbox', 'std' => 'yes'), 'services_button_text' => array('title' => __('Button Text', 'yit'), 'type' => 'text', 'std' => 'Read More'))), 'grid' => array('title' => __('Grid', 'yit'), 'description' => __('Use the grid for the responsive', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('first' => array('title' => __('First', 'yit'), 'type' => 'checkbox', 'std' => 'no'), 'last' => array('title' => __('Last', 'yit'), 'type' => 'checkbox', 'std' => 'no'), 'columns' => array('title' => __('Columns', 'yit'), 'description' => __('value between 1 and 12', 'yit'), 'type' => 'number', 'std' => '1', 'min' => '1', 'max' => '12'))), 'icon_list' => array('title' => __('Icon list', 'yit'), 'description' => __('Use a list with an icon', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'multiple' => true, 'unlimited' => true, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'last' => array('title' => __('Last element', 'yit'), 'type' => 'checkbox', 'std' => 'no'), 'icon_1' => array('title' => __('Icon', 'yit'), 'type' => 'select', 'options' => yit_get_model('shortcodes')->get_awesome_icons(), 'std' => '', 'multiple' => true), 'icon_url_1' => array('title' => __('Icon url', 'yit'), 'type' => 'text', 'std' => '', 'multiple' => true), 'item_1' => array('title' => __('Item', 'yit'), 'type' => 'text', 'std' => '', 'multiple' => true), 'item_link_1' => array('title' => __('Item link', 'yit'), 'type' => 'text', 'std' => '', 'multiple' => true))), 'sitemap' => array('title' => __('Sitemap', 'yit'), 'description' => __('The sitemap can be configured in Theme Options settings.', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'multiple' => false, 'unlimited' => false, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''))), 'label' => array('hide' => true))); }
/** * Load the Google Fonts * * @return void * @since 1.0.0 */ public function add_splash_google_fonts() { $options = array(yit_get_option('splash-container-label_font'), yit_get_option('splash-container-submit_font'), yit_get_option('splash-container-lostback_font')); $fonts = array(); foreach ($options as $option) { yit_get_model('google_font')->add_google_font($option['family']); } }
/** * Display tab html code * * @return string * @since 1.0.0 */ public function display_page() { $skins = yit_get_model('skin')->skins; ?> <div id="skins_skins" class="yit_options rm_option rm_input rm_text"> <div class="option"> <?php if (!empty($skins)) { ?> <label for="skin"><?php _e('Choose a skin to use', 'yit'); ?> </label> <div class="select_wrapper"> <select name="skin" id="skin"> <?php foreach ($skins as $id => $name) { ?> <option value="<?php echo $id; ?> "<?php selected($id, yit_get_option('skin')); ?> ><?php echo $name; ?> </option> <?php } ?> </select> </div> <input type="submit" value="<?php _e('Apply', 'yit'); ?> " class="button" name="apply-skin" id="apply-skin" /> <?php } else { ?> <?php _e('No skin to select.', 'yit'); ?> <?php } ?> </div> <div class="description"> <?php _e('Apply skin you want to use. This will replace some options in the theme options.', 'yit'); ?> </div> <div class="clear"></div> </div> <?php }
/** * Add more shortcodes to the framework * */ function yit_add_shortcodes($shortcodes) { /** Edit attributes in existing shortcodes */ unset($shortcodes['section_blog']['attributes']['other_posts_label']); unset($shortcodes['section_blog']['attributes']['show_featured']); unset($shortcodes['section_blog']['attributes']['show_excerpt']); unset($shortcodes['section_blog']['attributes']['show_readmore']); unset($shortcodes['section_blog']['attributes']['excerpt_length']); unset($shortcodes['section_blog']['attributes']['readmore_text']); unset($shortcodes['section_blog']['attributes']['show_featured']); unset($shortcodes['section_services']['attributes']['show_detail_hover']); unset($shortcodes['section_services']['attributes']['show_title_hover']); unset($shortcodes['arrow']); unset($shortcodes['team']); /*$shortcodes['team']['attributes']['style'] = array( 'title' => __('Style', 'yit'), 'type' => 'select', 'options' => array( 'accordion' => __('Accordion', 'yit'), 'rounded' => __('Round and Fade', 'yit') ), 'std' => 'accordion' ); */ $shortcodes['section']['attributes']['items_per_row'] = array('title' => __('Items per row', 'yit'), 'type' => 'select', 'options' => array('2' => __('2 items', 'yit'), '3' => __('3 items', 'yit'), '4' => __('4 items', 'yit'), '6' => __('6 items', 'yit')), 'std' => '4'); $shortcodes['section']['attributes']['show_services_button'] = array('title' => __('Show Button', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section']['attributes']['services_button_text'] = array('title' => __('Button Text', 'yit'), 'type' => 'text', 'std' => 'Read More'); $shortcodes['section_services']['attributes']['items_per_row'] = array('title' => __('Items per row', 'yit'), 'type' => 'select', 'options' => array('2' => __('2 items', 'yit'), '3' => __('3 items', 'yit'), '4' => __('4 items', 'yit'), '6' => __('6 items', 'yit')), 'std' => '4'); $shortcodes['section_services']['attributes']['show_services_button'] = array('title' => __('Show Button', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section_services']['attributes']['services_button_text'] = array('title' => __('Button Text', 'yit'), 'type' => 'text', 'std' => 'Read More'); $shortcodes['section_services']['attributes']['services_icon_title'] = array('title' => __('Title icon URL', 'yit'), 'type' => 'text', 'desc' => __('Select the icon to use for the title.', 'yit'), 'std' => ''); $shortcodes['section']['attributes']['services_icon_title'] = array('title' => __('Title icon URL', 'yit'), 'type' => 'text', 'desc' => __('Select the icon to use for the title.', 'yit'), 'std' => ''); $shortcodes['section']['attributes']['portfolio_style'] = array('title' => __('Style', 'yit'), 'type' => 'select', 'options' => array('' => __('Select an option', 'yit'), 'classic' => __('Classic', 'yit'), 'pinterest' => __('Pinterest', 'yit')), 'std' => 'classic'); $shortcodes['section_portfolio']['attributes'] = array('items' => array('title' => __('N. of items', 'yit'), 'description' => __('Show all with -1', 'yit'), 'type' => 'number', 'std' => '-1'), 'title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'portfolio_icon_title' => array('title' => __('Title icon URL', 'yit'), 'type' => 'text', 'desc' => __('Select the icon to use for the title.', 'yit'), 'std' => ''), 'description' => array('title' => __('Description', 'yit'), 'type' => 'text', 'std' => ''), 'portfolio' => array('title' => __('Portfolio', 'yit'), 'type' => 'select', 'options' => yit_get_model('shortcodes')->get_portfolios(), 'std' => ''), 'portfolio_style' => array('title' => __('Style', 'yit'), 'type' => 'select', 'options' => array('' => __('Select an option', 'yit'), 'classic' => __('Classic', 'yit'), 'pinterest' => __('Pinterest', 'yit')), 'std' => 'classic'), 'show_lightbox_hover' => array('title' => __('Show lightbox hover', 'yit'), 'type' => 'checkbox', 'std' => 'no')); $shortcodes['section']['attributes']['portfolio_icon_title'] = array('title' => __('Title icon URL', 'yit'), 'type' => 'text', 'desc' => __('Select the icon to use for the title.', 'yit'), 'std' => ''); $shortcodes['section']['attributes']['blog_icon_title'] = array('title' => __('Title icon URL', 'yit'), 'type' => 'text', 'desc' => __('Select the icon to use for the title.', 'yit'), 'std' => ''); $shortcodes['section_blog']['attributes']['blog_icon_title'] = array('title' => __('Title icon URL', 'yit'), 'type' => 'text', 'desc' => __('Select the icon to use for the title.', 'yit'), 'std' => ''); $shortcodes['section_blog']['attributes']['show_author'] = array('title' => __('Show Author', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section']['attributes']['show_author'] = array('title' => __('Show Author', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section']['attributes']['enable_slider'] = $shortcodes['section_blog']['attributes']['enable_slider'] = array('title' => __('Enable Slider', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); $shortcodes['section']['attributes']['blog_show_hover'] = array('title' => __('Enable hover', 'yit'), 'type' => 'checkbox', 'std' => 'yes'); /** Adding Icon Type to share **/ $shortcodes['share']['attributes']['icon_type'] = array('title' => __('Icon Type', 'yit'), 'type' => 'select', 'options' => array('' => __('Simple', 'yit'), 'fade' => __('Round', 'yit')), 'std' => ''); /** Adding button value in the [button] shortcode **/ $shortcodes['button']['attributes']['color']['options'] = array_merge(array('white-button' => __('White Button', 'yit')), $shortcodes['button']['attributes']['color']['options']); $shortcodes['button']['attributes']['color']['options'] = array_merge(array('red-button' => __('Red Button', 'yit')), $shortcodes['button']['attributes']['color']['options']); $shortcodes['button']['attributes']['color']['options'] = array_merge(array('black-button' => __('Black Button', 'yit')), $shortcodes['button']['attributes']['color']['options']); $shortcodes['button']['attributes']['color']['options'] = array_merge(array('white-big-button' => __('White Big Button', 'yit')), $shortcodes['button']['attributes']['color']['options']); $shortcodes['button']['attributes']['color']['options'] = array_merge(array('black-big-button' => __('Black Big Button', 'yit')), $shortcodes['button']['attributes']['color']['options']); $shortcodes['call_two']['attributes']['color']['options'] = array_merge(array('button' => __('Default style', 'yit')), $shortcodes['call_two']['attributes']['color']['options']); $faq_categories = yit_get_faq_categories(); $testimonial_categories = yit_get_testimonial_categories(); return array_merge($shortcodes, array('testimonials' => array('title' => __('Testimonials', 'yit'), 'description' => __('Show all post on testimonials post types', 'yit'), 'tab' => 'cpt', 'has_content' => false, 'attributes' => array('items' => array('title' => __('N. of items', 'yit'), 'description' => __('Show all with -1', 'yit'), 'type' => 'number', 'std' => '-1'), 'cat' => array('title' => __('Categories', 'yit'), 'description' => __('Select the categories of posts to show', 'yit'), 'type' => 'select', 'options' => $testimonial_categories, 'std' => ''))), 'testimonials_slider' => array('title' => __('Testimonials slider', 'yit'), 'description' => __('Show a slider with testimonials', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('items' => array('title' => __('N. of items', 'yit'), 'description' => __('Show all with -1', 'yit'), 'type' => 'number', 'std' => '-1'), 'excerpt' => array('title' => __('Limit words', 'yit'), 'type' => 'number', 'std' => '32'), 'speed' => array('title' => __('Speed (ms)', 'yit'), 'type' => 'number', 'std' => '500'), 'timeout' => array('title' => __('Time out (ms)', 'yit'), 'type' => 'number', 'std' => '5000'), 'cat' => array('title' => __('Categories', 'yit'), 'description' => __('Select the categories of posts to show', 'yit'), 'type' => 'select', 'options' => $testimonial_categories, 'std' => ''), 'title' => array('title' => __('Slider Title', 'yit'), 'description' => __('Select the title of the slider', 'yit'), 'type' => 'text', 'std' => 'Happy customers'))), 'logos_slider' => array('title' => __('Logos slider', 'yit'), 'description' => __('Show a slider with logos', 'yit'), 'tab' => 'cpt', 'has_content' => false, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'items' => array('title' => __('N. of items', 'yit'), 'type' => 'number', 'std' => '-1'), 'height' => array('title' => __('Height (px)', 'yit'), 'type' => 'number', 'std' => '50'), 'speed' => array('title' => __('Speed (ms)', 'yit'), 'type' => 'number', 'std' => '500'))), 'social' => array('title' => __('Social', 'yit'), 'description' => __('Print a simple icon link for social', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('type' => array('title' => __('Type', 'yit'), 'type' => 'select', 'options' => array('facebook' => __('Facebook', 'yit'), 'twitter' => __('Twitter', 'yit'), 'rss' => __('RSS', 'yit'), 'google' => __('Google Plus', 'yit'), 'pinterest' => __('Pinterest', 'yit'), 'instagram' => __('Instagram', 'yit'), 'bookmark' => __('Bookmark', 'yit'), 'mail' => __('Mail', 'yit'), 'flickr' => __('Flickr', 'yit'), 'skype' => __('Skype', 'yit'), 'youtube' => __('Youtube', 'yit')), 'std' => ''), 'icon_type' => array('title' => __('Icon Type', 'yit'), 'type' => 'select', 'options' => array('default' => __('Default', 'yit'), 'round' => __('Round', 'yit'), 'simple-black' => __('Simple Black', 'yit'), 'simple-white' => __('Simple White', 'yit')), 'std' => 'default'), 'size' => array('title' => __('Size', 'yit'), 'type' => 'select', 'options' => array('small' => __('Small', 'yit'), '' => __('Normal', 'yit')), 'std' => ''), 'href' => array('title' => __('URL', 'yit'), 'type' => 'text', 'std' => '#'), 'target' => array('title' => __('Target', 'yit'), 'type' => 'select', 'options' => array('' => __('Default', 'yit'), '_blank' => __('Blank', 'yit'), '_parent' => __('Parent', 'yit'), '_top' => __('Top', 'yit')), 'std' => ''), 'title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''))), 'random_numbers' => array('title' => __('Random numbers', 'yit'), 'description' => __('Show a icon with a block text', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('icon' => array('title' => __('Icon URL', 'yit'), 'type' => 'text', 'std' => ''), 'text' => array('title' => __('Text', 'yit'), 'type' => 'text', 'std' => ''), 'number' => array('title' => __('Number', 'yit'), 'type' => 'text', 'std' => ''), 'last' => array('title' => __('Last element', 'yit'), 'type' => 'checkbox', 'std' => 'no'))), 'box_title' => array('title' => __('Box title', 'yit'), 'description' => __('Show a title centered with line', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('class' => array('title' => __('Class', 'yit'), 'type' => 'text', 'std' => ''), 'border' => array('title' => __('Border', 'yit'), 'type' => 'select', 'options' => array('bottom' => __('bottom', 'yit'), 'middle' => __('middle', 'yit'), 'around' => __('around', 'yit'), 'none' => __('none', 'yit')), 'std' => 'middle'))), 'faq' => array('title' => __('FAQ', 'yit'), 'description' => __('Show a Frequently Asked Questions', 'yit'), 'tab' => 'cpt', 'has_content' => false, 'attributes' => array('category' => array('title' => __('Category', 'yit'), 'type' => 'checklist', 'options' => $faq_categories, 'std' => ''))), 'call_three' => array('title' => __('Call to action newsletter', 'yit'), 'description' => __('Show a message with newsletter subscription', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'incipit' => array('title' => __('Incipit', 'yit'), 'type' => 'text', 'std' => ''), 'email' => array('title' => __('E-mail', 'yit'), 'type' => 'text', 'std' => ''), 'email_label' => array('title' => __('E-mail label', 'yit'), 'type' => 'text', 'std' => 'your e-mail'), 'submit' => array('title' => __('Button text', 'yit'), 'type' => 'text', 'std' => ''), 'action' => array('title' => __('Action URL', 'yit'), 'type' => 'text', 'std' => ''), 'hidden_fields' => array('title' => __('Hidden fields', 'yit'), 'type' => 'text', 'std' => ''), 'method' => array('title' => __('Method', 'yit'), 'type' => 'select', 'options' => array('post' => __('POST', 'yit'), 'get' => __('GET', 'yit')), 'std' => 'post'))), 'call_four' => array('title' => __('Call to action with banner button', 'yit'), 'description' => __('Shows a box with an banner, text and button', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('href' => array('title' => __('URL', 'yit'), 'type' => 'text', 'std' => '#'), 'background_image_url' => array('title' => __('Background image URL', 'yit'), 'type' => 'text', 'std' => '#'), 'label_button' => array('title' => __('Label button', 'yit'), 'type' => 'text', 'std' => ''), 'slogan' => array('title' => __('Slogan', 'yit'), 'type' => 'text', 'std' => ''), 'subslogan' => array('title' => __('Subslogan', 'yit'), 'type' => 'text', 'std' => ''), 'hover_color' => array('title' => __('Hover Color', 'yit'), 'type' => 'colorpicker', 'std' => '#000000'))), 'logo' => array('title' => __('Logo font', 'yit'), 'description' => __('Show a text with logo style', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('size' => array('title' => __('Size of text', 'yit'), 'type' => 'number', 'std' => '44'), 'unit' => array('title' => __('Unit', 'yit'), 'type' => 'select', 'options' => array('px' => 'px', 'em' => 'em', '%' => '%'), 'std' => 'px'), 'color' => array('title' => __('Color', 'yit'), 'type' => 'colorpicker', 'std' => '#b6b6b7'))), 'numbers_sections' => array('title' => __('Numbers sections', 'yit'), 'description' => __('Show a number background with a title and text', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('number' => array('title' => __('Number', 'yit'), 'type' => 'number', 'std' => '1'), 'title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'last' => array('title' => __('Last element', 'yit'), 'type' => 'checkbox', 'std' => 'no'))), 'box_service' => array('title' => __('Box service', 'yit'), 'description' => __('Show a box with services style', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'url' => array('title' => __('URL', 'yit'), 'type' => 'text', 'std' => 'http://'), 'img' => array('title' => __('Image URL', 'yit'), 'type' => 'text', 'std' => 'http://'), 'show_title' => array('title' => __('Show Title', 'yit'), 'type' => 'checkbox', 'std' => 'yes'), 'show_content' => array('title' => __('Show Content', 'yit'), 'type' => 'checkbox', 'std' => 'yes'), 'show_services_button' => array('title' => __('Show Button', 'yit'), 'type' => 'checkbox', 'std' => 'yes'), 'services_button_text' => array('title' => __('Button Text', 'yit'), 'type' => 'text', 'std' => 'Read More'))), 'grid' => array('title' => __('Grid', 'yit'), 'description' => __('Use the grid for the responsive', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'attributes' => array('first' => array('title' => __('First', 'yit'), 'type' => 'checkbox', 'std' => 'no'), 'last' => array('title' => __('Last', 'yit'), 'type' => 'checkbox', 'std' => 'no'), 'columns' => array('title' => __('Columns', 'yit'), 'description' => __('value between 1 and 12', 'yit'), 'type' => 'number', 'std' => '1', 'min' => '1', 'max' => '12'))), 'icon_list' => array('title' => __('Icon list', 'yit'), 'description' => __('Use a list with an icon', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'multiple' => true, 'unlimited' => true, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'last' => array('title' => __('Last element', 'yit'), 'type' => 'checkbox', 'std' => 'no'), 'icon_1' => array('title' => __('Icon', 'yit'), 'type' => 'select', 'options' => yit_get_model('shortcodes')->get_awesome_icons(), 'std' => '', 'multiple' => true), 'icon_url_1' => array('title' => __('Icon url', 'yit'), 'type' => 'text', 'std' => '', 'multiple' => true), 'item_1' => array('title' => __('Item', 'yit'), 'type' => 'text', 'std' => '', 'multiple' => true), 'item_link_1' => array('title' => __('Item link', 'yit'), 'type' => 'text', 'std' => '', 'multiple' => true))), 'sitemap' => array('title' => __('Sitemap', 'yit'), 'description' => __('The sitemap can be configured in Theme Options settings.', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'multiple' => false, 'unlimited' => false, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''))), 'credit_card' => array('title' => __('Credit card', 'yit'), 'description' => __('Show an images of credit cards', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'attributes' => array('type' => array('title' => __('Type', 'yit'), 'type' => 'checklist', 'options' => array('amazon' => 'Amazon', 'amex' => 'American Express', 'amex_gold' => 'American Express Gold', 'amex_green' => 'American Express Green', 'amex_silver' => 'American Express Silver', 'apple' => 'Apple', 'bank' => 'Bank', 'cash' => 'Cash', 'chase' => 'Chase', 'coupon' => 'Coupon', 'credit' => 'Credit', 'debit' => 'Debit', 'discover' => 'Discover', 'discover_novus' => 'Discover Novus', 'echeck' => 'eCheck', 'generic_1' => 'Generic 1', 'generic_2' => 'Generic 2', 'generic_3' => 'Generic 3', 'gift' => 'Gift', 'gold' => 'Gold', 'googleckout' => 'Google Checkout', 'itunes' => 'iTunes (red)', 'itunes_2' => 'iTunes (blue)', 'itunes_3' => 'iTunes (green)', 'mastercard' => 'Mastercard', 'mileage' => 'Mileage', 'paypal' => 'PayPal', 'sapphire' => 'Sapphire', 'solo' => 'Solo', 'visa' => 'Visa'), 'std' => 'generic_1'))), 'teaser' => array('title' => __('Teaser', 'yit'), 'description' => __('Create a banner with an image, a link and text.', 'yit'), 'tab' => 'shortcodes', 'has_content' => false, 'multiple' => false, 'unlimited' => false, 'attributes' => array('title' => array('title' => __('Title', 'yit'), 'type' => 'text', 'std' => ''), 'subtitle' => array('title' => __('Subtitle', 'yit'), 'type' => 'text', 'std' => ''), 'image' => array('title' => __('Image URL', 'yit'), 'type' => 'text', 'std' => ''), 'link' => array('title' => __('Link', 'yit'), 'type' => 'text', 'std' => ''), 'target' => array('title' => __('Target', 'yit'), 'type' => 'select', 'options' => array('' => '', '_blank' => __('Blank', 'yit'), '_parent' => __('Parent', 'yit'), '_self' => __('Self', 'yit'), '_top' => __('Top', 'yit')), 'std' => ''), 'hover_class' => array('title' => __('Hover Skin', 'yit'), 'type' => 'select', 'options' => array('black' => __('Black', 'yit'), 'white' => __('White', 'yit')), 'std' => ''), 'slogan_position' => array('title' => __('Slogan Position', 'yit'), 'type' => 'select', 'options' => array('top' => __('Top', 'yit'), 'center' => __('Center', 'yit'), 'bottom' => __('Bottom', 'yit')), 'std' => ''))), 'parallax' => array('title' => __('Parallax effect', 'yit'), 'description' => __('Create a fancy full-width parallax effect', 'yit'), 'tab' => 'shortcodes', 'has_content' => true, 'multiple' => false, 'unlimited' => false, 'attributes' => array('height' => array('title' => __('Container height', 'yit'), 'type' => 'number', 'std' => 300), 'image' => array('title' => __('Background Image URL', 'yit'), 'type' => 'text', 'std' => ''), 'valign' => array('title' => __('Vertical Align', 'yit'), 'type' => 'select', 'options' => array('top' => __('Top', 'yit'), 'center' => __('Center', 'yit'), 'bottom' => __('Bottom', 'yit')), 'std' => 'center'), 'halign' => array('title' => __('Horizontal Align', 'yit'), 'type' => 'select', 'options' => array('left' => __('Left', 'yit'), 'center' => __('Center', 'yit'), 'right' => __('Right', 'yit')), 'std' => 'center'), 'color' => array('title' => __('Content Text Color', 'yit'), 'type' => 'colorpicker', 'std' => '#ffffff'), 'hover_color' => array('title' => __('Links hover Color', 'yit'), 'type' => 'colorpicker', 'std' => '#000'), 'effect' => array('title' => __('Effect', 'yit'), 'type' => 'select', 'options' => array('fadeIn' => __('fadeIn', 'yit'), 'fadeInUp' => __('fadeInUp', 'yit'), 'fadeInDown' => __('fadeInDown', 'yit'), 'fadeInLeft' => __('fadeInLeft', 'yit'), 'fadeInRight' => __('fadeInRight', 'yit'), 'fadeInUpBig' => __('fadeInUpBig', 'yit'), 'fadeInDownBig' => __('fadeInDownBig', 'yit'), 'fadeInLeftBig' => __('fadeInLeftBig', 'yit'), 'fadeInRightBig' => __('fadeInRightBig', 'yit'), 'bounceIn' => __('bounceIn', 'yit'), 'bounceInDown' => __('bounceInDown', 'yit'), 'bounceInUp' => __('bounceInUp', 'yit'), 'bounceInLeft' => __('bounceInLeft', 'yit'), 'bounceInRight' => __('bounceInRight', 'yit'), 'rotateIn' => __('rotateIn', 'yit'), 'rotateInDownLeft' => __('rotateInDownLeft', 'yit'), 'rotateInDownRight' => __('rotateInDownRight', 'yit'), 'rotateInUpLeft' => __('rotateInUpLeft', 'yit'), 'rotateInUpRight' => __('rotateInUpRight', 'yit'), 'lightSpeedIn' => __('lightSpeedIn', 'yit'), 'hinge' => __('hinge', 'yit'), 'rollIn' => __('rollIn', 'yit')), 'std' => 'fadeIn'), 'button_size' => array('title' => __('Button Size', 'yit'), 'type' => 'select', 'options' => array('large' => __('Large', 'yit'), 'small' => __('Small', 'yit')), 'std' => 'small'))), 'label' => array('hide' => true))); }
function yit_hide_second_tab_layersslider() { ?> <script type="text/javascript"> jQuery(document).ready(function($){ if ( $('#<?php echo yit_get_model('cpt_unlimited')->metabox_name; ?> _slider_type').val() == 'layer-slider' ) $('a[href="#item-edit"]').parent().remove(); }); </script> <?php }
/** * Print an iframe for the shop * * @return void * @since 1.0.0 */ public function display_page() { $this->get_header('skins'); $this->get_form(array('id' => 'skins', 'action' => 'panel_skins', 'enctype' => true, 'subpage' => strtolower(str_replace('YIT_Submenu_', '', __CLASS__)), 'action-field' => yit_get_model('skin')->admin_action)); foreach ($this->_tabClasses as $slug => $class) { ?> <div id="yit_<?php echo $slug; ?> _skins" class="yit-box"> <?php $class->display_page(); ?> </div> <?php } $this->get_footer(); }
* * 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 global $post; extract($args); if (empty($value) || !is_array($value)) { $value = array(); } $categories = yit_get_model('cpt_unlimited')->get_setting('categories', $post->ID); ?> <div id="<?php echo $id; ?> -container" <?php if (isset($deps)) { ?> data-field="<?php echo $id; ?> " data-dep="<?php echo $deps['ids']; ?> " data-value="<?php echo $deps['values'];
/** * Delete a transient. * * @since 2.8.0 * @package WordPress * @subpackage Transient * * @uses do_action() Calls 'delete_transient_$transient' hook before transient is deleted. * @uses do_action() Calls 'deleted_transient' hook on success. * * @param string $transient Transient name. Expected to not be SQL-escaped. * @return bool true if successful, false otherwise */ function yit_delete_transient( $transient ) { return yit_get_model( 'transient' )->delete_transient( $transient ); }
/** * Detect if we must use a color darker or lighter then the background. * * @param string $color * @param string $dark * @param string $light * @return string * @since 1.0 * @author Andrea Grillo <*****@*****.**> */ function yit_light_or_dark($color, $dark = '#000000', $light = '#FFFFFF') { return yit_get_model('colors')->light_or_dark($color, $dark, $light); }
/** * @see Walker::start_el() * @since 3.0.0 * * Walker::start_el(&$output, $object, $depth = 0, $args = Array, $current_object_id = 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. * @param object $args */ 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-' . (isset($_GET['edit-menu-item']) && $item_id == $_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; ?> <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 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'); ?> ">↑</abbr></a> | <a href="<?php echo 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'); ?> ">↓</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 isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ? admin_url('nav-menus.php') : 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_get_model('nav_menu')->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'] == 'upload') { ?> <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}); } ?> " /> <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 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 $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(); }
_e('Filter Shortcodes', 'yit'); ?> " /> </div> <div id="shortcode-back"> <label class="shortcode-back"><?php _e('Back to shortcodes list', 'yit'); ?> </label> </div> <div id="media-shortcodes"> <?php $tabs = ''; foreach (yit_get_model('shortcodes')->shortcodes as $shortcode => $atts) { ?> <?php if (!isset($atts['hide'])) { ?> <div class="shortcode <?php echo $atts['tab']; ?> " id="shortcode-<?php echo $shortcode; ?> " title="<?php echo $atts['description']; ?> "> <img src="<?php
<?php /** * Your Inspiration Themes * * @package WordPress * @subpackage Your Inspiration Themes * @author Your Inspiration Themes Team <*****@*****.**> * * 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 */ $var['posts_per_page'] = -1; yit_get_model('portfolio')->shortcode_atts = $var; yit_set_portfolio_loop($portfolio); $sidebar_layout = yit_get_sidebar_layout(); $postsPerRow = $sidebar_layout != 'sidebar-no' ? 3 : 4; $sp_span_class = "span" . ($sidebar_layout != 'sidebar-no' ? '3' : '3'); $sp_span_class_max = "span" . ($sidebar_layout != 'sidebar-no' ? '9' : '12'); $thumbSize = $sidebar_layout != 'sidebar-no' ? 'section_portfolio_sidebar' : 'section_portfolio'; $i = 0; $item_selected = 0; ?> <div class="section portfolio"><!-- section blog wrapper --> <?php if (!empty($title)) { yit_string('<h3 class="title">', $title, '</h3>'); }
/** * Save the file with all css * * @return bool * @since 1.0.0 */ function yit_add_google_font($font) { yit_get_model('google_font')->add_google_font($font); }
/** * Add the message to the system * * @since 1.0.0 */ function yit_add_message($message, $type, $region, $clean = false) { yit_get_model('message')->addMessage($message, $type, $region, $clean); }
/** * Add the separator between metaboxes * * @param string $metabox_id * @param string $tab * @return void * @since 1.0.0 */ function yit_metaboxes_sep($metabox_id, $tab) { $metabox = yit_get_model('metabox'); $metabox->add_option_metabox($metabox_id, $tab, microtime(), 'sep', array()); }
/** * Add image sizes with the function add_image_size(), if $this->is_onfly_active is false * * @since 1.0.0 */ function yit_add_image_size($name, $width, $height, $crop = false) { yit_get_model('image')->add_image_size($name, $width, $height, $crop); }
/** * Get contact form to show in select menu * */ public function get_contact_form(){ $contact = yit_get_model('cpt_unlimited')->get_posts_types('contactform'); $c = array(); foreach( $contact as $cont ): $c[$cont->post_name] = ($cont->post_title) ? $cont->post_title : 'Form ID: '. $cont->ID; endforeach; return $c; }
/** * Print the pagination of the current loop of portfolio * * @param string $class Extra class. * * @since 1.0 */ function yit_portfolio_get_setting($var, $post_id = false) { if (!$post_id) { $return = yit_get_model('portfolio')->get($var); } else { $return = yit_get_model('cpt_unlimited')->get_setting($var, $post_id); if (empty($return)) { $portfolio_type = yit_get_model('cpt_unlimited')->get_setting('portfolio_type', $post_id); $return = yit_get_model('cpt_unlimited')->get_setting($var . '_' . $portfolio_type, $post_id); } } return $return; }
/** * @return void * @since 1.0.0 */ function yit_install_sampledata_callback() { global $wpdb; $gz = YIT_THEME_ASSETS_DIR . '/sample-data/' . YIT_THEME_NAME . '.gz'; if (file_exists($gz)) { require_once YIT_CORE_LIB . '/yit/Backup/Backup.php'; if (YIT_Backup::import_backup($gz)) { yit_get_model('message')->addMessage(__('Sample data installed correctly!', 'yit')); } else { yit_get_model('message')->addMessage(__('Error. Unable to install sample data!', 'yit') . ' SQL ERROR: ' . $wpdb->last_error, 'error'); } } else { yit_get_model('message')->addMessage(__('Error. The file ' . $gz . ' does not exists!', 'yit'), 'error'); } yit_get_model('message')->printGlobalMessages(); die; }
/** * Get accordions to show in select menu * */ public function get_accordions() { $accordions = yit_get_model('cpt_unlimited')->get_posts_types('accordions'); $a = array(); foreach ($accordions as $accordion) { $a[$accordion->post_name] = $accordion->post_title ? $accordion->post_title : 'Accordion ID: ' . $accordion->ID; } return $a; }
/** * Ajax call used to retrieve contact form fields * * @since 1.0.0 */ public function add_contactform_field($args = array()) { extract(wp_parse_args($args, array('index' => isset($_POST['action']) && $_POST['action'] == 'add_contactform_field' && isset($_POST['index']) ? intval($_POST['index']) : 0, 'post_id' => isset($_POST['action']) && $_POST['action'] == 'add_contactform_field' && isset($_POST['post_id']) ? intval($_POST['post_id']) : 0, 'field_name' => isset($_POST['action']) && $_POST['action'] == 'add_contactform_field' && isset($_POST['field_name']) ? $_POST['field_name'] : 0, 'die' => true))); $index++; // evita di salvare in array un valore con chiave 0, perchè viene cancellato dal sistema, durante il salvataggio $items = array_values(yit_get_model('cpt_unlimited')->get_items($post_id)); $value = wp_parse_args(isset($items[$index - 1]) ? $items[$index - 1] : array(), array('order' => 0, 'title' => '', 'data_name' => '', 'description' => '', 'type' => 'text', 'already_checked' => '', 'options' => array(), 'option_selected' => '', 'error' => '', 'required' => '', 'is_email' => '', 'reply_to' => '', 'class' => '', 'icon' => '')); $args = array('name' => $field_name . '[items][' . $index . ']', 'id' => $field_name . '_items_' . $index, 'index' => $index, 'value' => $value); yit_get_template('admin/post-type-unlimited/settings-contactform-field.php', $args); if ($die) { die; } }
/** * @return void * @since 1.0.0 */ function yit_install_sampledata_callback() { global $wpdb; $gz = YIT_THEME_ASSETS_DIR . '/sample-data/' . YIT_THEME_NAME . '.gz'; global $woocommerce; if (!empty($woocommerce) && version_compare(preg_replace('/-beta-([0-9]+)/', '', $woocommerce->version), '2.1', '<')) { $gz = YIT_THEME_ASSETS_DIR . '/sample-data/' . YIT_THEME_NAME . '_woo_2.0.x.gz'; } if (file_exists($gz)) { require_once YIT_CORE_LIB . '/yit/Backup/Backup.php'; if (YIT_Backup::import_backup($gz)) { yit_get_model('message')->addMessage(__('Sample data installed correctly!', 'yit')); } else { yit_get_model('message')->addMessage(__('Error. Unable to install sample data!', 'yit') . ' SQL ERROR: ' . $wpdb->last_error, 'error'); } } else { yit_get_model('message')->addMessage(__('Error. The file ' . $gz . ' does not exists!', 'yit'), 'error'); } yit_get_model('message')->printGlobalMessages(); die; }
/** * Enqueue stylesheets with wp_enqueue_style * * @return void * @since 1.0.0 */ public function enqueue() { usort($this->_stylesheets, array($this, 'sortByPriority')); $excludedStylesheets = array(); foreach ($this->_stylesheets as $s) { extract($s); if ($type == 'external') { wp_enqueue_style($handle, $src, $deps, $ver, $media); } elseif ($type == 'yit') { if (!$exclude && ($media == 'all' || $media == 'screen')) { //wp_enqueue_style( $handle, $src, $deps, $ver, $media ); $filename = str_replace(get_template_directory_uri(), get_template_directory(), $src); $style = ""; if (file_exists($filename)) { $style = file_get_contents($filename); } $this->_style .= "/* {$handle} - {$src} */\n" . $this->replacePath($src, $style) . "\n\n"; } elseif (!$exclude) { wp_enqueue_style($handle, $src, $deps, $ver, $media); } else { $excludedStylesheets[] = $s; } } } //save the css in the file using cache $cache = yit_get_model('cache'); global $wpdb; $index = $wpdb->blogid != 0 ? '-' . $wpdb->blogid : ''; $this->_styleFilename = str_replace('.css', $index . '.css', $this->_styleFilename); if (YIT_DEBUG || $cache->is_expired($this->_styleFilename)) { $cache->save($this->_styleFilename, $this->_style); } wp_enqueue_style("styles-minified", yit_get_model('cache')->locate_url($this->_styleFilename)); //include the excluded stylesheets above foreach ($excludedStylesheets as $s) { extract($s); wp_enqueue_style($handle, $src, $deps, $ver, $media); } }
_e('Add tab', 'yit'); ?> </a> <img src="<?php echo esc_url(admin_url('images/wpspin_light.gif')); ?> " class="ajax-loading" id="add-items-ajax-loading" alt="" /> </p> <div class="featurestab_items panel"> <?php $i = 0; foreach (array_values($this_obj->get_items($post->ID)) as $item_id => $the_) { yit_get_model('features_tab')->add_featurestab_field(array('index' => $i, 'post_id' => $post->ID, 'field_name' => $this_obj->metabox_name, 'die' => false)); $i++; } ?> </div> <script> jQuery(document).ready(function($){ //toggle items $(document).on('click', '.featurestab_item h3, .featurestab_item .handlediv', function() { var p = $(this).parent('.featurestab_item'), id = p.attr('id'); p.toggleClass('closed');
/** * Ajax call used to retrieve features tab form fields * * @since 1.0.0 */ public function add_featurestab_field($args = array()) { extract(wp_parse_args($args, array('index' => isset($_POST['action']) && $_POST['action'] == 'add_featurestab_field' && isset($_POST['index']) ? intval($_POST['index']) : 0, 'post_id' => isset($_POST['action']) && $_POST['action'] == 'add_featurestab_field' && isset($_POST['post_id']) ? intval($_POST['post_id']) : 0, 'field_name' => isset($_POST['action']) && $_POST['action'] == 'add_featurestab_field' && isset($_POST['field_name']) ? $_POST['field_name'] : 0, 'die' => true))); $index++; // evita di salvare in array un valore con chiave 0, perchè viene cancellato dal sistema, durante il salvataggio $items = array_values(yit_get_model('cpt_unlimited')->get_items($post_id)); $value = wp_parse_args(isset($items[$index - 1]) ? $items[$index - 1] : array(), array('order' => 0, 'title' => '', 'content' => '', 'icon' => '')); $args = array('name' => $field_name . '[items][' . $index . ']', 'id' => $field_name . '_items_' . $index, 'index' => $index, 'value' => $value); yit_get_template('admin/post-type-unlimited/settings-featurestab-field.php', $args); if ($die) { die; } }
/** * Enqueue stylesheets with wp_enqueue_style * * @return void * @since 1.0.0 */ public function enqueue() { usort($this->_stylesheets, array($this, 'sortByPriority')); $excludedStylesheets = array(); foreach ($this->_stylesheets as $s) { extract($s); if ($type == 'external') { wp_enqueue_style($handle, $src, $deps, $ver, $media); } elseif ($type == 'yit') { if (!$exclude && ($media == 'all' || $media == 'screen')) { //wp_enqueue_style( $handle, $src, $deps, $ver, $media ); $tmp_src_with_ssl = str_replace(get_template_directory_uri() . '/', '', $src); $tmp_src_with_ssl = preg_replace('/http(s)?:/', '', $tmp_src_with_ssl); $filename = locate_template($tmp_src_with_ssl, false); $style = ""; if (file_exists($filename)) { $style = file_get_contents($filename); } $this->_style .= "/* {$handle} - {$src} */\n" . $this->replacePath($src, $style) . "\n\n"; } elseif (!$exclude) { wp_enqueue_style($handle, $src, $deps, $ver, $media); } else { $excludedStylesheets[] = $s; } } } //save the css in the file using cache $cache = yit_get_model('cache'); if (YIT_DEBUG || $cache->is_expired($this->_styleFilename)) { $cache->save($this->_styleFilename, $this->_style); } wp_enqueue_style("styles-minified", YIT_CACHE_URL . '/' . $this->_styleFilename); //include the excluded stylesheets above foreach ($excludedStylesheets as $s) { extract($s); wp_enqueue_style($handle, $src, $deps, $ver, $media); } }
/** * Print the breadcrumb. * * @param string $sep * @return string * @since 1.0.0 */ function yit_breadcrumb($delimiter = '»') { global $post; $home = apply_filters('yit_homepage_breadcrumb_text', __('Home Page', 'yit')); // text for the 'Home' link $before = '<a class="no-link current" href="#">'; // tag before the current crumb $after = '</a>'; // tag after the current crumb echo '<p id="yit-breadcrumb" itemprop="breadcrumb">'; //$homeLink = site_url(); $homeLink = apply_filters('yit_breadcrumb_homelink', YIT_SITE_URL); if (!is_home() && !is_front_page()) { echo '<a class="home" href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' '; } if (is_single() && yit_get_model('cpt_unlimited')->is_cptu($post->post_type)) { $tmp_post = get_post(get_the_id()); echo '<a href="' . get_permalink() . '">' . $tmp_post->post_title . '</a> ' . $delimiter . ' '; echo $before . yit_remove_chars_title(get_the_title()) . $after; } elseif (is_category()) { global $wp_query; $cat_obj = $wp_query->get_queried_object(); $thisCat = $cat_obj->term_id; $thisCat = get_category($thisCat); $parentCat = get_category($thisCat->parent); if ($thisCat->parent != 0) { echo get_category_parents($parentCat, true, ' ' . $delimiter . ' '); } echo $before . sprintf(__('Archive by category "%s"', 'yit'), single_cat_title('', false)) . $after; } elseif (is_day()) { echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' '; echo '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a> ' . $delimiter . ' '; echo $before . get_the_time('d') . $after; } elseif (is_month()) { echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' '; echo $before . get_the_time('F') . $after; } elseif (is_year()) { echo $before . get_the_time('Y') . $after; } elseif (is_single() && !is_attachment()) { if (get_post_type() != 'post') { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; echo '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $delimiter . ' '; echo $before . get_the_title() . $after; } else { $cat = get_the_category(); $cat = $cat[0]; if (!empty($cat)) { echo get_category_parents($cat, true, ' ' . $delimiter . ' '); } echo $before . get_the_title() . $after; } } elseif (!is_single() && !is_page() && get_post_type() != 'post' && get_post_type() != 'page' && !is_404()) { $post_type = get_post_type_object(get_post_type()); echo $before . $post_type->labels->singular_name . $after; } elseif (is_attachment()) { $parent = get_post($post->post_parent); if ($parent->post_type == 'page' || $parent->post_type == 'post') { $cat = get_the_category($parent->ID); $cat = $cat[0]; echo get_category_parents($cat, true, ' ' . $delimiter . ' '); } echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a> ' . $delimiter . ' '; echo $before . get_the_title() . $after; } elseif (is_page() && !$post->post_parent) { echo $before . ucfirst(strtolower(get_the_title())) . $after; } elseif (is_page() && $post->post_parent) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>'; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) { echo $crumb . ' ' . $delimiter . ' '; } echo $before . yit_remove_chars_title(get_the_title()) . $after; } elseif (is_search()) { echo $before . sprintf(__('Search results for "%s"', 'yit'), get_search_query()) . $after; } elseif (is_tag()) { echo $before . sprintf(__('Posts tagged "%s"', 'yit'), single_tag_title('', false)) . $after; } elseif (is_author()) { global $author; $userdata = get_userdata($author); echo $before . sprintf(__('Articles posted by %s', 'yit'), $userdata->display_name) . $after; } elseif (is_404()) { echo $before . __('Error 404', 'yit') . $after; } elseif (is_home()) { echo $before . apply_filters('yit_posts_page_breadcrumb', __('Home', 'yit')) . $after; } if (get_query_var('paged') > 1) { if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) { echo ' ('; } echo $before . __('Page', 'yit') . ' ' . get_query_var('paged') . $after; if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) { echo ')'; } } echo '</p>'; }
/** * Import backup data * * @param $file array * @return bool * */ public static function import_backup($file = '') { global $wpdb, $yiw_wptables; $wpdb->show_errors(); $error = ''; if (isset($_FILES['import-file']) && empty($file)) { if (!isset($_FILES['import-file'])) { wp_die(__("The file you have insert doesn't valid.", 'yit')); } switch (substr($_FILES['import-file']['name'], -3)) { case 'xml': $error = sprintf(__('The file you have insert is a WordPress eXtended RSS (WXR) file. You need to use this into the %s admin page to import this file. Here only <b>.gz</b> file are allowed. <a href="%s" title="Tools -> Import">Tools -> Import</a>', 'yit'), admin_url('import.php', false)); break; case 'zip': case 'rar': $error = sprintf(__('The file you have insert is a ZIP or RAR file, that it doesn\'t allowed in this case. Here only <b>.gz</b> file are allowed. <a href="%s" title="Tools -> Import">Tools -> Import</a>', 'yit'), admin_url('import.php', false)); break; } if (substr($_FILES['import-file']['name'], -2) != 'gz') { $error = sprintf(__('The file you have insert is not a valid file. Here only <b>.gz</b> file are allowed. <a href="%s" title="Tools -> Import">Tools -> Import</a>', 'yit'), admin_url('import.php', false)); } if ($error != '') { yit_get_model('message')->addMessage($error, 'error'); return false; } } $file = empty($file) ? $_FILES['import-file']['tmp_name'] : $file; // get db encoded $content_file = file_get_contents($file); $db = unserialize(base64_decode(gzuncompress($content_file))); //yit_debug($db); die; array_walk_recursive($db, 'yit_convert_url', 'in_import'); //yit_debug($db); die; if (!is_array($db)) { wp_die(__('An error encoured during during import. Please try again.', 'yit')); } set_time_limit(0); // tables foreach (self::$wptables as $table) { // delete all row of each table $wpdb->query("TRUNCATE TABLE {$wpdb->{$table}}"); // insert new data $error_data = array(); $insert = array(); foreach ($db[$table] as $id => $data) { $insert[] = YIT_Backup::_makeInsertSQL($data); } if (!empty($db[$table])) { $insert = implode(', ', $insert); $fields = implode('`, `', array_keys($db[$table][0])); //wp_die("INSERT INTO `{$wpdb->$table}` ( `$fields` ) VALUES " . $insert); $wpdb->query("INSERT INTO `{$wpdb->{$table}}` ( `{$fields}` ) VALUES " . $insert); } } $tables = apply_filters('yit_sample_data_tables', array()); $tables = apply_filters('yit_sample_data_tables_import', $tables); if (!empty($tables)) { foreach ($tables as $table) { if (!isset($db[$table])) { continue; } if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}{$table}'") == $wpdb->prefix . $table) { #yiw_string_( '<p></p><p><strong>', '// ' . $table, '</strong><br />' ); // delete all row of each table $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}{$table}"); #yiw_string_( '', sprintf( __( 'Truncated %s table', 'yit' ), $wpdb->prefix . $table ), '...<br />' ); // insert new data $insert = array(); foreach ($db[$table] as $id => $data) { $insert[] = YIT_Backup::_makeInsertSQL($data); } if (!empty($db[$table])) { $insert = implode(', ', $insert); $fields = implode('`, `', array_keys($db[$table][0])); $wpdb->query("INSERT INTO `{$wpdb->prefix}{$table}` ( `{$fields}` ) VALUES " . $insert); } } } } # yiw_string_( '<p></p><p><strong>', '// options', '</strong><br />' ); // delete options $theme = get_option('stylesheet'); $options = array(yit_get_model('panel')->option_name, 'sidebars_widgets', 'show_on_front', 'page_on_front', 'page_for_posts', 'widget%', 'theme\\_mods\\_%', 'rewrite_rules'); $options = apply_filters('yit_sample_data_options', $options); $options = apply_filters('yit_sample_data_options_import', $options); $sql_options = array(); foreach ($options as $option) { if (strpos($option, '%') !== FALSE) { $operator = 'LIKE'; } else { $operator = '='; } $sql_options[] = "option_name {$operator} '{$option}'"; } $sql_options = implode(' OR ', $sql_options); $sql = "DELETE FROM {$wpdb->options} WHERE {$sql_options};"; #if( $wpdb->query( $sql ) ) #yiw_string_( '', sprintf( __( 'Deleted value from %s table', 'yit' ), $wpdb->options ), '...<br />' ); #else #yiw_string_( '', sprintf( __( 'Error during deleting from %s table (SQL: %s)', 'yit' ), $wpdb->options, $sql ), '...<br />' ); $wpdb->query($sql); // update options $error_data = array(); $check = $wpdb->get_results("SELECT * FROM {$wpdb->options} WHERE option_id = 1", ARRAY_A); foreach ($db['options'] as $id => $option) { if (!isset($check['blog_id'])) { unset($option['blog_id']); } if ($wpdb->insert($wpdb->options, $option)) { $insert = true; } else { $insert = false; } // save the ID that has error, to show. if (!$insert) { $wpdb->print_error(); } //$error_data[] = $option['option_name']; } #if( $insert ) # yiw_string_( '', sprintf( __( 'Insert new values, into %s table', 'yit' ), $wpdb->options ), '...</p>' ); #else # yiw_string_( '', sprintf( __( 'Error during insert new values (IDs: %s), into %s table', 'yit' ), implode( $error_data, ' ' ), $wpdb->options ), '...</p>' ); # echo '</p>'; yit_delete_cache_callback(); do_action('yit_after_import'); return true; }
public function __construct() { $this->_customFields = yit_get_model('nav_menu')->fields; }