rdusnr

Untitled

Mar 1st, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.33 KB | None | 0 0
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Kleo
  5. * @author SeventhQueen <[email protected]>
  6. * @since Kleo 1.0
  7. */
  8.  
  9. /***************************************************
  10. * :: Load Kleo framework
  11. ***************************************************/
  12.  
  13. require_once( trailingslashit( get_template_directory() ) . 'kleo-framework/kleo.php' );
  14.  
  15.  
  16. if ( ! isset( $content_width ) ) {
  17. $content_width = 1200;
  18. }
  19.  
  20.  
  21. /***************************************************
  22. * :: Load Theme specific functions
  23. ***************************************************/
  24.  
  25. require_once( trailingslashit( get_template_directory() ) . 'lib/theme-functions.php' );
  26.  
  27.  
  28. /***************************************************
  29. * :: SideKick Integration
  30. ***************************************************/
  31.  
  32. define( 'SK_PRODUCT_ID', 457 );
  33. define( 'SK_ENVATO_PARTNER', 'Qjq0CBU+3zqUohNf6gfTpvfnRX3eCVM+HwoqKeVL4/k=' );
  34. define( 'SK_ENVATO_SECRET', 'RqjBt/YyaTOjDq+lKLWhL10sFCMCJciT9SPUKLBBmso=' );
  35.  
  36.  
  37. /**
  38. * Sets up theme defaults and registers the various WordPress features
  39. *
  40. * @uses load_theme_textdomain() For translation/localization support.
  41. * @uses add_editor_style() To add a Visual Editor stylesheet.
  42. * @uses add_theme_support() To add support for post thumbnails, automatic feed links,
  43. * custom background, and post formats.
  44. * @uses register_nav_menu() To add support for navigation menus.
  45. * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
  46. *
  47. * @since Kleo Framework 1.0
  48. */
  49. function kleo_setup() {
  50.  
  51.  
  52. global $kleo_config;
  53.  
  54. /*
  55. * Makes theme available for translation.
  56. * Translations can be added to the /languages/ directory.
  57. */
  58. load_theme_textdomain( 'kleo_framework', get_template_directory() . '/languages' );
  59.  
  60. /* This theme styles the visual editor with editor-style.css to match the theme style. */
  61. add_editor_style();
  62.  
  63. /* Adds RSS feed links to <head> for posts and comments. */
  64. add_theme_support( 'automatic-feed-links' );
  65.  
  66. /*
  67. * Enable support for Post Formats.
  68. * See http://codex.wordpress.org/Post_Formats
  69. */
  70. add_theme_support( 'post-formats', array(
  71. 'aside',
  72. 'image',
  73. 'video',
  74. 'audio',
  75. 'quote',
  76. 'link',
  77. 'gallery',
  78. ) );
  79.  
  80. /* This theme uses wp_nav_menu() in two locations. */
  81. register_nav_menu( 'primary', __( 'Primary Menu', 'kleo_framework' ) );
  82. register_nav_menu( 'secondary', __( 'Secondary Menu', 'kleo_framework' ) );
  83. register_nav_menu( 'top', __( 'Top Menu', 'kleo_framework' ) );
  84. register_nav_menu( 'side', __( 'Side Menu', 'kleo_framework' ) );
  85.  
  86. /* This theme uses a custom image size for featured images, displayed on "standard" posts. */
  87. add_theme_support( 'post-thumbnails' );
  88. set_post_thumbnail_size( 672, 9999 ); // Unlimited height, soft crop
  89.  
  90. $blog_img_single_crop = sq_option( 'blog_img_single_crop', false ) ? true : false;
  91. $blog_img_standard_crop = sq_option( 'blog_img_standard_crop', true ) ? true : false;
  92. $blog_img_grid_crop = sq_option( 'blog_img_grid_crop', false ) ? true : false;
  93. $blog_img_small_crop = sq_option( 'blog_img_small_crop', true ) ? true : false;
  94.  
  95. //Single post image size
  96. add_image_size( 'kleo-full-width',
  97. sq_option( 'blog_img_single_width', 1038 ),
  98. sq_option( 'blog_img_single_height', 9999 ),
  99. $blog_img_single_crop
  100. ); //default 480x270
  101.  
  102. //check for custom image sizes
  103. if ( sq_option( 'blog_custom_img', 0 ) == 1 ) {
  104. add_image_size( 'kleo-post-gallery',
  105. sq_option( 'blog_img_standard_width', $kleo_config['post_gallery_img_width'] ),
  106. sq_option( 'blog_img_standard_height', $kleo_config['post_gallery_img_height'] ),
  107. $blog_img_standard_crop
  108. ); //default 480x270
  109. add_image_size( 'kleo-post-grid',
  110. sq_option( 'blog_img_grid_width', $kleo_config['post_gallery_img_width'] ),
  111. sq_option( 'blog_img_grid_height', 9999 ),
  112. $blog_img_grid_crop
  113. ); //default 480xauto-height
  114. add_image_size( 'kleo-post-small-thumb',
  115. sq_option( 'blog_img_small_width', $kleo_config['post_gallery_img_width'] ),
  116. sq_option( 'blog_img_small_height', $kleo_config['post_gallery_img_height'] ),
  117. $blog_img_small_crop
  118. ); //default 480xauto-height
  119. }
  120.  
  121. /*
  122. * Switch default core markup for search form, comment form, and comments
  123. * to output valid HTML5.
  124. */
  125. add_theme_support( 'html5', array(
  126. 'search-form',
  127. 'comment-form',
  128. 'comment-list',
  129. ) );
  130.  
  131. // Add support for featured content.
  132. add_theme_support( 'featured-content', array(
  133. 'featured_content_filter' => 'kleo_get_featured_posts',
  134. 'max_posts' => 6,
  135. ) );
  136.  
  137. /* Specific framework functionality */
  138. add_theme_support( 'kleo-sidebar-generator' );
  139. add_theme_support( 'kleo-facebook-login' );
  140. add_theme_support( 'kleo-mega-menu' );
  141. add_theme_support( 'kleo-menu-items' );
  142.  
  143. /* Third-party plugins */
  144. add_theme_support( 'bbpress' );
  145. add_theme_support( 'woocommerce' );
  146.  
  147. add_theme_support( 'title-tag' );
  148.  
  149. add_theme_support( 'customize-selective-refresh-widgets' );
  150.  
  151. }
  152.  
  153. add_action( 'after_setup_theme', 'kleo_setup' );
  154.  
  155.  
  156. if ( ! function_exists( '_wp_render_title_tag' ) ) {
  157. function kleo_slug_render_title() {
  158. ?>
  159. <title><?php wp_title( '|', true, 'right' ); ?></title>
  160. <?php
  161. }
  162.  
  163. add_action( 'wp_head', 'kleo_slug_render_title' );
  164. }
  165.  
  166.  
  167. if ( ! function_exists( 'kleo_wp_title' ) ):
  168. /**
  169. * Creates a nicely formatted and more specific title element text
  170. * for output in head of document, based on current view.
  171. *
  172. * @since Kleo Framework 1.0
  173. *
  174. * @param string $title Default title text for current view.
  175. * @param string $sep Optional separator.
  176. *
  177. * @return string Filtered title.
  178. */
  179. function kleo_wp_title( $title, $sep ) {
  180. global $paged, $page;
  181.  
  182. if ( is_feed() ) {
  183. return $title;
  184. }
  185. // Add the site name.
  186. $title .= get_bloginfo( 'name' );
  187.  
  188. // Add the site description for the home/front page.
  189. $site_description = get_bloginfo( 'description', 'display' );
  190. if ( $site_description && ( is_home() || is_front_page() ) ) {
  191. $title = "$title $sep $site_description";
  192. }
  193. // Add a page number if necessary.
  194. if ( $paged >= 2 || $page >= 2 ) {
  195. $title = "$title $sep " . sprintf( __( 'Page %s', 'kleo_framework' ), max( $paged, $page ) );
  196. }
  197.  
  198. return $title;
  199. }
  200.  
  201. if ( ! function_exists( '_wp_render_title_tag' ) ) {
  202. add_filter( 'wp_title', 'kleo_wp_title', 10, 2 );
  203. }
  204. endif;
  205.  
  206.  
  207. /***************************************************
  208. * :: Main menu Navigation
  209. ***************************************************/
  210.  
  211. require_once( KLEO_LIB_DIR . '/menu-walker.php' );
  212.  
  213.  
  214. /***************************************************
  215. * :: Featured content
  216. ***************************************************/
  217.  
  218. /**
  219. * Getter function for Featured Content Plugin.
  220. *
  221. * @since Kleo 1.0
  222. *
  223. * @return array An array of WP_Post objects.
  224. */
  225. function kleo_get_featured_posts() {
  226. /**
  227. * Filter the featured posts to return in Kleo.
  228. *
  229. * @since Kleo 1.0
  230. *
  231. * @param array|bool $posts Array of featured posts, otherwise false.
  232. */
  233. return apply_filters( 'kleo_get_featured_posts', array() );
  234. }
  235.  
  236. /**
  237. * A helper conditional function that returns a boolean value.
  238. *
  239. * @since Kleo 1.0
  240. *
  241. * @return bool Whether there are featured posts.
  242. */
  243. function kleo_has_featured_posts() {
  244. return ! is_paged() && (bool) kleo_get_featured_posts();
  245. }
  246.  
  247.  
  248. /*
  249. * Add Featured Content functionality.
  250. *
  251. * To overwrite in a plugin, define your own Featured_Content class on or
  252. * before the 'setup_theme' hook.
  253. */
  254. if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
  255. require get_template_directory() . '/lib/featured-content/featured-content.php';
  256. }
  257. //------------------------------------------------------------------------------
  258.  
  259.  
  260. if ( ! function_exists( 'kleo_widgets_init' ) ) :
  261. /**
  262. * Registers our main widget area and the front page widget areas.
  263. *
  264. * @since Kleo 1.0
  265. */
  266. function kleo_widgets_init() {
  267. register_sidebar( array(
  268. 'name' => __( 'Main Sidebar', 'kleo_framework' ),
  269. 'id' => 'sidebar-1',
  270. 'description' => __( 'Default sidebar', 'kleo_framework' ),
  271. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  272. 'after_widget' => '</div>',
  273. 'before_title' => '<h4 class="widget-title">',
  274. 'after_title' => '</h4>',
  275. ) );
  276. register_sidebar( array(
  277. 'name' => 'Footer column 1',
  278. 'id' => 'footer-1',
  279. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  280. 'after_widget' => '</div>',
  281. 'before_title' => '<h4 class="widget-title">',
  282. 'after_title' => '</h4>',
  283. ) );
  284.  
  285. register_sidebar( array(
  286. 'name' => 'Footer column 2',
  287. 'id' => 'footer-2',
  288. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  289. 'after_widget' => '</div>',
  290. 'before_title' => '<h4 class="widget-title">',
  291. 'after_title' => '</h4>',
  292. ) );
  293.  
  294. register_sidebar( array(
  295. 'name' => 'Footer column 3',
  296. 'id' => 'footer-3',
  297. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  298. 'after_widget' => '</div>',
  299. 'before_title' => '<h4 class="widget-title">',
  300. 'after_title' => '</h4>',
  301. ) );
  302.  
  303. register_sidebar( array(
  304. 'name' => 'Footer column 4',
  305. 'id' => 'footer-4',
  306. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  307. 'after_widget' => '</div>',
  308. 'before_title' => '<h4 class="widget-title">',
  309. 'after_title' => '</h4>',
  310. ) );
  311. register_sidebar( array(
  312. 'name' => 'Extra - for 3 columns pages',
  313. 'id' => 'extra',
  314. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  315. 'after_widget' => '</div>',
  316. 'before_title' => '<h4 class="widget-title">',
  317. 'after_title' => '</h4>',
  318. ) );
  319. register_sidebar( array(
  320. 'name' => 'Shop sidebar',
  321. 'id' => 'shop-1',
  322. 'before_widget' => '<div id="%1$s" class="widget %2$s">',
  323. 'after_widget' => '</div>',
  324. 'before_title' => '<h4 class="widget-title">',
  325. 'after_title' => '</h4>',
  326. ) );
  327.  
  328. }
  329. endif;
  330. add_action( 'widgets_init', 'kleo_widgets_init' );
  331.  
  332.  
  333. if ( ! function_exists( 'kleo_entry_meta' ) ) :
  334. /**
  335. * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
  336. * Create your own kleo_entry_meta() to override in a child theme.
  337. * @since 1.0
  338. */
  339. function kleo_entry_meta( $echo = true, $att = array() ) {
  340.  
  341. global $kleo_config;
  342. $meta_list = array();
  343. $author_links = '';
  344. $meta_elements = sq_option( 'blog_meta_elements', $kleo_config['blog_meta_defaults'] );
  345.  
  346. // Translators: used between list items, there is a space after the comma.
  347. if ( in_array( 'categories', $meta_elements ) ) {
  348. $categories_list = get_the_category_list( __( ', ', 'kleo_framework' ) );
  349. }
  350.  
  351. // Translators: used between list items, there is a space after the comma.
  352. if ( in_array( 'tags', $meta_elements ) ) {
  353. $tag_list = get_the_tag_list( '', __( ', ', 'kleo_framework' ) );
  354. }
  355.  
  356. $date = sprintf( '<a href="%1$s" rel="bookmark" class="post-time">' .
  357. '<time class="entry-date" datetime="%2$s">%3$s</time>' .
  358. '<time class="modify-date hide hidden updated" datetime="%4$s">%5$s</time>' .
  359. '</a>',
  360. esc_url( get_permalink() ),
  361. esc_attr( get_the_date( 'c' ) ),
  362. esc_html( get_the_date() ),
  363. esc_html( get_the_modified_date( 'c' ) ),
  364. esc_html( get_the_modified_date() )
  365. );
  366.  
  367.  
  368. if ( is_array( $meta_elements ) && ! empty( $meta_elements ) ) {
  369.  
  370.  
  371. if ( in_array( 'author_link', $meta_elements ) || in_array( 'avatar', $meta_elements ) ) {
  372.  
  373. /* If buddypress is active then create a link to Buddypress profile instead */
  374. if ( function_exists( 'bp_is_active' ) ) {
  375. $author_link = esc_url( bp_core_get_userlink( get_the_author_meta( 'ID' ), $no_anchor = false, $just_link = true ) );
  376. $author_title = esc_attr( sprintf( __( 'View %s\'s profile', 'kleo_framework' ), get_the_author() ) );
  377. } else {
  378. $author_link = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
  379. $author_title = esc_attr( sprintf( __( 'View all POSTS by %s', 'kleo_framework' ), get_the_author() ) );
  380. }
  381.  
  382. $author = sprintf( '<a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s %4$s</a>',
  383. $author_link,
  384. $author_title,
  385. in_array( 'avatar', $meta_elements ) ? get_avatar( get_the_author_meta( 'ID' ), 50 ) : '',
  386. in_array( 'author_link', $meta_elements ) ? '<span class="author-name">' . get_the_author() . '</span>' : ''
  387. );
  388.  
  389. $meta_list[] = '<small class="meta-author author vcard">' . $author . '</small>';
  390. }
  391.  
  392. if ( function_exists( 'bp_is_active' ) ) {
  393. if ( in_array( 'profile', $meta_elements ) ) {
  394. $author_links .= '<a href="' . bp_core_get_userlink( get_the_author_meta( 'ID' ), $no_anchor = false, $just_link = true ) . '">' .
  395. '<i class="icon-user-1 hover-tip" ' .
  396. 'data-original-title="' . esc_attr( sprintf( __( 'View profile', 'kleo_framework' ), get_the_author() ) ) . '"' .
  397. 'data-toggle="tooltip"' .
  398. 'data-placement="top"></i>' .
  399. '</a>';
  400. }
  401.  
  402. if ( bp_is_active( 'messages' ) && is_user_logged_in() ) {
  403. if ( in_array( 'message', $meta_elements ) ) {
  404. $author_links .= '<a href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( get_the_author_meta( 'ID' ) ) ) . '">' .
  405. '<i class="icon-mail hover-tip" ' .
  406. 'data-original-title="' . esc_attr( sprintf( __( 'Contact %s', 'kleo_framework' ), get_the_author() ) ) . '" ' .
  407. 'data-toggle="tooltip" ' .
  408. 'data-placement="top"></i>' .
  409. '</a>';
  410. }
  411. }
  412. }
  413.  
  414. if ( in_array( 'archive', $meta_elements ) ) {
  415. $author_links .= '<a href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' .
  416. '<i class="icon-docs hover-tip" ' .
  417. 'data-original-title="' . esc_attr( sprintf( __( 'View all posts by %s', 'kleo_framework' ), get_the_author() ) ) . '" ' .
  418. 'data-toggle="tooltip" ' .
  419. 'data-placement="top"></i>' .
  420. '</a>';
  421. }
  422. }
  423.  
  424. if ( '' != $author_links ) {
  425. $meta_list[] = '<small class="meta-links">' . $author_links . '</small>';
  426. }
  427.  
  428. if ( in_array( 'date', $meta_elements ) ) {
  429. $meta_list[] = '<small>' . $date . '</small>';
  430. }
  431.  
  432. $cat_tag = array();
  433.  
  434. if ( isset( $categories_list ) && $categories_list ) {
  435. $cat_tag[] = $categories_list;
  436. }
  437.  
  438. if ( isset( $tag_list ) && $tag_list ) {
  439. $cat_tag[] = $tag_list;
  440. }
  441. if ( ! empty( $cat_tag ) ) {
  442. $meta_list[] = '<small class="meta-category">' . implode( ', ', $cat_tag ) . '</small>';
  443. }
  444.  
  445. //comments
  446. if ( ( ! isset( $att['comments'] ) || ( isset( $att['comments'] ) && false != $att['comments'] ) ) && in_array( 'comments', $meta_elements ) ) {
  447. $meta_list[] = '<small class="meta-comment-count"><a href="' . get_permalink() . '#comments">' . get_comments_number() .
  448. ' <i class="icon-chat-1 hover-tip" ' .
  449. 'data-original-title="' . sprintf( _n( 'This article has one comment', 'This article has %1$s comments', get_comments_number(), 'kleo_framework' ), number_format_i18n( get_comments_number() ) ) . '" ' .
  450. 'data-toggle="tooltip" ' .
  451. 'data-placement="top"></i>' .
  452. '</a></small>';
  453. }
  454.  
  455. $meta_separator = isset( $att['separator'] ) ? $att['separator'] : sq_option( 'blog_meta_sep', ', ' );
  456.  
  457. if ( $echo ) {
  458. echo implode( $meta_separator, $meta_list );
  459. } else {
  460. return implode( $meta_separator, $meta_list );
  461. }
  462.  
  463.  
  464. }
  465. endif;
  466.  
  467.  
  468. /***************************************************
  469. * :: Comments functions
  470. ***************************************************/
  471.  
  472.  
  473. if ( ! function_exists( 'kleo_custom_comments' ) ) {
  474. /**
  475. * Display customized comments
  476. *
  477. * @param object $comment
  478. * @param array $args
  479. * @param integer $depth
  480. */
  481. function kleo_custom_comments( $comment, $args, $depth ) {
  482. $GLOBALS['comment'] = $comment;
  483. $GLOBALS['comment_depth'] = $depth;
  484. ?>
  485. <li id="comment-<?php comment_ID() ?>" <?php comment_class( 'clearfix' ) ?>>
  486. <div class="comment-wrap clearfix">
  487. <div class="comment-avatar kleo-rounded">
  488. <?php
  489. if ( function_exists( 'get_avatar' ) ) {
  490. echo get_avatar( $comment, '100' );
  491. }
  492. ?>
  493. <?php if ( get_the_author_meta( 'email' ) == $comment->comment_author_email ) { ?>
  494. <span class="tooltip"><?php _e( 'Author', 'kleo_framework' ); ?><span class="arrow"></span></span>
  495. <?php } ?>
  496. </div>
  497. <div class="comment-content">
  498. <div class="comment-meta">
  499. <?php
  500. printf( '<span class="comment-author">%1$s</span> <span class="comment-date">%2$s</span>',
  501. get_comment_author_link(),
  502. human_time_diff( get_comment_time( 'U' ), current_time( 'timestamp' ) ) . ' ' . __( 'ago', 'kleo_framework' )
  503. );
  504. ?>
  505. </div>
  506. <?php
  507. if ( '0' == $comment->comment_approved ) {
  508. _e( "<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'kleo_framework' );
  509. }
  510. ?>
  511. <div class="comment-body">
  512. <?php comment_text() ?>
  513. </div>
  514. <div class="comment-meta-actions">
  515. <?php
  516. edit_comment_link( __( 'Edit', 'kleo_framework' ), '<span class="edit-link">', '</span><span class="meta-sep"> |</span>' );
  517. ?>
  518. <?php if ( 'all' == $args['type'] || 'comment' == get_comment_type() ) :
  519. comment_reply_link( array_merge( $args, array(
  520. 'reply_text' => __( 'Reply', 'kleo_framework' ),
  521. 'login_text' => __( 'Log in to reply.', 'kleo_framework' ),
  522. 'depth' => $depth,
  523. 'before' => '<span class="comment-reply">',
  524. 'after' => '</span>',
  525. ) ) );
  526. endif; ?>
  527. </div>
  528. </div>
  529. </div>
  530. <?php }
  531. } // end kleo_custom_comments
  532.  
  533.  
  534. if ( ! function_exists( 'kleo_comment_form' ) ) :
  535. /**
  536. * Outputs a complete commenting form for use within a template.
  537. * Most strings and form fields may be controlled through the $args array passed
  538. * into the function, while you may also choose to use the comment_form_default_fields
  539. * filter to modify the array of default fields if you'd just like to add a new
  540. * one or remove a single field. All fields are also individually passed through
  541. * a filter of the form comment_form_field_$name where $name is the key used
  542. * in the array of fields.
  543. *
  544. * @param array $args Options for strings, fields etc in the form
  545. * @param mixed $post_id Post ID to generate the form for, uses the current post if null
  546. *
  547. * @return void
  548. */
  549. function kleo_comment_form( $args = array(), $post_id = null ) {
  550. global $id;
  551.  
  552. $user = wp_get_current_user();
  553. $user_identity = $user->exists() ? $user->display_name : '';
  554.  
  555. if ( null === $post_id ) {
  556. $post_id = $id;
  557. } else {
  558. $id = $post_id;
  559. }
  560.  
  561. if ( comments_open( $post_id ) ) :
  562. ?>
  563. <div id="respond-wrap">
  564. <?php
  565. $commenter = wp_get_current_commenter();
  566. $req = get_option( 'require_name_email' );
  567. $aria_req = ( $req ? " aria-required='true'" : '' );
  568. $fields = array(
  569. 'author' => '<div class="row"><p class="comment-form-author col-sm-4"><label for="author">' . __( 'Name', 'kleo_framework' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="author" name="author" type="text" class="form-control" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
  570. 'email' => '<p class="comment-form-email col-sm-4"><label for="email">' . __( 'Email', 'kleo_framework' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input id="email" name="email" type="text" class="form-control" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
  571. 'url' => '<p class="comment-form-url col-sm-4"><label for="url">' . __( 'Website', 'kleo_framework' ) . '</label><input id="url" name="url" type="text" class="form-control" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p></div>',
  572. );
  573.  
  574. if ( function_exists( 'bp_is_active' ) ) {
  575. $profile_link = bp_get_loggedin_user_link();
  576. } else {
  577. $profile_link = admin_url( 'profile.php' );
  578. }
  579.  
  580. $comments_args = array(
  581. 'fields' => apply_filters( 'comment_form_default_fields', $fields ),
  582. 'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>', 'kleo_framework' ), $profile_link, $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink() ) ) ) . '</p>',
  583. 'title_reply' => __( 'Leave a reply', 'kleo_framework' ),
  584. 'title_reply_to' => __( 'Leave a reply to %s', 'kleo_framework' ),
  585. 'cancel_reply_link' => __( 'Click here to cancel the reply', 'kleo_framework' ),
  586. 'label_submit' => __( 'Post comment', 'kleo_framework' ),
  587. 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __( 'Comment', 'kleo_framework' ) . '</label><textarea class="form-control" id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
  588. 'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.', 'kleo_framework' ), wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) ) . '</p>',
  589. );
  590.  
  591. comment_form( $comments_args );
  592. ?>
  593. </div>
  594.  
  595. <?php
  596. endif;
  597.  
  598. }
  599. endif;
  600.  
  601.  
  602. if ( ! function_exists( 'kleo_the_attached_image' ) ) :
  603. /**
  604. * Print the attached image with a link to the next attached image.
  605. *
  606. * @since Kleo 1.0
  607. *
  608. * @return void
  609. */
  610. function kleo_the_attached_image() {
  611. $post = get_post();
  612. /**
  613. * Filter the default attachment size.
  614. *
  615. * @since Kleo 1.0
  616. *
  617. * @param array $dimensions {
  618. * An array of height and width dimensions.
  619. *
  620. * @type int $height Height of the image in pixels. Default 810.
  621. * @type int $width Width of the image in pixels. Default 810.
  622. * }
  623. */
  624. $attachment_size = apply_filters( 'kleo_attachment_size', array( 810, 810 ) );
  625. $next_attachment_url = wp_get_attachment_url();
  626.  
  627. /*
  628. * Grab the IDs of all the image attachments in a gallery so we can get the URL
  629. * of the next adjacent image in a gallery, or the first image (if we're
  630. * looking at the last image in a gallery), or, in a gallery of one, just the
  631. * link to that image file.
  632. */
  633. $attachment_ids = get_posts( array(
  634. 'post_parent' => $post->post_parent,
  635. 'fields' => 'ids',
  636. 'numberposts' => - 1,
  637. 'post_status' => 'inherit',
  638. 'post_type' => 'attachment',
  639. 'post_mime_type' => 'image',
  640. 'order' => 'ASC',
  641. 'orderby' => 'menu_order ID',
  642. ) );
  643.  
  644. // If there is more than 1 attachment in a gallery...
  645. if ( count( $attachment_ids ) > 1 ) {
  646. foreach ( $attachment_ids as $attachment_id ) {
  647. if ( $attachment_id == $post->ID ) {
  648. $next_id = current( $attachment_ids );
  649. break;
  650. }
  651. }
  652.  
  653. // get the URL of the next image attachment...
  654. if ( isset( $next_id ) && $next_id ) {
  655. $next_attachment_url = get_attachment_link( $next_id );
  656. } // or get the URL of the first image attachment.
  657. else {
  658. $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) );
  659. }
  660. }
  661.  
  662. printf( '<a href="%1$s" rel="attachment">%2$s</a>',
  663. esc_url( $next_attachment_url ),
  664. wp_get_attachment_image( $post->ID, $attachment_size )
  665. );
  666. }
  667. endif;
  668.  
  669.  
  670. /***************************************************
  671. * :: Sidebar logic
  672. ***************************************************/
  673. if ( ! function_exists( 'kleo_switch_layout' ) ) {
  674. /**
  675. * Change site layout
  676. *
  677. * @param bool $layout
  678. * @param int $priority
  679. */
  680. function kleo_switch_layout( $layout = false, $priority = 10 ) {
  681. if ( false == $layout ) {
  682. $layout = sq_option( 'global_sidebar', 'right' );
  683. }
  684.  
  685. $main_width_2cols = (int) sq_option( 'main_width_2cols', 9 ) == 0 ? 9 : (int) sq_option( 'main_width_2cols', 9 );
  686. $main_width_3cols = (int) sq_option( 'main_width_3cols', 6 ) == 0 ? 6 : (int) sq_option( 'main_width_3cols', 6 );
  687.  
  688. $sidebar_width_2cols = 12 - $main_width_2cols;
  689. $sidebar_width_3cols = ( 12 - $main_width_3cols ) / 2;
  690.  
  691. switch ( $layout ) {
  692.  
  693. case 'left':
  694. add_action( 'kleo_after_content', 'kleo_sidebar', $priority );
  695. remove_action( 'kleo_after_content', 'kleo_extra_sidebar' );
  696. add_filter( 'kleo_main_template_classes', create_function( '$cols', '$cols = "col-sm-' . $main_width_2cols . ' col-sm-push-' . $sidebar_width_2cols . ' tpl-left"; return $cols;' ), $priority );
  697. add_filter( 'kleo_sidebar_classes', create_function( '$cols', '$cols = "col-sm-' . $sidebar_width_2cols . ' sidebar-left col-sm-pull-' . $main_width_2cols . '"; return $cols;' ), $priority );
  698. remove_filter( 'kleo_main_container_class', 'kleo_ret_full_container', $priority );
  699. break;
  700.  
  701. case 'no': //full width
  702. remove_action( 'kleo_after_content', 'kleo_sidebar' );
  703. remove_action( 'kleo_after_content', 'kleo_extra_sidebar' );
  704. add_filter( 'kleo_main_template_classes', create_function( '$cols', '$cols = "col-sm-12 tpl-no"; return $cols;' ), $priority );
  705.  
  706. //enable full-width elements
  707. $has_vc = kleo_has_shortcode( 'vc_row' );
  708. sq_kleo()->set_option( 'has_vc_shortcode', $has_vc );
  709.  
  710. if ( ! is_singular( 'product' ) && $has_vc ) {
  711. add_filter( 'kleo_main_container_class', 'kleo_ret_full_container', $priority );
  712. }
  713.  
  714. break;
  715.  
  716. case '3ll':
  717. add_action( 'kleo_after_content', 'kleo_sidebar', $priority );
  718. add_action( 'kleo_after_content', 'kleo_extra_sidebar', $priority );
  719. add_filter( 'kleo_main_template_classes', create_function( '$cols', '$cols = "col-sm-' . $main_width_3cols . ' col-sm-push-' . ( $sidebar_width_3cols * 2 ) . ' tpl-3ll"; return $cols;' ), $priority );
  720. add_filter( 'kleo_sidebar_classes', create_function( '$cols', '$cols = "col-sm-' . $sidebar_width_3cols . ' col-sm-pull-' . $main_width_3cols . ' sidebar-3ll"; return $cols;' ), $priority );
  721. add_filter( 'kleo_extra_sidebar_classes', create_function( '$cols', '$cols = "col-sm-' . $sidebar_width_3cols . ' col-sm-pull-' . $main_width_3cols . ' sidebar-3ll"; return $cols;' ), $priority );
  722. remove_filter( 'kleo_main_container_class', 'kleo_ret_full_container', $priority );
  723. break;
  724.  
  725. case '3lr':
  726. add_action( 'kleo_after_content', 'kleo_sidebar', $priority );
  727. add_action( 'kleo_after_content', 'kleo_extra_sidebar', $priority );
  728. add_filter( 'kleo_main_template_classes', create_function( '$cols', '$cols = "col-sm-' . $main_width_3cols . ' col-sm-push-' . $sidebar_width_3cols . ' tpl-3lr"; return $cols;' ), $priority );
  729. add_filter( 'kleo_sidebar_classes', create_function( '$cols', '$cols = "col-sm-' . $sidebar_width_3cols . ' col-sm-pull-' . $main_width_3cols . ' sidebar-3lr"; return $cols;' ), $priority );
  730. add_filter( 'kleo_extra_sidebar_classes', create_function( '$cols', '$cols = "col-sm-' . $sidebar_width_3cols . ' sidebar-3lr"; return $cols;' ), $priority );
  731. remove_filter( 'kleo_main_container_class', 'kleo_ret_full_container', $priority );
  732. break;
  733.  
  734. case '3rr':
  735. add_action( 'kleo_after_content', 'kleo_sidebar', $priority );
  736. add_action( 'kleo_after_content', 'kleo_extra_sidebar', $priority );
  737. add_filter( 'kleo_main_template_classes', create_function( '$cols', '$cols = "col-sm-' . $main_width_3cols . ' tpl-3rr"; return $cols;' ), $priority );
  738. add_filter( 'kleo_sidebar_classes', create_function( '$cols', '$cols = "col-sm-' . $sidebar_width_3cols . ' sidebar-3rr"; return $cols;' ), $priority );
  739. add_filter( 'kleo_extra_sidebar_classes', create_function( '$cols', '$cols = "col-sm-' . $sidebar_width_3cols . ' sidebar-3rr"; return $cols;' ), $priority );
  740. remove_filter( 'kleo_main_container_class', 'kleo_ret_full_container', $priority );
  741. break;
  742.  
  743. case 'right':
  744. default:
  745. add_action( 'kleo_after_content', 'kleo_sidebar', $priority );
  746. remove_action( 'kleo_after_content', 'kleo_extra_sidebar' );
  747. add_filter( 'kleo_main_template_classes', create_function( '$cols', '$cols = "col-sm-' . $main_width_2cols . ' tpl-right"; return $cols;' ), $priority );
  748. add_filter( 'kleo_sidebar_classes', create_function( '$cols', '$cols = "col-sm-' . $sidebar_width_2cols . ' sidebar-right"; return $cols;' ), $priority );
  749. remove_filter( 'kleo_main_container_class', 'kleo_ret_full_container', $priority );
  750. break;
  751. }
  752. }
  753. }
  754.  
  755. if ( ! function_exists( 'kleo_prepare_layout' ) ) {
  756. /**
  757. * Prepare site layout with different customizations
  758. * @global string $kleo_custom_logo
  759. */
  760. function kleo_prepare_layout() {
  761.  
  762. //Change the template
  763. $layout = sq_option( 'global_sidebar', 'right' );
  764.  
  765. if ( is_home() ) {
  766. $layout = sq_option( 'blog_layout', 'right' );
  767. } elseif ( is_archive() ) {
  768. $layout = sq_option( 'cat_layout', 'right' );
  769. } elseif ( is_single() ) {
  770. if ( get_cfield( 'post_layout' ) && get_cfield( 'post_layout' ) != 'default' ) {
  771. $layout = get_cfield( 'post_layout' );
  772. } elseif ( sq_option( 'blog_post_layout', 'default' ) != 'default' ) {
  773. $layout = sq_option( 'blog_post_layout', 'right' );
  774. }
  775. }
  776.  
  777. $layout = apply_filters( 'kleo_page_layout', $layout );
  778. kleo_switch_layout( $layout );
  779.  
  780. /* Single post of any post type */
  781. if ( is_singular() || is_home() ) {
  782. $topbar_status = get_cfield( 'topbar_status' );
  783. //Top bar
  784. if ( isset( $topbar_status ) ) {
  785. if ( '1' === $topbar_status ) {
  786. add_filter( 'kleo_show_top_bar', create_function( '', 'return 1;' ) );
  787. } elseif ( '0' === $topbar_status ) {
  788. add_filter( 'kleo_show_top_bar', create_function( '', 'return 0;' ) );
  789. }
  790. }
  791.  
  792. //Header and Footer settings
  793. if ( get_cfield( 'hide_header' ) && get_cfield( 'hide_header' ) == 1 ) {
  794. remove_action( 'kleo_header', 'kleo_show_header' );
  795. }
  796. if ( get_cfield( 'hide_footer' ) && get_cfield( 'hide_footer' ) == 1 ) {
  797. add_filter( 'kleo_footer_hidden', create_function( '$status', 'return true;' ) );
  798. }
  799. if ( get_cfield( 'hide_socket' ) && get_cfield( 'hide_socket' ) == 1 ) {
  800. remove_action( 'kleo_after_footer', 'kleo_show_socket' );
  801. }
  802.  
  803. //Custom logo
  804. if ( get_cfield( 'logo' ) ) {
  805. global $kleo_custom_logo;
  806. $kleo_custom_logo = get_cfield( 'logo' );
  807. add_filter( 'kleo_logo', create_function( '', 'global $kleo_custom_logo; return $kleo_custom_logo;' ) );
  808. }
  809.  
  810. //Remove shop icon
  811. if ( get_cfield( 'hide_shop_icon' ) && get_cfield( 'hide_shop_icon' ) == 1 ) {
  812. remove_filter( 'wp_nav_menu_items', 'kleo_woo_header_cart', 9 );
  813. remove_filter( 'kleo_mobile_header_icons', 'kleo_woo_mobile_icon', 10 );
  814. }
  815. //Remove search icon
  816. if ( get_cfield( 'hide_search_icon' ) && get_cfield( 'hide_search_icon' ) == 1 ) {
  817. remove_filter( 'wp_nav_menu_items', 'kleo_search_menu_item', 200, 2 );
  818. }
  819.  
  820. if ( get_cfield( 'header_layout' ) && get_cfield( 'header_layout' ) != 'default' ) {
  821. add_filter( 'sq_option', 'kleo_override_header_layout', 10, 2 );
  822. }
  823.  
  824. //title section css
  825. global $kleo_theme;
  826. if ( get_cfield( 'title_top_padding' ) && get_cfield( 'title_top_padding' ) != '' ) {
  827. $kleo_theme->add_css( '.main-title {padding-top: ' . get_cfield( 'title_top_padding' ) . 'px;}' );
  828. }
  829. if ( get_cfield( 'title_bottom_padding' ) && get_cfield( 'title_bottom_padding' ) != '' ) {
  830. $kleo_theme->add_css( '.main-title {padding-bottom: ' . get_cfield( 'title_bottom_padding' ) . 'px;}' );
  831. }
  832. if ( get_cfield( 'title_color' ) && get_cfield( 'title_color' ) != '#' && get_cfield( 'title_color' ) != '' ) {
  833. $kleo_theme->add_css( '.main-title, .main-title h1, .main-title a, .main-title span, .breadcrumb > li + li:before {color: ' . get_cfield( 'title_color' ) . ' !important;}' );
  834. }
  835. if ( get_cfield( 'title_bg_color' ) && get_cfield( 'title_bg_color' ) != '#' && get_cfield( 'title_bg_color' ) != '' ) {
  836. $kleo_theme->add_css( '.main-title {background-color: ' . get_cfield( 'title_bg_color' ) . ' !important;}' );
  837. }
  838. if ( get_cfield( 'title_bg' ) && is_array( get_cfield( 'title_bg' ) ) ) {
  839. $title_bg = get_cfield( 'title_bg' );
  840. if ( isset( $title_bg['url'] ) && '' != $title_bg['url'] ) {
  841. $kleo_theme->add_css( '.main-title {' .
  842. 'background-image: url("' . $title_bg['url'] . '");' .
  843. 'background-repeat: ' . $title_bg['repeat'] . ';' .
  844. 'background-size: ' . $title_bg['size'] . ';' .
  845. 'background-attachment: ' . $title_bg['attachment'] . ';' .
  846. 'background-position: ' . $title_bg['position'] . ';' .
  847. '}'
  848. );
  849. }
  850. }
  851. }
  852.  
  853. //Show title in main content - if set from Theme options
  854. add_action( 'kleo_before_main_content', 'kleo_title_main_content' );
  855. }
  856. }
  857.  
  858. add_action( 'wp_head', 'kleo_prepare_layout' );
  859.  
  860.  
  861. //get the global sidebar
  862. if ( ! function_exists( 'kleo_sidebar' ) ) :
  863. function kleo_sidebar() {
  864. get_sidebar();
  865. }
  866. endif;
  867.  
  868. //get the extra sidebar
  869. if ( ! function_exists( 'kleo_extra_sidebar' ) ) :
  870. function kleo_extra_sidebar() {
  871. $classes = apply_filters( 'kleo_extra_sidebar_classes', '' );
  872.  
  873. echo '<div class="sidebar sidebar-extra ' . $classes . '">'
  874. . '<div class="inner-content">';
  875.  
  876. generated_dynamic_sidebar( 'extra' );
  877.  
  878. echo '</div>'
  879. . '</div> <!--end sidebar columns-->';
  880. }
  881. endif;
  882.  
  883. function kleo_ret_full_container() {
  884. return 'container-full';
  885. }
  886.  
  887. if ( ! function_exists( 'kleo_title_main_content' ) ) {
  888. /**
  889. * Echo the title if it was set to show in main content area
  890. */
  891. function kleo_title_main_content() {
  892. if ( sq_option( 'title_location', 'breadcrumb' ) == 'main' ) {
  893.  
  894. $title_status = true;
  895. if ( ( is_singular() || is_home() ) && get_cfield( 'title_checkbox' ) == 1 ) {
  896. $title_status = false;
  897. }
  898.  
  899. if ( $title_status ) {
  900. if ( ( is_singular() || is_home() ) && get_cfield( 'custom_title' ) && get_cfield( 'custom_title' ) != '' ) {
  901. $title = get_cfield( 'custom_title' );
  902. } else {
  903. $title = kleo_title();
  904. }
  905.  
  906. echo '<div class="container">';
  907. echo '<h1 class="page-title">' . $title . '</h1>';
  908. echo '</div>';
  909. }
  910. }
  911. }
  912. }
  913.  
  914. /* Change the html page title if we set a custom title */
  915. add_filter( 'single_post_title', 'kleo_check_single_post_title', 10, 2 );
  916. function kleo_check_single_post_title( $title, $post = false ) {
  917.  
  918. if ( ! $post || ! isset( $post->ID ) ) {
  919. return $title;
  920. }
  921.  
  922. if ( get_cfield( 'custom_title', $post->ID ) && get_cfield( 'custom_title', $post->ID ) != '' ) {
  923. return get_cfield( 'custom_title', $post->ID );
  924. }
  925.  
  926. return $title;
  927. }
  928.  
  929.  
  930. /***************************************************
  931. * :: Render the header section with the menus
  932. ***************************************************/
  933.  
  934. function kleo_show_header() {
  935. get_template_part( 'page-parts/general-header-section' );
  936. }
  937.  
  938. add_action( 'kleo_header', 'kleo_show_header' );
  939.  
  940.  
  941. /***************************************************
  942. * :: Extra body classes
  943. ***************************************************/
  944.  
  945. add_filter( 'body_class', 'kleo_body_classes' );
  946.  
  947. /**
  948. * Adds specific classes to body element
  949. *
  950. * @param array $classes
  951. *
  952. * @return array
  953. * @since 1.0
  954. */
  955. function kleo_body_classes( $classes = array() ) {
  956.  
  957. if ( is_admin_bar_showing() && sq_option( 'admin_bar', 1 ) == 1 ) {
  958. $classes[] = 'adminbar-enable';
  959. }
  960.  
  961. if ( sq_option( 'responsive_design', 1 ) == 0 ) {
  962. $classes[] = 'not-responsive';
  963. }
  964.  
  965. if ( sq_option( 'sticky_menu', 1 ) == 1 ) {
  966. $classes[] = 'kleo-navbar-fixed';
  967.  
  968. if ( sq_option( 'resize_logo', 1 ) == 1 ) {
  969. $classes[] = 'navbar-resize';
  970. }
  971. }
  972.  
  973. if ( ( sq_option( 'sticky_menu', 1 ) == 1 && sq_option( 'transparent_logo', 1 ) == 1 )
  974. || ( is_singular() && get_cfield( 'transparent_menu' ) )
  975. ) {
  976. $classes[] = 'navbar-transparent';
  977.  
  978. if ( get_cfield( 'transparent_menu_color' ) === 'black' ) {
  979. $classes[] = 'on-light-bg';
  980. } else {
  981. $classes[] = 'on-dark-bg';
  982. }
  983.  
  984. if ( sq_option( 'header_overlay_hover', 0 ) == 1 ) {
  985. $classes[] = 'navbar-hover-opacity';
  986. }
  987. }
  988.  
  989. if ( sq_option( 'sitewide_animations', 'enabled' ) == 'disable-all' ) {
  990. $classes[] = 'disable-all-animations';
  991. }
  992.  
  993. if ( sq_option( 'sitewide_animations', 'enabled' ) == 'disable-mobile' ) {
  994. $classes[] = 'disable-all-animations-on-mobile';
  995. }
  996.  
  997. if ( sq_option( 'menu_full_width', 0 ) == 1 || ( is_singular() && get_cfield( 'menu_full_width' ) ) ) {
  998. $classes[] = 'navbar-full-width';
  999. }
  1000.  
  1001. /* Flexmenu */
  1002. if ( sq_option( 'header_flexmenu', 0 ) == 1 ) {
  1003. $classes[] = 'header-overflow';
  1004. $classes[] = 'header-flexmenu';
  1005. }
  1006.  
  1007. /* Two row header */
  1008. $header_style = sq_option( 'header_layout', 'normal' );
  1009. if ( 'left_logo' == $header_style || 'center_logo' == $header_style ) {
  1010. $classes[] = 'header-two-rows';
  1011. }
  1012.  
  1013. return $classes;
  1014. }
  1015.  
  1016. // -----------------------------------------------------------------------------
  1017.  
  1018.  
  1019. /***************************************************
  1020. * :: Theme options link in Admin bar
  1021. ***************************************************/
  1022.  
  1023. add_action( 'admin_bar_menu', 'kleo_add_adminbar_options', 100 );
  1024.  
  1025. /**
  1026. * @param WP_Admin_Bar $admin_bar
  1027. */
  1028. function kleo_add_adminbar_options( $admin_bar ) {
  1029. if ( is_super_admin() && ! is_admin() ) {
  1030. $admin_bar->add_menu( array(
  1031. 'id' => 'theme-options',
  1032. 'title' => __( 'Theme options', 'kleo_framework' ),
  1033. 'href' => get_admin_url() . 'admin.php?page=kleo_options',
  1034. 'meta' => array(
  1035. 'title' => __( 'Theme options', 'kleo_framework' ),
  1036. 'target' => '_blank',
  1037. ),
  1038. ) );
  1039. }
  1040.  
  1041. }
  1042.  
  1043. /***************************************************
  1044. * :: Add mp4, webm and ogv mimes for uploads
  1045. ***************************************************/
  1046.  
  1047. add_filter( 'upload_mimes', 'kleo_add_upload_mimes' );
  1048. if ( ! function_exists( 'kleo_add_upload_mimes' ) ) {
  1049. function kleo_add_upload_mimes( $mimes ) {
  1050. return array_merge( $mimes, array( 'mp4' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm' ) );
  1051. }
  1052. }
  1053.  
  1054.  
  1055. /***************************************************
  1056. * :: Scripts/Styles load
  1057. ***************************************************/
  1058.  
  1059. add_action( 'wp_enqueue_scripts', 'kleo_frontend_files' );
  1060. if ( ! function_exists( 'kleo_frontend_files' ) ) :
  1061. // Register some javascript files
  1062. function kleo_frontend_files() {
  1063. $min = sq_option( 'dev_mode', 0 ) == 1 ? '' : '.min';
  1064.  
  1065. /* If remove query option is ON */
  1066. if ( sq_option( 'perf_remove_query', 0 ) == 1 ) {
  1067. $version = null;
  1068. } else {
  1069. $version = KLEO_THEME_VERSION;
  1070. }
  1071.  
  1072. //head scripts
  1073. //wp_register_script( 'kleo-init', get_template_directory_uri() . '/assets/js/init.js', array(), $version, false );
  1074. wp_register_script( 'modernizr', get_template_directory_uri() . '/assets/js/modernizr.custom.46504.js', array(), $version, false );
  1075.  
  1076. /* Footer scripts */
  1077. if ( sq_option( 'perf_combine_js', 0 ) == 1 ) {
  1078. wp_register_script( 'kleo-combined', get_template_directory_uri() . '/assets/js/combined' . $min . '.js', array( 'jquery' ), $version, true );
  1079. } else {
  1080. wp_register_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap' . $min . '.js', array( 'jquery' ), $version, true );
  1081. wp_register_script( 'waypoints', get_template_directory_uri() . '/assets/js/plugins/waypoints.min.js', array( 'jquery' ), $version, true );
  1082. wp_register_script( 'magnific-popup', get_template_directory_uri() . '/assets/js/plugins/magnific-popup/magnific.min.js', array( 'jquery' ), $version, true );
  1083. wp_register_script( 'caroufredsel', get_template_directory_uri() . '/assets/js/plugins/carouFredSel/jquery.carouFredSel-6.2.0-packed.js', array( 'jquery' ), $version, true );
  1084. wp_register_script( 'jquery-mousewheel', get_template_directory_uri() . '/assets/js/plugins/carouFredSel/helper-plugins/jquery.mousewheel.min.js', array(
  1085. 'jquery',
  1086. 'caroufredsel',
  1087. ), $version, true );
  1088. wp_register_script( 'jquery-touchswipe', get_template_directory_uri() . '/assets/js/plugins/carouFredSel/helper-plugins/jquery.touchSwipe.min.js', array(
  1089. 'jquery',
  1090. 'caroufredsel',
  1091. ), $version, true );
  1092. wp_register_script( 'isotope', get_template_directory_uri() . '/assets/js/plugins/jquery.isotope.min.js', array( 'jquery' ), $version, true );
  1093.  
  1094. }
  1095. wp_register_script( 'app', get_template_directory_uri() . '/assets/js/app' . $min . '.js', array( 'jquery' ), $version, true );
  1096.  
  1097. //not loaded by default. Only when needed by shortcodes
  1098. wp_register_script( 'three-canvas', get_template_directory_uri() . '/assets/js/plugins/snow/ThreeCanvas.js', array( 'app' ), $version, true );
  1099. wp_register_script( 'snow', get_template_directory_uri() . '/assets/js/plugins/snow/Snow.js', array( 'three-canvas' ), $version, true );
  1100. wp_register_script( 'particles-js', get_template_directory_uri() . '/assets/js/plugins/particles.min.js', array( 'jquery' ), $version, true );
  1101. wp_register_script( 'bootstrap-multiselect', get_template_directory_uri() . '/assets/js/plugins/bootstrap-multiselect.js', array( 'jquery' ), $version, true );
  1102.  
  1103. //enqueue them
  1104. //wp_enqueue_script( 'kleo-init' );
  1105. wp_enqueue_script( 'modernizr' );
  1106.  
  1107. if ( sq_option( 'perf_combine_js', 0 ) == 1 ) {
  1108. wp_enqueue_script( 'kleo-combined' );
  1109. } else {
  1110. wp_enqueue_script( 'bootstrap' );
  1111. wp_enqueue_script( 'waypoints' );
  1112. wp_enqueue_script( 'magnific-popup' );
  1113. wp_enqueue_script( 'caroufredsel' );
  1114. wp_enqueue_script( 'jquery-touchswipe' );
  1115. wp_enqueue_script( 'isotope' );
  1116. }
  1117. wp_enqueue_script( 'mediaelement' );
  1118. wp_enqueue_script( 'app' );
  1119.  
  1120. $regular_logo = sq_option_url( 'logo', '' );
  1121. if ( is_singular() && get_cfield( 'logo' ) ) {
  1122. $regular_logo = get_cfield( 'logo' );
  1123. }
  1124. $retina_logo = sq_option_url( 'logo_retina' ) != '' ? sq_option_url( 'logo_retina' ) : '';
  1125. if ( is_singular() && get_cfield( 'logo_retina' ) ) {
  1126. $retina_logo = get_cfield( 'logo_retina' );
  1127. }
  1128. $header_height = intval( sq_option( 'menu_height', 88 ) );
  1129. $header_height_scrolled = intval( sq_option( 'menu_height_scrolled', '' ) );
  1130. $header_two_height = intval( sq_option( 'menu_two_height', 88 ) );
  1131. $header_two_height_scrolled = intval( sq_option( 'menu_two_height_scrolled', '' ) );
  1132. $header_resize_offset = sq_option( 'menu_scroll_offset', '' ) != '' ? intval( sq_option( 'menu_scroll_offset', '' ) ) : '';
  1133.  
  1134. $obj_array = array(
  1135. 'ajaxurl' => admin_url( 'admin-ajax.php' ),
  1136. 'themeUrl' => get_template_directory_uri(),
  1137. 'loginUrl' => site_url( 'wp-login.php', 'login_post' ),
  1138. 'goTop' => sq_option( 'go_top', 1 ),
  1139. 'ajaxSearch' => sq_option( 'ajax_search', 1 ),
  1140. 'alreadyLiked' => sq_option( 'likes_already', 'You already like this' ),
  1141. 'logo' => $regular_logo,
  1142. 'retinaLogo' => $retina_logo,
  1143. 'headerHeight' => $header_height,
  1144. 'headerHeightScrolled' => $header_height_scrolled,
  1145. 'headerTwoRowHeight' => $header_two_height,
  1146. 'headerTwoRowHeightScrolled' => $header_two_height_scrolled,
  1147. 'headerResizeOffset' => $header_resize_offset,
  1148. 'loadingmessage' => '<i class="icon icon-spin5 animate-spin"></i> ' . __( 'Sending info, please wait...', 'kleo_framework' ),
  1149. 'DisableMagnificGallery' => sq_option( 'magnific_disable_gallery', '0' ),
  1150. 'flexMenuEnabled' => sq_option( 'header_flexmenu', 0 ),
  1151. );
  1152. $obj_array = apply_filters( 'kleo_localize_app', $obj_array );
  1153.  
  1154. wp_localize_script( 'app', 'kleoFramework', $obj_array );
  1155.  
  1156. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  1157. wp_enqueue_script( 'comment-reply' );
  1158. }
  1159.  
  1160. /* Register the styles */
  1161.  
  1162. /* register only when Theme options - combine option is OFF */
  1163. if ( sq_option( 'perf_combine_css', 0 ) == 0 ) {
  1164. wp_register_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap' . $min . '.css', array(), $version, 'all' );
  1165. wp_register_style( 'kleo-app', get_template_directory_uri() . '/assets/css/app' . $min . '.css', array(), $version, 'all' );
  1166. wp_register_style( 'magnific-popup', get_template_directory_uri() . '/assets/js/plugins/magnific-popup/magnific.css', array(), $version, 'all' );
  1167.  
  1168. wp_enqueue_style( 'bootstrap' );
  1169. wp_enqueue_style( 'kleo-app' );
  1170. wp_enqueue_style( 'magnific-popup' );
  1171. }
  1172.  
  1173. /* Load font icons */
  1174. $override_fonts = false;
  1175. if ( is_child_theme() && file_exists( get_stylesheet_directory() . '/assets/css/fontello.css' ) ) {
  1176. $fonts_path = get_stylesheet_directory_uri() . '/assets/css/fontello.css';
  1177. $override_fonts = true;
  1178. } else {
  1179. $fonts_path = get_template_directory_uri() . '/assets/css/fontello' . $min . '.css';
  1180. }
  1181.  
  1182. wp_register_style( 'kleo-fonts', $fonts_path, array(), $version, 'all' );
  1183. wp_register_style( 'kleo-style', CHILD_THEME_URI . '/style.css', array(), $version, 'all' );
  1184. wp_register_style( 'kleo-rtl', get_template_directory_uri() . '/rtl.css', array(), $version, 'all' );
  1185.  
  1186. //load fonts file if we not overriding font file in child theme
  1187. if ( 0 == sq_option( 'perf_combine_css', 0 ) || ( 1 == sq_option( 'perf_combine_css', 0 ) && true === $override_fonts ) ) {
  1188. wp_enqueue_style( 'kleo-fonts' );
  1189. }
  1190.  
  1191. //enqueue required styles
  1192. wp_enqueue_style( 'mediaelement' );
  1193.  
  1194. } // end kleo_frontend_files()
  1195. endif;
  1196.  
  1197.  
  1198. add_action( 'wp_enqueue_scripts', 'kleo_load_files_plugin_compat', 1000 );
  1199.  
  1200. function kleo_load_files_plugin_compat() {
  1201. $min = sq_option( 'dev_mode', 0 ) == 0 ? '.min' : '';
  1202.  
  1203. /* If remove query option is ON */
  1204. if ( 1 == sq_option( 'perf_remove_query', 0 ) ) {
  1205. $version = null;
  1206. } else {
  1207. $version = KLEO_THEME_VERSION;
  1208. }
  1209.  
  1210. /* Combine CSS option */
  1211. if ( sq_option( 'perf_combine_css', 0 ) == 0 ) {
  1212. wp_register_style( 'kleo-plugins', get_template_directory_uri() . '/assets/css/plugins' . $min . '.css', array(), $version, 'all' );
  1213. wp_enqueue_style( 'kleo-plugins' );
  1214. }
  1215.  
  1216. //wp_enqueue_style( 'mediaelement-skin' );
  1217.  
  1218. do_action( 'kleo_late_styles' );
  1219.  
  1220. //enqueue child theme style only if activated
  1221. if ( is_child_theme() ) {
  1222. if ( is_rtl() ) {
  1223. wp_enqueue_style( 'kleo-rtl' );
  1224. }
  1225. wp_enqueue_style( 'kleo-style' );
  1226. }
  1227.  
  1228.  
  1229. } // kleo_load_css_files_plugin_compat()
  1230.  
  1231. add_action( 'wp_enqueue_scripts', 'kleo_load_combined_files', 20 );
  1232.  
  1233. function kleo_load_combined_files() {
  1234. $min = sq_option( 'dev_mode', 0 ) == 0 ? '.min' : '';
  1235.  
  1236. /* If remove query option is ON */
  1237. if ( sq_option( 'perf_remove_query', 0 ) == 1 ) {
  1238. $version = null;
  1239. } else {
  1240. $version = KLEO_THEME_VERSION;
  1241. }
  1242.  
  1243. if ( sq_option( 'perf_combine_css', 0 ) == 1 ) {
  1244.  
  1245. $override_fonts = false;
  1246. if ( is_child_theme() && file_exists( get_stylesheet_directory() . '/assets/css/fontello.css' ) ) {
  1247. $override_fonts = true;
  1248. }
  1249.  
  1250. //Load
  1251. if ( true === $override_fonts ) {
  1252. $combined_file = 'combined';
  1253. } else {
  1254. $combined_file = 'combined-and-fonts';
  1255. }
  1256.  
  1257. wp_register_style( 'kleo-combined', get_template_directory_uri() . '/assets/css/' . $combined_file . $min . '.css', array(), $version, 'all' );
  1258. wp_enqueue_style( 'kleo-combined' );
  1259. }
  1260. }
  1261.  
  1262. function kleo_add_inline_js_helper_classes() {
  1263. ?>
  1264. <script type="text/javascript">
  1265. /*
  1266. prevent dom flickering for elements hidden with js
  1267. */
  1268. "use strict";
  1269.  
  1270. document.documentElement.className += ' js-active ';
  1271. document.documentElement.className += 'ontouchstart' in document.documentElement ? ' kleo-mobile ' : ' kleo-desktop ';
  1272.  
  1273. var prefix = ['-webkit-', '-o-', '-moz-', '-ms-', ""];
  1274. for (var i in prefix) {
  1275. if (prefix[i] + 'transform' in document.documentElement.style) document.documentElement.className += " kleo-transform ";
  1276. }
  1277. </script>
  1278. <?php
  1279. }
  1280.  
  1281. add_action( 'wp_head', 'kleo_add_inline_js_helper_classes' );
  1282.  
  1283.  
  1284. if ( ! function_exists( 'remove_wp_open_sans' ) ) {
  1285. /**
  1286. * Remove duplicate Open Sans from WordPress
  1287. */
  1288. function kleo_remove_wp_open_sans() {
  1289. $font_link = get_transient( KLEO_DOMAIN . '_google_link' );
  1290. if ( strpos( $font_link, 'Open+Sans' ) !== false ) {
  1291. wp_deregister_style( 'open-sans' );
  1292. wp_register_style( 'open-sans', false );
  1293. }
  1294. }
  1295.  
  1296. add_action( 'wp_enqueue_scripts', 'kleo_remove_wp_open_sans' );
  1297. }
  1298.  
  1299.  
  1300. /***************************************************
  1301. * :: ADMIN CSS & JS
  1302. ***************************************************/
  1303. function kleo_admin_styles() {
  1304.  
  1305. wp_register_style( 'kleo-admin', KLEO_LIB_URI . '/assets/admin-custom.css', array(), KLEO_THEME_VERSION, 'all' );
  1306. wp_register_style( 'kleo-fonts', kleo_get_fonts_path(), array(), KLEO_THEME_VERSION, 'all' );
  1307.  
  1308. wp_enqueue_style( 'kleo-admin' );
  1309.  
  1310. wp_register_script( 'kleo-admin', KLEO_LIB_URI . '/assets/admin-custom.js', array(), KLEO_THEME_VERSION, true );
  1311. wp_enqueue_script( 'kleo-admin' );
  1312. }
  1313.  
  1314. add_action( 'admin_enqueue_scripts', 'kleo_admin_styles' );
  1315.  
  1316.  
  1317.  
  1318. function kleo_get_fonts_path() {
  1319. $fonts_path = get_template_directory_uri() . '/assets/css/fontello.css';
  1320. if ( is_child_theme() && file_exists( get_stylesheet_directory() . '/assets/css/fontello.css' ) ) {
  1321. $fonts_path = get_stylesheet_directory_uri() . '/assets/css/fontello.css';
  1322. }
  1323.  
  1324. return $fonts_path;
  1325. }
  1326.  
  1327. /***************************************************
  1328. * :: Customize wp-login.php
  1329. ***************************************************/
  1330. function custom_login_css() {
  1331.  
  1332. echo "\n<style>";
  1333.  
  1334. //echo $kleo_theme->get_bg_css('header_background', 'body.login');
  1335.  
  1336. echo '.login h1 a { background-image: url("' . sq_option_url( 'logo', 'none' ) . '");background-size: contain;min-height: 88px;width:auto;}';
  1337. echo '#login {padding: 20px 0 0;}';
  1338. echo '.login #nav a, .login #backtoblog a {color:' . sq_option( 'header_primary_color' ) . '!important;text-shadow:none;}';
  1339.  
  1340. echo "</style>\n";
  1341. }
  1342.  
  1343. add_action( 'login_head', 'custom_login_css', 12 );
  1344.  
  1345. function kleo_new_wp_login_url() {
  1346. return home_url();
  1347. }
  1348.  
  1349. add_filter( 'login_headerurl', 'kleo_new_wp_login_url' );
  1350.  
  1351. function kleo_new_wp_login_title() {
  1352. return get_option( 'blogname' );
  1353. }
  1354.  
  1355. add_filter( 'login_headertitle', 'kleo_new_wp_login_title' );
  1356.  
  1357.  
  1358. /***************************************************
  1359. * :: Load Fonts and Quick CSS
  1360. ***************************************************/
  1361. sq_kleo()->add_google_fonts_link();
  1362. add_action( 'wp_head', array( $kleo_theme, 'render_css' ), 15 );
  1363.  
  1364.  
  1365. /***************************************************
  1366. * :: Dynamic CSS Logic
  1367. ***************************************************/
  1368. require_once( KLEO_LIB_DIR . '/dynamic-css.php' );
  1369.  
  1370.  
  1371. /***************************************************
  1372. * :: Modal Ajax login && Modal Lost Password
  1373. ***************************************************/
  1374.  
  1375. add_action( 'wp_footer', 'kleo_load_popups', 12 );
  1376.  
  1377. function kleo_load_popups() {
  1378. get_template_part( 'page-parts/general-popups' );
  1379. }
  1380.  
  1381. add_action( 'init', 'kleo_ajax_login' );
  1382.  
  1383. if ( ! function_exists( 'kleo_ajax_login' ) ) {
  1384. function kleo_ajax_login() {
  1385.  
  1386. /* If not our action, bail out */
  1387. if ( ! isset( $_POST['action'] ) || ( isset( $_POST['action'] ) && 'kleoajaxlogin' != $_POST['action'] ) ) {
  1388. return false;
  1389. }
  1390.  
  1391. /* If user is already logged in print a specific message */
  1392. if ( is_user_logged_in() ) {
  1393. $link = 'javascript:window.location.reload();return false;';
  1394. echo wp_json_encode( array(
  1395. 'loggedin' => false,
  1396. 'message' => '<i class="icon icon-info-circled"></i> ' . sprintf( __( 'You are already logged in. Please <a href="#" onclick="%s">refresh</a> page', 'kleo_framework' ), $link ),
  1397. ) );
  1398. die();
  1399. }
  1400.  
  1401. // Check the nonce, if it fails the function will break
  1402. check_ajax_referer( 'kleo-ajax-login-nonce', 'security' );
  1403.  
  1404. // Nonce is checked, continue
  1405. $secure_cookie = '';
  1406.  
  1407. // If the user wants ssl but the session is not ssl, force a secure cookie.
  1408. if ( ! empty( $_POST['log'] ) && ! force_ssl_admin() ) {
  1409. $user_name = sanitize_user( $_POST['log'] );
  1410. if ( $user = get_user_by( 'login', $user_name ) ) {
  1411. if ( get_user_option( 'use_ssl', $user->ID ) ) {
  1412. $secure_cookie = true;
  1413. force_ssl_admin( true );
  1414. }
  1415. }
  1416. }
  1417.  
  1418. if ( isset( $_REQUEST['redirect_to'] ) ) {
  1419. $redirect_to = $_REQUEST['redirect_to'];
  1420. // Redirect to https if user wants ssl
  1421. if ( $secure_cookie && false !== strpos( $redirect_to, 'wp-admin' ) ) {
  1422. $redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
  1423. }
  1424. } else {
  1425. $redirect_to = '';
  1426. }
  1427.  
  1428. $user_signon = wp_signon( '', $secure_cookie );
  1429. if ( is_wp_error( $user_signon ) ) {
  1430. $error_msg = $user_signon->get_error_message();
  1431. echo wp_json_encode( array(
  1432. 'loggedin' => false,
  1433. 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . $error_msg . '</span>',
  1434. ) );
  1435. //echo json_encode(array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . __( 'Wrong username or password. Please try again.', 'kleo_framework' ) . '</span>' ));
  1436. } else {
  1437. if ( sq_option( 'login_redirect', 'default' ) == 'reload' ) {
  1438. $redirecturl = null;
  1439. } else {
  1440. $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
  1441. /**
  1442. * Filter the login redirect URL.
  1443. *
  1444. * @since 3.0.0
  1445. *
  1446. * @param string $redirect_to The redirect destination URL.
  1447. * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
  1448. * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
  1449. */
  1450. $redirecturl = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user_signon );
  1451.  
  1452. }
  1453.  
  1454. echo wp_json_encode( array(
  1455. 'loggedin' => true,
  1456. 'redirecturl' => $redirecturl,
  1457. 'message' => '<span class="good-response"><i class="icon icon-ok-circled"></i> ' . __( 'Login successful, redirecting...', 'kleo_framework' ) . '</span>',
  1458. ) );
  1459. }
  1460.  
  1461. die();
  1462. }
  1463. }
  1464.  
  1465.  
  1466. if ( ! function_exists( 'kleo_lost_password_ajax' ) ) {
  1467. function kleo_lost_password_ajax() {
  1468. global $wpdb, $wp_hasher;
  1469.  
  1470. $errors = new WP_Error();
  1471.  
  1472. if ( isset( $_POST ) ) {
  1473.  
  1474. if ( empty( $_POST['user_login'] ) ) {
  1475. $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Enter a username or e-mail address.' ) );
  1476. } elseif ( strpos( $_POST['user_login'], '@' ) ) {
  1477. $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) );
  1478. if ( empty( $user_data ) ) {
  1479. $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: There is no user registered with that email address.' ) );
  1480. }
  1481. } else {
  1482. $login = trim( $_POST['user_login'] );
  1483. $user_data = get_user_by( 'login', $login );
  1484. }
  1485.  
  1486. /**
  1487. * Fires before errors are returned from a password reset request.
  1488. *
  1489. * @since 2.1.0
  1490. */
  1491. do_action( 'lostpassword_post' );
  1492.  
  1493. if ( $errors->get_error_code() ) {
  1494. echo '<span class="wrong-response">' . $errors->get_error_message() . '</span>';
  1495. die();
  1496. }
  1497.  
  1498. if ( ! $user_data ) {
  1499. $errors->add( 'invalidcombo', __( '<strong>ERROR</strong>: Invalid username or e-mail.' ) );
  1500. echo '<span class="wrong-response">' . $errors->get_error_message() . '</span>';
  1501. die();
  1502. }
  1503.  
  1504. // Redefining user_login ensures we return the right case in the email.
  1505. $user_login = $user_data->user_login;
  1506. $user_email = $user_data->user_email;
  1507.  
  1508. /**
  1509. * Fires before a new password is retrieved.
  1510. *
  1511. * @since 1.5.0
  1512. * @deprecated 1.5.1 Misspelled. Use 'retrieve_password' hook instead.
  1513. *
  1514. * @param string $user_login The user login name.
  1515. */
  1516. do_action( 'retreive_password', $user_login );
  1517.  
  1518. /**
  1519. * Fires before a new password is retrieved.
  1520. *
  1521. * @since 1.5.1
  1522. *
  1523. * @param string $user_login The user login name.
  1524. */
  1525. do_action( 'retrieve_password', $user_login );
  1526.  
  1527. /**
  1528. * Filter whether to allow a password to be reset.
  1529. *
  1530. * @since 2.7.0
  1531. *
  1532. * @param bool true Whether to allow the password to be reset. Default true.
  1533. * @param int $user_data ->ID The ID of the user attempting to reset a password.
  1534. */
  1535. $allow = apply_filters( 'allow_password_reset', true, $user_data->ID );
  1536.  
  1537. if ( ! $allow ) {
  1538. echo '<span class="wrong-response">' . __( 'Password reset is not allowed for this user' ) . '</span>';
  1539. die();
  1540. } elseif ( is_wp_error( $allow ) ) {
  1541. echo '<span class="wrong-response">' . $allow->get_error_message() . '</span>';
  1542. die();
  1543. }
  1544.  
  1545. // Generate something random for a password reset key.
  1546. $key = wp_generate_password( 20, false );
  1547.  
  1548. /**
  1549. * Fires when a password reset key is generated.
  1550. *
  1551. * @since 2.5.0
  1552. *
  1553. * @param string $user_login The username for the user.
  1554. * @param string $key The generated password reset key.
  1555. */
  1556. do_action( 'retrieve_password_key', $user_login, $key );
  1557.  
  1558. // Now insert the key, hashed, into the DB.
  1559. if ( empty( $wp_hasher ) ) {
  1560. require_once ABSPATH . WPINC . '/class-phpass.php';
  1561. $wp_hasher = new PasswordHash( 8, true );
  1562. }
  1563. $hashed = time() . ':' . $wp_hasher->HashPassword( $key );
  1564. $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user_login ) );
  1565.  
  1566. $message = __( 'Someone requested that the password be reset for the following account:' ) . "\r\n\r\n";
  1567. $message .= network_home_url( '/' ) . "\r\n\r\n";
  1568. $message .= sprintf( __( 'Username: %s' ), $user_login ) . "\r\n\r\n";
  1569. $message .= __( 'If this was a mistake, just ignore this email and nothing will happen.' ) . "\r\n\r\n";
  1570. $message .= __( 'To reset your password, visit the following address:' ) . "\r\n\r\n";
  1571. $message .= '<' . network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode( $user_login ), 'login' ) . ">\r\n";
  1572.  
  1573. if ( is_multisite() ) {
  1574. $blogname = $GLOBALS['current_site']->site_name;
  1575. } else /*
  1576. * The blogname option is escaped with esc_html on the way into the database
  1577. * in sanitize_option we want to reverse this for the plain text arena of emails.
  1578. */ {
  1579. $blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
  1580. }
  1581.  
  1582. $title = sprintf( __( '[%s] Password Reset' ), $blogname );
  1583.  
  1584. /**
  1585. * Filter the subject of the password reset email.
  1586. *
  1587. * @since 2.8.0
  1588. *
  1589. * @param string $title Default email title.
  1590. */
  1591. $title = apply_filters( 'retrieve_password_title', $title );
  1592. /**
  1593. * Filter the message body of the password reset mail.
  1594. *
  1595. * @since 2.8.0
  1596. *
  1597. * @param string $message Default mail message.
  1598. * @param string $key The activation key.
  1599. */
  1600. $message = apply_filters( 'retrieve_password_message', $message, $key );
  1601.  
  1602.  
  1603. if ( $message && ! wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) {
  1604. echo '<span class="wrong-response">' . __( 'Failure!', 'kleo_framework' );
  1605. echo __( 'The e-mail could not be sent.' );
  1606. echo '</span>';
  1607. die();
  1608. } else {
  1609. echo '<span class="good-response">' . __( 'Email successfully sent!', 'kleo_framework' ) . '</span>';
  1610. die();
  1611. }
  1612. }
  1613. die();
  1614. }
  1615. }
  1616. add_action( "wp_ajax_kleo_lost_password", "kleo_lost_password_ajax" );
  1617. add_action( 'wp_ajax_nopriv_kleo_lost_password', 'kleo_lost_password_ajax' );
  1618. // -----------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment