File: D:/HostingSpaces/KLeeuwen/old.samenbouwen.in/wwwroot/wp-content/themes/dlight/functions.php
<?php
/**
* @package WordPress
* @subpackage DLight Theme
* @author Shindiri Studio (http://www.shindiristudio.com) & http://www.mihajlovicnenad.com/
*/
/**
* Acive Plugins
*/
define( "DARKONE_MULTISITE", ( is_multisite() ? true : false ) );
$using_fbuilder = false;
if ( DARKONE_MULTISITE === true ) {
if ( array_key_exists( 'frontend_builder/frontend_builder.php', maybe_unserialize( get_site_option( 'active_sitewide_plugins') ) ) ) {
$using_fbuilder = true;
}
elseif ( in_array( 'frontend_builder/frontend_builder.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ? 'active' : '' ) {
$using_fbuilder = true;
}
}
elseif ( in_array( 'frontend_builder/frontend_builder.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ? 'active' : '' ) {
$using_fbuilder = true;
}
define( "DARKONE_FBUILDER", $using_fbuilder );
$using_revslider = false;
if ( DARKONE_MULTISITE === true ) {
if ( array_key_exists( 'revslider/revslider.php', maybe_unserialize( get_site_option( 'active_sitewide_plugins') ) ) ) {
$using_revslider = true;
}
elseif ( in_array( 'revslider/revslider.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ? 'active' : '' ) {
$using_revslider = true;
}
}
elseif ( in_array( 'revslider/revslider.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ? 'active' : '' ) {
$using_revslider = true;
}
define( "DARKONE_REVSLIDER", $using_revslider );
$using_ctimeline = false;
if ( DARKONE_MULTISITE === true ) {
if ( array_key_exists( 'ctimeline/ctimeline.php', maybe_unserialize( get_site_option( 'active_sitewide_plugins') ) ) ) {
$using_ctimeline = true;
}
elseif ( in_array( 'ctimeline/ctimeline.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ? 'active' : '' ) {
$using_ctimeline = true;
}
}
elseif ( in_array( 'ctimeline/ctimeline.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ? 'active' : '' ) {
$using_ctimeline = true;
}
define( "DARKONE_CTIMELINE", $using_ctimeline );
/**
* Slightly Modified Options Framework
*/
require_once ('admin/index.php');
/*
* After Setup DLight Theme
*/
if ( !function_exists('darkone_setup_theme') ) :
function darkone_setup_theme() {
global $darkone_data;
load_theme_textdomain( 'darkone', get_template_directory() . '/languages' );
add_theme_support( 'automatic-feed-links' );
register_nav_menu( 'darkone_primary', __( 'Primary Header Menu', 'darkone' ) );
add_theme_support( 'post-thumbnails' );
add_image_size( 'darkone-portfolio', 640, 640, true );
$feat_width = ( isset($darkone_data['fimage_width']) ? $darkone_data['fimage_width'] : 960 );
$feat_height = ( isset($darkone_data['fimage_height']) ? $darkone_data['fimage_height'] : 600 );
add_image_size( 'darkone-fullblog', $feat_width, $feat_height, true );
add_image_size( 'darkone-square', 200, 200, true );
add_theme_support( 'custom-background');
// Add support for Post Formats
add_theme_support( 'post-formats', array( 'audio', 'gallery', 'link', 'video', 'image', 'quote' ) );
// Adds editor style
add_editor_style();
}
endif;
add_action( 'after_setup_theme', 'darkone_setup_theme' );
/**
* Includes
*/
if ( DARKONE_FBUILDER === true ) { include_once ('shortcodes.php'); }
include_once('lib/twitteroauth/twitteroauth.php');
require_once dirname( __FILE__ ) . '/lib/tgm-plugin-activation/class-tgm-plugin-activation.php';
/**
* TGM Plugin Activation
*/
if ( !function_exists('darkone_register_required_plugins') ) :
function darkone_register_required_plugins() {
$plugins = array(
array(
'name' => 'Front-End Builder',
'slug' => 'frontend_builder',
'source' => get_template_directory() . '/lib/plugins/frontend_builder.zip',
'required' => true,
'version' => '2.7.0',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => 'http://www.shindiristudio.com/fbuilder/wp-admin/admin-ajax.php?action=fbuilder_edit&p=2'
),
array(
'name' => 'Revolution Slider',
'slug' => 'revslider',
'source' => get_template_directory() . '/lib/plugins/revslider.zip',
'required' => false,
'version' => '4.5.95',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => 'http://www.themepunch.com/codecanyon/revolution_wp/',
),
array(
'name' => 'Content Timeline',
'slug' => 'content_timeline',
'source' => get_template_directory() . '/lib/plugins/content_timeline.zip',
'required' => false,
'version' => '2.35',
'force_activation' => false,
'force_deactivation' => false,
'external_url' => 'http://www.shindiristudio.com/demo/?item=Content%20Timeline_Wordpress',
)
);
$theme_text_domain = 'darkone';
$config = array(
'domain' => $theme_text_domain,
'default_path' => '',
'parent_menu_slug' => 'themes.php',
'parent_url_slug' => 'themes.php',
'menu' => 'install-required-plugins',
'has_notices' => true,
'is_automatic' => true,
'message' => '',
'strings' => array(
'page_title' => __( 'Install Required Plugins', $theme_text_domain ),
'menu_title' => __( 'Install Plugins', $theme_text_domain ),
'installing' => __( 'Installing Plugin: %s', $theme_text_domain ), // %1$s = plugin name
'oops' => __( 'Something went wrong with the plugin API.', $theme_text_domain ),
'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ),
'notice_can_install_recommended'=> _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' ),
'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ),
'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ),
'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ),
'notice_cannot_activate'=> _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ),
'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ),
'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ),
'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ),
'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ),
'return'=> __( 'Return to Required Plugins Installer', $theme_text_domain ),
'plugin_activated' => __( 'Plugin activated successfully.', $theme_text_domain ),
'complete' => __( 'All plugins installed and activated successfully. %s', $theme_text_domain )
)
);
tgmpa( $plugins, $config );
}
endif;
add_action( 'tgmpa_register', 'darkone_register_required_plugins' );
/*
* Load Scripts
*/
if ( !function_exists('darkone_scripts') ) :
function darkone_scripts() {
global $darkone_data;
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'darkone-tween', get_template_directory_uri() . '/js/TweenMax.min.js', array( 'jquery' ), '1.0', true);
wp_enqueue_script( 'darkone-scrolltoplugin', get_template_directory_uri() . '/js/scrolltoplugin.js', array( 'jquery' ), '1.0', true);
wp_enqueue_script( 'darkone-swipebox', get_template_directory_uri() . '/js/swipebox/source/jquery.swipebox.min.js', array( 'jquery' ), '1.0', true);
wp_enqueue_script( 'darkone-idangerous', get_template_directory_uri() . '/js/idangerous.swiper-2.4.2.min.js', array( 'jquery' ), '1.0', true);
wp_enqueue_script( 'darkone-smoothscroll', get_template_directory_uri() . '/js/smoothscroll.js', array( 'jquery' ), '1.0', true);
wp_enqueue_script( 'darkone-main-js', get_template_directory_uri() . '/js/main.js', array( 'jquery' ), '1.0', true);
$entry = 'none';
$entry_mute = 'none';
$entry_loop = 'none';
$entry_hd = 'none';
$entry_fallback = 'none';
if ( is_page() ) {
$page_bg = get_post_meta( get_the_ID(), 'darkone_page_bg', true );
if ( $page_bg !== '' && $page_bg !== 'none' ) {
switch ($page_bg) :
case 'videoembed' :
$entry = get_post_meta(get_the_ID(),'darkone_pagevideo_embed',true);
$entry_mute = get_post_meta(get_the_ID(),'darkone_pagevideo_embed_mute',true);
$entry_loop = get_post_meta(get_the_ID(),'darkone_pagevideo_embed_loop',true);
$entry_hd = get_post_meta(get_the_ID(),'darkone_pagevideo_embed_hd',true);
$entry_fallback = wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );
break;
case 'html5video' :
$entry = 'none';
$entry_mute = 'none';
$entry_loop = 'none';
$entry_hd = 'none';
$entry_fallback = 'none';
default :
die( __('Invalid options.', 'darkone') );
endswitch;
}
}
wp_localize_script( 'darkone-main-js', 'darkone', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'siteurl'=> home_url('/'), 'ts_viewmore' => __('VIEW DETAILS', 'darkone') , 'video_bg' => $entry, 'video_mute' => $entry_mute, 'video_loop' => $entry_loop, 'video_hd' => $entry_hd) );
if ( $darkone_data['service_mode'] == '1' ) {
wp_enqueue_script( 'darkone-service', get_template_directory_uri() . '/settings/settings.js', array( 'jquery' ), '1.0', true);
wp_localize_script( 'darkone-service', 'darkoneService', array( 'siteurl' => get_template_directory_uri() ) );
}
}
endif;
add_action( 'wp_enqueue_scripts', 'darkone_scripts' );
/*
* Load Styles
*/
if ( !function_exists('darkone_styles_css') ) :
function darkone_styles_css() {
global $darkone_data;
if ( ! isset( $content_width ) )
$content_width = $darkone_data['content_width'];
wp_enqueue_style( 'darkone-style', get_stylesheet_uri() );
wp_enqueue_style( 'darkone-br0font', get_template_directory_uri().'/fonts/br0font/br0font.css' );
wp_enqueue_style( 'darkone-darkone', get_template_directory_uri().'/fonts/darkone/darkone.css' );
wp_enqueue_style( 'darkone-swipe', get_template_directory_uri().'/js/swipebox/source/swipebox.css' );
if ( $darkone_data['service_mode'] == '1' ) {
wp_enqueue_style( 'darkone-service', get_template_directory_uri() . '/settings/settings.css' );
}
if ( DARKONE_FBUILDER === false ) {
wp_enqueue_style( 'darkone-frontend', get_template_directory_uri() . '/lib/frontend.css' );
}
}
endif;
add_action( 'wp_enqueue_scripts', 'darkone_styles_css' );
/*
* Head CSS
*/
if ( !function_exists('darkone_styles') ) :
function darkone_styles() {
global $darkone_data;
echo "<style type='text/css'>\n";
printf('.darkone_container, .darkone_boxed .top-separator, body.darkone_boxed #darkone_wrapper, .social_header, .header_wrapper nav li.menu-item.has_sidebar ul.navmenu_fullwidth li.sidebar_holder, .darkone_maxwidth, .header_wrapper .menu_wrapper, .darkone_top {max-width:%1$spx;width:100%;}', $darkone_data['content_width'] );
echo "</style>\n";
echo "<style id='darkone_styles' type='text/css'>\n";
$darkone_rgb = implode(',', darkone_hex2rgb($darkone_data['theme_color']));
$colors_custom = array();
$colors_array = array(
'theme_color' => $darkone_data['theme_color'],
'theme_color_rgb' => $darkone_rgb
);
switch ($darkone_data['theme_style']) :
case 'dark' :
$colors_custom = array (
'dark' => '#ffffff',
'light' => '#111111',
'pale' => '#363636',
'light_rgb' => '17,17,17',
'dark_rgb' => '255,255,255',
'text'=> '#ffffff',
'footer_text' => '#ffffff',
'footer_bg' => '#000000',
'footer_rgb' => '255,255,255',
'pale_rgb' => '40,40,40'
);
break;
case 'light' :
$colors_custom = array (
'dark' => '#111111',
'light' => '#ffffff',
'pale' => '#aaaaaa',
'light_rgb' => '255,255,255',
'dark_rgb' => '17,17,17',
'text'=> '#444444',
'footer_text' => '#ffffff',
'footer_bg' => '#000000',
'footer_rgb' => '255,255,255',
'pale_rgb' => '170,170,170'
);
break;
case 'custom' :
$darkone_light_rgb = implode(',', darkone_hex2rgb($darkone_data['theme_color_light']));
$darkone_dark_rgb = implode(',', darkone_hex2rgb($darkone_data['theme_color_dark']));
$darkone_pale_rgb = implode(',', darkone_hex2rgb($darkone_data['theme_color_palee']));
$darkone_footer = implode(',', darkone_hex2rgb($darkone_data['theme_color_footer_textt']));
$colors_custom = array (
'dark' => $darkone_data['theme_color_dark'],
'light' => $darkone_data['theme_color_light'],
'pale' => $darkone_data['theme_color_palee'],
'light_rgb' => $darkone_light_rgb,
'dark_rgb' => $darkone_dark_rgb,
'text'=> $darkone_data['theme_color_textt'],
'footer_text' => $darkone_data['theme_color_footer_textt'],
'footer_bg' => $darkone_data['theme_color_footer_bg'],
'footer_rgb' => $darkone_footer,
'pale_rgb' => $darkone_pale_rgb
);
break;
default :
die( __('Invalid options.', 'darkone') );
endswitch;
$colors_array = $colors_array + $colors_custom;
printf('
.active.darkone_div_main_bg {background:%1$s !important;}body.div-nobgvideo #darkone_wrapper{background:%4$s;}.darkone_div_main_bg{background:%1$s}.footer_wrapper{color:%10$s;color:rgba(%12$s,.8);background:%11$s}.sticky-header{background:%4$s}body{color:%3$s;}.blog_content h3 a:hover,.menu_wrapper a:hover,.menu_wrapper>ul>li>a:hover,a,a:hover,.darkone_empty_cart a{color:%1$s}.darkone_div_breadcrumbs{background:%9$s}.hover_transparent.not-transparent h4,.menu_wrapper>ul>li>a,.tabs-nav .text_color_default,.darkone_border{border-color:%1$s!important}#darkone_sticky,.darkone_background{background:%4$s}.darkone_shopping_cart{background:%4$s;color:%3$s;border-color:%5$s}.darkone_background_dark,.darkone_separator,.small_separator{background:%3$s}.darkone_dark_border,.header_holder{border-color:%3$s!important}.single-tags-list a,.tagcloud a{background-color:%3$s;color:%4$s}.single-tags-list a:hover,.tagcloud a:hover{background:%1$s!important}{color:%4$s;background:%3$s;background:rgba(%3$s,.5)}.small_separator_pale{background-color:%5$s!important}.darkone_div_responsive #darkone_div_header_menu,.darkone_div_responsive #darkone_div_header_menu>ul>li,.darkone_pale_border,.posts_meta>div,.single .singlepost-navigation div a{border-color:%5$s!important}.darkone_div_responsive_icons a{border-color:%1$s;color:%1$s}.darkone_div_responsive_icons a:hover{border-color:%1$s;color:%1$s}.background-color-main{background:%3$s}.darkone_div_clac{background:%4$s;background:rgba(%6$s,.87)}.darkone_div_ctext,.text{color:%8$s}.darkone_div_dtext,h1,h2,h3,h4,h5,h6{color:%3$s}h1 a:hover,h2 a:hover,h3 a:hover,h4 a:hover,h5 a:hover,h6 a:hover{color:%1$s}.inline-arrow-left.not-active a,.inline-arrow-right.not-active a{color:%5$s !important;}.a-inherit li>a:hover{color:%1$s}.progers-bars-wrapper .progress-full{background:%5$s;color:%4$s}.progers-bars-wrapper .progress-done{background:%1$s}.progers-bars-wrapper span.tag-place{background-color:%3$s}.progers-bars-wrapper .progress-tag span.tag-place:after{border-top-color:%3$s}.darkone_search,.element-language-bar ul{color:%3$s;background:%4$s;border-color:%5$s}.darkone_search form button{background:%1$s;color:%4$s},.darkone_hover_over .darkone_div_buttons a{background:%3$s;color:%4$s}.darkone_header_widgets .darkone_dark_border{border-color:%4$s!important}.darkone_search:after{border-bottom-color:%4$s}.element-woo-cart.hovered a.cart-contents:after{border-top-color:%4$s}nav.social_bar{background:%4$s}.darkone_shopping_cart .darkone_cart_button{background:%3$s;color:%4$s;border-color:%4$s}.darkone_slider_content .darkone_slider_meta{background:%4$s}.pagination_wrapper li a.current{color:%1$s}.darkone_hover_over .darkone_div_buttons a:hover{background:%1$s}.tweets-list li,.widget-darkone-cat li,.single .singlepost-navigation{border-color:%5$s!important}.darkone_hover_over .portslider_meta a,.darkone_hover_over .portslider_meta{color:%4$s;}.darkone_div_ajax_port_selected a{color:%1$s !important;}.darkone_hover_over .portslider_meta a:hover {color:%1$s;}.darkone_div_portfolio_slider ul.darkone_div_top_nav_cat li.darkone_div_ajax_port_selected a,.darkone_div_portfolio_slider ul.darkone_div_top_nav_cat li a:hover{color:%1$s !important;}.darkone_div_portfolio_slider ul.darkone_div_top_nav_cat li a{color:%4$s}blockquote{border-color:%5$s;}
.darkone_theme_color {
color:%1$s !important;
}
.darkone_tc_border {
border-color:%1$s !important;
}
.darkone_tc_border > select {
color:%3$s;
}
.darkone_title span, h3.darkone_widget_title {
color:%1$s;
}
.darkone_footer_container {
background-color:%11$s;
}
.darkone_icon {
color:%4$s;
background-color:%1$s;
}
.darkone_blog .post.fbuilder_column {
border-color:%5$s;
}
widget_archive li,.widget_categories li,.widget_meta li,.widget_nav_menu li,.widget_pages li,.widget_recent_comments li,.widget_recent_entries li{
border-color:%4$s;
border-color:rgba(%7$s,0.33);
}
.single-tags-list a, .tagcloud a {
background-color:%5$s;
color:%3$s;
}
.single-tags-list a:hover,.tagcloud a:hover{background-color:%1$s!important}
.darkone_post_author {
border-color:%5$s;
}
input,select,textarea,button{color:%5$s;border-color:%5$s !important;}input:focus,textarea:focus,button:focus{color:%3$s!important;border-color:%1$s !important;}::-webkit-input-placeholder{color:%5$s!important}:-moz-placeholder{color:%5$s!important}::-moz-placeholder{color:%5$s!important}:-ms-input-placeholder{color:%5$s!important}
#respond input#submit,input[type=submit]{border-color:%5$s}
#respond input#submit:hover, input[type="submit"]:hover{border-color:%1$s!important;color:%1$s;}
.darkone_comment_bubble {
background-color:%5$s;
}
.darkone_comment_bubble:before {
border-right-color:%5$s;
}
#comments, #comments h6.comments_title {
border-color:%5$s;
}
.contact_form.comment_form .input_wrapper_select > div {
border-color:%5$s
}
.contact_form .darkone_captcha_wrap {
color:%5$s;;
}
span {
color:%1$s;
}
.darkone_nav_element a:hover, button.darkone_submit_button:hover {
color:%1$s;
}
.darkone_search input::-webkit-input-placeholder{color:%3$s!important}.darkone_search input:-moz-placeholder{color:%3$s!important}.darkone_search input::-moz-placeholder{color:%3$s!important}.darkone_search input:-ms-input-placeholder{color:%3$s!important}
.darkone_hover_color:hover,.team_member_module .hover_element .socials li a:hover {
background-color:%1$s !important;
}
.darkone_image_hover a.darkone_image_hover_button:hover, a.kklike-box:hover{border-color:%1$s;color:%1$s;}
.inline-block.not-active {
color:%5$s !important;
}
.menu_wrapper ul.sub-menu {background-color:%4$s;background-color:rgba(%6$s,0.9);}
.menu_wrapper ul.sub-menu:before {border-bottom-color:%4$s;border-bottom-color:rgba(%6$s,0.9);}
.menu_wrapper .sub-menu .sub-menu {
outline-left-color:%1$s;
}
.darkone_footer_container {color:%10$s;}
@keyframes mmntcone{0%%{background-color:%1$s}16.67%%{}100%%{}}
@-webkit-keyframes mmntcone{0%%{background-color:%1$s}16.67%%{}100%%{}}
@keyframes mmntctwo{0%%{}33.33%%{}50%% {background-color:%1$s}66.67%%{}100%%{}}
@-webkit-keyframes mmntctwo{0%%{}33.33%%{}50%% {background-color:%1$s}66.67%%{}100%%{}}
@keyframes mmntcthree{0%%{}83.33 {}100%%{background-color:%1$s}}
@-webkit-keyframes mmntcthree{0%%{}83.33 {}100%%{background-color:%1$s}}
',
$colors_array['theme_color'],
$colors_array['theme_color_rgb'],
$colors_array['dark'],
$colors_array['light'],
$colors_array['pale'],
$colors_array['light_rgb'],
$colors_array['dark_rgb'],
$colors_array['text'],
'',
$colors_array['footer_text'],
$colors_array['footer_bg'],
$colors_array['footer_rgb'],
$colors_array['pale_rgb']
);
echo "</style>\n";
$font = $darkone_data['font'];
$font_header = $darkone_data['font_header'];
echo "<style id='darkone_font_styles' type='text/css'>\n";
printf( '
body,li.sidebar_holder{font-family:"%1$s",serif;}
#darkone_div_header_menu,#form-wrap >p:first-child,#sendpress_signup #thanks,.bbp-footer,.bbp-forum-title,.bbp-header,.bbp-pagination-count,.bbp-topic-permalink,.darkone_header_font,.footer_header .footer_counter,.menu-trigger-icon,.news_feed_tabs .tabsnav a,.shop_table.cart thead,.widget>ul>li,.woocommerce .summary .price,.woocommerce-tabs ul.tabs>li>a,.yop-poll-question,aside .product_list_widget a,aside.widget_display_stats,h1,h2,h3,h4,h5,h6,span.product_hover_text, .frb_scrl_count_digit_wrap, .frb_percentage_chart, p.logged-in-as, p.comment-notes,.kklike-box {font-family:"%2$s",serif !important}', $font, $font_header);
echo "</style>\n";
if( $darkone_data['custom-css'] !== '' ) :
echo "<style type='text/css'>".$darkone_data['custom-css']."</style>";
endif;
}
endif;
add_action( 'wp_head', 'darkone_styles' );
/*
* Google Fonts
*/
if ( !function_exists('darkone_fonts') ) :
function darkone_fonts() {
global $darkone_data;
$protocol = is_ssl() ? 'https' : 'http';
$font = array ();
if(isset($darkone_data['font']))
{
$font[] = $darkone_data['font'];
}
if(isset($darkone_data['font_header']))
{
$font[] = $darkone_data['font_header'];
}
$protocol = is_ssl() ? 'https' : 'http';
$i = 0;
foreach ( array_unique($font) as $cf ) {
$i++;
$scf = str_replace(' ', '+', $cf);
wp_enqueue_style( "br0frmd-font-$i", $protocol."://fonts.googleapis.com/css?family=$scf%3A100%2C200%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C700%2C700italic%2C800&subset=all" );
}
if ( $darkone_data['service_mode'] == '1' ) {
$service_fonts = array(
'Sanchez',
'PT Sans',
'Open Sans',
'Roboto',
'Oswald',
'Lato',
'Droid Sans',
'Ubuntu',
'Montserrat',
'Dosis',
'Roboto Slab',
'Josefin Sans'
);
foreach ( $service_fonts as $cf ) {
$i++;
$scf = str_replace(' ', '+', $cf);
wp_enqueue_style( "br0frmd-font-$i", $protocol."://fonts.googleapis.com/css?family=$scf%3A100%2C200%2C300%2C300italic%2C400%2C400italic%2C500%2C500italic%2C600%2C700%2C700italic%2C800&subset=all" );
}
}
}
endif;
add_action( 'wp_enqueue_scripts', 'darkone_fonts' );
/*
* Layout Init
*/
if ( !function_exists('darkone_create_layout') ) :
function darkone_create_layout() {
global $darkone_data, $darkone_layout;
$darkone_layout['widget_title_before'] = '<h3 class="darkone_widget_title darkone_header_font text-left margin-bottom24">';
$darkone_layout['widget_title_after'] = '</h3>';
$darkone_layout['footer_widget_title_before'] = '<h3 class="darkone_widget_title darkone_header_font text-left margin-bottom24">';
$darkone_layout['footer_widget_title_after'] = '</h3>';
}
endif;
add_action( 'widgets_init', 'darkone_create_layout');
/*
* Widgets Init
*/
if ( !function_exists('darkone_widgets_init') ) :
function darkone_widgets_init() {
global $darkone_data, $darkone_layout;
register_sidebar( array (
'name' => __( 'Blog Archives Sidebar', 'darkone' ),
'id' => 'sidebar-blog',
'before_widget' => '<aside id="%1$s" class="widget margin-bottom36 %2$s">',
'after_widget' => "</aside>",
'before_title' => $darkone_layout['widget_title_before'],
'after_title' => $darkone_layout['widget_title_after'],
'description' => __( 'This sidebar appears on Blog Archive pages.', 'darkone' )
) );
register_sidebar( array (
'name' => __( 'Single Posts Sidebar', 'darkone' ),
'id' => 'sidebar-single',
'before_widget' => '<aside id="%1$s" class="widget margin-bottom36 %2$s">',
'after_widget' => "</aside>",
'before_title' => $darkone_layout['widget_title_before'],
'after_title' => $darkone_layout['widget_title_after'],
'description' => __( 'This sidebar appears on Single Posts.', 'darkone' )
) );
$sidebars = ( isset($darkone_data['sidebar']) ? $darkone_data['sidebar'] : array() );
foreach ( $sidebars as $sidebar ) {
$title = sanitize_title( $sidebar['title'] );
register_sidebar( array (
'name' => $sidebar['title'] ,
'id' => $title,
'before_widget' => '<aside id="%1$s" class="widget %2$s margin-bottom36">',
'after_widget' => "</aside>",
'before_title' => $darkone_layout['widget_title_before'],
'after_title' => $darkone_layout['widget_title_after']
) );
}
}
endif;
add_action( 'widgets_init', 'darkone_widgets_init' );
/*
* DLight Pagination
*/
if ( !function_exists('darkone_pagination') ) :
function darkone_pagination($pages = '', $page = '', $range = 3, $ajax = '') {
if ( $page == '' ) {
global $paged;
if ( empty( $paged ) ) $paged = 1;
}
else {
$paged = $page;
}
$next_page = $paged + 1;
$prev_page = $paged - 1;
$showitems = $range;
$out = '';
if ( $pages == '' ) {
global $wp_query;
$pages = $wp_query->max_num_pages;
if ( !$pages ) {
$pages = 1;
}
}
if ( $ajax !== '' && $ajax !== 'no' ) {
$ajaxload = 'onclick="darkone_ajaxload_portfolio(jQuery(this)); return false;"';
}
else {
$ajaxload = '';
}
if ( 1 != $pages ) {
$out .= "<nav class='darkone_pagination_wrapper text-right darkone_header_font a-inherit'><ul>";
if ( $paged > 1 ){
$out .= "<li class='darkone_icon inline-block'><a title=\"" . __('View newer posts', 'darkone') . "\" href=\"" . get_pagenum_link( $paged - 1 ) . "\" class=\"previous\" " . $ajaxload . "><i class='f-darkone-left'></i><span class='display_none darkone_page'>". ($paged - 1)."</span></a></li>";
}
else {
$out .= "<li class='darkone_icon inline-block darkone_opaque'><i class='f-darkone-left'></i></li>";
}
if ( $paged < $pages ) {
$out .= "<li class='darkone_icon inline-block'><a title=\"" . __( 'View earlier posts', 'darkone' ) . "\" href=\"" . get_pagenum_link( $paged + 1 ) . "\" class=\"lose_width next\" " . $ajaxload . "><i class='f-darkone-right'></i><span class='display_none darkone_page'>".( $paged + 1 )."</span></a></li>";
}
else {
$out .= "<li class='darkone_icon inline-block darkone_opaque'><i class='f-darkone-right'></i></li>";
}
$out .= "<div class=\"clearfix\"></div></ul></nav>";
}
return $out;
}
endif;
/*
* DLight Pagination Mini
*/
if ( !function_exists('darkone_mini_pagination') ) :
function darkone_mini_pagination($pages = '', $page = '', $range = 3, $ajax = '', $title = '') {
if ( $page == '' ) {
global $paged;
if ( empty( $paged ) ) $paged = 1;
}
else {
$paged = $page;
}
$next_page = $paged + 1;
$prev_page = $paged - 1;
$showitems = 5;
$out = '';
if ( $pages == '' ) {
global $wp_query;
$pages = $wp_query->max_num_pages;
if ( !$pages ) {
$pages = 1;
}
}
if ( $ajax !== '' && $ajax !== 'no' ) {
$ajaxload = 'onclick="darkone_ajaxload(jQuery(this)); return false;"';
}
else {
$ajaxload = '';
}
if ( 1 != $pages ) {
$out .= "<nav class='darkone_blog_top_pagination darkone_header_font a-inherit margin-bottom24'>
<h2 class='darkone_blog_top_page_header margin-bottom48'>".$title."</h2>
<ul class='inline-block'>";
if ( $paged > 1 ) {
$out .= "<li class='inline-block inline-arrow-left'><a title=\"" . __('View newer posts', 'darkone') . "\" href=\"" . get_pagenum_link( $paged - 1 ) . "\" class=\"previous bold_font\" " . $ajaxload . "><i class='f-darkone-left'></i><span class='display_none darkone_page'>". ($paged - 1)."</span></a></li>";
}
else {
$out .= "<li class='inline-block inline-arrow-left not-active'><a title=\"" . __('View newer posts', 'darkone') . "\" class=\"previous bold_font\"><i class='f-darkone-left'></i><span class='display_none darkone_page'>". ($paged - 1)."</span></a></li>";
}
if ( $paged < $pages ) { $out .= "<li class='inline-block inline-arrow-right'><a title=\"" . __( 'View earlier posts', 'darkone' ) . "\" href=\"" . get_pagenum_link( $paged + 1 ) . "\" class=\"next bold_font\" " . $ajaxload . "><i class='f-darkone-right'></i><span class='display_none darkone_page'>".( $paged + 1 )."</span></a></li>";}
else {
$out .= "<li class='inline-block inline-arrow-right not-active'><a title=\"" . __( 'View earlier posts', 'darkone' ) . "\" class=\"next bold_font\"><i class='f-darkone-right'></i><span class='display_none darkone_page'>".( $paged + 1 )."</span></a></li>";
}
$out .= "</ul></nav>";
}
return $out;
}
endif;
/*
* Template for comments and pingbacks
*/
if ( !function_exists( 'darkone_comment' ) ) :
function darkone_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case '' : ?>
<li <?php comment_class('single_comment'); ?> id="li-comment-<?php comment_ID(); ?>">
<div id="comment-<?php comment_ID(); ?>" class="darkone_div_comment border-box">
<?php echo get_avatar( $comment, 200 ); ?>
<div class="darkone_comment_bubble">
<div class="darkonecomment_meta margin-bottom12 darkone_header_font a-inherit">
<h6 class="comment_date_meta uppercase margin-bottom6"><?php echo get_comment_date(); ?></h6>
<h4 class="comment_author_meta uppercase darkone_theme_color"><?php echo get_comment_author_link(); ?></h4>
</div>
<div class="darkone_comment_text">
<?php
comment_text();
if ( $comment->comment_approved == '0' ) :
?>
<p class="moderation">
<?php _e( 'Your comment is awaiting moderation.', 'darkone' ); ?>
</p>
<?php endif; ?>
</div>
<div class="darkone_comment_edit darkone_header_font uppercase">
<?php
comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) );
edit_comment_link( __( 'Edit', 'darkone' ), ' ' );
?>
</div>
</div>
</div>
<?php
break;
case 'pingback' :
?>
<li class="post pingback">
<p>
<?php
_e( 'Pingback:', 'darkone' );
comment_author_link();
edit_comment_link( __('(Edit)', 'darkone'), ' ' );
?>
</p>
<?php
break;
case 'trackback' :
?>
<li class="post pingback">
<p>
<?php
_e( 'Pingback:', 'darkone' );
comment_author_link();
edit_comment_link( __('(Edit)', 'darkone'), ' ' );
?>
</p>
<?php
break;
default :
die( __('Invalid options.', 'darkone') );
endswitch;
}
endif;
/*
* DLight Blog AJAX
*/
if ( ! function_exists('darkone_ajaxload_send')) :
function darkone_ajaxload_send() {
$out = '';
$post_counter = 0;
$add_class = '';
$query_string = $_POST['data'];
$current_page = darkone_get_between($query_string, 'paged=', '&');
$type = $_POST['type'];
$page = $_POST['page'];
$ajax = $_POST['ajax'];
$words = $_POST['excerpt'];
$bot_margin = $_POST['bot_margin'];
$title = stripslashes($_POST['title']);
switch ($type) {
case 'darkone_type_0' :
$columns = 1;
$image_size = 'darkone-portfolio';
break;
case 'darkone_type_1' :
$columns = 2;
$image_size = 'darkone-portfolio';
break;
case 'darkone_type_2' :
$columns = 3;
$image_size = 'darkone-portfolio';
break;
case 'darkone_type_3' :
$columns = 4;
$image_size = 'darkone-portfolio';
break;
case 'darkone_type_4' :
$columns = 5;
$image_size = 'darkone-portfolio';
break;
default :
die( __('No type set', 'darkone') );
}
$query_string = str_replace('paged='.$current_page.'&', 'paged='.$page.'&', $query_string);
$darkone_posts = new WP_Query( $query_string );
if ( $darkone_posts->have_posts() ) :
$out .= darkone_mini_pagination($darkone_posts->max_num_pages, $page, 3, $ajax, $title);
$out .= "@@@!SPLIT!@@@<div class='blog_content {$type}' data-string='{$query_string}' data-shortcode='{$words}|{$bot_margin}|{$title}' style='margin-bottom:{$bot_margin}px'>";
$out .= '<div class="separate-post-column darkone_row margin-top36 fbuilder_row"><div>';
while( $darkone_posts->have_posts() ): $darkone_posts->the_post();
$feat_area = '';
$post_counter++;
if ( $add_class !== '' ) $out .= '</div></div><div class="separate-post-column darkone_row margin-top36 fbuilder_row"><div>';
$out .= '<div class=" '.implode(' ', get_post_class()).' fbuilder_column fbuilder_column-1-'.$columns.'"><div class="headline_highlighted_column_block">';
$out .= darkone_get_featarea($image_size);
$timecode = get_the_date();
$heading = '<div class="darkone_posts_meta uppercase"><div class="darkone_div_category_meta inline-block a-inherit">'.get_the_category_list( ', ' ).'</div>; <div class="darkone_div_author_meta inline-block a-inherit">'.__('by', 'darkone').' '.get_the_author_link().'</div></div>';
$heading .= '<h4 class="darkone_blog_title uppercase darkone_theme_color"><a href="'.get_permalink().'">'.get_the_title().'</a></h4>';
$out .= ( $type == 0 ? $heading . $feat_area : $feat_area . $heading );
if ( $words !== '0 ' ) {
$excerpt = get_the_excerpt();
$out .= '<div class="text margin-top6 margin-bottom6">'. darkone_string_limit_words( $excerpt, $words ).'</div>';
}
$out .= '</div></div>';
if ( $post_counter == $columns ){
$post_counter = 0;
$add_class = 'new_row';
}
else {
$add_class = '';
}
endwhile;
$out .= '</div></div>';
$out .= '<div class="clearfix"></div>';
$out .= '</div>';
endif;
die($out);
exit;
}
endif;
add_action('wp_ajax_nopriv_darkone_ajaxload_send', 'darkone_ajaxload_send');
add_action('wp_ajax_darkone_ajaxload_send', 'darkone_ajaxload_send');
/*
* DLight Portfolio AJAX
*/
if ( ! function_exists('darkone_ajaxload_send_portfolio')) :
function darkone_ajaxload_send_portfolio() {
$out = '';
$post_counter = 0;
$add_class = '';
$query_string = $_POST['data'];
$current_page = darkone_get_between($query_string, 'paged=', '&');
$type = $_POST['type'];
$page = $_POST['page'];
$ajax = $_POST['ajax'];
$category = $_POST['category'];
$bot_margin = $_POST['margin'];
$top_pagination = $_POST['top_pagination'];
$top_align = $_POST['top_align'];
$trans_effect = $_POST['trans_effect'];
$data_cat = $_POST['data_cat'];
$pagination = $_POST['pagination'];
switch ($type) {
case 'darkone_portfolio_1' :
$columns = 2;
$image_size = 'darkone-portfolio';
break;
case 'darkone_portfolio_2' :
$columns = 3;
$image_size = 'darkone-portfolio';
break;
case 'darkone_portfolio_3' :
$columns = 4;
$image_size = 'darkone-portfolio';
break;
case 'darkone_portfolio_4' :
$columns = 5;
$image_size = 'darkone-portfolio';
break;
default :
die( __('No type set', 'darkone') );
}
$query_string = str_replace('paged='.$current_page.'&', 'paged='.$page.'&', $query_string);
$darkone_posts = new WP_Query( $query_string );
if ( $darkone_posts->have_posts() ) :
$out .= "<div class='portfolio_content {$type}' data-string='{$query_string}' data-shortcode='{$bot_margin}|{$category}|{$top_pagination}|{$top_align}|{$trans_effect}|{$pagination}' data-columns='{$columns}' style='margin-bottom:{$bot_margin}px'>";
if ( $top_pagination == 'yes' ) {
$separate_categories = explode(',', $category);
$out .= '<div class="darkone_div_top_nav_wrap" data-category="'.$category.'"><ul class="darkone_container darkone_div_top_nav_cat a-inherit darkone_anim_'.$trans_effect.' text-'.$top_align.'">';
$sms_cnt = 0;
if ( count($separate_categories) > 1 && !array_search('-1', $separate_categories, true) ) {
if ( $data_cat == '-1' || $data_cat == $category ) {
$selected_class = ' class="darkone_div_ajax_port_selected"';
}
else {
$selected_class = '';
}
$out .= sprintf( '<li%3$s><a href="#" onclick="darkone_ajaxload_portfolio(jQuery(this)); return false;" data-cat="%2$s">%1$s</a></li>', __('All', 'darkone'), '-1', $selected_class );
$sms_cnt++;
}
foreach ( $separate_categories as $category_loop ) {
$sms_cnt++;
$selected_class = ( $data_cat == $category_loop ? ' class="darkone_div_ajax_port_selected"' : ' class="darkone_div_clac"' );
if ( $category_loop == '-1' ) {
$category_unique = __('All', 'darkone');
$queried_category = '-1';
$out .= sprintf( '<li%3$s><a href="#" onclick="darkone_ajaxload_portfolio(jQuery(this)); return false;" data-cat="%2$s">%1$s</a></li>', $category_unique, $category_loop, $selected_class );
}
else {
$category_unique = get_cat_name( $category_loop );
$queried_category = sanitize_title($category_unique);
$out .= sprintf( '<li%3$s><a href="#" onclick="darkone_ajaxload_portfolio(jQuery(this)); return false;" data-cat="%2$s">%1$s</a></li>', $category_unique, $category_loop, $selected_class );
}
}
$out .= '</ul></div>';
}
$out .= '<div class="separate-portfolio-column darkone_row margin-top24 fbuilder_row text-left"><div>';
while( $darkone_posts->have_posts() ): $darkone_posts->the_post();
if ( has_post_thumbnail()) {
$cat = get_the_category();
$out .= '<div class="darkone_div_ajax_col fbuilder_column fbuilder_column-1-'.$columns.'" data-type="'.sanitize_title($cat[0]->name).'">
<a href="'.get_permalink().'" rel="nofollow" onclick="darkone_ajaxload_portfolio_single(jQuery(this), \''.get_the_ID().'\'); return false;">';
$out .= sprintf('<div href="%1$s" class="margin-bottom36 darkone_hover">', get_permalink() );
$out .= get_the_post_thumbnail( get_the_ID(), $image_size, array('class' => sprintf('block')));
$out .= '<div class="darkone_hover_over"><div class="darkone_portfolio_meta darkone_header_font border-box">
<h4 class="darkone_portoflio_title uppercase darkone_theme_color">'.get_the_title().'</h4>
<div class="category_meta inline-block a-inherit uppercase">';
$post_categories = wp_get_post_categories( get_the_ID() );
$cats = array();
foreach($post_categories as $c){
$cat = get_category( $c );
$out .= $cat->name;
}
$out .= ';</div></div></div>';
$out .= sprintf('</div>' );
$out .= '</a></div>';
}
endwhile;
$out .= '</div></div>';
if ( $pagination == 'yes' ) { $out .= darkone_pagination($darkone_posts->max_num_pages, $page, 3, $ajax); }
$out .= '</div>';
endif;
die($out);
exit;
}
endif;
add_action('wp_ajax_nopriv_darkone_ajaxload_send_portfolio', 'darkone_ajaxload_send_portfolio');
add_action('wp_ajax_darkone_ajaxload_send_portfolio', 'darkone_ajaxload_send_portfolio');
/*
* DLight Portfolio Single AJAX
*/
if ( ! function_exists('darkone_ajaxload_send_portfolio_single')) :
function darkone_ajaxload_send_portfolio_single() {
$out = '';
$post_id = $_POST['post_id'];
$data_cat = $_POST['data_cat'];
$current_cat = $_POST['current_cat'];
if ( $current_cat == '-1' ) {
$current_cat = $data_cat;
}
$post_field = get_post_field('post_content', $post_id);
$out .= do_shortcode('[darkone_post_pagination ajax="yes" category="'.$current_cat.'" post_id="'.$post_id.'" previous="<i class=\'f-darkone-left\'></i>" next="<i class=\'f-darkone-right\'></i>"]').'<div class="darkone_single_portfolio_content">'.$post_field.'</div>';
die($out);
exit;
}
endif;
add_action('wp_ajax_nopriv_darkone_ajaxload_send_portfolio_single', 'darkone_ajaxload_send_portfolio_single');
add_action('wp_ajax_darkone_ajaxload_send_portfolio_single', 'darkone_ajaxload_send_portfolio_single');
/*
* DLight Read More Link
*/
if ( ! function_exists('darkone_remove_more_link')) :
function darkone_remove_more_link( $link ) {
return sprintf('<a href="%1$s" rel="nofollow" class="darkone_read_more block">%2$s</a>', get_permalink(), __('Read More', 'darkone') );
}
endif;
add_filter( 'the_content_more_link', 'darkone_remove_more_link' );
/*
* DLight Custom Functions
*/
// DLight List Pages
function darkone_list_pages(){
echo '<ul class="list_style">';
wp_list_pages( array( 'title_li' => '', 'depth' => '1' ));
echo '</ul>';
return;
}
// DLight Theme Options
function darkone_add_options_link() {
global $wp_admin_bar;
$wp_admin_bar -> add_menu( array(
'parent' => 'site-name',
'id' => 'darkone_options',
'title' => __('DLight Options', 'darkone'),
'href' => admin_url( 'themes.php?page=optionsframework' ),
'meta' => false
));
}
add_action( 'wp_before_admin_bar_render', 'darkone_add_options_link' );
// String limit by char
if ( ! function_exists('darkone_string_limit_words'))
{
function darkone_string_limit_words($str, $n = 500, $end_char = '...')
{
if ( $n == 0 ) return;
if (strlen($str) < $n)
{
return $str;
}
$str = preg_replace("/\s+/", ' ', str_replace(array("\r\n", "\r", "\n"), ' ', $str));
if (strlen($str) <= $n)
{
return $str;
}
$out = "";
foreach (explode(' ', trim($str)) as $val)
{
$out .= $val.' ';
if (strlen($out) >= $n)
{
$out = trim($out);
return (strlen($out) == strlen($str)) ? $out : $out.$end_char;
}
}
}
}
// Hex to RGB
function darkone_hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = array($r, $g, $b);
//return implode(",", $rgb);
return $rgb;
}
// get_between. string function
function darkone_get_between($content,$start,$end){
$r = explode($start, $content);
if (isset($r[1])){
$r = explode($end, $r[1]);
return $r[0];
}
return '';
}
// darkone_split. split string
function darkone_split($string,$needle,$nth){
$max = strlen($string);
$n = 0;
for($i=0;$i<$max;$i++){
if($string[$i]==$needle){
$n++;
if($n>=$nth){
break;
}
}
}
$arr[] = mb_substr($string,0,$i);
$arr[] = mb_substr($string,$i+1,$max);
return $arr;
}
// Adds featured images thumbnails
add_filter( 'manage_posts_columns', 'darkone_posts_columns', 5 );
add_action( 'manage_posts_custom_column', 'darkone_posts_custom_columns', 5, 2 );
function darkone_posts_columns( $defaults ) {
$defaults['post_thumbs'] = __( 'Featured image', 'darkone' );
return $defaults;
}
function darkone_posts_custom_columns( $column_name, $id ) {
if( $column_name === 'post_thumbs' ) {
echo the_post_thumbnail( array( 60, 60 ) );
}
}
/*
* Widgets
*/
include_once('widgets/socialbro/socialbro.php');
// Tweeter Widget
class Darkone_Twitter_Widget extends WP_Widget {
function Darkone_Twitter_Widget() {
$widget_ops = array(
'classname' => 'widget-darkone-twitter twitter_module',
'description' => __( 'Show your twitter feeds', 'darkone' )
);
$this->WP_Widget( 'darkone_twitter', '+ Darkone Twitter', $widget_ops );
}
function widget( $args, $instance ) {
extract( $args, EXTR_SKIP );
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters( 'widget_title', $instance['title'] );
$user = empty($instance['user']) ? '' : apply_filters( 'widget_user', $instance['user'] );
$count = empty($instance['count']) ? '' : apply_filters( 'widget_count', $instance['count'] );
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
echo darkone_twitter_feed( $user, $count );
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['user'] = strip_tags( $new_instance['user'] );
$instance['count'] = strip_tags( $new_instance['count'] );
return $instance;
}
function form( $instance ) {
$instance = wp_parse_args(
(array) $instance, array(
'title' => '',
'user' => '',
'count' => 5
) );
$title = strip_tags( $instance['title'] );
$user = strip_tags( $instance['user'] );
$count = strip_tags( $instance['count'] );
?>
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'darkone' ); ?> :</label>
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></p>
<p><label for="<?php echo $this->get_field_id( 'user' ); ?>"><?php _e( 'User', 'darkone' ); ?> :</label>
<input class="widefat" id="<?php echo $this->get_field_id( 'user' ); ?>" name="<?php echo $this->get_field_name( 'user' ); ?>" type="text" value="<?php echo esc_attr( $user ); ?>" /></p>
<p><label for="<?php echo $this->get_field_id( 'count' ); ?>"><?php _e( 'Count', 'darkone' ); ?> :</label>
<input class="widefat" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" type="text" value="<?php echo esc_attr( $count ); ?>" /></p>
<?php }
}
add_action( 'widgets_init', create_function('', 'return register_widget("Darkone_Twitter_Widget");' ) );
// Post widgets
class Darkone_Categories_Widget extends WP_Widget {
function Darkone_Categories_Widget() {
$widget_ops = array(
'classname' => 'widget-darkone-cat',
'description' => __( 'Show category posts', 'darkone') );
$this->WP_Widget( 'darkone_category', '+ Darkone Category Posts', $widget_ops );
}
function widget( $args, $instance ) {
extract( $args, EXTR_SKIP );
echo $before_widget;
$title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', $instance['title'] );
if ( isset( $instance['order'] ) ) : $order = $instance['order']; else : $order = 'date'; endif;
if ( isset( $instance['category'] ) ) : $category = $instance['category']; else : $category = '-1'; endif;
if ( isset( $instance['number'] ) ) : $number = $instance['number']; else : $number = '5'; endif;
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
echo '<ul>';
$out = '';
$query_string = array(
'post_type' => 'post',
'posts_per_page' => $number,
'ignore_sticky_posts' => true,
'orderby' => $order
);
if ( $category !== "-1" ){
$query_string = $query_string + array(
'cat' => $category
);
}
$darkone_posts = new WP_Query( $query_string );
if ( $darkone_posts->have_posts() ) :
while( $darkone_posts->have_posts() ): $darkone_posts->the_post();
$out .= '<li>';
if ( has_post_thumbnail()) {
$out .= '<a class="float_left margin-right12 smaller_image darkone_hover" href="' . get_permalink() . '">' . get_the_post_thumbnail( get_the_ID(), 'darkone-square' ) . '</a>';
}
$out .= '<div class="darkone_posts_meta uppercase"><div class="darkone_div_category_meta inline-block a-inherit">'.get_the_category_list( ', ' ).'</div>;</div>';
$out .= '<h4><a href="' . get_permalink() . '">'. get_the_title() .'</a></h4>';
$out .= '<div class="clearfix"></div>';
$out .= '</li>';
endwhile;
endif;
wp_reset_query();
echo $out;
echo '</ul>';
echo $after_widget;
}
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['order'] = strip_tags( $new_instance['order'] );
$instance['category'] = strip_tags( $new_instance['category'] );
$instance['number'] = strip_tags( $new_instance['number'] );
return $instance;
}
function form( $instance ) {
$instance = wp_parse_args(
(array) $instance, array(
'title' => '',
'order' => 'date',
'category' => '34',
'number' => '5'
) );
$title = strip_tags( $instance['title'] );
$number = strip_tags( $instance['number'] ); ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title', 'darkone' ); ?> : <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('order'); ?>"><?php _e( 'Order', 'darkone' ); ?> : <select id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>">
<option value="date" <?php $selected = ( $instance['order'] === 'date') ? 'selected = "selected"' : ''; echo $selected; ?>><?php _e('Recent', 'darkone'); ?></option>
<option value="comment_count" <?php $selected = ( $instance['order'] === 'comment_count') ? 'selected = "selected"' : ''; echo $selected; ?>><?php _e('Popular', 'darkone'); ?></option>
<option value="rand" <?php $selected = ( $instance['order'] === 'rand') ? 'selected = "selected"' : ''; echo $selected; ?>><?php _e('Random', 'darkone'); ?></option>
<option value="author" <?php $selected = ( $instance['order'] === 'author') ? 'selected = "selected"' : ''; echo $selected; ?>><?php _e('Author', 'darkone'); ?></option>
<option value="title" <?php $selected = ( $instance['order'] === 'title') ? 'selected = "selected"' : ''; echo $selected; ?>><?php _e('Title', 'darkone'); ?></option>
</select></label></p>
<p><label for="<?php echo $this->get_field_id('category'); ?>"><?php _e( 'Category', 'darkone' ); wp_dropdown_categories('show_option_none=All&show_count=1&orderby=name&echo=1&name='.$this->get_field_name('category').'&id='.$this->get_field_id('category').'&selected='. $instance['category'] .'');?></label></p>
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e( 'Number of posts to display', 'darkone' ); ?> : <input class="widefat" id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo esc_attr($number); ?>" /></label></p>
<?php
}
}
add_action( 'widgets_init', create_function('', 'return register_widget("Darkone_Categories_Widget");' ) );
// Twitter OAuth helper function
function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
return $connection;
}
/*
* Twitter Feed
*/
if ( !function_exists('darkone_twitter_feed') ) :
function darkone_twitter_feed($user = 'twitter', $count = '5'){
$transient_key = $user . "_twitter_" . $count;
$cached = get_transient( $transient_key );
if ( false !== $cached ) {
return $cached .= "\n" . '<!-- Returned from cache -->';
}
global $darkone_data;
$output = '';
$i = 1;
$twitteruser = $user;
$notweets = $count;
$consumerkey = $darkone_data['twitter_ck'];
$consumersecret = $darkone_data['twitter_cs'];
$accesstoken = $darkone_data['twitter_at'];
$accesstokensecret = $darkone_data['twitter_ats'];
$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);
$data = json_decode( json_encode($tweets) );
if ( is_array( $data ) ) :
$output .= '<ul class="tweets-list list_null">';
while ( $i <= $count ) {
if( isset( $data[$i-1] ) ) {
$feed = $data[( $i - 1 )]->text;
$feed = str_pad( $feed, 3, ' ', STR_PAD_LEFT );
$startat = stripos( $feed, '@' );
$numat = substr_count( $feed, '@' );
$numhash = substr_count( $feed, '#' );
$numhttp = substr_count( $feed, 'http' );
$feed = preg_replace( "#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $feed );
$feed = preg_replace( "#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $feed );
$feed = preg_replace( "/@(\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $feed );
$feed = preg_replace( "/#(\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $feed );
$output .= sprintf('
<li class="relative"><a href="http://www.twitter.com/%3$s" title="%4$s"><i class="fa fa-twitter"></i></a><div class="tweet-post padding-left48">%1$s</div>%2$s</li>', $feed, darkone_time_ago( strtotime( $data[($i-1)]->created_at ) ), $user, __('Visit us on twitter.com', 'darkone') );
}
$i++;
}
$output .= '</ul>';
set_transient( $transient_key, $output, 1800 );
set_transient( $transient_key.'_backup', $output );
return $output;
else :
$cached = get_transient( $transient_key.'_backup' );
if ( false !== $cached ) {
return $cached .= "\n" . '<!-- Returned from backup cache -->';
}
else {
return __('Twitter unaviable', 'darkone');
}
endif;
}
endif;
/*
* Time Ago
*/
if ( !function_exists('darkone_time_ago') ) :
function darkone_time_ago($date) {
$chunks = array(
array( 60 * 60 * 24 * 365 , __( 'year', 'darkone' ), __( 'years', 'darkone' ) ),
array( 60 * 60 * 24 * 30 , __( 'month', 'darkone' ), __( 'months', 'darkone' ) ),
array( 60 * 60 * 24 * 7, __( 'week', 'darkone' ), __( 'weeks', 'darkone' ) ),
array( 60 * 60 * 24 , __( 'day', 'darkone' ), __( 'days', 'darkone' ) ),
array( 60 * 60 , __( 'hour', 'darkone' ), __( 'hours', 'darkone' ) ),
array( 60 , __( 'minute', 'darkone' ), __( 'minutes', 'darkone' ) ),
array( 1, __( 'second', 'darkone' ), __( 'seconds', 'darkone' ) )
);
if ( !is_numeric( $date ) ) {
$time_chunks = explode( ':', str_replace( ' ', ':', $date ) );
$date_chunks = explode( '-', str_replace( ' ', '-', $date ) );
$date = gmmktime( (int)$time_chunks[1], (int)$time_chunks[2], (int)$time_chunks[3], (int)$date_chunks[1], (int)$date_chunks[2], (int)$date_chunks[0] );
}
$current_time = current_time( 'mysql', $gmt = 0 );
$newer_date = strtotime( $current_time );
$since = $newer_date - $date;
if ( 0 > $since )
return __( 'sometime', 'darkone' );
for ( $i = 0, $j = count($chunks); $i < $j; $i++) {
$seconds = $chunks[$i][0];
if ( ( $count = floor($since / $seconds) ) != 0 )
break;
}
$output = ( 1 == $count ) ? '1 <span class="text-ago">'. $chunks[$i][1] : $count . ' <span class="text-ago">' . $chunks[$i][2];
if ( !(int)trim($output) ){
$output = '0' . __( 'seconds', 'darkone' );
}
$output .= __(' ago', 'darkone').'</span>';
return $output;
}
endif;
/*
* Contact Form
*/
if ( !function_exists('darkone_contact_form') ) :
function darkone_contact_form( $users = '1', $margin = ' style="margin-bottom:20px"' ) {
global $darkone_data, $darkone_contact_form_id;
if ( isset( $darkone_data['contact'] ) ) $contact_options = $darkone_data['contact'];
if ( isset ( $darkone_contact_form_id ) == false ) {
global $darkone_contact_form_id;
$darkone_contact_form_id = 1;
}
if( isset( $_POST['submitted-' . $darkone_contact_form_id] ) ) {
if( trim( $_POST['contactCaptcha'] ) === '' ) {
$captchaError = '<small>' . __( 'Please try again. Thank you!', 'darkone' ) . '</small>';
$hasError = true;
}
elseif ( intval( $_POST['contactCaptcha'] ) !== intval( $_POST['contactCaptchaHid'] ) ) {
$captchaError = '<small>' . __( 'Please try again. Thank you!', 'darkone' ) . '</small>';
$hasError = true;
}
if( trim( $_POST['contactName'] ) === '' ) {
$nameError = '<small>' . __( 'Please enter your name', 'darkone' ) . '</small>';
$hasError = true;
} else {
$name = wp_strip_all_tags(trim( $_POST['contactName'] ));
}
if( trim( $_POST['contactEmail'] ) === '' ) {
$emailError = '<small>' . __( 'Please enter your email address', 'darkone' ) . '</small>';
$hasError = true;
} else if ( !preg_match( "/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim( $_POST['contactEmail'] ) ) ) {
$emailError = '<small>' . __('You entered an invalid email address', 'darkone') . '</small>';
$hasError = true;
} else {
$email = trim( $_POST['contactEmail'] );
}
if( trim( $_POST['contactWebsite'] ) !== '' ) {
$website = esc_url(trim( $_POST['contactWebsite'] ));
}
if( trim( $_POST['commentsText'] ) === '' ) {
$commentError = '<small>' . __( 'Please enter a message', 'darkone' ) . '</small>';
$hasError = true;
} else {
if ( function_exists( 'stripslashes' ) ) {
$comments = wp_strip_all_tags(stripslashes( trim( $_POST['commentsText'] ) ));
} else {
$comments = wp_strip_all_tags(trim( $_POST['commentsText'] ));
}
}
if ( !isset( $hasError ) ) {
if ( $_POST['contactEmailSend'] == 'main' ) : $emailTo = $darkone_data['main_contact']['email']; else : $emailTo = $contact_options[$_POST['contactEmailSend']]['email']; endif;
$subject = get_bloginfo('name').' / From ' . $name;
$body = "Name: $name \n\nEmail: $email \n\nWebsite: $website \n\nComments: $comments";
$headers = 'From: ' . $name . ' <' . $emailTo . '>' . "\r\n" . 'Reply-To: ' . $email;
wp_mail( $emailTo, $subject, $body, $headers );
$emailSent = true;
}
}
$output = '';
$contactName = '';
$contactEmail = '';
$contactWebsite = '';
$commentsText = '';
$output .= sprintf( '<div class="contact_form_wrapper"%1$s>', $margin );
if( isset( $emailSent ) && $emailSent == true ) {
if ( $darkone_data['contactform_message'] == '' ) {
$output .= '<div class="success"><div class="margin-bottom20"><img src="'.$darkone_data['logo'].'"/></div><i class="fa fa-thumbs-up"></i> '. __( 'Thanks, your email was sent successfully!', 'darkone' ).'</div>';
}
else $output .= $darkone_data['contactform_message'];
}
else {
$permlink = get_permalink();
if( isset( $hasError ) ) {
$output .= '<span class="error send block"><small><i class="fa fa-exclamation color-red"></i> '.__( 'Sorry, an error occured', 'darkone' ).'</small></span>';
}
$output .= sprintf( '<form action="%1$s#darkone_cform" id="darkone_cform" class="comment_form contact_form" method="post">', $permlink );
$output .= '<div class="input_wrapper_select margin-bottom20">';
if ( $darkone_data['contact'] ) :
$i = 1;
$users_array = explode( ',', $users );
if ( !is_array ( $users_array ) ) { $users_array[] = $users; }
$curr_count = count($users_array);
$output .= '<div><select name="contactEmailSend" class="input_field_select block" '.( $curr_count == 1 ? 'disabled' : '' ).'>';
foreach ( $contact_options as $option ) {
if ( in_array ( $i, $users_array ) ) { $output .= '<option value="'. $i .'">'. $option['name'] .'</option>'; }
$i++;
}
$output .= '</select></div>';
endif;
$output .= '</div>';
if ( isset( $_POST['contactEmail'] ) ) $contactEmail = esc_attr($_POST['contactEmail']);
$output .= '<div class="input_wrapper">';
if( isset( $emailError ) ) {
$output .= '<span class="error block margin_altered"><i class="fa fa-exclamation color-red"></i> '. $emailError .'</span>';
}
$output .= sprintf('<input type="text" name="contactEmail" class="input_field block margin-bottom20" value="%1$s" placeholder="%2$s"/>', $contactEmail, __('EMAIL ADDRESS', 'darkone') );
$output .= '</div>';
if ( isset( $_POST['contactName'] ) ) $contactName = esc_attr($_POST['contactName']);
$output .= '<div class="input_wrapper">';
if( isset( $nameError ) ) {
$output .= '<span class="error block"><i class="fa fa-exclamation color-red"></i> '. $nameError .'</span>';
}
$output .= sprintf('<input type="text" name="contactName" class="input_field block margin-bottom20" value="%1$s" placeholder="%2$s"/>', $contactName, __('NAME', 'darkone') );
$output .= '</div>';
if ( isset( $_POST['contactWebsite'] ) ) $contactWebsite = esc_url($_POST['contactWebsite']);
$output .= '<div class="input_wrapper">';
if( isset( $nameError ) ) {
$output .= '<span class="error block"><i class="fa fa-blank"></i></span>';
}
$output .= sprintf('<input type="text" name="contactWebsite" class="input_field block margin-bottom20" value="%1$s" placeholder="%2$s"/>', $contactWebsite, __('WEBSITE', 'darkone') );
$output .= '</div>';
if( isset( $_POST['commentsText'] ) ) { if ( function_exists( 'stripslashes' ) ) { $commentsText = wp_strip_all_tags(stripslashes( $_POST['commentsText'] )); } else { $commentsText = wp_strip_all_tags($_POST['commentsText']); } }
$output .= '<textarea name="commentsText" class="textarea_field block margin-bottom20" placeholder="'.__('MESSAGE GOES HERE (MAX 300 CHARS)', 'darkone').'">'. $commentsText .'</textarea>';
if( isset( $commentError ) ) {
$output .= '<span class="error block"><i class="fa fa-exclamation color-red"></i> '. $commentError .'</span>';
}
$output .= '<input type="hidden" name="submitted-'. $darkone_contact_form_id .'" value="true" />';
$output .= '<div class="darkone_captcha_wrap float_left">';
$rand = rand(0,10);
$rand2 = rand(0,10);
$output .= '<p class="float_left">'.$rand.' + '.$rand2.' =</p>';
$output .= '<div class="input_wrapper darkone_captcha">';
$output .= '<input name="contactCaptcha" class="darkone_button block bg_color_default bg_color_main_hover color_white float_left" type="text" value="" />';
$output .= '<input name="contactCaptchaHid" class="darkone_button block bg_color_default bg_color_main_hover color_white float_left" type="hidden" value="'. ($rand + $rand2).'" />';
$output .= '</div></div>';
$output .= '<input class="darkone_button block bg_color_default bg_color_main_hover color_white float_right" type="submit" value="'.__('Send Email', 'darkone').'" />';
$output .= '<div class="clearfix"></div>';
if( isset( $captchaError ) ) {
$output .= '<span class="error block"><i class="fa fa-exclamation color-red"></i> '. $captchaError .'</span>';
}
$output .= '</form>';
}
$output .= '</div>';
$darkone_contact_form_id++;
return $output;
}
endif;
/**
* Get content with formatting
*/
if ( !function_exists('get_the_content_with_formatting') ) :
function get_the_content_with_formatting ($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
endif;
/**
* Custom excerpt lenght
*/
if ( !function_exists('custom_excerpt_length') ) :
function custom_excerpt_length( $length ) {
return 999;
}
endif;
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
/**
* Time difference
*/
if ( !function_exists('time_difference') ) :
function time_difference($time_diff) {
$args = array(
'posts_per_page' => 1,
'offset' => 0,
'orderby' => 'date',
'order' => 'ASC',
'post_type' => 'post',
'post_status' => 'publish',
'suppress_filters' => true
);
$first_post = get_posts($args);
$date = $first_post[0]->post_date_gmt;
$chunks = array(
'years' => array( 60 * 60 * 24 * 365 ),
'months' => array( 60 * 60 * 24 * 30 ),
'weeks' => array( 60 * 60 * 24 * 7 ),
'days' => array( 60 * 60 * 24 )
);
if ( !is_numeric( $date ) ) {
$time_chunks = explode( ':', str_replace( ' ', ':', $date ) );
$date_chunks = explode( '-', str_replace( ' ', '-', $date ) );
$date = gmmktime( (int)$time_chunks[1], (int)$time_chunks[2], (int)$time_chunks[3], (int)$date_chunks[1], (int)$date_chunks[2], (int)$date_chunks[0] );
}
$current_time = current_time( 'mysql', $gmt = 0 );
$newer_date = strtotime( $current_time );
$since = $newer_date - $date;
if ( 0 > $since )
return __( 'sometime', 'darkone' );
$seconds = $chunks[$time_diff][0];
$count = floor($since / $seconds);
$output = ( 1 == $count ) ? '1' : $count;
return $output;
}
endif;
/**
* Posts metaboxes
*/
add_action( 'load-post.php', 'darkone_page_meta_boxes_setup' );
add_action( 'load-post-new.php', 'darkone_page_meta_boxes_setup' );
/**
* Post Types
*/
if ( !function_exists('darkone_page_meta_boxes_setup') ) :
function darkone_page_meta_boxes_setup() {
add_action( 'add_meta_boxes', 'darkone_add_page_meta_boxes' );
add_action( 'save_post', 'darkone_save_page_meta_boxes', 10, 2 );
}
endif;
/**
* Post Types
*/
if ( !function_exists('darkone_add_page_meta_boxes') ) :
function darkone_add_page_meta_boxes() {
add_meta_box(
'darkone-revolution',
esc_html__( 'Darkone Full Width Revolution Slider', 'darkone' ),
'darkone_revolution',
'page',
'normal',
'high'
);
add_meta_box(
'darkone-page-options',
esc_html__( 'Darkone Page Options', 'darkone' ),
'darkone_page_options',
'page',
'side',
'default'
);
add_meta_box(
'darkone-post-options',
esc_html__( 'Darkone Post Options', 'darkone' ),
'darkone_post_options',
'post',
'side',
'default'
);
add_meta_box(
'darkone-post-type',
__('Darkone Post Type Settings', 'darkone'),
'darkone_post_type',
'post',
'side',
'default'
);
}
endif;
/**
* Post Types
*/
if ( !function_exists('darkone_post_type') ) :
function darkone_post_type( $object, $box ) { ?>
<p>
<h4><?php _e('Video', 'darkone'); ?></h4>
<label for="darkone-video-override"><?php _e( "Set featured area video embed (MP4)", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-video-override" id="darkone-video-override"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_video_override', true ) ); ?></textarea>
</p>
<p>
<label for="darkone-video-override"><?php _e( "Set featured area video embed (OGG)", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-video-override-ogg" id="darkone-video-override-ogg"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_video_override_ogg', true ) ); ?></textarea>
</p>
<p>
<label for="darkone-video-override"><?php _e( "Set featured area video embed from site", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-video-override-site" id="darkone-video-override-site"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_video_override_site', true ) ); ?></textarea>
</p>
<p>
<h4><?php _e('Audio', 'darkone'); ?></h4>
<label for="darkone-audio-override"><?php _e( "Set featured area audio embed", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-audio-override" id="darkone-audio-override"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_audio_override', true ) ); ?></textarea>
</p>
<p>
<label for="darkone-audio-override"><?php _e( "Set featured area audio embed (ogg)", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-audio-override-ogg" id="darkone-audio-override-ogg"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_audio_override_ogg', true ) ); ?></textarea>
</p>
<p>
<label for="darkone-audio-override"><?php _e( "Set featured area audio embed from site", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-audio-override-site" id="darkone-audio-override-site"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_audio_override_site', true ) ); ?></textarea>
</p>
<p>
<h4><?php _e('Gallery', 'darkone'); ?></h4>
<label for="darkone-gallery-override"><?php _e( "Override default post gallery", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-gallery-override" id="darkone-gallery-override"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_gallery_override', true ) ); ?></textarea>
</p>
<p>
<h4><?php _e('Link', 'darkone'); ?></h4>
<label for="darkone-link-override"><?php _e( "Set featured area link", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-link-override" id="darkone-link-override"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_link_override', true ) ); ?></textarea>
</p>
<?php }
endif;
/**
* Revolution Slider Metabox
*/
if ( !function_exists('darkone_revolution') ) :
function darkone_revolution( $object, $box ) { ?>
<?php wp_nonce_field( basename( __FILE__ ), 'darkone_nonce' ); ?>
<?php
if ( DARKONE_REVSLIDER === true ) {
global $wpdb;
$revsliders = array( 'none' );
$current = get_post_meta( $object->ID, 'darkone_revolution', true );
if ( $current == '' ) {
$current = 'none';
}
$get_sliders = $wpdb->get_results('SELECT * FROM '.$wpdb->prefix.'revslider_sliders');
if($get_sliders) {
foreach($get_sliders as $slider) {
$revsliders[$slider->alias] = $slider->alias;
}
}
else {
$revsliders = array ( 'none' => 'none' );
}
}
else {
$revsliders = array ( 'none' => 'none' );
}
?>
<p>
<label for="darkone-revolution"><?php _e( "Select Revolution Slider template to use one this page. This slider will be shown just bellow main navigation in full width.", 'darkone' ); ?></label>
<br /><br />
<select name="darkone-revolution" id="darkone-revolution">
<?php
foreach ( $revsliders as $slider ) :
printf( '<option value="%1$s" %2$s>%1$s</option>', $slider, ( ( $slider == $current ) ? 'selected' : '' ) );
endforeach;
?>
</select>
</p>
<?php }
function darkone_page_options( $object, $box ) { ?>
<p>
<label for="darkone-padding"><input value="" type="checkbox" name="darkone-padding" id="darkone-padding" <?php if ( 1 == get_post_meta( $object->ID, 'darkone_padding', true ) ) echo 'checked="checked"'; ?>> <?php _e( "Remove page padding", 'darkone' ); ?></label>
</p>
<p>
<label for="darkone-breadcrumbs"><input value="" type="checkbox" name="darkone-breadcrumbs" id="darkone-breadcrumbs" <?php if ( 1 == get_post_meta( $object->ID, 'darkone_breadcrumbs', true ) ) echo 'checked="checked"'; ?>> <?php _e( "Hide breadcrumbs", 'darkone' ); ?></label>
</p>
<p>
<hr/>
<?php _e('Override default page background', 'darkone'); ?>
</p>
<p>
<label for="darkone-page-bg"><?php _e( "Select background type", 'darkone' ); ?> :</label>
<?php
$feat_areas = array (
'none' => __('None', 'darkone'),
'html5video' => __('HTML5 Video', 'darkone'),
'videoembed' => __('Youtube Video Embed', 'darkone')
);
$current = get_post_meta( $object->ID, 'darkone_page_bg', true );
if ( $current == '' ) {
$current = 'none';
}
foreach ( $feat_areas as $s => $v ) :
?>
<br />
<input type="radio" name="darkone-page-bg" id="darkone-page-bg" value="<?php echo $s; ?>" <?php echo ( ( $s == $current ) ? 'checked' : '' ); ?>/> <?php echo $v; ?>
<?php endforeach; ?>
</p>
<p>
<label for="darkone-pagevideo-mp4"><?php _e( "Enter video URL (MP4).", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-pagevideo-mp4" id="darkone-pagevideo-mp4"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_pagevideo_mp4', true ) ); ?></textarea>
</p>
<p>
<label for="darkone-pagevideo-ogv"><?php _e( "Enter video URL (OGV).", 'darkone' ); ?></label>
<br />
<textarea class="widefat" type="text" name="darkone-pagevideo-ogv" id="darkone-pagevideo-ogv"><?php echo esc_attr( get_post_meta( $object->ID, 'darkone_pagevideo_ogv', true ) ); ?></textarea>
</p>
<p>
<label for="darkone-pagevideo-embed"><?php _e( "Enter Youtube Video ID / Youtube Embed.", 'darkone' ); ?></label>
<br />
<input class="widefat" type="text" name="darkone-pagevideo-embed" id="darkone-pagevideo-embed" value="<?php echo esc_attr( get_post_meta( $object->ID, 'darkone_pagevideo_embed', true ) ); ?>" / >
</p>
<?php
$mute = get_post_meta( $object->ID, 'darkone_pagevideo_embed_mute', true );
?>
<p>
<label for="darkone-pagevideo-embed-mute"><input value="" type="checkbox" name="darkone-pagevideo-embed-mute" id="darkone-pagevideo-embed-mute" <?php if ( 1 == $mute ) echo 'checked="checked"'; ?>> <?php _e( "Mute Youtube Video", 'darkone' ); ?></label>
</p>
<?php
$loop = get_post_meta( $object->ID, 'darkone_pagevideo_embed_loop', true );
?>
<p>
<label for="darkone-pagevideo-embed-loop"><input value="" type="checkbox" name="darkone-pagevideo-embed-loop" id="darkone-pagevideo-embed-loop" <?php if ( 1 == $loop ) echo 'checked="checked"'; ?>> <?php _e( "Loop Youtube Video", 'darkone' ); ?></label>
</p>
<?php
$hd = get_post_meta( $object->ID, 'darkone_pagevideo_embed_hd', true );
?>
<p>
<label for="darkone-pagevideo-embed-hd"><input value="" type="checkbox" name="darkone-pagevideo-embed-hd" id="darkone-pagevideo-embed-hd" <?php if ( 1 == $hd ) echo 'checked="checked"'; ?>> <?php _e( "HD Youtube Video", 'darkone' ); ?></label>
</p>
<?php
}
endif;
/**
* Revolution Post Options
*/
if ( !function_exists('darkone_post_options') ) :
function darkone_post_options( $object, $box ) {
global $darkone_data;
?>
<?php wp_nonce_field( basename( __FILE__ ), 'darkone_nonce' ); ?>
<?php
$hide_feat = get_post_meta( $object->ID, 'darkone_hide_featarea', true );
$hide_feat = ( $hide_feat == '' ? $darkone_data['darkone_hide_featarea'] : $hide_feat );
?>
<p>
<label for="darkone-hide-featarea"><input value="" type="checkbox" name="darkone-hide-featarea" id="darkone-hide-featarea" <?php if ( 1 == $hide_feat ) echo 'checked="checked"'; ?>> <?php _e( "Hide featured area", 'darkone' ); ?></label>
</p>
<?php
$hide_title = get_post_meta( $object->ID, 'darkone_hide_title', true );
$hide_title = ( $hide_title == '' ? $darkone_data['darkone_hide_title'] : $hide_title );
?>
<p>
<label for="darkone-hide-title"><input value="" type="checkbox" name="darkone-hide-title" id="darkone-hide-title" <?php if ( 1 == $hide_title ) echo 'checked="checked"'; ?>> <?php _e( "Hide title", 'darkone' ); ?></label>
</p>
<?php
$hide_meta = get_post_meta( $object->ID, 'darkone_hide_meta', true );
$hide_meta = ( $hide_meta == '' ? $darkone_data['darkone_hide_meta'] : $hide_meta );
?>
<p>
<label for="darkone-hide-meta"><input value="" type="checkbox" name="darkone-hide-meta" id="darkone-hide-meta" <?php if ( 1 == $hide_meta ) echo 'checked="checked"'; ?>> <?php _e( "Hide postmeta", 'darkone' ); ?></label>
</p>
<?php
$hide_tags = get_post_meta( $object->ID, 'darkone_hide_tags', true );
$hide_tags = ( $hide_tags == '' ? $darkone_data['darkone_hide_tags'] : $hide_tags );
?>
<p>
<label for="darkone-hide-tags"><input value="" type="checkbox" name="darkone-hide-tags" id="darkone-hide-tags" <?php if ( 1 == $hide_tags ) echo 'checked="checked"'; ?>> <?php _e( "Hide tags", 'darkone' ); ?></label>
</p>
<?php
$hide_author = get_post_meta( $object->ID, 'darkone_hide_author', true );
$hide_author = ( $hide_author == '' ? $darkone_data['darkone_hide_author'] : $hide_author );
?>
<p>
<label for="darkone-hide-author"><input value="" type="checkbox" name="darkone-hide-author" id="darkone-hide-author" <?php if ( 1 == $hide_author ) echo 'checked="checked"'; ?>> <?php _e( "Hide author", 'darkone' ); ?></label>
</p>
<?php
$hide_share = get_post_meta( $object->ID, 'darkone_hide_share', true );
$hide_share = ( $hide_share == '' ? $darkone_data['darkone_hide_share'] : $hide_share );
?>
<p>
<label for="darkone-hide-share"><input value="" type="checkbox" name="darkone-hide-share" id="darkone-hide-share" <?php if ( 1 == $hide_share ) echo 'checked="checked"'; ?>> <?php _e( "Hide social share", 'darkone' ); ?></label>
</p>
<?php
$hide_nav = get_post_meta( $object->ID, 'darkone_hide_navigation', true );
$hide_nav = ( $hide_nav == '' ? $darkone_data['darkone_hide_navigation'] : $hide_nav );
?>
<p>
<label for="darkone-padding"><input value="" type="checkbox" name="darkone-padding" id="darkone-padding" <?php if ( 1 == get_post_meta( $object->ID, 'darkone_padding', true ) ) echo 'checked="checked"'; ?>> <?php _e( "Remove page padding", 'darkone' ); ?></label>
</p>
<p>
<label for="darkone-hide-sidebar"><input value="" type="checkbox" name="darkone-hide-sidebar" id="darkone-hide-sidebar" <?php if ( 1 == get_post_meta( $object->ID, 'darkone_hide_sidebar', true ) ) echo 'checked="checked"'; ?>> <?php _e( "Hide default single post sidebar", 'darkone' ); ?></label>
</p>
<?php }
endif;
/**
* Save Metaboxes
*/
if ( !function_exists('darkone_save_page_meta_boxes') ) :
function darkone_save_page_meta_boxes( $post_id, $post ) {
if ( !isset( $_POST['darkone_nonce'] ) || !wp_verify_nonce( $_POST['darkone_nonce'], basename( __FILE__ ) ) )
return $post_id;
$post_type = get_post_type_object( $post->post_type );
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
return $post_id;
$new_meta_values = array();
$new_meta_values[] = ( isset( $_POST['darkone-revolution'] ) ? $_POST['darkone-revolution'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-padding'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-hide-featarea'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-hide-title'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-hide-meta'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-hide-tags'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-hide-author'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-hide-share'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-hide-sidebar'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-video-override'] ) ? $_POST['darkone-video-override'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-video-override-ogg'] ) ? $_POST['darkone-video-override-ogg'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-video-override-site'] ) ? $_POST['darkone-video-override-site'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-audio-override'] ) ? $_POST['darkone-audio-override'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-audio-override-ogg'] ) ? $_POST['darkone-audio-override-ogg'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-audio-override-site'] ) ? $_POST['darkone-audio-override-site'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-gallery-override'] ) ? $_POST['darkone-gallery-override'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-link-override'] ) ? $_POST['darkone-link-override'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-page-bg'] ) ? $_POST['darkone-page-bg'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-pagevideo-mp4'] ) ? $_POST['darkone-pagevideo-mp4'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-pagevideo-ogv'] ) ? $_POST['darkone-pagevideo-ogv'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-pagevideo-embed'] ) ? $_POST['darkone-pagevideo-embed'] : '' );
$new_meta_values[] = ( isset( $_POST['darkone-pagevideo-embed-mute'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-pagevideo-embed-loop'] ) ? 1 : 0 );
$new_meta_values[] = ( isset( $_POST['darkone-pagevideo-embed-hd'] ) ? 1 : 0 );
$meta_keys = array();
$meta_keys[] = 'darkone_revolution';
$meta_keys[] = 'darkone_padding';
$meta_keys[] = 'darkone_hide_featarea';
$meta_keys[] = 'darkone_hide_title';
$meta_keys[] = 'darkone_hide_meta';
$meta_keys[] = 'darkone_hide_tags';
$meta_keys[] = 'darkone_hide_author';
$meta_keys[] = 'darkone_hide_share';
$meta_keys[] = 'darkone_hide_sidebar';
$meta_keys[] = 'darkone_video_override';
$meta_keys[] = 'darkone_video_override_ogg';
$meta_keys[] = 'darkone_video_override_site';
$meta_keys[] = 'darkone_audio_override';
$meta_keys[] = 'darkone_audio_override_ogg';
$meta_keys[] = 'darkone_audio_override_site';
$meta_keys[] = 'darkone_gallery_override';
$meta_keys[] = 'darkone_link_override';
$meta_keys[] = 'darkone_page_bg';
$meta_keys[] = 'darkone_pagevideo_mp4';
$meta_keys[] = 'darkone_pagevideo_ogv';
$meta_keys[] = 'darkone_pagevideo_embed';
$meta_keys[] = 'darkone_pagevideo_embed_mute';
$meta_keys[] = 'darkone_pagevideo_embed_loop';
$meta_keys[] = 'darkone_pagevideo_embed_hd';
$meta_values = array();
$i = 0;
foreach ( $meta_keys as $meta_key ) {
$meta_value = get_post_meta( $post_id, $meta_key, true );
if ( $new_meta_values[$i] && '' == $meta_value )
add_post_meta( $post_id, $meta_key, $new_meta_values[$i], true );
elseif ( $new_meta_values[$i] && $new_meta_values[$i] != $meta_value )
update_post_meta( $post_id, $meta_key, $new_meta_values[$i] );
elseif ( '' == $new_meta_values[$i] && $meta_value )
delete_post_meta( $post_id, $meta_key, $meta_value );
$i++;
}
}
endif;
/**
* Frontend Builder Activate
*/
if ( !function_exists('darkone_factive') ) :
function darkone_factive() {
global $fbuilder, $darkone_data;
$options = array (
'bottom_margin' => $darkone_data['fb_bmargin'],
'high_rezolution_width' => $darkone_data['content_width'],
'high_rezolution_margin' => $darkone_data['fb_hres_c'],
'med_rezolution_width' => $darkone_data['fb_mres_w'],
'med_rezolution_margin' => $darkone_data['fb_mres_c'],
'med_rezolution_hide_sidebar' => ( $darkone_data['fb_mres_s'] == 1 ) ? 'true' : 'false',
'low_rezolution_width' => $darkone_data['fb_lres_w'],
'low_rezolution_margin' => $darkone_data['fb_lres_c'],
'low_rezolution_hide_sidebar' => ( $darkone_data['fb_lres_s'] == 1 ) ? 'true' : 'false',
'main_color' => $darkone_data['theme_color'],
'light_main_color' => $darkone_data['theme_color'],
'text_color' => $darkone_data['theme_color_textt'],
'title_color' => $darkone_data['theme_color_dark'],
'dark_back_color' => $darkone_data['theme_color_dark'],
'light_back_color' => $darkone_data['theme_color_palee'],
'dark_border_color' => $darkone_data['theme_color_dark'],
'light_border_color' => $darkone_data['theme_color_palee']
);
$fbuilder->set_options($options);
}
endif;
add_action('fbuilder_activate', 'darkone_factive');
/**
* Get Featured Area
*/
if ( !function_exists('darkone_get_featarea') ) :
function darkone_get_featarea( $feat_type )
{
$type = get_post_format();
$html = '';
if($type != '')
{
$result;
switch ($type) {
case 'audio':
$darkone_audio_override = get_post_meta(get_the_ID(),'darkone_audio_override',true);
$darkone_audio_override_ogg = get_post_meta(get_the_ID(),'darkone_audio_override_ogg',true);
if(($darkone_audio_override !== 'none' && $darkone_audio_override !== '') || ($darkone_audio_override_ogg !== 'none' && $darkone_audio_override_ogg !== ''))
{
$add_poster = ( has_post_thumbnail() ? wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), $feat_type ) : '' );
$html = '<div class="darkone_div_featarea darkone_div_feat_'.$type.' margin-bottom24">';
$html .= sprintf('<audio class="fullwidth block" preload="auto" loop="loop" controls%4$s>
<source src="%1$s" type="audio/mpeg">
<source src="%2$s" type="audio/ogg">
%3$s
</audio>',$darkone_audio_override,$darkone_audio_override_ogg, __( 'Your browser does not support the audio tag.', 'darkone' ), ( $add_poster !== '' ? ' poster="'.$add_poster[0].'" data-image-replacement="'.$add_poster[0].'"' : ''));
}
else{
$darkone_audio_override = get_post_meta(get_the_ID(),'darkone_audio_override_site',true);
if($darkone_audio_override !== 'none' && $darkone_audio_override !== '')
{
$html = '<div class="darkone_div_featarea darkone_div_feat_'.$type.' margin-bottom24">';
$html .= sprintf('%1$s',$darkone_audio_override);
}
}
break;
case 'gallery':
if ( DARKONE_FBUILDER === true ) :
$images = get_attached_media( 'image' );
if ( $feat_type == 'large' ) { $feat_type = 'darkone-fullblog'; }
$old_gallery_shortcode = get_post_meta(get_the_ID(),'darkone_gallery_override',true);
$shortcode = '[fbuilder_slider ';
$ctype = 'ctype="';
$image_url = 'image="';
$image_link = 'image_link="';
$image_link_type = 'image_link_type="';
$shortcode_html = 'html="';
$text_align = 'text_align="';
$back_color = 'back_color="';
$text_color = 'text_color="';
$randId = rand();
if($old_gallery_shortcode != 'none' && $old_gallery_shortcode != '')
{
$html = '<div class="darkone_div_featarea darkone_div_feat_'.$type.' margin-bottom24 fbuilder_module" data-modid="'.$randId.'">';
$old_gallery_shortcode = explode(' ',$old_gallery_shortcode);
$old_ids;
$num = count($old_gallery_shortcode);
for($i=0; $i<count($old_gallery_shortcode); $i++ )
{
$old_gallery_shortcode[$i] = explode('="',$old_gallery_shortcode[$i]);
}
$num = count($old_gallery_shortcode);
for($i=0; $i<count($old_gallery_shortcode); $i++ )
{
if($old_gallery_shortcode[$i][0] == 'ids')
$old_ids = explode(',',$old_gallery_shortcode[$i][1]);
}
$i = 0;
$last_id = explode('"',$old_ids[count($old_ids)-1]);
$old_ids[count($old_ids)-1] = $last_id[0];
$num_of_images = count($old_ids);
foreach ($old_ids as $old_id) {
$i++;
$ctype .= 'image';
$result = wp_get_attachment_image_src( intval($old_id), $feat_type);
$image_url .= sprintf('%1$s',$result[0]);
$image_link .= sprintf('%1$s',$result[0]);
$image_link_type .= 'lightbox-image';
$shortcode_html .= '';
$text_align .= '';
$back_color .= '';
$text_color .= '';
if($i<$num_of_images)
{
$ctype .= '|';
$image_url .= '|';
$image_link .= '|';
$image_link_type .= '|';
$shortcode_html .= '|';
$text_align .= '|';
$back_color .= '|';
$text_color .= '|';
}
else
{
$ctype .= '" ';
$image_url .= '" ';
$image_link .= '" ';
$image_link_type .= '" ';
$shortcode_html .= '" ';
$text_align .= '" ';
$back_color .= '" ';
$text_color .= '" ';
}
}
}
else if ( !empty($images) ){
$i = 0;
$images = get_attached_media( 'image' );
$num_of_images = count($images);
if ( !is_array($images) ) break;
$html = '<div class="darkone_div_featarea darkone_div_feat_'.$type.' margin-bottom24 fbuilder_module" data-modid="'.$randId.'">';
foreach ($images as $image) {
$i++;
$ctype .= 'image';
$result = wp_get_attachment_image_src( $image->ID, $feat_type);
$image_url .= sprintf('%1$s',$result[0]);
$image_link .= sprintf('%1$s|',$result[0]);
$image_link_type .= 'lightbox-image';
$shortcode_html .= '';
$text_align .= '';
$back_color .= '';
$text_color .= '';
if($i<$num_of_images)
{
$ctype .= '|';
$image_url .= '|';
$image_link .= '|';
$image_link_type .= '|';
$shortcode_html .= '|';
$text_align .= '|';
$back_color .= '|';
$text_color .= '|';
}
else
{
$ctype .= '" ';
$image_url .= '" ';
$image_link .= '" ';
$image_link_type .= '" ';
$shortcode_html .= '" ';
$text_align .= '" ';
$back_color .= '" ';
$text_color .= '" ';
}
}
}
else {
$html = '';
break;
}
$shortcode .= sprintf('%1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s auto_play="false" bot_margin=24 navigation="squared" pagination="false"][/fbuilder_slider]', $ctype, $image_url, $image_link, $image_link_type, $shortcode_html, $text_align, $back_color, $text_color);
$html .= do_shortcode($shortcode);
endif;
break;
case 'image':
if ( has_post_thumbnail() ) {
$html = '<div class="darkone_div_featarea darkone_div_feat_'.$type.' margin-bottom24">';
$html .= get_the_post_thumbnail(get_the_ID(),$feat_type);
$kklike = '';
if ( in_array( 'kk-i-like-it/admin.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
$kklike = '<div class="darkone_image_hover_button darkone_div_button_like inline-block">'.do_shortcode('[kklike_button]').'</div>';
}
$html .= sprintf( '<div class="darkone_image_hover"><div><a href="%1$s" class="darkone_image_hover_button darkone_div_button_link"><i class="br0 br0-plus"></i></a><a href="%2$s" class="darkone_image_hover_button darkone_div_button_zoom" rel="lightbox"><i class="br0 br0-search"></i></a>%3$s</div></div>', get_permalink(), wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) ), $kklike );
}
break;
case 'video':
$result = array();
$darkone_video_override = get_post_meta(get_the_ID(),'darkone_video_override',true);
$darkone_video_override_ogg = get_post_meta(get_the_ID(),'darkone_video_override_ogg',true);
$result = get_post_meta(get_the_ID(),'darkone_video_override_site',true);
if(($darkone_video_override !== 'none' && $darkone_video_override !== '') || ($darkone_video_override_ogg !== 'none' && $darkone_video_override_ogg !== ''))
{
$add_poster = ( has_post_thumbnail() ? wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), $feat_type ) : '' );
$html = '<div class="darkone_div_featarea darkone_div_feat_'.$type.' margin-bottom24">';
$html .= sprintf('<div class="video"><video class="fullwidth block" preload="auto" loop="loop" controls%4$s>
<source src="%1$s" type="video/mp4">
<source src="%2$s" type="video/ogg">
%3$s
</video></div>',$darkone_video_override,$darkone_video_override_ogg, __( 'Your browser does not support the video tag.', 'darkone' ), ( $add_poster !== '' ? ' poster="'.$add_poster[0].'" data-image-replacement="'.$add_poster[0].'"' : ''));
}
else if (($result !== 'none' && $result !== ''))
{
if ($result !== 'none' || $result !== '')
{
$html = '<div class="darkone_div_featarea darkone_div_feat_'.$type.' margin-bottom24">';
$html .= sprintf('%1$s', $result);
}
}
break;
case 'link':
$result = get_post_meta(get_the_ID(),'darkone_link_override',true);
if($result !== 'none' && $result !== '') {
$html = '<div class="darkone_div_featarea darkone_div_feat_link margin-bottom24">';
$html .= get_the_post_thumbnail(get_the_ID(),$feat_type);
$html .= sprintf( '<div class="darkone_image_hover"><div><a href="%2$s" class="darkone_image_hover_button" rel="bookmark"><i class="br0 br0-search"></i></a><a href="%1$s" class="darkone_image_hover_button"><i class="br0 br0-plus"></i></a></div></div>', get_permalink(), $result );
}
break;
case 'quote':
$html = '<div class="darkone_div_featarea darkone_div_feat_quote margin-bottom24 darkone_header_font darkone_theme_color">';
$html .= sprintf( '%1$s', get_the_content() );
break;
default:
if ( has_post_thumbnail() ) {
$html = '<div class="darkone_div_featarea darkone_div_feat_'.$type.' margin-bottom24">';
$html .= get_the_post_thumbnail(get_the_ID(),$feat_type);
}
break;
default :
die( __('No type set', 'darkone') );
}
}
else {
if ( has_post_thumbnail() ) {
$html = '<div class="darkone_div_featarea darkone_div_feat_image margin-bottom24">';
$html .= get_the_post_thumbnail(get_the_ID(),$feat_type);
$kklike = '';
if ( in_array( 'kk-i-like-it/admin.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
$kklike = '<div class="darkone_image_hover_button darkone_div_button_like inline-block">'.do_shortcode('[kklike_button]').'</div>';
}
$html .= sprintf( '<div class="darkone_image_hover"><div><a href="%1$s" class="darkone_image_hover_button darkone_div_button_link"><i class="br0 br0-plus"></i></a><a href="%2$s" class="darkone_image_hover_button darkone_div_button_zoom" rel="lightbox"><i class="br0 br0-search"></i></a>%3$s</div></div>', get_permalink(), wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) ), $kklike );
}
}
if($html !== '')
$html .= '</div>';
return $html;
}
endif;
// Add Standard Post Type
function akv3_query_format_standard($query) {
if (isset($query->query_vars['post_format']) &&
$query->query_vars['post_format'] == 'post-format-standard') {
if (($post_formats = get_theme_support('post-formats')) &&
is_array($post_formats[0]) && count($post_formats[0])) {
$terms = array();
foreach ($post_formats[0] as $format) {
$terms[] = 'post-format-'.$format;
}
$query->is_tax = null;
unset($query->query_vars['post_format']);
unset($query->query_vars['taxonomy']);
unset($query->query_vars['term']);
unset($query->query['post_format']);
$query->set('tax_query', array(
'relation' => 'AND',
array(
'taxonomy' => 'post_format',
'terms' => $terms,
'field' => 'slug',
'operator' => 'NOT IN'
)
));
}
}
}
add_action('pre_get_posts', 'akv3_query_format_standard');
/**
* DLight Update
*/
function darkone_update_options() {
global $darkone_data;
$old_options = get_option('DLight_options_br0');
if ( is_array($old_options) && is_array($darkone_data) ) {
if ( get_theme_mod('darkone_version') !== '1.1' ) {
if ( isset($old_options['darkone_version']) === false ) :
foreach ( $old_options as $key => $option ) {
$new = str_replace(get_bloginfo('url'), '[site_url]', $option);
set_theme_mod($key, $new);
var_dump($key.' - '.$new);
}
set_theme_mod('smof_init', date('r'));
set_theme_mod('darkone_version', '1.1');
die('<p>Version 1.1 Updated / Please refresh your browser!</p>');
endif;
}
}
}
add_action( 'init', 'darkone_update_options' );
?>