-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
190 lines (156 loc) · 6.45 KB
/
functions.php
File metadata and controls
190 lines (156 loc) · 6.45 KB
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?php
/**
* photoboard functions and definitions
*
* @package photoboard
* @since photoboard 1.0
*/
//define( 'PHOTOBOARD_NO_CACHE', FALSE );
//max height * width for photo to avoid out of memory errors
define( 'PHOTOBOARD_MAX_IMAGE_SIZE', 10000000 );
//min height or width for photo
define( 'PHOTOBOARD_MIN_IMAGE_SIZE', 100 );
//initialise constants
define( 'PHOTOBOARD_THEME_URL', get_stylesheet_directory_uri() );
define( 'PHOTOBOARD_THEME_PATH_SITE', '/board/wp-content/themes/photoboard' );
define( 'PHOTOBOARD_THEME_PATH_WP', '/wp/wp-content/themes/photoboard' );
define( 'PHOTOBOARD_PIX_PATH', '/pix/' );
define( 'PHOTOBOARD_PIX_DIR', $_SERVER['DOCUMENT_ROOT'] . '/pix/' );
define( 'TT_URL', PHOTOBOARD_THEME_URL . '/extlib/tt/tt.php' );
define( 'TT_URL_2', str_replace( '//photoboard', '//img.photoboard', TT_URL ));
//bit of a hack - makes sure we have a URL for the real path to images
//using the multisite path confuses TT sometimes
define( 'PHOTOBOARD_RAW_THEME_URL', str_replace( '/board/', '/wp/', get_stylesheet_directory_uri() ) );
//path to where photos are stored by gravity forms
//define( 'PHOTOBOARD_GRAVITY_DIR', '/wp/wp-content/uploads/gravity_forms/2-eeb7716ba96df13867debe99f05ec6f1' );
define( 'PHOTOBOARD_GRAVITY_DIR', '/wp/wp-content/uploads/gravity_forms/1-a13b2848a36456456ab5f25b33f14fcc' );
//prefix to strip from photo url location when importing
define( 'PHOTOBOARD_PIX_URL_STRIP', 'http://photoboard.findhorn.cc' . PHOTOBOARD_GRAVITY_DIR );
//if TRUE will import all records overwriting any existing ones
//use with caution - changes are made direct in the database, not to the original form
define ('PHOTOBOARD_IMPORT_ALL', FALSE );
if( 'photoboard.dev' == $_SERVER['SERVER_NAME'] )
{
define( 'PHOTOBOARD_IMPORT_FILE', '/Users/mark/Sites/photoboard/import.csv');
define( 'PHOTOBOARD_PIX_IMPORT_DIR', '/Users/mark/Sites/photoboard/photo_import' . PHOTOBOARD_GRAVITY_DIR);
define( 'PHOTOBOARD_OLD_PIX_IMPORT_DIR', '/Users/mark/Documents/Dox/Business/Clients/NFA/Photoboard/existing_photos' );
}
else
{
//absolute path to csv file used for import
define( 'PHOTOBOARD_IMPORT_FILE', '/home/httpd/vhosts/photoboard/import.csv');
//absolute path to dir where pix are imported from - replaces URL constant above in file location
define( 'PHOTOBOARD_PIX_IMPORT_DIR', '/home/httpd/vhosts/photoboard/sites/live' . PHOTOBOARD_GRAVITY_DIR);
//where are existing photoboard pix stored
define( 'PHOTOBOARD_OLD_PIX_IMPORT_DIR', '/home/httpd/vhosts/photoboard/existing_photos' );
//separate url for serving large images
define( 'PHOTOBOARD_IMG_SITE', 'http://img.photoboard.findhorn.cc');
}
//define cachebuster constant if not already defined
//define as false above to disable
if( !defined('PHOTOBOARD_NO_CACHE') )
define( 'PHOTOBOARD_NO_CACHE', "no-cache-" . microtime(TRUE) );
foreach( scandir(__DIR__ . '/functions') as $file )
{
if( '.'==$file || '..'==$file || substr( $file, -4 )!='.php' ) continue;
require_once("functions/$file");
}
/**
* Set the content width based on the theme's design and stylesheet.
*
* @since photoboard 1.0
*/
if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */
if ( ! function_exists( 'photoboard_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* @since photoboard 1.0
*/
function photoboard_setup() {
/**
* Custom template tags for this theme.
*/
require( get_template_directory() . '/inc/template-tags.php' );
/**
* Custom functions that act independently of the theme templates
*/
//require( get_template_directory() . '/inc/tweaks.php' );
/**
* Custom Theme Options
*/
//require( get_template_directory() . '/inc/theme-options/theme-options.php' );
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
* If you're building a theme based on photoboard, use a find and replace
* to change 'photoboard' to the name of your theme in all the template files
*/
load_theme_textdomain( 'photoboard', get_template_directory() . '/languages' );
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' );
/**
* Enable support for Post Thumbnails
*/
add_theme_support( 'post-thumbnails' );
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'photoboard' ),
) );
/**
* Add support for the Aside Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', ) );
}
endif; // photoboard_setup
add_action( 'after_setup_theme', 'photoboard_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since photoboard 1.0
*/
function photoboard_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'photoboard' ),
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
}
add_action( 'widgets_init', 'photoboard_widgets_init' );
/**
* Enqueue scripts and styles
*/
function photoboard_scripts() {
wp_enqueue_style( 'style', PHOTOBOARD_THEME_URL . '/css/screen.css', NULL, PHOTOBOARD_NO_CACHE );
wp_enqueue_style( 'font-merienda', 'http://fonts.googleapis.com/css?family=Merienda+One', 'style');
//wp_enqueue_script( 'small-menu', PHOTOBOARD_THEME_URL . '/js/small-menu.js', array( 'jquery' ), '20120206', true );
wp_enqueue_script( 'photoboard', PHOTOBOARD_THEME_URL . '/js/photoboard.js', array( 'jquery' ), PHOTOBOARD_NO_CACHE, true );
wp_enqueue_script( 'bootstrap', PHOTOBOARD_THEME_URL . '/js/bootstrap.min.js', array( 'jquery' ), '20120206', true );
$photoboard_js_vars = array(
'ajaxurl' => admin_url( 'admin-ajax.php' )
);
wp_localize_script( 'photoboard', 'photoboard_params', $photoboard_js_vars );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
}
add_action( 'wp_enqueue_scripts', 'photoboard_scripts' );
/**
* Implement the Custom Header feature
*/
//require( get_template_directory() . '/inc/custom-header.php' );