File: /home/salhiscp/salhab360photos.com/wp-content/themes/acora/inc/theme-support.php
<?php
/**
* Theme support functions.
*
* @package acora
* @since acora 1.0
*/
/**
* Blog posts
* -------------------------------------------------------
*/
// Get post title.
function acora_get_post_title(){
echo wp_kses(get_the_title(), wp_kses_allowed_html('post'));
}
// Get post link.
function acora_get_post_title_with_link(){
return '<a href="' . esc_url(get_permalink()) . '" target="_self">' . wp_kses(get_the_title(), wp_kses_allowed_html('post')) . '</a>';
}
// Get read more button.
function acora_get_read_more(){
?>
<div class="read-more"><a href="<?php echo esc_url(get_permalink()) ?>" class="button"><?php esc_attr_e('Read more', 'acora'); ?></a></div>
<?php
}
// Get class if there are related posts or active comment.
function acora_rl_active_comments(){
global $post;
$class = '';
if(comments_open() || get_comments_number()){
$class = ' has-cm-rl';
}
$tags = wp_get_post_tags($post->ID);
$tag_ids = array();
foreach($tags as $tag ) {
$tag_ids[] = $tag->term_id;
}
if($tags){
$first_tag = $tags[0]->term_id;
$args = array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=> -1,
'ignore_sticky_posts'=> 1
);
$my_query = new WP_Query($args);
if($my_query->have_posts()){
$class = ' has-cm-rl';
}
wp_reset_query();
}
return esc_html($class);
}
// Get post tags
function acora_has_tags_or_share(){
$output = false;
if(!empty(get_the_tag_list())){
$output = true;
}
if(get_post_type() == 'post' && AcoraData::$data->blog_settings['use_share_feature'] && defined('ACORA_SETTINGS_INIT')){
$output = true;
}
return $output;
}
function acora_get_tags(){
if(!empty(get_the_tag_list())){
$content = '<div class="tags-container"><span>' . esc_html__('Tags', 'acora') . '</span>';
$posttags = get_the_tags();
if ($posttags) {
$array = [];
foreach($posttags as $tag) {
$array[] = '<a href="' . esc_url(get_tag_link($tag->term_id)) . '">#' . esc_html($tag->name) . '</a>';
}
$content .= implode(' ', $array);
}
$content .= '</div>';
return wp_kses($content, wp_kses_allowed_html('post'));
}else{
return '';
}
}
// Get post date in short format.
function acora_get_posted_on() {
return '<span class="entry-date posted-on">' . esc_html(get_the_date('F j, Y')) . '<span> / </span>'. esc_html(get_the_date('h:i A')) . '</span>';
}
// Get comment count.
function acora_get_comment_count(){
return '<span class="entry-date comments">' . esc_html(get_comments_number()) . '</span>';
}
// Get information for the current author.
function acora_posted_by() {
global $acora_port_base;
$link = get_author_posts_url(get_the_author_meta('ID'));
if(get_post_type() == 'acora_portfolio'){
$author_link = $link;
$ar = explode('/',$author_link);
$ar = array_reverse($ar);
$test_link ='';
$i = 0;
foreach ($ar as $a) {
if($i <=2){
$test_link .= $a ."/";
}
$i++;
}
$pos = strlen($author_link) - strlen($test_link);
$temp = substr($author_link, 0, $pos) . '/' . esc_html($acora_port_base) . '' . substr($author_link, $pos);
$author_link = esc_url($temp);
}else{
$author_link = esc_url($link);
}
printf('<span class="entry-date posted-by"><span class="author vcard"><a class="" href="%1$s" title="%2$s" rel="author">%3$s</a></span></span>',
esc_url($author_link),
esc_html(sprintf(esc_html__('View all posts by %s', 'acora'), esc_html(get_the_author()))),
esc_html(get_the_author())
);
}
// Get a list of post categories.
function acora_post_categories(){
global $post;
$categories = wp_get_post_terms($post->ID, 'category', array("fields" => "all"));
$term = get_queried_object();
$term_id = (isset($term->term_id)) ? (int) $term->term_id : 0;
$html = '<span class="entry-date categories">';
$i = 0;
$com = ', ';
foreach($categories as $category){
$cat_ID = (int) $category->term_id;
$category_name = $category->name;
if($i >= count($categories) -1){
$com = '';
}
// When viewing a particular category, give it an [active] class.
$cat_class = ($cat_ID == $term_id) ? 'front' : 'not-front';
$html .= '<a class="' . esc_attr($cat_class) .'" href="' . esc_url(get_category_link($category->term_id)) . '">' . esc_html($category->name) . '</a>' . esc_html($com);
$i ++;
}
$html .= '</span>';
echo wp_kses($html, wp_kses_allowed_html('post'));
}
// Get comment count for the current blog post.
function acora_comment_count(){
if(!get_comments_number()){
return;
}
$html = '<span class="entry-date comments"><a href="#comments" class="comment-count">%s</a></span>';
$comments = sprintf(_n('1', '%1$s', esc_html(get_comments_number()), 'acora'),
esc_html(number_format_i18n(get_comments_number()))
);
$html = sprintf($html, $comments);
echo wp_kses(apply_filters('acora_comment_count', $html), wp_kses_allowed_html('post'));
}
// Display blog sidebar.
function acora_blog_sidebar($num){
if(!is_active_sidebar('sidebar-blog')){
return;
}
$class = 'sidebar';
if($num > 1){
$class = 'sidebar has-navigation';
}
?>
<div class="<?php echo esc_attr($class); ?>" data-show-sidebar="<?php echo esc_attr((AcoraData::$data->sidebar_settings['show_sidebar'] == true) ? 'yes' : 'no'); ?>">
<div class="inner">
<div class="scrollbar-macosx acora-hide">
<div class="widgets">
<?php dynamic_sidebar('sidebar-blog'); ?>
</div><!-- .widgets -->
</div><!-- .scrollbar-inner -->
</div><!-- .inner -->
</div><!-- .sidebar -->
<?php
}
/**
* Get vertical menu logo.
*/
function acora_get_vertical_menu_logo(){
global $post;
$show_logo = true;
$use_alternative_logo = true;
$logo_path = AcoraData::$data->menu_settings['logo_image'];
if(is_page_template('page-templates/home-slider.php')){
$data = acora_settings_cats_get_data($post->ID);
extract($data);
$show_logo = $cs_show_logo === 'true' ? true : false;
$use_alternative_logo = $cs_use_alternative_logo === 'true' ? true : false;
}else if(is_page_template('page-templates/home-simple.php')){
$data = acora_settings_hs_get_data($post->ID);
extract($data);
$show_logo = $hs_show_logo === 'true' ? true : false;
$use_alternative_logo = $hs_use_alternative_logo === 'true' ? true : false;
}else if(is_page_template('page-templates/portfolio.php')){
$data = acora_settings_pac_get_data($post->ID);
extract($data);
$show_logo = $pac_show_logo === 'true' ? true : false;
$use_alternative_logo = $pac_use_alternative_logo === 'true' ? true : false;
}else if(is_page_template('page-templates/igp-portfolio.php')){
$data = acora_settings_igp_get_data($post->ID);
extract($data);
$show_logo = $igp_show_logo === 'true' ? true : false;
$use_alternative_logo = $igp_use_alternative_logo === 'true' ? true : false;
}else if(is_page_template('page-templates/only-shortcode-fullscreen.php')){
$data = acora_settings_osfs_get_data($post->ID);
extract($data);
$show_logo = $osfs_show_logo === 'true' ? true : false;
$use_alternative_logo = $osfs_use_alternative_logo === 'true' ? true : false;
}else if(is_page_template('page-templates/only-shortcode-fluid-width.php')){
$data = acora_settings_osfw_get_data($post->ID);
extract($data);
$show_logo = $osfw_show_logo === 'true' ? true : false;
$use_alternative_logo = $osfw_use_alternative_logo === 'true' ? true : false;
}else if(is_page_template('page-templates/uvp-home.php')){
$data = acora_settings_uvp_get_data($post->ID);
extract($data);
$show_logo = $uvp_show_logo === 'true' ? true : false;
$use_alternative_logo = $uvp_use_alternative_logo === 'true' ? true : false;
}else if(is_page_template('page-templates/contact-simple.php')){
$data = acora_settings_cs_get_data($post->ID);
extract($data);
$show_logo = $css_show_logo === 'true' ? true : false;
$use_alternative_logo = $css_use_alternative_logo === 'true' ? true : false;
}
if(!empty(AcoraData::$data->menu_settings['alternative_logo_image'])){
$logo_path = AcoraData::$data->menu_settings['alternative_logo_image'];
}else{
$use_alternative_logo = false;
}
if(!empty(AcoraData::$data->menu_settings['alternative_logo_image'])
&& !$use_alternative_logo
){
$logo_path = AcoraData::$data->menu_settings['logo_image'];
}
$class = 'has-logo';
if($use_alternative_logo){
$class = 'has-logo alternative';
}
if($show_logo):
?>
<div class="vm-logo acora-hide">
<div class="<?php echo esc_attr($class); ?>">
<?php if(empty($logo_path)): ?>
<a class="text" href="<?php echo esc_url(get_home_url()); ?>">
<?php echo esc_url(bloginfo('name')); ?>
</a>
<?php else: ?>
<a href="<?php echo esc_url(get_home_url()); ?>">
<img src="<?php echo esc_url($logo_path) ?>" alt="logo"/>
</a>
<?php endif; ?>
</div><!-- .has-logo -->
</div>
<?php endif;
}
/**
* Register widget sidebar.
*/
function acora_widgets_init() {
// Register sidebar widget area.
$sidebar_post = array_merge(
array('name' => esc_html__('Blog Sidebar', 'acora'),
'id' => 'sidebar-blog'),
acora_get_default_widget_params()
);
register_sidebar($sidebar_post);
// Register menu widget area.
$sidebar_post = array_merge(
array('name' => esc_html__('Vertical Menu Sidebar', 'acora'),
'id' => 'vertical-menu'),
acora_get_default_widget_params()
);
register_sidebar($sidebar_post);
}
add_action('widgets_init', 'acora_widgets_init');
// Returns theme's default widget params.
function acora_get_default_widget_params() {
return array(
'description' => esc_html__('Add widgets here.', 'acora'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>'
);
}
/**
* Load vertical sidebar AJAX to improve initial loading time,
* for some reason adding the sidebar before the document is
* loaded it adds to the loading time 1-4 seconds which makes no
* sense, loading it with AJAX is fixing this issue.
*/
add_action('wp_ajax_nopriv_acora_load_vertical_sidebar', 'acora_load_vertical_sidebar');
add_action('wp_ajax_acora_load_vertical_sidebar', 'acora_load_vertical_sidebar');
function acora_load_vertical_sidebar(){
acora_vertical_menu_sidebar();
die();
}
// Display vertical menu sidebar.
function acora_vertical_menu_sidebar(){
if(!is_active_sidebar('vertical-menu')){
return;
}
?>
<div class="vertical-menu-sidebar">
<div class="wrapper">
<?php dynamic_sidebar('vertical-menu'); ?>
</div>
</div><!-- .vertical-menu-sidebar -->
<?php
}
// Check if it has navigation.
function acora_blog_has_navigation(){
global $post;
if(wp_count_posts('post')->publish > 1){
return true;
}
return false;
}
// Displays blog pagination on the post archive page.
function acora_content_paging($query = "") {
global $wp_query, $post;
if(!empty($query)){
$wp_query = $query;
}
?>
<nav class="navigation-paging">
<div class="paging acora-hide"><?php
if(get_previous_posts_link()):
$prev_link = esc_html(previous_posts(false)); ?>
<a href="<?php echo esc_url($prev_link) ?>" class="button-light button-fwdicon-left fwdicon-left button-newer"></a><?php
else: ?>
<span class="button-light button-fwdicon-left fwdicon-left button-disabled button-newer"></span><?php
endif;
?>
<div class="wrap-page-numbers">
<?php
$big = 9999999;
echo paginate_links(array(
'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' => '?paged=%#%',
'current' => esc_html(max(1, get_query_var('paged'))),
'total' => esc_html($wp_query->max_num_pages),
'prev_next' => false
));
?>
</div>
<?php
if(get_next_posts_link()):
$next_link = esc_html(next_posts(9999999, false)); ?>
<a href="<?php echo esc_html($next_link); ?>" class="button-light button-fwdicon-right fwdicon-right button-older"></a><?php
else: ?>
<span class="button-light button-fwdicon-right fwdicon-right button-disabled button-older"></span><?php
endif; ?>
</div>
</nav>
<?php
}
// Display blog navigation to next/previous pages when applicable.
function acora_blog_nav() {
global $wp_query, $post;
// Don't print empty markup on single pages if there's nowhere to navigate.
if (is_single()){
$previous = (is_attachment()) ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
$next = get_adjacent_post(false, '', false);
if (!$next && !$previous) {
return;
}
}else{
return;
}
?>
<nav class="post-navigation">
<?php
$next_post = get_next_post();
if ($next_post) : ?>
<a class="button-light button-fwdicon-right fwdicon-right nav-previous" href="<?php echo esc_url(get_permalink($next_post->ID)); ?>">
<?php esc_html_e('Next post', 'acora'); ?>
</a><?php
else: ?>
<span class="button-light button-fwdicon-right fwdicon-right nav-previous button-disabled">
<?php esc_html_e('Next post', 'acora'); ?>
</span><?php
endif;
$previous_post = get_previous_post();
if ($previous_post): ?>
<a class="button-light button-fwdicon-left fwdicon-left nav-next" href="<?php echo esc_url(get_permalink($previous_post->ID)); ?>">
<?php esc_html_e('Previous post', 'acora'); ?>
</a><?php
else: ?>
<span class="button-light button-fwdicon-left fwdicon-left nav-next button-disabled">
<?php esc_html_e('Previous post', 'acora'); ?>
</span><?php
endif;
?>
</nav><?php
}
// Get related posts.
function acora_get_related_posts(){
global $post;
$tags = wp_get_post_tags($post->ID);
$tag_ids = array();
foreach($tags as $tag ) {
$tag_ids[] = $tag->term_id;
}
if($tags){
$first_tag = $tags[0]->term_id;
$args = array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=> -1,
'ignore_sticky_posts'=> 1
);
$my_query = new WP_Query($args);
if($my_query->have_posts()){
$count = 0;
$main_data = array();
while($my_query->have_posts()){
if($count > 5){
acora_display_related_posts($main_data);
wp_reset_query();
return;
}
$my_query->the_post();
if(has_post_thumbnail(get_the_ID())){
$data = array('permalink' => esc_url(get_permalink()),
'image_path' => esc_url(wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()))),
'title' => esc_html(get_the_title()));
array_push($main_data, $data);
$count ++;
}else if(get_post_format() == 'gallery' && defined('ACORA_SETTINGS_INIT')){
$data = acora_gallery_get_data(get_the_ID());
extract($data);
if(!empty($gallery_images)){
$image = $gallery_images[0];
$data = array('permalink' => esc_url(get_permalink()),
'image_path' => esc_url($image['src']),
'title' => esc_html(get_the_title()));
array_push($main_data, $data);
$count ++;
}
}
}
?>
<?php
acora_display_related_posts($main_data);
}
wp_reset_query();
}
}
// Display related posts.
function acora_display_related_posts($main_data){
if(empty($main_data)) return;
// All variables in this funtion are escpaed in the acora_get_related_posts function.
$output = '<div id="acora_related_posts" style="display:none">';
$output .= '<ul data-categories="">';
$output .='</ul>';
foreach($main_data as $image) {
$output .= '<div data-url="' . esc_url($image['permalink']) . '">';
$output .= '<ul data-category=""></ul>';
$output .= '<img src="' . esc_url($image['image_path']) . '" alt="' . esc_attr($image['title']) . '"/>';
$output .= '<div data-title=""></div>';
$output .= '<div data-thumbnail-extra-content=""><div class="extra-content">' . esc_html($image['title']) . '</div></div>';
$output .= '</div>';
}
$output .= '</div>';
echo wp_kses($output, wp_kses_allowed_html('post'));
?>
<div class="related-posts acora-hide">
<h3 class="title"><?php esc_html_e('Related posts', 'acora'); ?></h3>
<div id="acora_grid"></div>
</div>
<?php
echo acora_portfolio_grid('myGrid', 'acora_grid', 'acora_related_posts', 'classic', 'no', 'no', esc_html(AcoraData::$data->portfolio_settings['thumbnail_max_width']), esc_html(AcoraData::$data->portfolio_settings['thumbnail_max_height']), 'no', 'no', 'preview', 'no', 'yes', 'no', 30, 40, 'no');
}
function acora_get_post_pagination(){
$defaults = array(
'before' => '<div class="wp-link-pages"><span>'.esc_html__('Pages:' ,'acora').'</span>',
'after' => '</div>',
'next_or_number' => 'number',
'pagelink' => '%',
'echo' => 1
);
wp_link_pages($defaults);
}
// Template for comments and pingbacks.
function acora_comment($comment, $args, $depth){
global $post;
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
$comment_class = empty( $args['has_children'] ) ? '' : 'parent';
switch ($comment->comment_type):
case 'pingback' :
case 'trackback' : ?>
<li class="post pingback">
<p>
<?php esc_html_e('Pingback:', 'acora');
esc_url(comment_author_link());
?>
<div class="comment-content-pingback"><?php wp_kses(comment_text(), wp_kses_allowed_html('post')); ?></div>
<?php
edit_comment_link(esc_html__('Edit', 'acora'), ' '); ?>
</p><?php
break;
default: ?>
<<?php echo esc_html($tag); ?> <?php comment_class('item ' . $comment_class .' ' ); ?> id="comment-<?php comment_ID() ?>">
<?php if ( 'div' != $args['style'] ) : ?>
<div id="div-comment-<?php comment_ID() ?>" class="">
<?php endif; ?>
<div class="posts">
<div class="single">
<div id="comment-article-<?php esc_attr(comment_ID()); ?>" class="comment-article">
<footer>
<div class="comment-author vcard"><?php
$avatar = get_avatar($comment, 64);
$avatar_2x = get_avatar($comment, 128);
if ($avatar): ?>
<div class="wrap-avatar">
<?php echo wp_kses($avatar, wp_kses_allowed_html('post')) . wp_kses($avatar_2x, wp_kses_allowed_html('post')); ?>
</div><?php
endif;
?>
<div class="comment-author-info">
<?php
printf(esc_html('%s', 'acora'), sprintf('<cite class="fn">%s</cite>', get_comment_author_link()));
if ($comment->user_id > 0 && $user = get_userdata($comment->user_id)) {
if ($comment->user_id === $post->post_author): ?>
<span class="bypostauthor-icon"><?php esc_html_e('Post author', 'acora'); ?></span><?php
endif;
}
?>
<div class="comment-meta commentmetadata">
<a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?>" class="comment-time"><time datetime="<?php esc_attr(comment_time('c')); ?>">
<?php
/* translators: 1: date, 2: time */
printf(esc_html__('%1$s at %2$s', 'acora'), esc_html(get_comment_date()), esc_html(get_comment_time())); ?>
</time></a>
<div class="comment-actions">
<?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
<?php edit_comment_link(esc_html__('Edit', 'acora'), ' '); ?>
</div>
</div>
</div>
</div><?php
if ($comment->comment_approved == '0'): ?>
<em><?php esc_html_e('Your comment is awaiting moderation.', 'acora'); ?></em>
<br /><?php
endif; ?>
</footer>
<div class="comment-content"><?php wp_kses(comment_text(), wp_kses_allowed_html('post')); ?></div>
</div>
</div>
</div>
<?php if ( 'div' != $args['style'] ) : ?>
</div>
<?php endif;
break;
endswitch;
}
/**
* Home slider.
* --------------------------------------------------------
*/
function acora_get_home_slider_playlist($cs_open_project){
$terms = get_terms([
'taxonomy' => 'acora_category',
'hide_empty' => false,
]);
$output = '<ul id="myPlaylist" style="display:none;">';
$images_path = array();
$count = 1;
foreach ($terms as $term){
$cat_names = array();
$cat_names[] = $term->name;
$tax_query = array(array('taxonomy' => 'acora_category', 'field' => 'name', 'terms' => $cat_names));
$args = array(
'post_type' => 'acora_portfolio',
'tax_query' => $tax_query,
'posts_per_page' => -1,
//'orderby' => 'rand',
'post_status' => array('publish', 'private')
);
$link_to_project = get_term_link($term->term_id, 'acora_category');
$portfolio = new WP_Query($args);
while($portfolio->have_posts()){
$portfolio->the_post();
$post = $portfolio->post;
$data = acora_porfolio_get_data($post->ID);
extract($data);
$imagePath = '';
foreach($gallery_images as $image){
if($image['featured']){
$imagePath = $image['imgSrc'];
if($cs_open_project == 'true'){
$link_to_project = get_permalink();
}
$found = false;
foreach($images_path as $img){
if($img == $imagePath) $found = true;
}
$images_path[] = $imagePath;
if(!$found) break 2;
}
}
}
if(empty($imagePath) && $gallery_images){
$imagePath = $gallery_images[0];
}
$output .= '<li data-source="' . esc_url($image['imgSrc']) . '" data-width="' . esc_attr($image['imgW']) . '" data-height="' . esc_attr($image['imgH']) . '" data-link="' . esc_url($link_to_project) .'">';
$output .= '<div class="main-holder">';
$output .= '<p class="count">' . esc_html($count) . '/' . esc_html(count($terms)) . '</p>';
$output .= '<div class="separator"></div>';
$output .= '<p class="text">' . esc_html($term->name) . '</p>';
$output .= '<p class="desc">' . esc_html($term->description) . '</p>';
$output .= '</div>';
$output .= '</li>';
$count ++;
};
$output .= '</ul>';
echo wp_kses($output, wp_kses_allowed_html('post'));
}
/**
* Get blog posts.
* --------------------------------------------------------
*/
function acora_get_blog_posts(){
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'post',
'post_status' => array('publish', 'private'),
'paged' => $paged
);
$query = new WP_Query($args);
return($query);
}
/**
* Portfolio.
* --------------------------------------------------------
*/
function acora_get_portfolio_playlist($id, $author_name='', $category_name=''){
if(get_post_type() == 'acora_portfolio' && empty($author_name)){
// Categories.
$output = '<ul id="' . $id . '" style="display:none">';
$categories = get_terms(array(
'taxonomy' => 'acora_category',
'hide_empty' => false));
if(!empty($category_name)){
$categories = array();
if(have_posts()){
while(have_posts()){
the_post();
global $post;
$temp_categories = wp_get_post_terms($post->ID, 'acora_tags', array("fields" => "all"));
foreach($temp_categories as $parsed_cat){
if(!acora_array_has_value($categories, $parsed_cat->name)){
$cat = new FWDUPT_cat_helper();
$cat->name = $parsed_cat->name;
$categories[] = $cat;
}
}
}
}
sort($categories);
}
$output .= '<li data-categories="">';
foreach($categories as $category){
$output .= '<p>' . ucfirst(esc_html($category->name)) . '</p>';
}
$output .='</li>';
if(have_posts()){
while(have_posts()){
the_post();
global $post;
$categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
if(!empty($category_name)){
$categories = wp_get_post_terms($post->ID, 'acora_tags', array("fields" => "all"));
}
$data = acora_porfolio_get_data($post->ID);
extract($data);
$client = get_post_meta($post->ID, 'acora_client', true);
$featuredImage = '';
if(!empty($gallery_images)){
foreach ($gallery_images as $image) {
if($image['featured']){
$featuredImage = $image;
}
}
}
if(empty($featuredImage) && $gallery_images) $featuredImage = $gallery_images[0];
if(!empty($gallery_images)){
$output .= '<li data-url="' . esc_url(get_the_permalink()) . '">';
$output .= '<ul data-category="">';
foreach ($categories as $category) {
$output .= '<li>' . ucfirst(esc_html($category->name)). '</li>';
}
$output .= '</ul>';
$output .= '<ul data-slidewhow="">';
foreach ($gallery_images as $image) {
if($featuredImage != $image){
$output .= '<li>' . esc_url($image['thumbSrc']) . '</li>';
}
}
$output .= '</ul>';
$alt = '';
if(!empty($gallery_images[0]['title'])){
$alt = $gallery_images[0]['title'];
}
$output .= '<img src="' . esc_url($featuredImage['thumbSrc']) . '" alt="' . esc_attr($alt) . '"/>';
$output .= '<div data-title="">' . esc_html(acora_short_str($post->post_title, 40)) . '</div>';
if(!empty($client)){
$output .= '<div data-client=""><div class="client"><span class="fwdicon fwdicon-author"></span><span>' . esc_html($client) . '</span></div></div>';
}
if(!empty(AcoraData::$data->portfolio_settings['use_like_feature'])){
// acora_get_number_of_likes is already escaped.
$output .= '<div data-likes=""><div class="like"><span class="fwdicon fwdicon-love"></span><span class="count">' . acora_get_number_of_likes($post) . '</span></div></div>';
}
$output .= '</li>';
}
}
$output .= '</ul>';
}
}else{
$args = array(
'post_type' => 'acora_portfolio',
'author_name' => $author_name,
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
$portfolio = new WP_Query($args);
$categories = array();
while($portfolio->have_posts()){
$portfolio->the_post();
$post = $portfolio->post;
$temp_categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
foreach ($temp_categories as $category) {
array_push($categories, $category->name);
}
}
$categories = array_unique($categories);
$output = '<ul id="' . $id . '" style="display:none">';
$output .= '<li data-categories="">';
foreach($categories as $category){
$output .= '<p>' . esc_html($category) . '</p>';
}
$output .='</li>';
while($portfolio->have_posts()){
$portfolio->the_post();
$post = $portfolio->post;
$categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
$data = acora_porfolio_get_data($post->ID);
extract($data);
$client = get_post_meta($post->ID, 'acora_client', true);
$featuredImage = '';
foreach ($gallery_images as $image) {
if($image['featured']){
$featuredImage = $image;
}
}
if(empty($featuredImage) && $gallery_images){
$featuredImage = $gallery_images[0];
}
if(!empty($gallery_images)){
$output .= '<li data-url="' . esc_url(get_the_permalink()) . '">';
$output .= '<ul data-category="">';
foreach ($categories as $category) {
$output .= '<li>' . ucfirst(esc_html($category->name)). '</li>';
}
$output .= '</ul>';
$output .= '<ul data-slidewhow="">';
$i = 0;
foreach ($gallery_images as $image) {
if($featuredImage != $image){
if($i < 6) $output .= '<li>' . esc_url($image['thumbSrc']) . '</li>';
$i ++;
}
}
$output .= '</ul>';
$alt = '';
if(!empty($gallery_images[0]['title'])){
$alt = $gallery_images[0]['title'];
}
$output .= '<img src="' . esc_url($featuredImage['thumbSrc']) . '" alt="' . esc_attr($alt) . '"/>';
$output .= '<div data-title="">' . esc_html(acora_short_str($post->post_title, 35)) . '</div>';
$output .= '<div data-client=""><div class="client"><span class="fwdicon fwdicon-author"></span><span>' . esc_html($client) . '</span></div></div>';
if(!empty(AcoraData::$data->portfolio_settings['use_like_feature'])){
// acora_get_number_of_likes is already escaped.
$output .= '<div data-likes=""><div class="like"><span class="fwdicon fwdicon-love"></span><span class="count">' . acora_get_number_of_likes($post) . '</span></div></div>';
}
$output .= '</li>';
}
}
$output .= '</ul>';
wp_reset_postdata();
}
echo wp_kses($output, wp_kses_allowed_html('post'));
}
// Get portfolio related playlist.
function acora_get_portfolio_related_playlist($id){
global $post;
$categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
$cat_names = array();
foreach ($categories as $cat) {
$cat_names[] = $cat->name;
}
if(empty($cat_names)) return;
$tax_query = array(array('taxonomy' => 'acora_category', 'field' => 'name', 'terms' => $cat_names));
$args = array(
'post_type' => 'acora_portfolio',
'tax_query' => $tax_query,
'posts_per_page' => AcoraData::$data->portfolio_settings['thumbnails_rp_max_number'],
'orderby' => 'rand',
'post_status' => array('publish', 'private'),
'post__not_in' => array($post->ID)
);
// Categories.
$output = '<ul id="' . esc_attr($id) . '" style="display:none">';
$output .= '<li data-categories="">';
$output .='</li>';
$portfolio = new WP_Query($args);
if(!$portfolio->found_posts){
return;
}
while($portfolio->have_posts()){
$portfolio->the_post();
$post = $portfolio->post;
$categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
$data = acora_porfolio_get_data($post->ID);
extract($data);
$client = get_post_meta($post->ID, 'acora_client', true);
$featuredImage = '';
foreach ($gallery_images as $image) {
if($image['featured']){
$featuredImage = $image;
}
}
if(empty($featuredImage) && $gallery_images){
$featuredImage = $gallery_images[0];
}
if(!empty($gallery_images)){
$output .= '<li data-url="' . get_the_permalink() . '">';
$output .= '<ul data-category="">';
foreach ($categories as $category) {
$output .= '<li>' . esc_html($category->name) . '</li>';
}
$output .= '</ul>';
$output .= '<ul data-slidewhow="">';
$i = 0;
foreach ($gallery_images as $image) {
if($featuredImage != $image){
if($i < 6) $output .= '<li>' . esc_url($image['thumbSrc']) . '</li>';
$i ++;
}
}
$output .= '</ul>';
$alt = '';
if(!empty($gallery_images[0]['title'])){
$alt = esc_html($gallery_images[0]['title']);
}
$output .= '<img src="' . esc_url($featuredImage['thumbSrc']) . '" alt="' . esc_attr($alt) . '"/>';
$output .= '<div data-title="">' . esc_html(acora_short_str($post->post_title, 15)) . '</div>';
$output .= '<div data-client=""><div class="client"><span class="fwdicon fwdicon-author"></span><span>' . esc_html($client) . '</span></div></div>';
// acora_get_number_of_likes is already escaped.
$output .= '<div data-likes=""><div class="like"><span class="fwdicon fwdicon-love"></span><span class="count">' . esc_html(acora_get_number_of_likes($post)) . '</span></div></div>';
$output .= '</li>';
}
}
$output .= '</ul>';
wp_reset_postdata();
return wp_kses($output, wp_kses_allowed_html('post'));
}
// Portfolio nfinite grid playlist.
function acora_igp_portfolio_category_has_enough_projects($category_name){
if(empty($category_name)) return;
$result = 'allowed';
$tax_query = array(array('taxonomy' => 'acora_category', 'field' => 'slug', 'terms' => array($category_name)));
$args = array(
'post_type' => 'acora_portfolio',
'tax_query' => $tax_query,
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
$cat_query = new WP_Query($args);
wp_reset_postdata();
if($cat_query->found_posts < 9){
$result = 'not_allowed';
}
return $result;
}
function acora_igp_portfolio_author_has_enough_projects($author_name){
if(empty($author_name)) return;
$result = 'allowed';
$args = array(
'post_type' => 'acora_portfolio',
'author_name' => $author_name,
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
$author_query = new WP_Query($args);
wp_reset_postdata();
if($author_query->found_posts < 9){
$result = 'not_allowed';
}
return $result;
}
function acora_igp_portfolio_tags_has_enough_projects($tag_name){
if(empty($tag_name)) return;
$result = 'allowed';
$tax_query = array(array('taxonomy' => 'acora_tags', 'field' => 'slug', 'terms' => array($tag_name)));
$args = array(
'post_type' => 'acora_portfolio',
'tax_query' => $tax_query,
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
$tag_query = new WP_Query($args);
wp_reset_postdata();
if($tag_query->found_posts < 9){
$result = 'not_allowed';
}
return $result;
}
function acora_igp_portfolio_archive_has_enough_projects(){
$result = 'allowed';
$args = array(
'post_type' => 'acora_portfolio',
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
if(empty(acora_get_portfolio_all_categories_names())){
$result = 'not_allowed';
}
$cat_tests = array();
foreach (acora_get_portfolio_all_categories_names() as $cat){
$cat_tests[] = array('name' => $cat, 'count' => 0);
}
$query = new WP_Query($args);
while($query->have_posts()){
$query->the_post();
$post = $query->post;
$temp_categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
foreach($temp_categories as $category){
foreach($cat_tests as &$temp_cat){
if($category->name == $temp_cat['name']){
$temp_cat['count'] = $temp_cat['count'] + 1;
}
}
}
}
foreach($cat_tests as $cat){
if($cat['count'] < 9){
$result = 'not_allowed';
}
}
return $result;
}
function acora_get_portfolio_all_categories_names(){
$args = array(
'post_type' => 'acora_portfolio',
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
$portfolio = new WP_Query($args);
$categories = array();
while($portfolio->have_posts()){
$portfolio->the_post();
$post = $portfolio->post;
$temp_categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
foreach($temp_categories as $category) {
array_push($categories, $category->name);
}
}
wp_reset_postdata();
return array_unique($categories);
}
function acora_get_igp_portfolio_playlist($id, $category_name='', $author_name='', $tag_name='', $widget=''){
$output = '<div id="' . esc_attr($id) . '" style="display:none">';
if($category_name || $author_name || $tag_name || $widget){
if(!empty($category_name)){
$tax_query = array(array('taxonomy' => 'acora_category', 'field' => 'slug', 'terms' => array($category_name)));
$args = array(
'post_type' => 'acora_portfolio',
'tax_query' => $tax_query,
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
}else if(!empty($author_name)){
$args = array(
'post_type' => 'acora_portfolio',
'author_name' => $author_name,
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
}else if(!empty($tag_name)){
$tax_query = array(array('taxonomy' => 'acora_tags', 'field' => 'slug', 'terms' => array($tag_name)));
$args = array(
'post_type' => 'acora_portfolio',
'tax_query' => $tax_query,
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
}else if(!empty($widget)){
$args = array(
'post_type' => 'acora_portfolio',
'posts_per_page' => 18,
'post_status' => array('publish', 'private')
);
}
$cat_query = new WP_Query($args);
$output .= '<div data-cat="' . esc_html($category_name) . '">';
while($cat_query->have_posts()){
$cat_query->the_post();
$post = $cat_query->post;
$temp_categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
$data = acora_porfolio_get_data($post->ID);
extract($data);
$featuredImage = '';
foreach ($gallery_images as $image) {
if($image['featured']){
$featuredImage = $image;
}
}
if(empty($featuredImage) && $gallery_images){
$featuredImage = $gallery_images[0];
}
$cats = '<ul data-category="">';
foreach($temp_categories as $temp_category) {
$cats .= '<li>' . esc_html($temp_category->name) . '</li>';
}
$cats .= '</ul>';
$image_src = $featuredImage['thumbSrc'];
if(!empty($widget) && !empty($featuredImage['sThumbSrc'])){
$image_src = $featuredImage['sThumbSrc'];
}
$output .= "<div>";
$output .= '<li data-thumb-src="' . esc_url($image_src) . '" data-thumb-link="' . esc_url(get_the_permalink()) . '" data-thumb-target="_self"></li>';
$output .= $cats;
$output .= '<div data-title="">' . esc_html(acora_short_str($post->post_title, 35)) . '</div>';
$output .= '<div data-client=""><div class="client"><span class="fwdicon fwdicon-author"></span><span>' . esc_html($client) . '</span></div></div>';
if(!empty(AcoraData::$data->portfolio_settings['use_like_feature'])){
// acora_get_number_of_likes is already escaped.
$output .= '<div data-likes=""><div class="like"><span class="fwdicon fwdicon-love"></span><span class="count">' . acora_get_number_of_likes($post) . '</span></div></div>';
}
$output .= '</div>';
}
$output .= '</div>';
wp_reset_postdata();
}else{
$args = array(
'post_type' => 'acora_portfolio',
'posts_per_page' => -1,
'post_status' => array('publish', 'private')
);
$portfolio = new WP_Query($args);
$categories = acora_get_portfolio_all_categories_names();
foreach($categories as $category){
$output .= '<div data-cat="' . esc_html($category) . '">';
while($portfolio->have_posts()){
$portfolio->the_post();
$post = $portfolio->post;
$temp_categories = wp_get_post_terms($post->ID, 'acora_category', array("fields" => "all"));
$data = acora_porfolio_get_data($post->ID);
extract($data);
$featuredImage = '';
foreach ($gallery_images as $image) {
if($image['featured']){
$featuredImage = $image;
}
}
if(empty($featuredImage) && $gallery_images){
$featuredImage = $gallery_images[0];
}
$cats = '<ul data-category="">';
foreach($temp_categories as $temp_category) {
$cats .= '<li>' . esc_html($temp_category->name) . '</li>';
}
$cats .= '</ul>';
$found = false;
foreach($temp_categories as $temp_category) {
if($temp_category->name == $category){
$output .= "<ul>";
$output .= '<li data-thumb-src="' . esc_url($featuredImage['thumbSrc']) . '" data-thumb-link="' . esc_url(get_the_permalink()) . '" data-thumb-target="_self"></li>';
$output .= $cats;
$output .= '<div data-title="">' . esc_html(acora_short_str($post->post_title, 35)) . '</div>';
$output .= '<div data-client=""><div class="client"><span class="fwdicon fwdicon-author"></span><span>' . esc_html($client) . '</span></div></div>';
if(!empty(AcoraData::$data->portfolio_settings['use_like_feature'])){
// acora_get_number_of_likes is already escaped.
$output .= '<div data-likes=""><div class="like"><span class="fwdicon fwdicon-love"></span><span class="count">' . acora_get_number_of_likes($post) . '</span></div></div>';
}
$output .= "</ul>";
}
}
}
$output .= '</div>';
}
}
$output .= '</div>';
wp_reset_postdata();
echo wp_kses($output, wp_kses_allowed_html('post'));
}
// Display blog navigation to next/previous pages when applicable.
function acora_portfolio_nav() {
global $wp_query, $post;
// Don't print empty markup on single pages if there's nowhere to navigate.
if(is_single()){
$previous = (is_attachment()) ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
$next = get_adjacent_post(false, '', false);
if(!$next && !$previous) {
return;
}
}else{
return;
}
?>
<nav class="post-navigation">
<?php
$next_post = get_next_post();
if ($next_post) : ?>
<a class="button-light button-fwdicon-right fwdicon-right nav-previous" href="<?php echo esc_url(get_permalink($next_post->ID)); ?>">
<?php esc_html_e('Next project', 'acora'); ?>
</a><?php
else: ?>
<span class="button-light button-fwdicon-right fwdicon-right nav-previous button-disabled">
<?php esc_html_e('Next project', 'acora'); ?>
</span><?php
endif;
?>
<a class="button-light button-fwdicon-left fwdicon-projects nav-portfolio" href="<?php echo esc_url(get_post_type_archive_link('acora_portfolio')); ?>">
<?php esc_html_e('All projects', 'acora'); ?>
</a>
<?php
$previous_post = get_previous_post();
if ($previous_post): ?>
<a class="button-light button-fwdicon-left fwdicon-left nav-next" href="<?php echo esc_url(get_permalink($previous_post->ID)); ?>">
<?php esc_html_e('Previous project', 'acora'); ?>
</a><?php
else: ?>
<span class="button-light button-fwdicon-left fwdicon-left nav-next button-disabled">
<?php esc_html_e('Previous project', 'acora'); ?>
</span><?php
endif;
?>
</nav><?php
}
/**
* Get video and audio for post video and audio post formats.
*/
function acora_get_video($instanceName, $parentId, $source, $posterPath, $subtitlePath){
if(empty($source)){
$output = '<div class="table"><div class="table-cell text-center">Please add a video file (mp4, youtube, vimeo, hls) in your post <a href="' . esc_url(get_edit_post_link(get_the_ID())) . '" target="_blank">here</a>.</div></div>';
}else{
$output = fwddupt_get_FWDEVP(esc_html($instanceName), esc_html($parentId), 'no', esc_url($source), esc_url($posterPath), esc_url($subtitlePath));
}
return wp_kses($output, wp_kses_allowed_html('post'));
}
function acora_get_audio($instanceName, $parentId, $source){
if(empty($source)){
$output = '<div class="table"><div class="table-cell text-center">Please add a audio file (mp3 or soundcloud) in your post <a href="' . esc_url(get_edit_post_link(get_the_ID())) . '" target="_blank">here</a>.</div></div>';
}else{
$output = fwddupt_get_FWDEVP(esc_html($instanceName), esc_html($parentId), 'yes', esc_url($source));
}
return wp_kses($output, wp_kses_allowed_html('post'));
}
/**
* Get must install plugin.
*/
function acora_must_have_settings_plugin(){
if(!defined('ACORA_SETTINGS_INIT')){
echo '<div style="margin-top: 100px; text-align:center; text-transform:uppercase;">' . esc_html__('Please install Acora Settings Plugin to view this page.', 'acora') . '</div>';
return;
}
return true;
}
/**
* FWD constructors.
* -------------------------------------------------------
*/
function acora_get_FWDHS(
$instanceName,
$parentId,
$playlistId
){
$output = '<script type="text/javascript"> jQuery(window).ready(function($){ new FWDHS({ instanceName:"' . esc_html($instanceName) . '", parentId:"' . esc_html($parentId) . '", mainFolderPath:"' . esc_url(ACORA_URI) . '/js/fwd/fwdhs/content", skinPath:"minimal_skin_dark",playlistId:"' . esc_html($playlistId) . '",rightClickContextMenu:"disabled",preloaderPosition:"center",slideshowPreloaderPosition:"bottomRight",slideshowRadius:9,slideshowBackgroundColor:"#a2a2a2",slideshowFillColor:"#FFF",slideshowStrokeSize:2});});</script>';
echo wp_kses($output, wp_kses_allowed_html('post'));
}
function acora_get_igp_portfolio_grid(
$instanceName,
$parentId,
$playlistId,
$menuSelectorLabel,
$allCatLabel,
$tW,
$tH,
$preset = '',
$showThumbnailIcon = 'no',
$addZoomSupport = "no",
$maxScale = 1.6,
$minScale = .8
){
if($instanceName == 'mySISC-home-extended'){
$backgroundColor = 'rgba(43,43,43)';
}
$backgroundColor = '#FFF';
$thumbnailBackgroundColor = 'transparent';
if(AcoraData::$data->general_settings['theme_style'] == 'dark'){
$backgroundColor = '#111';
$thumbnailBackgroundColor = '#2a2a2a';
}
$output = '<script type="text/javascript"> jQuery(window).ready(function($){ FWDIGPUtils.checkIfHasTransofrms(); new FWDIGP({rightClickContextMenu:"disabled",instanceName:"' . esc_html($instanceName) . '",parentId:"' . esc_html($parentId) . '",mainFolderPath:"' . esc_url(ACORA_URI) . '/js/fwd/fwdigp/content", skinPath:"upt-skin",useVectorIcons:"yes",galleryId:"' . esc_html($playlistId) . '",displayType:"afterparent",dragDirection:"both",autoScrollDirection:"right",initializeOnlyWhenVisible:"no",thumbnailTransitionType:"motion",allCategoriesLabel:"' . esc_html($allCatLabel) . '",showAllGalleries:"yes",autoScale:"yes",autoScroll:"no",enableVisitedThumbnails:"no",keepThumbnailsOriginalSizeOnGridStart:"no",addZoomSupport:"' . $addZoomSupport . '",addDragAndSwipeSupport:"yes",disableThumbnailInteractivity:"no",fontIcon:"fwdicon",randomizeAllCategories:"yes",randomizeCategories:"no",showThumbnailOverlay:"' . esc_html($showThumbnailIcon) . '",showThumbnailIcon:"' . esc_html($showThumbnailIcon) . '",preset:"' .esc_html($preset) . '", thumbnailsOrder:"normal",startAtGallery:0,maxWidth:940,maxHeight:600,thumbnailMaxWidth:' . esc_html($tW) . ',thumbnailMaxHeight:' . esc_html($tH) . ',maxScale:"' . $maxScale . '",minScale:"' . $minScale . '", autoScrollSpeed:10,thumbnailOverlayOpacity:.7,helpScreenOpacity:.8,backgroundColor:"' . esc_html($backgroundColor) . '",thumbnailBackgroundColor:"' . esc_html($thumbnailBackgroundColor) . '",thumbnailOverlayColor:"#000",allGalleriesMenuLabel:"' . esc_html($allCatLabel) . '",galleriesMenuSelectLabel:"' . esc_html($menuSelectorLabel) . '",menuPosition:"topRight",slideshowRadius:9,slideshowBackgroundColor:"#FFF",slideshowFillColor:"#000",slideshowStrokeSize:2,showGalleriesMenu:"yes"});});</script>';
return wp_kses($output, wp_kses_allowed_html('post'));
}
function acora_portfolio_grid(
$instanceName,
$parentId,
$playlistId,
$gridType,
$comboboxSelectorLabel,
$allCatLabel,
$tW,
$tH,
$showMenu = 'yes',
$useThumbnailSlideshow = 'yes',
$preset = 'default',
$fitToViewportHeight = 'no',
$animateParent = 'yes',
$showSearch = 'yes',
$horizontalSpaceBetweenThumbnails = 0,
$verticalSpaceBetweenThumbnails = 0,
$prelaoderAllScreen = 'yes'
){
if($useThumbnailSlideshow === true){
$useThumbnailSlideshow = 'yes';
}
$previewText = esc_html__('Read more', 'acora');
$output = '<script type="text/javascript"> jQuery(document).ready(function($){ FWDVSUtils.checkIfHasTransofrms(); new FWDVS({gridType:"' . esc_html($gridType) . '",rightClickContextMenu:"default",instanceName:"' . esc_html($instanceName) .'",parentId:"' . esc_html($parentId) . '",mainFolderPath:"' . esc_url(ACORA_URI) . '/js/fwd/fwdvs/content",gridSkinPath:"grid_skin_classic",playlistId:"' . esc_html($playlistId) .'",allCategoriesLabel:"' . esc_html($allCatLabel) . '",showAllCategories:"yes",randomizeCategories:"no",fontIcon:"fwdicon",initializeOnlyWhenVisible:"yes",startAtCategory:0,slideshowRadius:9,slideshowBackgroundColor:"#a2a2a2",backgroundColor:"transparent",slideshowFillColor:"#000000",slideshowStrokeSize:2,showSearch:"' . esc_html($showSearch) . '",notFoundLabel:"' . __('nothing found', 'acora') . '",searchLabel:"' . __('Search Project Item', 'acora') . '",animateParent:"' . esc_html($animateParent) .'",showMenu:"' . esc_html($showMenu) .'",showMenuButtonsSpacers:"yes",howManyThumbnailsToDisplayPerSet:20,fitToViewportHeight:"' . esc_html($fitToViewportHeight) . '",comboboxSelectorLabel:"' . esc_html($comboboxSelectorLabel) . '",menuButtonSpacerHeight:20,hideAndShowTransitionType:"scale",thumbanilBoxShadow:"none",disableThumbnails:"no",thumbnailsHorizontalOffset:0,thumbnailsVerticalOffset:0,thumbnailMaxWidth:' . esc_html($tW) .',thumbnailMaxHeight:' . esc_html($tH) . ',horizontalSpaceBetweenThumbnails:' . esc_html($horizontalSpaceBetweenThumbnails) . ',verticalSpaceBetweenThumbnails:' . esc_html($verticalSpaceBetweenThumbnails) . ',useThumbnailSlideshow:"' . esc_html($useThumbnailSlideshow) . '",thumbnailBorderSize:0,thumbnailBorderRadius:0,preset:"' . esc_html($preset) . '",thumbnailOverlayOpacity:.7,prelaoderAllScreen:"' . esc_html($prelaoderAllScreen) . '",previewText:"' . esc_html($previewText) . '"});});</script>';
return wp_kses($output, wp_kses_allowed_html('post'));
}
function acora_gg(
$instanceName,
$parentId,
$playlistId,
$gridType,
$tW,
$tH,
$useThumbnailSlideshow,
$startPosition,
$preset,
$horizontalSpaceBetweenThumbnails,
$autoScroll = 'no',
$smoothScroll = 'no'
){
$output = '<script type="text/javascript"> jQuery(window).ready(function($){FWDGGUtils.checkIfHasTransofrms(); new FWDGG({gridType:"' . esc_html($gridType) . '",rightClickContextMenu:"disabled",instanceName:"' . esc_html($instanceName) . '",parentId:"' . esc_html($parentId) . '",mainFolderPath:"'. esc_url(ACORA_URI) . '/js/fwd/fwdgg/content",gridSkinPath:"grid_skin_classic",playlistId:"' . esc_html($playlistId) . '",randomizeCategories:"no",initializeOnlyWhenVisible:"yes",useThumbnailSlideshow:"' . esc_html($useThumbnailSlideshow) . '",startPosition: "' . esc_html($startPosition) . '",slideshowRadius:9,fontIcon:"fwdicon",slideshowStrokeSize: 2,slideshowBackgroundColor:"#FFFFFF",slideshowFillColor:"#000000",backgroundColor:"transparent",disableThumbnails:"no",showThumbnailOnlyWhenImageIsLoaded:"no",smoothScroll:"' . esc_html($smoothScroll) . '",autoScroll:"' . esc_html($autoScroll) . '",autoScrollDirection_str:"left",autoScrollSpeed: .05,thumbnailBorderNormalColor:"transparent",thumbnailBorderSelectedColor:"transparent",thumbnailsHorizontalOffset:0,thumbnailsVerticalOffset:0,thumbnailMaxWidth:' . esc_html($tW) . ',thumbnailMaxHeight:' . esc_html($tH) . ',horizontalSpaceBetweenThumbnails:' . esc_html($horizontalSpaceBetweenThumbnails) . ',thumbnailBorderSize:0,thumbnailBorderRadius:0,prelaoderAllScreen:"no",preset:"' . esc_html($preset) . '",thumbnailOverlayOpacity:.7,previewText: "Read more"});});</script>';
return wp_kses($output, wp_kses_allowed_html('post'));
}
function acora_get_FWDSISC(
$instanceName,
$parentId,
$acoraGalleryPlaylist,
$paralax = 'no',
$displayVertical = 'no',
$showNextAndPrevButtons = 'no',
$buttonsHideDelay = 1000,
$slideshowDelay = 0,
$randomizeImages = 'no',
$addDragSupport = 'yes',
$showCount = 'no',
$maxImageHeight = 'fullscreen',
$preloaderPosition = "center",
$show_zoom_button = 'yes',
$show_fullscreen_button = 'yes'
){
$overlay_color ='rgba(0,0,0,.4)';
if($maxImageHeight == 'fullscreen'){
$overlay_color = 'rgba(0,0,0,0)';
}
if($displayVertical == 'yes'){
$paralax = 'no';
$showNextAndPrevButtons = 'no';
}
$imageBackgroundColor = '#F6F4F8';
if(AcoraData::$data->general_settings['theme_style'] == 'dark'){
$imageBackgroundColor = '#1A1A1A';
}
$useVideo = AcoraData::$data->portfolio_settings['use_video'] ? 'yes' : 'no';
$preloaderBackgroundColor = AcoraData::$data->portfolio_settings['preloader_background_color'];
$preloaderFillColor = AcoraData::$data->portfolio_settings['preloader_fill_color'];
$fillEntireVideoScreen = AcoraData::$data->portfolio_settings['fill_entire_video_screen'] ? 'yes' : 'no';
$useKeyboard = AcoraData::$data->portfolio_settings['use_keyboard'] ? 'yes' : 'no';
$volume = AcoraData::$data->portfolio_settings['volume'];
$logoPath = AcoraData::$data->portfolio_settings['logo_src'];
$showLogo = $logoPath ? 'yes' : 'no';
$showVolumeButton = AcoraData::$data->portfolio_settings['show_volume_button'] ? 'yes' : 'no';
$showScrubberWhenControllerIsHidden = AcoraData::$data->portfolio_settings['show_scrubber_when_controller_is_hidden'] ? 'yes' : 'no';
$showChromecastButton = AcoraData::$data->portfolio_settings['show_chromecast_button'] ? 'yes' : 'no';
$showTime = AcoraData::$data->portfolio_settings['show_time'] ? 'yes' : 'no';
$showRewindButton = AcoraData::$data->portfolio_settings['show_rewind_button'] ? 'yes' : 'no';
$showQualityButton = AcoraData::$data->portfolio_settings['show_quality_button'] ? 'yes' : 'no';
$showPlaybackRateButton = AcoraData::$data->portfolio_settings['show_playback_rate_button'] ? 'yes' : 'no';
$showFullScreenButton = AcoraData::$data->portfolio_settings['show_video_fullscreen_button'] ? 'yes' : 'no';
$showScrubberToolTipLabel = AcoraData::$data->portfolio_settings['show_scrubber_tool_tip_label'] ? 'yes' : 'no';
$scrubbersToolTipLabelBackgroundColor = AcoraData::$data->portfolio_settings['scrubbers_tooltip_label_background_color'];
$scrubbersToolTipLabelFontColor = AcoraData::$data->portfolio_settings['scrubbers_tooltip_label_font_color'];
$audioVisualizerCircleColor = AcoraData::$data->portfolio_settings['audio_visualizer_circle_color'];
$audioVisualizerLinesColor = AcoraData::$data->portfolio_settings['audio_visualizer_lines_color'];
$preloaderPosition = 'center';
$output = '<script type="text/javascript"> jQuery(window).ready(function($){ new FWDSISC({ instanceName:"' . esc_html($instanceName) . '",displayType:"afterparent",parentId:"' . esc_html($parentId) . '",mainFolderPath:"' . esc_url(ACORA_URI) . '/js/fwd/fwdsisc/content",skinPath:"minimal_skin_dark",playlistId:"' . esc_html($acoraGalleryPlaylist) . '",rightClickContextMenu:"disabled",autoScale:"yes",randomizeImages:"' . esc_html($randomizeImages) . '",logoPath:"' . esc_url_raw($logoPath) . '",showPlaybackRateButton:"' . esc_html($showPlaybackRateButton) . '",showQualityButton:"' . esc_html($showQualityButton) . '",showRewindButton:"' . esc_html($showRewindButton) . '",showLogo:"' . esc_html($showLogo) . '",showTime:"' . esc_html($showTime) . '",addKeyboardSupport:"' . esc_html($useKeyboard) . '",showScrubberToolTipLabel:"' . esc_html($showScrubberToolTipLabel) . '",showFullscreenButton:"' . esc_html($show_fullscreen_button) . '",audioVisualizerLinesColor:"' . esc_html($audioVisualizerLinesColor) . '",audioVisualizerCircleColor:"' . esc_html($audioVisualizerCircleColor) . '",showChromecastButton:"' . esc_html($showChromecastButton) . '",addDragSupport:"' . esc_html($addDragSupport) . '",initializeOnlyWhenVisible:"yes",useVectorIconsSkin:"yes",displayVertical:"' . esc_html($displayVertical) . '",useVideo:"' . esc_html($useVideo) . '",paralax:"' . esc_html($paralax) .'",zIndex:0,maxWidth:800,maxHeight:600,startAtImage:0,videoShowFullScreenButton:"' . esc_html($showFullScreenButton) . '",fontIcon:"fwdicon",showZoomButton:"' . esc_html($show_zoom_button). '",scrubbersToolTipLabelFontColor:"' . esc_html($scrubbersToolTipLabelFontColor) . '",scrubbersToolTipLabelBackgroundColor:"' . esc_html($scrubbersToolTipLabelBackgroundColor) . '",showScrubberWhenControllerIsHidden:"' . esc_html($showScrubberWhenControllerIsHidden) . '",showVolumeButton:"' . esc_html($showVolumeButton) . '",fillEntireVideoScreen:"' . esc_html($fillEntireVideoScreen) . '",slideshowBackgroundColor:"' . esc_html($preloaderBackgroundColor) . '",slideshowFillColor:"' . esc_html($preloaderFillColor) . '",volume:' . esc_html($volume) . ',buttonsHideDelay:' . esc_html($buttonsHideDelay) . ',howManyImagesToSkipOnNextAndPrevButtons:1,zoomButtonOffset:10,showNextAndPrevButtonsOnMobile:"yes",showNextAndPrevButtons:"' . esc_html($showNextAndPrevButtons) . '",showImageReflection:"no",animationTextType:"fadeFromBottomToTop",transitionType:"expo",showHTMLTextContent:"center",showCount:"' . esc_html($showCount) .'",HTMLTextPosition:"inside",nextAndPrevButtonsPosition:"leftAndRight",nextAndPrevButtonsHorizontalButtonsOffset:30,nextAndPrevButtonsVerticalButtonsOffset:0,sliderOffsetTopAndBottom:0,maxImageHeight:"' . esc_html($maxImageHeight) . '",maxCenterImageHeight:"originalSize",spaceBetweenImages:0,imageBorderSize:0,youtubeQualityButtonNormalColor:"#B9B9B9",youtubeQualityButtonSelectedColor:"#FFFFFF",defaulNrThumbsToDisplay:3,transitionDuration:.8,overlayColor:"' . esc_html($overlay_color) . '",imageBorderColor:"transparent",imageBackgroundColor:"' . esc_html($imageBackgroundColor) . '",backgroundColor:"' . esc_html($imageBackgroundColor) . '",preloaderPosition:"' . esc_html($preloaderPosition) . '",slideshowPreloaderPosition:"' . esc_html($preloaderPosition) . '",slideshowDelay:' . esc_html($slideshowDelay) . ',slideshowRadius:9,slideshowStrokeSize:2, showInfoHolder:"yes", infoHolderHeight:40, infoHolderHorizontalOffset:30,infoHolderVerticalOffset:30,infoHolderStartHorizontalSpace:20,showCaption:"yes",captionAnimationType:"fadeFromBottomToTop",showDefaultControllerForVimeo:"yes",infoHolderHorizontalSpaceBetweenItems:12,infoHolderBackgroundColor:"rgba(0,0,0, .7)"}); });</script>';
return wp_kses($output, wp_kses_allowed_html('post'));
}
function acora_get_FWDSI(
$instanceName,
$parentId,
$display,
$imageSource,
$width,
$height,
$limit_height_id = "",
$initializeOnlyWhenVisible = 'yes',
$backgroundColor = '#F6F4F8'
){
if(AcoraData::$data->general_settings['theme_style'] == 'dark'){
$backgroundColor = '#1A1A1A';
}
if($instanceName == 'mySISC-home-extended'){
$backgroundColor = 'rgba(43,43,43)';
}
$output = '<script type="text/javascript"> jQuery(window).ready(function($){ new FWDSI({instanceName:"' . esc_html($instanceName) . '",displayType:"' . esc_html($display) . '",parentId:"' . esc_html($parentId) . '",imageSource:"' . esc_url($imageSource) . '",initializeOnlyWhenVisible:"' . esc_html($initializeOnlyWhenVisible) . '",maxWidth:' . esc_html($width) . ',maxHeight:' . esc_html($height) . ',slideshowPreloaderPosition:"center",slideshowRadius:9,slideshowBackgroundColor:"#FFFFFF",slideshowFillColor:"#000000",slideshowStrokeSize:2,limitId:"' . esc_html($limit_height_id) . '",backgroundColor:"' . esc_html($backgroundColor) . '"});});</script>';
return wp_kses($output, wp_kses_allowed_html('post'));
}
function fwddupt_get_FWDEVP(
$instance_name,
$parent_id,
$use_without_video_screen,
$source,
$poster_source = '',
$subtitle_source = '',
$display_type = 'afterparent',
$use_chromeless = 'no',
$autoplay = 'no',
$loop = 'no',
$keyboard = 'yes'
){
if(!empty($subtitleSource)){
$subtitleSource = '{subtitlePath:"' . esc_url($subtitleSource) .'", subtileLabel:"English"}';
}
$output = '<script type="text/javascript"> jQuery(window).ready(function($){ FWDEVPUtils.checkIfHasTransofrms(); new FWDEVPlayer({instanceName:"' . esc_html($instance_name) .'",parentId:"' . esc_html($parent_id) .'",mainFolderPath:"' . esc_url(ACORA_URI) . '/js/fwd/fwdevp/content' . '",initializeOnlyWhenVisible:"yes",skinPath:"minimal_skin_dark",displayType:"' . esc_html($display_type) . '",fillEntireVideoScreen:"yes",useVectorIcons:"yes",useWithoutVideoScreen:"' . esc_html($use_without_video_screen) . '",preloaderBackgroundColor:"#000000",preloaderFillColor:"#FFFFFF",videoSource:[{source:"' . esc_html($source) . '", label:"hd1080"}],posterPath:"' . esc_html($poster_source) .'",showErrorInfo:"yes",fillEntireScreenWithPoster:"no",rightClickContextMenu:"disabled",disableDoubleClickFullscreen:"no",addKeyboardSupport:"' . esc_html($keyboard) . '",autoPlay:"'. esc_html($autoplay) . '",loop:"' . esc_html($loop) . '",volume:1,backgroundColor:"#F6F4F8",posterBackgroundColor:"#000000",showControllerWhenVideoIsStopped:"yes",showDefaultControllerForVimeo:"no",showVolumeScrubber:"yes",showVolumeButton:"yes",showTime:"yes",showRewindButton:"yes",playsinline:"yes",showQualityButton:"yes",showShareButton:"no",showEmbedButton:"no",showDownloadButton:"no",showFullScreenButton:"yes",showMainScrubberToolTipLabel:"yes",scrubbersToolTipLabelBackgroundColor:"#FFFFFF",repeatBackground:"yes",controllerHeight:47,controllerHideDelay:3,startSpaceBetweenButtons:14,spaceBetweenButtons:12,mainScrubberOffestTop:14,scrubbersOffsetWidth:4,timeOffsetLeftWidth:5,timeOffsetRightWidth:3,volumeScrubberWidth:80,volumeScrubberOffsetRightWidth:0,timeColor:"#888",useChromeless:"' . esc_html($use_chromeless) . '",youtubeQualityButtonNormalColor:"#777777",youtubeQualityButtonSelectedColor:"#FFFFFF",showPlaybackRateButton:"yes",defaultPlaybackRate:"1",showSubtitleButton:"no",subtitlesOffLabel:"Subtitle off",startAtSubtitle:1,showContextmenu:"yes",showScriptDeveloper:"no",contextMenuBackgroundColor:"#1a1a1a",contextMenuBorderColor:"#1f1f1f",contextMenuSpacerColor:"#333",contextMenuItemNormalColor:"#888",contextMenuItemSelectedColor:"#FFF",contextMenuItemDisabledColor:"#444",subtitlesSource:[{subtitlePath:"' . esc_url($subtitle_source). '"}] });});</script>';
return wp_kses($output, wp_kses_allowed_html('post'));
}
/**
* Globals.
* ----------------------------------------------------------
*/
// Get metas
function acora_get_meta_excerpt(){
global $post;
setup_postdata($post);
return esc_html(strip_tags(get_the_excerpt()));
}
function acora_get_meta_image(){
global $post;
$images = [];
if(get_post_format() == 'gallery'){
$galleryData = acora_gallery_get_data($post->ID);
extract($galleryData);
if(!empty($gallery_images)){
foreach ($gallery_images as $image) {
array_push($images, esc_url($image['src']));
}
}
}else if(get_post_type() == 'acora_portfolio'){
$galleryData = acora_porfolio_get_data($post->ID);
extract($galleryData);
if(!empty($gallery_images)){
foreach ($gallery_images as $image) {
if($image['featured']){
}
}
foreach ($gallery_images as $image) {
if(!$image['featured']) array_push($images, esc_url($image['imgSrc']));
}
}
}else if(has_post_thumbnail($post->ID)){
array_push($images, esc_url(wp_get_attachment_url(get_post_thumbnail_id($post->ID))));
}
return $images;
}
function acora_get_meta_image_size(){
if(!defined('ACORA_SETTINGS_INIT')){
return;
}
global $post;
if(get_post_format() == 'gallery'){
$galleryData = acora_gallery_get_data($post->ID);
extract($galleryData);
if(!empty($gallery_images)){
$sizes = array('w' => esc_html($gallery_images[0]['imgW']), 'h' => esc_html($gallery_images[0]['imgH']));
}
}else if(get_post_type() == 'acora_portfolio'){
$galleryData = acora_porfolio_get_data($post->ID);
extract($galleryData);
$featuredImage = '';
if(!empty($gallery_images)){
foreach ($gallery_images as $image) {
if($image['featured']) $featuredImage = $image;
}
if(empty($featuredImage) && $gallery_images){
$featuredImage = $gallery_images[0];
}
$sizes = array('w' => esc_html($featuredImage['imgW']), 'h' => esc_html($featuredImage['imgH']));
}
}else if(has_post_thumbnail($post->ID)){
$image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
$sizes = array('w' => esc_html($image[1]), 'h' => esc_html($image[2]));
}
if(empty($sizes)){
$sizes = array('w' => 0, 'h' => 0);
}
return $sizes;
}
// Get google fonts.
function acora_slug_fonts_url(){
$font_url = '';
/**
* Translators: If there are characters in your language that are not supported
* by chosen font(s), translate this to 'off'. Do not translate into your own language.
*/
if('off' !== _x('on', 'Google font: on or off', 'acora')){
$font_url = add_query_arg('family', 'Josefin+Sans:100,300,400,700|Open+Sans:100,300,400,600,700&display=swap&subset=latin-ext', "//fonts.googleapis.com/css" );
}
return esc_url($font_url);
}
/**
* Utils.
* ----------------------------------------------------------
*/
// Trim double quote.
function acora_trim_double_qoute($string){
$string = str_replace('"', '', $string);
return str_replace('\\', '', $string);
}
// Check for a specified value in an array.
function acora_array_has_value($array, $value_compare){
foreach ($array as $value) {
if($value->name == $value_compare) return true;
}
return false;
}
// Add ... if string is too long.
function acora_short_str($str, $max = 20){
$str = trim($str);
if(strlen($str) > $max){
$s_pos = strpos($str, ' ');
$cut = $s_pos === false || $s_pos > $max;
$str = wordwrap($str, $max, ';;', $cut);
$str = explode(';;', $str);
$str = $str[0] . '...';
}
return $str;
}
// Helper class to create tags.
class FWDUPT_cat_helper{
public $name;
}