/** * Magic method for this class * * @param $name string The name of magic property * @since 2.0.0 * @author Simone D'Amico <*****@*****.**> * @return mixed */ public function __get($name) { if ($name == 'request') { if (!$this->_request instanceof YIT_Request) { $this->_request = YIT_Registry::get_instance()->request; } return $this->_request; } }
/** * Load required classes * * @since 2.0.0 * @author Simone D'Amico <*****@*****.**> */ public function run() { if (is_admin() && (!defined('DOING_AJAX') || defined('DOING_AJAX') && !DOING_AJAX)) { YIT_Registry::get_instance()->load('transient', 'panel', 'notifier', 'font', 'plugins', 'cache', 'dashboard'); } else { // something to instance in the frontend YIT_Registry::get_instance()->load('asset'); } // something to instance both admin and frontend YIT_Registry::get_instance()->load('request', 'options', 'splash', 'css', 'google_fonts', 'font', 'icon', 'navmenu', 'image', 'sidebar', 'widgets', 'update', 'mobile', 'skins'); }
/** * Render the HTML of the option * * @since Version 2.0.0 * @author Simone D'Amico <*****@*****.**> */ public function render($option) { if (isset($option['type']) && $option['type']) { // set properly the default value for this option if (isset($option['std']) && isset($option['id'])) { $defaults = YIT_Registry::get_instance()->options->get_default_options(); if (isset($defaults[$option['id']])) { $option['std'] = $defaults[$option['id']]; } else { $option['std'] = ''; } } // alter option array by plugin $option = apply_filters('yit_admin_option_args', $option); $path = 'admin/type/' . $option['type'] . '.php'; yit_get_template($path, $option); } }
/** * Return a json item with a List of Google Fonts (used for theme options) * * @see core\templates\admin\type\typography.php * @return array * @since 1.0.0 * @author Andrea Grillo <*****@*****.**> */ function yit_get_json_google_fonts() { $font = YIT_Registry::get_instance()->font; return json_encode(array('items' => $font->get_google_fonts())); }
/** * Return the instance of YIT_Sidebar class * * @return \YIT_Sidebar * @since 2.0.0 * @author Emanuela Castorina <*****@*****.**> */ function YIT_Sidebar() { return YIT_Registry::get_instance()->sidebar; }
$categories_icon = ( $categories_icon_type == 'none' ) ? false : ( ( $categories_icon_type == 'icon' ) ? '<i class="fa fa-' . $categories_icon_options['icon'] . '"></i>' : 'style="background: transparent url(' . yit_ssl_url( $categories_icon_options['custom'] ) . ') top left no-repeat"' ); $categories_icon_class = ( $categories_icon_type == 'none' ) ? 'without-icon' : ( ( $categories_icon_type == 'custom' ) ? 'with-icon' : 'with-icon awesome' ); $tags_icon_options = yit_get_option( 'blog-tags-icon' ); $tags_icon_type = $tags_icon_options['select']; $tags_icon = ( $tags_icon_type == 'none' ) ? false : ( ( $tags_icon_type == 'icon' ) ? '<i class="fa fa-' . $tags_icon_options['icon'] . '"></i>' : 'style="background: transparent url(' . yit_ssl_url( $tags_icon_options['custom'] ) . ') top left no-repeat"' ); $tags_icon_class = ( $tags_icon_type == 'none' ) ? 'without-icon' : ( ( $tags_icon_type == 'custom' ) ? 'with-icon' : 'with-icon awesome' ); $comments_icon_options = yit_get_option( 'blog-comments-icon' ); $comments_icon_type = $comments_icon_options['select']; $comments_icon = ( $comments_icon_type == 'none' ) ? false : ( ( $comments_icon_type == 'icon' ) ? '<i class="fa fa-' . $comments_icon_options['icon'] . '"></i>' : 'style="background: transparent url(' . yit_ssl_url( $comments_icon_options['custom'] ) . ') top left no-repeat"' ); $comments_icon_class = ( $comments_icon_type == 'none' ) ? 'without-icon' : ( ( $comments_icon_type == 'custom' ) ? 'with-icon' : 'with-icon awesome' ); $title = ( get_the_title() != '' ) ? get_the_title() : __( '(this post does not have a title)', 'yit' ); $read_more_text = yit_get_option( 'blog-read-more-text' ) != '' ? yit_get_option( 'blog-read-more-text' ) : __( 'Read More', 'yit' ); $post_meta_separator = ' / '; $link = get_permalink(); $has_pagination = ( $wp_query->max_num_pages > 1 ) ? true : false; $image_size = YIT_Registry::get_instance()->image->get_size( 'blog_' . $blog_type ); $sidebars = YIT_Layout()->sidebars; $bootstrap_col_class = ''; if( $blog_type != 'big' && ! is_singular( 'post' ) ){ if( $sidebars['layout'] == 'sidebar-no' ){ $bootstrap_col_class = 'col-sm-3 col-xs-6'; }elseif( $sidebars['layout'] == 'sidebar-double' ){ $bootstrap_col_class = 'col-sm-6 col-xs-6'; }else{ $bootstrap_col_class = 'col-sm-4 col-xs-6'; } } $args = array( 'show_thumbnail' => $show_thumbnail,
global $post; $blog_type = is_singular( 'post' ) ? 'single_' . $blog_type : $blog_type; $attachments = get_posts( array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => get_the_ID(), 'post_mime_type'=> 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) ); $image_type = yit_size_xl( 'blog_' . $blog_type ); $image_size = YIT_Registry::get_instance()->image->get_size( $image_type ); if ( !empty( $attachments ) ): ?> <div style="visibility: hidden;" class="masterslider ms-skin-default" data-view="flow" data-width="<?php echo $image_size['width'] ?>" data-height="<?php echo $image_size['height'] ?>" data-postid="<?php the_ID() ?>" id="galleryslider-<?php the_ID() ?>"> <?php foreach ( $attachments as $key => $attachment ) : ?> <div class="ms-slide"> <?php yit_image( "id=$attachment->ID&size=$image_type&class=img-responsive" ); ?> </div> <?php endforeach; ?> </div> <?php endif ?>
/** * Get the next blog post with an ajax call * * @return void * @since 2.0.0 * @author Antonio La Rocca <*****@*****.**> * @author Andrea Grillo <*****@*****.**> */ function yit_blog_big_next_post() { global $post; if (is_null($post) || empty($post)) { return; } if (YIT_Request()->is_ajax && isset($_REQUEST['post_id'])) { $post = get_post(intval($_REQUEST['post_id'])); } if ((is_singular('post') || YIT_Request()->is_ajax && $post->post_type == 'post') && yit_get_option('blog-single-type') == 'big') { $blog_type_options = array('blog_single_type' => yit_get_option('blog-single-type'), 'is_next_post' => true); $image_size = YIT_Registry::get_instance()->image->get_size('blog_single_big'); $next_post = get_previous_post(); if ($next_post == '' || $next_post == null) { $args = array('order' => 'DESC', 'order_by' => 'date'); $posts = get_posts($args); if (!empty($posts)) { $next_post = $posts[0]; } } $post = $next_post; setup_postdata($post); $has_post_thumbnail = has_post_thumbnail(); $placeholder = !$has_post_thumbnail ? 'class="placeholder no-featured" style="height: ' . $image_size['height'] . 'px;"' : 'class="placeholder" style="max-height: ' . $image_size['height'] . 'px;"'; ?> <div id="next" class='slide-tab next-post hidden-content' data-post_id="<?php the_ID(); ?> "> <div class='big-image'> <div <?php echo $placeholder; ?> > <?php if ($has_post_thumbnail) { ?> <?php yit_image(array('post_id' => get_the_ID(), 'size' => 'blog_single_big', 'class' => 'img-responsive')); ?> <?php } ?> <div class="inner"> <div class="info-overlay"> <div class="read-more-label"><?php _e('VIEW NEXT POST', 'yit'); ?> </div> <div class="read-more-title"><?php the_title(); ?> </div> </div> </div> </div> <?php yit_blog_big_post_start('next-post'); ?> </div> <div class='container'> <?php remove_action('yit_primary', 'yit_start_primary', 5); remove_action('yit_primary', 'yit_end_primary', 90); remove_action('yit_content_loop', 'yit_content_loop', 10); add_action('yit_content_loop', 'yit_blog_single_loop'); yit_get_template('primary/loop/single.php', $blog_type_options); if (!YIT_Request()->is_ajax) { comments_template(); } add_action('yit_primary', 'yit_end_primary', 90); ?> </div> </div> <?php if (defined('DOING_AJAX') && DOING_AJAX) { die; } } }
protected function _import_data() { global $wpdb; $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.', '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.', 'yit')); 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.', 'yit')); } if ($error != '') { YIT_Registry::get_instance()->message->addMessage($error, 'error'); return false; } } if (YIT_Request()->post('sampledata') == 'true') { $check_file = YIT_Request()->post('file'); $file = !empty($check_file) ? $check_file : 'default.gz'; $wp_remote_get_result = wp_remote_get($file, array('redirection' => 50, 'timeout' => 50)); $content_file = wp_remote_retrieve_body($wp_remote_get_result); } else { $file = empty($file) ? $_FILES['import-file']['tmp_name'] : $file; $content_file = file_get_contents($file); } if ($content_file) { // get db encoded $db = unserialize(base64_decode(gzuncompress($content_file))); array_walk_recursive($db, array($this, 'convert_url'), 'in_import'); if (!is_array($db)) { wp_die(__('An error encoured during during import. Please try again.', 'yit')); } set_time_limit(0); // tables $tables = array_keys($db); $db_tables = $wpdb->get_col("SHOW TABLES"); $theme_name = is_child_theme() ? strtolower(wp_get_theme()->parent()->get('Name')) : strtolower(wp_get_theme()->get('Name')); foreach ($tables as $key => $table) { if ($table != 'options' && in_array($wpdb->prefix . $table, $db_tables)) { // delete all row of each table if (!in_array($table, array('users', 'usermeta'))) { $wpdb->query("TRUNCATE TABLE {$wpdb->prefix}{$table}"); } // insert new data $error_data = array(); $insert = array(); foreach ($db[$table] as $id => $data) { $insert[] = $this->_makeInsertSQL($data); } if (!empty($db[$table])) { $num_rows = count($insert); $step = 5000; $insert_step = intval(ceil($num_rows / $step)); $fields = implode('`, `', array_keys($db[$table][0])); for ($i = 0; $i < $insert_step; $i++) { $insert_row = implode(', ', array_slice($insert, $i * $step, $step)); $wpdb->query("INSERT INTO `{$wpdb->prefix}{$table}` ( `{$fields}` ) VALUES " . $insert_row); } } } elseif ($table == 'options') { $options_iterator = new ArrayIterator($db[$table]); foreach ($options_iterator as $id => $data) { if ($data['option_name'] == 'theme_mods_' . $theme_name) { $data_child = $data; $data_child['option_name'] = $data_child['option_name'] . '-child'; $options_iterator->append($data_child); } $fields = implode("`,`", array_keys($data)); $values = implode("', '", array_values(array_map('esc_sql', $data))); $updates = ''; foreach ($data as $k => $v) { $v = esc_sql($v); $updates .= "{$k} = '{$v}',"; } $updates = substr($updates, 0, -1); $query = "INSERT INTO {$wpdb->prefix}{$table}\r\n (`{$fields}`)\r\n VALUES\r\n ('{$values}')\r\n ON DUPLICATE KEY UPDATE\r\n {$updates};"; $wpdb->query($query); } } elseif (function_exists('YIT_Custom_Style') && $table == YIT_Custom_Style()->slug) { $custom_style_file = locate_template(YIT_Custom_Style()->filename); if ('' != $custom_style_file && is_writeable($custom_style_file)) { $f = fopen($custom_style_file, 'w'); if ($f !== false) { fwrite($f, $db[$table]); fclose($f); } } } } //fire an action after import file do_action('yit_backup_reset_after_file_import', $db); $this->delete_cache_data(); YIT_Registry::get_instance()->message->addMessage(__('Content and Data imported correctly!', 'yit')); if ('install-sampledata' == YIT_Request()->post('action')) { YIT_Registry::get_instance()->message->printGlobalMessages(); } } else { $error = 'Attention: an error occurred. It is impossible to automatically import your sample data in you installation. To use your data, please use the manual installation: '; $error .= '<a href="' . YIT_WPADMIN_URL . '/admin.php?page=yit_panel_backup_and_reset#yit-panel-backup-theme_options_backups">'; $error .= wp_get_theme() . __(' → Backup & Reset → Import and Export Data', 'yit'); $error .= '</a>'; YIT_Registry::get_instance()->message->addMessage(__($error, 'yit'), 'error', 'panel'); YIT_Registry::get_instance()->message->printMessages(); } if (YIT_Request()->is_ajax) { die; } return true; }
/** * Return the instance of YIT_Css class * * @return \YIT_Css * @since 2.0.0 * @author Andrea Grillo <*****@*****.**> */ function YIT_Css() { return YIT_Registry::get_instance()->css; }
function woocommerce_template_loop_product_thumbnail() { global $product, $woocommerce_loop; $attachments = $product->get_gallery_attachment_ids(); $attachment_title = ''; $original_size = wc_get_image_size('shop_catalog'); if ($woocommerce_loop['view'] == 'masonry_item') { $size = $original_size; $size['height'] = 0; YIT_Registry::get_instance()->image->set_size('shop_catalog', $size); } if (isset($attachments[0])) { $attachment_post = get_post($attachments[0]); if (isset($attachment_post->post_title)) { $attachment_title = $attachment_post->post_title; } echo '<a href="' . get_permalink() . '" class="thumb backface"><span class="face">' . woocommerce_get_product_thumbnail() . '</span>'; echo '<span class="face back">'; yit_image("id={$attachments['0']}&size=shop_catalog&class=image-hover&alt=" . $attachment_title); echo '</span></a>'; } else { echo '<a href="' . get_permalink() . '" class="thumb"><span class="face">' . woocommerce_get_product_thumbnail() . '</span></a>'; } if ($woocommerce_loop['view'] == 'masonry_item') { YIT_Registry::get_instance()->image->set_size('shop_catalog', $original_size); } }
/** * Delete an option value from the database * * @param $id string * @return null * @since 1.0.0 */ function yit_delete_option($id) { YIT_Registry::get_instance()->options->delete_option($id); }
/** * Constructor * * @since 1.0.0 * @author Simone D'Amico <*****@*****.**> */ public function __construct() { $this->_custom_fields = YIT_Registry::get_instance()->{'navmenu'}->fields; }
/** * Get registry singleton * * @return YIT_Registry registry * @since 2.0.0 * @return YIT_Registry * @author Simone D'Amico <*****@*****.**> */ public static function get_instance() { if (!self::$registry instanceof YIT_Registry) { self::$registry = new YIT_Registry(); } return self::$registry; }
* 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 Sample Data > Download sample image > Sample Image * * @package Yithemes * @author Antonio La Rocca <*****@*****.**> * @author Andrea Grillo <*****@*****.**> * @since 2.0.0 * @return mixed array * */ $skins_list = class_exists('YIT_Skins') ? YIT_Registry::get_instance()->skins->get_skins_list() : false; $has_skins = !empty($skins_list) ? true : false; return array(array('type' => 'sampledata', 'title' => __('Install Sample Data', 'yit'), 'desc' => __('<strong>Warning: You must import the sample data file before customizing your theme.</strong> <br/><br/> If you customize your theme, and later import a sample data file, all current contents entered in your site will be overwritten to the default settings of the file you are uploading! Please proceed with the utmost care, <strong>after exporting all current data!</strong> <br/><br/> <strong>Note:</strong> If you get errors, please be sure that your server can use the PHP function set_time_limit() before opening a ticket in our support platform.', 'yit'), 'button_label' => __('Import Data', 'yit'), 'default_data' => $has_skins ? $skins_list['default']['data'] : YIT_DEFAULT_DUMMY_DATA, 'action' => 'install-sampledata', 'has_skins' => $has_skins, 'options' => $skins_list, 'sample_data' => true), array('type' => 'link', 'title' => __('Download Sample Images', 'yit'), 'desc' => __('<p>Sample images must be used in combination with sample data.</p> <p>Once you\'ve downloaded the zip file, you simply need the following steps to import the images:</p> <ol> <li>Extract the zip package in your computer.</li> <li>Upload it into the wp-content folder via FTP.</li> </ol> Some images will not be available because they are <strong>protected by copyright</strong>, as explained in the 11th paragraph of our <a href="http://yithemes.com/terms-and-conditions/" target="_blank">Terms & Conditions</a>. ', 'yit'), 'link_name' => __('Download Sample Images', 'yit'), 'link_href' => YIT_DEFAULT_DUMMY_DATA_IMAGES, 'link_class' => 'multi_link', 'multi' => $has_skins, 'options' => $skins_list), array('type' => 'link', 'title' => __('Download Custom Background', 'yit'), 'desc' => __('<p>Here you are some free backgrounds you can use in your site. To use the custom backgrounds, you can manually upload them from:
/** * Return the instance of YIT_Icon class * * @return \YIT_Icon * @since 2.0.0 * @author Emanuela Castorina <*****@*****.**> */ function YIT_Icon() { return YIT_Registry::get_instance()->icon; }
/** * 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'); ?> ">↑</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'); ?> ">↓</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(); }
/** * Return the instance of class * * @return \YIT_Request * * @since Version 2.0.0 * @author Antonino Scarfi <*****@*****.**> */ function YIT_Request() { return YIT_Registry::get_instance()->request; }
/** * Return the instance of class * * @return \YIT_Mobile * * @since Version 2.0.0 * @author Antonino Scarfi <*****@*****.**> */ function YIT_Mobile() { return YIT_Registry::get_instance()->mobile; }
function woocommerce_template_loop_product_thumbnail() { global $product, $yit_products_layout, $woocommerce_loop; $attachments = $product->get_gallery_attachment_ids(); $original_size = wc_get_image_size('shop_catalog'); if ($woocommerce_loop['view'] == 'masonry_item') { $size = $original_size; $size['height'] = 0; YIT_Registry::get_instance()->image->set_size('shop_catalog', $size); } echo '<div class="thumb-wrapper ' . $yit_products_layout . '">'; switch ($yit_products_layout) { case 'slideup': echo '<a href="' . get_permalink() . '" class="thumb">' . woocommerce_get_product_thumbnail() . '</a>'; echo '<div class="quick-view' . (yit_get_option('shop-use-quick-view') == 'no' ? ' none' : '') . '" data-product_id="' . esc_attr($product->id) . '">'; if (yit_get_option('shop-use-quick-view') == 'yes') { $sc_index = function_exists('YIT_Shortcodes') && YIT_Shortcodes()->is_inside ? '-' . YIT_Shortcodes()->index() : ''; echo '<a id="quick-view-trigger-' . esc_attr($product->id) . $sc_index . '" href="#" class="trigger" data-item_id="' . $product->id . '">+ ' . yit_get_option('shop-quick-view-text') . '</a>'; } elseif (yit_get_option('shop-add-to-cart') == 'yes') { if (!$product->is_in_stock()) { echo '<p>' . __('Out of stock', 'yit') . '</p>'; } elseif ($product->product_type == 'simple') { echo '<p>' . yit_get_option('shop-add-to-cart-text') . '</p>'; } elseif ($product->product_type == 'grouped' || $product->product_type == 'variable') { echo '<p>' . __('View options', 'yit') . '</p>'; } else { echo '<p>' . __('Read more', 'yit') . '</p>'; } } do_action('yith_add_to_cart_button'); echo '</div>'; break; case 'classic': if (isset($attachments[0])) { echo '<a href="' . get_permalink() . '" class="thumb backface"><span class="face">' . woocommerce_get_product_thumbnail() . '</span>'; echo '<span class="face back">'; yit_image("id={$attachments['0']}&size=shop_catalog&class=image-hover"); echo '</span></a>'; } else { echo '<a href="' . get_permalink() . '" class="thumb"><span class="face">' . woocommerce_get_product_thumbnail() . '</span></a>'; } break; } echo '</div>'; if ($woocommerce_loop['view'] == 'masonry_item') { YIT_Registry::get_instance()->image->set_size('shop_catalog', $original_size); } }
* 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 */ global $post; $enable_thumbnails = $enable_thumbnails == 'yes' ? true : false; $enable_title = $enable_title == 'yes' ? true : false; $enable_date = $enable_date == 'yes' ? true : false; $enable_author = $enable_author == 'yes' && get_the_author() != false ? true : false; $enable_comments = $enable_comments == 'yes' ? true : false; $enable_slider = isset($enable_slider) ? $enable_slider : 'yes'; $args = array('post_type' => 'post', 'posts_per_page' => $nitems); $animate_data = $animate != '' ? 'data-animate="' . $animate . '"' : ''; $animate_data .= $animation_delay != '' ? ' data-delay="' . $animation_delay . '"' : ''; $animate = $animate != '' ? ' yit_animate' : ''; $image_size = YIT_Registry::get_instance()->image->get_size('blog_section'); $blog = new WP_Query($args); if ($blog->have_posts()) { wp_enqueue_script('owl-carousel'); ?> <div class="blog-slider-outer clearfix <?php echo esc_attr($animate . $vc_css); ?> " <?php echo $animate_data; ?> > <div class="blog-slider"> <div class="prev-blog"> <div class="icon-circle"> <i class="fa fa-angle-left"></i>
/** * Retrieve image size * * @param $path string * * @return \YIT_Image * @since 1.0.0 * @author Antonino Scarfi <*****@*****.**> */ function yit_getimagesize($path) { return YIT_Registry::get_instance()->image->getimagesize($path); }
* * @author Your Inspiration Themes * @package YITH Pre-Launch * @version 1.0.0 */ $countdown_message = get_option('yith_prelaunch_countdown_message'); $wrapper_background = get_option('yith_prelaunch_wrapper_background_wrapper_color'); $wrapper_opacity = get_option('yith_prelaunch_wrapper_background_wrapper_opacity') / 100; $border['style-1'] = yit_get_option('color-website-border-style-1'); $border['style-2'] = yit_get_option('color-website-border-style-2'); $tooltip['box'] = get_option('yith_prelaunch_socials_tooltip_box_color'); $tooltip['text'] = get_option('yith_prelaunch_socials_tooltip_text_color'); $tooltip['prefix'] = apply_filters('yit_prelaunch_tooltip_prefix', __("I'm on", 'yit')); $tooltip['prefix_mail'] = apply_filters('yit_prelaunch_tooltip_prefix_mail', __("me", 'yit')); if ('transparent' != $wrapper_background) { $rgba = YIT_Registry::get_instance()->colors->hex2rgb($wrapper_background); $wrapper_background = "rgba( {$rgba[0]}, {$rgba[1]}, {$rgba[2]}, {$wrapper_opacity} );"; } $background_role = array(); if (!empty($background['color'])) { $background_role[] = "background-color: {$background['color']};"; } if (!empty($background['image'])) { $background_role[] = "background-image: url('{$background['image']}');"; } if (!empty($background['repeat'])) { $background_role[] = "background-repeat: {$background['repeat']};"; } if (!empty($background['position'])) { $background_role[] = "background-position: {$background['position']};"; }
/** * Add classes to body on portfolio layout * * @param $classes * * @return string[] * @since 2.0.0 * @author Antonio La Rocca <antonio.larocca@yithems.com * @author Francesco Licandro <*****@*****.**> */ function yit_portfolio_add_body_class($classes) { if (has_post_thumbnail()) { $classes[] = "yit-portfolio"; if (YIT_Registry::get_instance()->skins->get_skin() != 'vintage') { $classes[] = "force-sticky-header"; } } return $classes; }
function woocommerce_template_loop_product_thumbnail() { global $product, $woocommerce_loop; $attachments = $product->get_gallery_attachment_ids(); $original_size = wc_get_image_size( 'shop_catalog' ); if ( $woocommerce_loop['view'] == 'masonry_item' ) { $size = $original_size; $size['height'] = 0; YIT_Registry::get_instance()->image->set_size('shop_catalog', $size ); } switch ( $woocommerce_loop['products_layout'] ) { case 'elegant' : echo '<a href="' . get_permalink() . '" class="thumb"><span class="face">' . woocommerce_get_product_thumbnail() . '</span></a>'; break; case 'alternative' : if( isset( $attachments[0] ) ) { echo '<a href="' . get_permalink() . '" class="thumb backface"><span class="face">' . woocommerce_get_product_thumbnail() . '</span>'; echo '<span class="face back">'; yit_image( "id=$attachments[0]&size=shop_catalog&class=image-hover" ); echo '</span></a>'; } else { echo '<a href="' . get_permalink() . '" class="thumb"><span class="face">' . woocommerce_get_product_thumbnail() . '</span></a>'; } break; } if ( $woocommerce_loop['view'] == 'masonry_item' ) { YIT_Registry::get_instance()->image->set_size('shop_catalog', $original_size ); } }
/** * Return the instance of YIT_Asset class * * @return \YIT_Asset * @since 2.0.0 * @author Andrea Grillo <*****@*****.**> */ function YIT_Asset() { return YIT_Registry::get_instance()->asset; }
/** * Return the instance of YIT_Panel class * * @return \YIT_Panel * @since 2.0.0 * @author Andrea Grillo <*****@*****.**> */ function YIT_Panel() { return YIT_Registry::get_instance()->panel; }