1 | <?php
|
---|
2 | /* Fusion/digitalnature */
|
---|
3 |
|
---|
4 | function init_language(){
|
---|
5 | if (class_exists('xili_language')) {
|
---|
6 | define('THEME_TEXTDOMAIN','fusion');
|
---|
7 | define('THEME_LANGS_FOLDER','/lang');
|
---|
8 | } else {
|
---|
9 | load_theme_textdomain('fusion', get_template_directory() . '/lang');
|
---|
10 | }
|
---|
11 | }
|
---|
12 | add_action ('init', 'init_language');
|
---|
13 |
|
---|
14 | // theme options
|
---|
15 | class FusionOptions {
|
---|
16 | function getOptions() {
|
---|
17 | $options = get_option('fusion_options');
|
---|
18 | if (!is_array($options)) {
|
---|
19 | $options['metakeywords'] = '';
|
---|
20 | $options['logoimage'] = false;
|
---|
21 | $options['hidehometab'] = false;
|
---|
22 | $options['hidecategories'] = false;
|
---|
23 | $options['hidesearch'] = false;
|
---|
24 | $options['categorytabs'] = false;
|
---|
25 | $options['layouttype'] = 'fixed';
|
---|
26 | $options['sidebarpos'] = 'right';
|
---|
27 | $options['nolayoutcontrol'] = false;
|
---|
28 | $options['nojquery'] = false;
|
---|
29 | $options['customcss'] = '';
|
---|
30 | update_option('fusion_options', $options);
|
---|
31 | }
|
---|
32 | return $options;
|
---|
33 | }
|
---|
34 |
|
---|
35 | function add() {
|
---|
36 | if(isset($_POST['fusion_save'])) {
|
---|
37 | $options = FusionOptions::getOptions();
|
---|
38 |
|
---|
39 | // meta keywords
|
---|
40 | $options['metakeywords'] = stripslashes($_POST['metakeywords']);
|
---|
41 |
|
---|
42 | // logo image
|
---|
43 | if ($_POST['logoimage']) { $options['logoimage'] = (bool)true; } else { $options['logoimage'] = (bool)false; }
|
---|
44 | $options['logoimage'] = stripslashes($_POST['logoimage']);
|
---|
45 |
|
---|
46 | // hide home tab
|
---|
47 | if ($_POST['hidehometab']) { $options['hidehometab'] = (bool)true; } else { $options['hidehometab'] = (bool)false; }
|
---|
48 | $options['hidehometab'] = stripslashes($_POST['hidehometab']);
|
---|
49 |
|
---|
50 | // hide categories
|
---|
51 | if ($_POST['hidecategories']) { $options['hidecategories'] = (bool)true; } else { $options['hidecategories'] = (bool)false; }
|
---|
52 | $options['hidecategories'] = stripslashes($_POST['hidecategories']);
|
---|
53 |
|
---|
54 | // hide search
|
---|
55 | if ($_POST['hidesearch']) { $options['hidesearch'] = (bool)true; } else { $options['hidesearch'] = (bool)false; }
|
---|
56 | $options['hidesearch'] = stripslashes($_POST['hidesearch']);
|
---|
57 |
|
---|
58 | // show category tabs instead of page tabs
|
---|
59 | if ($_POST['categorytabs']) { $options['categorytabs'] = (bool)true; } else { $options['categorytabs'] = (bool)false; }
|
---|
60 | $options['categorytabs'] = stripslashes($_POST['categorytabs']);
|
---|
61 |
|
---|
62 | // page width
|
---|
63 | $options['layouttype'] = stripslashes($_POST['layouttype']);
|
---|
64 |
|
---|
65 | // page width
|
---|
66 | $options['sidebarpos'] = stripslashes($_POST['sidebarpos']);
|
---|
67 |
|
---|
68 | // hide <>
|
---|
69 | if ($_POST['nolayoutcontrol']) { $options['nolayoutcontrol'] = (bool)true; } else { $options['nolayoutcontrol'] = (bool)false; }
|
---|
70 | $options['nolayoutcontrol'] = stripslashes($_POST['nolayoutcontrol']);
|
---|
71 |
|
---|
72 | // disable jquery
|
---|
73 | if ($_POST['nojquery']) { $options['nojquery'] = (bool)true; } else { $options['nojquery'] = (bool)false; }
|
---|
74 | $options['nojquery'] = stripslashes($_POST['nojquery']);
|
---|
75 |
|
---|
76 | // meta keywords
|
---|
77 | $options['customcss'] = stripslashes($_POST['customcss']);
|
---|
78 |
|
---|
79 | update_option('fusion_options', $options);
|
---|
80 |
|
---|
81 | } else {
|
---|
82 | FusionOptions::getOptions();
|
---|
83 | }
|
---|
84 |
|
---|
85 | add_theme_page(__("Fusion Theme Options","fusion"), __("Fusion Theme Options","fusion"), 'edit_themes', basename(__FILE__), array('FusionOptions', 'display'));
|
---|
86 | }
|
---|
87 |
|
---|
88 | function display() {
|
---|
89 | $options = FusionOptions::getOptions();
|
---|
90 | ?>
|
---|
91 | <form action="#" method="post" enctype="multipart/form-data" name="fusion_form" id="fusion_form">
|
---|
92 | <div class="wrap">
|
---|
93 | <h2><?php _e('Fusion Theme Options','fusion'); ?></h2>
|
---|
94 | <br />
|
---|
95 | <p>
|
---|
96 | <label><?php _e('Meta keywords:','fusion'); ?></label><br />
|
---|
97 | <input type="text" name="metakeywords" id="metakeywords" class="code" value="<?php echo($options['metakeywords']); ?>" /><br /><em><?php _e('Separate with commas','fusion'); ?></em>
|
---|
98 | </p>
|
---|
99 | <br />
|
---|
100 | <p>
|
---|
101 | <input name="logoimage" type="checkbox" value="checkbox" <?php if($options['logoimage']) echo "checked='checked'"; ?> />
|
---|
102 | <?php _e('Use custom logo image','fusion'); ?><br /><em> <?php _e('Upload your logo as "logo.png" in the theme directory:','fusion'); echo ' <strong>'; bloginfo('template_url'); echo '</strong>.<br />'; _e('You should export the logo image with transparency enabled','fusion'); ?></em>
|
---|
103 | </p>
|
---|
104 | <br />
|
---|
105 | <p>
|
---|
106 | <input name="hidehometab" type="checkbox" value="checkbox" <?php if($options['hidehometab']) echo "checked='checked'"; ?> />
|
---|
107 | <?php _e('Disable homepage tab','fusion'); ?><br /><em><?php _e('Check this if you are using a static page as the homepage','fusion'); ?></em>
|
---|
108 | </p>
|
---|
109 | <br />
|
---|
110 | <p>
|
---|
111 | <input name="categorytabs" type="checkbox" value="checkbox" <?php if($options['categorytabs']) echo "checked='checked'"; ?> />
|
---|
112 | <?php _e('Show the categories as header tabs','fusion'); ?><br /><em><?php _e('(instead of pages)','fusion'); ?></em>
|
---|
113 | </p>
|
---|
114 | <br />
|
---|
115 | <p>
|
---|
116 | <input name="hidecategories" type="checkbox" value="checkbox" <?php if($options['hidecategories']) echo "checked='checked'"; ?> />
|
---|
117 | <?php _e('Disable the default category block in the sidebar','fusion'); ?><br /><em><?php _e('Check if you prefer the widgetized category display or just want to hide the categories','fusion'); ?></em>
|
---|
118 | </p>
|
---|
119 | <br />
|
---|
120 | <p>
|
---|
121 | <input name="hidesearch" type="checkbox" value="checkbox" <?php if($options['hidesearch']) echo "checked='checked'"; ?> />
|
---|
122 | <?php _e('Disable the default search block in the sidebar','fusion'); ?><br /><em><?php _e('Check if you don\'t like the theme-default search look','fusion'); ?></em>
|
---|
123 | </p>
|
---|
124 | <br />
|
---|
125 | <p>
|
---|
126 | <input name="nolayoutcontrol" type="checkbox" value="checkbox" <?php if($options['nolayoutcontrol']) echo "checked='checked'"; ?> />
|
---|
127 | <?php _e('Disable layout controls (Aa/<>)','fusion'); ?>
|
---|
128 | <br />
|
---|
129 | <?php _e('Default page content width:','fusion'); ?>
|
---|
130 | <label>
|
---|
131 | <input name="layouttype" type="radio" value="fixed" <?php if($options['layouttype'] != 'fluid') echo "checked='checked'"; ?> />
|
---|
132 | <?php _e('Fixed (960 pixels)','fusion'); ?>
|
---|
133 | </label>
|
---|
134 | <label style="padding-left: 15px;">
|
---|
135 | <input name="layouttype" type="radio" value="fluid" <?php if($options['layouttype'] == 'fluid') echo "checked='checked'"; ?> />
|
---|
136 | <?php _e('Fluid (95 percent of the visitor\'s screen width)','fusion'); ?>
|
---|
137 | </label><br /><em><?php _e('Note that if the layout controls are enabled, the visitor\'s javascript page width cookie setting will override this option','fusion'); ?></em>
|
---|
138 | </p>
|
---|
139 | <br />
|
---|
140 | <p>
|
---|
141 | <?php _e('Sidebar position:','fusion'); ?>
|
---|
142 | <label>
|
---|
143 | <input name="sidebarpos" type="radio" value="right" <?php if($options['sidebarpos'] != 'left') echo "checked='checked'"; ?> />
|
---|
144 | <?php _e('Right (default)','fusion'); ?>
|
---|
145 | </label>
|
---|
146 | <label style="padding-left: 15px;">
|
---|
147 | <input name="sidebarpos" type="radio" value="left" <?php if($options['sidebarpos'] == 'left') echo "checked='checked'"; ?> />
|
---|
148 | <?php _e('Left','fusion'); ?>
|
---|
149 | </label>
|
---|
150 | </p>
|
---|
151 | <br />
|
---|
152 | <p>
|
---|
153 | <input name="nojquery" type="checkbox" value="checkbox" <?php if($options['nojquery']) echo "checked='checked'"; ?> />
|
---|
154 | <?php _e('Disable jQuery and the associated code','fusion'); ?><br /><em><?php _e('This will reduce the page load with ~70 KB, but will also disable some features and effects (layout controls, rss links inside category menu, comment tabs, trackbacks).<br />You shouldn\'t change this unless you have problems with your host regarding bandwidth','fusion'); ?></em>
|
---|
155 | </p>
|
---|
156 | <br />
|
---|
157 | <h2><?php _e('Custom CSS code','fusion'); ?></h2>
|
---|
158 | <p style="float:left; padding-right: 10px; width: 300px;"><em><?php printf(__('Here you can add or change anything related to design if you have some basic CSS knowledge. Check %s to see existing styles, which you can redefine here.','fusion'),'<a href="'.get_bloginfo('template_url').'/style.css">style.css</a>'); ?></em> <?php echo'<br /><br /><em style="color: #ed1f24">';_e('Don\'t modify style.css if you wish to preserve your changes after theme update! Use this option instead.','fusion');echo '</em><br /><br />'?>
|
---|
159 | <textarea name="customcss" id="customcss" class="code" style='float: left' rows="18" cols="38"><?php echo($options['customcss']); ?></textarea>
|
---|
160 | </p>
|
---|
161 | <div style="float: left; margin-left: 6px; border-left: 1px solid #DCDCDC; padding-left: 6px;">
|
---|
162 | <p><strong>Examples</strong> (copy/paste in the left text area):</p>
|
---|
163 | <p><em style="color: #5db408">/* Set maximum page width to 1200 pixels (on fluid layout) */</em><br /><code>#page{ max-width: 1200px; }</code></p>
|
---|
164 | <p><em style="color: #5db408">/* Make links red, without background on mouse over */</em><br /><code>a, a:hover{ color: #ed1f24; }<br />a:hover{ background: none; }</code></p>
|
---|
165 | <p><em style="color: #5db408">/* Make header background dark brown */</em><br /><code>#page-wrap1{ background: none; }<br />#page-wrap2{ background: #402f1f; }</code></p>
|
---|
166 | <p><em style="color: #5db408">/* Custom header image */</em><br /><code>#page-wrap1{ background: none; }<br />#page-wrap2{ background: url(/files/yourimage.jpg) no-repeat center top; }</code></p>
|
---|
167 | <p><em style="color: #5db408">/* Decrease header height to 150 pixels and hide the logo */</em><br /><code>#page-wrap2, #header{ height: 150px; }<br />body{ background-position: left 150px; }<br />a#logo{ display: none; }</code></p>
|
---|
168 | <p><em style="color: #5db408">/* Increase tag line text size */</em><br /><code>#topnav, #topnav a{ font-size: 130%; }</code></p>
|
---|
169 | <p><em style="color: #5db408">/* Hide post information bar */</em><br /><code>.postinfo{ display: none; }</code></p>
|
---|
170 | <p><em style="color: #5db408">/* Make tabs narrower */</em><br /><code>#tabs{ letter-spacing: -0.04em; font-size: 13px; }<br />#tabs a span span{ padding: 4px 0 0 0; }</code></p>
|
---|
171 | <p><em style="color: #5db408">/* Use Windows Arial style fonts, instead of Mac's Lucida */</em><br /><code>body, input, textarea, select, h3, h4, h5, h6,<br />#sidebar h2.title, #sidebar2 h2.title{ font-family: Arial, Helvetica; }</code></p>
|
---|
172 | </div>
|
---|
173 | <br clear="left" />
|
---|
174 |
|
---|
175 |
|
---|
176 |
|
---|
177 | <p class="submit">
|
---|
178 | <input class="button-primary" type="submit" name="fusion_save" value="<?php _e('Save Changes','fusion'); ?>" />
|
---|
179 | </p>
|
---|
180 |
|
---|
181 | </div>
|
---|
182 | </form>
|
---|
183 | <?php
|
---|
184 | }
|
---|
185 | }
|
---|
186 |
|
---|
187 | // register functions
|
---|
188 | add_action('admin_menu', array('FusionOptions', 'add'));
|
---|
189 |
|
---|
190 | if ( function_exists('register_sidebar')) {
|
---|
191 | register_sidebar(array(
|
---|
192 | 'name' => 'Default sidebar',
|
---|
193 | 'before_widget' => '<li><div id="%1$s" class="widget %2$s">',
|
---|
194 | 'after_widget' => '</div></li>',
|
---|
195 | 'before_title' => '<h2 class="title">',
|
---|
196 | 'after_title' => '</h2>'
|
---|
197 | ));
|
---|
198 | register_sidebar(array(
|
---|
199 | 'name' => '2nd sidebar (only on 3-col pages)',
|
---|
200 | 'before_widget' => '<li><div id="%1$s" class="widget %2$s">',
|
---|
201 | 'after_widget' => '</div></li>',
|
---|
202 | 'before_title' => '<h2 class="title">',
|
---|
203 | 'after_title' => '</h2>'
|
---|
204 | ));
|
---|
205 | }
|
---|
206 |
|
---|
207 | function list_pings($comment, $args, $depth) {
|
---|
208 | $GLOBALS['comment'] = $comment;
|
---|
209 | ?>
|
---|
210 | <li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?>
|
---|
211 | <?php
|
---|
212 | }
|
---|
213 |
|
---|
214 | // custom comments
|
---|
215 | function list_comments($comment, $args, $depth) {
|
---|
216 | $GLOBALS['comment'] = $comment;
|
---|
217 | global $commentcount;
|
---|
218 | if(!$commentcount) { $commentcount = 0; }
|
---|
219 | ?> <!-- comment entry -->
|
---|
220 | <li <?php if (function_exists('get_avatar') && get_option('show_avatars')) echo comment_class('with-avatars'); else comment_class(); ?> id="comment-<?php comment_ID() ?>">
|
---|
221 | <div class="wrap<?php if(comments_open()) { ?> tiptrigger<?php } ?>">
|
---|
222 | <?php if (function_exists('get_avatar') && get_option('show_avatars')) { ?>
|
---|
223 | <div class="avatar">
|
---|
224 | <a class="gravatar"><?php echo get_avatar($comment, 64); ?></a>
|
---|
225 | </div>
|
---|
226 | <?php } ?>
|
---|
227 | <div class="details <?php if($comment->comment_author_email == get_the_author_email()) echo 'admincomment'; else echo 'regularcomment'; ?>">
|
---|
228 | <p class="head">
|
---|
229 | <span class="info">
|
---|
230 | <?php
|
---|
231 | if (get_comment_author_url()):
|
---|
232 | $authorlink='<a id="commentauthor-'.get_comment_ID().'" href="'.get_comment_author_url().'">'.get_comment_author().'</a>';
|
---|
233 | else:
|
---|
234 | $authorlink='<b id="commentauthor-'.get_comment_ID().'">'.get_comment_author().'</b>';
|
---|
235 | endif;
|
---|
236 | printf(__('%s by %s at %s', 'fusion'), '<a href="#comment-'.get_comment_ID().'">#'.++$commentcount.'</a>', $authorlink, get_comment_time(__('F jS, Y', 'fusion')), get_comment_time(__('H:i', 'fusion')));
|
---|
237 | ?>
|
---|
238 | </span>
|
---|
239 | </p>
|
---|
240 | <!-- comment contents -->
|
---|
241 | <div class="text">
|
---|
242 | <?php if ($comment->comment_approved == '0') : ?>
|
---|
243 | <p class="error"><small><?php _e('Your comment is awaiting moderation.','fusion'); ?></small></p>
|
---|
244 | <?php endif; ?>
|
---|
245 | <div id="commentbody-<?php comment_ID() ?>">
|
---|
246 | <?php comment_text(); ?>
|
---|
247 | </div>
|
---|
248 | </div>
|
---|
249 | <!-- /comment contents -->
|
---|
250 | </div>
|
---|
251 | <?php if(comments_open()) { ?>
|
---|
252 | <div class="act tip">
|
---|
253 | <span class="button reply"><?php comment_reply_link(array_merge( $args, array('add_below' => 'commentbody', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'reply_text' => '<span><span>'.__('Reply','fusion').'</span></span>'.$my_comment_count))) ?></span> <span class="button quote"><a title="<?php _e('Quote','fusion'); ?>" href="javascript:void(0);" onclick="MGJS_CMT.quote('commentauthor-<?php comment_ID() ?>', 'comment-<?php comment_ID() ?>', 'commentbody-<?php comment_ID() ?>', 'comment');"><span><span><?php _e('Quote','fusion'); ?></span></span></a></span>
|
---|
254 | </div>
|
---|
255 | <?php } ?>
|
---|
256 | <span class="editlink"><?php edit_comment_link(''); ?></span>
|
---|
257 | </div>
|
---|
258 | <?php
|
---|
259 | }
|
---|
260 | ?>
|
---|