Sindbad~EG File Manager
<?php
if (!defined('ABSPATH'))
exit; // Exit if accessed directly
/*
*
* imic Framework Theme Functions
* ------------------------------------------------
* imic Framework v2.0
* Copyright imic 2014 - http://www.imicreation.com/
* imic_theme_activation()
* imic_maintenance_mode()
* imic_custom_login_logo()
* imic_add_nofollow_cat()
* imic_admin_bar_menu()
* imic_admin_css()
* imic_analytics()
* imic_custom_styles()
* imic_custom_script()
* imic_content_filter()
* imic_register_sidebars()
* imic_event_grid()
* imic_event_time_columns()
* imic_afterSavePost()
* imic_get_cat_list()
* imic_widget_titles()
* imic_month_translate()
* imic_RevSliderShortCode()
* imic_query_arg()
* imicAddQueryVarsFilter()
* ImicConvertDate()
* imic_cat_count_flag()
* imic_recur_events()
* imic_custom_taxonomies_terms_links()
* imic_get_all_sidebars()
* imic_register_meta_box()
* imic_wp_get_attachment()
* imic_gallery_flexslider()
* imic_social_staff_icon()
* imic_event_status_view()
* imic_video_embed()
* imic_video_youtube()
* imic_video_vimeo()
* imic_audio_soundcloud()
* imic_orderby_include()
* imic_share_buttons()
* imic_custom_excerpt_length()
* imic_contact_event_manager()
* imic_book_event_ticket()
* imic_get_event_details()
* imic_search_button_header
* imic_cart_button_header
* IMIC SIDEBAR POSITION
* bbpress local host access
*
*/
/* THEME ACTIVATION
================================================== */
if (!function_exists('imic_theme_activation')) {
function imic_theme_activation() {
global $pagenow;
if (is_admin() && 'themes.php' == $pagenow && isset($_GET['activated'])) {
#provide hook so themes can execute theme specific functions on activation
do_action('imic_theme_activation');
}
}
add_action('admin_init', 'imic_theme_activation');
}
/* MAINTENANCE MODE
================================================== */
if (!function_exists('imic_maintenance_mode')) {
function imic_maintenance_mode() {
$options = get_option('imic_options');
$custom_logo = $custom_logo_output = $maintenance_mode = "";
if (isset($options['custom_admin_login_logo'])) {
$custom_logo = $options['custom_admin_login_logo']['url'];
}
$custom_logo_output = '<img src="' . $custom_logo . '" alt="maintenance" style="height: 62px!important;margin: 0 auto; display: block;" />';
if (isset($options['enable_maintenance'])) {
$maintenance_mode = $options['enable_maintenance'];
} else {
$maintenance_mode = false;
}
if ($maintenance_mode) {
if (!current_user_can('edit_themes') || !is_user_logged_in()) {
wp_die($custom_logo_output . '<p style="text-align:center">' . __('We are currently in maintenance mode, please check back shortly.', 'framework') . '</p>', __('Maintenance Mode', 'framework'));
}
}
}
add_action('get_header', 'imic_maintenance_mode');
}
/* CUSTOM LOGIN LOGO
================================================== */
if (!function_exists('imic_custom_login_logo')) {
function imic_custom_login_logo() {
$options = get_option('imic_options');
$custom_logo = "";
if (isset($options['custom_admin_login_logo'])) {
$custom_logo = $options['custom_admin_login_logo']['url'];
}
echo '<style type="text/css">
.login h1 a { background-image:url(' . $custom_logo . ') !important; background-size: auto !important; width: auto !important; height: 95px !important; }
</style>';
}
add_action('login_head', 'imic_custom_login_logo');
}
/* CATEGORY REL FIX
================================================== */
if (!function_exists('imic_add_nofollow_cat')) {
function imic_add_nofollow_cat($text) {
$text = str_replace('rel="category tag"', "", $text);
return $text;
}
add_filter('the_category', 'imic_add_nofollow_cat');
}
/* ----------------------------------------------------------------------------------- */
/* Show analytics code in footer */
/* ----------------------------------------------------------------------------------- */
if (!function_exists('imic_analytics')) {
function imic_analytics() {
$options = get_option('imic_options');
if (isset($options['tracking-code']) && $options['tracking-code'] != '') {
echo '<script>';
echo ''.$options['tracking-code'];
echo '</script>';
}
}
add_action('wp_head', 'imic_analytics');
}
/* CUSTOM CSS OUTPUT
================================================== */
if (!function_exists('imic_custom_styles')) {
function imic_custom_styles() {
$options = get_option('imic_options');
$HeaderLogoHeight = (isset($options['logo_upload']['height']))?$options['logo_upload']['height']:'';
$logo_height = (isset($options['logo_upload']['height']))?$options['logo_upload']['height']:'';
$sticky_header_height = (isset($options['sticky_header_height']))?$options['sticky_header_height']:'';
$NavLineHeight = intval($logo_height) + 33;
$DropDownLevel = intval($logo_height) + 40;
$StickyHeight = $sticky_header_height;
$StickyDropDownLevel = intval($sticky_header_height) + 8;
$LogoIcon = intval($sticky_header_height) - 30;
$LogoIconMar = intval($LogoIcon) / 2;
$StickyLogoHeight = intval($sticky_header_height) - 30;
$logo_type = (isset($options['logo_type']))?$options['logo_type']:'';
if ($HeaderLogoHeight < $StickyLogoHeight){
$StickyLogoHeight = $HeaderLogoHeight;
}
$HeaderHeight4 = intval($sticky_header_height) + 72;
$PHeaderHeight = intval($NavLineHeight) + 270;
$headericonslink = (isset($options['main_nav_color']['regular']))?$options['main_nav_color']['regular']:'';
$headericonslinkhover = (isset($options['main_nav_color']['hover']))?$options['main_nav_color']['hover']:'';;
$headericonslinkactive = (isset($options['main_nav_color']['active']))?$options['main_nav_color']['active']:'';
$sheadericonslink = (isset($options['sticky_main_nav_color']['regular']))?$options['sticky_main_nav_color']['regular']:'';
$sheadericonslinkhover = (isset($options['sticky_main_nav_color']['hover']))?$options['sticky_main_nav_color']['hover']:'';
$sheadericonslinkactive = (isset($options['sticky_main_nav_color']['active']))?$options['sticky_main_nav_color']['active']:'';
// OPEN STYLE TAG
echo '<style type="text/css">' . "\n";
if($logo_type==1 && $options['logo_upload']['url'] != '') {
echo '.site-logo img{height:'.esc_attr($HeaderLogoHeight).'px;}
.site-header.sticky-header .site-logo img{height:'.esc_attr($StickyLogoHeight).'px;}
.main-navigation > ul > li > a{line-height:'.esc_attr($NavLineHeight).'px;}
.search-module-opened, .cart-module-opened{top:'.esc_attr($NavLineHeight).'px;}
.search-module-trigger, .cart-module-trigger{line-height:'.esc_attr($NavLineHeight).'px;}
.header-style2 .body{padding-top:'.esc_attr($NavLineHeight).'px;}
.header-style2 .main-navigation > ul > li ul, .header-style4 .main-navigation > ul > li ul, .header-style5 .main-navigation > ul > li ul{top:'.esc_attr($DropDownLevel).'px;}
@media only screen and (max-width: 767px) {.header-style4 .body{padding-top:'.esc_attr($NavLineHeight).'px;}}
#menu-toggle{line-height:'.esc_attr($NavLineHeight).'px;}
@media only screen and (max-width: 992px) {.main-navigation{top:'.esc_attr($NavLineHeight).'px;}.header-style4 .main-navigation{top:'.esc_attr($NavLineHeight).'px;}}
@media only screen and (max-width: 767px) {.header-style5 .body{padding-top:'.esc_attr($NavLineHeight).'px;}}
';
}
echo '
.site-header.sticky-header{height:'.esc_attr($StickyHeight).'px;}
.sticky-header .main-navigation > ul > li > a{line-height:'.esc_attr($StickyHeight).'px;}
.sticky-header .search-module-opened, .sticky-header .cart-module-opened{top:'.esc_attr($StickyHeight).'px;}
.sticky-header .search-module-trigger, .sticky-header .cart-module-trigger{line-height:'.esc_attr($StickyHeight).'px;}
.site-header.sticky-header{height:'.esc_attr($StickyHeight).'px;}
.header-style4 .body{padding-top:'.esc_attr($HeaderHeight4).'px;}
.header-style2 .sticky-header .main-navigation > ul > li ul, .header-style4 .sticky-header .main-navigation > ul > li ul, .header-style5 .sticky-header .main-navigation > ul > li ul{top:'.esc_attr($StickyDropDownLevel).'px;}
.sticky-header .main-navigation > ul > li > a{line-height:'.esc_attr($StickyHeight).'px;}
.sticky-header #menu-toggle{line-height:'.esc_attr($StickyHeight).'px;}
@media only screen and (max-width: 992px) {.sticky-header .main-navigation{top:'.esc_attr($StickyHeight).'px;}}
.sticky-header .site-logo .text-logo{margin-top:'.esc_attr($LogoIconMar).'px;}
.header-style2 .sticky-header .main-navigation > ul > li ul, .header-style4 .sticky-header .main-navigation > ul > li ul, .header-style5 .sticky-header .main-navigation > ul > li ul{top:'.esc_attr($StickyDropDownLevel).'px;}
.search-module-trigger, .cart-module-trigger{color:'.esc_attr($headericonslink).';}
.search-module-trigger:hover, .cart-module-trigger:hover{color:'.esc_attr($headericonslinkhover).';}
.search-module-trigger:active, .cart-module-trigger:active{color:'.esc_attr($headericonslinkactive).';}
.sticky-header .search-module-trigger, .sticky-header .cart-module-trigger{color:'.esc_attr($sheadericonslink).';}
.sticky-header .search-module-trigger:hover, .sticky-header .cart-module-trigger:hover{color:'.esc_attr($sheadericonslinkhover).';}
.sticky-header .search-module-trigger:active, .sticky-header .cart-module-trigger:active{color:'.esc_attr($sheadericonslinkactive).';}
@media only screen and (max-width: 767px) {.header-style3 .site-header{position:relative;} .header-style3 .body{padding-top:0; }}
';
// Custom CSS
$custom_css = (isset($options['custom_css'])) ? $options['custom_css'] : '';
if (isset($options['theme_color_type']) && $options['theme_color_type'][0] == 1) {
$primaryColor = $options['primary_theme_color'];
echo '.text-primary, .btn-primary .badge, .btn-link,a.list-group-item.active > .badge,.nav-pills > .active > a > .badge, p.drop-caps:first-letter, .accent-color, .posts-listing .post-time, h3.title .title-border i, .upcoming-events .event-cats a:hover, .nav-np .next:hover, .nav-np .prev:hover, .basic-link, .pagination > li > a:hover,.pagination > li > span:hover,.pagination > li > a:focus,.pagination > li > span:focus, .staff-item .meta-data, .flexslider .flex-prev:hover, .flexslider .flex-next:hover, .event-list-item:hover .action-buttons > li > a:hover, .accordion-heading:hover .accordion-toggle, .accordion-heading:hover .accordion-toggle.inactive, .accordion-heading:hover .accordion-toggle i, .smaller-cont .lined-info h4 a, .quick-info h4, .sort-source li.active a, .event-ticket h4, .event-ticket .ticket-ico, .tag-cloud a:hover, .main-navigation > ul > li > ul > li a:hover, .events-listing-content .event-title, .twitter-widget .date, .woocommerce div.product span.price, .woocommerce div.product p.price, .woocommerce #content div.product span.price, .woocommerce #content div.product p.price, .woocommerce-page div.product span.price, .woocommerce-page div.product p.price, .woocommerce-page #content div.product span.price, .woocommerce-page #content div.product p.price, .woocommerce ul.products li.product .price, .woocommerce-page ul.products li.product .price, .pricing-column h3, .pricing-column .features a:hover, a:hover, .social-share-bar .share-buttons-tc.social-icons-colored a:hover{
color:'.esc_attr($primaryColor).';
}
.basic-link:hover{
opacity:.9
}
p.drop-caps.secondary:first-letter, .accent-bg, .fa.accent-color, .btn-primary,.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active,.dropdown-menu > .active > a,.dropdown-menu > .active > a:hover,.dropdown-menu > .active > a:focus,.nav-pills > li.active > a,.nav-pills > li.active > a:hover,.nav-pills > li.active > a:focus,.pagination > .active > a,.pagination > .active > span,.pagination > .active > a:hover,.pagination > .active > span:hover,.pagination > .active > a:focus,.pagination > .active > span:focus,.label-primary,.progress-bar-primary,a.list-group-item.active,a.list-group-item.active:hover,a.list-group-item.active:focus, .accordion-heading .accordion-toggle.active, .accordion-heading:hover .accordion-toggle.active,.panel-primary > .panel-heading, .carousel-indicators .active, .flex-control-nav a:hover, .flex-control-nav a.flex-active, .flexslider .flex-control-nav a.background--dark.flex-active, .media-box .media-box-wrapper, .notice-bar, .featured-block figure, .media-box .zoom .icon, .media-box .expand .icon, .latest-sermon-content, .page-header, .icon-box.icon-box-style1:hover .ico, .event-page-cal, .fc-event, .sermon-media-left.sermon-links, .nav-tabs li a:active, .nav-tabs li.active a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus, .page-header-overlay, #bbpress-forums div.bbp-topic-tags a:hover, .bbp-search-form input[type="submit"]:hover, .bbp-topic-pagination .current, .pricing-column.highlight h3{
background-color: '.esc_attr($primaryColor).';
}
.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary, .top-menu li a:hover, .woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover, .woocommerce input.button.alt:hover, .woocommerce #respond input#submit.alt:hover, .woocommerce #content input.button.alt:hover, .woocommerce-page a.button.alt:hover, .woocommerce-page button.button.alt:hover, .woocommerce-page input.button.alt:hover, .woocommerce-page #respond input#submit.alt:hover, .woocommerce-page #content input.button.alt:hover, .woocommerce a.button.alt:active, .woocommerce button.button.alt:active, .woocommerce input.button.alt:active, .woocommerce #respond input#submit.alt:active, .woocommerce #content input.button.alt:active, .woocommerce-page a.button.alt:active, .woocommerce-page button.button.alt:active, .woocommerce-page input.button.alt:active, .woocommerce-page #respond input#submit.alt:active, .woocommerce-page #content input.button.alt:active, .wpcf7-form .wpcf7-submit{
background: '.esc_attr($primaryColor).';
opacity:.9
}
p.demo_store, .woocommerce a.button.alt, .woocommerce button.button.alt, .woocommerce input.button.alt, .woocommerce #respond input#submit.alt, .woocommerce #content input.button.alt, .woocommerce-page a.button.alt, .woocommerce-page button.button.alt, .woocommerce-page input.button.alt, .woocommerce-page #respond input#submit.alt, .woocommerce-page #content input.button.alt, .woocommerce span.onsale, .woocommerce-page span.onsale, .wpcf7-form .wpcf7-submit, .woocommerce .widget_price_filter .ui-slider .ui-slider-handle, .woocommerce-page .widget_price_filter .ui-slider .ui-slider-handle, .woocommerce .widget_layered_nav ul li.chosen a, .woocommerce-page .widget_layered_nav ul li.chosen a, .ticket-cost{
background: '.esc_attr($primaryColor).';
}
.nav .open > a,.nav .open > a:hover,.nav .open > a:focus,.pagination > .active > a,.pagination > .active > span,.pagination > .active > a:hover,.pagination > .active > span:hover,.pagination > .active > a:focus,.pagination > .active > span:focus,a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active,a.list-group-item.active,a.list-group-item.active:hover,a.list-group-item.active:focus,.panel-primary,.panel-primary > .panel-heading, .flexslider .flex-prev:hover, .flexslider .flex-next:hover, .btn-primary.btn-transparent, .counter .timer-col #days, .event-list-item:hover .event-list-item-date .event-date, .icon-box.icon-box-style1 .ico, .event-prog .timeline-stone, .event-ticket-left .ticket-handle, .bbp-topic-pagination .current, .social-share-bar .share-buttons-tc.social-icons-colored a:hover{
border-color:'.esc_attr($primaryColor).';
}
.panel-primary > .panel-heading + .panel-collapse .panel-body, #featured-events ul.slides, .woocommerce .woocommerce-info, .woocommerce-page .woocommerce-info, .woocommerce .woocommerce-message, .woocommerce-page .woocommerce-message{
border-top-color:'.esc_attr($primaryColor).';
}
.panel-primary > .panel-footer + .panel-collapse .panel-body, .nav-tabs li a:active, .nav-tabs li.active a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus, .title .title-border{
border-bottom-color:'.esc_attr($primaryColor).';
}
/* Theme Options Styling */';
}
$site_width = (isset($options['site_width']))?$options['site_width']:'';
$flex_top = (isset($options['flex_caption_top']))?$options['flex_caption_top']:'';
$flex_left = (isset($options['flex_caption_side']))?$options['flex_caption_side']:'';
$flex_width = (isset($options['flex_caption_width']))?$options['flex_caption_width']:'';
$site_width=!empty($site_width)?$site_width:1080;
$site_width_spaced=!empty($site_width)?intval($site_width)+40:1120;
$header_five_nav=!empty($site_width)?intval($site_width)+70:1150;
$header_five_lefter= intval($header_five_nav) / 2;
echo '@media (min-width:1200px){.container{width:'.$site_width.'px;}}
body.boxed .body{max-width:'.$site_width_spaced.'px}
@media (min-width: 1200px) {body.boxed .body .site-header, body.boxed .body .topbar{width:'.$site_width_spaced.'px;}}
.header-style5 .site-header, .lead-content-wrapper{width:'.$header_five_nav.'px; margin-left: -'.$header_five_lefter.'px;}';
if (isset($options['footer_wide_width']) && $options['footer_wide_width'] == 1) {
echo '.site-footer > .container{width:100%;}';
}
if (isset($options['subpage_header_height']) && $options['subpage_header_height'] != '' && !is_home() && !is_front_page()) {
$subpage_hheight = $options['subpage_header_height'];
echo '.page-header, .hero-slider.flexslider, .hero-slider.flexslider ul.slides li{height:'.$subpage_hheight.'px}';
}
if (isset($options['header_wide_width']) && $options['header_wide_width'] == 1) {
echo '.header-style1 .container.for-navi, .header-style1 .topbar > .container, .header-style2 .container.for-navi, .header-style2 .topbar > .container, .header-style3 .container.for-navi, .header-style3 .topbar > .container, .header-style4 .container.for-navi, .header-style4 .topbar > .container{width:100%;}';
}
if (isset($options['sidebar_position']) && $options['sidebar_position'] == 2) {
echo ' #content-col, #sidebar-col{float:right!important;}';
}
if (isset($options['hide_featured_image']) && $options['hide_featured_image'] == 1) {
echo ' .single-post .post-media{display:none}';
}
if (isset($options['hide_meta_data']) && $options['hide_meta_data'] == 1) {
echo ' .single-post .meta-data{display:none}';
}
if (isset($options['add_to_calendar_text']) && $options['add_to_calendar_text'] != '') {
echo ' .single-event .addtocalendar .atcb-link{font-size: 0}.single-event .addtocalendar .atcb-link:before{content: "'.$options['add_to_calendar_text'].'"; font-size: 14px; line-height:2}';
}
if (isset($options['sticky_logo_upload']['url']) && $options['sticky_logo_upload']['url'] != '') {
echo '.sticky-header .sticky-logo{display:block;}
.sticky-header .nsticky-logo{display:none;}
.nsticky-logo{display:block;}
.sticky-logo{display:none;}';
}
if (isset($options['print_stylesheet']) && $options['print_stylesheet'] == 1) {
echo '@media print{
a[href]:after{content:""}
.site-header, .social-share-bar, .site-footer, .staff-item .social-icons-colored,
.fluid-width-video-wrapper, .social-icons-colored, .btn, .basic-link, .sidebar-widget,
.sermon-media-left, .sermon-media-content, .nav, .pagination, .sort-source, .action-buttons,
.event-list-item-actions, .listing-header, .breadcrumb-cont, .basic-link, .post-cats, .singleSound,
.visualAudible, .mejs-controls, .post-tags, .contact-form, .woocommerce-ordering,
.add_to_cart_button, .post-17 .post-media iframe, .cart, .comment-respond {
display:none;
}
.staff-item-name, .grid-content p {
margin-top:15px;
}
.list-group li:nth-child(3) {
padding:0px;
}
.sidebar-col {
padding:25px 10px;
}
.page-header{
height:auto!important;
min-height:none!important;
}
.title-subtitle-holder-inner{
text-align:left;
}
}';
}
if (isset($options['content_wide_width']) && $options['content_wide_width'] == 1) {
echo '.content .container{width:100%;}';
}
if (isset($options['mobile_menu_bg'])&&$options['mobile_menu_bg']['rgba'] != '') {
echo '@media only screen and (max-width: 992px) {.body .main-navigation{background:'.$options['mobile_menu_bg']['rgba'].';}}';
}
if (isset($options['mobile_menu_border'])&&$options['mobile_menu_border']['border-color'] != '') {
echo '@media only screen and (max-width: 992px) {.body .main-navigation > ul > li > ul li > a{border-bottom-width:'.$options['mobile_menu_border']['border-bottom'].';border-bottom-style:'.$options['mobile_menu_border']['border-style'].';border-bottom-color:'.$options['mobile_menu_border']['border-color'].';}.main-navigation ul{border-top-color:'.$options['mobile_menu_border']['border-color'].';}}';
}
if (isset($options['mobile_menu_color'])&&isset($options['mobile_menu_color']['regular'])&&$options['mobile_menu_color']['regular'] != '') {
echo '@media only screen and (max-width: 992px) {.body .main-navigation > ul > li > a, .main-navigation > ul > li > ul li > a{color:'.$options['mobile_menu_color']['regular'].'!important;}.body .main-navigation > ul > li a:hover, .main-navigation > ul > li > ul li > a:hover{color:'.$options['mobile_menu_color']['hover'].'!important;}.body .main-navigation > ul > li a:active, .main-navigation > ul > li > ul li > a:active{color:'.$options['mobile_menu_color']['active'].'!important;}}';
}
if ($flex_top != '') {
echo '.flex-caption{top:'.$flex_top.'%;}';
}
if ($flex_left != '') {
echo '.flex-caption{left:'.$flex_left.'%;}';
}
if ($flex_width != '') {
echo '.flex-caption{width:'.$flex_width.'px;}';
}
if ($custom_css) {
echo "\n" . '/*========== User Custom CSS Styles ==========*/' . "\n";
echo ''.$custom_css;
}
// CLOSE STYLE TAG
echo "</style>" . "\n";
}
add_action('wp_head', 'imic_custom_styles');
}
/* CUSTOM JS OUTPUT
================================================== */
if (!function_exists('imic_custom_script')) {
function imic_custom_script() {
$options = get_option('imic_options');
$custom_js = (isset($options['custom_js']))?$options['custom_js']:'';
if ($custom_js) {
echo'<script type ="text/javascript">';
echo ''.$custom_js;
echo '</script>';
}
}
add_action('wp_footer', 'imic_custom_script');
}
/* SHORTCODE FIX
================================================== */
if (!function_exists('imic_content_filter')) {
function imic_content_filter($content) {
// array of custom shortcodes requiring the fix
$block = join("|", array("imic_button", "icon", "iconbox", "imic_image", "anchor", "paragraph", "divider", "heading", "alert", "blockquote", "dropcap", "code", "label", "container", "spacer", "span", "one_full", "one_half", "one_third", "one_fourth", "one_sixth","two_third", "progress_bar", "imic_count", "imic_tooltip", "imic_video", "htable", "thead", "tbody", "trow", "thcol", "tcol", "pricing_table", "pt_column", "pt_package", "pt_button", "pt_details", "pt_price", "list", "list_item", "list_item_dt", "list_item_dd", "accordions", "accgroup", "acchead", "accbody", "toggles", "togglegroup", "togglehead", "togglebody", "tabs", "tabh", "tab", "tabc", "tabrow", "section", "page_first", "page_last", "page", "modal_box", "imic_form", "fullcalendar", "staff","fullscreenvideo"));
// opening tag
$rep = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/", "[$2$3]", $content);
// closing tag
$rep = preg_replace("/(<p>)?\[\/($block)](<\/p>|<br \/>)?/", "[/$2]", $rep);
return $rep;
}
add_filter("the_content", "imic_content_filter");
}
/* REGISTER SIDEBARS
================================================== */
if (!function_exists('imic_register_sidebars')) {
function imic_register_sidebars() {
if (function_exists('register_sidebar')) {
$options = get_option('imic_options');
$footer_class = (isset($options['footer_layout']))?$options['footer_layout']:'';
register_sidebar(array(
'name' => __('Home Page Sidebar', 'framework'),
'id' => 'main-sidebar',
'description' => '',
'class' => '',
'before_widget' => '<div id="%1$s" class="widget sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
register_sidebar(array(
'name' => __('Home Page Sidebar Second', 'framework'),
'id' => 'main-sidebar-2',
'description' => '',
'class' => '',
'before_widget' => '<div id="%1$s" class="widget sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
register_sidebar(array(
'name' => __('Contact Sidebar', 'framework'),
'id' => 'inner-sidebar',
'description' => '',
'class' => '',
'before_widget' => '<div id="%1$s" class="widget sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
register_sidebar(array(
'name' => __('Page Sidebar', 'framework'),
'id' => 'page-sidebar',
'description' => '',
'class' => '',
'before_widget' => '<div id="%1$s" class="widget sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
register_sidebar(array(
'name' => __('Events Sidebar', 'framework'),
'id' => 'events-sidebar',
'description' => '',
'class' => '',
'before_widget' => '<div id="%1$s" class="widget sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
register_sidebar(array(
'name' => __('Post Sidebar', 'framework'),
'id' => 'post-sidebar',
'description' => '',
'class' => '',
'before_widget' => '<div id="%1$s" class="widget sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
register_sidebar(array(
'name' => __('Product Sidebar', 'framework'),
'id' => 'product-sidebar',
'description' => '',
'class' => '',
'before_widget' => '<div id="%1$s" class="widget sidebar-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>'
));
register_sidebar(array(
'name' => __('Footer Widgets', 'framework'),
'id' => 'footer-sidebar',
'description' => '',
'class' => '',
'before_widget' => '<div class="col-md-'.$footer_class.' col-sm-'.$footer_class.' widget footer-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="footer-widget-title">',
'after_title' => '</h4>'
));
}
}
add_action('widgets_init', 'imic_register_sidebars', 35);
}
/* EVENT GRID FUNCTION
================================================== */
if (!function_exists('imic_event_grid')) {
function imic_event_grid() {
$options = get_option('imic_options');
$event_view = (isset($options['event_time_view']))?$options['event_time_view']:'';
$event_counter_view = (isset($options['event_countdown_position']))?$options['event_countdown_position']:'';
$output = '';
$output1 = '';
$currentEventTime = $_POST['date'];
$EventTerm = $_POST['term'];
$prev_month = adorechurch_date_localization('Y-m', strtotime('-1 month', strtotime($currentEventTime)));
$next_months = adorechurch_date_localization('Y-m', strtotime('+1 month', strtotime($currentEventTime)));
echo '<span class="month">'.esc_attr(adorechurch_date_localization('M',strtotime($currentEventTime))).'</span><span class="year">'.esc_attr(adorechurch_date_localization('Y',strtotime($currentEventTime))).'</span>';
echo '<a href="javascript:void(0)" rel="'.$EventTerm.'" class="upcomingEvents actions left" id="'.$prev_month.'"><i class="fa fa-angle-left"></i></a><a href="javascript:void(0)" rel="'.$EventTerm.'" class="upcomingEvents actions right" id="'.$next_months.'"><i class="fa fa-angle-right"></i></a><div id="load-next-events" class="load-events" style="display:none;"><img src="'.IMIC_THEME_PATH.'/assets/images/loader.gif"></div>~!';
$events = imic_recur_events($EventTerm,'',$EventTerm,$currentEventTime);
ksort($events);
if(!empty($events)) {
foreach($events as $key=>$value):
$date_converted=adorechurch_date_localization('Y-m-d',$key );
$custom_event_url= imic_query_arg($date_converted,$value);
$start_time = '23:59';
$start_time_meta = get_post_meta($value,'imic_event_start_dt',true);
if($start_time_meta!='') {
$start_time_meta = strtotime($start_time_meta);
$start_time = adorechurch_date_localization('G:i',$start_time_meta); }
$st_time = '';
$st_time = adorechurch_date_localization('Y-m-d',$key);
$st_time = strtotime($st_time.' '.$start_time);
$event_multiple_tickets = get_post_meta($value, 'adore_ticket_status', true);
$tickets_type1 = get_post_meta( $value, 'adore_event_type1', true );
$adore_event_ticket1 = get_post_meta( $value, 'adore_event_ticket1', true );
$adore_event_ticket1 = ($adore_event_ticket1<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket1;
$adore_event_booked1 = get_post_meta( $value, 'adore_event_booked1', true );
$adore_event_amount1 = get_post_meta( $value, 'adore_event_amount1', true );
$tickets_type2 = get_post_meta( $value, 'adore_event_type2', true );
$adore_event_ticket2 = get_post_meta( $value, 'adore_event_ticket2', true );
$adore_event_ticket2 = ($adore_event_ticket2<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket2;
$adore_event_booked2 = get_post_meta( $value, 'adore_event_booked2', true );
$adore_event_amount2 = get_post_meta( $value, 'adore_event_amount2', true );
$tickets_type3 = get_post_meta( $value, 'adore_event_type3', true );
$adore_event_ticket3 = get_post_meta( $value, 'adore_event_ticket3', true );
$adore_event_ticket3 = ($adore_event_ticket3<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket3;
$adore_event_booked3 = get_post_meta( $value, 'adore_event_booked3', true );
$adore_event_amount3 = get_post_meta( $value, 'adore_event_amount3', true );
$paypal_site = (isset($options['paypal_site']))?$options['paypal_site']:'';
$paypal_site = ($paypal_site==1)?"https://www.paypal.com/cgi-bin/webscr":"https://www.sandbox.paypal.com/cgi-bin/webscr";
if($event_counter_view==0)
{
$end_date_event = $key;
}
else
{
$end_time_meta = get_post_meta($value,'imic_event_end_dt',true);
$end_date_event = '';
if($end_time_meta!='')
{
$end_time_meta = strtotime($end_time_meta);
$end_time = adorechurch_date_localization('G:i',$end_time_meta);
}
$en_time = '';
$en_time = adorechurch_date_localization('Y-m-d',$key);
$end_date_event = strtotime($en_time.' '.$end_time);
}
$event_address = get_post_meta($value,'imic_event_address2',true);
$term_slug = get_the_terms($value, 'event-category');
echo '<li class=" event-list-item event-dynamic grid-item';
if (!empty($term_slug)) {
foreach ($term_slug as $term) {
echo ' '.$term->slug;
}
}
$st_event_date = get_post_meta($value, 'imic_event_start_dt', true);
$en_event_date = get_post_meta($value, 'imic_event_end_dt', true);
$st_event_str = strtotime($st_event_date);
$en_event_str = strtotime($en_event_date);
$event_diff = imic_dateDiff($st_event_date, $en_event_date);
echo '">';
?>
<div style="display:none">
<span class="event-multiple-tickets"><?php echo esc_attr($event_multiple_tickets); ?></span>
<span class="adore_event_type1"><?php echo esc_attr($tickets_type1); ?></span>
<span class="adore_event_ticket1"><?php echo esc_attr($adore_event_ticket1); ?></span>
<span class="adore_event_booked1"><?php echo esc_attr($adore_event_booked1); ?></span>
<span class="adore_event_amount1"><?php echo esc_attr($adore_event_amount1); ?></span>
<span class="adore_event_type2"><?php echo esc_attr($tickets_type2); ?></span>
<span class="adore_event_ticket2"><?php echo esc_attr($adore_event_ticket2); ?></span>
<span class="adore_event_booked2"><?php echo esc_attr($adore_event_booked2); ?></span>
<span class="adore_event_amount2"><?php echo esc_attr($adore_event_amount2); ?></span>
<span class="adore_event_type3"><?php echo esc_attr($tickets_type3); ?></span>
<span class="adore_event_ticket3"><?php echo esc_attr($adore_event_ticket3); ?></span>
<span class="adore_event_booked3"><?php echo esc_attr($adore_event_booked3); ?></span>
<span class="adore_event_amount3"><?php echo esc_attr($adore_event_amount3); ?></span>
<span class="adore_event_id"><?php echo esc_attr($value); ?></span>
<span class="adore_event_title"><?php echo esc_attr(get_the_title($value)); ?></span>
<span class="adore_event_url"><?php echo esc_url(add_query_arg('reg', 1, $custom_event_url)); ?></span>
<span class="adore_event_paypal"><?php echo esc_url($paypal_site); ?></span>
<span class="adore_event_cdate"><?php echo esc_attr($date_converted); ?></span>
</div>
<?php
echo '<div class="event-list-item-date">
<span class="event-date">
<span class="event-day">'.esc_attr(adorechurch_date_localization('d',$key)).'</span>
<span class="event-month">'.esc_attr(adorechurch_date_localization('M',$key)).', '. esc_attr(adorechurch_date_localization('y',$key)).'</span>
</span>
</div>
<div class="event-list-item-info">
<div class="lined-info">
<h4><a class="event-title" href="'.esc_url($custom_event_url).'" class="event-title">'.get_the_title($value).'</a></h4>
</div>
<div class="lined-info">';
if($event_diff>0) {
echo '<span class="meta-data"><i class="fa fa-clock-o"></i> '.esc_attr(adorechurch_date_localization(get_option('date_format').' '.get_option('time_format'), $st_event_str)).' - <span class="event-time">'.esc_attr(adorechurch_date_localization(get_option('date_format').' '.get_option('time_format'), $en_event_str)).'</span>';
}
else
{
if($event_view==0) {
echo '<span class="meta-data"><i class="fa fa-clock-o"></i> '.esc_attr(adorechurch_date_localization('l', $key)).', <span class="event-time">'. esc_attr(adorechurch_date_localization(get_option('time_format'), $st_time)); if($end_date_event!='') { echo ' - '.adorechurch_date_localization(get_option('time_format'), $end_date_event); } echo '</span> '; } else {
echo '<span class="meta-data"><i class="fa fa-clock-o"></i> '.esc_attr(adorechurch_date_localization('l', $key)).', <span class="event-time">'. esc_attr(adorechurch_date_localization(get_option('time_format'), $st_time)); echo '</span> '; }
}
if($key<adorechurch_date_localization('U')) { echo '<span class="label label-default">'.__('Passed','framework').'</span>'; } elseif(adorechurch_date_localization('U')>$st_time&&adorechurch_date_localization('U')<$key) { echo '<span class="label label-success">'.__('Going On','framework').'</span>'; } else { echo '<span class="label label-primary">'.__('Upcoming','framework').'</span>'; }
echo '</div>';
if($event_address!='') {
echo '<div class="lined-info event-location">
<span class="meta-data"><i class="fa fa-map-marker"></i> <span class="event-location-address">'.esc_attr($event_address).'</span></span>
</div>'; }
echo '</div>
<div class="event-list-item-actions">';
if($key>adorechurch_date_localization('U')) { $event_registration = get_post_meta($value,'imic_event_registration',true);
$event_custom_url = get_post_meta($value,'imic_custom_event_registration',true);
$event_custom_url_target = get_post_meta($value,'imic_custom_event_registration_target',true);
$event_registration = get_post_meta($value,'imic_event_registration',true);
if(!empty($event_custom_url)) {
$target = ($event_custom_url_target==1)?'_blank':'';
echo '<a href="'.$event_custom_url.'" class="btn btn-default btn-transparent" target="'.$target.'">'. __('Register','framework').' <i class="fa fa-sign-out"></i></a>';
} elseif($event_registration==1) {
echo '<a id="register-'.($value+2648).'|'.$key.'" href="#" class="btn btn-default btn-transparent event-tickets event-register-button">'. __('Register','framework').'</a>';
}}
echo '<ul class="action-buttons">';
if ($options['switch_sharing'] == 1 && $options['share_post_types']['3'] == '1') {
echo '<li title="Share event"><a href="#" data-trigger="focus" data-placement="top" data-content="" data-toggle="popover" data-original-title="Share Event" class="event-share-link"><i class="icon-share"></i></a></li>';
} $event_map = get_post_meta($value,'imic_event_address2',true);
$virtual_event = get_post_meta($value , 'imic_virtual_event', true);
if ($virtual_event == 0 || $virtual_event == ''){
if($event_map!='') {
$gmap_route = get_post_meta($value, 'imic_google_map_track', true);
if($gmap_route==0)
{ ?>
<li title="<?php _e('Get directions','framework'); ?>" class="hidden-xs"><a href="#" class="cover-overlay-trigger event-direction-link"><i class="icon-compass"></i></a></li><?php
}
else
{
echo '<li title="'.__('Get directions','framework').'" class="hidden-xs"><a href="https://www.google.com/maps/dir//'.$event_map.'" class="cover-overlay-trigger event-direction-link"><i class="icon-compass"></i></a></li>';
}
} } $event_contact_info = get_post_meta($value,'imic_event_manager',true); if($event_contact_info!='') {
echo '<li title="Contact event manager"><a id="contact-'.($value+2648).'|'.$key.'" href="#" data-toggle="modal" data-target="#Econtact" class="event-contact-link"><i class="icon-mail"></i></a></li>'; }
echo '</ul>
</div>
</li>';
endforeach;
}
else {
echo '<li class=" event-list-item event-dynamic grid-item"><div class="event-list-item-info">
<div class="lined-info">'.__('Sorry, there are no events for this month.', 'framework') . '</div></div></li>';
}
die();
}
add_action('wp_ajax_nopriv_imic_event_grid', 'imic_event_grid');
add_action('wp_ajax_imic_event_grid', 'imic_event_grid');
}
// get taxonomies terms links
if (!function_exists('imic_custom_taxonomies_terms_links')) {
function imic_custom_taxonomies_terms_links($id) {
global $post;
$out = '';
// get post by post id
$post = get_post($id);
// get post type by post
$post_type = $post->post_type;
// get post type taxonomies
$taxonomies = get_object_taxonomies($post_type);
foreach ($taxonomies as $taxonomy) {
// get the terms related to post
$terms = get_the_terms( $post->ID, $taxonomy );
if ( !empty( $terms ) ) {
foreach ( $terms as $term ){
$out = $term->name;
}
}
}
return $out;
}
}
//Manage Custom Columns for Event Post Type
if (!function_exists('imic_event_time_columns')) {
add_filter('manage_edit-event_columns', 'imic_event_time_columns');
function imic_event_time_columns($columns) {
$columns['Event'] = __('Event', 'framework');
//$columns['Recurring'] = __('Recurring', 'framework');
return $columns;
}
}
if (!function_exists('imic_event_time_column_content')) {
add_action('manage_event_posts_custom_column', 'imic_event_time_column_content', 10, 2);
function imic_event_time_column_content($column_name, $post_id) {
switch ($column_name) {
case 'Event':
$sdate = get_post_meta($post_id, 'imic_event_start_dt', true);
$stime = get_post_meta($post_id, 'imic_event_start_tm', true);
$edate = get_post_meta($post_id, 'imic_event_end_dt', true);
$etime = get_post_meta($post_id, 'imic_event_end_tm', true);
echo '<abbr title="'.$sdate .' '.$stime.'">'.$sdate.'</abbr><br title="'.$edate.' '.$etime.'">'.$edate;
break;
case 'Recurring':
$frequency = get_post_meta($post_id, 'imic_event_frequency', true);
$frequency_count = get_post_meta($post_id, 'imic_event_frequency_count', true);
if($frequency==1){ $sent = "Every Day"; }
elseif($frequency==2){ $sent = "Every 2nd Day"; }
elseif($frequency==3){ $sent = "Every 3rd Day"; }
elseif($frequency==4){ $sent = "Every 4th Day"; }
elseif($frequency==5){ $sent = "Every 5th Day"; }
elseif($frequency==6){ $sent = "Every 6th Day"; }
elseif($frequency==30){ $sent = "Every Month"; }
else{ $sent = "Every week"; }
if($frequency>0) {
echo '<abbr title="'.$sent .' '.$sent.'">'.$sent.'</abbr><br>'.$frequency_count.' time';
}
break;
}
}
}
if (!function_exists('imic_sortable_event_column')) {
add_filter('manage_edit-event_sortable_columns', 'imic_sortable_event_column');
function imic_sortable_event_column($columns) {
$columns['Event'] = 'event';
return $columns;
}
}
if (!function_exists('imic_dateDiff')) {
function imic_dateDiff($start, $end) {
$start_ts = strtotime($start);
$end_ts = strtotime($end);
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
}
//Event Recurring Date/Time
function imic_afterSavePost()
{
if(isset($_GET['post']))
{
$postId = $_GET['post'];
$post_type = get_post_type($postId);
if($post_type=='event')
{
$sdate = get_post_meta($postId,'imic_event_start_dt',true);
$end_event_date = get_post_meta($postId,'imic_event_end_dt',true);
if($end_event_date=='') { update_post_meta($postId,'imic_event_end_dt',$sdate); }
$frequency = get_post_meta($postId,'imic_event_frequency',true);
$frequency_count = get_post_meta($postId,'imic_event_frequency_count',true);
$value = strtotime($sdate);
if($frequency==30) {
$svalue = strtotime("+".$frequency_count." month", $value);
$suvalue = adorechurch_date_localization('Y-m-d',$svalue);
}
else {
$svalue = intval($frequency)*intval($frequency_count)*intval(86400);
$suvalue = intval($svalue)+intval($value);
$suvalue = adorechurch_date_localization('Y-m-d',$suvalue);
}
if(imic_dateDiff($sdate, $end_event_date)>0)
{
$suvalue = $end_event_date;
}
update_post_meta($postId,'imic_event_frequency_end',$suvalue);
}
}
}
imic_afterSavePost();
//Get All Post Types
if(!function_exists('imic_get_all_types')){
add_action( 'wp_loaded', 'imic_get_all_types');
function imic_get_all_types(){
$args = array(
'public' => true,
);
$output = 'names'; // names or objects, note names is the default
return $post_types = get_post_types($args, $output);
}
}
/* -------------------------------------------------------------------------------------
Get Cat List.
----------------------------------------------------------------------------------- */
if (!function_exists('imic_get_cat_list')) {
function imic_get_cat_list() {
$amp_categories_obj = get_categories('exclude=1');
$amp_categories = array();
if(count($amp_categories_obj)>0){
foreach ($amp_categories_obj as $amp_cat) {
$amp_categories[$amp_cat->cat_ID] = $amp_cat->name;
}}
return $amp_categories;
}
}
/* -------------------------------------------------------------------------------------
Filter the Widget Title.
----------------------------------------------------------------------------------- */
if (!function_exists('imic_widget_titles')) {
add_filter('dynamic_sidebar_params', 'imic_widget_titles', 20);
function imic_widget_titles(array $params) {
// $params will ordinarily be an array of 2 elements, we're only interested in the first element
$widget = & $params[0];
$id = $params[0]['id'];
if ($id == 'footer-sidebar') {
$widget['before_title'] = '<h4 class="widgettitle">';
$widget['after_title'] = '</h4>';
} else {
$widget['before_title'] = '<h3 class="widgettitle">';
$widget['after_title'] = '</h3>';
}
return $params;
}
}
/* -------------------------------------------------------------------------------------
Filter the Widget Text.
----------------------------------------------------------------------------------- */
add_filter('widget_text', 'do_shortcode');
/* -------------------------------------------------------------------------------------
Month Translate in Default.
----------------------------------------------------------------------------------- */
if(!function_exists('imic_month_translate')){
function imic_month_translate( $str ) {
$options = get_option('imic_options');
$months = (isset($options['calendar_month_name']))?$options['calendar_month_name']:'';
$months = explode(',',$months);
if(count($months)<=1){
$months = array("January","February","March","April","May","June","July","August","September","October","November","December");
}
$sb = array();
foreach($months as $month) { $sb[] = $month; }
$engMonth = array("January","February","March","April","May","June","July","August","September","October","November","December");
$trMonth = $sb;
$converted = str_replace($engMonth, $trMonth, $str);
return $converted;
}
/* -------------------------------------------------------------------------------------
Filter the Month name of Post.
----------------------------------------------------------------------------------- */
add_filter( 'get_the_time', 'imic_month_translate' );
add_filter( 'the_date', 'imic_month_translate' );
add_filter( 'get_the_date', 'imic_month_translate' );
add_filter( 'comments_number', 'imic_month_translate' );
add_filter( 'get_comment_date', 'imic_month_translate' );
add_filter( 'get_comment_time', 'imic_month_translate' );
add_filter( 'date_i18n', 'imic_month_translate' );
}
/* -------------------------------------------------------------------------------------
Short Month Translate in Default.
----------------------------------------------------------------------------------- */
if(!function_exists('imic_short_month_translate')){
function imic_short_month_translate( $str ) {
$options = get_option('imic_options');
$months = (isset($options['calendar_month_name_short']))?$options['calendar_month_name_short']:'';
$months = explode(',',$months);
if(count($months)<=1){
$months = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
}
$sb = array();
foreach($months as $month) { $sb[] = $month; }
$engMonth = array("/\bJan\b/","/\bFeb\b/","/\bMar\b/","/\bApr\b/","/\bMay\b/","/\bJun\b/","/\bJul\b/","/\bAug\b/","/\bSep\b/","/\bOct\b/","/\bNov\b/","/\bDec\b/");
$trMonth = $sb;
$converted = preg_replace($engMonth, $trMonth, $str);
return $converted;
}
/* -------------------------------------------------------------------------------------
Filter the Sort Month name of Post.
----------------------------------------------------------------------------------- */
add_filter( 'get_the_time', 'imic_short_month_translate' );
add_filter( 'the_date', 'imic_short_month_translate' );
add_filter( 'get_the_date', 'imic_short_month_translate' );
add_filter( 'comments_number', 'imic_short_month_translate' );
add_filter( 'get_comment_date', 'imic_short_month_translate' );
add_filter( 'get_comment_time', 'imic_short_month_translate' );
add_filter( 'date_i18n', 'imic_short_month_translate' );
}
if(!function_exists('imic_day_translate')){
function imic_day_translate( $str ) {
$options = get_option('imic_options');
$days = (isset($options['calendar_day_name'])) ? $options['calendar_day_name'] : '';
$days = explode(',',$days);
if(count($days)<=1){
$days = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
}
$sb = array();
foreach($days as $month) { $sb[] = $month; }
$engDay = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$trDay = $sb;
$converted = str_replace($engDay, $trDay, $str);
return $converted;
}
/* -------------------------------------------------------------------------------------
Filter the Day name of Post.
----------------------------------------------------------------------------------- */
add_filter('date_i18n', 'imic_day_translate');
}
/* -------------------------------------------------------------------------------------
RevSlider ShortCode
----------------------------------------------------------------------------------- */
if (!function_exists('imic_RevSliderShortCode')) {
function imic_RevSliderShortCode()
{
$slidernames = array();
if(class_exists('RevSlider')){
$sld = new RevSlider();
$sliders = $sld->getArrSliders();
if(!empty($sliders)){
foreach($sliders as $slider){
$title = $slider->title;
$slidernames[esc_attr($slider->id)] = $title;
}
}
}
return $slidernames;
}
}
/* -------------------------------------------------------------------------------------
Layer Slider ShortCode
----------------------------------------------------------------------------------- */
if(!function_exists('imic_layerslidershortcode')) {
function imic_layerslidershortcode() {
$layersliders = array();
if(class_exists('LS_Sliders')){
$filters = array('page' => 1, 'limit' => 100);
// Find sliders
$sliders = LS_Sliders::find($filters);
if(!empty($sliders)) :
foreach($sliders as $key => $item) :
$name = !empty($item['slug']) ? $item['slug'] : $item['id'];
$layersliders[$name]=$name;
endforeach;
endif;
}
return $layersliders;
}
}
/** -------------------------------------------------------------------------------------
* Add Query Arg
* @param ID,param1,param2 of current Post.
* @return Url with Query arg which is passed default is event_date.
----------------------------------------------------------------------------------- */
if(!function_exists('imic_query_arg')){
function imic_query_arg($date_converted,$id){
$custom_event_url= add_query_arg('event_date',$date_converted,get_permalink($id));
return $custom_event_url;
}
}
/** -------------------------------------------------------------------------------------
* Query Var Filter
* @description event_date parameter is added to query_vars filter
----------------------------------------------------------------------------------- */
if(!function_exists('imicAddQueryVarsFilter')){
function imicAddQueryVarsFilter( $vars ){
$vars[] = "event_date";
$vars[] = "event_cat";
$vars[] = "pg";
$vars[] = "speakers";
$vars[] = "reg";
$vars[] = "registrant";
$vars[] = "ticket";
return $vars;
}
add_filter('query_vars','imicAddQueryVarsFilter');
}
/** -------------------------------------------------------------------------------------
* Convert the Format String from php to fullcalender
* @see http://arshaw.com/fullcalendar/docs/utilities/formatDate/
* @param $format
----------------------------------------------------------------------------------- */
if(!function_exists('ImicConvertDate')){
function ImicConvertDate($format) {
$format_rules = array('a'=>'t',
'A'=>'T',
'B'=>'',
'c'=>'u',
'd'=>'dd',
'D'=>'ddd',
'F'=>'MMMM',
'g'=>'h',
'G'=>'H',
'h'=>'hh',
'H'=>'HH',
'i'=>'mm',
'I'=>'',
'j'=>'d',
'l'=>'dddd',
'L'=>'',
'm'=>'MM',
'M'=>'MMM',
'n'=>'M',
'O'=>'',
'r'=>'',
's'=>'ss',
'S'=>'S',
't'=>'',
'T'=>'',
'U'=>'',
'w'=>'',
'W'=>'',
'y'=>'yy',
'Y'=>'yyyy',
'z'=>'',
'Z'=>'');
$ret = '';
for ($i=0; $i<strlen($format); $i++) {
if (isset($format_rules[$format[$i]])) {
$ret .= $format_rules[$format[$i]];
} else {
$ret .= $format[$i];
}
}
return $ret;
}
}
/** -------------------------------------------------------------------------------------
* Return 0 if category have any post
----------------------------------------------------------------------------------- */
if(!function_exists('imic_cat_count_flag')){
function imic_cat_count_flag(){
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
$flag=1;
if(!empty($term)){
$flag= $output=($term->count==0)?0:1;
}
global $cat;
if(!empty($cat)){
$cat_data= get_category($cat);
$flag=($cat_data->count==0)?0:1;
}
return $flag;
}
}
if(!function_exists('imic_in_array_r'))
{
function imic_in_array_r($needle, $haystack, $strict = false) {
foreach ($haystack as $item) {
if (($strict ? $item === $needle : $item == $needle) || (is_array($item) && imic_in_array_r($needle, $item, $strict))) {
return true;
}
}
return false;
}
}
//Event Global Function
if (!function_exists('imic_recur_events')) {
function imic_recur_events($status,$featured="nos",$term='',$month='') {
$options = get_option('imic_options');
$show_event = (isset($options['event_countdown_position']))?$options['event_countdown_position']:'0';
$featured = ($featured=="yes")?"no":"nos";
$today = adorechurch_date_localization('Y-m-d');
if($month!="") {
$stop_date = $month;
$curr_month = adorechurch_date_localization('Y-m-t 23:59', strtotime('-1 month', strtotime($stop_date)));
$current_end_date = adorechurch_date_localization('Y-m-d H:i:s', strtotime($stop_date . ' + 1 day'));
$previous_month_end = strtotime(adorechurch_date_localization('Y-m-d 00:01', strtotime($stop_date)));
$next_month_start = strtotime(adorechurch_date_localization('Y-m-d 00:01', strtotime('+1 month', strtotime($stop_date))));
query_posts(array('post_type' => 'event','post_status' => 'publish','event-category' => $term,'meta_key' => 'imic_event_start_dt','meta_query' => array('relation' => 'AND',array('key' => 'imic_event_frequency_end','value' => $curr_month,'compare' => '>'),array('key' => 'imic_event_start_dt','value' => adorechurch_date_localization('Y-m-t 23:59', strtotime($stop_date)),'compare' => '<')),'orderby' => 'meta_value','order' => 'ASC','posts_per_page' => -1));
}
else {
if($status=='future') {
query_posts(array('post_type' => 'event','post_status' => 'publish', 'event-category'=>$term, 'meta_key' => 'imic_event_start_dt', 'meta_query' => array(array('key' => 'imic_event_frequency_end', 'value' => $today, 'compare' => '>='),array('key' => 'imic_featured_event', 'value' => $featured, 'compare' => '!=')), 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => -1)); }
else {
query_posts(array('post_type' => 'event','post_status' => 'publish', 'event-category'=>$term, 'meta_key' => 'imic_event_start_dt', 'meta_query' => array(array('key' => 'imic_featured_event', 'value' => $featured, 'compare' => '!=')), 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page' => -1));
}
}
$event_add = array();
$sinc = 1;
if (have_posts()):
while (have_posts()):the_post();
$eventDate = get_post_meta(get_the_ID(), 'imic_event_start_dt', true);
$frequency = get_post_meta(get_the_ID(), 'imic_event_frequency', true);
$frequency_count = get_post_meta(get_the_ID(), 'imic_event_frequency_count', true);
$frequency_active = get_post_meta(get_the_ID(),'imic_event_frequency_type',true);
$frequency_type = get_post_meta(get_the_ID(),'imic_event_frequency_type',true);
$frequency_month_day = get_post_meta(get_the_ID(),'imic_event_day_month',true);
$frequency_week_day = get_post_meta(get_the_ID(),'imic_event_week_day',true);
if ($frequency_active > 0)
{
$frequency_count = $frequency_count;
}
else
{
$frequency_count = 0;
}
$seconds = intval($frequency) * 86400;
$fr_repeat = 0;
$multiple_type = get_post_meta(get_the_ID(), 'imic_event_multiple_type', true);
$multiple_dates = get_post_meta(get_the_ID(), 'imic_event_multiple_dates', false);
if($multiple_type!=1)
{
while ($fr_repeat <= $frequency_count)
{
$eventDate = get_post_meta(get_the_ID(), 'imic_event_start_dt', true);
$eventEndDate = get_post_meta(get_the_ID(),'imic_event_end_dt',true);
$inc = '';
$eventEndDate = strtotime($eventEndDate);
$eventDate = strtotime($eventDate);
$diff_start = adorechurch_date_localization('Y-m-d',$eventDate);
$diff_end = adorechurch_date_localization('Y-m-d', $eventEndDate);
$days_extra = imic_dateDiff($diff_start, $diff_end);
if($days_extra>0)
{
$start_day = 0;
while($start_day<=$days_extra)
{
$diff_sec = 86400*intval($start_day);
$new_date = intval($eventDate)+intval($diff_sec);
$str_only_date = adorechurch_date_localization('Y-m-d',$new_date);
$en_only_time = adorechurch_date_localization("G:i", $eventEndDate);
$start_dt_tm = strtotime($str_only_date.' '.$en_only_time);
if($start_dt_tm>adorechurch_date_localization('U'))
{
$eventDate = $new_date;
break;
}
$start_day++;
}
}
if($days_extra<1)
{
if($frequency_type==1||$frequency_type==0)
{
if($frequency==30)
{
$eventDate = strtotime("+".$fr_repeat." month", $eventDate);
$eventEndDate = strtotime("+".$fr_repeat." month", $eventEndDate);
}
else
{
$new_date = intval($seconds) * intval($fr_repeat);
$eventDate = intval($eventDate) + intval($new_date);
$eventEndDate = intval($eventEndDate) + intval($new_date);
}
}
else
{
$eventTime = adorechurch_date_localization('G:i',$eventDate);
$eventDate = strtotime( adorechurch_date_localization('Y-m-01',$eventDate) );
if($fr_repeat==0)
{
$fr_repeat = intval($fr_repeat)+1;
}
$eventDate = strtotime("+".$fr_repeat." month", $eventDate);
$next_month = adorechurch_date_localization('F',$eventDate);
$next_event_year = adorechurch_date_localization('Y',$eventDate);
$eventDate = adorechurch_date_localization('Y-m-d '.$eventTime, strtotime($frequency_month_day.' '.$frequency_week_day.' of '.$next_month.' '.$next_event_year));
$eventDate = strtotime($eventDate);
}
}
$st_dt = adorechurch_date_localization('Y-m-d',$eventDate);
if($show_event==0)
{
$en_tm = adorechurch_date_localization("G:i",$eventEndDate);
}
else
{
$en_tm = adorechurch_date_localization("G:i",$eventDate);
}
$dt_tm = strtotime($st_dt.' '.$en_tm);
if(!imic_in_array_r(adorechurch_date_localization('Y-m-d', $eventDate), $multiple_dates))
{
if($month!='')
{
if(($dt_tm > $previous_month_end) && ($dt_tm < $next_month_start))
{
$total_sec = intval($dt_tm) + intval($sinc) + intval($inc);
$event_add[$total_sec] = get_the_ID();
$sinc++;
}
}
else
{
if($status=="future")
{
if ($dt_tm >= adorechurch_date_localization('U'))
{
$total_sec = intval($dt_tm) + intval($sinc) + intval($inc);
$event_add[$total_sec] = get_the_ID();
$sinc++;
}
}
else
{
if ($dt_tm <= adorechurch_date_localization('U'))
{
$total_sec = intval($dt_tm) + intval($sinc) + intval($inc);
$event_add[$total_sec] = get_the_ID();
$sinc++;
}
}
}
}
if($days_extra<1)
{
$fr_repeat++;
}
else
{
$fr_repeat = 1000000;
}
}
}
else
{
$multiple_dates_add = get_post_meta(get_the_ID(), 'imic_event_multiple_dates', true);
$eventDate = get_post_meta(get_the_ID(), 'imic_event_start_dt', true);
$eventEndDate = get_post_meta(get_the_ID(),'imic_event_end_dt',true);
$eventEndDate = strtotime($eventEndDate);
$eventDate = strtotime($eventDate);
if(!empty($multiple_dates_add))
{
foreach($multiple_dates_add as $add_date)
{
$full_date_st = strtotime($add_date.' '.adorechurch_date_localization('G:i', $eventDate));
$full_date_ls = strtotime($add_date.' '.adorechurch_date_localization('G:i', $eventEndDate));
if($status=="future")
{
if($show_event==0&&$full_date_ls>=adorechurch_date_localization('U'))
{
$event_add[$full_date_ls] = get_the_ID();
}
elseif($show_event==1&&$full_date_st>=adorechurch_date_localization('U'))
{
$event_add[$full_date_st] = get_the_ID();
}
}
else
{
if($show_event==0&&$full_date_ls<=adorechurch_date_localization('U'))
{
$event_add[$full_date_ls] = get_the_ID();
}
elseif($show_event==1&&$full_date_st<=adorechurch_date_localization('U'))
{
$event_add[$full_date_st] = get_the_ID();
}
}
}
}
}
endwhile;
endif; wp_reset_query();
return $event_add;
}
}
//Get all Sidebars
if (!function_exists('imic_get_all_sidebars')) {
function imic_get_all_sidebars() {
$all_sidebars = array();
global $wp_registered_sidebars;
$all_sidebars = array('' => '');
foreach ($wp_registered_sidebars as $sidebar) {
$all_sidebars[$sidebar['id']] = $sidebar['name'];
}
return $all_sidebars;
}
}
//Meta Box for Sidebar on all Posts/Page
if (!function_exists('imic_register_meta_box')) {
add_action('admin_init', 'imic_register_meta_box');
function imic_register_meta_box() {
// Check if plugin is activated or included in theme
if (!class_exists('RW_Meta_Box'))
return;
$prefix = 'imic_';
$meta_box = array(
'id' => 'template-sidebar1',
'title' => __("Select Sidebar", 'framework'),
'pages' => array('post', 'page', 'event', 'speaker', 'product', 'sermon'),
'context' => 'normal',
'fields' => array(
array(
'name' => 'Select Sidebar from list',
'id' => $prefix . 'select_sidebar_from_list',
'desc' => __("Select Sidebar from list, if using page builder then please add sidebar from element only.", 'framework'),
'type' => 'select',
'options' => imic_get_all_sidebars(),
),
array(
'name' => 'Show no sidebar',
'id' => $prefix . 'strict_no_sidebar',
'desc' => esc_html__("This will not dishonour page sidebar chosen at Theme Options as well.", 'framework'),
'type' => 'checkbox',
'default' => 0
),
array(
'name' => __('Columns Layout', 'framework'),
'id' => $prefix . 'sidebar_columns_layout',
'desc' => __("Select Columns Layout .", 'framework'),
'type' => 'select',
'options' => array(
'3' => __('One Fourth', 'framework'),
'4' => __('One Third','framework'),
'6' => __('Half','framework'),
),
'std' => 3,
),
array(
'name' => 'Select Sidebar Position',
'id' => $prefix . 'select_sidebar_position',
'desc' => __("Select Sidebar Postion", 'framework'),
'type' => 'radio',
'options' => array(
'2' => 'Left',
'1' => 'Right'
),
'default' => '1'
),
)
);
new RW_Meta_Box($meta_box);
}
}
//Attachment Meta Box
if(!function_exists('imic_attachment_url')){
function imic_attachment_url( $fields, $post ) {
$meta = get_post_meta($post->ID, 'meta_link', true);
$fields['meta_link'] = array(
'label' => __('Image URL','framework'),
'input' => 'text',
'value' => $meta,
'show_in_edit' => true,
);
return $fields;
}
add_filter( 'attachment_fields_to_edit', 'imic_attachment_url', 10, 2 );
}
/**
* Update custom field on save
*/
if(!function_exists('imic_update_attachment_url')){
function imic_update_attachment_url($attachment){
global $post;
update_post_meta($post->ID, 'meta_link', $attachment['attachments'][$post->ID]['meta_link']);
return $attachment;
}
add_filter( 'attachment_fields_to_save', 'imic_update_attachment_url', 4);
}
/**
* Update custom field via ajax
*/
if(!function_exists('imic_save_attachment_url')){
function imic_save_attachment_url() {
$post_id = $_POST['id'];
$meta = $_POST['attachments'][$post_id ]['meta_link'];
update_post_meta($post_id , 'meta_link', $meta);
clean_post_cache($post_id);
}
add_action('wp_ajax_save-attachment-compat', 'imic_save_attachment_url', 0, 1);
}
//Get Attachment details
if (!function_exists('imic_wp_get_attachment')) {
function imic_wp_get_attachment( $attachment_id ) {
$attachment = get_post( $attachment_id );
if(!empty($attachment)) {
return array(
'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
'caption' => $attachment->post_excerpt,
'description' => $attachment->post_content,
'href' => get_permalink( $attachment->ID ),
'src' => $attachment->guid,
'title' => $attachment->post_title,
'url' => $attachment->meta_link
); }
}
}
/** -------------------------------------------------------------------------------------
* Gallery Flexslider
* @param ID of current Post.
* @return Div with flexslider parameter.
----------------------------------------------------------------------------------- */
if (!function_exists('imic_gallery_flexslider')) {
function imic_gallery_flexslider($id) {
$speed = (get_post_meta(get_the_ID(), 'imic_gallery_slider_speed', true)!='')?get_post_meta(get_the_ID(), 'imic_gallery_slider_speed', true):5000;
$pagination = get_post_meta(get_the_ID(), 'imic_gallery_slider_pagination', true);
$auto_slide = get_post_meta(get_the_ID(), 'imic_gallery_slider_auto_slide', true);
$direction = get_post_meta(get_the_ID(), 'imic_gallery_slider_direction_arrows', true);
$effect = get_post_meta(get_the_ID(), 'imic_gallery_slider_effects', true);
$pagination = !empty($pagination) ? $pagination : 'yes';
$auto_slide = !empty($auto_slide) ? $auto_slide : 'yes';
$direction = !empty($direction) ? $direction : 'yes';
$effect = !empty($effect) ? $effect : 'slide';
return '<div class="flexslider galleryflex" data-autoplay="' . $auto_slide . '" data-pagination="' . $pagination . '" data-arrows="' . $direction . '" data-style="' . $effect . '" data-pause="yes" data-speed='.$speed.'>';
}
}
if (!function_exists('imic_social_staff_icon')) {
function imic_social_staff_icon() {
$output = '';
$staff_icons = get_post_meta(get_the_ID(), 'imic_social_icon_list', false);
if (!empty($staff_icons[0]) || get_post_meta(get_the_ID(), 'imic_staff_member_email', true) != '') {
$output.='<ul class="social-icons-colored">';
if (!empty($staff_icons[0])) {
foreach ($staff_icons[0] as $list => $values) {
if (!empty($values[1])) {
$className = preg_replace('/\s+/', '-', strtolower($values[0]));
$className = 'fa fa-' . $className;
$output.='<li class="'.$values[0].'"><a href="' . $values[1] . '" target ="_blank"><i class="' . $className . '"></i></a></li>';
}
}
}
if (get_post_meta(get_the_ID(), 'imic_staff_member_email', true) != '') {
$output.='<li class="email"><a href="mailto:' . get_post_meta(get_the_ID(), 'imic_staff_member_email', true) . '"><i class="fa fa-envelope"></i></a></li>';
}
if (get_post_meta(get_the_ID(), 'imic_staff_member_phone', true) != '') {
$output.='<li class="phone"><a href="tel:' . get_post_meta(get_the_ID(), 'imic_staff_member_phone', true) . '"><i class="fa fa-phone"></i></a></li>';
}
$output.='</ul>';
}
return $output;
}
}
//Event Status View Ajax Call
if (!function_exists('imic_event_status_view')) {
function imic_event_status_view() {
$options = get_option('imic_options');
$event_view = (isset($options['event_time_view']))?$options['event_time_view']:'';
$event_counter_view = (isset($options['event_countdown_position']))?$options['event_countdown_position']:'';
$status = $_POST['status'];
$status_number = explode("-",$status);
$status = $status_number[0];
$count = $status_number[1];
$term = $_POST['term'];
if($status == "future") {
$events = imic_recur_events('future','',$term,'');
echo '<span class="month">'.__('Events','framework').'</span><a href="javascript:" rel="'.$term.'" class="pastevents" id="past-'.$count.'"><span class="year">'.__('Past','framework').'</span></a><div id="load-next-events" class="load-events" style="display:none;"><img src="'. IMIC_THEME_PATH.'/assets/images/loader.gif"></div>~!';
ksort($events);
}
else {
$events = imic_recur_events('past','',$term,'');
echo '<span class="month">'.__('Events','framework').'</span><a href="javascript:" rel="'.$term.'" class="pastevents" id="future-'.$count.'"><span class="year">'.__('Future','framework').'</span></a><div id="load-next-events" class="load-events" style="display:none;"><img src="'. IMIC_THEME_PATH.'/assets/images/loader.gif"></div>~!';
krsort($events);
}
if(!empty($events)) {
$total = 1;
foreach($events as $key=>$value):
$date_converted=adorechurch_date_localization('Y-m-d',$key );
$custom_event_url= imic_query_arg($date_converted,$value);
$start_time = '23:59';
$start_time_meta = get_post_meta($value,'imic_event_start_dt',true);
if($start_time_meta!='') {
$start_time_meta = strtotime($start_time_meta);
$start_time = adorechurch_date_localization('G:i',$start_time_meta); }
$st_time = '';
$st_time = adorechurch_date_localization('Y-m-d',$key);
$st_time = strtotime($st_time.' '.$start_time);
if($event_counter_view==0)
{
$end_date_event = $key;
}
else
{
$end_time_meta = get_post_meta($value,'imic_event_end_dt',true);
$end_date_event = '';
if($end_time_meta!='') {
$end_time_meta = strtotime($end_time_meta);
$end_time = adorechurch_date_localization('G:i',$end_time_meta); }
$en_time = '';
$en_time = adorechurch_date_localization('Y-m-d',$key);
$end_date_event = strtotime($en_time.' '.$end_time);
}
$event_address = get_post_meta($value,'imic_event_address2',true);
$term_slug = get_the_terms($value, 'event-category');
$event_multiple_tickets = get_post_meta($value, 'adore_ticket_status', true);
$tickets_type1 = get_post_meta( $value, 'adore_event_type1', true );
$adore_event_ticket1 = get_post_meta( $value, 'adore_event_ticket1', true );
$adore_event_ticket1 = ($adore_event_ticket1<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket1;
$adore_event_booked1 = get_post_meta( $value, 'adore_event_booked1', true );
$adore_event_amount1 = get_post_meta( $value, 'adore_event_amount1', true );
$tickets_type2 = get_post_meta( $value, 'adore_event_type2', true );
$adore_event_ticket2 = get_post_meta( $value, 'adore_event_ticket2', true );
$adore_event_ticket2 = ($adore_event_ticket2<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket2;
$adore_event_booked2 = get_post_meta( $value, 'adore_event_booked2', true );
$adore_event_amount2 = get_post_meta( $value, 'adore_event_amount2', true );
$tickets_type3 = get_post_meta( $value, 'adore_event_type3', true );
$adore_event_ticket3 = get_post_meta( $value, 'adore_event_ticket3', true );
$adore_event_ticket3 = ($adore_event_ticket3<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket3;
$adore_event_booked3 = get_post_meta( $value, 'adore_event_booked3', true );
$adore_event_amount3 = get_post_meta( $value, 'adore_event_amount3', true );
$paypal_site = (isset($options['paypal_site']))?$options['paypal_site']:'';
$paypal_site = ($paypal_site==1)?"https://www.paypal.com/cgi-bin/webscr":"https://www.sandbox.paypal.com/cgi-bin/webscr";
echo '<li class=" event-list-item event-dynamic grid-item';
if (!empty($term_slug)) {
foreach ($term_slug as $term) {
echo ' '.$term->slug;
}
}
$st_event_date = get_post_meta($value, 'imic_event_start_dt', true);
$en_event_date = get_post_meta($value, 'imic_event_end_dt', true);
$st_event_str = strtotime($st_event_date);
$en_event_str = strtotime($en_event_date);
$event_diff = imic_dateDiff($st_event_date, $en_event_date);
echo '">';
?>
<div style="display:none">
<span class="event-multiple-tickets"><?php echo esc_attr($event_multiple_tickets); ?></span>
<span class="adore_event_type1"><?php echo esc_attr($tickets_type1); ?></span>
<span class="adore_event_ticket1"><?php echo esc_attr($adore_event_ticket1); ?></span>
<span class="adore_event_booked1"><?php echo esc_attr($adore_event_booked1); ?></span>
<span class="adore_event_amount1"><?php echo esc_attr($adore_event_amount1); ?></span>
<span class="adore_event_type2"><?php echo esc_attr($tickets_type2); ?></span>
<span class="adore_event_ticket2"><?php echo esc_attr($adore_event_ticket2); ?></span>
<span class="adore_event_booked2"><?php echo esc_attr($adore_event_booked2); ?></span>
<span class="adore_event_amount2"><?php echo esc_attr($adore_event_amount2); ?></span>
<span class="adore_event_type3"><?php echo esc_attr($tickets_type3); ?></span>
<span class="adore_event_ticket3"><?php echo esc_attr($adore_event_ticket3); ?></span>
<span class="adore_event_booked3"><?php echo esc_attr($adore_event_booked3); ?></span>
<span class="adore_event_amount3"><?php echo esc_attr($adore_event_amount3); ?></span>
<span class="adore_event_id"><?php echo esc_attr($value); ?></span>
<span class="adore_event_title"><?php echo esc_attr(get_the_title($value)); ?></span>
<span class="adore_event_url"><?php echo esc_url(add_query_arg('reg', 1, $custom_event_url)); ?></span>
<span class="adore_event_paypal"><?php echo esc_url($paypal_site); ?></span>
<span class="adore_event_cdate"><?php echo esc_attr($date_converted); ?></span>
</div>
<?php
echo '<div class="event-list-item-date">
<span class="event-date">
<span class="event-day">'.esc_attr(adorechurch_date_localization('d',$key)).'</span>
<span class="event-month">'.esc_attr(adorechurch_date_localization('M',$key)).', '. esc_attr(adorechurch_date_localization('y',$key)).'</span>
</span>
</div>
<div class="event-list-item-info">
<div class="lined-info">
<h4><a class="event-title" href="'.esc_url($custom_event_url).'" class="event-title">'.get_the_title($value).'</a></h4>
</div>
<div class="lined-info">';
if($event_diff>0) {
echo '<span class="meta-data"><i class="fa fa-clock-o"></i> '.esc_attr(adorechurch_date_localization(get_option('date_format').' '.get_option('time_format'), $st_event_str)).' - <span class="event-time">'.esc_attr(adorechurch_date_localization(get_option('date_format').' '.get_option('time_format'), $en_event_str)).'</span> ';
}
else
{
if($event_view==0) {
echo '<span class="meta-data"><i class="fa fa-clock-o"></i> '.esc_attr(adorechurch_date_localization('l', $key)).', <span class="event-time">'. esc_attr(adorechurch_date_localization(get_option('time_format'), $st_time)); if($end_date_event!='') { echo ' - '.adorechurch_date_localization(get_option('time_format'), $end_date_event); } echo '</span> ';
} else {
echo '<span class="meta-data"><i class="fa fa-clock-o"></i> '.esc_attr(adorechurch_date_localization('l', $key)).', <span class="event-time">'. esc_attr(adorechurch_date_localization(get_option('time_format'), $st_time)); echo '</span> ';
}
}
if($key<adorechurch_date_localization('U')) {
echo '<span class="label label-default">'.__('Passed','framework').'</span>';
} elseif(adorechurch_date_localization('U')>$st_time&&adorechurch_date_localization('U')<$key) {
echo '<span class="label label-success">'.__('Going On','framework').'</span>';
} else {
echo '<span class="label label-primary">'.__('Upcoming','framework').'</span>';
}
echo '</div>';
if($event_address!='') {
echo '<div class="lined-info event-location">
<span class="meta-data"><i class="fa fa-map-marker"></i> <span class="event-location-address">'.$event_address.'</span></span>
</div>';
}
echo '</div>
<div class="event-list-item-actions">';
if($key>adorechurch_date_localization('U')) { $event_registration = get_post_meta($value,'imic_event_registration',true);
$event_custom_url = get_post_meta($value,'imic_custom_event_registration',true);
$event_custom_url_target = get_post_meta($value,'imic_custom_event_registration_target',true);
$event_registration = get_post_meta($value,'imic_event_registration',true);
if(!empty($event_custom_url)) {
$target = ($event_custom_url_target==1)?'_blank':'';
echo '<a href="'.$event_custom_url.'" class="btn btn-default btn-transparent" target="'.$target.'">'. __('Register','framework').' <i class="fa fa-sign-out"></i></a>';
} elseif($event_registration==1) {
echo '<a id="register-'.($value+2648).'|'.$key.'" href="#" class="btn btn-default btn-transparent event-tickets event-register-button">'. __('Register','framework').'</a>';
}
}
echo '<ul class="action-buttons">';
if ($options['switch_sharing'] == 1 && $options['share_post_types']['3'] == '1') {
echo '<li title="Share event"><a href="#" data-trigger="focus" data-placement="top" data-content="" data-toggle="popover" data-original-title="Share Event" class="event-share-link"><i class="icon-share"></i></a></li>';
}
$event_map = get_post_meta($value,'imic_event_address2',true);
$virtual_event = get_post_meta($value , 'imic_virtual_event', true);
if ($virtual_event == 0 || $virtual_event == ''){
if($event_map!='') {
$gmap_route = get_post_meta($value, 'imic_google_map_track', true);
if($gmap_route==0)
{ ?>
<li title="<?php _e('Get directions','framework'); ?>" class="hidden-xs"><a href="#" class="cover-overlay-trigger event-direction-link"><i class="icon-compass"></i></a></li>
<?php }
else
{
echo '<li title="'.__('Get directions','framework').'" class="hidden-xs"><a target="_blank" href="https://www.google.com/maps/dir//'.$event_map.'" class=""><i class="icon-compass"></i></a></li>';
}
}
}
$event_contact_info = get_post_meta($value,'imic_event_manager',true);
if($event_contact_info!='') {
echo '<li title="Contact event manager"><a id="contact-'.($value+2648).'|'.$key.'" href="#" data-toggle="modal" data-target="#Econtact" class="event-contact-link"><i class="icon-mail"></i></a></li>';
}
echo '</ul>
</div>
</li>';
if($total++>=$count) { break; } endforeach; }
else {
echo '<li class=" event-list-item event-dynamic grid-item"><div class="event-list-item-info">
<div class="lined-info">'.__('Sorry, there are no past events.', 'framework') . '</div></div></li>';
}
die();
}
add_action('wp_ajax_nopriv_imic_event_status_view', 'imic_event_status_view');
add_action('wp_ajax_imic_event_status_view', 'imic_event_status_view');
}
//Fetch Youtube Video ID
if(!function_exists('imic_linkifyYouTubeURLs'))
{
function imic_linkifyYouTubeURLs($text) {
$text = preg_replace('~
# Match non-linked youtube URL in the wild. (Rev:20130823)
https?:// # Required scheme. Either http or https.
(?:[0-9A-Z-]+\.)? # Optional subdomain.
(?: # Group host alternatives.
youtu\.be/ # Either youtu.be,
| youtube # or youtube.com or
(?:-nocookie)? # youtube-nocookie.com
\.com # followed by
\S* # Allow anything up to VIDEO_ID,
[^\w\s-] # but char before ID is non-ID char.
) # End host alternatives.
([\w-]{11}) # $1: VIDEO_ID is exactly 11 chars.
(?=[^\w-]|$) # Assert next char is non-ID or EOS.
(?! # Assert URL is not pre-linked.
[?=&+%\w.-]* # Allow URL (query) remainder.
(?: # Group pre-linked alternatives.
[\'"][^<>]*> # Either inside a start tag,
| </a> # or inside <a> element text contents.
) # End recognized pre-linked alts.
) # End negative lookahead assertion.
[?=&+%\w.-]* # Consume any URL (query) remainder.
~ix',
'$1',
$text);
return $text;
}
}
/* VIDEO EMBED FUNCTIONS
================================================== */
if (!function_exists('imic_video_embed')) {
function imic_video_embed($url, $width = 500, $height = 300) {
if (strpos($url, 'youtube') || strpos($url, 'youtu.be')) {
return imic_video_youtube($url, $width, $height);
} else {
return imic_video_vimeo($url, $width, $height);
}
}
}
/* Video Youtube
================================================== */
if (!function_exists('imic_video_youtube')) {
function imic_video_youtube($url, $width = 560, $height = 315) {
if($url!='') {
$video_id = imic_linkifyYouTubeURLs($url);
return '<iframe itemprop="video" src="//www.youtube.com/embed/' . $video_id . '?wmode=transparent&autoplay=0" width="' . $width . '" height="' . $height . '" ></iframe>';
}
}
}
/* Video Vimeo
================================================== */
if (!function_exists('imic_video_vimeo')) {
function imic_video_vimeo($url, $width = 500, $height = 281) {
if($url!='') {
preg_match('/https?:\/\/vimeo.com\/(\d+)$/', $url, $video_id);
return '<iframe src="//player.vimeo.com/video/' . $video_id[1] . '?title=0&byline=0&autoplay=0&portrait=0" width="' . $width . '" height="' . $height . '" allowfullscreen></iframe>'; }
}
}
//
add_filter( 'get_terms_orderby', 'imic_orderby_include', 10, 2 );
function imic_orderby_include( $orderby, $args ) {
if ( isset( $args['orderby'] ) && 'include' == $args['orderby'] ) {
$include = implode(',', array_map( 'absint', $args['include'] ));
$orderby = "FIELD( t.term_id, $include )";
}
return $orderby;
}
/**
* IMIC SHARE BUTTONS
*/
if(!function_exists('imic_share_buttons')){
function imic_share_buttons(){
$posttitle = get_the_title();
$postpermalink = get_permalink();
$posttype = get_post_type(get_the_ID());
if ($posttype == 'event'){
$date = get_query_var('event_date');
if(empty($date)){
$date= get_post_meta(get_the_ID(),'imic_event_start_dt',true);
}
$date = strtotime($date);
$date = adorechurch_date_localization('Y-m-d',$date);
$postpermalink = esc_url(imic_query_arg($date,get_the_ID()));
}
$postexcerpt = get_the_excerpt();
$options = get_option('imic_options');
$facebook_share_alt = (isset($options['facebook_share_alt']))?$options['facebook_share_alt']:'';
$twitter_share_alt = (isset($options['twitter_share_alt']))?$options['twitter_share_alt']:'';
$google_share_alt = (isset($options['facebook_share_alt']))?$options['facebook_share_alt']:'';
$tumblr_share_alt = (isset($options['tumblr_share_alt']))?$options['tumblr_share_alt']:'';
$pinterest_share_alt = (isset($options['pinterest_share_alt']))?$options['pinterest_share_alt']:'';
$reddit_share_alt = (isset($options['reddit_share_alt']))?$options['reddit_share_alt']:'';
$linkedin_share_alt = (isset($options['linkedin_share_alt']))?$options['linkedin_share_alt']:'';
$email_share_alt = (isset($options['email_share_alt']))?$options['email_share_alt']:'';
$vk_share_alt = (isset($options['vk_share_alt']))?$options['vk_share_alt']:'';
echo '<div class="social-share-bar">';
if (isset($options['sharing_style']) && $options['sharing_style'] == '0') {
if (isset($options['sharing_color']) && $options['sharing_color'] == '0') {
echo '<h4><i class="fa fa-share-alt"></i> '.__('Share','framework').'</h4>';
echo '<ul class="social-icons-colored">';
}elseif (isset($options['sharing_color']) && $options['sharing_color'] == '1') {
echo '<h4><i class="fa fa-share-alt"></i> '.__('Share','framework').'</h4>';
echo '<ul class="social-icons-colored share-buttons-tc">';
}elseif (isset($options['sharing_color']) && $options['sharing_color'] == '2') {
echo '<h4><i class="fa fa-share-alt"></i> '.__('Share','framework').'</h4>';
echo '<ul class="social-icons-colored share-buttons-gs">';
}
} elseif (isset($options['sharing_style']) && $options['sharing_style'] == '1') {
if (isset($options['sharing_color']) && $options['sharing_color'] == '0') {
echo '<h4><i class="fa fa-share-alt"></i> '.__('Share','framework').'</h4>';
echo '<ul class="social-icons-colored share-buttons-squared">';
}elseif (isset($options['sharing_color']) && $options['sharing_color'] == '1') {
echo '<h4><i class="fa fa-share-alt"></i> '.__('Share','framework').'</h4>';
echo '<ul class="social-icons-colored share-buttons-tc share-buttons-squared">';
}elseif (isset($options['sharing_color']) && $options['sharing_color'] == '2') {
echo '<h4><i class="fa fa-share-alt"></i> '.__('Share','framework').'</h4>';
echo '<ul class="social-icons-colored share-buttons-gs share-buttons-squared">';
}
};
echo '<li class="share-title"></li>';
if (isset($options['share_icon']) && $options['share_icon']['1'] == '1') {
echo '<li class="facebook-share"><a href="https://www.facebook.com/sharer/sharer.php?u=' . $postpermalink . '&t=' . $posttitle . '" target="_blank" title="' . $facebook_share_alt . '"><i class="fa fa-facebook"></i></a></li>';
}
if (isset($options['share_icon']) && $options['share_icon']['2'] == '1') {
echo '<li class="twitter-share"><a href="https://twitter.com/intent/tweet?source=' . $postpermalink . '&text=' . $posttitle . ':' . $postpermalink . '" target="_blank" title="' . $twitter_share_alt . '"><i class="fa fa-twitter"></i></a></li>';
}
if (isset($options['share_icon']) && $options['share_icon']['3'] == '1') {
echo '<li class="google-share"><a href="https://plus.google.com/share?url=' . $postpermalink . '" target="_blank" title="' . $google_share_alt . '"><i class="fa fa-google-plus"></i></a></li>';
}
if (isset($options['share_icon']) && $options['share_icon']['4'] == '1') {
echo '<li class="tumblr-share"><a href="http://www.tumblr.com/share?v=3&u=' . $postpermalink . '&t=' . $posttitle . '&s=" target="_blank" title="' . $tumblr_share_alt . '"><i class="fa fa-tumblr"></i></a></li>';
}
if (isset($options['share_icon']) && $options['share_icon']['5'] == '1') {
echo '<li class="pinterest-share"><a href="http://pinterest.com/pin/create/button/?url=' . $postpermalink . '&description=' . $postexcerpt . '" target="_blank" title="' . $pinterest_share_alt . '"><i class="fa fa-pinterest"></i></a></li>';
}
if (isset($options['share_icon']) && $options['share_icon']['6'] == '1') {
echo '<li class="reddit-share"><a href="http://www.reddit.com/submit?url=' . $postpermalink . '&title=' . $posttitle . '" target="_blank" title="' . $reddit_share_alt . '"><i class="fa fa-reddit"></i></a></li>';
}
if (isset($options['share_icon']) && $options['share_icon']['7'] == '1') {
echo '<li class="linkedin-share"><a href="http://www.linkedin.com/shareArticle?mini=true&url=' . $postpermalink . '&title=' . $posttitle . '&summary=' . $postexcerpt . '&source=' . $postpermalink . '" target="_blank" title="' . $linkedin_share_alt . '"><i class="fa fa-linkedin"></i></a></li>';
}
if (isset($options['share_icon']) && $options['share_icon']['8'] == '1') {
echo '<li class="email-share"><a href="mailto:?subject=' . $posttitle . '&body=' . $postexcerpt . ':' . $postpermalink . '" target="_blank" title="' . $email_share_alt . '"><i class="fa fa-envelope"></i></a></li>';
}
if (isset($options['share_icon']) && $options['share_icon']['9'] == '1') {
echo '<li class="vk-share"><a href="http://vk.com/share.php?url=' . $postpermalink . '" target="_blank" title="' . $vk_share_alt . '"><i class="fa fa-vk"></i></a></li>';
}
echo '</ul></div>';
}
}
/*======================
Change Excerpt Length*/
if (!function_exists('imic_custom_excerpt_length')) {
function imic_custom_excerpt_length( $length ) {
return 520;
}
add_filter( 'excerpt_length', 'imic_custom_excerpt_length', 999 );
}
//Event Preview function for Calendar
if (!function_exists('imic_get_event_details')) {
function imic_get_event_details() {
$options = get_option('imic_options');
$id = $_POST['id'];
$data = explode("|",$id);
$id = $data[0];
$key = $data[1];
$output = '';
$custom_event_url = '';
$date_converted=adorechurch_date_localization('Y-m-d',$key );
$start_time = '23:59';
$start_time_meta = get_post_meta($id,'imic_event_start_dt',true);
if($start_time_meta!='') {
$start_time_meta = strtotime($start_time_meta);
$start_time = adorechurch_date_localization('G:i',$start_time_meta); }
$st_time = '';
$st_time = adorechurch_date_localization('Y-m-d',$key);
$st_time = strtotime($st_time.' '.$start_time);
$custom_event_url= imic_query_arg($date_converted,$id);
$event_multiple_tickets = get_post_meta($id, 'adore_ticket_status', true);
$tickets_type1 = get_post_meta( $id, 'adore_event_type1', true );
$adore_event_ticket1 = get_post_meta( $id, 'adore_event_ticket1', true );
$adore_event_ticket1 = ($adore_event_ticket1<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket1;
$adore_event_booked1 = get_post_meta( $id, 'adore_event_booked1', true );
$adore_event_amount1 = get_post_meta( $id, 'adore_event_amount1', true );
$tickets_type2 = get_post_meta( $id, 'adore_event_type2', true );
$adore_event_ticket2 = get_post_meta( $id, 'adore_event_ticket2', true );
$adore_event_ticket2 = ($adore_event_ticket2<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket2;
$adore_event_booked2 = get_post_meta( $id, 'adore_event_booked2', true );
$adore_event_amount2 = get_post_meta( $id, 'adore_event_amount2', true );
$tickets_type3 = get_post_meta( $id, 'adore_event_type3', true );
$adore_event_ticket3 = get_post_meta( $id, 'adore_event_ticket3', true );
$adore_event_ticket3 = ($adore_event_ticket3<=0)?esc_html__('All Booked', 'framework'):$adore_event_ticket3;
$adore_event_booked3 = get_post_meta( $id, 'adore_event_booked3', true );
$adore_event_amount3 = get_post_meta( $id, 'adore_event_amount3', true );
$paypal_site = (isset($options['paypal_site']))?$options['paypal_site']:'';
$paypal_site = ($paypal_site==1)?"https://www.paypal.com/cgi-bin/webscr":"https://www.sandbox.paypal.com/cgi-bin/webscr";
$output .= '<ul class=" sort-destination events-ajax-caller">';
$output .= '<li class="event-item event-dynamic">';
$output .= '<div style="display:none">
<span class="event-multiple-tickets">'.esc_attr($event_multiple_tickets).'</span>
<span class="adore_event_type1">'.esc_attr($tickets_type1).'</span>
<span class="adore_event_ticket1">'.esc_attr($adore_event_ticket1).'</span>
<span class="adore_event_booked1">'.esc_attr($adore_event_booked1).'</span>
<span class="adore_event_amount1">'.esc_attr($adore_event_amount1).'</span>
<span class="adore_event_type2">'.esc_attr($tickets_type2).'</span>
<span class="adore_event_ticket2">'.esc_attr($adore_event_ticket2).'</span>
<span class="adore_event_booked2">'.esc_attr($adore_event_booked2).'</span>
<span class="adore_event_amount2">'.esc_attr($adore_event_amount2).'</span>
<span class="adore_event_type3">'.esc_attr($tickets_type3).'</span>
<span class="adore_event_ticket3">'.esc_attr($adore_event_ticket3).'</span>
<span class="adore_event_booked3">'.esc_attr($adore_event_booked3).'</span>
<span class="adore_event_amount3">'.esc_attr($adore_event_amount3).'</span>
<span class="adore_event_id">'.esc_attr($id).'</span>
<span class="adore_event_title">'.esc_attr(get_the_title($id)).'</span>
<span class="adore_event_url">'.esc_url(add_query_arg('reg', 1, $custom_event_url)).'</span>
<span class="adore_event_paypal">'.esc_url($paypal_site).'</span>
<span class="adore_event_cdate">'.esc_attr($date_converted).'</span>
</div>';
$output .= '<div class="grid-item-inner">';
$output .= '<div class="preview-event-bar">
<div id="counter" class="counter-preview top-header" data-date="'.$key.'">
<div class="timer-col"> <span id="days"></span> <span class="timer-type">'.__('d','framework').'</span> </div>
<div class="timer-col"> <span id="hours"></span> <span class="timer-type">'.__('h','framework').'</span> </div>
<div class="timer-col"> <span id="minutes"></span> <span class="timer-type">'.__('m','framework').'</span> </div>
<div class="timer-col"> <span id="seconds"></span> <span class="timer-type">'.__('s','framework').'</span> </div>
</div>
</div>';
$event_address = get_post_meta($id,'imic_event_address2',true);
if ( '' != get_the_post_thumbnail($id) ) {
$output .= '<a href="'.esc_url($custom_event_url).'" class="media-box">'.get_the_post_thumbnail($id,'full').'</a>'; }
$output .= '<div id="load-preview-events" class="load-events" style="display:none;"><img src="'.IMIC_THEME_PATH.'/assets/images/loader.gif"></div>';
$output .= '<div class="grid-content">';
$output .= '<h3><a class="event-title" href="'.esc_url($custom_event_url).'">'.get_the_title($id).'</a></h3>';
$address1 = get_post_meta($id,'imic_event_address1',true);
$address2 = get_post_meta($id,'imic_event_address2',true);
$output .= '<span class="meta-data"><i class="fa fa-calendar"></i> <span class="event-date">'.esc_attr(adorechurch_date_localization(get_option('date_format'),$key)).'</span>'.__(' at ','framework').'<span class="event-time">'.adorechurch_date_localization(get_option('time_format'), $st_time).'</span></span>';
if($event_address!='') {
$output .= '<span class="meta-data event-location-address"><i class="fa fa-map-marker"></i> '.$event_address.'</span>'; }
$output .= '</div>';
$output .= '<div class="grid-footer clearfix">';
if($key>adorechurch_date_localization('U')) {
$event_registration = get_post_meta($id,'imic_event_registration',true);
$event_custom_url = get_post_meta($id,'imic_custom_event_registration',true);
$event_custom_url_target = get_post_meta($id,'imic_custom_event_registration_target',true);
$event_registration = get_post_meta($id,'adore_ticket_status',true);
if(!empty($event_custom_url)) {
$target = ($event_custom_url_target==1)?'_blank':'';
$output .= '<a href="'.$event_custom_url.'" class="btn btn-default btn-transparent" target="'.$target.'">'. __('Register','framework').' <i class="fa fa-sign-out"></i></a>';
} elseif($event_registration==1) {
$output .= '<a id="register-'.($id+2648).'|'.$key.'" href="#" class="pull-right btn btn-sm btn-primary btn-sm event-tickets event-register-button">'. __('Register','framework').'</a>';
}
}
$output .= '<ul class="action-buttons">';
if ($options['switch_sharing'] == 1 && $options['share_post_types']['3'] == '1') {
$output .= '<li title="Share event"><a href="#" data-trigger="focus" data-placement="right" data-content="" data-toggle="popover" data-original-title="Share Event" class="event-share-link"><i class="icon-share"></i></a></li>'; }
$event_map = get_post_meta($id,'imic_event_address2',true);
$virtual_event = get_post_meta($id , 'imic_virtual_event', true);
if ($virtual_event == 0 || $virtual_event == ''){
if($event_map!='') {
$gmap_route = get_post_meta($id, 'imic_google_map_track', true);
if($gmap_route==0)
{
$output .= '<li title="'.__('Get directions','framework').'" class="hidden-xs"><a href="#" class="cover-overlay-trigger event-direction-link"><i class="icon-compass"></i></a></li>';
}
else
{
$output .= '<li title="'.__('Get directions','framework').'" class="hidden-xs"><a target="_blank" href="https://www.google.com/maps/dir//'.$event_map.'" class=""><i class="icon-compass"></i></a></li>';
}
}
}
$event_contact_info = get_post_meta($id,'imic_event_manager',true); if($event_contact_info!='') {
$output .= '<li title="Contact event manager"><a id="contact-'.($id+2648).'|'.$key.'" href="#" data-toggle="modal" data-target="#Econtact" class="event-contact-link"><i class="icon-mail"></i></a></li>'; }
$output .= '</ul></div>';
$output .= '</div></div></li></ul>';
echo ''.$output;
die();
}
add_action('wp_ajax_nopriv_imic_get_event_details', 'imic_get_event_details');
add_action('wp_ajax_imic_get_event_details', 'imic_get_event_details');
}
/**
* IMIC SEARCH BUTTON
*/
if(!function_exists('imic_search_button_header')){
function imic_search_button_header(){
echo '<div class="search-module hidden-xs">
<a href="#" class="search-module-trigger"><i class="fa fa-search"></i></a>
<div class="search-module-opened">
<form method="get" id="searchform" action="' .home_url('/').'/">
<div class="input-group input-group-sm">
<input type="text" name="s" id="s" class="form-control">
<span class="input-group-btn"><button name ="submit" type="submit" class="btn btn-primary"><i class="fa fa-search"></i></button></span>
</div>
</form>
</div>
</div>';
}
}
/**
* IMIC CART BUTTON
*/
if(!function_exists('imic_cart_button_header')){
function imic_cart_button_header(){
global $woocommerce;
if(class_exists('Woocommerce')):
if(!$woocommerce->cart->cart_contents_count): ?>
<div class="cart-module hidden-xs">
<a href="<?php echo get_permalink(get_option('woocommerce_cart_page_id')); ?>" class="cart-module-trigger"><i class="fa fa-shopping-cart"></i></a>
</div>
<?php else: ?>
<div class="cart-module hidden-xs">
<a href="#" class="cart-module-trigger" id="cart-module-trigger"><i class="fa fa-shopping-cart"></i><span class="cart-tquant"><?php echo sprintf(_n('%d', '%d', $woocommerce->cart->cart_contents_count, 'framework'), $woocommerce->cart->cart_contents_count);?></span></a>
<div class="cart-module-opened">
<ul class="cart-module-items">
<?php
$count = 1;
foreach($woocommerce->cart->cart_contents as $cart_item): ?>
<li>
<a href="<?php echo get_permalink($cart_item['product_id']); ?>">
<?php $thumbnail_id = ($cart_item['variation_id']) ? $cart_item['variation_id'] : $cart_item['product_id']; ?>
<?php echo get_the_post_thumbnail($thumbnail_id, 'theme-small-thumb'); ?>
<span class="cart-module-item-name"><?php echo ''.$cart_item['data']->post->post_title; ?></span>
<span class="cart-module-item-quantity"><?php echo ''.$cart_item['quantity']; ?> x <?php echo ''.$woocommerce->cart->get_product_subtotal($cart_item['data'], 1); ?></span>
</a>
</li>
<?php if ($count++ > 2){break;} endforeach; ?>
</ul>
<div class="cart-module-footer">
<a href="<?php echo get_permalink(get_option('woocommerce_cart_page_id')); ?>" class="basic-link"><i class="fa fa-long-arrow-left"></i> <?php _e('View full cart', 'framework'); ?></a>
<a href="<?php echo get_permalink(get_option('woocommerce_checkout_page_id')); ?>" class="basic-link"><?php _e('Checkout', 'framework'); ?> <i class="fa fa-long-arrow-right"></i></a>
</div>
</div>
</div>
<?php endif;
endif;
}
}
/**
* IMIC SIDEBAR POSITION
*/
if(!function_exists('imic_sidebar_position_module')){
function imic_sidebar_position_module(){
$sidebar_position = get_post_meta(get_the_ID(),'imic_select_sidebar_position',true);
if($sidebar_position == 2){
echo ' <style type="text/css">#content-col, #sidebar-col{float:right!important;}</style>';
} elseif($sidebar_position == 1){
echo ' <style type="text/css">#content-col, #sidebar-col{float:left!important;}</style>';
}
}
}
/* Custom Excerpt Function */
function content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
//bbpress LocalHost Access
/* add_filter( 'bbp_verify_nonce_request_url', 'my_bbp_verify_nonce_request_url', 999, 1 );
function my_bbp_verify_nonce_request_url( $requested_url )
{
return 'http://localhost:8888' . $_SERVER['REQUEST_URI'];
} */
/* GET TEMPLATE URL
================================================*/
if(!function_exists('imic_get_template_url')) {
function imic_get_template_url($TEMPLATE_NAME){
$url;
$pages = query_posts(array(
'post_type' =>'page',
'meta_key' =>'_wp_page_template',
'meta_value'=> $TEMPLATE_NAME
));
$url = null;
if(isset($pages[0])) {
$url = get_page_link($pages[0]->ID);
}
wp_reset_query();
return $url;
}
}
/** remove redux menu under the tools **/
add_action( 'admin_menu', 'remove_redux_menu',12 );
function remove_redux_menu() {
remove_submenu_page('tools.php','redux-about');
}
/**
* Returns the timezone string for a site, even if it's set to a UTC offset
*
* Adapted from http://www.php.net/manual/en/function.timezone-name-from-abbr.php#89155
*
* @return string valid PHP timezone string
*/
function wp_get_timezone_string() {
// if site timezone string exists, return it
if ( $timezone = get_option( 'timezone_string' ) )
return $timezone;
// get UTC offset, if it isn't set then return UTC
if ( 0 === ( $utc_offset = get_option( 'gmt_offset', 0 ) ) )
return 'UTC';
// adjust UTC offset from hours to seconds
$utc_offset *= 3600;
// attempt to guess the timezone string from the UTC offset
if ( $timezone = timezone_name_from_abbr( '', $utc_offset, 0 ) ) {
return $timezone;
}
// last try, guess timezone string manually
$is_dst = adorechurch_date_localization( 'I' );
foreach ( timezone_abbreviations_list() as $abbr ) {
foreach ( $abbr as $city ) {
if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset )
return $city['timezone_id'];
}
}
// fallback to UTC
return 'UTC';
}
if(!function_exists('adore_remove_registrant'))
{
function adore_remove_registrant()
{
$registrant_id = (isset($_POST['registrant_id']))?$_POST['registrant_id']:'';
if($registrant_id!='')
{
$registrants = explode('-', $registrant_id);
wp_delete_post($registrants[1]);
}
die();
}
add_action('wp_ajax_nopriv_adore_remove_registrant', 'adore_remove_registrant');
add_action('wp_ajax_adore_remove_registrant', 'adore_remove_registrant');
}
/* Removing Redux framework pages */
if(!function_exists('imic_remove_redux_menu'))
{
add_action( 'admin_menu', 'imic_remove_redux_menu',12 );
function imic_remove_redux_menu() {
remove_submenu_page('tools.php','redux-about');
}
}
$default_attribs = array('data-skin' => array(),'data-layout' => array(),'value' => array(),'name' => array(),'action' => array(),'method' => array(),'type' => array(),'placeholder' => array(),'data-padding' => array(),'data-margin' => array(),'data-autoplay-timeout' => array(),'data-loop' => array(),'data-rtl' => array(),'data-auto-height' => array(),'data-displayinput' => array(), 'data-readonly' => array(), 'value' => array(), 'data-fgcolor' => array(), 'data-bgcolor' => array(), 'data-thickness' => array(), 'data-linecap' => array(), 'data-option-value' => array(), 'data-style' => array(), 'data-pause' => array(), 'data-speed' => array(), 'data-option-key' => array(), 'data-sort-id' => array(),'href' => array(),'rel' => array(),'data-appear-progress-animation' => array(),'data-appear-animation-delay' => array(), 'target' => array('_blank','_self','_top'), 'data-items-mobile' => array(), 'data-items-tablet' => array(), 'data-items-desktop-small' => array(), 'data-items-desktop' => array(), 'data-single-item' => array(), 'data-arrows' => array(), 'data-pagination' => array(), 'data-autoplay' => array(), 'data-columns' => array(), 'data-columns-tab' => array(), 'data-columns-mobile' => array(), 'width' => array(), 'data-srcset' => array(), 'height' => array(), 'src' => array(), 'id' => array(), 'class' => array(), 'title' => array(), 'style' => array(), 'alt' => array(), 'data' => array(), 'data-mce-id' => array(), 'data-mce-style' => array(), 'data-mce-bogus' => array(), 'data' => array());
$framework_allowed_tags = array(
'div' => $default_attribs,
'span' => $default_attribs,
'p' => $default_attribs,
'a' => $default_attribs,
'u' => $default_attribs,
'i' => $default_attribs,
'q' => $default_attribs,
'b' => $default_attribs,
'ul' => $default_attribs,
'ol' => $default_attribs,
'li' => $default_attribs,
'br' => $default_attribs,
'hr' => $default_attribs,
'strong' => $default_attribs,
'blockquote' => $default_attribs,
'del' => $default_attribs,
'strike' => $default_attribs,
'em' => $default_attribs,
'code' => $default_attribs,
'h1' => $default_attribs,
'h2' => $default_attribs,
'h3' => $default_attribs,
'h4' => $default_attribs,
'h5' => $default_attribs,
'h6' => $default_attribs,
'cite' => $default_attribs,
'img' => $default_attribs,
'section' => $default_attribs,
'iframe' => $default_attribs,
'input' => $default_attribs,
'label' => $default_attribs,
'canvas' => $default_attribs,
'form' => $default_attribs,
'sub' => $default_attribs,
'sup' => $default_attribs,
'audio' => $default_attribs,
'video' => $default_attribs,
'object' => $default_attribs,
'param' => $default_attribs,
'figure' => $default_attribs,
);
function adorechurch_date_localization($format = "Y-m-d H:i:s", $timestamp = null, $timezone = null){
$timestamp_with_offset = ($timestamp)?$timestamp:false;
$gmt = ($timezone)?$timezone:false;
return date_i18n($format, $timestamp_with_offset, $gmt);
global $wp_version;
if ( version_compare( $wp_version, '5.3', '>=' ) ) {
return wp_date($format, $timestamp, $timezone);
}
else{
$timestamp_with_offset = ($timestamp)?$timestamp:false;
$gmt = ($timezone)?$timezone:false;
return date_i18n($format, $timestamp_with_offset, $gmt);
}
}
function disallowed_admin_pages()
{
global $pagenow;
if ($pagenow == 'admin.php') {
$domain = preg_replace( '|https?://([^/]+)|', '$1', home_url() );
$localhost = false;
if ( parse_url( home_url() , PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
$localhost = true;
}
if (!$localhost && (!empty($_REQUEST['page']) && $_REQUEST['page'] == '_options' || !empty($_REQUEST['page']) && $_REQUEST['page'] == 'imi-admin-demo-importer')) {
if (empty(get_option('nativechurch_authenticate'))) {
wp_safe_redirect(admin_url('/admin.php?page=imi-admin-welcome'));
exit;
}
}
}
}
add_action('admin_init', 'disallowed_admin_pages');
function processAuthentication()
{
$status = $_REQUEST['status'];
$authCode = $_REQUEST['authCode'];
update_option('nativechurch_authenticate', $status);
update_option('nativechurch_auth_code', $authCode);
wp_die();
}
add_action('wp_ajax_processAuthentication', 'processAuthentication');
function welcomePageElement()
{
if(!empty($_GET['page']) && $_GET['page'] == 'imi-admin-welcome'){
$purchaseCode = $purchaseCodeRaw = $showRegisterForm = "";
$showUnRegisterForm = ' style="display: none;"';
if(!empty(get_option('nativechurch_auth_code'))) {
$purchaseCode = "xxxxxx-xxxx-xxxxxxx-xxxxx".substr(get_option('nativechurch_auth_code'), -4);
$purchaseCodeRaw = get_option('nativechurch_auth_code');
$showRegisterForm = ' style="display: none;"';
$showUnRegisterForm = "";
}
?>
<div class="nativechurch-validation-steps" style="display: none;">
<div class="imi-box-content" <?php echo ''.$showUnRegisterForm; ?>>
<h3 style="color: green; text-align: left">Theme is registered</h3>
</div>
<div class="imi-box-content" <?php echo ''.$showRegisterForm; ?>>
<h3 style="color: red; text-align: left">Please register your theme purchase code</h3>
</div>
<div class="imi-box-content">
<form class="imi_val" <?php echo ''.$showRegisterForm; ?>>
<label for="imi_purchase_code"><?php esc_html_e('Purchase Code: ','framework') ?></label>
<input type="text" value="" class="native-purchase-code">
<input type="hidden" value="<?php echo urlencode(site_url()); ?>" class="native-verified-dm">
<input type="hidden" value="<?php echo esc_url($_SERVER['REMOTE_ADDR']); ?>" class="native-server-type">
<input type="submit" value="Register">
<div class="native-message"></div>
</form>
<form class="imi_vals" <?php echo ''.$showUnRegisterForm; ?>>
<label for="imi_purchase_code"><?php esc_html_e('Purchase Code: ','framework') ?></label>
<input type="text" class="native-hidden-code" value="<?php echo esc_attr($purchaseCode); ?>">
<input type="hidden" value="<?php echo urlencode(site_url()) ?>" class="native-verified-dm">
<input type="hidden" value="<?php echo esc_url($_SERVER['REMOTE_ADDR']); ?>" class="native-server-type">
<input type="hidden" value="<?php echo esc_attr($purchaseCodeRaw); ?>" class="native-purchase-code">
<input type="submit" value="Unregister">
<p><small>Unregister the purchase code to use it on any other domain/website.</small></p>
<div class="native-message"></div>
</form>
<div <?php echo ''.$showUnRegisterForm; ?>>
<div class="imi-button">
<a href="<?php echo esc_url(get_admin_url()); ?>admin.php?page=envato-market#settings">Setup theme auto updates</a>
</div>
</div>
<div <?php echo ''.$showRegisterForm; ?>>
<h3><?php _e( 'Instructions for registering your purchase code', 'framework' ); ?></h3>
<p>Whenever you purchase an item via the ThemeForest, they will provide you with a purchase code for each item purchased. The purchase code is used for purchase validation for use of the item and also so that you can access theme support.</p>
<ol>
<li>Log in to ThemeForest with your Envato account.</li>
<li>Navigate to the Downloads tab. Your all purchases and items appear in this page.</li>
<li>Locate your item, and click the Download button.</li>
<li>Choose between License Certificate & Purchase Code (PDF) or License Certificate & Purchase Code (Text).</li>
<li>Open the file to find the purchase code.</li>
</ol>
<p><a href="https://www.youtube.com/watch?v=yTScONNFnZ8" target="_blank">See instructions video</a></p>
</div>
</div>
</div>
<?php
}
}
add_action('admin_init', 'welcomePageElement');
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists