source: trunk/www.guidonia.net/wp/wp-content/themes/atahualpa/functions.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 43.6 KB
Line 
1<?php
2# Load translation file if available
3load_theme_textdomain('atahualpa');
4# Sidebars:
5if ( function_exists('register_sidebar') ) {
6 register_sidebar(array(
7 'name'=>'Left Sidebar',
8 'before_widget' => '<div id="%1$s" class="widget %2$s">',
9 'after_widget' => '</div></div>',
10 'before_title' => '<div class="widget-title"><h3>',
11 'after_title' => '</h3></div><div class="widget-content">',
12 ));
13 register_sidebar(array(
14 'name'=>'Right Sidebar',
15 'before_widget' => '<div id="%1$s" class="widget %2$s">',
16 'after_widget' => '</div></div>',
17 'before_title' => '<div class="widget-title"><h3>',
18 'after_title' => '</h3></div><div class="widget-content">',
19 ));
20}
21# Load functions
22include (TEMPLATEPATH . '/functions/bfa_header_config.php');
23include (TEMPLATEPATH . '/functions/bfa_hor_cats.php');
24include (TEMPLATEPATH . '/functions/bfa_hor_pages.php');
25include (TEMPLATEPATH . '/functions/bfa_footer.php');
26include (TEMPLATEPATH . '/functions/bfa_recent_comments.php');
27include (TEMPLATEPATH . '/functions/bfa_popular_posts.php');
28include (TEMPLATEPATH . '/functions/bfa_popular_in_cat.php');
29include (TEMPLATEPATH . '/functions/bfa_subscribe.php');
30include (TEMPLATEPATH . '/functions/bfa_text_widget.php');
31include (TEMPLATEPATH . '/functions/bfa_search_widget.php');
32include (TEMPLATEPATH . '/functions/bfa_calendar_widget.php');
33if (!function_exists('paged_comments')) { include (TEMPLATEPATH . '/functions/bfa_comment_walker.php'); }
34if (function_exists('sociable_html')) { include (TEMPLATEPATH . '/functions/bfa_sociable2.php'); }
35// find in directory function, needed for header images on WPMU
36if (file_exists(ABSPATH."/wpmu-settings.php")) {include (TEMPLATEPATH . '/functions/bfa_m_find_in_dir.php');}
37# Add admin page CSS
38function bfa_add_stuff_admin_head() {
39 $url_base = get_bloginfo('template_directory');
40 // add jquery function only to theme page or widgets won't work in 2.3 and older
41 if ( $_GET['page'] == basename(__FILE__) ) {
42 echo "<script src=\"$url_base/options/jscolor/jscolor.js\" type=\"text/javascript\"></script>\n";
43 echo "<style type=\"text/css\">\n";
44 echo "div.tabcontent { height: auto; border: none; margin: 0; padding: 0; display:none; /*overflow: visible;*/ width: auto} \n";
45 echo ".bfa-container { width: 100%; border: solid 3px #C6D9E9; background-color: #E4F2FD; margin: 10px auto; padding: 0; \n";
46 echo "-moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }\n";
47 echo ".bfa-container ul {list-style: circle url('" . get_bloginfo('template_directory') . "/options/images/list-arrow.gif') !important; margin: 1em 1em 1em 2em;} \n";
48 echo ".bfa-container-left { display: block; float: left; text-align: right; width: 35%; border-right: solid 1px #C6D9E9; margin: 0; padding: 10px; }\n";
49 echo ".bfa-container-right { display: block; float: right; width: 58%; margin: 0; padding: 10px; }\n";
50 echo ".bfa-container-full { /*display:block;*/ width: auto; margin: 0; padding: 10px; }\n";
51 echo ".bfa-container h2 { font-size: 1.5em; color: #666; margin:0; padding: 3px; border: none}\n";
52 echo ".bfa-container input { text-align: right }\n";
53 echo ".bfa-container label { font-size: 16px; font-weight: bold; color: #444; }\n";
54 echo ".bfa-container input, .bfa-container-left textarea, .bfa-container-left select { margin: 7px 0 4px 7px}\n";
55 echo "ul#bfaoptiontabs {text-align: left;list-style-type: none; margin: 10px 0 0 0; padding: 0; -moz-padding-start: 0}\n";
56 echo "ul#bfaoptiontabs li {display: inline; list-style-type: none; padding-top: 5px; }\n";
57 echo "ul#bfaoptiontabs li a:link, ul#bfaoptiontabs li a:visited, ul#bfaoptiontabs li a:active {display: -moz-inline-box; display: inline-block; white-space: nowrap; outline: 0; text-decoration: none; position: relative; z-index: 1; padding: 2px 6px; \n";
58 echo "margin-right: 0px; margin-top: 3px; border: 2px solid #C6D9E9; font-size: 1.1em; color: #2582a9; background-color: #E4F2FD; /*line-height: 22px; height: 22px;*/\n";
59 echo "-moz-border-radius: 3px; -khtml-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px;}\n";
60 echo "ul#bfaoptiontabs li a:hover {border: 2px solid #D54E21; background-color: #ffffff; color: #D54E21; }\n";
61 echo "ul#bfaoptiontabs li a.selected {border: 2px solid #883215; background-color: #D54E21; color: #ffffff !important; outline: 0}\n";
62 echo "table.bfa-optiontable-layout {width: 100%; }\n";
63 echo "table.bfa-optiontable {text-align: left; white-space: wrap; background-color: #f1f9fe; border-collapse: collapse; border: solid 1px #c4e2fb }\n";
64 echo "table.bfa-optiontable input {margin: 0 2px 0 2px; padding: 2px; text-align: left }\n";
65 echo "table.bfa-optiontable input.color {text-align: right }\n";
66 echo "table.bfa-optiontable thead tr td {line-height: 11px; }\n";
67 echo "table.bfa-optiontable-layout td {vertical-align:top; }\n";
68 echo "table.bfa-optiontable td {vertical-align:middle; padding: 1px 3px}\n";
69 echo "table.bfa-optiontable thead td {text-align: center; background-color: #c4e2fb; font-weight: bold; padding: 5px; }\n";
70 echo "div.more_blog_title_font { display: none }\n";
71 echo "div.more_show_header_image { display: none }\n";
72 echo "h4 {font-size: 18px; font-family:\"Courier New\", Courier, monospace; margin-bottom: 5px}\n";
73 echo "code {background: #ffffff; padding-left: 5px; padding-right: 5px;}\n";
74 echo "i {color: red; font-style: normal; font-weight: bold;}\n";
75 echo "input.save-tab { line-height: normal !important; font-size: 5em !important; padding: 5px 20px 10px 75px; border: solid 5px #063; background: #009d4f url('" . get_bloginfo('template_directory') . "/options/images/save.png') no-repeat 5% 50% !important; color: #fff; text-align: center; font-weight: bold;}\n";
76 echo "input.save-tab:hover { border: solid 5px #88d87a; background: #063 url('" . get_bloginfo('template_directory') . "/options/images/save.png') 5% 50% no-repeat !important; color: #fff; }\n";
77 echo "input.reset-tab { line-height: normal !important; font-size: 2em !important; padding: 5px 10px 5px 45px; border: solid 3px #800; background: #c30 url('" . get_bloginfo('template_directory') . "/options/images/reset.png') no-repeat 5% 50% !important; background-image: none; color: #fff; text-align: center; font-weight: bold;}\n";
78 echo "input.reset-tab:hover { border: solid 3px #ff9393; background: #800 url('" . get_bloginfo('template_directory') . "/options/images/reset.png') 5% 50% no-repeat !important; color: #fff; }\n";
79 echo "input.reset-all { line-height: normal !important; font-size: 1.5em !important; padding: 5px 10px 5px 45px; border: solid 3px #555; background: #777 url('" . get_bloginfo('template_directory') . "/options/images/reset-all-gray.png') no-repeat 5% 50% !important; background-image: none; color: #ddd; text-align: center; font-weight: bold;}\n";
80 echo "input.reset-all:hover { border: solid 3px #ff9393; background: #800 url('" . get_bloginfo('template_directory') . "/options/images/reset-all.png') 5% 50% no-repeat !important; color: #fff; }\n";
81 echo "p.submit { text-align: center; }\n";
82 echo "</style>\n";
83 echo "<script LANGUAGE=\"JavaScript\">\n";
84 echo "<!--\n";
85 echo "function confirmSubmit()\n";
86 echo "{\n";
87 echo "var agree=confirm(\"Are you sure? This will reset ALL theme options.\");\n";
88 echo "if (agree) return true ;\n";
89 echo "else return false ;\n";
90 echo "}\n";
91 echo "// -->\n";
92 echo "</script>\n";
93 // add jquery to WP 2.3 and older
94 if ( substr(get_bloginfo('version'), 0, 3) < 2.5 ) {
95 echo "<script type=\"text/javascript\" src=\"$url_base/js/jquery-1.2.6.min.js\"></script>\n";
96 }
97 echo "<script type=\"text/javascript\" src=\"$url_base/options/tabcontent/tabcontent.js\">\n";
98 echo "/***********************************************\n";
99 echo "* Tab Content script v2.2- © Dynamic Drive DHTML code library (www.dynamicdrive.com)\n";
100 echo "* This notice MUST stay intact for legal use\n";
101 echo "* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code\n";
102 echo "***********************************************/\n";
103 echo "</script>\n";
104 }
105}
106add_action('admin_head', 'bfa_add_stuff_admin_head');
107?>
108<?php
109// Escape single & double quotes
110function bfa_escape($string) {
111 $string = str_replace('"', '&#34;', $string);
112 $string = str_replace("'", '&#39;', $string);
113 return $string;
114}
115// change them back
116function bfa_unescape($string) {
117 $string = str_replace('&#34;', '"', $string);
118 $string = str_replace('&#39;', "'", $string);
119 return $string;
120}
121function bfa_escapelt($string) {
122 $string = str_replace('<', '&lt;', $string);
123 $string = str_replace('>', '&gt;', $string);
124 return $string;
125}
126?>
127<?php
128// get the theme options
129$stylesheet_directory = get_bloginfo('template_directory');
130include (TEMPLATEPATH . '/functions/bfa_theme_options.php');
131
132function mytheme_add_admin() {
133 global $themename, $shortname, $options;
134 if ( $_GET['page'] == basename(__FILE__) ) {
135 if ( 'save' == $_REQUEST['action'] ) {
136
137 foreach ($options as $value) {
138 if ( $value['category'] == $_REQUEST['category'] ) {
139 if ( $value['escape'] == "yes" ) {
140 update_option( $value['id'], stripslashes(bfa_escape($_REQUEST[ $value['id'] ] )));
141 } elseif ( $value['stripslashes'] == "no" ) {
142 update_option( $value['id'], $_REQUEST[ $value['id'] ] );
143 } else {
144 update_option( $value['id'], stripslashes($_REQUEST[ $value['id'] ] ));
145 }
146 }
147 }
148
149 foreach ($options as $value) {
150 if ( $value['category'] == $_REQUEST['category'] ) {
151 if ( $value['escape'] == "yes" ) {
152 if( isset( $_REQUEST[ $value['id'] ] ) ) {
153 update_option( $value['id'], stripslashes(bfa_escape($_REQUEST[ $value['id'] ] )));
154 } else {
155 delete_option( $value['id'] );
156 }
157 } elseif ($value['stripslashes'] == "no") {
158 if( isset( $_REQUEST[ $value['id'] ] ) ) {
159 update_option( $value['id'], $_REQUEST[ $value['id'] ] );
160 } else {
161 delete_option( $value['id'] );
162 }
163 } else {
164 if( isset( $_REQUEST[ $value['id'] ] ) ) {
165 update_option( $value['id'], stripslashes($_REQUEST[ $value['id'] ] ));
166 } else {
167 delete_option( $value['id'] );
168 }
169 }
170 }
171 }
172
173 header("Location: themes.php?page=functions.php&saved=true");
174 die;
175
176 } else if( 'reset' == $_REQUEST['action'] ) {
177 foreach ($options as $value) {
178 if ( $value['category'] == $_REQUEST['category'] OR "reset-all" == $_REQUEST['category'] ) {
179 delete_option( $value['id'] );
180 }
181 }
182 header("Location: themes.php?page=functions.php&reset=true");
183 die;
184 }
185 }
186 add_theme_page($themename. " Options", "Atahualpa Theme Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
187}
188
189function mytheme_admin() {
190 global $themename, $shortname, $options;
191 if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename. ' settings saved.</strong></p></div>';
192 if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename. ' settings reset.</strong></p></div>';
193?>
194<?php
195#
196$theme_name = "Atahualpa";
197$theme_version = "3.2";
198#
199$border_styles = array("solid", "dotted", "dashed", "double", "groove", "ridge", "inset", "outset");
200$background_repeat = array("vertic. and horiz.", "vertically", "horizontally", "don't repeat");
201$background_position = array("top left", "top center", "top right", "center left", "center center", "center right", "bottom left", "bottom center", "bottom right");
202$background_attachment = array("scroll", "fixed");
203$background_image_location = array("Remote: http://", "Local: /themes/atahualpa3/images/");
204$font_family = array("Tahoma", "Arial", "Calibri", "Cambria", "Candara", "Comic Sans MS", "Consolas", "Constantia", "Corbel", "Courier New", "Georgia", "Times New Roman", "Trebuchet MS", "Verdana");
205$font_family_backup = array("Tahoma, sans-serif", "Arial, sans-serif", "Calibri, sans-serif", "Cambria, serif", "Candara, sans-serif", "Comic Sans MS, sans-serif", "Consolas, sans-serif", "Constantia, serif", "Corbel, sans-serif", "Courier New, sans-serif", "Georgia, serif", "Times New Roman, serif", "Trebuchet MS, sans-serif", "Verdana, sans-serif");
206$font_size = array("0.5", "0.55", "0.6", "0.65", "0.7", "0.75", "0.8", "0.85", "0.9", "0.95", "1", "1.05", "1.1", "1.15", "1.2", "1.25", "1.3", "1.35", "1.4", "1.45", "1.5", "1.55", "1.6", "1.65", "1.7", "1.75", "1.8", "1.85", "1.9", "1.95", "2", "2.05", "2.1", "2.15", "2.2", "2.25", "2.3", "2.35", "2.4", "2.45", "2.5", "2.55", "2.6", "2.65", "2.7", "2.75", "2.8", "2.85", "2.9", "2.95", "3", "3.05", "3.1", "3.15", "3.2", "3.25", "3.3", "3.35", "3.4", "3.45", "3.5", "3.55", "3.6", "3.65", "3.7", "3.75", "3.8", "3.85", "3.9", "3.95", "4");
207$font_weight = array("normal", "bold");
208$font_style =array("normal", "italic");
209$text_align = array("left", "center", "right", "justify");
210$line_height = array("normal", "0.7", "0.75", "0.8", "0.85", "0.9", "0.95", "1", "1.05", "1.1", "1.15", "1.2", "1.25", "1.3", "1.35", "1.4", "1.45", "1.5", "1.55", "1.6", "1.65", "1.7", "1.75", "1.8", "1.85", "1.9", "1.95", "2");
211$text_transform = array("none", "capitalize", "uppercase", "lowercase");
212$text_decoration = array("none", "underline", "overline", "line-through");
213$url_base = get_bloginfo('template_directory');
214?>
215<table width="100%" cellpadding="2" cellspacing="0"><tr><td valign="middle" width="380"><h2 style="margin:0 30px 0 0; padding: 5px 0 5px 0;"><?php echo $theme_name; ?> Theme Options</h2></td><td valign="middle"><iframe src="http://wordpress.bytesforall.com/update.php?theme=<?php echo $theme_name; ?>&version=<?php echo $theme_version; ?>" width="98%" height="40" scrolling="no" frameborder="0"></iframe></td>
216</tr></table>
217<div class="wrap">
218<ul id="bfaoptiontabs" class="shadetabs">
219<li><a href="#" rel="start-here" class="selected">START</a></li>
220<li><a href="#" rel="seo">SEO</a></li>
221<li><a href="#" rel="body-font-links">Body, Text &amp; Links</a></li>
222<li><a href="#" rel="layout">Layout</a></li>
223<li><a href="#" rel="favicon">Favicon</a></li>
224<li><a href="#" rel="header">Header</a></li>
225<li><a href="#" rel="header-image">Header Image</a></li>
226<li><a href="#" rel="feed-links">RSS Settings</a></li>
227<li><a href="#" rel="page-menu-bar">Page Menu Bar</a></li>
228<li><a href="#" rel="cat-menu-bar">Category Menu Bar</a></li>
229<li><a href="#" rel="center">Center</a></li>
230<li><a href="#" rel="next-prev-nav">Next/Previous Navigation</a></li>
231<li><a href="#" rel="sidebars">Sidebars</a></li>
232<li><a href="#" rel="widgets">Widgets</a></li>
233<li><a href="#" rel="postinfos">Post/Page Info Items</a></li>
234<li><a href="#" rel="posts">Post/Page Styling</a></li>
235<li><a href="#" rel="posts-or-excerpts">Posts or Excerpts</a></li>
236<li><a href="#" rel="more-tag">"Read More" tag</a></li>
237<li><a href="#" rel="comments">Comments</a></li>
238<li><a href="#" rel="footer-style">Footer</a></li>
239<li><a href="#" rel="tables">Tables</a></li>
240<li><a href="#" rel="forms">Forms</a></li>
241<li><a href="#" rel="blockquotes">Blockquotes</a></li>
242<li><a href="#" rel="images">Images</a></li>
243<li><a href="#" rel="html-inserts">HTML/CSS Inserts</a></li>
244<li><a href="#" rel="archives-page">Archives Page</a></li>
245</ul>
246
247<div id="start-here" class="tabcontent"> <!-- opening the first tab content div, first option should be start-here, in the options array above //-->
248<?php foreach ($options as $value) { # start the options loop, check first, if we need to switch to another tab = option category
249
250# open/close category tab divs
251if ( $value['switch'] == "yes") {
252
253 echo "</div>\n<div id=\"" . $value['category'] . "\" class=\"tabcontent\">\n";
254
255 // all categories except first category "start-here" get an opening form tag. "start-here" has no value "switch" so no IF required here
256 echo '<form method="post">';
257
258}
259
260# extra info for some categories
261
262if($value['category'] == "postinfos" AND $value['switch'] == "yes") { ?>
263<div class="bfa-container">
264 <div class="bfa-container-full"><img src="<?php echo get_bloginfo('template_directory'); ?>/options/images/post-structure.gif" style="float: right; margin: 40px 0 15px 15px;">
265 <label for="Post Info Items">Post Info Items</label><br /><br />
266 Configure a <strong>Kicker</strong>, a <strong>Byline</strong> and a <strong>Footer</strong> for posts and pages by arranging these <strong>Post Info Items</strong>.
267 <br /><br />Some of these post info items have one or several <strong>parameters</strong>:
268<ul>
269 <li>You can leave parameters empty but do not remove their single quotes, even if the parameter is empty.</li>
270 <li>Replace the parameter <code>delimiter</code> with what you want to put between the list items of the tag or category list, i.e. a comma.</li>
271 <li>Replace the parameters <code>before</code> and <code>after</code> with what you want to display before or after that info item. If an item has these "before/after" parameters, use them instead of
272 hard coding text before and after that item: Example: Use <br /><code>%tags-linked('<i>Tags: </i>', '<i>, </i>', '<i> - </i>')%</code><br />instead of<br /><code>Tags: %tags-linked('', '<i>, </i>', '')% - </code></li>
273 <li>Replace the parameter <code>linktext</code> with the link text for that item.</li>
274</ul>
275HTML and <strong>icons</strong> can be used, inside of parameters, too, just not inside the date item:
276<ul>
277<li><code>&lt;image(someimage.gif)&gt;</code> to include an image. <em>Note: The image item doesn't have quotes</em></li>
278<li>To use your own images, upload them to /[theme-folder]/images/icons/</li>
279</ul>
280 <h3>Icons</h3>
281<strong>Currently available images (Once you uploaded yours they will be listed here):</strong><br /><br />
282<?php
283if ($handle = opendir( TEMPLATEPATH . '/images/icons/')) {
284 while (false !== ($file = readdir($handle))) {
285 if ($file != "." && $file != "..") {
286 $files[] = $file;
287 }
288 }
289 closedir($handle);
290}
291sort($files);
292foreach ($files as $key => $file) {
293 echo '<span style="float:left; width: 280px; margin-right: 10px; height: 22px;"><img src="' . get_bloginfo('template_directory') . '/images/icons/' . "$file" . '" /> &nbsp;<code>&lt;image(' . "$file" . ')&gt;</code></span>';
294}
295?>
296<div style="clear:left">&nbsp;</div>
297<h3>Examples</h3>
298Examples for <strong>Post Bylines</strong>:
299<ul>
300 <li><code>By %author%, on %date('<i>F jS, Y</i>')%</code></li>
301 <li><code>&lt;strong&gt;%author-linked%&lt;/strong&gt; posted this in &lt;strong&gt;%categories-linked('<i>, </i>')%&lt;/strong&gt; on &lt;em&gt;%date('<i>F jS, Y</i>')%&lt;/em&gt;</code></li>
302 <li><code>&lt;image(user.gif)&gt; %author-linked% &lt;image(date.gif)&gt; %date('<i>l, jS #of F Y #a#t h:i:s A</i>')%</code></li>
303 </ul>
304Examples for <strong>Post Footers</strong>:
305 <ul>
306 <li><code>%tags-linked('<i>&lt;strong&gt;Tags:&lt;/strong&gt; </i>', '<i>, </i>', '<i> &amp;mdash; </i>')% &lt;strong&gt;Categories:&lt;/strong&gt; %categories-linked('<i>, </i>')% &amp;mdash; %comments('<i>Nobody has commented yet, kick it off...</i>', '<i>One comment so far</i>', '<i>% people had their say - be the next!</i>', '<i>Sorry, but comments are closed</i>')% &amp;mdash;
307 %wp-print% &amp;mdash; %wp-email% &amp;mdash; %sociable% &amp;mdash; %wp-postviews%</code></li>
308 </ul>
309
310 <h3>Post Info Items</h3>
311 List of available post info items:
312<br /><h4>%author%</h4>
313Prints the name of the author of the post.
314<br /><h4>%author-linked%</h4>
315Prints the name of the author of the post, and links it to a page listing all posts by that author.
316<br /><h4>%date('F jS, Y')%</h4>
317Prints the date and/or time the post was published at. Many configuration options at <a href='http://www.php.net/date'>PHP Date</a>.
318Because most letters of the alphabet represent a certain date/time output function, you will have to <strong>escape</strong> each letter that you want to display LITERALLY, for instance, to
319include words like <strong>at</strong>, <strong>on</strong>, or <strong>the</strong> somewhere <strong>inside</strong> the date output. To <strong>escape</strong> a letter put a hash sign
320<strong>#</strong> right before that letter. (Please note that this is different from the original "PHP way" of escaping with backslashes <code>\</code>. The theme needs the hash sign <code>#</code>).
321That will tell the theme that you mean the actual letter and not the corresponding PHP date function.<br /><br />
322<strong>How to escape literal strings</strong>
323<ul><li>on -> <code>#o#n</code></li>
324<li>of -> <code>#of</code> &nbsp;&nbsp;(Note how the the lowercase <strong>f</strong> didn't get a <code>#</code>. That's because <strong>f</strong> is one of the letters of the alphabet that does not represent a PHP date function)</li>
325<li>at -> <code>#a#t</code></li>
326<li>the -> <code>#t#h#e</code></li>
327<li>The arrows just illustrate how to change a word to display it literally inside a date function, don't use them</li>
328</ul>
329<strong>Examples:</strong>
330 <ul>
331 <li><code>%date('<i>F j, Y, #a#t g:i a</i>')%</code> displays: December 10, 2008, at 5:16 pm <br />
332 Note how the letters <strong>a</strong> and <strong>t</strong> of the word <strong>at</strong> are <strong>escaped</strong> with <code>#</code>
333 to display them literally instead of interpreting them as PHP date functions.
334 </li>
335 <li><code>%date('<i>F j, Y, g:i a</i>')%</code> displays: December 10, 2008, 5:16 pm
336 </li>
337 <li><code>%date('<i>m.d.y</i>')%</code> displays: 10.12.08
338 </li>
339 </ul>
340<br /><h4>%category%</h4>
341Prints the name of the <strong>first</strong> category the post is filed under.
342<br /><h4>%category-linked%</h4>
343Prints the name of the <strong>first</strong> category the post is filed under and links the name to that category page.
344<br /><h4>%categories('delimiter')%</h4>
345Prints the names of <strong>all</strong> categories the post is filed under, separated by delimiter.
346<br /><strong>Example:</strong> <code>%categories('<i>, </i>')%</code>
347<br /><h4>%categories-linked('delimiter')%</h4>
348Prints the names of <strong>all</strong> categories the post is filed under, separated by delimiter, and links each name to the respective category page.
349<br /><strong>Example:</strong> <code>%categories-linked('<i> | </i>')%</code>
350<br /><h4>%tags('before', 'delimiter', 'after')%</h4>
351Prints the names of all tags attached to the post, separated by delimiter.
352<br /><strong>Example:</strong> <code>%tags('<i>Tags: </i>', '<i>, </i>', '')%</code>
353<br /><h4>%tags-linked('before', 'delimiter', 'after')%</h4>
354Prints the names of all tags attached to the post, separated by delimiter, and links each name to the respective tag page.
355<br /><strong>Example:</strong> <code>%tags-linked('<i>Tagged with: </i>', '<i> - </i>', '<i>. </i>')%</code>
356<br /><h4>%comments('No comments', '1 comment', '% comments', 'Comments closed')%</h4>
357Prints a link to the comment section of the post. The link text depends on the comment count & status (open/closed).
358<br /><br /><strong>When using this item, provide 4 text strings for the 4 possible comment states:</strong> <ul>
359<li>Replace <code>'No Comments'</code> with your link text for posts that have no comments yet</li>
360<li>Replace <code>'1 comment'</code> with your text for posts with 1 comment</li>
361<li>Replace <code>'% comments'</code> with your text for posts with 2 or more comments. The <code>%</code> (percent) character
362will be replaced with the comment count. Use that character in your own text, too, unless you do not want to display the comment count.</li>
363<li>Replace <code>'Comments closed'</code> with your text for posts where comments are closed.</li>
364</ul>
365<br /><strong>Example:</strong> <code>%comments('<i>Leave your comment</i>', '<i>One comment so far</i>', '<i>% people had their say - chime in!</i>', '<i>Sorry, but comments are closed</i>')%</code>
366<br /><h4>%comments-rss('linktext')%</h4>
367Prints a link to the RSS feed of the post's comments, with <em>linktext</em> as the link text.
368<br /><strong>Example:</strong> <code>%comments-rss('<i>Subscribe to the comments of this post</i>')%</code>
369<br /><h4>%trackback%</h4>
370Prints the trackback URL of the post, without linking it.
371<br /><h4>%trackback-linked('linktext')%</h4>
372Prints a link to the trackback URL of the post, with <em>linktext</em> as the link text.
373<br /><strong>Example:</strong> <code>%trackback-linked('<i>Trackback this Post</i>')%</code>
374<br /><h4>%print('linktext')%</h4>
375Prints a link with <em>linktext</em> as the link text, which, when clicked, will start printing the content of the center column of the current page, without header, sidebars and footer.
376<br /><strong>Example:</strong> <code>%print('<i>Print this Page</i>')%</code>
377<br /><h4>%edit('before', 'linktext', 'after')%</h4>
378Prints a direct edit link for the post, IF the current viewer is permitted to edit posts, with <em>linktext</em> as the link text.
379<br /><strong>Example:</strong> <code>%edit('<i> - </i>', '<i>Edit This Post</i>', '')%</code>
380<br /><h4>%wp-print%</h4>
381Prints a link to a print preview page of the post. A configurable alternative to the theme's own basic print function (which prints right away, without preview page).<br />
382<?php echo ( function_exists('wp_print') ?
383'Customize the output at the <a title="If this link doesn\'t work, go to \'Settings\' (top right) -> \'Print\'"
384href="options-general.php?page=wp-print/print-options.php">WP-Print Options Page</a>.' :
385'To use this item, you must first install (= upload) and activate the plugin "<a href="http://wordpress.org/extend/plugins/wp-print/">WP-Print</a>"' ); ?>
386<br /><h4>%wp-email%</h4>
387Prints a link to a form where visitors can e-mail the post to others.<br />
388<?php echo ( function_exists('wp_email') ?
389'Customize the output at the <a title="If this link doesn\'t work, click on \'E-Mail\' at the top of the current page, then \'E-Mail Options\'"
390href="admin.php?page=wp-email/email-options.php">WP-Email Options Page</a>.<br />
391<strong>Settings:</strong> <ul><li>Change settings in the section "E-Mail Styles" to customize the output of this item</li>
392<li>Make other changes as you see fit</li>
393<li>Click "Save Changes"</li></ul>' :
394'To use this item, you must first install (= upload) and activate the plugin "<a href="http://wordpress.org/extend/plugins/wp-email/">WP-Email</a>"' ); ?>
395<br /><h4>%wp-postviews%</h4>
396Prints how many times the post was viewed.<br />
397<?php echo ( function_exists('the_views') ?
398'Customize the output at the <a title="If this link doesn\'t work, go to \'Settings\' (top right) -> \'Post Views\'"
399href="options-general.php?page=wp-postviews/postviews-options.php">WP-PostViews Options Page</a>.<br />
400<strong>Settings:</strong> <ul><li>Change "Views Template" to customize the output of this item</li>
401<li>Make other changes as you see fit</li>
402<li>Click "Save Changes"</li></ul>' :
403'To use this item, you must first install (= upload) and activate the plugin "<a href="http://wordpress.org/extend/plugins/wp-postviews/">WP-PostViews</a>"' ); ?>
404<br /><h4>%wp-postratings%</h4>
405Prints stars or other graphics showing the vote/rating of a post, and lets visitors rate the post.<br />
406<?php echo ( function_exists('the_ratings') ?
407'Customize the output at the <a title="If this link doesn\'t work, click on \'Ratings\' at the top of the current page"
408href="admin.php?page=wp-postratings/postratings-templates.php">WP-PostRatings Options Page</a>.<br />
409<strong>Settings:</strong> <ul><li>Delete <code>%RATINGS_TEXT%</code> from the bottom of the textarea named "Ratings Vote Text:"</li>
410<li>Delete <code>%RATINGS_TEXT%</code> from the bottom of the textarea named "Ratings None:"</li>
411<li>Make other changes as you see fit</li>
412<li>Click "Save Changes"</li></ul>' :
413'To use this item, you must first install (= upload) and activate the plugin "<a href="http://wordpress.org/extend/plugins/wp-postratings/">WP-PostRatings</a>"' ); ?>
414<br /><h4>%sociable%</h4>
415Prints little icons, linking the post to social bookmark sites.<br />
416<?php echo ( function_exists('sociable_html') ?
417'Customize the output at the <a title="If this link doesn\'t work, go to \'Settings\' (top right) -> \'Sociable\'"
418href="options-general.php?page=Sociable">Sociable Options Page</a>.<br />
419<strong>Settings:</strong> <ul><li>"Tagline:" - Will be ignored</li><li>"Position:" - Uncheck all boxes</li><li>"Use CSS:" - Uncheck this</li>
420<li>"Open in new window:" - Check or uncheck, will be used</li><li>Click "Save Changes"</li></ul>' :
421'To use this item, you must first install (= upload) and activate the plugin "<a href="http://wordpress.org/extend/plugins/sociable/">Sociable</a>"' ); ?>
422 </div>
423</div>
424<?php }
425#####################################################################
426# TEXT
427#####################################################################
428if ($value['type'] == "text") { ?>
429<div class="bfa-container">
430 <div class="bfa-container-left"><label for="<?php echo $value['name']; ?>"><?php echo $value['name']; ?></label><br />
431 <input <?php if ($value['size'] != "") { echo "size=" . $value['size'] . ($value['size'] > 20 ? " style=\"width: 95%;\"" : " "); } ?><?php
432 if (eregi("color", $value['id'])) { ?>class="color" <?php } ?>name="<?php echo $value['id']; ?>" id="<?php
433 echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php
434 if ( get_option( $value['id'] ) !== FALSE) {
435 echo ( $value['editable'] == "yes" ? stripslashes(format_to_edit(get_option( $value['id'] ))) : get_option( $value['id'] ) );
436 } else {
437 echo ( $value['editable'] == "yes" ? stripslashes(format_to_edit($value['std'])) : $value['std'] );
438 }
439 ?>" />
440 <br />Default: <strong>
441 <?php if ($value['std'] == "") {
442 echo "blank";
443 } else {
444 echo ( $value['editable'] == "yes" ? stripslashes(format_to_edit($value['std'])) : $value['std'] ); } ?></strong>
445 </div>
446 <div class="bfa-container-right">
447 <?php echo $value['info']; ?>
448 </div>
449 <div style="clear:both"></div>
450</div>
451<?php }
452#####################################################################
453# WIDGET LIST ITEMS
454#####################################################################
455elseif ($value['type'] == "widget-list-items") {
456# needed for multi array options
457$current_options = get_option( $value['id']);
458?>
459<div class="bfa-container">
460<div class="bfa-container-full">
461<label for="<?php echo $value['name']; ?>"><?php echo $value['name']; ?></label>
462<br />
463<br />
464<?php echo $value['info']; ?>
465<br />
466<br />
467<table class="bfa-optiontable" border="0" cellspacing="0">
468 <thead>
469 <tr><td colspan="8">List items and links inside</td></tr>
470 </thead>
471<tbody>
472 <tr><td>Left Margin for whole Item</td><td>Left Border Width for Links</td><td>Left Border Color for Links</td><td>Left Border Hover Color for Links</td><td>Left Padding for Links</td><td>Link Text Weight</td><td>Link Text Color</td><td>Link Text Hover Color</td></tr>
473 <tr>
474 <td>
475 <select name="<?php echo $value['id'] . '[li-margin-left]'; ?>" id="<?php echo $value['id'] . '[li-margin-left]'; ?>">
476 <?php for ($i = 0; $i <= 20; $i++) { ?>
477 <option<?php if ( $current_options['li-margin-left'] == $i) { echo ' selected="selected"'; } elseif ( !isset($current_options['li-margin-left']) AND $i == $value['std']['li-margin-left']) { echo ' selected="selected"'; } ?>><?php echo $i; ?></option>
478 <?php } ?>
479 </select>
480 </td>
481 <td>
482 <select name="<?php echo $value['id'] . '[link-border-left-width]'; ?>" id="<?php echo $value['id'] . '[link-border-left-width]'; ?>">
483 <?php for ($i = 0; $i <= 20; $i++) { ?>
484 <option<?php if ( $current_options['link-border-left-width'] == $i) { echo ' selected="selected"'; } elseif ( !isset($current_options['link-border-left-width']) AND $i == $value['std']['link-border-left-width']) { echo ' selected="selected"'; } ?>><?php echo $i; ?></option>
485 <?php } ?>
486 </select>
487 </td>
488 <td>
489 <input size="8" class="color" name="<?php echo $value['id'] . '[link-border-left-color]'; ?>" id="<?php echo $value['id'] . '[link-border-left-color]'; ?>" type="text" value="<?php if ( $current_options['link-border-left-color'] != "") { echo $current_options['link-border-left-color'] ; } else { echo $value['std']['link-border-left-color']; } ?>" />
490 </td>
491 <td>
492 <input size="8" class="color" name="<?php echo $value['id'] . '[link-border-left-hover-color]'; ?>" id="<?php echo $value['id'] . '[link-border-left-hover-color]'; ?>" type="text" value="<?php if ( $current_options['link-border-left-hover-color'] != "") { echo $current_options['link-border-left-hover-color'] ; } else { echo $value['std']['link-border-left-hover-color']; } ?>" />
493 </td>
494 <td>
495 <select name="<?php echo $value['id'] . '[link-padding-left]'; ?>" id="<?php echo $value['id'] . '[link-padding-left]'; ?>">
496 <?php for ($i = 0; $i <= 20; $i++) { ?>
497 <option<?php if ( $current_options['link-padding-left'] == $i) { echo ' selected="selected"'; } elseif ( !isset($current_options['link-padding-left']) AND $i == $value['std']['link-padding-left']) { echo ' selected="selected"'; } ?>><?php echo $i; ?></option>
498 <?php } ?>
499 </select>
500 </td>
501 <td>
502 <select name="<?php echo $value['id'] . '[link-weight]'; ?>" id="<?php echo $value['id'] . '[link-weight]'; ?>">
503 <?php foreach ($font_weight as $option) { ?>
504 <option<?php if ( $current_options['link-weight'] == $option) { echo ' selected="selected"'; } elseif ( !isset($current_options['link-weight']) AND $option == $value['std']['link-weight']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
505 <?php } ?>
506 </select>
507 </td>
508 <td>
509 <input size="8" class="color" name="<?php echo $value['id'] . '[link-color]'; ?>" id="<?php echo $value['id'] . '[link-color]'; ?>" type="text" value="<?php if ( $current_options['link-color'] != "") { echo $current_options['link-color'] ; } else { echo $value['std']['link-color']; } ?>" />
510 </td>
511 <td>
512 <input size="8" class="color" name="<?php echo $value['id'] . '[link-hover-color]'; ?>" id="<?php echo $value['id'] . '[link-hover-color]'; ?>" type="text" value="<?php if ( $current_options['link-hover-color'] != "") { echo $current_options['link-hover-color'] ; } else { echo $value['std']['link-hover-color']; } ?>" />
513 </td>
514 </tr>
515</tbody>
516</table>
517<div style="clear:both"></div>
518</div>
519</div>
520<?php }
521#####################################################################
522# DISPLAY ON
523#####################################################################
524elseif ($value['type'] == "displayon") {
525# special for checkboxes, if checkbox is unchecked then there won't be any key/value pair for that checkbox in the options table.
526if (get_option( $value['id'] ) === FALSE) { $current_options = $value['std']; } else { $current_options = get_option( $value['id'] ); }
527
528echo '<div class="bfa-container">
529<div class="bfa-container-left"><label for="' . $value['name'] . '">' . $value['name'] . '</label><br /><br />
530<table align="right" class="bfa-optiontable" border="0" cellspacing="0" cellpadding="2">
531<tbody><tr><td>
532<input type="checkbox" name="' . $value['id'] . '[homepage]" ' . ($current_options['homepage'] ? 'checked="checked"' : '' ) . ' /> Homepage<br />
533<input type="checkbox" name="' . $value['id'] . '[frontpage]" ' . ($current_options['frontpage'] ? 'checked="checked"' : '' ) . ' /> Front Page (*)<br />
534<input type="checkbox" name="' . $value['id'] . '[single]" ' . ($current_options['single'] ? 'checked="checked"' : '' ) . ' /> Single Posts<br />
535<input type="checkbox" name="' . $value['id'] . '[page]" ' . ($current_options['page'] ? 'checked="checked"' : '' ) . ' /> "Page" pages<br />
536</td><td>
537<input type="checkbox" name="' . $value['id'] . '[category]" ' . ($current_options['category'] ? 'checked="checked"' : '' ) . ' /> Category Pages<br />
538<input type="checkbox" name="' . $value['id'] . '[date]" ' . ($current_options['date'] ? 'checked="checked"' : '' ) . ' /> Archive Pages<br />
539<input type="checkbox" name="' . $value['id'] . '[tag]" ' . ($current_options['tag'] ? 'checked="checked"' : '' ) . ' /> Tag Pages<br />
540<input type="checkbox" name="' . $value['id'] . '[search]" ' . ($current_options['search'] ? 'checked="checked"' : '' ) . ' /> Search Results<br />
541</td><td valign="top">
542<input type="checkbox" name="' . $value['id'] . '[author]" ' . ($current_options['author'] ? 'checked="checked"' : '' ) . ' /> Author Pages<br />
543<input type="checkbox" name="' . $value['id'] . '[404]" ' . ($current_options['404'] ? 'checked="checked"' : '' ) . ' /> "Not Found"<br />
544<input type="checkbox" name="' . $value['id'] . '[attachment]" ' . ($current_options['attachment'] ? 'checked="checked"' : '' ) . ' /> Attachments<br />
545<input type="hidden" name="' . $value['id'] . '[check-if-saved-once]" value="saved">
546</td></tr></tbody>
547</table>
548</div><div class="bfa-container-right">' . $value['info'] . '
549</div><div style="clear:both"></div></div>';
550}
551#####################################################################
552# TEXTAREA
553#####################################################################
554elseif ($value['type'] == "textarea") { ?>
555<div class="bfa-container">
556 <div class="bfa-container-left"><label for="<?php echo $value['name']; ?>"><?php echo $value['name']; ?></label><br />
557 <textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" cols="35" style="width: 95%" rows="6"><?php if ( get_option( $value['id'] ) !== FALSE) { echo ( $value['editable'] == "yes" ? stripslashes(format_to_edit(get_option( $value['id'] ))) : get_option( $value['id'] ) ) ; } else { echo ( $value['editable'] == "yes" ? stripslashes(format_to_edit($value['std'])) : $value['std'] ); } ?></textarea>
558 <br />Default: <strong><?php if ($value['std'] == "") { echo "blank"; } else { echo "<br /><code>" . ( $value['editable'] == "yes" ? str_replace("\n", "<br />", htmlentities($value['std'], ENT_QUOTES)) : str_replace("\n", "<br />", $value['std']) ) . "</code>"; } ?></strong>
559 </div>
560 <div class="bfa-container-right">
561 <?php echo $value['info']; ?>
562 </div>
563 <div style="clear:both"></div>
564</div>
565<?php }
566#####################################################################
567# POSTINFOS
568#####################################################################
569elseif ($value['type'] == "postinfos") { ?>
570<div class="bfa-container">
571 <div class="bfa-container-full"><label for="<?php echo $value['name']; ?>"><?php echo $value['name']; ?></label><br />
572 <?php echo $value['info']; ?><br />
573 <textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" cols="110" rows="3"><?php if ( get_option( $value['id'] ) !== FALSE) { echo format_to_edit(get_option( $value['id'] )); } else { echo format_to_edit($value['std']); } ?></textarea>
574 <br />Default: <strong><?php if ($value['std'] == "") { echo "blank"; } else { echo format_to_edit($value['std']); } ?></strong>
575 </div>
576</div>
577<?php }
578#####################################################################
579# INFO
580#####################################################################
581elseif ($value['type'] == "info") { ?>
582<div class="bfa-container">
583 <div class="bfa-container-full"><label for="<?php echo $value['name']; ?>"><?php echo $value['name']; ?></label><br />
584 <?php echo $value['info']; ?>
585 </div>
586</div>
587<?php }
588#####################################################################
589# SELECT
590#####################################################################
591elseif ($value['type'] == "select") { ?>
592<div class="bfa-container">
593 <div class="bfa-container-left"><label for="<?php echo $value['name']; ?>"><?php echo $value['name']; ?></label><br />
594 <select name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
595 <?php foreach ($value['options'] as $option) { ?>
596 <option<?php if ( get_option( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ( get_option( $value['id']) === FALSE AND $option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
597 <?php } ?>
598 </select>
599 <br />Default: <strong><?php if ($value['std'] == "") { echo "blank"; } else { echo $value['std']; } ?></strong>
600 </div>
601 <div class="bfa-container-right">
602 <?php echo $value['info']; ?>
603 </div>
604 <div style="clear:both"></div>
605</div>
606<?php
607}
608
609 // all categories except first category "start-here" get closing form tags and buttons
610 if ( $value['category'] != "start-here" AND $value['lastoption'] == "yes" ) { ?>
611 <div class="bfa-container">
612 <p class="submit">
613 <input class="save-tab" name="save" type="submit" value="Save changes" />
614 <input type="hidden" name="action" value="save" />
615 <input type="hidden" name="category" value="<?php echo $value['category']; ?>" />
616 <br /><strong>Save settings of current page</strong>
617 </p><br />
618 </form>
619 <form method="post">
620 <p class="submit">
621 <input class="reset-tab" name="reset" type="submit" value="Reset settings" />
622 <input type="hidden" name="action" value="reset" />
623 <input type="hidden" name="category" value="<?php echo $value['category']; ?>" />
624 <br /><strong>Reset settings of current page</strong>
625 </p>
626 </form>
627 </div>
628 <?php }
629
630} // options loop END
631?>
632</div> <!-- closing the last tab content div //-->
633<script type="text/javascript">
634var myflowers=new ddtabcontent("bfaoptiontabs") //enter ID of Tab Container
635myflowers.setpersist(true) //toogle persistence of the tabs' state
636myflowers.setselectedClassTarget("link") //"link" or "linkparent"
637myflowers.init()
638</script>
639<!-- "reset all" button -->
640<br /><br />
641 <form method="post">
642 <p class="submit">
643 <input class="reset-all" name="reset" type="submit" value="Reset ALL theme options" onClick="return confirmSubmit()"/>
644 <input type="hidden" name="action" value="reset" />
645 <input type="hidden" name="category" value="reset-all" /><br />
646 <span style="color: #c00;"><strong>WARNING</strong> - this will reset ALL 200+ theme options!</span><br />Clicking this button will...<br />
647 (1) remove all Atahualpa options from the WordPress options table<br />
648 (2) reset all Atahualpa options to the default values<br />
649
650 </p>
651
652 </form>
653</div><!-- / class=wrap -->
654<?php
655}
656add_action('admin_menu', 'mytheme_add_admin');
657?>
658<?php
659function footer_output($footer_content) {
660$footer_content .= '<br />Powered by <a href="http://www.wordpress.org/">WordPress</a> &middot; <a href="http://wordpress.bytesforall.com/" title="WP Themes">Atahualpa Theme</a> by <a href="http://www.bytesforall.com/" title="Custom WordPress Themes &amp; Web Design">BytesForAll</a>';
661return $footer_content;
662}
663?>
664<?php
665function special_char_import($string) {
666$special_placeholders = array("<b>", "</b>", "<i>", "</i>", "<br>", "<raquo>", "<laquo>", "<rsaquo>", "<lsaquo>", "<rarr>", "<larr>", "<s>");
667$html_replacement = array("<strong>", "</strong>", "<em>", "</em>", "<br />", "&raquo;", "&laquo;", "&rsaquo;", "&lsaquo;", "&rarr;", "&larr;", "&nbsp;");
668$string = str_replace($special_placeholders, $html_replacement, $string);
669return $string;
670}
671?>
672<?php
673// new comment template for WP 2.7+, legacy template for old WP 2.6 and older
674if (!function_exists('paged_comments')) {
675add_filter('comments_template', 'legacy_comments');
676function legacy_comments($file) {
677 if(!function_exists('wp_list_comments')) $file = TEMPLATEPATH . '/legacy.comments.php';
678 return $file;
679}
680}
681?>
682<?php
683// see if several pages exist to avoid empty next/prev navigation on multi post pages
684function show_posts_nav() {
685 global $wp_query;
686 return ($wp_query->max_num_pages > 1) ? TRUE : FALSE;
687}
688?>
Note: See TracBrowser for help on using the repository browser.