Server : nginx/1.20.1 System : Linux ccpf-production-2021 5.4.0-148-generic #165-Ubuntu SMP Tue Apr 18 08:53:12 UTC 2023 x86_64 User : forge ( 1000) PHP Version : 7.4.21 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, Directory : /home/forge/gcc-ccpf.com/wp-content/themes/labora/ |
<?php
/**
* register and enqueue scripts.
*/
if ( ! function_exists( 'labora_theme_enqueue_scripts' ) ) {
function labora_theme_enqueue_scripts() {
$labora_theme_data = wp_get_theme();
$labora_theme_version = $labora_theme_data->get( 'Version' );
global $post;
// Enqueue scripts.
wp_enqueue_script( 'hoverintent', LABORA_THEME_JS . '/hoverIntent.js',array( 'jquery' ),'', true );
wp_enqueue_script( 'superfish', LABORA_THEME_JS . '/superfish.js',array( 'jquery' ),'',true );
if ( is_singular( 'gallery' ) || ( is_a( $post, 'WP_Post' ) && has_shortcode( $post->post_content, 'gallery' ) ) || is_page_template( 'template-blog.php' ) ) {
wp_enqueue_script( 'prettyphoto', LABORA_THEME_JS . '/jquery.prettyPhoto.js','','',true );
wp_enqueue_style( 'prettyPhoto', LABORA_THEME_CSS . '/prettyPhoto.css', array(), $labora_theme_version, false );
}
wp_enqueue_script( 'labora-customjs', LABORA_THEME_JS . '/labora-custom.js', array( 'jquery' ), $labora_theme_version , true );
// AJAX URL
$labora_data['ajaxurl'] = admin_url( 'admin-ajax.php' );
// HOME URL
$labora_data['home_url'] = get_home_url();
// Directory URI
$labora_data['directory_uri'] = get_template_directory_uri();
// Pass data to javascript
$labora_params = array(
'l10n_print_after' => 'labora_localize_script_param = ' . wp_json_encode( $labora_data ) . ';',
);
wp_localize_script( 'jquery', 'labora_localize_script_param', $labora_params );
// Enqueue styles.
wp_enqueue_style( 'labora-theme', get_stylesheet_uri() );
wp_enqueue_style( 'font-awesome', LABORA_THEME_CSS . '/fontawesome/css/font-awesome.min.css' );
wp_enqueue_style( 'style-custom', LABORA_THEME_CSS . '/style-custom.css' );
wp_enqueue_style( 'labora-responsive', LABORA_THEME_CSS . '/responsive.css');
}
add_action('wp_enqueue_scripts','labora_theme_enqueue_scripts');
}
/* Enqueue comment-reply.js for Threaded Comments
*/
function labora_enqueue_comments_reply() {
if ( get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'comment_form_before', 'labora_enqueue_comments_reply' );
/**
* Flex Slider Enqueue Scripts
*/
if ( ! function_exists( 'labora_flexslider_enqueue_scripts' ) ) {
add_action( 'labora_theme_flexslider','labora_flexslider_enqueue_scripts' );
function labora_flexslider_enqueue_scripts() {
$fs_slidespeed = get_option( 'labora_flexslidespeed' ) ? get_option( 'labora_flexslidespeed' ) : '3000';
$fs_slideeffect = get_option( 'labora_flexslideeffect' ) ? get_option( 'labora_flexslideeffect' ) : 'fade';
$fs_slidednav = get_option( 'labora_flexslidednav' ) ? get_option( 'labora_flexslidednav' ) : 'true';
$flexslider_args = array(
'slideeffect' => $fs_slideeffect,
'slidespeed' => $fs_slidespeed,
'slidednav' => $fs_slidednav,
);
wp_enqueue_script( 'flexslider', LABORA_THEME_JS . '/jquery.flexslider-min.js', array( 'jquery' ), '', true );
wp_localize_script( 'flexslider', 'flexslider_args', $flexslider_args );
wp_enqueue_style( 'flexslider-style', LABORA_THEME_CSS . '/flexslider.css' );
}
}
/*
* Theme functions for common usage
*/
require_once( get_template_directory() . '/theme-functions.php' );
// Post Likes
require_once( get_template_directory() . '/framework/common/iva-post-like.php' );
/* Importer */
require_once( get_template_directory() . '/framework/admin/options-importer/ob-import-export.php' );
/**
* Labora_Theme_Functions class.
*/
if ( ! class_exists( 'Labora_Theme_Functions' ) ) {
class Labora_Theme_Functions
{
public $labora_meta_box;
public function __construct() {
$this->labora_theme_constants();
$this->labora_theme_support();
$this->labora_theme_admin_scripts();
$this->labora_theme_admin_interface();
$this->labora_theme_custom_widgets();
$this->labora_theme_custom_meta();
$this->labora_theme_meta_generator();
$this->labora_theme_extras();
}
function labora_theme_constants() {
/**
* Set the file path based on whether the Options
* Framework is in a parent theme or child theme
* Directory Structure
*/
define( 'LABORA_FRAMEWORK', '2.0' );
define( 'LABORA_THEME_NAME', 'Labora' );
define( 'LABORA_THEME_URI', get_template_directory_uri() );
define( 'LABORA_THEME_DIR', get_template_directory() );
define( 'LABORA_THEME_JS', LABORA_THEME_URI . '/js' );
define( 'LABORA_THEME_CSS', LABORA_THEME_URI . '/css' );
define( 'LABORA_FRAMEWORK_DIR', LABORA_THEME_DIR . '/framework/' );
define( 'LABORA_FRAMEWORK_URI', LABORA_THEME_URI . '/framework/' );
define( 'LABORA_ADMIN_URI', LABORA_FRAMEWORK_URI . 'admin' );
define( 'LABORA_ADMIN_DIR', LABORA_FRAMEWORK_DIR . 'admin' );
define( 'LABORA_THEME_WIDGETS', LABORA_FRAMEWORK_DIR . 'widgets/' );
define( 'LABORA_THEME_CUSTOM_META', LABORA_FRAMEWORK_DIR . 'custom-meta/' );
}
/**
* allows a theme to register its support of a certain features
*/
function labora_theme_support() {
add_theme_support( 'post-formats', array(
'aside',
'audio',
'link',
'image',
'gallery',
'quote',
'status',
'video',
'event',
));
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'editor-style.css' );
add_theme_support( 'title-tag' );
add_theme_support( 'menus' );
// register menu.
register_nav_menus( array(
'primary-menu' => esc_html__( 'Primary Menu', 'labora' ),
));
// define content width.
if ( ! isset( $content_width ) ) {
$content_width = 1100;
}
}
/**
* scripts and styles enqueue .
*/
function labora_theme_admin_scripts() {
require_once( LABORA_FRAMEWORK_DIR . 'common/admin-scripts.php' );
}
/**
* admin interface .
*/
function labora_theme_admin_interface() {
require_once( LABORA_FRAMEWORK_DIR . 'common/iva-googlefont.php' );
require_once( LABORA_FRAMEWORK_DIR . 'admin/admin-interface.php' );
require_once( LABORA_FRAMEWORK_DIR . 'admin/theme-options.php' );
}
/**
* widgets .
*/
function labora_theme_custom_widgets() {
require_once( LABORA_THEME_WIDGETS . '/register-widget.php' );
require_once( LABORA_THEME_WIDGETS . '/iva-wg-contactinfo.php' );
require_once( LABORA_THEME_WIDGETS . '/iva-wg-sociable.php' );
require_once( LABORA_THEME_WIDGETS . '/iva-wg-recentpost.php' );
require_once( LABORA_THEME_WIDGETS . '/iva-wg-icon-box.php' );
require_once( LABORA_THEME_WIDGETS . '/iva-wg-button.php' );
}
/** load meta generator templates
* @files slider, Menus, page, posts,
*/
function labora_theme_custom_meta() {
require_once( LABORA_THEME_CUSTOM_META . '/page-meta.php' );
require_once( LABORA_THEME_CUSTOM_META . '/post-meta.php' );
require_once( LABORA_THEME_CUSTOM_META . '/slider-meta.php' );
require_once( LABORA_THEME_CUSTOM_META . '/testimonial-meta.php' );
require_once( LABORA_THEME_CUSTOM_META . '/gallery-meta.php' );
}
function labora_theme_meta_generator() {
require_once( LABORA_THEME_CUSTOM_META . '/meta-generator.php' );
}
/**
* theme functions
* @uses skin generator
* @uses pagination
* @uses sociables
* @uses Aqua imageresize // Credits : http://aquagraphite.com/
* @uses plugin activation class
*/
function labora_theme_extras() {
require_once( LABORA_THEME_DIR . '/css/skin.php' );
require_once( LABORA_FRAMEWORK_DIR . 'includes/mega-menu.php' );
require_once( LABORA_FRAMEWORK_DIR . 'common/iva-generator.php' );
require_once( LABORA_FRAMEWORK_DIR . 'includes/image-resize.php' );
require_once( LABORA_FRAMEWORK_DIR . 'includes/class-activation.php' );
}
/**
* custom switch case for fetching
* posts, post-types, custom-taxonomies, tags
*/
function labora_get_vars( $type ) {
$labora_tax_options = array();
switch ( $type ) {
/**
* get page titles.
*/
case 'pages':
$labora_get_pages = get_pages( 'sort_column=post_parent,menu_order' );
if ( ! empty( $labora_get_pages ) && ! is_wp_error( $labora_get_pages ) ) {
foreach ( $labora_get_pages as $page ) {
$labora_tax_options[ $page->ID ] = $page->post_title;
}
}
break;
/**
* get slider slug and name.
*/
case 'slider':
$labora_slider_cats = get_terms( 'slider_cat', 'orderby=name&hide_empty=0' );
if ( ! empty( $labora_slider_cats ) && ! is_wp_error( $labora_slider_cats ) ) {
foreach ( $labora_slider_cats as $slider ) {
$labora_tax_options[ $slider->slug ] = $slider->name;
}
}
break;
/**
* get posts slug and name.
*/
case 'posts':
$labora_post_cats = get_categories( 'hide_empty=0' );
if ( ! empty( $labora_post_cats ) && ! is_wp_error( $labora_post_cats ) ) {
foreach ( $labora_post_cats as $cat ) {
$labora_tax_options[ $cat->slug ] = $cat->name;
}
}
break;
/**
* get categories slug and name.
*/
case 'categories':
$labora_post_cats = get_categories( 'hide_empty=true' );
if ( ! empty( $labora_post_cats ) && ! is_wp_error( $labora_post_cats ) ) {
foreach ( $labora_post_cats as $cat ) {
$labora_tax_options[ $cat->term_id ] = $cat->name;
}
}
break;
/**
* get taxonomy tags.
*/
case 'tags':
$labora_tags = get_tags(array(
'taxonomy' => 'post_tag',
));
if ( ! empty( $labora_tags ) && ! is_wp_error( $labora_tags ) ) {
foreach ( $labora_tags as $tags ) {
$labora_tax_options[ $tags->slug ] = $tags->name;
}
}
break;
/**
* slider arrays for theme options.
*/
case 'slider_type':
$labora_tax_options = array(
'' => esc_html__( 'Select Slider', 'labora' ),
'flexslider' => esc_html__( 'Flex Slider', 'labora' ),
'static_image' => esc_html__( 'Static Image', 'labora' ),
'customslider' => esc_html__( 'Custom Slider', 'labora' ),
);
break;
}
return $labora_tax_options;
}
}
}
/**
* Defines Template directory path for seminar directory
*/
define( 'LABORA_URI', get_template_directory_uri() . '/labora-niche/' );
define( 'LABORA_DIR', get_template_directory() . '/labora-niche/' );
if ( ! defined( 'LABORA_NICHE_DIR' ) ) {
define( 'LABORA_NICHE_DIR', get_template_directory() . '/labora-niche/' );
}
if ( defined( 'LABORA_NICHE_DIR' ) ) {
require_once( LABORA_NICHE_DIR . 'index.php' );
add_action( 'after_setup_theme', 'labora_theme_setup' );
} else {
$labora_theme_ob = new Labora_Theme_Functions();
add_action( 'after_setup_theme', 'labora_theme_setup' );
}
if ( ! function_exists( 'labora_theme_setup' ) ) {
function labora_theme_setup() {
load_theme_textdomain( 'labora', get_template_directory() . '/languages' );
add_filter( 'posts_where', 'labora_multi_tax_terms' );
// This theme uses its own gallery styles.
add_filter( 'use_default_gallery_style', '__return_false' );
add_image_size( 'labora-image-350x204-croped', 350, 204, true );
add_image_size( 'labora-image-350x250-croped', 350, 250, true );
add_image_size( 'labora-image-1110x550-croped', 1110, 550, true );
add_image_size( 'labora-image-50x50-croped', 50, 50, true );
add_image_size( 'labora-image-255x182-croped', 255, 182, true );
add_image_size( 'labora-image-350x195-croped', 350, 195, true );
}
add_action( 'after_setup_theme', 'labora_theme_setup' );
}
/**
* function labora_custom_login_logo
*/
if ( ! function_exists( 'labora_custom_login_logo' ) ) {
add_action( 'login_head', 'labora_custom_login_logo' );
function labora_custom_login_logo() {
if ( get_option( 'labora_admin_logo' ) ) {
echo '<style type="text/css">.login h1 a { background-image:url(' . esc_url( get_option( 'labora_admin_logo' ) ) . ') !important; }</style>';
}
}
}
/**
* generates the html pingback head tag
* @return string the pingback head tag
*/
if ( ! function_exists( 'labora_set_pingback_tag' ) ) {
function labora_set_pingback_tag( $echo = true ) {
$output = apply_filters( 'labora_pingback_head_tag', '<link rel="pingback" href="' . get_bloginfo( 'pingback_url' ) . '" />' . "\n" );
echo wp_kses( $output , array(
'link' => array(
'href' => true,
'rel' => true,
),
));
}
add_action( 'wp_head', 'labora_set_pingback_tag', 10, 0 );
}
/**
* Multiple taxonomies
*/
if ( ! function_exists( 'labora_multi_tax_terms' ) ) {
function labora_multi_tax_terms( $where ) {
global $wp_query, $wpdb;
if ( isset( $wp_query->query_vars['term'] ) && ( strpos( $wp_query->query_vars['term'], ', ' ) !== false && strpos( $where, 'AND 0' ) !== false ) ) {
/**
* Get the terms
*/
$labora_term_array = explode( ',', $wp_query->query_vars['term'] );
foreach ( $labora_term_array as $term_item ) {
$labora_terms[] = get_terms( $wp_query->query_vars['taxonomy'], array(
'slug' => $term_item,
));
}
/**
* get the id of posts with that term in that taxonomy.
*/
foreach ( $labora_terms as $term ) {
if ( $term ) {
$labora_term_ids[] = $term[0]->term_id;
}
} //$terms as $term
$labora_post_ids = get_objects_in_term( $labora_term_ids, $wp_query->query_vars['taxonomy'] );
if ( ! is_wp_error( $labora_post_ids ) && count( $labora_post_ids ) ) {
// Build the new query
$labora_postids_where = " AND $wpdb->posts.ID IN ('. implode(', ', $labora_post_ids) . ') ";
$where = str_replace( 'AND 0', $labora_postids_where, $where );
}
} //$wp_query
return $where;
}
}
if ( ! function_exists( 'labora_get_attachment_id_from_src' ) ) {
function labora_get_attachment_id_from_src( $image_src ) {
global $wpdb;
$id = $wpdb->get_var( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid = %s", $image_src ) );
return $id;
}
}
// Woocommerce Config File
if ( class_exists( 'woocommerce' ) ) {
require_once( get_template_directory() . '/woocommerce/wc-config.php' );
}
// Theme Demo Importer
function labora_ocdi_import_files() {
return array(
array(
'import_file_name' => esc_html__( 'labora Demo','labora' ),
'local_import_file' => trailingslashit( get_template_directory() ) . '/theme-demo/main-demo/Sample-Data.xml',
'local_import_widget_file' => trailingslashit( get_template_directory() ) . '/theme-demo/main-demo/widget_data.wie',
'import_preview_image_url' => trailingslashit( get_template_directory_uri() ) . 'screenshot.png',
'import_notice' => esc_html__( 'Before Importing the demo data make sure you import theme options from the Appearance > Labora > Import/Export.', 'labora' ),
),
);
}
add_filter( 'pt-ocdi/import_files', 'labora_ocdi_import_files' );
function labora_ocdi_after_import_setup() {
// Assign menus to their locations.
$main_menu = get_term_by( 'name', 'Main Menu', 'nav_menu' );
set_theme_mod( 'nav_menu_locations', array(
'primary-menu' => $main_menu->term_id,
)
);
// Assign front page and posts page (blog page).
$front_page_id = get_page_by_title( 'Homepage' );
$blog_page_id = get_page_by_title( 'Blog' );
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $front_page_id->ID );
update_option( 'page_for_posts', $blog_page_id->ID );
}
add_action( 'pt-ocdi/after_import', 'labora_ocdi_after_import_setup' );