rdusnr

Untitled

Dec 8th, 2016
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 78.14 KB | None | 0 0
  1. <?php
  2. define( 'KLEO_THEME_VERSION', '4.1.6.2' );
  3.  
  4. /* Configuration array */
  5. global $kleo_config;
  6.  
  7. //Post image sizes for carousels and galleries
  8. $kleo_config['post_gallery_img_width'] = 480;
  9. $kleo_config['post_gallery_img_height'] = 270;
  10.  
  11. //Image width for big images like on single post page
  12. $kleo_config['post_single_img_width'] = 1200;
  13.  
  14. $kleo_config['blog_layouts'] = array(
  15. 'masonry' => 'Grid Masonry',
  16. 'small' => 'Small Left Thumbnail',
  17. 'standard' => 'Standard'
  18. );
  19.  
  20. $kleo_config['blog_meta_elements'] = array(
  21. 'avatar' => 'Author Avatar',
  22. 'date' => 'Date',
  23. 'archive' => 'Archive Link',
  24. 'profile' => 'Profile Icon',
  25. 'author_link' => 'Profile Link',
  26. 'message' => 'Message Link',
  27. 'categories' => 'Categories',
  28. 'tags' => 'Tags',
  29. 'comments' => 'Comments'
  30. );
  31. $kleo_config['blog_meta_defaults'] = array('author_link', 'date', 'categories', 'tags', 'comments');
  32.  
  33. //define dynamic styles path
  34. $upload_dir = wp_upload_dir();
  35. if ( is_ssl() ) {
  36. if ( strpos( $upload_dir['baseurl'], 'https://' ) === false) {
  37. $upload_dir['baseurl'] = str_ireplace('http', 'https', $upload_dir['baseurl']);
  38. }
  39. }
  40.  
  41. $kleo_config['upload_basedir'] = $upload_dir['basedir'];
  42. $kleo_config['custom_style_path'] = $upload_dir['basedir'] . '/custom_styles';
  43. $kleo_config['custom_style_url'] = $upload_dir['baseurl'] . '/custom_styles';
  44. $kleo_config['image_overlay'] = '<span class="hover-element"><i>+</i></span>';
  45.  
  46. //define site style sets
  47. $kleo_config['style_sets'] = array( 'header','main','alternate','side','footer','socket');
  48. $kleo_config['font_sections'] = array('h1','h2','h3','h4','h5','h6','body');
  49.  
  50. //physical file template mapping
  51. $kleo_config['tpl_map'] = array(
  52. 'page-templates/left-sidebar.php' => 'left',
  53. 'page-templates/right-sidebar.php' => 'right',
  54. 'page-templates/full-width.php' => 'no',
  55. 'page-templates/left-right-sidebars.php' => '3lr',
  56. 'page-templates/left-two-sidebars.php' => '3ll',
  57. 'page-templates/right-two-sidebars.php' => '3rr'
  58. );
  59.  
  60. /***************************************************
  61. :: Framework initialization with required plugins
  62. ***************************************************/
  63.  
  64. //instance of our theme framework
  65. global $kleo_theme;
  66.  
  67. /**
  68. * @return Kleo
  69. */
  70. function sq_kleo() {
  71. return Kleo::instance();
  72. }
  73. $kleo_theme = sq_kleo();
  74.  
  75. if ( is_admin() ) {
  76. require_once KLEO_LIB_DIR . '/required-plugins.php';
  77. }
  78.  
  79.  
  80.  
  81. /***************************************************
  82. :: Load Theme functions
  83. ***************************************************/
  84.  
  85. add_action( 'after_setup_theme', 'kleo_theme_functions', 12 );
  86.  
  87. function kleo_theme_functions() {
  88.  
  89. /* Plugins and functionality */
  90.  
  91. // BuddyPress compatibility
  92. if (function_exists( 'bp_is_active' )) {
  93. require_once( KLEO_LIB_DIR . '/plugin-buddypress/config.php' ); //compatibility with buddypress plugin
  94. }
  95.  
  96. // bbPress compatibility
  97. if (class_exists( 'bbPress' )) {
  98. require_once( KLEO_LIB_DIR . '/plugin-bbpress/config.php' ); //compatibility with bbpress plugin
  99. }
  100.  
  101. /* Woocommerce compatibility */
  102. if ( class_exists( 'WooCommerce' ) ) {
  103. require_once( KLEO_LIB_DIR . '/plugin-woocommerce/config.php' );
  104. }
  105.  
  106. // Paid memberships Pro compatibility
  107. if(function_exists('pmpro_url')) {
  108. require_once( KLEO_LIB_DIR . '/plugin-pmpro/config.php' );
  109. }
  110.  
  111. // Visual composer compatibility
  112. if( function_exists( 'vc_set_as_theme' ) ) {
  113. require_once( KLEO_LIB_DIR . '/plugin-vc/config.php' );
  114. }
  115.  
  116. // Compatibility with GeoDirectory plugin
  117. if( defined( 'GEODIRECTORY_VERSION' ) ) {
  118. require_once( KLEO_LIB_DIR . '/plugin-geodirectory/config.php' );
  119. }
  120.  
  121. // Compatibility with Sensei plugin
  122. if( class_exists( 'WooThemes_Sensei' ) ) {
  123. require_once( KLEO_LIB_DIR . '/plugin-sensei/config.php' );
  124. }
  125.  
  126. // Compatibility Bp Profile Search
  127. if( defined( 'BPS_VERSION' ) ) {
  128. require_once( KLEO_LIB_DIR . '/plugin-bp-profile-search/config.php' );
  129. }
  130.  
  131. // Posts likes
  132. if (sq_option('likes_status', 1) == 1) {
  133. require_once( KLEO_LIB_DIR . '/item-likes.php' );
  134. }
  135.  
  136. // Resize on the fly
  137. require_once(KLEO_LIB_DIR . '/aq_resizer.php');
  138.  
  139. // menu-items-visibility-control plugin compatibility
  140. if ( class_exists('Boom_Walker_Nav_Menu_Edit') ) {
  141. require_once(KLEO_LIB_DIR . '/plugin-menu-items-visibility-control/config.php');
  142. }
  143.  
  144. /* Custom menu */
  145. require_if_theme_supports( 'kleo-mega-menu', KLEO_LIB_DIR . '/menu-custom.php');
  146.  
  147. /* Custom menu items */
  148. require_if_theme_supports( 'kleo-menu-items', KLEO_LIB_DIR . '/menu-items.php');
  149.  
  150. /* Portfolio module */
  151. if ( sq_option( 'module_portfolio', 1 ) == 1 ) {
  152. require KLEO_LIB_DIR . '/portfolio.php';
  153. }
  154.  
  155. /* Include admin customizations */
  156. if ( is_admin() ) {
  157. //Metaboxes
  158. require_once(KLEO_LIB_DIR . '/metaboxes.php');
  159. }
  160.  
  161. if (is_admin() || is_customize_preview()) {
  162. require_once(KLEO_LIB_DIR . '/options.php');
  163. }
  164.  
  165. //Modules
  166. require_once( KLEO_LIB_DIR . '/modules.php' );
  167.  
  168. }
  169.  
  170.  
  171. /***************************************************
  172. :: Theme panel
  173. ***************************************************/
  174. if ( is_admin() ) {
  175. require_once( KLEO_LIB_DIR . '/theme-panel/init.php' );
  176. }
  177.  
  178. /***************************************************
  179. :: 1 Click Install
  180. ***************************************************/
  181. if ( is_admin() ) {
  182. require_once( KLEO_LIB_DIR . '/importer/import.php' );
  183. }
  184.  
  185.  
  186.  
  187. /***************************************************
  188. :: Load post types class
  189. ***************************************************/
  190.  
  191. require_once KLEO_LIB_DIR. '/post-types.php';
  192.  
  193.  
  194. /* Testimonials module */
  195. if ( sq_option( 'module_testimonials', 1 ) == 1 ) {
  196. require KLEO_LIB_DIR . '/testimonials.php';
  197. }
  198.  
  199. /* Clients module */
  200. if ( sq_option( 'module_clients', 1 ) == 1 ) {
  201. require KLEO_LIB_DIR . '/clients.php';
  202. }
  203.  
  204.  
  205. /***************************************************
  206. :: Theme options
  207. ***************************************************/
  208.  
  209. if ( is_admin() || is_customize_preview() ) {
  210. //Options panel
  211. if (!class_exists('ReduxFramework') && file_exists(KLEO_DIR . '/options/framework.php')) {
  212. require_once(KLEO_DIR . '/options/framework.php');
  213. }
  214. }
  215.  
  216.  
  217. /***************************************************
  218. :: Modules Class
  219. ***************************************************/
  220. if ( sq_option( 'performance', 0 ) == 1 ) {
  221. require_once( KLEO_DIR . '/modules.php' );
  222. }
  223.  
  224.  
  225. /***************************************************
  226. :: Include widgets
  227. ***************************************************/
  228.  
  229. $kleo_widgets = array(
  230. 'recent_posts.php'
  231. );
  232.  
  233. $kleo_widgets = apply_filters( 'kleo_widgets', $kleo_widgets );
  234.  
  235. foreach ( $kleo_widgets as $widget ) {
  236. $file_path = trailingslashit( KLEO_LIB_DIR ) . 'widgets/' . $widget;
  237.  
  238. if ( file_exists( $file_path ) ) {
  239. require_once( $file_path );
  240. }
  241. }
  242.  
  243.  
  244. /**
  245. * Return the breadcrumb area
  246. * @global object $wp_query
  247. * @param array $args
  248. * @return string
  249. */
  250. function kleo_title_section($args = false)
  251. {
  252. $defaults = array(
  253. 'title' => get_the_title(),
  254. 'show_title' => true,
  255. 'show_breadcrumb' => true,
  256. 'link' => '',
  257. 'output' => "<section class='{class} border-bottom'><div class='container'>{title_data}<div class='breadcrumb-extra'>{breadcrumb_data}{extra}</div></div></section>",
  258. 'class' => 'container-wrap main-title alternate-color ',
  259. 'extra' => '<p class="page-info">' . do_shortcode( sq_option( 'title_info', '' ) ) . '</p>',
  260. 'heading' => 'h1'
  261. );
  262.  
  263. // Parse incoming $args into an array and merge it with $defaults
  264. $args = wp_parse_args( $args, $defaults );
  265. $args = apply_filters('kleo_title_args', $args);
  266.  
  267. // OPTIONAL: Declare each item in $args as its own variable i.e. $type, $before.
  268. extract( $args, EXTR_SKIP );
  269.  
  270. if(!empty($link)) {
  271. $title = "<a href='".$link."' rel='bookmark' title='".__('Permanent Link:','kleo_framework')." ".esc_attr( $title )."'>".$title."</a>";
  272. }
  273.  
  274. $breadcrumb_data = '';
  275. if( $show_breadcrumb )
  276. {
  277. $breadcrumb_data = kleo_breadcrumb(array(
  278. 'show_browse' => false,
  279. 'separator' => ' ',
  280. 'show_home' => __( 'Home', 'kleo_framework' ),
  281. 'echo' => false
  282. ));
  283. }
  284.  
  285. $title_data = '';
  286. if( $show_title )
  287. {
  288. $title_data = '<{heading} class="page-title">{title}</{heading}>';
  289. }
  290.  
  291. if ( ! $show_breadcrumb && $extra == '' ) {
  292. $class .= ' title-single';
  293. }
  294.  
  295. $title_layout = sq_option( 'title_layout', 'normal' );
  296. if (is_singular() && get_cfield('title_layout') && get_cfield('title_layout') != '' ) {
  297. $title_layout = get_cfield('title_layout');
  298. }
  299. if ( $title_layout == 'center' ) {
  300. $class .= ' main-center-title';
  301. } elseif( $title_layout == 'right_breadcrumb' ) {
  302. $class .= ' main-right-breadcrumb';
  303. }
  304.  
  305.  
  306. $output = str_replace('{title_data}', $title_data, $output);
  307. $output = str_replace('{class}', $class, $output);
  308. $output = str_replace('{title}', $title, $output);
  309. $output = str_replace('{breadcrumb_data}', $breadcrumb_data, $output);
  310. $output = str_replace('{extra}', $extra, $output);
  311. $output = str_replace('{heading}', $heading, $output);
  312.  
  313. return $output;
  314. }
  315.  
  316. /**
  317. * Prepare the title/breadcrumb area using hide/show site options
  318. * @param integer $post_id
  319. * @return array
  320. */
  321. function kleo_prepare_title( $post_id = null ) {
  322. $title_arr = array();
  323.  
  324. $title_arr['title'] = kleo_title();
  325.  
  326. //hide title?
  327. $title_arr['show_title'] = true;
  328. if( get_cfield( 'title_checkbox', $post_id ) == 1 ) {
  329. $title_arr['show_title'] = false;
  330. }
  331. if ( sq_option('title_location', 'breadcrumb') == 'main' ) {
  332. $title_arr['show_title'] = false;
  333. }
  334.  
  335. //hide breadcrumb?
  336. $title_arr['show_breadcrumb'] = true;
  337. if(sq_option('breadcrumb_status', 1) == 0) {
  338. $title_arr['show_breadcrumb'] = false;
  339. }
  340. if(get_cfield( 'hide_breadcrumb', $post_id ) == 1) {
  341. $title_arr['show_breadcrumb'] = false;
  342. } else if ( get_cfield( 'hide_breadcrumb', $post_id ) === '0' ) {
  343. $title_arr['show_breadcrumb'] = true;
  344. }
  345.  
  346. //hide extra info?
  347. if(get_cfield( 'hide_info' , $post_id ) == 1) {
  348. $title_arr['extra'] = '';
  349. }
  350. return $title_arr;
  351. }
  352.  
  353.  
  354.  
  355. /***************************************************
  356. * TOP TOOLBAR - ADMIN BAR
  357. * Enable or disable the bar, depending of the theme option setting
  358. ***************************************************/
  359. if (sq_option('admin_bar', 1) == '0'):
  360. remove_action('wp_footer','wp_admin_bar_render',1000);
  361. add_filter('show_admin_bar', '__return_false');
  362. endif;
  363.  
  364.  
  365.  
  366. /***************************************************
  367. :: MAINTENANCE MODE
  368. ***************************************************/
  369. if (!function_exists('kleo_maintenance_mode')) {
  370. function kleo_maintenance_mode() {
  371.  
  372. $logo_path = apply_filters('kleo_logo', sq_option_url('logo'));
  373. $logo_img = '<img src="'. $logo_path .'" alt="maintenance" style="margin: 0 auto; display: block;" />';
  374.  
  375. if (sq_option('maintenance_mode', 0) == 1) {
  376.  
  377. /* Theme My Login compatibility */
  378. if ( class_exists( 'Theme_My_Login' ) && Theme_My_Login::is_tml_page( 'login' ) ) {
  379. return;
  380. }
  381.  
  382. if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
  383. wp_die(
  384. $logo_img
  385. . '<div style="text-align:center">'
  386. . sq_option('maintenance_msg', '')
  387. . '</div>',
  388. get_bloginfo( 'name' )
  389. );
  390. }
  391. }
  392. }
  393. add_action('get_header', 'kleo_maintenance_mode');
  394. }
  395.  
  396.  
  397.  
  398. /***************************************************
  399. :: Get social profiles
  400. ***************************************************/
  401.  
  402. if (!function_exists('kleo_get_social_profiles')):
  403.  
  404. function kleo_get_social_profiles($args=false)
  405. {
  406. $output = '';
  407. $icons = '';
  408. $all_options = get_option("kleo_".KLEO_DOMAIN);
  409.  
  410. $defaults = array(
  411. 'container' => 'ul',
  412. 'item_tag' => 'li',
  413. 'target' => '_blank'
  414. );
  415. // Parse incomming $args into an array and merge it with $defaults
  416. $args = wp_parse_args( $args, $defaults );
  417. $args = apply_filters('kleo_get_social_profiles_args', $args);
  418.  
  419. //get social data from theme options
  420. if (!empty($all_options)) {
  421. foreach ($all_options as $k => $opt)
  422. {
  423. if (substr( $k, 0, 7 ) === 'social_' && !empty($opt) ) {
  424. $k = str_replace('social_','',$k);
  425. $title = str_replace(
  426. array('gplus', 'vimeo-squared', 'pinterest-circled', 'instagramm'),
  427. array('Google+', 'Vimeo','Pinterest', 'Instagram'),
  428. $k
  429. );
  430.  
  431. $icons .= '<' . $args['item_tag'] . '>';
  432. $icons .= '<a target="'.$args['target'].'" href="'.$opt.'"><i class="icon-'.$k.'"></i><div class="ts-text">'.ucfirst($title).'</div></a>';
  433. $icons .= '</' . $args['item_tag'] . '>';
  434. }
  435. }
  436. }
  437.  
  438. $icons = apply_filters('kleo_get_social_profiles', $icons);
  439. if ($icons != '') {
  440. $output .= '<' . $args['container'] . ' class="kleo-social-icons">';
  441. $output .= $icons;
  442. $output .= '</' . $args['container'] . '>';
  443. }
  444.  
  445. return $output;
  446.  
  447. }
  448. add_shortcode( 'kleo_social_icons', 'kleo_get_social_profiles' );
  449.  
  450. endif;
  451.  
  452.  
  453.  
  454. /***************************************************
  455. :: Ajax search in header main menu
  456. ***************************************************/
  457.  
  458. //if set from admin to show search
  459. if ( sq_option( 'ajax_search', 1 ) == 1 || sq_option( 'ajax_search', 1 ) == 'logged_in' ) {
  460. add_filter( 'wp_nav_menu_items', 'kleo_search_menu_item', 200, 2 );
  461. }
  462.  
  463. if( ! function_exists( 'kleo_search_menu_item' ) )
  464. {
  465. /**
  466. * Add search to menu
  467. * @param string $items
  468. * @param object $args
  469. * @return string
  470. */
  471. function kleo_search_menu_item ( $items, $args )
  472. {
  473. if ( sq_option( 'ajax_search', 1 ) == 'logged_in' && ! is_user_logged_in() ) {
  474. return $items;
  475. }
  476.  
  477. $location = sq_option( 'menu_search_location', 'primary' );
  478.  
  479. if ( $args->theme_location == $location )
  480. {
  481. $form = kleo_get_search_menu_item();
  482. $items .= '<li id="nav-menu-item-search" class="menu-item kleo-search-nav">' . $form . '</li>';
  483. }
  484. return $items;
  485. }
  486. }
  487.  
  488. function kleo_get_search_menu_item() {
  489.  
  490. $context = sq_option( 'search_context', '' );
  491. if ( is_array($context ) ) {
  492. $context = implode( ',', $context );
  493. }
  494.  
  495. //Defaults
  496. $action = home_url( '/' );
  497. $hidden = '';
  498. $input_name = 's';
  499. if ( function_exists('bp_is_active') && $context == 'members' ) {
  500. //Buddypress members form link
  501. $action = bp_get_members_directory_permalink();
  502.  
  503. } elseif ( function_exists( 'bp_is_active' ) && bp_is_active( 'groups' ) && $context == 'groups' ) {
  504. //Buddypress group directory link
  505. $action = bp_get_groups_directory_permalink();
  506.  
  507. } elseif ( class_exists( 'bbPress' ) && $context == 'forum' ) {
  508. $action = bbp_get_search_url();
  509. $input_name = 'bbp_search';
  510.  
  511. } elseif ( $context == 'product' ) {
  512. $hidden .= '<input type="hidden" name="post_type" value="product">';
  513. }
  514.  
  515.  
  516. ob_start();
  517. ?>
  518. <a class="search-trigger" href="#"><i class="icon icon-search"></i></a>
  519. <div class="kleo-search-wrap searchHidden" id="ajax_search_container">
  520. <form class="form-inline" id="ajax_searchform" action="<?php echo $action; ?>" data-context="<?php echo $context;?>">
  521. <?php echo $hidden;?>
  522. <input name="<?php echo $input_name;?>" class="ajax_s form-control" autocomplete="off" type="text" value="<?php if ( isset($_REQUEST['s']) ) { echo esc_attr($_REQUEST['s']); } ?>" placeholder="<?php _e( "Start typing to search...", "kleo_framework" );?>">
  523. <span class="kleo-ajax-search-loading"><i class="icon-spin6 animate-spin"></i></span>
  524. </form>
  525. <div class="kleo_ajax_results"></div>
  526. </div>
  527.  
  528. <?php
  529. $form = ob_get_clean();
  530. return $form;
  531. }
  532.  
  533. //Catch ajax requests
  534. add_action( 'wp_ajax_kleo_ajax_search', 'kleo_ajax_search' );
  535. add_action( 'wp_ajax_nopriv_kleo_ajax_search', 'kleo_ajax_search' );
  536.  
  537. if(!function_exists('kleo_ajax_search'))
  538. {
  539. function kleo_ajax_search()
  540. {
  541. //if "s" input is missing exit
  542. if( empty( $_REQUEST['s'] ) && empty( $_REQUEST['bbp_search'] ) ) die();
  543.  
  544. if( ! empty( $_REQUEST['bbp_search'] ) ) {
  545. $search_string = $_REQUEST['bbp_search'];
  546. } else {
  547. $search_string = $_REQUEST['s'];
  548. }
  549.  
  550. $output = "";
  551. $context = "any";
  552. $defaults = array(
  553. 'numberposts' => 4,
  554. 'posts_per_page' => 20,
  555. 'post_type' => 'any',
  556. 'post_status' => 'publish',
  557. 'post_password' => '',
  558. 'suppress_filters' => false,
  559. 's' => $_REQUEST['s']
  560. );
  561.  
  562. if ( isset( $_REQUEST['context'] ) && $_REQUEST['context'] != '' ) {
  563. $context = explode( ",", $_REQUEST['context'] );
  564. $defaults['post_type'] = $context;
  565. }
  566. if ( ! empty( $defaults['post_type'] ) && is_array( $defaults['post_type'] ) ) {
  567. foreach ( $defaults['post_type'] as $ptk => $ptv ) {
  568. if ( $ptv == 'forum' ) {
  569. unset( $defaults['post_type'][$ptk] );
  570. break;
  571. }
  572. }
  573. }
  574.  
  575. $defaults = apply_filters( 'kleo_ajax_query_args', $defaults);
  576.  
  577. $the_query = new WP_Query( $defaults );
  578. $posts = $the_query->get_posts();
  579.  
  580. $members = array();
  581. $members['total'] = 0;
  582. $groups = array();
  583. $groups['total'] = 0;
  584. $forums = FALSE;
  585.  
  586.  
  587. if ( function_exists( 'bp_is_active' ) && ( $context == "any" || in_array( "members", $context ) ) ) {
  588. $members = bp_core_get_users(array('search_terms' => $search_string, 'per_page' => $defaults['numberposts'], 'populate_extras' => false));
  589. }
  590.  
  591. if ( function_exists( 'bp_is_active' ) && bp_is_active("groups") && ( $context == "any" || in_array( "groups", $context ) ) ) {
  592. $groups = groups_get_groups(array('search_terms' => $search_string, 'per_page' => $defaults['numberposts'], 'populate_extras' => false));
  593. }
  594.  
  595. if ( class_exists( 'bbPress' ) && ( $context == "any" || in_array( "forum", $context ) ) ) {
  596. $forums = kleo_bbp_get_replies( $search_string );
  597. }
  598.  
  599.  
  600. //if there are no posts, groups nor members
  601. if( empty( $posts ) && $members['total'] == 0 && $groups['total'] == 0 && ! $forums ) {
  602. $output = "<div class='kleo_ajax_entry ajax_not_found'>";
  603. $output .= "<div class='ajax_search_content'>";
  604. $output .= "<i class='icon icon-attention-circled'></i> ";
  605. $output .= __("Sorry, we haven't found anything based on your criteria.", 'kleo_framework');
  606. $output .= "<br>";
  607. $output .= __("Please try searching by different terms.", 'kleo_framework');
  608. $output .= "</div>";
  609. $output .= "</div>";
  610. echo $output;
  611. die();
  612. }
  613.  
  614. //if there are members
  615. if ( $members['total'] != 0 ) {
  616.  
  617. $output .= '<div class="kleo-ajax-part kleo-ajax-type-members">';
  618. $output .= '<h4><span>' . __("Members", 'kleo_framework') . '</span></h4>';
  619. foreach ( (array) $members['users'] as $member ) {
  620. $image = '<img src="' . bp_core_fetch_avatar(array('item_id' => $member-> ID, 'width' => 25, 'height' => 25, 'html' => false)) . '" class="kleo-rounded" alt="">';
  621. if ( $update = bp_get_user_meta( $member-> ID, 'bp_latest_update', true ) ) {
  622. $latest_activity = char_trim( trim( strip_tags( bp_create_excerpt( $update['content'], 50,"..." ) ) ) );
  623. } else {
  624. $latest_activity = '';
  625. }
  626. $output .= "<div class ='kleo_ajax_entry'>";
  627. $output .= "<div class='ajax_search_image'>$image</div>";
  628. $output .= "<div class='ajax_search_content'>";
  629. $output .= "<a href='" . bp_core_get_user_domain( $member->ID ) . "' class='search_title'>";
  630. $output .= $member->display_name;
  631. $output .= "</a>";
  632. $output .= "<span class='search_excerpt'>";
  633. $output .= $latest_activity;
  634. $output .= "</span>";
  635. $output .= "</div>";
  636. $output .= "</div>";
  637. }
  638. $output .= "<a class='ajax_view_all' href='" . esc_url( bp_get_members_directory_permalink() . "?s=" . $search_string ) . "'>" . __('View member results','kleo_framework') . "</a>";
  639. $output .= "</div>";
  640. }
  641.  
  642. //if there are groups
  643. if ( $groups['total'] != 0 ) {
  644.  
  645. $output .= '<div class="kleo-ajax-part kleo-ajax-type-groups">';
  646. $output .= '<h4><span>' . __("Groups", 'kleo_framework') . '</span></h4>';
  647. foreach ( (array) $groups['groups'] as $group ) {
  648. $image = '<img src="' . bp_core_fetch_avatar(array('item_id' => $group->id, 'object'=>'group', 'width' => 25, 'height' => 25, 'html' => false)) . '" class="kleo-rounded" alt="">';
  649. $output .= "<div class ='kleo_ajax_entry'>";
  650. $output .= "<div class='ajax_search_image'>$image</div>";
  651. $output .= "<div class='ajax_search_content'>";
  652. $output .= "<a href='" . bp_get_group_permalink( $group ) . "' class='search_title'>";
  653. $output .= $group->name;
  654. $output .= "</a>";
  655. $output .= "</div>";
  656. $output .= "</div>";
  657. }
  658. $output .= "<a class='ajax_view_all' href='" . esc_url( bp_get_groups_directory_permalink() . "?s=" . $search_string ) . "'>" . __('View group results','kleo_framework') . "</a>";
  659. $output .= "</div>";
  660. }
  661.  
  662. //if there are posts
  663. if( ! empty( $posts ) ) {
  664. $post_types = array();
  665. $post_type_obj = array();
  666. foreach ( $posts as $post ) {
  667. $post_types[$post->post_type][] = $post;
  668. if (empty($post_type_obj[$post->post_type])) {
  669. $post_type_obj[$post->post_type] = get_post_type_object($post->post_type);
  670. }
  671. }
  672.  
  673. foreach ($post_types as $ptype => $post_type) {
  674. $output .= '<div class="kleo-ajax-part kleo-ajax-type-' . esc_attr( $post_type_obj[$ptype]->name ) . '">';
  675. if (isset($post_type_obj[$ptype]->labels->name)) {
  676. $output .= "<h4><span>" . $post_type_obj[$ptype]->labels->name . "</span></h4>";
  677. } else {
  678. $output .= "<hr>";
  679. }
  680. $count = 0;
  681. foreach ($post_type as $post) {
  682.  
  683. $count++;
  684. if ($count > 4) {
  685. continue;
  686. }
  687. $format = get_post_format( $post->ID );
  688. if ( $img_url = kleo_get_post_thumbnail_url( $post->ID ) ) {
  689. $image = aq_resize( $img_url, 44, 44, true, true, true );
  690. if( ! $image ) {
  691. $image = $img_url;
  692. }
  693. $image = '<img src="'. $image .'" class="kleo-rounded">';
  694. } else {
  695. if ($format == 'video') {
  696. $image = "<i class='icon icon-video'></i>";
  697. } elseif ($format == 'image' || $format == 'gallery') {
  698. $image = "<i class='icon icon-picture'></i>";
  699. } else {
  700. $image = "<i class='icon icon-link'></i>";
  701. }
  702. }
  703.  
  704. $excerpt = "";
  705.  
  706. if ( ! empty($post->post_content) ) {
  707. $excerpt = $post->post_content;
  708. $excerpt = preg_replace("/\[(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s",'', $excerpt);
  709. $excerpt = char_trim( trim(strip_tags($excerpt)), 40, "..." );
  710. }
  711. $link = apply_filters('kleo_custom_url', get_permalink($post->ID));
  712. $classes = "format-" . $format;
  713. $output .= "<div class ='kleo_ajax_entry $classes'>";
  714. $output .= "<div class='ajax_search_image'>$image</div>";
  715. $output .= "<div class='ajax_search_content'>";
  716. $output .= "<a href='$link' class='search_title'>";
  717. $output .= get_the_title($post->ID);
  718. $output .= "</a>";
  719. $output .= "<span class='search_excerpt'>";
  720. $output .= $excerpt;
  721. $output .= "</span>";
  722. $output .= "</div>";
  723. $output .= "</div>";
  724. }
  725. $output .= '</div>';
  726. }
  727.  
  728. $output .= "<a class='ajax_view_all' href='" . esc_url( home_url( '/' ) . '?s=' . $search_string ) . "'>" . __('View all results', 'kleo_framework') . "</a>";
  729. }
  730.  
  731. /* Forums topics search */
  732. if( ! empty( $forums ) ) {
  733. $output .= '<div class="kleo-ajax-part kleo-ajax-type-forums">';
  734. $output .= '<h4><span>' . __("Forums", 'kleo_framework') . '</span></h4>';
  735.  
  736. $i = 0;
  737. foreach ( $forums as $fk => $forum ) {
  738.  
  739. $i++;
  740. if ($i <= 4 ) {
  741. $image = "<i class='icon icon-chat-1'></i>";
  742.  
  743. $output .= "<div class ='kleo_ajax_entry'>";
  744. $output .= "<div class='ajax_search_image'>$image</div>";
  745. $output .= "<div class='ajax_search_content'>";
  746. $output .= "<a href='" . $forum['url'] . "' class='search_title'>";
  747. $output .= $forum['name'];
  748. $output .= "</a>";
  749. //$output .= "<span class='search_excerpt'>";
  750. //$output .= $latest_activity;
  751. //$output .= "</span>";
  752. $output .= "</div>";
  753. $output .= "</div>";
  754. }
  755. }
  756. $output .= "<a class='ajax_view_all' href='" . esc_url( bbp_get_search_url() . "?bbp_search=" . $search_string ) . "'>" . __('View forum results','kleo_framework') . "</a>";
  757. $output .= "</div>";
  758. }
  759.  
  760.  
  761. echo $output;
  762. die();
  763. }
  764. }
  765.  
  766. if(!function_exists('kleo_bbp_get_replies'))
  767. {
  768. function kleo_bbp_get_replies($title = '')
  769. {
  770. global $wpdb;
  771. $topic_matches = array();
  772.  
  773. /* First do a title search */
  774. $topics = $wpdb->get_results('SELECT * FROM ' . $wpdb->posts . ' WHERE post_title LIKE "%' . esc_sql(trim($title)) . '%" AND post_type="topic" AND post_status="publish"');
  775.  
  776. /* do a tag search if title search doesn't have results */
  777. if (!$topics) {
  778. $topic_tags = get_terms('topic-tag');
  779.  
  780. if (empty($topic_tags)) {
  781. return $topic_matches;
  782. }
  783.  
  784. foreach ($topic_tags as $tid => $tag) {
  785. $tags[$tag->term_id] = $tag->name;
  786. }
  787.  
  788. $tag_matches = kleo_bbp_stristr_array($title, $tags);
  789.  
  790. $args = array(
  791. 'post_type' => 'topic',
  792. 'showposts' => -1,
  793. 'tax_query' => array(
  794. array(
  795. 'taxonomy' => 'topic-tag',
  796. 'field' => 'term_id',
  797. 'terms' => $tag_matches
  798. )
  799. )
  800. );
  801.  
  802. $topics = get_posts($args);
  803. }
  804.  
  805. /* Compile results into array*/
  806. foreach ($topics as $topic) {
  807. $topic_matches[$topic->ID]['name'] = $topic->post_title;
  808. $topic_matches[$topic->ID]['url'] = get_post_permalink($topic->ID);
  809. }
  810.  
  811.  
  812. return $topic_matches;
  813.  
  814. }
  815. }
  816.  
  817. function kleo_bbp_stristr_array( $haystack, $needles ) {
  818.  
  819. $elements = array();
  820.  
  821.  
  822. foreach ( $needles as $id => $needle )
  823. {
  824. if ( stristr( $haystack, $needle ) )
  825. {
  826. $elements[] = $id;
  827. }
  828. }
  829.  
  830. return $elements;
  831. }
  832.  
  833.  
  834.  
  835. /***************************************************
  836. :: WPML language switch
  837. ***************************************************/
  838.  
  839. if( !function_exists('kleo_wpml_wp_nav_menu_items_filter') && function_exists('icl_get_languages') ){
  840. function kleo_wpml_wp_nav_menu_items_filter( $items, $args ){
  841. if( $args->theme_location == 'primary' ) {
  842. $items = str_replace( '<a href="#" onclick="return false">', '<a href="#" class="js-activated">', $items );
  843. $items = str_replace( '</a><ul class="sub-menu submenu-languages">', '<span class="caret"></span></a><ul class="sub-menu submenu-languages dropdown-menu pull-left">', $items );
  844. }
  845. return $items;
  846. }
  847. add_filter( 'wp_nav_menu_items', 'kleo_wpml_wp_nav_menu_items_filter', 10, 2 );
  848. }
  849.  
  850. if (!function_exists('kleo_lang_menu_item')):
  851.  
  852. function kleo_lang_menu_item ( $items, $args )
  853. {
  854. if ($args->theme_location == 'top')
  855. {
  856. $items .= kleo_get_languages();
  857. }
  858.  
  859. return $items;
  860. }
  861.  
  862. endif;
  863.  
  864. if(sq_option('show_lang',1) == 1) {
  865. add_filter( 'wp_nav_menu_items', 'kleo_lang_menu_item', 10, 2 );
  866. }
  867.  
  868. function kleo_get_languages() {
  869.  
  870. global $sitepress_settings;
  871. $output = '';
  872. $active = '';
  873. $items = '';
  874.  
  875. if (function_exists('icl_get_languages')) {
  876. $languages = icl_get_languages('skip_missing=0&orderby=code');
  877.  
  878. if( ! empty( $languages ) ){
  879. foreach( $languages as $code => $lang )
  880. {
  881.  
  882. $items .= '<li>';
  883.  
  884. $alt_title_lang = $sitepress_settings['icl_lso_native_lang'] ? esc_attr($lang['native_name']) : esc_attr($lang['translated_name']);
  885.  
  886. $entry = '';
  887.  
  888. if( $sitepress_settings['icl_lso_flags'] ){
  889. $entry .= '<img class="iclflag" src="' . $lang['country_flag_url'] . '" width="18" height="12" alt="' . $alt_title_lang . '" title="' . $alt_title_lang . '" /> ';
  890. }
  891. if($sitepress_settings['icl_lso_native_lang']){
  892. $entry .= $lang['native_name'];
  893. }
  894. if($sitepress_settings['icl_lso_display_lang'] && $sitepress_settings['icl_lso_native_lang']){
  895. $entry .= ' (';
  896. }
  897. if($sitepress_settings['icl_lso_display_lang']){
  898. $entry .= $lang['translated_name'];
  899. }
  900. if($sitepress_settings['icl_lso_display_lang'] && $sitepress_settings['icl_lso_native_lang']){
  901. $entry .= ')';
  902. }
  903.  
  904.  
  905. if( ! $lang['active'] ) {
  906. $items .= '<a href="' . $lang['url'] . '">' . $entry . '</a>';
  907. } else {
  908. $active = '<a href="' . $lang['url'] . '" class="dropdown-toggle js-activated current-language" data-toggle="dropdown">' . $entry . (count($languages) > 1 ? ' <span class="caret"></span>' : '') . '</a>';
  909. }
  910.  
  911. $items .= '</li>';
  912. }
  913. }
  914.  
  915. $output .= ' <li class="' . ( count( $languages ) > 1 ? 'dropdown' : '' ) . ' kleo-langs">'
  916. . $active
  917. . '<ul class="dropdown-menu pull-right">'
  918. . $items
  919. .'</ul></li>';
  920. }
  921.  
  922. return $output;
  923. }
  924.  
  925.  
  926. /***************************************************
  927. :: Go up button
  928. ***************************************************/
  929. function kleo_go_up()
  930. {
  931. ?>
  932. <a class="kleo-go-top" href="#"><i class="icon-up-open-big"></i></a>
  933. <?php
  934. }
  935.  
  936. if(sq_option('go_top',1) == 1) {
  937. add_action('kleo_after_footer', 'kleo_go_up');
  938. }
  939.  
  940.  
  941.  
  942. /***************************************************
  943. :: Bottom contact form
  944. ***************************************************/
  945.  
  946. if (!function_exists('kleo_contact_form')) {
  947. function kleo_contact_form( $atts, $content = null ) {
  948. extract(shortcode_atts(array(
  949. 'title' => 'CONTACT US',
  950. 'builtin_form' => 1
  951. ), $atts));
  952.  
  953. $output = '';
  954.  
  955. $output .= '<div class="kleo-quick-contact-wrapper">'
  956. .'<a class="kleo-quick-contact-link" href="#"><i class="icon-mail-alt"></i></a>'
  957. .'<div id="kleo-quick-contact">'
  958. .'<h4 class="kleo-qc-title">'. $title .'</h4>'
  959. .'<p>'. do_shortcode($content).'</p>';
  960. if( $builtin_form == 1 ) {
  961. $output .= '<form class="kleo-contact-form" action="#" method="post" novalidate>'
  962. . '<input type="text" placeholder="' . __("Your Name", 'kleo_framework') . '" required id="contact_name" name="contact_name" class="form-control" value="" tabindex="276" />'
  963. . '<input type="email" required placeholder="' . __("Your Email", 'kleo_framework') . '" id="contact_email" name="contact_email" class="form-control" value="" tabindex="277" />'
  964. . '<textarea placeholder="' . __("Type your message...", 'kleo_framework') . '" required id="contact_content" name="contact_content" class="form-control" tabindex="278"></textarea>'
  965. . '<input type="hidden" name="action" value="kleo_sendmail">'
  966. . '<button tabindex="279" class="btn btn-default pull-right" type="submit">' . __("Send", 'kleo_framework') . '</button>'
  967. . '<div class="kleo-contact-loading">' . __("Sending", 'kleo_framework') . ' <i class="icon-spinner icon-spin icon-large"></i></div>'
  968. . '<div class="kleo-contact-success"> </div>'
  969. . '</form>';
  970. }
  971. $output .= '<div class="bottom-arrow"></div>'
  972. .'</div>'
  973. .'</div><!--end kleo-quick-contact-wrapper-->';
  974.  
  975. return $output;
  976. }
  977. add_shortcode('kleo_contact_form', 'kleo_contact_form');
  978. }
  979.  
  980.  
  981. if (!function_exists('kleo_sendmail')):
  982. function kleo_sendmail()
  983. {
  984. if(isset($_POST['action'])) {
  985.  
  986. $error_tpl = "<span class='mail-error'>%s</span>";
  987.  
  988. //contact name
  989. if(trim($_POST['contact_name']) === '')
  990. {
  991. printf($error_tpl, __('Please enter your name.','kleo_framework') );
  992. die();
  993. }
  994. else
  995. {
  996. $name = trim($_POST['contact_name']);
  997. }
  998.  
  999. ///contact email
  1000. if(trim($_POST['contact_email']) === '')
  1001. {
  1002. printf($error_tpl, __('Please enter your email address.','kleo_framework') );
  1003. die();
  1004. }
  1005. elseif (!preg_match("/^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+.[a-z]{2,4}$/i", trim($_POST['contact_email'])))
  1006. {
  1007. printf($error_tpl, __('You entered an invalid email address.','kleo_framework') );
  1008. die();
  1009. }
  1010. else
  1011. {
  1012. $email = trim($_POST['contact_email']);
  1013. }
  1014.  
  1015. //message
  1016. if(trim($_POST['contact_content']) === '')
  1017. {
  1018. printf($error_tpl, __('Please enter a message.','kleo_framework') );
  1019. die();
  1020. }
  1021. else
  1022. {
  1023. if(function_exists('stripslashes')) {
  1024. $comment = stripslashes(trim($_POST['contact_content']));
  1025. } else {
  1026. $comment = trim($_POST['contact_content']);
  1027. }
  1028. }
  1029.  
  1030. $emailTo = sq_option('contact_form_to','');
  1031. if (!isset($emailTo) || ($emailTo == '') )
  1032. {
  1033. $emailTo = get_option('admin_email');
  1034. }
  1035.  
  1036. $subject = __( 'Contact Form Message', 'kleo_framework' );
  1037. apply_filters( 'kleo_contact_form_subject', $subject );
  1038.  
  1039. $body = __("You received a new contact form message:", 'kleo_framework') . "\n";
  1040. $body .= __("Name: ", 'kleo_framework') . $name . "\n";
  1041. $body .= __("Email: ", 'kleo_framework') .$email . "\n" ;
  1042. $body .= __("Message: ", 'kleo_framework') . $comment . "\n";
  1043.  
  1044. $headers[] = "Content-type: text/html";
  1045. $headers[] = "Reply-To: $name <$email>";
  1046. apply_filters('kleo_contact_form_headers',$headers);
  1047.  
  1048. if(wp_mail($emailTo, $subject, $body, $headers))
  1049. {
  1050. echo '<span class="mail-success">' . __("Thank you. Your message has been sent.", 'kleo_framework').' <i class="icon-ok icon-large"></i></span>';
  1051.  
  1052. do_action('kleo_after_contact_form_mail_send', $name, $email, $comment);
  1053. }
  1054. else
  1055. {
  1056. printf($error_tpl, __("Mail couldn't be sent. Please try again!",'kleo_framework') );
  1057. }
  1058.  
  1059. }
  1060. else
  1061. {
  1062. printf($error_tpl, __("Unknown error occurred. Please try again!",'kleo_framework') );
  1063. }
  1064. die();
  1065. }
  1066. endif;
  1067.  
  1068.  
  1069. function kleo_show_contact_form()
  1070. {
  1071. $title = sq_option('contact_form_title','');
  1072. $content = sq_option('contact_form_text','');
  1073. $builtin_form = sq_option('contact_form_builtin', 1);
  1074.  
  1075. echo do_shortcode('[kleo_contact_form title="'.$title.'" builtin_form="'.$builtin_form.'"]'.$content.'[/kleo_contact_form]');
  1076. }
  1077.  
  1078. if(sq_option('contact_form',1) == 1) {
  1079. add_action('wp_ajax_kleo_sendmail', 'kleo_sendmail');
  1080. add_action('wp_ajax_nopriv_kleo_sendmail', 'kleo_sendmail');
  1081. add_action('kleo_after_footer', 'kleo_show_contact_form');
  1082. }
  1083.  
  1084.  
  1085.  
  1086.  
  1087. /***************************************************
  1088. :: SOCKET AREA
  1089. ***************************************************/
  1090. function kleo_show_socket()
  1091. {
  1092. get_template_part('page-parts/socket');
  1093. }
  1094.  
  1095. if (sq_option('socket_enable', 1) == 1) {
  1096. add_action('kleo_after_footer', 'kleo_show_socket');
  1097. }
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103. /***************************************************
  1104. :: EXCERPT
  1105. ***************************************************/
  1106.  
  1107. if ( ! function_exists( 'kleo_new_excerpt_length' ) ) {
  1108. function kleo_new_excerpt_length($length) {
  1109. return 60;
  1110. }
  1111. add_filter('excerpt_length', 'kleo_new_excerpt_length');
  1112. }
  1113.  
  1114. if ( ! function_exists( 'kleo_excerpt' ) ) {
  1115. function kleo_excerpt( $limit = 20, $words = true ) {
  1116.  
  1117. $from_content = false;
  1118. $excerpt_initial = get_the_excerpt();
  1119.  
  1120. if( $excerpt_initial == '' ) {
  1121. $excerpt_initial = get_the_content();
  1122. $from_content = true;
  1123. }
  1124. $excerpt_initial = preg_replace( '`\[[^\]]*\]`', '', $excerpt_initial );
  1125. $excerpt_initial = strip_tags( $excerpt_initial );
  1126.  
  1127. /* If we got it from get_the_content -> apply length restriction */
  1128. if ( $from_content ) {
  1129. $excerpt_length = apply_filters( 'excerpt_length', $limit );
  1130. $excerpt_initial = wp_trim_words( $excerpt_initial, $excerpt_length, '' );
  1131. }
  1132.  
  1133. if ( $words ) {
  1134. $excerpt = explode( ' ', $excerpt_initial, $limit );
  1135. if ( count( $excerpt ) >= $limit ) {
  1136. array_pop( $excerpt );
  1137. $excerpt = implode( " ", $excerpt ) . '...';
  1138. } else {
  1139. $excerpt = implode( " ", $excerpt ) . '';
  1140. }
  1141. } else {
  1142. $excerpt = substr( $excerpt_initial, 0, $limit ) . ( strlen( $excerpt_initial ) > $limit ? '...' : '' );
  1143. }
  1144.  
  1145. return '<p>' . $excerpt . '</p>';
  1146. }
  1147. }
  1148.  
  1149.  
  1150. if ( ! function_exists( 'kleo_has_shortcode' ) ) {
  1151. function kleo_has_shortcode( $shortcode = '', $post_id = null ) {
  1152.  
  1153. if ( ! $post_id ) {
  1154. if ( ! is_singular() ) {
  1155. return false;
  1156. }
  1157. $post_id = get_the_ID();
  1158. }
  1159.  
  1160. if ( is_page() || is_single() ) {
  1161. $current_post = get_post( $post_id );
  1162.  
  1163. if ( post_password_required( $current_post ) ) {
  1164. return false;
  1165. }
  1166.  
  1167. //remove_filter( 'the_content', 'do_shortcode', 11 );
  1168. //$post_content = apply_filters( 'the_content', $current_post->post_content );
  1169. $post_content = $current_post->post_content;
  1170. //add_filter( 'the_content', 'do_shortcode', 11 );
  1171.  
  1172. $found = false;
  1173.  
  1174. if ( ! $shortcode ) {
  1175. return $found;
  1176. }
  1177.  
  1178. if ( stripos( $post_content, '[' . $shortcode ) !== false ) {
  1179. $found = true;
  1180. }
  1181.  
  1182. return $found;
  1183. } else {
  1184. return false;
  1185. }
  1186. }
  1187. }
  1188.  
  1189. if ( ! function_exists( 'kleo_icons_array' ) ) {
  1190. function kleo_icons_array( $prefix = '', $before = array( '' ) ) {
  1191.  
  1192. // Get any existing copy of our transient data
  1193. $transient_name = 'kleo_font_icons_' . $prefix . implode( '', $before );
  1194.  
  1195. if ( false === ( $icons = get_transient( $transient_name ) ) ) {
  1196.  
  1197. // It wasn't there, so regenerate the data and save the transient
  1198. $icons = $before;
  1199.  
  1200. $icons_json = file_get_contents( THEME_DIR . '/assets/font/config.json' );
  1201. if ( is_child_theme() && file_exists( CHILD_THEME_DIR . '/assets/css/fontello.css' )) {
  1202. $icons_json = file_get_contents( CHILD_THEME_DIR . '/assets/config.json' );
  1203. }
  1204.  
  1205. if ( $icons_json ) {
  1206. $arr = json_decode( $icons_json, true );
  1207. foreach($arr['glyphs'] as $icon)
  1208. {
  1209. if((isset($icon['selected']) && $icon['selected'] == true) || ! isset($icon['selected']) ) {
  1210. $icons[$prefix . $icon['css']] = $icon['css'];
  1211. }
  1212. }
  1213. asort($icons);
  1214. }
  1215.  
  1216. // set transient for one day
  1217. set_transient( $transient_name, $icons, 86400 );
  1218. }
  1219.  
  1220. return $icons;
  1221. }
  1222. }
  1223. add_action( 'kleo-opts-saved', 'kleo_delete_font_transient' );
  1224. function kleo_delete_font_transient() {
  1225. delete_transient( 'kleo_font_icons_' );
  1226. }
  1227.  
  1228. if ( ! function_exists( 'kleo_post_nav' ) ) :
  1229. /**
  1230. * Display navigation to next/previous post when applicable.
  1231. *
  1232. * @since Kleo 1.0
  1233. *
  1234. * @return void
  1235. */
  1236. function kleo_post_nav( $same_cat = false ) {
  1237. // Don't print empty markup if there's nowhere to navigate.
  1238. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( $same_cat, '', true );
  1239. $next = get_adjacent_post( $same_cat, '', false );
  1240.  
  1241. if ( ! $next && ! $previous ) {
  1242. return;
  1243. }
  1244. ?>
  1245.  
  1246. <nav class="pagination-sticky member-navigation" role="navigation">
  1247. <?php
  1248. if ( is_attachment() ) :
  1249. previous_post_link( '%link', __( '<span id="older-nav">Go to article</span>', 'kleo_framework' ) );
  1250. else :
  1251. if ($previous) {
  1252. previous_post_link( '%link', '<span id="older-nav"><span class="outter-title"><span class="entry-title">' . $previous->post_title . '</span></span></span>', $same_cat );
  1253. }
  1254. if ($next) {
  1255. next_post_link( '%link', '<span id="newer-nav"><span class="outter-title"><span class="entry-title">' . $next->post_title . '</span>', $same_cat );
  1256. }
  1257. endif;
  1258. ?>
  1259. </nav><!-- .navigation -->
  1260.  
  1261. <?php
  1262. }
  1263. endif;
  1264.  
  1265. if (! function_exists( 'kleo_postmeta_enabled' )) {
  1266. /**
  1267. * Check to see if post meta is enabled for a single post
  1268. * @return int
  1269. */
  1270. function kleo_postmeta_enabled() {
  1271.  
  1272. if ( ! is_single() ) {
  1273. return 1;
  1274. }
  1275.  
  1276. /* If we set it via a shortcode */
  1277. global $kleo_config;
  1278. if ( isset( $kleo_config['post_meta_enabled'] ) ) {
  1279. if ( $kleo_config['post_meta_enabled'] ) {
  1280. return 1;
  1281. } else {
  1282. return 0;
  1283. }
  1284. }
  1285.  
  1286. $meta_status = sq_option( 'blog_meta_status', 1 );
  1287.  
  1288. if ( get_cfield( 'meta_checkbox' ) == 1 ) {
  1289. $meta_status = 0;
  1290. }
  1291.  
  1292. return apply_filters( 'kleo_postmeta_enabled', $meta_status );
  1293. }
  1294. }
  1295.  
  1296.  
  1297. /**
  1298. * Check to see if post media is enabled for a single post page
  1299. * @param string media_option
  1300. * @param int default
  1301. * @return int
  1302. */
  1303. function kleo_postmedia_enabled( $media_option = 'blog_media_status', $default = 1 ) {
  1304.  
  1305.  
  1306. global $conditional_thumb;
  1307. global $wp_query;
  1308.  
  1309. if ( ! is_singular() ) {
  1310.  
  1311. //check for shortcode thumbnail condition
  1312. if ( isset( $conditional_thumb ) ) {
  1313. if( $wp_query->current_post > ( $conditional_thumb - 1 ) ) {
  1314. return false;
  1315. }
  1316. }
  1317.  
  1318. return 1;
  1319. }
  1320.  
  1321. $media_status = sq_option( $media_option, $default );
  1322. $post_status = get_cfield( 'post_media_status' );
  1323.  
  1324. if( $post_status != '' ) {
  1325. $media_status = get_cfield( 'post_media_status' );
  1326. }
  1327.  
  1328. return $media_status;
  1329. }
  1330.  
  1331. if ( ! function_exists( 'kleo_get_img_overlay' ) ) {
  1332.  
  1333. function kleo_get_img_overlay() {
  1334. global $kleo_config;
  1335.  
  1336. if ( isset( $kleo_config['image_overlay'] ) ) {
  1337. return $kleo_config['image_overlay'];
  1338. }
  1339.  
  1340. return '';
  1341. }
  1342.  
  1343. }
  1344.  
  1345.  
  1346.  
  1347. /***************************************************
  1348. :: Facebook Integration
  1349. ***************************************************/
  1350.  
  1351. if (!function_exists('kleo_fb_button')) :
  1352. function kleo_fb_button()
  1353. {
  1354. echo kleo_get_fb_button();
  1355. }
  1356. endif;
  1357. if (!function_exists('kleo_get_fb_button')) :
  1358. function kleo_get_fb_button()
  1359. {
  1360. ob_start();
  1361. ?>
  1362. <div class="kleo-fb-wrapper text-center">
  1363. <a href="#" class="kleo-facebook-connect btn btn-default "><i class="icon-facebook"></i> &nbsp;<?php _e("Log in with Facebook", 'kleo_framework');?></a>
  1364. </div>
  1365. <div class="gap-20"></div>
  1366. <div class="hr-title hr-full"><abbr> <?php echo __("or", "kleo_framework");?> </abbr></div>
  1367. <?php
  1368.  
  1369. $output = ob_get_clean();
  1370.  
  1371. return $output;
  1372. }
  1373. endif;
  1374.  
  1375. if (!function_exists('kleo_fb_button_regpage')) :
  1376. function kleo_fb_button_regpage()
  1377. {
  1378. echo kleo_get_fb_button_regpage();
  1379. }
  1380. endif;
  1381. if (!function_exists('kleo_get_fb_button_regpage')) :
  1382. function kleo_get_fb_button_regpage()
  1383. {
  1384. ob_start();
  1385. ?>
  1386. <div class="kleo-fb-wrapper text-center">
  1387. <a href="#" class="kleo-facebook-connect btn btn-default "><i class="icon-facebook"></i> &nbsp;<?php _e("Log in with Facebook", 'kleo_framework');?></a>
  1388. </div>
  1389. <div class="gap-30"></div>
  1390. <div class="hr-title hr-full"><abbr> <?php echo __("or", "kleo_framework");?> </abbr></div>
  1391. <div class="gap-10"></div>
  1392. <?php
  1393. $output = ob_get_clean();
  1394.  
  1395. return $output;
  1396. }
  1397. endif;
  1398.  
  1399. if (!function_exists('kleo_fb_button_shortcode')) :
  1400. function kleo_fb_button_shortcode()
  1401. {
  1402. $output = '';
  1403. if ( sq_option( 'facebook_login', 0 ) == 1 && get_option( 'users_can_register' ) && !is_user_logged_in() ) {
  1404. $output .= '<a href="#" class="kleo-facebook-connect btn btn-default "><i class="icon-facebook"></i> &nbsp; ' . __("Log in with Facebook", 'kleo_framework') . '</a>';
  1405. }
  1406. return $output;
  1407. }
  1408. add_shortcode('kleo_fb_button', 'kleo_fb_button_shortcode');
  1409. endif;
  1410.  
  1411. if ( sq_option( 'facebook_login', 0 ) == 1 ) {
  1412. add_action('bp_before_login_widget_loggedout', 'kleo_fb_button' );
  1413. add_action( 'login_form', 'kleo_fb_button', 10 );
  1414. add_action( 'kleo_before_login_form', 'kleo_fb_button', 10 );
  1415. add_action( 'kleo_before_register_form_modal', 'kleo_fb_button', 10 );
  1416.  
  1417. if ( class_exists( 'WooCommerce' ) ) {
  1418. add_action( 'woocommerce_login_form_start', 'kleo_fb_button', 10 );
  1419. }
  1420.  
  1421. if (sq_option('facebook_register', 0) == 1) {
  1422. add_action('bp_before_register_page', 'kleo_fb_button_regpage' );
  1423. }
  1424. }
  1425.  
  1426.  
  1427.  
  1428. /***************************************************
  1429. :: oEmbed manipulation for youtube/vimeo video
  1430. ***************************************************/
  1431.  
  1432. if ( ! function_exists( 'kleo_add_video_wmode_transparent' ) ) :
  1433. /**
  1434. * Automatically add wmode=transparent to embeded media
  1435. * Automatically add showinfo=0 for youtube
  1436. * @param type $html
  1437. * @param type $url
  1438. * @param type $attr
  1439. * @return type
  1440. */
  1441. function kleo_add_video_wmode_transparent($html, $url, $attr)
  1442. {
  1443. if (strpos($html, "youtube.com") !== NULL || strpos($html, "youtu.be") !== NULL) {
  1444. $info = "&amp;showinfo=0";
  1445. }
  1446. else {
  1447. $info = "";
  1448. }
  1449.  
  1450. if ( strpos( $html, "<embed src=" ) !== false ) {
  1451. return str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html);
  1452. }
  1453. elseif ( strpos ( $html, 'feature=oembed' ) !== false ) {
  1454. return str_replace( 'feature=oembed', 'feature=oembed&amp;wmode=opaque'.$info, $html );
  1455. }
  1456. else {
  1457. return $html;
  1458. }
  1459. }
  1460. endif;
  1461.  
  1462. add_filter( 'oembed_result', 'kleo_add_video_wmode_transparent', 10, 3);
  1463.  
  1464. if (!function_exists('kleo_oembed_filter')):
  1465. function kleo_oembed_filter( $return, $data, $url ) {
  1466. $return = str_replace('frameborder="0"', 'style="border: none"', $return);
  1467. return $return;
  1468. }
  1469. endif;
  1470.  
  1471. add_filter('oembed_dataparse', 'kleo_oembed_filter', 90, 3 );
  1472.  
  1473.  
  1474.  
  1475. /***************************************************
  1476. :: Apply oEmbed for post video format
  1477. ***************************************************/
  1478. add_filter( 'kleo_oembed_video', array( $wp_embed, 'autoembed'), 8 );
  1479.  
  1480.  
  1481.  
  1482. /***************************************************
  1483. :: Custom taxonomy header content
  1484. ***************************************************/
  1485.  
  1486. if(function_exists('get_term_meta')) {
  1487.  
  1488. /* GET CUSTOM HEADER CONTENT FOR CATEGORY */
  1489. add_action('kleo_before_main', 'kleo_taxonomy_header', 9);
  1490.  
  1491. function kleo_taxonomy_header() {
  1492. $queried_object = get_queried_object();
  1493. if (isset($queried_object->term_id)){
  1494.  
  1495. $term_id = $queried_object->term_id;
  1496. $content = get_term_meta($term_id, 'cat_meta');
  1497.  
  1498. if( isset( $content[0]['cat_header'] ) && $content[0]['cat_header'] != '' ) {
  1499. echo '<section class="kleo-cat-header container-wrap main-color">';
  1500. echo do_shortcode( $content[0]['cat_header'] );
  1501. echo '</section>';
  1502. }
  1503. }
  1504. }
  1505.  
  1506. /* ADD CUSTOM META BOX TO CATEGORY PAGES */
  1507. function kleo_taxonomy_edit_meta_field($term) {
  1508. // put the term ID into a variable
  1509. $t_id = $term->term_id;
  1510. // retrieve the existing value(s) for this meta field. This returns an array
  1511. $term_meta = get_term_meta($t_id,'cat_meta');
  1512. if(!$term_meta){$term_meta = add_term_meta($t_id, 'cat_meta', '');}
  1513. ?>
  1514. <tr class="form-field">
  1515. <th scope="row" valign="top"><label for="term_meta[cat_header]"><?php _e( 'Top Content', 'kleo_framework' ); ?></label></th>
  1516. <td>
  1517. <?php
  1518. $content = (isset( $term_meta[0]['cat_header'] ) && $term_meta[0]['cat_header'] != '' ) ? esc_attr( $term_meta[0]['cat_header'] ) : '';
  1519. echo '<textarea id="term_meta[cat_header]" name="term_meta[cat_header]">'.$content.'</textarea>'; ?>
  1520. <p class="description"><?php _e( 'This will be displayed at top of the category page. Shortcodes are allowed.','kleo_framework' ); ?></p>
  1521. </td>
  1522. </tr>
  1523. <?php
  1524. }
  1525. add_action( 'product_cat_edit_form_fields', 'kleo_taxonomy_edit_meta_field', 10, 2 );
  1526.  
  1527. /* SAVE CUSTOM META*/
  1528. /**
  1529. * @param $term_id
  1530. */
  1531. function kleo_save_taxonomy_custom_meta( $term_id ) {
  1532. if ( isset( $_POST['term_meta'] ) ) {
  1533. $t_id = $term_id;
  1534. $term_meta = get_term_meta($t_id,'cat_meta');
  1535. $cat_keys = array_keys( $_POST['term_meta'] );
  1536. foreach ( $cat_keys as $key ) {
  1537. if ( isset ( $_POST['term_meta'][$key] ) ) {
  1538. $term_meta[$key] = $_POST['term_meta'][$key];
  1539. }
  1540. }
  1541. // Save the option array.
  1542. update_term_meta($term_id, 'cat_meta', $term_meta);
  1543.  
  1544. }
  1545. }
  1546. add_action( 'edited_product_cat', 'kleo_save_taxonomy_custom_meta', 10, 2 );
  1547. }
  1548.  
  1549.  
  1550.  
  1551. /***************************************************
  1552. :: Add custom HTML to page header set from Page edit
  1553. ***************************************************/
  1554.  
  1555. add_action( 'kleo_before_main', 'kleo_header_content', 8 );
  1556.  
  1557. function kleo_header_content() {
  1558. if ( is_singular() || is_home() ) {
  1559. $page_header = get_cfield('header_content');
  1560. if( $page_header != '' ) {
  1561. echo '<section class="kleo-page-header container-wrap main-color">';
  1562. echo do_shortcode( html_entity_decode( $page_header) );
  1563. echo '</section>';
  1564. }
  1565. } else {
  1566. return false;
  1567. }
  1568. }
  1569.  
  1570.  
  1571.  
  1572. /***************************************************
  1573. :: Add custom HTML to bottom page set from Page edit
  1574. ***************************************************/
  1575.  
  1576. add_action( 'kleo_after_main_content', 'kleo_bottom_content', 12 );
  1577.  
  1578. function kleo_bottom_content() {
  1579. if ( is_singular() || is_home() ) {
  1580. $page_bottom = get_cfield('bottom_content');
  1581. if( $page_bottom != '' ) {
  1582. echo '<div class="kleo-page-bottom">';
  1583. echo do_shortcode( html_entity_decode($page_bottom) );
  1584. echo '</div>';
  1585. }
  1586. }else{
  1587. return false;
  1588. }
  1589. }
  1590.  
  1591.  
  1592.  
  1593. /***************************************************
  1594. :: rtMedia small compatibility
  1595. ***************************************************/
  1596.  
  1597. if ( class_exists( 'RTMedia' ) ) {
  1598. add_action('wp_enqueue_scripts', 'kleo_rtmedia_scripts', 999);
  1599.  
  1600. function kleo_rtmedia_scripts() {
  1601. //wp_dequeue_style('rtmedia-font-awesome');
  1602. wp_dequeue_style('rtmedia-magnific');
  1603. wp_dequeue_script('rtmedia-magnific');
  1604. wp_dequeue_script('rtmedia-touchswipe');
  1605. }
  1606.  
  1607. add_filter( 'body_class', 'kleo_rtmedia_class');
  1608. function kleo_rtmedia_class( $classes ) {
  1609. $classes[] = 'rtm-' . RTMEDIA_VERSION ;
  1610. return $classes;
  1611. }
  1612.  
  1613. global $rtmedia_admin;
  1614. remove_action( 'admin_notices', array( $rtmedia_admin, 'rtmedia_admin_notices' ) );
  1615.  
  1616. }
  1617.  
  1618.  
  1619.  
  1620. /***************************************************
  1621. :: WP Multisite Sign-up page
  1622. ***************************************************/
  1623. add_action( 'before_signup_form', 'kleo_mu_before_page' );
  1624. function kleo_mu_before_page() {
  1625. get_template_part('page-parts/general-before-wrap');
  1626. }
  1627.  
  1628. add_action( 'after_signup_form', 'kleo_mu_after_page' );
  1629. function kleo_mu_after_page() {
  1630. get_template_part('page-parts/general-after-wrap');
  1631. echo '<style>'
  1632. . '.mu_register input[type="submit"], .mu_register #blog_title, .mu_register #user_email, .mu_register #blogname, .mu_register #user_name {font-size: inherit;}'
  1633. . '.mu_register input[type="submit"] {width: auto;}'
  1634. .'</style>'
  1635. . '<script>jQuery(document).ready(function() { jQuery(\'.mu_register input[type="submit"]\').addClass("btn btn-default"); });</script>';
  1636.  
  1637. }
  1638. /***************************************************
  1639. :: WP Multisite Activate page
  1640. ***************************************************/
  1641. if ( defined('WP_INSTALLING') && WP_INSTALLING == true ) {
  1642. add_action( 'kleo_before_main', 'kleo_mu_before_page' );
  1643. add_action( 'kleo_after_main', 'kleo_mu_after_page' );
  1644. }
  1645.  
  1646.  
  1647.  
  1648. /**
  1649. * Translate column proportions to classes
  1650. * @param string $width
  1651. * @return string
  1652. */
  1653. function kleo_translateColumnWidth( $width ) {
  1654. if ( preg_match( '/^(\d{1,2})\/12$/', $width, $match ) ) {
  1655. $w = 'vc_col-sm-'.$match[1];
  1656. } else {
  1657. $w = 'vc_col-sm-';
  1658. switch ( $width ) {
  1659. case "1/6" :
  1660. $w .= '2';
  1661. break;
  1662. case "1/4" :
  1663. $w .= '3';
  1664. break;
  1665. case "1/3" :
  1666. $w .= '4';
  1667. break;
  1668. case "1/2" :
  1669. $w .= '6';
  1670. break;
  1671. case "2/3" :
  1672. $w .= '8';
  1673. break;
  1674. case "3/4" :
  1675. $w .= '9';
  1676. break;
  1677. case "5/6" :
  1678. $w .= '10';
  1679. break;
  1680. case "1/1" :
  1681. $w .= '12';
  1682. break;
  1683. /* custom 5 columns */
  1684. case "1/5" :
  1685. $w = 'col-sm-1-5';
  1686. break;
  1687.  
  1688. default :
  1689. $w = $width;
  1690. }
  1691. }
  1692. return $w;
  1693. }
  1694.  
  1695.  
  1696.  
  1697. /**
  1698. * GET CUSTOM POST TYPE TAXONOMY LIST
  1699. */
  1700. function kleo_get_category_list( $category_name, $filter = 0, $category_child = "" ){
  1701.  
  1702. if ( $category_child != "" && $category_child != "All" ) {
  1703.  
  1704. $childcategory = get_term_by( 'slug', $category_child, $category_name );
  1705. $get_category = get_categories( array( 'taxonomy' => $category_name, 'child_of' => $childcategory->term_id ) );
  1706. $category_list = array( '0' => 'All');
  1707.  
  1708. foreach( $get_category as $category ) {
  1709. if (isset($category->cat_name)) {
  1710. $category_list[] = $category->slug;
  1711. }
  1712. }
  1713.  
  1714. return $category_list;
  1715.  
  1716. } else {
  1717. if ( ! $filter ) {
  1718.  
  1719. $get_category = get_categories( array( 'taxonomy' => $category_name ));
  1720. $category_list = array( '0' => 'All');
  1721.  
  1722. foreach( $get_category as $category ){
  1723. if (isset($category->slug)) {
  1724. $category_list[] = $category->slug;
  1725. }
  1726. }
  1727.  
  1728. return $category_list;
  1729.  
  1730. } else {
  1731. $get_category = get_categories( array( 'taxonomy' => $category_name ) );
  1732. $category_list = array( '0' => 'All' );
  1733.  
  1734. foreach ( $get_category as $category ) {
  1735. if ( isset( $category->cat_name ) ) {
  1736. $category_list[] = $category->cat_name;
  1737. }
  1738. }
  1739.  
  1740. return $category_list;
  1741. }
  1742.  
  1743. }
  1744. }
  1745.  
  1746. function kleo_get_category_list_key_array( $category_name, $key = 'slug' ) {
  1747.  
  1748. $get_category = get_categories( array( 'taxonomy' => $category_name ));
  1749. $category_list = array( 'all' => 'All');
  1750.  
  1751. foreach( $get_category as $category ){
  1752. if (isset($category->{$key})) {
  1753. $category_list[$category->{$key}] = $category->cat_name;
  1754. }
  1755. }
  1756.  
  1757. return $category_list;
  1758. }
  1759.  
  1760.  
  1761.  
  1762. /***************************************************
  1763. :: Custom main menu select for each page
  1764. ***************************************************/
  1765. if( ! is_admin() ) {
  1766. add_filter('wp_nav_menu_args', 'kleo_set_custom_menu');
  1767. }
  1768. function kleo_set_custom_menu( $args = '' ) {
  1769.  
  1770. if( 'primary' != $args['theme_location'] && 'secondary' != $args['theme_location'] ) {
  1771. return $args;
  1772. }
  1773.  
  1774. global $post;
  1775.  
  1776. if( ! empty( $post ) ) {
  1777.  
  1778. if ( 'primary' == $args['theme_location'] ) {
  1779. $menuslug = get_cfield( 'page_menu', $post->ID );
  1780.  
  1781. if ( ! empty( $menuslug ) && $menuslug != 'default' && is_nav_menu( $menuslug ) ) {
  1782. $args['menu'] = $menuslug;
  1783. }
  1784.  
  1785. } elseif( 'secondary' == $args['theme_location'] ) {
  1786.  
  1787. $sec_menuslug = get_cfield( 'page_menu_secondary', $post->ID );
  1788.  
  1789. if ( ! empty( $sec_menuslug ) && $sec_menuslug != 'default' && is_nav_menu( $sec_menuslug ) ) {
  1790. $args['menu'] = $sec_menuslug;
  1791. }
  1792.  
  1793. }
  1794.  
  1795. } // END if(!empty($post))
  1796.  
  1797. return $args;
  1798. } // END function kleo_set_custom_menu($args = '')
  1799.  
  1800.  
  1801.  
  1802. /***************************************************
  1803. :: SIDE MENU
  1804. ***************************************************/
  1805.  
  1806. //if set from admin to show side button
  1807. if (sq_option( 'side_menu', 0 ) == 1 ) {
  1808.  
  1809. if ( sq_option( 'side_menu_button', 0 ) == 1 ) {
  1810. add_filter('wp_nav_menu_items', 'kleo_side_menu_button', 20, 2);
  1811. }
  1812.  
  1813. add_filter( 'body_class', 'kleo_offcanvas_classes' );
  1814. add_action('kleo_after_page', 'kleo_show_side_menu');
  1815. }
  1816.  
  1817. if( ! function_exists( 'kleo_side_menu_button' ) ) {
  1818. /**
  1819. * Add side button to menu
  1820. * @param string $items
  1821. * @param object $args
  1822. * @return string
  1823. */
  1824. function kleo_side_menu_button ( $items, $args )
  1825. {
  1826. if ($args->theme_location == 'primary')
  1827. {
  1828. $items .= '<li id="nav-menu-item-side" class="menu-item">' .
  1829. '<a href="#" class="open-sidebar" onclick="javascript:return false;">' .
  1830. '<i class="icon-menu"></i>' .
  1831. '</a>' .
  1832. '</li>';
  1833. }
  1834. return $items;
  1835. }
  1836. }
  1837.  
  1838. function kleo_show_side_menu()
  1839. {
  1840. $side_menu = wp_nav_menu(array(
  1841. 'theme_location' => 'side',
  1842. 'depth' => 3,
  1843. 'container' => '',
  1844. 'menu_class' => 'offcanvas-menu',
  1845. 'fallback_cb' => '',
  1846. 'walker' => new kleo_walker_nav_menu(),
  1847. 'echo' => false
  1848. )
  1849. );
  1850. echo '<div class="offcanvas-sidebar side-color">' .
  1851. '<div class="wrap-canvas-menu">' .
  1852. '<div class="offcanvas-title">' .
  1853. '<a href="#" class="open-sidebar"></a>' .
  1854. '</div>' .
  1855. '<div class="offcanvas-before">' . do_shortcode(sq_option('side_menu_before')) . '</div>' .
  1856. '<div class="widget_nav_menu">' .
  1857. $side_menu .
  1858. '</div>' .
  1859. '<div class="offcanvas-after">' . do_shortcode(sq_option('side_menu_after')) . '</div>' .
  1860. '</div>' .
  1861. '</div>';
  1862. }
  1863.  
  1864.  
  1865.  
  1866. function kleo_offcanvas_classes( $classes = '' ) {
  1867.  
  1868. if ( sq_option( 'side_menu', 0 ) == 1 ) {
  1869. $classes[] = 'offcanvas-' . sq_option( 'side_menu_position', 'left' );
  1870. $classes[] = 'offcanvas-type-' . sq_option( 'side_menu_type', 'default' );
  1871. }
  1872.  
  1873. return $classes;
  1874.  
  1875. }
  1876.  
  1877.  
  1878.  
  1879. /***************************************************
  1880. :: BLOG CUSTOMISATIONS
  1881. ***************************************************/
  1882.  
  1883. if ( ! function_exists( 'kleo_view_switch' ) ) {
  1884. /**
  1885. * Show post layout type switcher
  1886. *
  1887. * @param array $layouts
  1888. * @param string $active
  1889. * @param string $identifier
  1890. */
  1891. function kleo_view_switch( $layouts, $active = '', $identifier = '' ) {
  1892.  
  1893. echo '<div class="kleo-view-switch" data-identifier="'. $identifier .'">' .
  1894. '<ul>';
  1895.  
  1896. foreach ( $layouts as $layout ) {
  1897.  
  1898. $selected = '';
  1899. if ( $active == $layout ) {
  1900. $selected = ' active';
  1901. }
  1902. echo '<li><span data-type="'. $layout .'" class="switch-'. $layout . $selected . '"></span></li>';
  1903. }
  1904.  
  1905. echo '</ul>' .
  1906. '</div>' .
  1907. '<div class="clearfix"></div>';
  1908.  
  1909. ?>
  1910.  
  1911. <?php
  1912. }
  1913. }
  1914.  
  1915. /**
  1916. * Return the blog layout from visitor Cookie
  1917. * @param string $layout
  1918. * @param string $identifier
  1919. * @return string
  1920. */
  1921. function kleo_post_grid_layout( $layout = '', $identifier = '' ) {
  1922. $cookie_name = 'kleo-blog-layout'. $identifier;
  1923. if ( isset($_COOKIE[$cookie_name]) && $_COOKIE[$cookie_name] != '' ) {
  1924. $layout = $_COOKIE[$cookie_name];
  1925. }
  1926.  
  1927. if( function_exists('get_term_meta') ) {
  1928. if ( is_category() ) {
  1929.  
  1930. global $kleo_config;
  1931. $layouts = $kleo_config['blog_layouts'];
  1932. $category = get_category( get_query_var('cat') );
  1933. $category_meta = get_term_meta( $category->term_id, 'kleo_category_display_type' );
  1934.  
  1935. if (isset($category_meta[0]) && isset($layouts[$category_meta[0]])) {
  1936. $layout = $category_meta[0];
  1937. }
  1938.  
  1939. }
  1940. }
  1941.  
  1942. return $layout;
  1943. }
  1944. add_filter( 'kleo_blog_type', 'kleo_post_grid_layout', 10, 2 );
  1945.  
  1946.  
  1947.  
  1948. /***************************************************
  1949. :: Let it Snow
  1950. ***************************************************/
  1951.  
  1952. function kleo_site_snow()
  1953. {
  1954. echo do_shortcode('[kleo_snow scope="window"]');
  1955. }
  1956. if ( sq_option( 'let_it_snow', 0 ) == 1 ) {
  1957. add_action('kleo_after_page', 'kleo_site_snow');
  1958. }
  1959.  
  1960.  
  1961.  
  1962. /**
  1963. * Get current post format for posts
  1964. * or custom media settings as post format for custom post type
  1965. * @return mixed|string
  1966. */
  1967. function kleo_get_post_format() {
  1968. if ( get_post_type() == 'portfolio' ) {
  1969. if (get_cfield('media_type') && get_cfield('media_type') != '') {
  1970. $media_type = get_cfield('media_type');
  1971. switch ($media_type) {
  1972. case 'slider':
  1973. $kleo_post_format = 'gallery';
  1974. break;
  1975.  
  1976. case 'video':
  1977. case 'hosted_video':
  1978. $kleo_post_format = 'video';
  1979. break;
  1980. }
  1981. }
  1982. return $kleo_post_format;
  1983. } else {
  1984. return get_post_format();
  1985. }
  1986. }
  1987.  
  1988.  
  1989.  
  1990. /**
  1991. * Return the URL as requested on the current page load by the user agent.
  1992. *
  1993. * @since KLEO (2.4)
  1994. *
  1995. * @return string Requested URL string.
  1996. */
  1997. function kleo_get_requested_url() {
  1998. $url = is_ssl() ? 'https://' : 'http://';
  1999. $url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  2000.  
  2001. return apply_filters( 'kleo_get_requested_url', esc_url($url) );
  2002. }
  2003.  
  2004.  
  2005.  
  2006. /***************************************************
  2007. :: Profile placeholder in menu for bbPress or Buddypress
  2008. ***************************************************/
  2009.  
  2010. add_filter('walker_nav_menu_start_el', 'kleo_bp_replace_placeholders');
  2011.  
  2012. function kleo_bp_replace_placeholders( $output ) {
  2013.  
  2014. $initial_output = $output;
  2015.  
  2016. if ( strpos( $output, '##profile_link##' ) !== false ) {
  2017.  
  2018. if ( ! is_user_logged_in() ) {
  2019. return '';
  2020. }
  2021.  
  2022. if ( function_exists( 'bp_is_active' ) ) {
  2023. $logged_in_link = bp_loggedin_user_domain( '/' );
  2024. $output = str_replace('##profile_link##', $logged_in_link, $output);
  2025. }
  2026. elseif ( class_exists( 'bbPress' ) ) {
  2027. //$logged_in_link = bb_get_profile_link();
  2028. $logged_in_link = bbp_get_user_profile_url( bbp_get_current_user_id() );
  2029. $output = str_replace('##profile_link##', $logged_in_link, $output);
  2030. }
  2031. }
  2032.  
  2033. if ( strpos( $output, '##member_name##' ) !== false ) {
  2034.  
  2035. if ( ! is_user_logged_in()) {
  2036. return '';
  2037. }
  2038. if ( function_exists( 'bp_is_active' ) ) {
  2039. $logged_in_username = bp_get_loggedin_user_fullname();
  2040. $output = str_replace('##member_name##', $logged_in_username, $output);
  2041. }
  2042. elseif ( class_exists( 'bbPress' ) ) {
  2043. $logged_in_username = bbp_get_user_nicename( bbp_get_current_user_id() );
  2044. $output = str_replace('##member_name##', $logged_in_username, $output);
  2045. }
  2046. }
  2047. $output = apply_filters( 'kleo_bp_replace_placeholders', $output, $initial_output );
  2048.  
  2049. return $output;
  2050. }
  2051.  
  2052.  
  2053.  
  2054. /***************************************************
  2055. :: Custom redirect from Theme options - Miscellaneous
  2056. ***************************************************/
  2057.  
  2058. if ( sq_option('login_redirect', 'default') == 'custom' && sq_option( 'login_redirect_custom', '' ) != '' ) {
  2059. add_filter( 'login_redirect', 'kleo_custom_redirect', 12 );
  2060. }
  2061.  
  2062. function kleo_custom_redirect() {
  2063.  
  2064. $redirect_to = sq_option( 'login_redirect_custom', '' );
  2065.  
  2066. return $redirect_to;
  2067. }
  2068.  
  2069. if ( ! function_exists('kleo_get_post_media')) {
  2070. /**
  2071. * Return post media by format
  2072. *
  2073. * @param $post_format
  2074. * @param $options
  2075. * @return string
  2076. *
  2077. * @since 3.0
  2078. */
  2079. function kleo_get_post_media($post_format = 'standard', $options = array())
  2080. {
  2081.  
  2082. global $kleo_config;
  2083.  
  2084. if (isset($options['icons']) && $options['icons']) {
  2085. $icons = true;
  2086. } else {
  2087. $icons = false;
  2088. }
  2089.  
  2090. if (isset($options['media_width']) && isset($options['media_height'])) {
  2091. $media_width = $options['media_width'];
  2092. $media_height = $options['media_height'];
  2093. } else {
  2094. $media_width = $kleo_config['post_gallery_img_width'];
  2095. $media_height = $kleo_config['post_gallery_img_height'];
  2096. }
  2097.  
  2098. $output = '';
  2099.  
  2100. switch ($post_format) {
  2101.  
  2102. case 'video':
  2103.  
  2104. //oEmbed video
  2105. $video = get_cfield('embed');
  2106. // video bg self hosted
  2107. $bg_video_args = array();
  2108. $k_video = '';
  2109.  
  2110. if (get_cfield('video_mp4')) {
  2111. $bg_video_args['mp4'] = get_cfield('video_mp4');
  2112. }
  2113. if (get_cfield('video_ogv')) {
  2114. $bg_video_args['ogv'] = get_cfield('video_ogv');
  2115. }
  2116. if (get_cfield('video_webm')) {
  2117. $bg_video_args['webm'] = get_cfield('video_webm');
  2118. }
  2119.  
  2120. if (!empty($bg_video_args)) {
  2121. $attr_strings = array(
  2122. 'preload="none"'
  2123. );
  2124.  
  2125. if (get_cfield('video_poster')) {
  2126. $attr_strings[] = 'poster="' . get_cfield('video_poster') . '"';
  2127. }
  2128.  
  2129. $k_video .= '<div class="kleo-video-wrap"><video ' . join(' ', $attr_strings) . ' controls="controls" class="kleo-video" style="width: 100%; height: 100%;">';
  2130.  
  2131. $source = '<source type="%s" src="%s" />';
  2132. foreach ($bg_video_args as $video_type => $video_src) {
  2133. $video_type = wp_check_filetype($video_src, wp_get_mime_types());
  2134. $k_video .= sprintf($source, $video_type['type'], esc_url($video_src));
  2135. }
  2136.  
  2137. $k_video .= '</video></div>';
  2138.  
  2139. $output .= $k_video;
  2140. } // oEmbed
  2141. elseif (!empty($video)) {
  2142. global $wp_embed;
  2143. $output .= apply_filters('kleo_oembed_video', $video);
  2144. }
  2145.  
  2146. break;
  2147.  
  2148. case 'audio':
  2149.  
  2150. $audio = get_cfield('audio');
  2151.  
  2152. if (!empty($audio)) {
  2153. $output .=
  2154. '<div class="post-audio">' .
  2155. '<audio preload="none" class="kleo-audio" id="audio_' . get_the_ID() . '" style="width:100%;" src="' . $audio . '"></audio>' .
  2156. '</div>';
  2157. }
  2158. break;
  2159.  
  2160. case 'gallery':
  2161.  
  2162. $slides = get_cfield('slider');
  2163.  
  2164. $output .= '<div class="kleo-banner-slider">'
  2165. . '<div class="kleo-banner-items" >';
  2166.  
  2167. if ( $slides ) {
  2168. foreach ($slides as $slide) {
  2169. if ($slide) {
  2170. $image = aq_resize($slide, $media_width, $media_height, true, true, true);
  2171. //small hack for non-hosted images
  2172. if (!$image) {
  2173. $image = $slide;
  2174. }
  2175. $output .= '<article>
  2176. <a href="' . $slide . '" data-rel="modalPhoto[inner-gallery]">
  2177. <img src="' . $image . '" alt="' . get_the_title() . '">'
  2178. . kleo_get_img_overlay()
  2179. . '</a>
  2180. </article>';
  2181. }
  2182. }
  2183. }
  2184.  
  2185. $output .= '</div>'
  2186. . '<a href="#" class="kleo-banner-prev"><i class="icon-angle-left"></i></a>'
  2187. . '<a href="#" class="kleo-banner-next"><i class="icon-angle-right"></i></a>'
  2188. . '<div class="kleo-banner-features-pager carousel-pager"></div>'
  2189. . '</div>';
  2190.  
  2191. break;
  2192.  
  2193.  
  2194. case 'aside':
  2195. if ($icons) {
  2196. $output .= '<div class="post-format-icon"><i class="icon icon-doc"></i></div>';
  2197. }
  2198. break;
  2199.  
  2200. case 'link':
  2201. if ($icons) {
  2202. $output .= '<div class="post-format-icon"><i class="icon icon-link"></i></div>';
  2203. }
  2204. break;
  2205.  
  2206. case 'quote':
  2207. if ($icons) {
  2208. $output .= '<div class="post-format-icon"><i class="icon icon-quote-right"></i></div>';
  2209. }
  2210. break;
  2211.  
  2212. case 'image':
  2213. default:
  2214. if (kleo_get_post_thumbnail_url() != '') {
  2215. $output .= '<div class="post-image">';
  2216.  
  2217. $img_url = kleo_get_post_thumbnail_url();
  2218. $image = aq_resize($img_url, $media_width, $media_height, true, true, true);
  2219. if (!$image) {
  2220. $image = $img_url;
  2221. }
  2222. $output .= '<a href="' . get_permalink() . '" class="element-wrap">'
  2223. . '<img src="' . $image . '" alt="' . get_the_title() . '">'
  2224. . kleo_get_img_overlay()
  2225. . '</a>';
  2226.  
  2227. $output .= '</div><!--end post-image-->';
  2228. } elseif ($icons) {
  2229. $post_icon = $post_format == 'image' ? 'picture' : 'doc';
  2230. $output .= '<div class="post-format-icon"><i class="icon icon-' . $post_icon . '"></i></div>';
  2231. }
  2232.  
  2233. break;
  2234. }
  2235.  
  2236. return $output;
  2237. }
  2238. }
  2239.  
  2240.  
  2241. /***************************************************
  2242. :: Custom taxonomy category template
  2243. ***************************************************/
  2244.  
  2245. if( function_exists('get_term_meta') ) {
  2246.  
  2247. function kleo_category_display_type_form( $category = false ) {
  2248.  
  2249. global $kleo_config;
  2250. $layouts = array_merge( $kleo_config['blog_layouts'], array( 'kb' => 'Knowledge Base' ) );
  2251. $category_layout = '';
  2252.  
  2253. if( $category && is_object( $category ) ) {
  2254. $category_id = $category->term_id;
  2255. $category_meta = get_term_meta($category_id, 'kleo_category_display_type');
  2256. if ( isset( $category_meta[0] ) && isset( $layouts[$category_meta[0]] ) ) {
  2257. $category_layout = $category_meta[0];
  2258. }
  2259. }
  2260.  
  2261. ?>
  2262. <tr class="form-field">
  2263. <th scope="row" valign="top"><label for="kleo_category_display_type"><?php _e( 'Display type', 'kleo_framework' ); ?></label></th>
  2264. <td>
  2265. <div class="form-field term-meta-wrap">
  2266. <select id="kleo_category_display_type" name="kleo_category_display_type">
  2267. <option value=""><?php _e( 'Use default display type', 'kleo_framework' ); ?></option>
  2268. <?php foreach( $layouts as $layout => $layout_name ) { ?>
  2269. <option value="<?php echo esc_attr( $layout ); ?>" <?php echo ( $layout == $category_layout ? 'selected="selected"' : '' ); ?>><?php echo esc_html( $layout_name ); ?></option>
  2270. <?php } ?>
  2271. </select>
  2272. <p class="description"><?php _e( 'The "Display type" will override the default display layout for each category in part.','kleo_framework' ); ?></p>
  2273. </div>
  2274. </td>
  2275. </tr>
  2276. <?php
  2277.  
  2278. }
  2279. add_action( 'category_add_form_fields', 'kleo_category_display_type_form' );
  2280. add_action( 'category_edit_form_fields', 'kleo_category_display_type_form' );
  2281.  
  2282. function kleo_category_display_type_save( $category_id ) {
  2283.  
  2284. if ( isset( $_POST['kleo_category_display_type'] ) ) {
  2285.  
  2286. global $kleo_config;
  2287. $layouts = array_merge( $kleo_config['blog_layouts'], array( 'kb' => 'Knowledge Base' ) );
  2288. $category_layout = esc_attr( $_POST['kleo_category_display_type'] );
  2289.  
  2290. if( isset( $layouts[$category_layout] ) ) {
  2291. update_term_meta( $category_id, 'kleo_category_display_type', $category_layout );
  2292. }else{
  2293. delete_term_meta( $category_id, 'kleo_category_display_type' );
  2294. }
  2295.  
  2296. }
  2297.  
  2298. }
  2299. add_action( 'created_category', 'kleo_category_display_type_save' );
  2300. add_action( 'edited_category', 'kleo_category_display_type_save' );
  2301.  
  2302. function kleo_category_display_type_template( $template ) {
  2303. if ( is_category() ) {
  2304.  
  2305. $category = get_category( get_query_var('cat') );
  2306. $category_meta = get_term_meta( $category->term_id, 'kleo_category_display_type' );
  2307.  
  2308. if ( isset( $category_meta[0] ) && $category_meta[0] == 'kb' && locate_template( 'page-parts/posts-layout-kb.php' ) ) {
  2309. return locate_template( 'page-parts/posts-layout-kb.php' );
  2310. }
  2311.  
  2312. }
  2313. return $template;
  2314. }
  2315. add_filter( 'template_include', 'kleo_category_display_type_template' );
  2316.  
  2317. }
  2318.  
  2319.  
  2320. /***************************************************
  2321. :: Allow site layout overriding at page/post level
  2322. ***************************************************/
  2323.  
  2324. function kleo_custom_site_style( $style ){
  2325. if( is_singular() ){
  2326. $page_style = get_cfield( 'site_style' );
  2327. if( $page_style ) {
  2328. $style = $page_style == 'boxed' ? ' page-boxed' : '';
  2329. }
  2330. }
  2331. if( $style == ' page-boxed' ){
  2332. add_filter('body_class', 'kleo_boxed_bg_body_class');
  2333. }
  2334. return $style;
  2335. }
  2336. add_filter( 'kleo_site_style', 'kleo_custom_site_style' );
  2337.  
  2338. function kleo_boxed_bg_body_class($classes){
  2339. $classes[] = 'page-boxed-bg';
  2340. return $classes;
  2341. }
  2342.  
  2343.  
  2344. /***************************************************
  2345. :: Blog tags in footer
  2346. ***************************************************/
  2347.  
  2348. function kleo_show_post_tags( $content ) {
  2349. if ( is_single() ) {
  2350. $tag_list = get_the_tag_list( '', __(', ', 'kleo_framework'));
  2351. if ( isset( $tag_list ) && $tag_list ) {
  2352. $tags_array = explode( ',', $tag_list );
  2353.  
  2354. $tag_html = '';
  2355. foreach ($tags_array as $tag ) {
  2356. $tag_html .= '<span class="label label-default">' . $tag . '</span> ' ;
  2357. }
  2358. $content .= esc_html__( 'Tags: ', 'kleo_framework' ) . $tag_html;
  2359. }
  2360. }
  2361. return $content;
  2362. }
  2363. if ( sq_option( 'blog_tags_footer', 0 ) ) {
  2364. add_action('the_content', 'kleo_show_post_tags', 20);
  2365. }
  2366.  
  2367.  
  2368.  
  2369. /*
  2370. * Force URLs in srcset attributes into HTTPS scheme.
  2371. * This is particularly useful when you're running a Flexible SSL frontend like Cloudflare
  2372. */
  2373. function ssl_srcset( $sources ) {
  2374. if (is_ssl()) {
  2375. foreach ( $sources as &$source ) {
  2376. $source['url'] = set_url_scheme( $source['url'], 'https' );
  2377. }
  2378. }
  2379.  
  2380. return $sources;
  2381. }
  2382. add_filter( 'wp_calculate_image_srcset', 'ssl_srcset' );
  2383.  
  2384.  
  2385. /***************************************************
  2386. :: Manage custom page redirects
  2387. ***************************************************/
  2388.  
  2389. function kleo_template_redirect(){
  2390. if( is_user_logged_in() ){
  2391. $homepage_redirect = sq_option( 'homepage_redirect', 'disabled' );
  2392. if( is_front_page() && ( $homepage_redirect == 'profile' || $homepage_redirect == 'custom' ) ){
  2393. if ( function_exists( 'bp_is_active' ) ) {
  2394. $logged_in_link = bp_loggedin_user_domain( '/' );
  2395. }
  2396. elseif ( class_exists( 'bbPress' ) ) {
  2397. $logged_in_link = bbp_get_user_profile_url( bbp_get_current_user_id() );
  2398. }else{
  2399. $logged_in_link = home_url('author');
  2400. }
  2401.  
  2402. if($homepage_redirect == 'profile'){
  2403. wp_redirect($logged_in_link);
  2404. exit;
  2405. }
  2406. if($homepage_redirect == 'custom'){
  2407. $homepage_redirect_custom = sq_option( 'homepage_redirect_custom', $logged_in_link );
  2408. if ( strpos( $homepage_redirect_custom, '##profile_link##' ) !== false ) {
  2409. $homepage_redirect_custom = str_replace('##profile_link##', $logged_in_link, $homepage_redirect_custom);
  2410. }
  2411. wp_redirect($homepage_redirect_custom);
  2412. exit;
  2413.  
  2414. }
  2415. }
  2416. }
  2417. }
  2418. add_action( 'template_redirect', 'kleo_template_redirect' );
  2419.  
  2420.  
  2421.  
  2422. /**
  2423. * Remove hentry class from pages to stop google structured data errors
  2424. *
  2425. * @param array $classes
  2426. *
  2427. * @return array
  2428. */
  2429. function kleo_remove_hentry_on_pages( $classes ) {
  2430. if ( is_page() && !( function_exists('bp_is_group_forum_topic') && bp_is_group_forum_topic() ) ) {
  2431. $classes = array_diff( $classes, array( 'hentry' ) );
  2432. }
  2433. return $classes;
  2434. }
  2435. add_filter( 'post_class','kleo_remove_hentry_on_pages' );
  2436.  
  2437.  
  2438.  
  2439. /* Re-enable theme auto-update for Go Pricing Tables */
  2440. add_action( 'admin_init', 'kleo_go_pricing_enable_updates', 11 );
  2441.  
  2442. function kleo_go_pricing_enable_updates() {
  2443. if (class_exists('GW_GoPricing_Update')) {
  2444. remove_filter( 'pre_set_site_transient_update_plugins', array(
  2445. GW_GoPricing_Update::instance(),
  2446. 'check_update'
  2447. ) );
  2448. remove_filter( 'plugins_api', array( GW_GoPricing_Update::instance(), 'update_info' ), 10, 3 );
  2449. }
  2450. }
  2451.  
  2452.  
  2453. if ( sq_option( 'mobile_app_capable', 1 ) ) {
  2454. add_action('wp_head', 'kleo_add_mobile_app_capable_tag');
  2455. }
  2456. function kleo_add_mobile_app_capable_tag() {
  2457. ?>
  2458. <meta name="mobile-web-app-capable" content="yes">
  2459. <?php
  2460. }
  2461.  
  2462. if ( sq_option( 'apple_mobile_app_capable', 1 ) ) {
  2463. add_action('wp_head', 'kleo_add_apple_mobile_app_capable_tag');
  2464. }
  2465. function kleo_add_apple_mobile_app_capable_tag() {
  2466. ?>
  2467. <meta name="apple-mobile-web-app-capable" content="yes">
  2468. <?php
  2469. }
  2470.  
  2471.  
  2472. if ( sq_option( 'meta_theme_color', '' ) != '' && sq_option( 'meta_theme_color', '' ) != 'transparent' ) {
  2473. add_action('wp_head', 'kleo_add_meta_color');
  2474. }
  2475. function kleo_add_meta_color() {
  2476. ?>
  2477. <!-- Chrome, Firefox OS and Opera -->
  2478. <meta name="theme-color" content="<?php echo sq_option( 'meta_theme_color', '' ); ?>">
  2479. <!-- Windows Phone -->
  2480. <meta name="msapplication-navbutton-color" content="<?php echo sq_option( 'meta_theme_color', '' ); ?>">
  2481. <!-- Safari -->
  2482. <meta name="apple-mobile-web-app-status-bar-style" content="<?php echo sq_option( 'meta_theme_color', '' ); ?>">
  2483. <?php
  2484. }
  2485.  
  2486.  
  2487. /* Schema org for body */
  2488. if ( ! function_exists( 'kleo_get_schema_org_markup' ) ) {
  2489.  
  2490. function kleo_get_schema_org_markup() {
  2491. $schema = 'http://schema.org/';
  2492. // If woocommerce product
  2493. if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
  2494. $type = 'Product';
  2495. } elseif ( is_singular( 'post' ) ) {
  2496. $type = "Article";
  2497. } elseif ( is_singular( 'portfolio' ) ) {
  2498. $type = "VisualArtwork";
  2499. } else {
  2500. if ( is_author() ) {
  2501. $type = 'ProfilePage';
  2502. } // Is search results page
  2503. elseif ( is_search() ) {
  2504. $type = 'SearchResultsPage';
  2505. } else {
  2506. $type = 'WebPage';
  2507. }
  2508. }
  2509.  
  2510. $type = apply_filters( 'kleo_schema_org_type', $type );
  2511.  
  2512. return 'itemscope itemtype="' . $schema . $type . '"';
  2513. }
  2514.  
  2515. }
  2516.  
  2517. function kleo_schema_org_markup() {
  2518. echo kleo_get_schema_org_markup();
  2519. }
  2520.  
  2521.  
  2522. /**
  2523. *
  2524. * Override header layout at page level
  2525. * @param $output
  2526. * @param $option
  2527. *
  2528. * @return bool|mixed
  2529. */
  2530. function kleo_override_header_layout( $output, $option ) {
  2531. if ( $option == 'header_layout' ) {
  2532. $output = get_cfield('header_layout');
  2533. }
  2534.  
  2535. return $output;
  2536. }
Advertisement
Add Comment
Please, Sign In to add comment