Advertisement
Guest User

Dragonheart functions.php

a guest
Jun 27th, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 86.98 KB | None | 0 0
  1. <?php
  2. global $wpdb;
  3.  
  4. require( get_template_directory() . '/inc/theme-settings.php');                //Building theme administration
  5.  
  6. require( get_template_directory() . '/inc/meta-boxes.php');                    //Building meta boxes
  7.  
  8. require( get_template_directory() . '/inc/post-types.php');                    //Building post types
  9.  
  10. require( get_template_directory() . '/inc/custom-taxonomies.php');             //Building post types
  11.  
  12. function tk_theme_name() {
  13.     return 'beautypress';
  14. }
  15.  
  16. define('tk_theme_name', 'beautypress');
  17. update_option('tk_theme_name', tk_theme_name);
  18.  
  19. $lang = get_template_directory() . '/languages/';                               //Make this theme available for translation.
  20. load_theme_textdomain(tk_theme_name, $lang);
  21.  
  22. add_theme_support('automatic-feed-links');
  23.  
  24. add_theme_support('custom-background');
  25.  
  26. add_theme_support('post-thumbnails');                                         //This enables Post Thumbnails support for this theme.
  27. add_image_size('gallery', 412, 276, true);
  28. add_image_size('gallery3home', 377, 253, true);
  29. add_image_size('teammembers', 601, 9999);
  30. add_image_size('teammembers-slide', 297, 246, true);
  31. add_image_size('servicesthumb', 71, 71, true);
  32. add_image_size('servicest-big', 606, 9999);
  33. add_image_size('gallery-big', 960, 9999);
  34. add_image_size('partner', 154, 154, true);
  35. add_image_size('blog-page', 606, 338, true);
  36. add_image_size('blog-full', 963, 537, true);
  37. add_image_size('widget-advert', 300, 250, true);
  38. add_image_size('widget-advert-small', 125, 125, true);
  39. add_image_size('home-news', 170, 166, true);
  40.  
  41.  
  42. register_nav_menu('primary', __('Primary Menu', tk_theme_name));                //This theme uses wp_nav_menu()
  43. //THEME NAME
  44. $tk_theme_name = tk_theme_name;
  45.  
  46. function new_excerpt_more($more) {
  47.     return '...';
  48. }
  49.  
  50. add_filter('excerpt_more', 'new_excerpt_more');
  51.  
  52.  
  53.  
  54.  
  55. /* * ********************************************************** */
  56. /* * **********LOAD STYLES*********************************** */
  57. /* * ********************************************************** */
  58.  
  59. function tk_add_stylesheet() {
  60.     wp_register_style('main_style', get_stylesheet_uri());
  61.     wp_enqueue_style('main_style');
  62.  
  63.     wp_register_style('superfish', get_template_directory_uri() . '/script/menu/superfish.css');
  64.     wp_enqueue_style('superfish');
  65.  
  66.     wp_register_style('tabs', get_template_directory_uri() . '/script/tabs/jquery-ui-1.10.1.custom.min.css');
  67.     wp_enqueue_style('tabs');
  68.  
  69.     wp_register_style('fancybox', get_template_directory_uri() . '/script//fancybox/source/jquery.fancybox.css');
  70.     wp_enqueue_style('fancybox');
  71.  
  72.     wp_register_style('flexslider', get_template_directory_uri() . '/script/flexslider/flexslider.css');
  73.     wp_enqueue_style('flexslider');
  74.  
  75.     wp_register_style('scroll-button', get_template_directory_uri() . '/script/scroll-button/scroll-button.css');
  76.     wp_enqueue_style('scroll-button');
  77.  
  78.     wp_register_style('Anvo', 'http://fonts.googleapis.com/css?family=Arvo:400,700');
  79.     wp_enqueue_style('Anvo');
  80.  
  81.  
  82.     if (is_archive() || is_search() || is_single() || is_page_template('_blog.php') || is_category()) {
  83.         wp_register_style('jplayer', get_template_directory_uri() . '/script/jplayer/skin/blue.monday/jplayer.blue.monday.css');
  84.         wp_enqueue_style('jplayer');
  85.     }
  86.  
  87.  
  88.     $browser = $_SERVER['HTTP_USER_AGENT'];
  89.  
  90.     if (strpos($browser, 'iPhone')) {
  91.         wp_register_style('iphone', get_template_directory_uri() . '/style/iphone.css');
  92.         wp_enqueue_style('iphone');
  93.     }
  94.  
  95.     if (strpos($browser, 'MSIE 8.0')) {
  96.         wp_register_style('ie8', get_template_directory_uri() . '/style/ie8.css');
  97.         wp_enqueue_style('ie8');
  98.     }
  99.  
  100.     if (strpos($browser, 'MSIE 9.0')) {
  101.         wp_register_style('ie9', get_template_directory_uri() . '/style/ie9.css');
  102.         wp_enqueue_style('ie9');
  103.     }
  104.  
  105.     if (strpos($browser, 'MSIE 10.0')) {
  106.         wp_register_style('ie10', get_template_directory_uri() . '/style/ie10.css');
  107.         wp_enqueue_style('ie10');
  108.     }
  109.  
  110.     if (strpos($browser, 'Firefox')) {
  111.         wp_register_style('firefox', get_template_directory_uri() . '/style/firefox.css');
  112.         wp_enqueue_style('firefox');
  113.     }
  114.    
  115.  
  116.     if (strpos($browser, 'iPad')) {
  117.          wp_register_style('ipad', get_template_directory_uri().'/style/ipad.css');
  118.          wp_enqueue_style('ipad');
  119.      }
  120.  
  121. }
  122.  
  123. add_action('wp_enqueue_scripts', 'tk_add_stylesheet');
  124.  
  125.  
  126.  
  127. /* * ********************************************************** */
  128. /* * **********LOAD SCRIPTS********************************** */
  129. /* * ********************************************************** */
  130.  
  131. function tk_add_scripts() {
  132.     wp_enqueue_script('jquery');
  133.     wp_enqueue_script('jquery-ui-tabs');
  134.     wp_enqueue_script('jquery-ui-datepicker');
  135.     wp_enqueue_script('superfish', get_template_directory_uri() . '/script/menu/superfish.js', false, false, true);
  136.     wp_enqueue_script('my-commons', get_template_directory_uri() . '/script/common.js', false, false, true);
  137.     if(get_theme_option(tk_theme_name.'_general_custom_scroll') == 'yes') {wp_enqueue_script('nice-scroll', get_template_directory_uri() . '/script/jqueryNicescroll/jquery.nicescroll.min.js', false, false, true);}
  138.     wp_enqueue_script('fancybox', get_template_directory_uri() . '/script/fancybox/source/jquery.fancybox.js', false, false, true);
  139.     wp_enqueue_script('easing', get_template_directory_uri() . '/script/easing/jquery.easing.1.3.js', false, false, true);
  140.     wp_enqueue_script('scroll-button', get_template_directory_uri() . '/script/scroll-button/scroll-button.js', false, false, true);
  141.     wp_enqueue_script('flexslider', get_template_directory_uri() . '/script/flexslider/jquery.flexslider-min.js', false, false, true);
  142.     if (is_page_template('_blog.php') || is_single()) {
  143.         wp_enqueue_script('flex-slider', get_template_directory_uri() . '/script/flexslider/flex-slider.js', false, false, true);
  144.     }
  145.     wp_enqueue_script('isotope', get_template_directory_uri() . '/script/isotope/jquery.isotope.min.js', false, false, true);
  146.     wp_enqueue_script('spiner', get_template_directory_uri() . '/script/spiner/spin.min.js', false, false, true);
  147.     wp_enqueue_script('jplayer', get_template_directory_uri() . '/script/jplayer/js/jquery.jplayer.min.js', false, false, true);
  148.     wp_enqueue_script('respond', get_template_directory_uri() . '/script/respond/respond.src.js', false, false, true);
  149.     wp_enqueue_script('hover-modernzr', get_template_directory_uri() . '/script/hover-gallery/modernizr.custom.97074.js', false, false, true);
  150.     wp_enqueue_script('hover-gallery', get_template_directory_uri() . '/script/hover-gallery/jquery.hoverdir.js', false, false, true);
  151.    
  152.     /************************************************************** */
  153.     /*************      NICESCROLL    *********************** */
  154.     /************************************************************** */    
  155.    
  156.     $variable_scroll = array('scroll_bar');
  157.     wp_localize_script('my-commons', 'scroll_bar_option', $variable_scroll);
  158.  
  159.     /*     * *********************************************************** */
  160.     /*     * **********CONTACT MESSAGES*************************** */
  161.     /*     * ********************************************************* */
  162.  
  163.     $subject_error_msg = get_option(tk_theme_name . '_contact_subject_error_message');
  164.     $name_error_msg = get_option(tk_theme_name . '_contact_name_error_message');
  165.     $email_error_msg = get_option(tk_theme_name . '_contact_email_error_message');
  166.     $message_error_msg = get_option(tk_theme_name . '_contact_message_error_message');
  167.     $mail_success_msg = get_option(tk_theme_name . '_contact_message_successful');
  168.     $mail_error_msg = get_option(tk_theme_name . '_contact_message_unsuccessful');
  169.     $phone_error_msg = get_option(tk_theme_name . '_contact_phone_error');
  170.     $date_error_msg = get_option(tk_theme_name . '_contact_date_error');
  171.     $doctor_error_msg = get_option(tk_theme_name . '_contact_doctor_error');
  172.  
  173.     $variable_array = array(
  174.        
  175.         'subject_error_message' => $subject_error_msg,
  176.         'name_error_message' => $name_error_msg,
  177.         'email_error_message' => $email_error_msg,
  178.         'message_error_message' => $message_error_msg,
  179.         'all_fields_are_required' => __('All fields are required', tk_theme_name()),
  180.         'mail_success_msg' => $mail_success_msg,
  181.         'mail_error_msg' => $mail_error_msg,
  182.         'phone_error_msg' => $phone_error_msg,
  183.         'date_error_msg' => $date_error_msg,
  184.         'doctor_error_msg' => $doctor_error_msg,
  185.         'reservation_message_field' => get_option(tk_theme_name().'_reservation_message_field'),
  186.         'reservation_appointment_field' => get_option(tk_theme_name().'_reservation_appointment_field'),
  187.         'reservation_service_field' => get_option(tk_theme_name().'_reservation_service_field'),
  188.         'reservation_date_field' => get_option(tk_theme_name().'_reservation_date_field'),
  189.         'reservation_phone_field' => get_option(tk_theme_name().'_reservation_phone_field'),
  190.         'reservation_email_field' => get_option(tk_theme_name().'_reservation_email_field'),
  191.         'reservation_fullname_field' => get_option(tk_theme_name().'_reservation_fullname_field'),
  192.         'admin_bar_showing' => is_admin_bar_showing()
  193.     );
  194.  
  195.  
  196.  
  197.     wp_localize_script('my-commons', 'contact_variables', $variable_array);
  198.  
  199.  
  200.  
  201.     if (is_singular())
  202.         wp_enqueue_script('comment-reply', false, false, true);
  203. }
  204.  
  205. add_action('wp_enqueue_scripts', 'tk_add_scripts');
  206.  
  207.  
  208.  
  209. /* * ********************************************************** */
  210. /* * **********VIDEO PLAYER**************************** */
  211. /* * ********************************************************** */
  212.  
  213. function tk_video_player($url) {
  214.  
  215.     if (!empty($url)) {
  216.         $key_str1 = 'youtube';
  217.         $key_str2 = 'vimeo';
  218.  
  219.         $pos_youtube = strpos($url, $key_str1);
  220.         $pos_vimeo = strpos($url, $key_str2);
  221.         if (!empty($pos_youtube)) {
  222.             $url = str_replace('watch?v=', '', $url);
  223.             $url = explode('&', $url);
  224.             $url = $url[0];
  225.             $url = str_replace('http://www.youtube.com/', '', $url);
  226.             ?>
  227.             <div class="holder">
  228.                 <iframe src="http://www.youtube.com/embed/<?php echo $url; ?>?rel=0" frameborder="0" allowfullscreen></iframe>
  229.             </div>
  230.             <?php
  231.         }
  232.         if (!empty($pos_vimeo)) {
  233.             $url = explode('.com/', $url);
  234.             ?>
  235.  
  236.             <div class="holder">
  237.                 <iframe src="http://player.vimeo.com/video/<?php echo $url[1]; ?>" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
  238.             </div>
  239.             <?php
  240.         }
  241.         if (empty($pos_vimeo) && empty($pos_youtube)) {
  242.  
  243.             echo "Video only allowes vimeo and youtube!";
  244.         }
  245.     }
  246. }
  247.  
  248. add_action("switch_theme", "tk_create_tables"); //theme switch action
  249.  
  250. function tk_create_tables() {
  251.     global $wpdb;
  252.  
  253.     /*
  254.      * Create first table: user_rating
  255.      */
  256.     $table_name1 = $wpdb->prefix . "banner_stats";
  257.  
  258.     if ($wpdb->get_var("show tables like '$table_name1'") !== $table_name1) {
  259.  
  260.         $sql = "CREATE TABLE " . $table_name1 . " (
  261. stat_id bigint(20) NOT NULL AUTO_INCREMENT,
  262. banner_id bigint(20) NOT NULL,
  263. date date NOT NULL,
  264. clicks bigint(20) NOT NULL,
  265. views bigint(20) NOT NULL,
  266. PRIMARY KEY (stat_id),
  267. KEY banner_id (banner_id));";
  268.  
  269.  
  270.         require_once(ABSPATH . 'wp-admin/upgrade.php');
  271.         dbDelta($sql);
  272.     }
  273.  
  274.  
  275.     //creating database for room options
  276.     $table_name3 = $wpdb->prefix . tk_theme_name . "_reservations";
  277.  
  278.     if ($wpdb->get_var("show tables like '$table_name3'") !== $table_name3) {
  279.  
  280.         $sql3 = "CREATE TABLE IF NOT EXISTS " . $table_name3 . " (
  281.            id bigint(20) NOT NULL AUTO_INCREMENT,
  282.            fullname text NOT NULL,
  283.            email text NOT NULL,
  284.            phone text NOT NULL,
  285.            date date NOT NULL,
  286.            service text NOT NULL,
  287.            appointment_for text NOT NULL,
  288.            message text NOT NULL,
  289.            PRIMARY KEY (id))
  290.            ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
  291.        
  292.         require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
  293.         dbDelta($sql3);
  294.     }
  295.  
  296. }
  297.  
  298. /* * ********************************************************** */
  299. /* * **********GET VIDEO IMAGE********************************** */
  300. /* * ********************************************************** */
  301.  
  302. function get_video_image($url, $post_ID) {
  303.  
  304.     if (!empty($url)) {
  305.         $key_str1 = 'youtube';
  306.         $key_str2 = 'vimeo';
  307.  
  308.         $pos_youtube = strpos($url, $key_str1);
  309.         $pos_vimeo = strpos($url, $key_str2);
  310.         if (!empty($pos_youtube)) {
  311.             $url = str_replace('watch?v=', '', $url);
  312.             $url = explode('&', $url);
  313.             $url = $url[0];
  314.             $url = str_replace('http://www.youtube.com/', '', $url);
  315.             ?>
  316.             <img src="http://img.youtube.com/vi/<?php echo $url; ?>/0.jpg" title="<?php echo get_the_title($post_ID) ?>" alt="<?php echo get_the_title($post_ID) ?>" />
  317.             <?php
  318.         }
  319.         if (!empty($pos_vimeo)) {
  320.             $url = explode('.com/', $url);
  321.             $data = @file_get_contents("http://vimeo.com/api/v2/video/" . $url[1] . ".json");
  322.             if ($data) {
  323.                 $data = file_get_contents("http://vimeo.com/api/v2/video/" . $url[1] . ".json");
  324.             } else {
  325.                 curl_setopt($ch = curl_init(), CURLOPT_URL, "http://vimeo.com/api/v2/video/" . $url[1] . ".json");
  326.                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  327.                 $response = curl_exec($ch);
  328.                 curl_close($ch);
  329.                 $data = $response;
  330.             }
  331.             $data = json_decode($data);
  332.             ?>
  333.             <img src="<?php echo $data[0]->thumbnail_medium; ?>" title="<?php echo get_the_title($post_ID) ?>" alt="<?php echo get_the_title($post_ID) ?>" />
  334.             <?php
  335.         }
  336.         if (empty($pos_vimeo) && empty($pos_youtube)) {
  337.  
  338.             echo "Video only allowes vimeo and youtube!";
  339.         }
  340.     }
  341. }
  342.  
  343. /*
  344.  * SOCIAL SHARE COUNTERS
  345.  */
  346.  
  347. // Facebook Share Counter
  348. function get_likes($url) {
  349.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  350.     $transient_name = md5('facebook_' . $url);
  351.  
  352.     if ($cache_time == 0) {
  353.         delete_transient($transient_name);
  354.     }
  355.     if ($cache_time == '') {
  356.         $cache_time = 15;
  357.     }
  358.  
  359.     if (false === ( $trans = get_transient($transient_name) )) {
  360.  
  361.         $get_link = wp_remote_get('http://graph.facebook.com/' . $url, array('timeout' => 60));
  362.  
  363.         if (is_wp_error($get_link)) {
  364.             return "0";
  365.         } else {
  366.             $facebook_count = json_decode($get_link['body'], true);
  367.  
  368.             if (!isset($facebook_count['shares']) or $facebook_count['shares'] == '') {
  369.                 set_transient($transient_name, 0, $cache_time * 60);
  370.                 return 0;
  371.             } else {
  372.                 set_transient($transient_name, intval($facebook_count['shares']), $cache_time * 60);
  373.                 return $facebook_count['shares'];
  374.             }
  375.         }
  376.     } else {
  377.         return get_transient($transient_name);
  378.     }
  379. }
  380.  
  381. // Twitter Share Counter
  382. function get_tweets($url) {
  383.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  384.     $transient_name = md5('twitter_' . $url);
  385.  
  386.     if ($cache_time == 0) {
  387.         delete_transient($transient_name);
  388.     }
  389.     if ($cache_time == '') {
  390.         $cache_time = 15;
  391.     }
  392.     if (false === ( $trans = get_transient($transient_name) )) {
  393.         $get_link = wp_remote_get('http://urls.api.twitter.com/1/urls/count.json?url=' . $url);
  394.         if (is_wp_error($get_link)) {
  395.             return "0";
  396.         } else {
  397.             $twitter_count = json_decode($get_link['body'], true);
  398.             set_transient($transient_name, intval($twitter_count['count']), $cache_time * 60);
  399.             return intval($twitter_count['count']);
  400.         }
  401.     } else {
  402.         return get_transient($transient_name);
  403.     }
  404. }
  405.  
  406. // Google plus Share Counter
  407. function get_plusones($url) {
  408.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  409.     $transient_name = md5('google_plus_' . $url);
  410.  
  411.     if ($cache_time == 0) {
  412.         delete_transient($transient_name);
  413.     }
  414.     if ($cache_time == '') {
  415.         $cache_time = 15;
  416.     }
  417.  
  418.     if (false === ( $trans = get_transient($transient_name) )) {
  419.  
  420.         $args = array(
  421.             'method' => 'POST',
  422.             'headers' => array(
  423.                 'Content-Type' => 'application/json'
  424.             ),
  425.             'timeout' => 30,
  426.             'redirection' => 1,
  427.             'body' => json_encode(array(
  428.                 'method' => 'pos.plusones.get',
  429.                 'id' => 'p',
  430.                 'method' => 'pos.plusones.get',
  431.                 'jsonrpc' => '2.0',
  432.                 'key' => 'p',
  433.                 'apiVersion' => 'v1',
  434.                 'params' => array(
  435.                     'nolog' => true,
  436.                     'id' => $url,
  437.                     'source' => 'widget',
  438.                     'userId' => '@viewer',
  439.                     'groupId' => '@self'
  440.                 )
  441.             )),
  442.             'sslverify' => false
  443.         );
  444.  
  445.         $json_string = wp_remote_post("https://clients6.google.com/rpc", $args);
  446.  
  447.         if (is_wp_error($json_string)) {
  448.             return "0";
  449.         } else {
  450.             $json = json_decode($json_string['body'], true);
  451.             set_transient($transient_name, intval($json['result']['metadata']['globalCounts']['count']), $cache_time * 60);
  452.             return intval($json['result']['metadata']['globalCounts']['count']);
  453.         }
  454.     } else {
  455.         return get_transient($transient_name);
  456.     }
  457. }
  458.  
  459. // Stumbleupon Share Counter
  460. function get_stumbleupon($url) {
  461.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  462.     $transient_name = md5('stumbleupon_' . $url);
  463.  
  464.     if ($cache_time == 0) {
  465.         delete_transient($transient_name);
  466.     }
  467.     if ($cache_time == '') {
  468.         $cache_time = 15;
  469.     }
  470.  
  471.     if (false === ( $trans = get_transient($transient_name) )) {
  472.         $get_link = wp_remote_get('http://www.stumbleupon.com/services/1.01/badge.getinfo?url=' . $url);
  473.         if (is_wp_error($get_link)) {
  474.             return "0";
  475.         } else {
  476.             $stumbleupon_count = json_decode($get_link['body'], true);
  477.             if (@$stumbleupon_count['result']['views'] == '') {
  478.                 return 0;
  479.             } else {
  480.                 set_transient($transient_name, intval($stumbleupon_count['result']['views']), $cache_time * 60);
  481.                 return intval($stumbleupon_count['result']['views']);
  482.             }
  483.         }
  484.     } else {
  485.         return get_transient($transient_name);
  486.     }
  487. }
  488.  
  489. // Linkedin Share Counter
  490. function get_linkedin($url) {
  491.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  492.     $transient_name = md5('linkedin_' . $url);
  493.  
  494.     if ($cache_time == 0) {
  495.         delete_transient($transient_name);
  496.     }
  497.     if ($cache_time == '') {
  498.         $cache_time = 15;
  499.     }
  500.  
  501.     if (false === ( $trans = get_transient($transient_name) )) {
  502.         $get_link = wp_remote_get('http://www.linkedin.com/countserv/count/share?url=' . $url . '&format=json');
  503.         if (is_wp_error($get_link)) {
  504.             return "0";
  505.         } else {
  506.             $linkedin_count = json_decode($get_link['body'], true);
  507.             if ($linkedin_count['count'] == '') {
  508.                 return 0;
  509.             } else {
  510.                 set_transient($transient_name, intval($linkedin_count['count']), $cache_time * 60);
  511.                 return intval($linkedin_count['count']);
  512.             }
  513.         }
  514.     } else {
  515.         return get_transient($transient_name);
  516.     }
  517. }
  518.  
  519. // Pinterest Share Counter
  520. function get_pinit($url) {
  521.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  522.     $transient_name = md5('pinit_' . $url);
  523.  
  524.     if ($cache_time == 0) {
  525.         delete_transient($transient_name);
  526.     }
  527.     if ($cache_time == '') {
  528.         $cache_time = 15;
  529.     }
  530.  
  531.     if (false === ( $trans = get_transient($transient_name) )) {
  532.  
  533.         $get_link = wp_remote_get('http://api.pinterest.com/v1/urls/count.json?callback=receiveCount&url=' . $url);
  534.  
  535.         $temp_json = str_replace("receiveCount(", "", $get_link['body']);
  536.         $temp_json = substr($temp_json, 0, -1);
  537.  
  538.         if (is_wp_error($get_link)) {
  539.             return "0";
  540.         } else {
  541.             $pinit_count = json_decode($temp_json, true);
  542.             if ($pinit_count['count'] == '') {
  543.                 return 0;
  544.             } else {
  545.                 set_transient($transient_name, intval($pinit_count['count']), $cache_time * 60);
  546.                 return intval($pinit_count['count']);
  547.             }
  548.         }
  549.     } else {
  550.         return get_transient($transient_name);
  551.     }
  552. }
  553.  
  554. /* get twitter followers on home page */
  555.  
  556. function tk_get_twitter_followers() {
  557.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  558.     $transient_name = 'tk_overall_twitter_followers';
  559.  
  560.     if ($cache_time == 0) {
  561.         delete_transient($transient_name);
  562.     }
  563.     if ($cache_time == '') {
  564.         $cache_time = 15;
  565.     }
  566.  
  567.  
  568.     $twitter_user = get_theme_option(tk_theme_name . '_social_twitter');
  569.  
  570.     if (false === ( $tk_overall_twitter_followers = get_transient($transient_name) )) {
  571.         $json = wp_remote_get('https://api.twitter.com/1/users/show.json?screen_name=' . $twitter_user . '&include_entities=true', array('timeout' => 60));
  572.  
  573.         if (is_wp_error($json)) {
  574.             return "0.";
  575.         } else {
  576.             if (is_wp_error($json))
  577.                 return "0";
  578.             $twitter_date = json_decode($json['body'], true);
  579.             set_transient($transient_name, intval($twitter_date['followers_count']), $cache_time * 60);
  580.             return intval($twitter_date['followers_count']);
  581.         }
  582.     } else {
  583.         return get_transient($transient_name);
  584.     }
  585. }
  586.  
  587. /* get facebook page likes on home page */
  588.  
  589. function tk_get_facebook_likes() {
  590.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  591.     $transient_name = 'tk_overall_facebook_likes';
  592.     $facebook_likes = '';
  593.  
  594.     if ($cache_time == 0) {
  595.         delete_transient($transient_name);
  596.     }
  597.     if ($cache_time == '') {
  598.         $cache_time = 15;
  599.     }
  600.  
  601.     $facebook_user = get_theme_option(tk_theme_name . '_social_facebook');
  602.  
  603.     if (false === ( $tk_overall_facebook_followers = get_transient($transient_name) )) {
  604.         $json = wp_remote_get("http://graph.facebook.com/" . $facebook_user, array('timeout' => 30));
  605.  
  606.         if (is_wp_error($json)) {
  607.             return "0.";
  608.         } else {
  609.             $json = wp_remote_get("http://graph.facebook.com/" . $facebook_user, array('timeout' => 30));
  610.             if (is_wp_error($json))
  611.                 return "0";
  612.             $fbData = json_decode($json['body'], true);
  613.  
  614.             set_transient($transient_name, intval($fbData['likes']), $cache_time * 60);
  615.  
  616.             return intval($fbData['likes']);
  617.         }
  618.     } else {
  619.         return get_transient($transient_name);
  620.     }
  621. }
  622.  
  623. /* get googe plus circled count */
  624.  
  625. function gplus_count() {
  626.     $cache_time = get_option(tk_theme_name() . '_social_cache_time');
  627.     $transient_name = 'tk_overall_google_pluses';
  628.     $google_plus_count = '';
  629.  
  630.     if ($cache_time == 0) {
  631.         delete_transient($transient_name);
  632.     }
  633.     if ($cache_time == '') {
  634.         $cache_time = 15;
  635.     }
  636.  
  637.     $gplus_username = get_theme_option(tk_theme_name() . '_social_google_plus');
  638.     $gplus_api = get_theme_option(tk_theme_name() . '_social_google_plus_api');
  639.  
  640.     if (false === ( $tk_overall_twitter_followers = get_transient($transient_name) )) {
  641.         $get_link = wp_remote_get("https://www.googleapis.com/plus/v1/people/" . $gplus_username . "?key=" . $gplus_api, array('timeout' => 30));
  642.  
  643.         if (is_wp_error($get_link)) {
  644.             return "0.";
  645.         } else {
  646.             $google_plus_count = json_decode($get_link['body'], true);
  647.             set_transient($transient_name, intval($google_plus_count['plusOneCount']), $cache_time * 60);
  648.             return intval($google_plus_count['plusOneCount']);
  649.         }
  650.     } else {
  651.         return get_transient($transient_name);
  652.     }
  653. }
  654.  
  655. /* * ********************************************************** */
  656. /* * **********REGISTER POST FORMATS*********************** */
  657. /* * ********************************************************* */
  658.  
  659. $post_formats = array(
  660.     'gallery',
  661.     'link',
  662.     'quote',
  663.     'audio',
  664.     'video');
  665.  
  666. add_theme_support('post-formats', $post_formats);
  667.  
  668. add_post_type_support('post', 'post-formats');
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675. /* * ********************************************************** */
  676. /* * **********ENQUEUE ADMINSCRIPT************************* */
  677. /* * ********************************************************* */
  678.  
  679. function enqueue_admin_script($hook) {
  680.     global $typenow;
  681.  
  682.     wp_enqueue_script('jquery-ui-core');
  683.     wp_enqueue_script('jquery-ui-accordion');
  684.     wp_enqueue_script('jquery-ui-sortable');
  685.  
  686.     wp_register_script('adminscript', get_template_directory_uri() . '/script/adminscript/adminscript.js', 'jquery');
  687.     wp_enqueue_script('adminscript');
  688.  
  689.     if (($hook == 'post.php' || $hook == 'post-new.php') and $typenow == 'advertisement' and isset($_GET['post'])) {
  690.  
  691.         wp_register_script('flot', get_template_directory_uri() . '/script/flot/jquery.flot.js', 'jquery');
  692.         wp_enqueue_script('flot');
  693.  
  694.         wp_register_script('flot_resize', get_template_directory_uri() . '/script/flot/jquery.flot.resize.js', 'jquery');
  695.         wp_enqueue_script('flot_resize');
  696.  
  697.         wp_register_script('flot_tooltip', get_template_directory_uri() . '/script/flot/jquery.flot.tooltip_0.4.4.js', 'jquery');
  698.         wp_enqueue_script('flot_tooltip');
  699.  
  700.         wp_register_script('flot_time', get_template_directory_uri() . '/script/flot/jquery.flot.time.js', 'jquery');
  701.         wp_enqueue_script('flot_time');
  702.         ?>
  703.  
  704.         <?php
  705.         global $wpdb;
  706.         $todays_date = date('Y-m-d');
  707.         $date = strtotime(date("Y", strtotime($todays_date)) . " -7 days");
  708.         $date = date('Y-m-d', $date);
  709.  
  710.         $pageposts = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "banner_stats WHERE banner_id = %d AND date BETWEEN '" . $date . "' AND '" . $todays_date . "' ORDER BY date ASC", $_GET['post']), OBJECT);
  711.  
  712.         $views = '';
  713.         $clicks = '';
  714.         foreach ($pageposts as $post) {
  715.             $views .= "[(new Date(\"" . $post->date . "\")).getTime()," . $post->views . "],";
  716.             $clicks .= "[(new Date(\"" . $post->date . "\")).getTime()," . $post->clicks . "],";
  717.         }
  718.         ?>
  719.         <script>
  720.             var views = [<?php echo $views; ?>];
  721.             var clicks = [<?php echo $clicks; ?>];
  722.         </script>
  723.  
  724.  
  725.         <?php
  726.     }
  727. }
  728.  
  729. add_action('admin_enqueue_scripts', 'enqueue_admin_script', 10, 1);
  730.  
  731.  
  732.  
  733. /* * ********************************************************** */
  734. /* * **********AUDIO PLAYER********************************** */
  735. /* * ********************************************************* */
  736.  
  737. function tk_jplayer($postid) {
  738.     $audio_link = get_post_meta($postid, 'tk_audio_link', true);
  739.     ?>
  740.     <script type="text/javascript">
  741.  
  742.         jQuery(document).ready(function(){
  743.  
  744.             if(jQuery().jPlayer) {
  745.                 jQuery("#jquery_jplayer_<?php echo $postid; ?>").jPlayer({
  746.                     ready: function () {
  747.                         jQuery(this).jPlayer("setMedia", {
  748.                             mp3: "<?php echo $audio_link; ?>",
  749.                             end: ""
  750.                         });
  751.                     },
  752.                     swfPath: "<?php echo get_template_directory_uri(); ?>/script/player",
  753.                     cssSelectorAncestor: "#jp_interface_<?php echo $postid; ?>",
  754.                     supplied: "mp3, all",
  755.                     swfPath: "<?php echo get_template_directory_uri() ?>/script/jplayer/js"
  756.                 });
  757.  
  758.             }
  759.         });
  760.     </script>
  761.     <?php
  762. }
  763.  
  764. /* * ****************************************************** */
  765. /* * **********GET CUSTOM THUMB SIZE********** */
  766. /* * ***************************************************** */
  767.  
  768. function get_attachment_id_from_src($image_src) {
  769.     global $wpdb;
  770.     $query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'";
  771.     $id = $wpdb->get_var($query);
  772.     return $id;
  773. }
  774.  
  775. /*
  776.  * $height -> height of new image
  777.  * $width -> width of new image
  778.  * $src -> url of image you want to get thumb from
  779.  */
  780.  
  781. function tk_get_thumb($width, $height, $src) {
  782.     $img_id = get_attachment_id_from_src($src);
  783.     $size = wp_get_attachment_image_src($img_id, 'full');
  784.     if ($width >= $size[1] || $height >= $size[2]) {
  785.         echo $src;
  786.     } else {
  787.         if (strpos($src, '.jpg')) {
  788.             $new_src = explode('.jpg', $src);
  789.             $new_src = $new_src[0] . '-' . $width . 'x' . $height . '.jpg';
  790.             echo $new_src;
  791.         } elseif (strpos($src, '.jpeg')) {
  792.             $new_src = explode('.jpeg', $src);
  793.             $new_src = $new_src[0] . '-' . $width . 'x' . $height . '.jpeg';
  794.             echo $new_src;
  795.         } elseif (strpos($src, '.gif')) {
  796.             $new_src = explode('.gif', $src);
  797.             $new_src = $new_src[0] . '-' . $width . 'x' . $height . '.gif';
  798.             echo $new_src;
  799.         } elseif (strpos($src, '.png')) {
  800.             $new_src = explode('.png', $src);
  801.             $new_src = $new_src[0] . '-' . $width . 'x' . $height . '.png';
  802.             echo $new_src;
  803.         }
  804.     }
  805. }
  806.  
  807. /* * ********************************************************** */
  808. /* * **********GET CUSTOM THUMB SIZE v2******************** */
  809. /* * ********************************************************* */
  810.  
  811. function tk_get_thumb_new($width, $height, $src) {
  812.     if (strpos($src, '.jpg')) {
  813.         $new_src = explode('.jpg', $src);
  814.         $new_src = $new_src[0] . '-' . $width . 'x' . $height . '.jpg';
  815.         /*
  816.          * THIS STILL NEEDS TO BE TESTED!!!!
  817.           if(@fopen($new_src, 'r')){
  818.           echo $new_src;
  819.           }else{
  820.           echo $src;
  821.           }
  822.          */
  823.         return $new_src;
  824.     } elseif (strpos($src, '.jpeg')) {
  825.         $new_src = explode('.jpeg', $src);
  826.         $new_src = $new_src[0] . '-' . $width . 'x' . $height . '.jpeg';
  827.         return $new_src;
  828.     } elseif (strpos($src, '.gif')) {
  829.         $new_src = explode('.gif', $src);
  830.         $new_src = $new_src[0] . '-' . $width . 'x' . $height . '.gif';
  831.         return $new_src;
  832.     } elseif (strpos($src, '.png')) {
  833.         $new_src = explode('.png', $src);
  834.         $new_src = $new_src[0] . '-' . $width . 'x' . $height . '.png';
  835.         return $new_src;
  836.     }
  837. }
  838.  
  839. /* * ********************************************************** */
  840. /* * **********LOAD WIDGETS********************************* */
  841. /* * ********************************************************** */
  842.  
  843. require_once (TEMPLATEPATH . '/inc/widgets/widget-twitter.php');
  844. require_once (TEMPLATEPATH . '/inc/widgets/widget-newsletter.php');
  845. require_once (TEMPLATEPATH . '/inc/widgets/widget-ad.php');
  846. require_once (TEMPLATEPATH . '/inc/widgets/widget-facebook.php');
  847.  
  848.  
  849.  
  850.  
  851.  
  852. /* * ********************************************************** */
  853. /* * **********INCREASE IMAGE QUALITY********************** */
  854. /* * ********************************************************* */
  855.  
  856. function jpeg_quality_callback($arg) {
  857.     return (int) 100;
  858. }
  859.  
  860. add_filter('jpeg_quality', 'jpeg_quality_callback');
  861.  
  862.  
  863.  
  864. /* * ********************************************************** */
  865. /* * **********REMOVE IMAGE SIZE**************************** */
  866. /* * ********************************************************* */
  867.  
  868. add_filter('post_thumbnail_html', 'remove_thumbnail_dimensions', 10);
  869. add_filter('image_send_to_editor', 'remove_thumbnail_dimensions', 10);
  870. // Removes attached image sizes as well
  871. add_filter('the_content', 'remove_thumbnail_dimensions', 10);
  872.  
  873. function remove_thumbnail_dimensions($html) {
  874.     $html = preg_replace('/(width|height)=\"\d*\"\s/', "", $html);
  875.     return $html;
  876. }
  877.  
  878. /* * ********************************************************** */
  879. /* * **********IMAGE WITHOUT DIMENSIONS******************* */
  880. /* * ********************************************************* */
  881.  
  882. function tk_thumbnail($post_id, $img_size) {
  883.     $thumbnail = get_the_post_thumbnail($post_id, $img_size);
  884.     $thumbnail = preg_replace('/(width|height)=\"\d*\"\s/', "", $thumbnail);
  885.     echo $thumbnail;
  886. }
  887.  
  888. /* * ********************************************************** */
  889. /* * **********EXCERPT LENGTH****************************** */
  890. /* * ********************************************************* */
  891.  
  892. function the_excerpt_length($charlength) {
  893.     $excerpt = get_the_excerpt();
  894.     $charlength++;
  895.  
  896.     if (strlen($excerpt) > $charlength) {
  897.         $subex = substr($excerpt, 0, $charlength - 5);
  898.         $exwords = explode(' ', $subex);
  899.         $excut = - ( strlen($exwords[count($exwords) - 1]) );
  900.         if ($excut < 0) {
  901.             echo substr($subex, 0, $excut);
  902.         } else {
  903.             echo $subex;
  904.         }
  905.         echo '...';
  906.     } else {
  907.         echo $excerpt;
  908.     }
  909. }
  910.  
  911. /* * ********************************************************** */
  912. /* * **********LOAD FUNCTION FOR COLOR CHANGE*********** */
  913. /* * ********************************************************** */
  914.  
  915. function tk_change_color() {
  916.     get_template_part('/inc/change-colors');
  917. }
  918.  
  919. add_action('wp_head', 'tk_change_color', '99');
  920.  
  921. /* * ********************************************************** */
  922. /* * **********GET URL OF CURENT PAGE********************* */
  923. /* * ********************************************************* */
  924.  
  925. function get_page_url() {
  926.  
  927.     $pageURL = 'http';
  928.     if (isset($_SERVER["HTTPS"])) {
  929.         $pageURL .= "s";
  930.     }
  931.     $pageURL .= "://";
  932.     if ($_SERVER["SERVER_PORT"] != "80") {
  933.         $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
  934.     } else {
  935.         $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
  936.     }
  937.     return $pageURL;
  938. }
  939.  
  940. /* * ********************************************************** */
  941. /* * **********CHOSE SIDEBAR POSITION*********************** */
  942. /* * ********************************************************* */
  943.  
  944. function tk_get_sidebar($sidebar_position, $sidebar_name) {
  945.     $sidebar_option = get_theme_option(tk_theme_name . '_general_custom_sidebars');
  946.     if ($sidebar_position == 'Right') {
  947.         ?>
  948.         <?php
  949.         $sidebar_option = get_theme_option(tk_theme_name . '_general_custom_sidebars');
  950.         if ($sidebar_option !== 'yes') {
  951.             ?>
  952.             <div id="sidebar" class="right third-width last-width">
  953.                 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Default')) : ?>
  954.                 <?php endif; ?>
  955.             </div><!--/#sidebar-->
  956.         <?php } else { ?>
  957.             <div id="sidebar" class="right third-width last-width">
  958.                 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar($sidebar_name)) : ?>
  959.                 <?php endif; ?>
  960.             </div><!--/#sidebar-->
  961.             <?php
  962.         }
  963.     }elseif ($sidebar_position == 'Left') {
  964.         ?>
  965.         <?php
  966.         $sidebar_option = get_theme_option(tk_theme_name . '_general_custom_sidebars');
  967.         if ($sidebar_option !== 'yes') {
  968.             ?>
  969.             <div id="sidebar" class="left third-width last-width">
  970.                 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Default')) : ?>
  971.                 <?php endif; ?>
  972.             </div><!--/#sidebar-->
  973.         <?php } else { ?>
  974.             <div id="sidebar" class="left third-width last-width">
  975.                 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar($sidebar_name)) : ?>
  976.                 <?php endif; ?>
  977.             </div><!--/#sidebar-->
  978.             <?php
  979.         }
  980.     }
  981. }
  982.  
  983. /* * ********************************************************* /
  984.   /**********REGISTERING SIDEBARS************************* /
  985.   /********************************************************** */
  986.  
  987.  
  988.  
  989.  
  990. if (function_exists('register_sidebar')) {
  991.     register_sidebar(array(
  992.         'name' => 'Footer Widget 1',
  993.         'before_widget' => '<div class="footer_widget_holder left">',
  994.         'after_widget' => '</div>',
  995.         'before_title' => '<h2>',
  996.         'after_title' => '</h2>')
  997.     );
  998. }
  999.  
  1000. if (function_exists('register_sidebar')) {
  1001.     register_sidebar(array(
  1002.         'name' => 'Footer Widget 2',
  1003.         'before_widget' => '<div class="footer_widget_holder left">',
  1004.         'after_widget' => '</div>',
  1005.         'before_title' => '<h2>',
  1006.         'after_title' => '</h2>')
  1007.     );
  1008. }
  1009.  
  1010. if (function_exists('register_sidebar')) {
  1011.     register_sidebar(array(
  1012.         'name' => 'Footer Widget 3',
  1013.         'before_widget' => '<div class="footer_widget_holder left">',
  1014.         'after_widget' => '</div>',
  1015.         'before_title' => '<h2>',
  1016.         'after_title' => '</h2>')
  1017.     );
  1018. }
  1019.  
  1020. if (function_exists('register_sidebar')) {
  1021.     register_sidebar(array(
  1022.         'name' => 'Home/Index',
  1023.         'before_widget' => '<div class="sidebar_widget_holder">',
  1024.         'after_widget' => '</div>',
  1025.         'before_title' => '<h3>',
  1026.         'after_title' => '</h3>')
  1027.     );
  1028. }
  1029.  
  1030. if (function_exists('register_sidebar')) {
  1031.     register_sidebar(array(
  1032.         'name' => 'Default',
  1033.         'before_widget' => '<div class="sidebar_widget_holder">',
  1034.         'after_widget' => '</div>',
  1035.         'before_title' => '<h3>',
  1036.         'after_title' => '</h3>')
  1037.     );
  1038. }
  1039.  
  1040.  
  1041. if (function_exists('register_sidebar')) {
  1042.     register_sidebar(array(
  1043.         'name' => 'Archive/Search',
  1044.         'before_widget' => '<div class="sidebar_widget_holder">',
  1045.         'after_widget' => '</div>',
  1046.         'before_title' => '<h3>',
  1047.         'after_title' => '</h3>')
  1048.     );
  1049. }
  1050.  
  1051. if (function_exists('register_sidebar')) {
  1052.     register_sidebar(array(
  1053.         'name' => '404 Sidebar',
  1054.         'before_widget' => '<div class="sidebar_widget_holder">',
  1055.         'after_widget' => '</div>',
  1056.         'before_title' => '<h3>',
  1057.         'after_title' => '</h3>')
  1058.     );
  1059. }
  1060.  
  1061.  
  1062.  
  1063. $results = $wpdb->get_results("SELECT * FROM  " . $wpdb->prefix . "posts WHERE post_type = 'sidebars' AND post_status = 'publish'");
  1064.  
  1065. foreach ($results as $one_col) {
  1066.  
  1067.     if (function_exists('register_sidebar')) {
  1068.         register_sidebar(array(
  1069.             'name' => $one_col->post_title,
  1070.             'before_widget' => '<div class="sidebar_widget_holder left">',
  1071.             'after_widget' => '</div>',
  1072.             'before_title' => '<h3>',
  1073.             'after_title' => '</h3>')
  1074.         );
  1075.     }
  1076. }
  1077.  
  1078.  
  1079.  
  1080. /* * ********************************************************** */
  1081. /* * **********SET DEFAULTS********************************** */
  1082. /* * ********************************************************** */
  1083. if (is_admin() && isset($_GET['activated']) && $pagenow == 'themes.php') {
  1084.     update_option('beautypress_colors_body_bg_img', get_template_directory_uri() . '/style/img/bg-body.jpg');
  1085. }
  1086.  
  1087.  
  1088. /* * ********************************************************** */
  1089. /* * **********LOAD SHORTCODES***************************** */
  1090. /* * ********************************************************** */
  1091.  
  1092.  
  1093. require_once ( ABSPATH . 'wp-content/themes/' . tk_theme_name . '/inc/shortcodes/tinymce_loader.php');
  1094.  
  1095. // This one enables hr tag to default tiny options
  1096. function enable_more_buttons($buttons) {
  1097.     $buttons[] = 'hr';
  1098.     return $buttons;
  1099. }
  1100.  
  1101. add_filter("mce_buttons", "enable_more_buttons");
  1102.  
  1103. // Columns one half
  1104. function shortcode_one_half($atts, $content = null) {
  1105.     extract(shortcode_atts(array(
  1106.                 'position' => '',
  1107.                     ), $atts));
  1108.  
  1109.     return '<div class="one-half ' . $position . '"><p>' . do_shortcode($content) . '</p></div>';
  1110. }
  1111.  
  1112. add_shortcode('one_half', 'shortcode_one_half');
  1113.  
  1114. // Columns one third
  1115. function shortcode_one_third($atts, $content = null) {
  1116.     extract(shortcode_atts(array(
  1117.                 'position' => '',
  1118.                     ), $atts));
  1119.  
  1120.     return '<div class="one-third ' . $position . '"><p>' . do_shortcode($content) . '</p></div>';
  1121. }
  1122.  
  1123. add_shortcode('one_third', 'shortcode_one_third');
  1124.  
  1125. // Columns one fourth
  1126. function shortcode_one_fourth($atts, $content = null) {
  1127.     extract(shortcode_atts(array(
  1128.                 'position' => '',
  1129.                     ), $atts));
  1130.  
  1131.     return '<div class="one-fourth ' . $position . '"><p>' . do_shortcode($content) . '</p></div>';
  1132. }
  1133.  
  1134. add_shortcode('one_fourth', 'shortcode_one_fourth');
  1135.  
  1136. // Shortcode for buttons
  1137. function shortcode_button($atts, $content = null) {
  1138.  
  1139.     extract(shortcode_atts(array(
  1140.                 'url' => '#',
  1141.                 'style' => 'black',
  1142.                     ), $atts));
  1143.  
  1144.     return '<div class="color-buttons color-button-' . $style . ' left"><a href="' . $url . '">' . do_shortcode($content) . '</a></div>';
  1145. }
  1146.  
  1147. add_shortcode('button', 'shortcode_button');
  1148.  
  1149. // Shortcode for unordered list with different looks
  1150. function shortcode_list($atts, $content = null) {
  1151.  
  1152.     extract(shortcode_atts(array(
  1153.                 'style' => '1'
  1154.                     ), $atts));
  1155.  
  1156.     return '<ul style="list-style:none;padding-left:0px"><li class="' . $style . '">' . do_shortcode($content) . '</li></ul>';
  1157. }
  1158.  
  1159. add_shortcode('list', 'shortcode_list');
  1160.  
  1161. // Shortcode for toggled content
  1162. function shortcode_toggle($atts, $content = null) {
  1163.  
  1164.     extract(shortcode_atts(array(
  1165.                 'title' => 'Title',
  1166.                 'value' => ''
  1167.                     ), $atts));
  1168.  
  1169.     if ($value != '') {
  1170.         $image_class = 'active-togle-img';
  1171.         $box_class = 'no-active-togle';
  1172.     } else {
  1173.         $image_class = '';
  1174.         $box_class = '';
  1175.     }
  1176.  
  1177.     return '<div class="toggle-holder"><div class="toggle-holder-image"><h6 class="' . $image_class . '"></h6></div><span>' . $title . '</span><p class="' . $box_class . '">' . do_shortcode($content) . '</p></div>';
  1178. }
  1179.  
  1180. add_shortcode('toggle', 'shortcode_toggle');
  1181.  
  1182. // Shortcode for tabbed content
  1183. function tz_tabs($atts, $content = null) {
  1184.     extract(shortcode_atts(array(
  1185.                 'tabs' => ''
  1186.                     ), $atts));
  1187.  
  1188.     $output = '';
  1189.     $output .= '<div class="tabs"><ul>';
  1190.  
  1191.     $tabs = trim($tabs, ",");
  1192.     $myTabs = explode(',', $tabs);
  1193.  
  1194.     foreach ($myTabs as $tab) {
  1195.         $create_href = sanitize_title($tab);
  1196.         $output .= '<li><a href="#' . $create_href . '">' . $tab . '</a></li>';
  1197.     }
  1198.  
  1199.     $output .= '</ul>';
  1200.     $output .= '<div class="tab">';
  1201.     $myContent = do_shortcode($content);
  1202.     $output .= $myContent;
  1203.     $output .= '</div></div>';
  1204.  
  1205.     return $output;
  1206. }
  1207.  
  1208. add_shortcode('tabs', 'tz_tabs');
  1209.  
  1210. function tz_tabs_panes($atts, $content = null) {
  1211.     extract(shortcode_atts(array(
  1212.                 'title' => ''
  1213.                     ), $atts));
  1214.  
  1215.  
  1216.     $create_id = sanitize_title($title);
  1217.     $output = '<div id="' . $create_id . '">' . do_shortcode($content) . '</div>';
  1218.  
  1219.     return $output;
  1220. }
  1221.  
  1222. add_shortcode('tab', 'tz_tabs_panes');
  1223.  
  1224. // Shortcode for PRICETABLE
  1225. function tk_price_table($atts, $content = null) {
  1226.     extract(shortcode_atts(array(
  1227.                 'column' => '',
  1228.                 'position' => '',
  1229.                 'title' => '',
  1230.                 'subtitle' => '',
  1231.                 'bgcolor' => '',
  1232.                 'textcolor' => '',
  1233.                 'usebutton' => '',
  1234.                 'url' => '',
  1235.                 'style' => '',
  1236.                 'buttontext' => ''
  1237.                     ), $atts));
  1238.  
  1239.     if ($usebutton == 'yes') {
  1240.         $button_output = '
  1241.                    <div class="color-buttons color-button-' . $style . ' pricing-button">
  1242.                        <a href="' . $url . '">' . $buttontext . '</a>
  1243.                    </div>';
  1244.     } else {
  1245.         $button_output = '';
  1246.     }
  1247.     $output = '
  1248.  
  1249.                        <div class="pricing-table-one left ' . $column . ' ' . $position . '">
  1250.                            <div class="pricing-table-one-border left">
  1251.                                <div class="pricing-table-one-top pricing-table-green left" style="background:' . $bgcolor . '">
  1252.                                    <span style="color:' . $textcolor . '">' . $title . '</span>
  1253.                                    <p style="color:' . $textcolor . '">' . $subtitle . '</p>
  1254.                                </div>
  1255.                                ' . do_shortcode($content) . $button_output . '
  1256.                            </div>
  1257.                        </div>
  1258.                        ';
  1259.  
  1260.  
  1261.     return $output;
  1262. }
  1263.  
  1264. add_shortcode('pricing', 'tk_price_table');
  1265.  
  1266. // Shortcode for ONEPRICE
  1267. function tk_one_price($atts, $content = null) {
  1268.     extract(shortcode_atts(array(
  1269.                 'title' => ''
  1270.                     ), $atts));
  1271.  
  1272.     $create_id = $title; //sanitize_title
  1273.     if (strlen($content) <= 3) {
  1274.         $output = '<div class="pricing-table-one-center pricing-table-white left"><h5>' . $create_id . '</h5></div>';
  1275.     } else {
  1276.         $output = '<div class="pricing-table-one-center pricing-table-white left"><span>' . $create_id . '</span><p>' . do_shortcode($content) . '</p></div>';
  1277.     }
  1278.  
  1279.     return $output;
  1280. }
  1281.  
  1282. add_shortcode('price', 'tk_one_price');
  1283.  
  1284. // Shortcode for infobox
  1285. function shortcode_infobox($atts, $content = null) {
  1286.  
  1287.     extract(shortcode_atts(array(
  1288.                 'bgcolor' => '#e85c2c',
  1289.                 'textcolor' => '#FFF',
  1290.                     ), $atts));
  1291.  
  1292.     return '<div class="shortcode-infobox left" style="background-color:' . $bgcolor . '"><p style="color:' . $textcolor . '">' . do_shortcode($content) . '<p></div>';
  1293. }
  1294.  
  1295. add_shortcode('infobox', 'shortcode_infobox');
  1296.  
  1297. // Shortcode DROPCAP
  1298. function shortcode_dropcap($atts, $content = null) {
  1299.     extract(shortcode_atts(array(
  1300.                 'style' => '',
  1301.                     ), $atts));
  1302.  
  1303.     return '<span class="dropcap-' . $style . '">' . do_shortcode($content) . '</span>';
  1304. }
  1305.  
  1306. add_shortcode('dropcap', 'shortcode_dropcap');
  1307.  
  1308. // Shortcode for calltoaction
  1309. function shortcode_calltoaction($atts, $content = null) {
  1310.  
  1311.     extract(shortcode_atts(array(
  1312.                 'url' => '#',
  1313.                 'style' => 'black',
  1314.                 'buttontext' => '',
  1315.                 'usebutton' => '',
  1316.                     ), $atts));
  1317.  
  1318.     $tk_return = '';
  1319.     if ($usebutton != 'yes') {
  1320.         $shortcode_call_class = 'home-call-action-fullwidth';
  1321.     } else {
  1322.         $shortcode_call_class = '';
  1323.     }
  1324.  
  1325.     $tk_return .= '<div class="home-call-action call-to-action-shortcode left">
  1326.                        <div class="home-call-action-content">
  1327.                            <div class="home-call-action-text ' . $shortcode_call_class . ' left">
  1328.                                <p>' . do_shortcode($content) . '</p>
  1329.                            </div>';
  1330.  
  1331.     if ($usebutton == 'yes') {
  1332.         $tk_return .= '<div class="cta-button-floater"><div class="color-buttons color-button-' . $style . ' left"><a href="' . $url . '">' . $buttontext . '</a></div></div>';
  1333.     }
  1334.     $tk_return .= '</div></div>';
  1335.  
  1336.     return($tk_return);
  1337. }
  1338.  
  1339. add_shortcode('calltoaction', 'shortcode_calltoaction');
  1340.  
  1341. /* * ********************************************************** */
  1342. /* * **********SAVE TEMPLATE  ID AND NAME****************** */
  1343. /* * ********************************************************** */
  1344.  
  1345. add_action('publish_page', 'saveBlogId');
  1346.  
  1347. function saveBlogId($post_ID) {
  1348.     global $wp_query;
  1349.     $the_title = get_the_title($post_ID);
  1350.     $template_name = get_post_meta($post_ID, '_wp_page_template', true);
  1351.     if ($template_name == "_blog.php") {
  1352.         update_option('id_blog_page', $post_ID);
  1353.         update_option('title_blog_page', $the_title);
  1354.     }
  1355.  
  1356.     $oldblog = get_option('id_blog_page');
  1357.     if ($post_ID == $oldblog) {
  1358.         if ($template_name <> "_blog.php") {
  1359.             update_option('id_blog_page', '');
  1360.         }
  1361.     }
  1362. }
  1363.  
  1364. add_action('publish_page', 'saveServicesId');
  1365.  
  1366. function saveServicesId($post_ID) {
  1367.     global $wp_query;
  1368.     $the_title = get_the_title($post_ID);
  1369.     $template_name = get_post_meta($post_ID, '_wp_page_template', true);
  1370.     if ($template_name == "_services.php") {
  1371.         update_option('id_services_page', $post_ID);
  1372.         update_option('title_services_page', $the_title);
  1373.     }
  1374.  
  1375.     $oldblog = get_option('id_services_page');
  1376.     if ($post_ID == $oldblog) {
  1377.         if ($template_name <> "_services.php") {
  1378.             update_option('id_services_page', '');
  1379.         }
  1380.     }
  1381. }
  1382.  
  1383. add_action('publish_page', 'saveReservationsId');
  1384.  
  1385. function saveReservationsId($post_ID) {
  1386.     global $wp_query;
  1387.     $the_title = get_the_title($post_ID);
  1388.     $template_name = get_post_meta($post_ID, '_wp_page_template', true);
  1389.     if ($template_name == "_reservations.php") {
  1390.         update_option('id_reservations_page', $post_ID);
  1391.         update_option('title_reservations_page', $the_title);
  1392.     }
  1393.  
  1394.     $oldblog = get_option('id_reservations_page');
  1395.     if ($post_ID == $oldblog) {
  1396.         if ($template_name <> "_reservations.php") {
  1397.             update_option('id_reservations_page', '');
  1398.         }
  1399.     }
  1400. }
  1401.  
  1402. add_action('publish_page', 'saveGalleryId');
  1403.  
  1404. function saveGalleryId($post_ID) {
  1405.     global $wp_query;
  1406.     $the_title = get_the_title($post_ID);
  1407.     $template_name = get_post_meta($post_ID, '_wp_page_template', true);
  1408.     if ($template_name == "_gallery_3_columns.php") {
  1409.         update_option('id_gallery_page', $post_ID);
  1410.         update_option('title_gallery_page', $the_title);
  1411.     }
  1412.  
  1413.     $oldblog = get_option('id_gallery_page');
  1414.     if ($post_ID == $oldblog) {
  1415.         if ($template_name <> "_gallery_3_columns.php") {
  1416.             update_option('id_gallery_page', '');
  1417.         }
  1418.     }
  1419. }
  1420.  
  1421. add_action('publish_page', 'saveTeamId');
  1422.  
  1423. function saveTeamId($post_ID) {
  1424.     global $wp_query;
  1425.     $the_title = get_the_title($post_ID);
  1426.     $template_name = get_post_meta($post_ID, '_wp_page_template', true);
  1427.     if ($template_name == "_team-members.php") {
  1428.         update_option('id_team_page', $post_ID);
  1429.         update_option('title_team_page', $the_title);
  1430.     }
  1431.  
  1432.     $oldblog = get_option('id_team_page');
  1433.     if ($post_ID == $oldblog) {
  1434.         if ($template_name <> "_team-members.php") {
  1435.             update_option('id_team_page', '');
  1436.         }
  1437.     }
  1438. }
  1439.  
  1440. /* * ********************************************************** */
  1441. /* * **********GOOGLE FONTS*********************** */
  1442. /* * ********************************************************** */
  1443. add_action('admin_enqueue_scripts', 'tk_enqueue_google_fonts_in_admin');
  1444.  
  1445. function tk_enqueue_google_fonts_in_admin() {
  1446.  
  1447.     global $wpdb;
  1448.     $google_fonts =
  1449.             array(
  1450.                 array('name' => "Select", 'variant' => ''),
  1451.                 array('name' => "Cantarell", 'variant' => ':r,b,i,bi'),
  1452.                 array('name' => "Cardo", 'variant' => ''),
  1453.                 array('name' => "Crimson Text", 'variant' => ''),
  1454.                 array('name' => "Droid Sans", 'variant' => ':r,b'),
  1455.                 array('name' => "Droid Sans Mono", 'variant' => ''),
  1456.                 array('name' => "Droid Serif", 'variant' => ':r,b,i,bi'),
  1457.                 array('name' => "IM Fell DW Pica", 'variant' => ':r,i'),
  1458.                 array('name' => "Inconsolata", 'variant' => ''),
  1459.                 array('name' => "Josefin Sans", 'variant' => ':400,400italic,700,700italic'),
  1460.                 array('name' => "Josefin Slab", 'variant' => ':r,b,i,bi'),
  1461.                 array('name' => "Lobster", 'variant' => ''),
  1462.                 array('name' => "Molengo", 'variant' => ''),
  1463.                 array('name' => "Nobile", 'variant' => ':r,b,i,bi'),
  1464.                 array('name' => "OFL Sorts Mill Goudy TT", 'variant' => ':r,i'),
  1465.                 array('name' => "Old Standard TT", 'variant' => ':r,b,i'),
  1466.                 array('name' => "Reenie Beanie", 'variant' => ''),
  1467.                 array('name' => "Tangerine", 'variant' => ':r,b'),
  1468.                 array('name' => "Vollkorn", 'variant' => ':r,b'),
  1469.                 array('name' => "Yanone Kaffeesatz", 'variant' => ':r,b'),
  1470.                 array('name' => "Cuprum", 'variant' => ''),
  1471.                 array('name' => "Neucha", 'variant' => ''),
  1472.                 array('name' => "Neuton", 'variant' => ''),
  1473.                 array('name' => "PT Sans", 'variant' => ':r,b,i,bi'),
  1474.                 array('name' => "PT Sans Caption", 'variant' => ':r,b'),
  1475.                 array('name' => "PT Sans Narrow", 'variant' => ':r,b'),
  1476.                 array('name' => "Philosopher", 'variant' => ''),
  1477.                 array('name' => "Allerta", 'variant' => ''),
  1478.                 array('name' => "Allerta Stencil", 'variant' => ''),
  1479.                 array('name' => "Arimo", 'variant' => ':r,b,i,bi'),
  1480.                 array('name' => "Arvo", 'variant' => ':r,b,i,bi'),
  1481.                 array('name' => "Bentham", 'variant' => ''),
  1482.                 array('name' => "Coda", 'variant' => ':800'),
  1483.                 array('name' => "Cousine", 'variant' => ''),
  1484.                 array('name' => "Covered By Your Grace", 'variant' => ''),
  1485.                 array('name' => "Geo", 'variant' => ''),
  1486.                 array('name' => "Just Me Again Down Here", 'variant' => ''),
  1487.                 array('name' => "Puritan", 'variant' => ':r,b,i,bi'),
  1488.                 array('name' => "Raleway", 'variant' => ':100'),
  1489.                 array('name' => "Tinos", 'variant' => ':r,b,i,bi'),
  1490.                 array('name' => "UnifrakturCook", 'variant' => ':bold'),
  1491.                 array('name' => "UnifrakturMaguntia", 'variant' => ''),
  1492.                 array('name' => "Mountains of Christmas", 'variant' => ''),
  1493.                 array('name' => "Lato", 'variant' => ':400,700,400italic'),
  1494.                 array('name' => "Orbitron", 'variant' => ':r,b,i,bi'),
  1495.                 array('name' => "Allan", 'variant' => ':bold'),
  1496.                 array('name' => "Anonymous Pro", 'variant' => ':r,b,i,bi'),
  1497.                 array('name' => "Copse", 'variant' => ''),
  1498.                 array('name' => "Kenia", 'variant' => ''),
  1499.                 array('name' => "Ubuntu", 'variant' => ':r,b,i,bi'),
  1500.                 array('name' => "Vibur", 'variant' => ''),
  1501.                 array('name' => "Sniglet", 'variant' => ':800'),
  1502.                 array('name' => "Syncopate", 'variant' => ''),
  1503.                 array('name' => "Cabin", 'variant' => ':400,400italic,700,700italic,'),
  1504.                 array('name' => "Merriweather", 'variant' => ''),
  1505.                 array('name' => "Maiden Orange", 'variant' => ''),
  1506.                 array('name' => "Just Another Hand", 'variant' => ''),
  1507.                 array('name' => "Kristi", 'variant' => ''),
  1508.                 array('name' => "Corben", 'variant' => ':b'),
  1509.                 array('name' => "Gruppo", 'variant' => ''),
  1510.                 array('name' => "Buda", 'variant' => ':light'),
  1511.                 array('name' => "Lekton", 'variant' => ''),
  1512.                 array('name' => "Luckiest Guy", 'variant' => ''),
  1513.                 array('name' => "Crushed", 'variant' => ''),
  1514.                 array('name' => "Chewy", 'variant' => ''),
  1515.                 array('name' => "Coming Soon", 'variant' => ''),
  1516.                 array('name' => "Crafty Girls", 'variant' => ''),
  1517.                 array('name' => "Fontdiner Swanky", 'variant' => ''),
  1518.                 array('name' => "Permanent Marker", 'variant' => ''),
  1519.                 array('name' => "Rock Salt", 'variant' => ''),
  1520.                 array('name' => "Sunshiney", 'variant' => ''),
  1521.                 array('name' => "Unkempt", 'variant' => ''),
  1522.                 array('name' => "Calligraffitti", 'variant' => ''),
  1523.                 array('name' => "Cherry Cream Soda", 'variant' => ''),
  1524.                 array('name' => "Homemade Apple", 'variant' => ''),
  1525.                 array('name' => "Irish Growler", 'variant' => ''),
  1526.                 array('name' => "Kranky", 'variant' => ''),
  1527.                 array('name' => "Schoolbell", 'variant' => ''),
  1528.                 array('name' => "Slackey", 'variant' => ''),
  1529.                 array('name' => "Walter Turncoat", 'variant' => ''),
  1530.                 array('name' => "Radley", 'variant' => ''),
  1531.                 array('name' => "Meddon", 'variant' => ''),
  1532.                 array('name' => "Kreon", 'variant' => ':r,b'),
  1533.                 array('name' => "Dancing Script", 'variant' => ''),
  1534.                 array('name' => "Goudy Bookletter 1911", 'variant' => ''),
  1535.                 array('name' => "PT Serif Caption", 'variant' => ':r,i'),
  1536.                 array('name' => "PT Serif", 'variant' => ':r,b,i,bi'),
  1537.                 array('name' => "Astloch", 'variant' => ':b'),
  1538.                 array('name' => "Bevan", 'variant' => ''),
  1539.                 array('name' => "Anton", 'variant' => ''),
  1540.                 array('name' => "Expletus Sans", 'variant' => ':b'),
  1541.                 array('name' => "VT323", 'variant' => ''),
  1542.                 array('name' => "Pacifico", 'variant' => ''),
  1543.                 array('name' => "Candal", 'variant' => ''),
  1544.                 array('name' => "Architects Daughter", 'variant' => ''),
  1545.                 array('name' => "Indie Flower", 'variant' => ''),
  1546.                 array('name' => "League Script", 'variant' => ''),
  1547.                 array('name' => "Quattrocento", 'variant' => ''),
  1548.                 array('name' => "Amaranth", 'variant' => ''),
  1549.                 array('name' => "Irish Grover", 'variant' => ''),
  1550.                 array('name' => "Oswald", 'variant' => ':400,300,700'),
  1551.                 array('name' => "EB Garamond", 'variant' => ''),
  1552.                 array('name' => "Nova Round", 'variant' => ''),
  1553.                 array('name' => "Nova Slim", 'variant' => ''),
  1554.                 array('name' => "Nova Script", 'variant' => ''),
  1555.                 array('name' => "Nova Cut", 'variant' => ''),
  1556.                 array('name' => "Nova Mono", 'variant' => ''),
  1557.                 array('name' => "Nova Oval", 'variant' => ''),
  1558.                 array('name' => "Nova Flat", 'variant' => ''),
  1559.                 array('name' => "Terminal Dosis Light", 'variant' => ''),
  1560.                 array('name' => "Michroma", 'variant' => ''),
  1561.                 array('name' => "Miltonian", 'variant' => ''),
  1562.                 array('name' => "Miltonian Tattoo", 'variant' => ''),
  1563.                 array('name' => "Annie Use Your Telescope", 'variant' => ''),
  1564.                 array('name' => "Dawning of a New Day", 'variant' => ''),
  1565.                 array('name' => "Sue Ellen Francisco", 'variant' => ''),
  1566.                 array('name' => "Waiting for the Sunrise", 'variant' => ''),
  1567.                 array('name' => "Special Elite", 'variant' => ''),
  1568.                 array('name' => "Quattrocento Sans", 'variant' => ''),
  1569.                 array('name' => "Smythe", 'variant' => ''),
  1570.                 array('name' => "The Girl Next Door", 'variant' => ''),
  1571.                 array('name' => "Aclonica", 'variant' => ''),
  1572.                 array('name' => "News Cycle", 'variant' => ''),
  1573.                 array('name' => "Damion", 'variant' => ''),
  1574.                 array('name' => "Wallpoet", 'variant' => ''),
  1575.                 array('name' => "Over the Rainbow", 'variant' => ''),
  1576.                 array('name' => "MedievalSharp", 'variant' => ''),
  1577.                 array('name' => "Six Caps", 'variant' => ''),
  1578.                 array('name' => "Swanky and Moo Moo", 'variant' => ''),
  1579.                 array('name' => "Bigshot One", 'variant' => ''),
  1580.                 array('name' => "Francois One", 'variant' => ''),
  1581.                 array('name' => "Sigmar One", 'variant' => ''),
  1582.                 array('name' => "Carter One", 'variant' => ''),
  1583.                 array('name' => "Holtwood One SC", 'variant' => ''),
  1584.                 array('name' => "Paytone One", 'variant' => ''),
  1585.                 array('name' => "Monofett", 'variant' => ''),
  1586.                 array('name' => "Rokkitt", 'variant' => ':400,700'),
  1587.                 array('name' => "Megrim", 'variant' => ''),
  1588.                 array('name' => "Judson", 'variant' => ':r,ri,b'),
  1589.                 array('name' => "Didact Gothic", 'variant' => ''),
  1590.                 array('name' => "Play", 'variant' => ':r,b'),
  1591.                 array('name' => "Ultra", 'variant' => ''),
  1592.                 array('name' => "Metrophobic", 'variant' => ''),
  1593.                 array('name' => "Mako", 'variant' => ''),
  1594.                 array('name' => "Shanti", 'variant' => ''),
  1595.                 array('name' => "Caudex", 'variant' => ':r,b,i,bi'),
  1596.                 array('name' => "Jura", 'variant' => ''),
  1597.                 array('name' => "Ruslan Display", 'variant' => ''),
  1598.                 array('name' => "Brawler", 'variant' => ''),
  1599.                 array('name' => "Nunito", 'variant' => ''),
  1600.                 array('name' => "Wire One", 'variant' => ''),
  1601.                 array('name' => "Podkova", 'variant' => ''),
  1602.                 array('name' => "Muli", 'variant' => ''),
  1603.                 array('name' => "Maven Pro", 'variant' => ':400,500,700'),
  1604.                 array('name' => "Tenor Sans", 'variant' => ''),
  1605.                 array('name' => "Limelight", 'variant' => ''),
  1606.                 array('name' => "Playfair Display", 'variant' => ''),
  1607.                 array('name' => "Artifika", 'variant' => ''),
  1608.                 array('name' => "Lora", 'variant' => ''),
  1609.                 array('name' => "Kameron", 'variant' => ':r,b'),
  1610.                 array('name' => "Cedarville Cursive", 'variant' => ''),
  1611.                 array('name' => "Zeyada", 'variant' => ''),
  1612.                 array('name' => "La Belle Aurore", 'variant' => ''),
  1613.                 array('name' => "Shadows Into Light", 'variant' => ''),
  1614.                 array('name' => "Lobster Two", 'variant' => ':r,b,i,bi'),
  1615.                 array('name' => "Nixie One", 'variant' => ''),
  1616.                 array('name' => "Redressed", 'variant' => ''),
  1617.                 array('name' => "Bangers", 'variant' => ''),
  1618.                 array('name' => "Open Sans Condensed", 'variant' => ':300italic,400italic,700italic,400,300,700'),
  1619.                 array('name' => "Open Sans", 'variant' => ':r,i,b,bi'),
  1620.                 array('name' => "Varela", 'variant' => ''),
  1621.                 array('name' => "Goblin One", 'variant' => ''),
  1622.                 array('name' => "Asset", 'variant' => ''),
  1623.                 array('name' => "Gravitas One", 'variant' => ''),
  1624.                 array('name' => "Hammersmith One", 'variant' => ''),
  1625.                 array('name' => "Stardos Stencil", 'variant' => ''),
  1626.                 array('name' => "Love Ya Like A Sister", 'variant' => ''),
  1627.                 array('name' => "Loved by the King", 'variant' => ''),
  1628.                 array('name' => "Bowlby One SC", 'variant' => ''),
  1629.                 array('name' => "Forum", 'variant' => ''),
  1630.                 array('name' => "Patrick Hand", 'variant' => ''),
  1631.                 array('name' => "Varela Round", 'variant' => ''),
  1632.                 array('name' => "Yeseva One", 'variant' => ''),
  1633.                 array('name' => "Give You Glory", 'variant' => ''),
  1634.                 array('name' => "Modern Antiqua", 'variant' => ''),
  1635.                 array('name' => "Bowlby One", 'variant' => ''),
  1636.                 array('name' => "Tienne", 'variant' => ''),
  1637.                 array('name' => "Istok Web", 'variant' => ':r,b,i,bi'),
  1638.                 array('name' => "Yellowtail", 'variant' => ''),
  1639.                 array('name' => "Pompiere", 'variant' => ''),
  1640.                 array('name' => "Unna", 'variant' => ''),
  1641.                 array('name' => "Rosario", 'variant' => ''),
  1642.                 array('name' => "Leckerli One", 'variant' => ''),
  1643.                 array('name' => "Snippet", 'variant' => ''),
  1644.                 array('name' => "Ovo", 'variant' => ''),
  1645.                 array('name' => "IM Fell English", 'variant' => ':r,i'),
  1646.                 array('name' => "IM Fell English SC", 'variant' => ''),
  1647.                 array('name' => "Gloria Hallelujah", 'variant' => ''),
  1648.                 array('name' => "Kelly Slab", 'variant' => ''),
  1649.                 array('name' => "Black Ops One", 'variant' => ''),
  1650.                 array('name' => "Carme", 'variant' => ''),
  1651.                 array('name' => "Aubrey", 'variant' => ''),
  1652.                 array('name' => "Federo", 'variant' => ''),
  1653.                 array('name' => "Delius", 'variant' => ''),
  1654.                 array('name' => "Rochester", 'variant' => ''),
  1655.                 array('name' => "Rationale", 'variant' => ''),
  1656.                 array('name' => "Abel", 'variant' => ''),
  1657.                 array('name' => "Marvel", 'variant' => ':r,b,i,bi'),
  1658.                 array('name' => "Actor", 'variant' => ''),
  1659.                 array('name' => "Delius Swash Caps", 'variant' => ''),
  1660.                 array('name' => "Smokum", 'variant' => ''),
  1661.                 array('name' => "Tulpen One", 'variant' => ''),
  1662.                 array('name' => "Coustard", 'variant' => ':r,b'),
  1663.                 array('name' => "Andika", 'variant' => ''),
  1664.                 array('name' => "Alice", 'variant' => ''),
  1665.                 array('name' => "Questrial", 'variant' => ''),
  1666.                 array('name' => "Comfortaa", 'variant' => ':r,b'),
  1667.                 array('name' => "Geostar", 'variant' => ''),
  1668.                 array('name' => "Geostar Fill", 'variant' => ''),
  1669.                 array('name' => "Volkhov", 'variant' => ''),
  1670.                 array('name' => "Voltaire", 'variant' => ''),
  1671.                 array('name' => "Montez", 'variant' => ''),
  1672.                 array('name' => "Short Stack", 'variant' => ''),
  1673.                 array('name' => "Vidaloka", 'variant' => ''),
  1674.                 array('name' => "Aldrich", 'variant' => ''),
  1675.                 array('name' => "Numans", 'variant' => ''),
  1676.                 array('name' => "Days One", 'variant' => ''),
  1677.                 array('name' => "Gentium Book Basic", 'variant' => ''),
  1678.                 array('name' => "Monoton", 'variant' => ''),
  1679.                 array('name' => "Alike", 'variant' => ''),
  1680.                 array('name' => "Delius Unicase", 'variant' => ''),
  1681.                 array('name' => "Abril Fatface", 'variant' => ''),
  1682.                 array('name' => "Dorsa", 'variant' => ''),
  1683.                 array('name' => "Antic", 'variant' => ''),
  1684.                 array('name' => "Passero One", 'variant' => ''),
  1685.                 array('name' => "Fanwood Text", 'variant' => ''),
  1686.                 array('name' => "Prociono", 'variant' => ''),
  1687.                 array('name' => "Merienda One", 'variant' => ''),
  1688.                 array('name' => "Changa One", 'variant' => ''),
  1689.                 array('name' => "Julee", 'variant' => ''),
  1690.                 array('name' => "Prata", 'variant' => ''),
  1691.                 array('name' => "Adamina", 'variant' => ''),
  1692.                 array('name' => "Sorts Mill Goudy", 'variant' => ''),
  1693.                 array('name' => "Terminal Dosis", 'variant' => ''),
  1694.                 array('name' => "Sansita One", 'variant' => ''),
  1695.                 array('name' => "Chivo", 'variant' => ''),
  1696.                 array('name' => "Spinnaker", 'variant' => ''),
  1697.                 array('name' => "Poller One", 'variant' => ''),
  1698.                 array('name' => "Alike Angular", 'variant' => ''),
  1699.                 array('name' => "Gochi Hand", 'variant' => ''),
  1700.                 array('name' => "Poly", 'variant' => ''),
  1701.                 array('name' => "Andada", 'variant' => ''),
  1702.                 array('name' => "Federant", 'variant' => ''),
  1703.                 array('name' => "Ubuntu Condensed", 'variant' => ''),
  1704.                 array('name' => "Ubuntu Mono", 'variant' => ''),
  1705.                 array('name' => "Sancreek", 'variant' => ''),
  1706.                 array('name' => "Coda", 'variant' => ''),
  1707.                 array('name' => "Rancho", 'variant' => ''),
  1708.                 array('name' => "Satisfy", 'variant' => ''),
  1709.                 array('name' => "Pinyon Script", 'variant' => ''),
  1710.                 array('name' => "Vast Shadow", 'variant' => ''),
  1711.                 array('name' => "Marck Script", 'variant' => ''),
  1712.                 array('name' => "Salsa", 'variant' => ''),
  1713.                 array('name' => "Amatic SC", 'variant' => ''),
  1714.                 array('name' => "Quicksand", 'variant' => ''),
  1715.                 array('name' => "Linden Hill", 'variant' => ''),
  1716.                 array('name' => "Corben", 'variant' => ''),
  1717.                 array('name' => "Creepster Caps", 'variant' => ''),
  1718.                 array('name' => "Butcherman Caps", 'variant' => ''),
  1719.                 array('name' => "Eater Caps", 'variant' => ''),
  1720.                 array('name' => "Nosifer Caps", 'variant' => ''),
  1721.                 array('name' => "Atomic Age", 'variant' => ''),
  1722.                 array('name' => "Contrail One", 'variant' => ''),
  1723.                 array('name' => "Jockey One", 'variant' => ''),
  1724.                 array('name' => "Cabin Sketch", 'variant' => ':r,b'),
  1725.                 array('name' => "Cabin Condensed", 'variant' => ':r,b'),
  1726.                 array('name' => "Fjord One", 'variant' => ''),
  1727.                 array('name' => "Rametto One", 'variant' => ''),
  1728.                 array('name' => "Mate", 'variant' => ':r,i'),
  1729.                 array('name' => "Mate SC", 'variant' => ''),
  1730.                 array('name' => "Arapey", 'variant' => ':r,i'),
  1731.                 array('name' => "Supermercado One", 'variant' => ''),
  1732.                 array('name' => "Petrona", 'variant' => ''),
  1733.                 array('name' => "Lancelot", 'variant' => ''),
  1734.                 array('name' => "Convergence", 'variant' => ''),
  1735.                 array('name' => "Cutive", 'variant' => ''),
  1736.                 array('name' => "Karla", 'variant' => ':400,400italic,700,700italic'),
  1737.                 array('name' => "Bitter", 'variant' => ':r,i,b'),
  1738.                 array('name' => "Asap", 'variant' => ':400,700,400italic,700italic'),
  1739.                 array('name' => "Bree Serif", 'variant' => '')
  1740.     );
  1741.  
  1742.     $font_count = 1;
  1743.     $font_output = '';
  1744.     $transh = 1;
  1745.  
  1746.     foreach ($google_fonts as $font) {
  1747.         $font_output .= $font['name'] . '' . $font['variant'] . '|';
  1748.         $font_count++;
  1749.  
  1750.         if ($font_count == 20) {
  1751.             tk_font_output_helper($font_output, 'google_font_' . $transh);
  1752.             $font_output = '';
  1753.             $font_count = 1;
  1754.             $transh++;
  1755.         }
  1756.     }
  1757. }
  1758.  
  1759. function tk_font_output_helper($output_font_string, $identifier) {
  1760.     wp_register_style($identifier, 'http://fonts.googleapis.com/css?family=' . $output_font_string);
  1761.     wp_enqueue_style($identifier);
  1762. }
  1763.  
  1764. add_action('wp_enqueue_scripts', 'tk_enqueue_google_fonts');
  1765.  
  1766. function tk_enqueue_google_fonts() {
  1767.     global $wpdb;
  1768.  
  1769.     $fonts = $wpdb->get_results("SELECT DISTINCT(option_value) FROM " . $wpdb->prefix . "options WHERE option_value LIKE 'tk_font_%'", ARRAY_A);
  1770.     $from_replaces = array('tk_font_', ' ');
  1771.     $to_replaces = array('', '+');
  1772.     $font_output = '';
  1773.  
  1774.     foreach ($fonts as $font) {
  1775.         $font_output .= str_replace($from_replaces, $to_replaces, $font['option_value']) . '|';
  1776.     }
  1777.  
  1778.     if(empty($font_output) || $font_output == 'Select|') {
  1779.         $font_output = 'Arvo';
  1780.     }
  1781.    
  1782.     wp_register_style('google_fonts', 'http://fonts.googleapis.com/css?family=' . $font_output);
  1783.     wp_enqueue_style('google_fonts');
  1784. }
  1785.  
  1786. function tk_get_font_name($font_option) {
  1787.     $font_name = str_replace('tk_font_', '', $font_option);
  1788.     $font_name = str_replace(substr(strrchr($font_name, ":"), 0), '', $font_name);
  1789.     return $font_name;
  1790. }
  1791.  
  1792. /* * ********************************************************** */
  1793. /* * **********GALLERY FANCYBOX FILTER*********************** */
  1794. /* * ********************************************************** */
  1795.  
  1796. add_filter('wp_get_attachment_link', 'add_lighbox_rel');
  1797.  
  1798. function add_lighbox_rel($attachment_link) {
  1799.     if (strpos($attachment_link, 'a href') != false) {
  1800.         $attachment_link = str_replace('a href', 'a class="fancybox" href', $attachment_link);
  1801.     }
  1802.     return $attachment_link;
  1803. }
  1804.  
  1805. /* * ********************************************************** */
  1806. /* * **********TWITTER SCRIPT******************************** */
  1807. /* * ********************************************************** */
  1808.  
  1809.  
  1810. function twitter_script($unique_id, $limit) {
  1811.    
  1812. require_once(dirname( __FILE__ ).'/script/twitter/TwitterAPIExchange.php');
  1813.  
  1814. ?>
  1815.     <script type="text/javascript">
  1816.         <!--//--><![CDATA[//><!--
  1817.  
  1818.         function twitterCallback2(twitters) {
  1819.             var statusHTML = [];
  1820.             for (var i=0; i<twitters.length; i++){
  1821.                 var username = twitters[i].user.screen_name;
  1822.                 var status = twitters[i].text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
  1823.                     return '<a href="'+url+'">'+url+'</a>';
  1824.                 }).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
  1825.                     return  reply.charAt(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>';
  1826.                 });
  1827.                 statusHTML.push('<li><div class="box-twitter-center left"><span>'+status+'</span></div><span class="twitter-links">'+relative_time(twitters[i].created_at)+'</span></li>');
  1828.             }
  1829.             document.getElementById('twitter_update_list_<?php echo $unique_id; ?>').innerHTML = statusHTML.join('');
  1830.         }
  1831.                                                                                                                                                    
  1832.         function relative_time(time_value) {
  1833.             var values = time_value.split(" ");
  1834.             time_value = values[1] + " " + values[2] + ", " + values[5] + " " + values[3];
  1835.             var parsed_date = Date.parse(time_value);
  1836.             var relative_to = (arguments.length > 1) ? arguments[1] : new Date();
  1837.             var delta = parseInt((relative_to.getTime() - parsed_date) / 1000);
  1838.             delta = delta + (relative_to.getTimezoneOffset() * 60);
  1839.  
  1840.             if (delta < 60) {
  1841.                 return 'less than a minute ago';
  1842.             } else if(delta < 120) {
  1843.                 return 'about a minute ago';
  1844.             } else if(delta < (60*60)) {
  1845.                 return (parseInt(delta / 60)).toString() + ' minutes ago';
  1846.             } else if(delta < (120*60)) {
  1847.                 return 'about an hour ago';
  1848.             } else if(delta < (24*60*60)) {
  1849.                 return 'about ' + (parseInt(delta / 3600)).toString() + ' hours ago';
  1850.             } else if(delta < (48*60*60)) {
  1851.                 return '1 day ago';
  1852.             } else {
  1853.                 return (parseInt(delta / 86400)).toString() + ' days ago';
  1854.             }
  1855.         }
  1856.         //-->
  1857.     </script>
  1858.  
  1859.  
  1860. <?php
  1861.  
  1862.  
  1863. /*GET TWITTER KEYS FROM ADMINISTRATION*/
  1864. $twitter_consumer_key = get_theme_option(tk_theme_name.'_social_twitter_consumer_key');
  1865. $twitter_consumer_secret = get_theme_option(tk_theme_name.'_social_twitter_consumer_secret');
  1866. $twitter_access_token = get_theme_option(tk_theme_name.'_social_twitter_access_token');
  1867. $twitter_token_secret = get_theme_option(tk_theme_name.'_social_twitter_token_secret');
  1868. $twitter_username = get_theme_option(tk_theme_name.'_social_twitter');
  1869.  
  1870.  
  1871.  
  1872. /** Set access tokens here - see: https://dev.twitter.com/apps/ **/
  1873. $settings = array(
  1874.     'oauth_access_token' => $twitter_access_token,
  1875.     'oauth_access_token_secret' => $twitter_token_secret,
  1876.     'consumer_key' => $twitter_consumer_key,
  1877.     'consumer_secret' => $twitter_consumer_secret
  1878. );
  1879.  
  1880. /** URL for REST request, see: https://dev.twitter.com/docs/api/1.1/ **/
  1881. $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json';
  1882. $getfield = '?screen_name='.$twitter_username;
  1883.  
  1884. if(!empty($unique_id)) {
  1885.     $getfield .= "&count=".$limit;
  1886. } else {
  1887.     $getfield .= "&count=1";
  1888. }
  1889.  
  1890. $requestMethod = 'GET';
  1891.  
  1892. /** Perform the request and echo the response **/
  1893. $twitter = new TwitterAPIExchange($settings);
  1894. $twitter_results = $twitter->setGetfield($getfield)
  1895.              ->buildOauth($url, $requestMethod)
  1896.              ->performRequest();
  1897. ?>
  1898.    
  1899. <script>twitterCallback2(<?php echo $twitter_results; ?>);</script>
  1900.    
  1901. <?php
  1902. }
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908. function catch_that_image() {
  1909.     global $post, $posts;
  1910.     $first_img = '';
  1911.     ob_start();
  1912.     ob_end_clean();
  1913.     $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  1914.     $first_img = $matches [1] [0];
  1915.     if (empty($first_img)) { //Defines a default image
  1916.         $first_img = "/images/default.jpg";
  1917.     }
  1918.     return $first_img;
  1919. }
  1920.  
  1921. add_action('init', 'tk_check_for_banner_redirection', 0); //Awaiting for banner click redirections
  1922. add_action('init', 'tk_check_for_banner_stats', 0);
  1923.  
  1924. function tk_check_for_banner_stats() {
  1925.     global $wpdb;
  1926.  
  1927.     if (isset($_GET['banner_stat_id'])) {
  1928.         $banner_id = $_GET['banner_stat_id'];
  1929.         $period = $_GET['period'];
  1930.         $today = date("Y-m-d");
  1931.         $date = '';
  1932.         if ($period == 0) {
  1933.             $date = '2011-01-01';
  1934.         }
  1935.  
  1936.         if ($period == 7) {
  1937.  
  1938.             $date = strtotime(date("Y", strtotime($today)) . " -7 days");
  1939.             $date = date('Y-m-d', $date);
  1940.         }
  1941.         if ($period == 30) {
  1942.             $date = strtotime(date("Y", strtotime($today)) . " -30 days");
  1943.             $date = date('Y-m-d', $date);
  1944.         }
  1945.         if ($period == 365) {
  1946.             $date = strtotime(date("Y", strtotime($today)) . " -365 days");
  1947.             $date = date('Y-m-d', $date);
  1948.         }
  1949.  
  1950.         $pageposts = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "banner_stats WHERE banner_id = %d AND date BETWEEN '" . $date . "' AND '" . $today . "' ORDER BY date ASC", $banner_id), OBJECT);
  1951.         $views = '';
  1952.         $clicks = '';
  1953.  
  1954.         if (isset($_GET['data_type']) and $_GET['data_type'] == 'views') {
  1955.             foreach ($pageposts as $post) {
  1956.                 $views .= "[" . (strtotime($post->date) * 1000) . "," . $post->views . "],";
  1957.             }
  1958.             $views = str_replace('],]', ']]', '[' . $views . ']');
  1959.             echo $views;
  1960.         }
  1961.  
  1962.         if (isset($_GET['data_type']) and $_GET['data_type'] == 'clicks') {
  1963.             foreach ($pageposts as $post) {
  1964.                 $clicks .= "[" . (strtotime($post->date) * 1000) . "," . $post->clicks . "],";
  1965.             }
  1966.             $clicks = str_replace('],]', ']]', '[' . $clicks . ']');
  1967.             echo $clicks;
  1968.         }
  1969.  
  1970.         exit;
  1971.     }
  1972. }
  1973.  
  1974. function tk_check_for_banner_redirection() {//Save click for the banner and redirect to the banner URL
  1975.     if (isset($_GET['banner_id'])) {
  1976.         global $wpdb;
  1977.         tk_add_banner_click($_GET['banner_id']);
  1978.     }
  1979. }
  1980.  
  1981. function tk_add_banner_view($banner_id) {
  1982.     global $wpdb;
  1983.     global $post;
  1984.     if (!is_admin()) {
  1985.         $todays_date = date('Y-m-d');
  1986.         $insert_query = $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "banner_stats SET views = (views + 1) WHERE banner_id = %d AND date = '" . $todays_date . "'", $banner_id));
  1987.         if (!$insert_query) {
  1988.             $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "banner_stats (banner_id, date, clicks, views) VALUES(%d, '" . $todays_date . "', 0, 1)", $banner_id));
  1989.         }
  1990.     }
  1991. }
  1992.  
  1993. function tk_add_banner_click($banner_id) {
  1994.     global $wpdb;
  1995.     $todays_date = date('Y-m-d');
  1996.     $insert_query = $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "banner_stats SET clicks = (clicks + 1) WHERE banner_id = %d AND date = '" . $todays_date . "'", $banner_id));
  1997.     if (!$insert_query) {
  1998.         $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "banner_stats (banner_id, date, clicks, views) VALUES(%d, '" . $todays_date . "', 1, 0)", $banner_id));
  1999.     }
  2000.     wp_redirect(get_post_meta($banner_id, 'tk_advertisement_link', true));
  2001.     exit;
  2002. }
  2003.  
  2004. /* * ********************************************************** */
  2005. /* * ****COLOR CHANGER FOR SERVICES POSTS************* */
  2006. /* * ********************************************************** */
  2007.  
  2008. function service_color() {
  2009.     $prefix = 'tk_';
  2010.     global $wpdb;
  2011.     $services_posts = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."posts WHERE post_type = 'services' AND post_status = 'publish'");
  2012. //var_dump($services_posts);
  2013.  
  2014.     foreach ($services_posts as $one_post) {
  2015.  
  2016.         $tk_background_color = get_post_meta($one_post->ID, $prefix . 'background_color', true);
  2017.         $tk_headline_color = get_post_meta($one_post->ID, $prefix . 'headline_color', true);
  2018.         $tk_text_color = get_post_meta($one_post->ID, $prefix . 'text_color', true);
  2019.         $tk_hover_color = get_post_meta($one_post->ID, $prefix . 'hover_color', true);
  2020.         $subheadline_color = get_post_meta($one_post->ID, $prefix . 'sub_headline_color', true);
  2021.         $subheading = get_post_meta($one_post->ID, $prefix . 'sub_headline_color', true);
  2022.         ?>
  2023.  
  2024.  
  2025.         <style type="text/css">
  2026.             .services-template .home-services-one<?php echo $one_post->ID; ?>,  .bg-services-single<?php echo $one_post->ID; ?>, .home .home-services-one<?php echo $one_post->ID; ?> {
  2027.                 background-color:#<?php echo $tk_background_color; ?>;
  2028.             }
  2029.  
  2030.             .home-services-one<?php echo $one_post->ID; ?> .home-services-one-image-title span a, .bg-services-single<?php echo $one_post->ID; ?> .bg-services-single-text span {
  2031.                 color:#<?php echo $tk_headline_color; ?>;
  2032.             }
  2033.  
  2034.             .home-services-one<?php echo $one_post->ID; ?> .home-services-one-image-text p, .home-services-one<?php echo $one_post->ID; ?> .home-services-one-image-link a {
  2035.                 color:#<?php echo $tk_text_color; ?>;
  2036.             }
  2037.  
  2038.             .home-services-one<?php echo $one_post->ID; ?> .home-services-one-image-link a:hover {
  2039.                 color:#<?php echo $tk_hover_color; ?>;
  2040.             }
  2041.  
  2042.             .home-services-one<?php echo $one_post->ID; ?> .ca-sub, .home-services-one<?php echo $one_post->ID; ?> p, .bg-services-single<?php echo $one_post->ID; ?> ul li p  {
  2043.                 color:#<?php echo $subheading; ?>;
  2044.             }
  2045.  
  2046.  
  2047.         </style>
  2048.  
  2049.         <?php
  2050.     } //service_post
  2051. }
  2052.  
  2053. //service_color
  2054.  
  2055. add_action('wp_footer', 'service_color');
  2056.  
  2057.  
  2058. require_once ( ABSPATH . 'wp-content/themes/' . tk_theme_name . '/inc/theme-style.php');
  2059.  
  2060. //Registers Revolution Slider Plugin
  2061. require_once dirname( __FILE__ ) . '/inc/tgm-plugin-activation/class-tgm-plugin-activation.php';
  2062.  
  2063. add_action( 'tgmpa_register', 'register_slider_plugin' );
  2064. function register_slider_plugin() {
  2065.  
  2066.    
  2067.     $plugins = array(
  2068.        
  2069.         array(
  2070.             'name'                  => 'Revolutions Slider', // The plugin name
  2071.             'slug'                  => 'revslider', // The plugin slug (typically the folder name)
  2072.             'source'                => get_stylesheet_directory() . '/inc/plugins/revslider.zip', // The plugin source
  2073.             'required'              => true, // If false, the plugin is only 'recommended' instead of required
  2074.             'version'               => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented
  2075.             'force_activation'      => true, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch
  2076.             'force_deactivation'    => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins
  2077.             'external_url'          => '', // If set, overrides default API URL and points to an external URL
  2078.         ),
  2079.  
  2080.     );
  2081.  
  2082.     // Change this to your theme text domain, used for internationalising strings
  2083.     $theme_text_domain = tk_theme_name();
  2084.  
  2085.     $config = array(
  2086.         'domain'            => $theme_text_domain,          // Text domain - likely want to be the same as your theme.
  2087.         'default_path'      => '',                          // Default absolute path to pre-packaged plugins
  2088.         'parent_menu_slug'  => 'themes.php',                // Default parent menu slug
  2089.         'parent_url_slug'   => 'themes.php',                // Default parent URL slug
  2090.         'menu'              => 'install-required-plugins',  // Menu slug
  2091.         'has_notices'       => true,                        // Show admin notices or not
  2092.         'is_automatic'      => false,                       // Automatically activate plugins after installation or not
  2093.         'message'           => '',                          // Message to output right before the plugins table
  2094.         'strings'           => array(
  2095.             'page_title'                                => __( 'Install Required Plugins', $theme_text_domain ),
  2096.             'menu_title'                                => __( 'Install Plugins', $theme_text_domain ),
  2097.             'installing'                                => __( 'Installing Plugin: %s', $theme_text_domain ), // %1$s = plugin name
  2098.             'oops'                                      => __( 'Something went wrong with the plugin API.', $theme_text_domain ),
  2099.             'notice_can_install_required'               => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ), // %1$s = plugin name(s)
  2100.             'notice_can_install_recommended'            => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' ), // %1$s = plugin name(s)
  2101.             'notice_cannot_install'                     => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s)
  2102.             'notice_can_activate_required'              => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
  2103.             'notice_can_activate_recommended'           => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s)
  2104.             'notice_cannot_activate'                    => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s)
  2105.             'notice_ask_to_update'                      => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ), // %1$s = plugin name(s)
  2106.             'notice_cannot_update'                      => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s)
  2107.             'install_link'                              => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ),
  2108.             'activate_link'                             => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ),
  2109.             'return'                                    => __( 'Return to Required Plugins Installer', $theme_text_domain ),
  2110.             'plugin_activated'                          => __( 'Plugin activated successfully.', $theme_text_domain ),
  2111.             'complete'                                  => __( 'All plugins installed and activated successfully. %s', $theme_text_domain ), // %1$s = dashboard link
  2112.             'nag_type'                                  => 'updated' // Determines admin notice type - can only be 'updated' or 'error'
  2113.         )
  2114.     );
  2115.  
  2116.     tgmpa( $plugins, $config );
  2117. }
  2118.  
  2119. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement