-
Notifications
You must be signed in to change notification settings - Fork 26
/
carrington.php
132 lines (117 loc) · 3.47 KB
/
carrington.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
// This file is part of the Carrington Core Platform for WordPress
// http://crowdfavorite.com/carrington-core/
//
// Copyright (c) 2008-2013 Crowd Favorite, Ltd. All rights reserved.
// http://crowdfavorite.com
//
// Released under the GPL license
// http://www.opensource.org/licenses/gpl-license.php
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// **********************************************************************
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
// ini_set('display_errors', '1');
// ini_set('error_reporting', E_ALL);
define('CFCT_CORE_VERSION', '3.7');
// Path to Carrington Core parent directory (usually the theme).
if (!defined('CFCT_PATH')) {
define('CFCT_PATH', trailingslashit(TEMPLATEPATH));
}
load_theme_textdomain('carrington');
include_once(CFCT_PATH.'carrington-core/admin.php');
include_once(CFCT_PATH.'carrington-core/templates.php');
include_once(CFCT_PATH.'carrington-core/utility.php');
include_once(CFCT_PATH.'carrington-core/ajax-load.php');
include_once(CFCT_PATH.'carrington-core/attachment.php');
include_once(CFCT_PATH.'carrington-core/compatibility.php');
cfct_load_plugins();
/**
* Loads AJAX request handler
*
**/
function cfct_init() {
cfct_admin_request_handler();
if (cfct_get_option('ajax_load') == 'yes') {
cfct_ajax_load();
}
}
//add_action('init', 'cfct_init');
/**
* Loads header code from Carrington Options
*
**/
function cfct_wp_head() {
echo cfct_get_option('wp_head');
}
add_action('wp_head', 'cfct_wp_head');
/**
* Loads footer code from Carrington Options
*
**/
function cfct_wp_footer() {
echo cfct_get_option('wp_footer');
}
add_action('wp_footer', 'cfct_wp_footer');
/**
* Loads about text from Carrington options for display in the sidebar
*
* @return string Markup for the about text
*
**/
function cfct_about_text() {
$about_text = cfct_get_option('about_text');
if (!empty($about_text)) {
$about_text = cfct_basic_content_formatting($about_text);
}
else {
global $post, $wp_query;
$orig_post = $post;
isset($wp_query->query_vars['page']) ? $page = $wp_query->query_vars['page'] : $page = null;
// temporary - resetting below
$wp_query->query_vars['page'] = null;
remove_filter('the_excerpt', 'st_add_widget');
$about_query = new WP_Query('pagename=about');
while ($about_query->have_posts()) {
$about_query->the_post();
$about_text = get_the_excerpt().sprintf(__('<a class="more" href="%s">more →</a>', 'carrington'), get_permalink());
}
$wp_query->query_vars['page'] = $page;
if (!empty($orig_post)) {
$post = $orig_post;
setup_postdata($post);
}
}
if (function_exists('st_add_widget')) {
add_filter('the_excerpt', 'st_add_widget');
}
return $about_text;
}
/**
* Gets custom colors to be used with a themes
*
* @return string Custom color
*
**/
function cfct_get_custom_colors($type = 'option') {
global $cfct_color_options;
$colors = array();
foreach ($cfct_color_options as $option => $value) {
switch ($type) {
case 'preview':
!empty($_GET[$option]) ? $colors[$option] = strip_tags(stripslashes($_GET[$option])) : $colors[$option] = '';
break;
case 'option':
default:
$colors[$option] = cfct_get_option($option);
break;
}
}
return $colors;
}
if (!defined('CFCT_DEBUG')) {
define('CFCT_DEBUG', false);
}