Advertisement
Guest User

Maggi

a guest
Feb 12th, 2011
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.55 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. $ThemeName = "Arthemia Premium";
  4.  
  5. // WP 2.7 vs WP 2.6 comment compatibility
  6. add_filter('comments_template', 'legacy_comments');
  7. function legacy_comments($file) {
  8. if(!function_exists('wp_list_comments')) : // WP 2.7-only check
  9. $file = TEMPLATEPATH . '/legacy.comments.php';
  10. endif;
  11. return $file;
  12. }
  13.  
  14. // sidebar stuff
  15. if ( function_exists('register_sidebar') )
  16. {
  17. register_sidebar(array('name' => 'Sidebar Top','before_widget' => '<div id="%1$s" class="%2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  18. register_sidebar(array('name' => 'Sidebar Left','before_widget' => '<div id="%1$s" class="%2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  19. register_sidebar(array('name' => 'Sidebar Right','before_widget' => '<div id="%1$s" class="%2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  20. register_sidebar(array('name' => 'Sidebar Bottom','before_widget' => '<div id="%1$s" class="%2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  21. register_sidebar(array('name' => 'Footer Left','before_widget' => '<div id="%1$s" class="%2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  22. register_sidebar(array('name' => 'Footer Center','before_widget' => '<div id="%1$s" class="%2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  23. register_sidebar(array('name' => 'Footer Right','before_widget' => '<div id="%1$s" class="%2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
  24. }
  25.  
  26. // WP bug workaround to get W3C compliant
  27. remove_filter('term_description','wpautop');
  28.  
  29.  
  30. // excerpt
  31. remove_filter('get_the_excerpt', 'wp_trim_excerpt');
  32. add_filter('get_the_excerpt', 'custom_trim_excerpt');
  33.  
  34. function custom_trim_excerpt($text) { // Fakes an excerpt if needed
  35. global $post;
  36. if ( '' == $text ) {
  37. $text = get_the_content('');
  38.  
  39. $text = strip_shortcodes( $text );
  40.  
  41. $text = apply_filters('the_content', $text);
  42. $text = str_replace(']]>', ']]&gt;', $text);
  43. $text = strip_tags($text);
  44. $excerpt_length = apply_filters('excerpt_length', 35);
  45. $words = explode(' ', $text, $excerpt_length + 1);
  46. if (count($words) > $excerpt_length) {
  47. array_pop($words);
  48. array_push($words, '...');
  49. $text = implode(' ', $words);
  50. }
  51. }
  52. return $text;
  53. }
  54.  
  55. // manual timthumb
  56. function timthumb($atts) {
  57.  
  58. //Check if custom field key "Image" has a value
  59. $values = get_post_custom_values("Image");
  60.  
  61. extract(shortcode_atts(array(
  62. "width" => '150',
  63. "height" => '150',
  64. "quality" => '90',
  65. "orientation" => 'left'
  66. ), $atts));
  67.  
  68. $home = get_option('home');
  69. $images = $values[0];
  70. $bloginfo = get_bloginfo('template_url');
  71. $alt = the_title("","",false);
  72.  
  73. if (isset($values[0])) {
  74. $thumb .= '<img src="'.$bloginfo.'/scripts/timthumb.php?src='.$home.'/'.$images.'&amp;w='.$width.'&amp;h='.$height.'&amp;zc=1&amp;q='.$quality.'" width="'.$width.'px" height="'.$height.'px" class="'.$orientation.'" alt="'.$alt.'" />';
  75. }
  76.  
  77. return $thumb;
  78.  
  79. }
  80.  
  81. add_shortcode("thumb", "timthumb");
  82.  
  83.  
  84. // offset and pagination
  85. function my_post_limit($limit) {
  86. global $paged, $myOffset;
  87. if (empty($paged)) {
  88. $paged = 1;
  89. }
  90. $postperpage = intval(get_option('posts_per_page'));
  91. $pgstrt = ((intval($paged) -1) * $postperpage) + $myOffset . ', ';
  92. $limit = 'LIMIT '.$pgstrt.$postperpage;
  93. return $limit;
  94. }
  95.  
  96.  
  97. // admin panel
  98. function cp_input( $var, $type, $description = "", $value = "", $selected="", $onchange="" ) {
  99.  
  100. echo "\n";
  101.  
  102. switch( $type ){
  103.  
  104. case "text":
  105.  
  106. echo "<input name=\"$var\" id=\"$var\" type=\"$type\" style=\"width: 80%\" class=\"code\" value=\"$value\" onchange=\"$onchange\"/>";
  107. echo "<p style=\"font-size:0.9em; color:#999; margin:0;\">$description</p>";
  108.  
  109. break;
  110.  
  111. case "smalltext":
  112.  
  113. echo "<input name=\"$var\" id=\"$var\" type=\"$type\" style=\"width: 30%\" class=\"code\" value=\"$value\" onchange=\"$onchange\"/>";
  114. echo "<span style=\"font-size:0.9em; color:#999; margin:0; padding-left:5px; \">$description</span><br />";
  115.  
  116. break;
  117.  
  118. case "submit":
  119.  
  120. echo "<p class=\"submit\" align=\"right\"><input name=\"$var\" type=\"$type\" value=\"$value\" /></p>";
  121.  
  122. break;
  123.  
  124. case "option":
  125.  
  126. if( $selected == $value ) { $extra = "selected=\"true\""; }
  127.  
  128. echo "<option value=\"$value\" $extra >$description</option>";
  129.  
  130. break;
  131.  
  132. case "radio":
  133.  
  134. if( $selected == $value ) { $extra = "checked=\"true\""; }
  135.  
  136. echo "<label><input name=\"$var\" id=\"$var\" type=\"$type\" value=\"$value\" $extra /> $description</label><br/>";
  137.  
  138. break;
  139.  
  140. case "checkbox":
  141.  
  142. if( $selected == $value ) { $extra = "checked=\"true\""; }
  143.  
  144. echo "<label><input name=\"$var\" id=\"$var\" type=\"$type\" value=\"$value\" $extra /> $description</label><br/>";
  145.  
  146. break;
  147.  
  148. case "textarea":
  149.  
  150. echo "<textarea name=\"$var\" id=\"$var\" style=\"width: 60%; height: 10em;\" class=\"code\">$value</textarea>";
  151.  
  152. break;
  153. }
  154.  
  155. }
  156.  
  157. function cp_select( $var, $arrValues, $selected, $label ) {
  158.  
  159. if( $label != "" ) {
  160. echo "<label for=\"$var\">$label</label>";
  161. }
  162.  
  163. echo "<select name=\"$var\" id=\"$var\">\n";
  164.  
  165. forEach( $arrValues as $arr ) {
  166.  
  167. $extra = "";
  168. if( $selected == $arr[ 0 ] ) { $extra = " selected=\"true\""; }
  169.  
  170. echo "<option value=\"" . $arr[ 0 ] . "\"$extra>" . $arr[ 1 ] . "</option>\n";
  171.  
  172. }
  173.  
  174. echo "</select>";
  175.  
  176. }
  177.  
  178. function cp_multiSelect( $var, $arrValues, $arrSelected, $label, $description ) {
  179.  
  180. if( $label != "" ) {
  181. echo "<label for=\"$var\">$label</label>";
  182. }
  183.  
  184. echo "<select multiple=\"true\" size=\"7\" name=\"$var\" id=\"$var\" style=\"height:150px;\">\n";
  185.  
  186. forEach( $arrValues as $arr ) {
  187.  
  188. $extra = "";
  189. if( in_array( $arr[ 0 ], $arrSelected ) ) { $extra = " selected=\"true\""; }
  190.  
  191. echo "<option value=\"" . $arr[ 0 ] . "\"$extra>" . $arr[ 1 ] . "</option>\n";
  192.  
  193. }
  194.  
  195. echo "</select>";
  196.  
  197. echo "<p style=\"font-size:0.9em; color:#999; margin:0;\">$description</p>";
  198.  
  199. }
  200.  
  201. function cp_th( $title ) {
  202.  
  203. echo "<tr valign=\"top\">";
  204. echo "<th width=\"63%\" scope=\"row\">$title</th>";
  205. echo "<td>";
  206.  
  207. }
  208.  
  209. function cp_cth() {
  210.  
  211. echo "</td>";
  212. echo "</tr>";
  213.  
  214. }
  215.  
  216.  
  217. // Theme Administration Panel
  218.  
  219. function cp_addThemePage() {
  220.  
  221. global $ThemeName;
  222.  
  223. if ( $_GET['page'] == basename(__FILE__) ) {
  224.  
  225. // save settings
  226. if ( 'save' == $_REQUEST['action'] ) {
  227.  
  228. check_admin_referer( 'save-theme-properties' );
  229.  
  230. // text input
  231. update_option( 'cp_feedlinkURL', $_REQUEST[ 'cp_feedlinkURL' ] );
  232. update_option( 'cp_feedlinkComments', $_REQUEST[ 'cp_feedlinkComments' ] );
  233. update_option( 'cp_analytics', $_REQUEST[ 'cp_analytics' ] );
  234. update_option( 'ar_headline', $_REQUEST[ 'ar_headline' ] );
  235. update_option( 'ar_featured', $_REQUEST[ 'ar_featured' ] );
  236. update_option( 'ar_video', $_REQUEST[ 'ar_video' ] );
  237. update_option( 'ar_categories', $_REQUEST[ 'ar_categories'] );
  238. update_option( 'ar_spoilers', $_REQUEST[ 'ar_spoilers' ] );
  239.  
  240. update_option( 'cp_thumbAuto', $_REQUEST[ 'cp_thumbAuto' ] );
  241. update_option( 'cp_styleHead', $_REQUEST[ 'cp_styleHead' ] );
  242. update_option( 'cp_numFeatured', $_REQUEST[ 'cp_numFeatured' ] );
  243. update_option( 'cp_autoScroll', $_REQUEST[ 'cp_autoScroll' ] );
  244. update_option( 'cp_ScrollSpeed', $_REQUEST[ 'cp_ScrollSpeed' ] );
  245. update_option( 'cp_preventHeadline', $_REQUEST[ 'cp_preventHeadline' ] );
  246. update_option( 'cp_preventLatest', $_REQUEST[ 'cp_preventLatest' ] );
  247.  
  248. update_option( 'cp_thumbHeight_LatestPost', $_REQUEST[ 'cp_thumbHeight_LatestPost' ] );
  249. update_option( 'cp_thumbWidth_LatestPost', $_REQUEST[ 'cp_thumbWidth_LatestPost' ] );
  250.  
  251. update_option( 'cp_status_Column', $_REQUEST[ 'cp_status_Column' ] );
  252. update_option( 'cp_thumbHeight_Column', $_REQUEST[ 'cp_thumbHeight_Column' ] );
  253. update_option( 'cp_thumbWidth_Column', $_REQUEST[ 'cp_thumbWidth_Column' ] );
  254. update_option( 'cp_excerptColumn', $_REQUEST[ 'cp_excerptColumn' ] );
  255.  
  256. update_option( 'cp_thumbWidth_Spoilers', $_REQUEST[ 'cp_thumbWidth_Spoilers' ] );
  257. update_option( 'cp_thumbHeight_Spoilers', $_REQUEST[ 'cp_thumbHeight_Spoilers' ] );
  258. update_option( 'cp_excerptSpoilers', $_REQUEST[ 'cp_excerptSpoilers' ] );
  259. update_option( 'cp_catSpoilers', $_REQUEST[ 'cp_catSpoilers' ] );
  260.  
  261. update_option( 'cp_showindexcatbar', $_POST[ 'cp_showindexcatbar' ] );
  262. update_option( 'cp_showindexgallery', $_POST[ 'cp_showindexgallery' ] );
  263.  
  264. update_option( 'cp_thumbHeight_Post', $_REQUEST[ 'cp_thumbHeight_Post' ] );
  265. update_option( 'cp_thumbWidth_Post', $_REQUEST[ 'cp_thumbWidth_Post' ] );
  266. update_option( 'cp_postThumb', $_POST[ 'cp_postThumb' ] );
  267. update_option( 'cp_showpostcatbar', $_POST[ 'cp_showpostcatbar' ] );
  268. update_option( 'cp_showpostheadline', $_POST[ 'cp_showpostheadline' ] );
  269. update_option( 'cp_showpostgallery', $_POST[ 'cp_showpostgallery' ] );
  270.  
  271. update_option( 'cp_thumbWidth_Archive', $_REQUEST[ 'cp_thumbWidth_Archive' ] );
  272. update_option( 'cp_thumbHeight_Archive', $_REQUEST[ 'cp_thumbHeight_Archive' ] );
  273. update_option( 'cp_showarchivecatbar', $_POST[ 'cp_showarchivecatbar' ] );
  274. update_option( 'cp_showarchiveheadline', $_POST[ 'cp_showarchiveheadline' ] );
  275. update_option( 'cp_showarchivegallery', $_POST[ 'cp_showarchivegallery' ] );
  276.  
  277.  
  278. update_option( 'cp_catColor', $_REQUEST[ 'cp_catColor' ] );
  279. $cp_categories = get_categories('hide_empty=0');
  280. $cp_numCats = 0;
  281. foreach ( $cp_categories as $b ) {
  282. $cp_numCats ++; }
  283.  
  284. for( $cp_x = 1; $cp_x <= $cp_numCats; $cp_x ++ ) {
  285. update_option( 'cp_colorCategory_' . $cp_x, $_REQUEST[ 'cp_colorCategory_' . $cp_x ] );
  286. update_option( 'cp_hexColor_' . $cp_x, $_REQUEST[ 'cp_hexColor_' . $cp_x ] );
  287. update_option( 'cp_textColor_' . $cp_x, $_REQUEST[ 'cp_textColor_' . $cp_x ] );
  288. update_option( 'cp_hoverColor_' . $cp_x, $_REQUEST[ 'cp_hoverColor_' . $cp_x ] );
  289. }
  290.  
  291. update_option( 'cp_adImage_1', $_REQUEST[ 'cp_adImage_1' ] );
  292. update_option( 'cp_adURL_1', $_REQUEST[ 'cp_adURL_1' ] );
  293. update_option( 'cp_adImage_2', $_REQUEST[ 'cp_adImage_2' ] );
  294. update_option( 'cp_adURL_2', $_REQUEST[ 'cp_adURL_2' ] );
  295. update_option( 'cp_adImage_3', $_REQUEST[ 'cp_adImage_3' ] );
  296. update_option( 'cp_adURL_3', $_REQUEST[ 'cp_adURL_3' ] );
  297.  
  298. update_option( 'cp_adGoogleID', $_REQUEST[ 'cp_adGoogleID' ] );
  299. update_option( 'cp_adAdsenseCode_1', $_REQUEST[ 'cp_adAdsenseCode_1' ] );
  300. update_option( 'cp_adAdsenseCode_2', $_REQUEST[ 'cp_adAdsenseCode_2' ] );
  301. update_option( 'cp_adAdsenseCode_3', $_REQUEST[ 'cp_adAdsenseCode_3' ] );
  302.  
  303.  
  304. update_option( 'cp_logo', $_REQUEST[ 'cp_logo' ] );
  305. update_option( 'cp_favICON', $_REQUEST[ 'cp_favICON' ] );
  306.  
  307.  
  308. // goto theme edit page
  309. header("Location: themes.php?page=functions.php&saved=true");
  310. die;
  311.  
  312. // reset settings
  313. } else if( 'reset' == $_REQUEST['action'] ) {
  314.  
  315. delete_option( 'cp_feedlinkURL' );
  316. delete_option( 'cp_feedlinkComments' );
  317. delete_option( 'cp_analytics' );
  318.  
  319. delete_option( 'ar_headline' );
  320. delete_option( 'ar_featured' );
  321. delete_option( 'ar_video' );
  322. delete_option( 'ar_categories' );
  323. delete_option( 'ar_spoilers' );
  324.  
  325. delete_option( 'cp_thumbAuto' );
  326. delete_option( 'cp_styleHead' );
  327. delete_option( 'cp_numFeatured' );
  328. delete_option( 'cp_autoScroll' );
  329. delete_option( 'cp_ScrollSpeed' );
  330. delete_option( 'cp_preventHeadline' );
  331. delete_option( 'cp_preventLatest' );
  332.  
  333. delete_option( 'cp_thumbHeight_LatestPost' );
  334. delete_option( 'cp_thumbWidth_LatestPost' );
  335.  
  336. delete_option( 'cp_status_Column' );
  337. delete_option( 'cp_thumbHeight_Column' );
  338. delete_option( 'cp_thumbWidth_Column' );
  339. delete_option( 'cp_excerptColumn' );
  340.  
  341. delete_option( 'cp_thumbWidth_Spoilers' );
  342. delete_option( 'cp_thumbHeight_Spoilers' );
  343. delete_option( 'cp_excerptSpoilers' );
  344. delete_option( 'cp_catSpoilers' );
  345.  
  346. delete_option( 'cp_showindexcatbar' );
  347. delete_option( 'cp_showindexgallery' );
  348.  
  349. delete_option( 'cp_thumbHeight_Post' );
  350. delete_option( 'cp_thumbWidth_Post' );
  351. delete_option( 'cp_postThumb' );
  352. delete_option( 'cp_showpostcatbar' );
  353. delete_option( 'cp_showpostheadline' );
  354. delete_option( 'cp_showpostgallery' );
  355.  
  356. delete_option( 'cp_thumbWidth_Archive' );
  357. delete_option( 'cp_thumbHeight_Archive' );
  358. delete_option( 'cp_showarchivecatbar' );
  359. delete_option( 'cp_showarchiveheadline' );
  360. delete_option( 'cp_showarchivegallery' );
  361.  
  362. delete_option( 'cp_catColor' );
  363.  
  364. $cp_categories = get_categories('hide_empty=0');
  365. $cp_numCats = 0;
  366. foreach ( $cp_categories as $b ) {
  367. $cp_numCats ++; }
  368.  
  369. for( $cp_x = 1; $cp_x <= $cp_numCats; $cp_x ++ ) {
  370. delete_option( 'cp_colorCategory_' . $cp_x );
  371. delete_option( 'cp_hexColor_' . $cp_x );
  372. delete_option( 'cp_textColor_' . $cp_x );
  373. delete_option( 'cp_hoverColor_' . $cp_x );
  374. }
  375.  
  376. delete_option( 'cp_adImage_1' );
  377. delete_option( 'cp_adURL_1' );
  378. delete_option( 'cp_adImage_2' );
  379. delete_option( 'cp_adURL_2' );
  380. delete_option( 'cp_adImage_3' );
  381. delete_option( 'cp_adURL_3' );
  382.  
  383. delete_option( 'cp_adGoogleID' );
  384. delete_option( 'cp_adAdsenseCode_1' );
  385. delete_option( 'cp_adAdsenseCode_2' );
  386. delete_option( 'cp_adAdsenseCode_3' );
  387.  
  388. delete_option( 'cp_logo' );
  389. delete_option( 'cp_favICON' );
  390.  
  391. // goto theme edit page
  392. header("Location: themes.php?page=functions.php&reset=true");
  393. die;
  394.  
  395. }
  396. }
  397.  
  398. add_theme_page( $ThemeName . ' Theme Options', $ThemeName . ' Options', 'edit_themes', basename(__FILE__), 'cp_themePage' );
  399.  
  400. }
  401.  
  402. function cp_themePage() {
  403.  
  404. global $ThemeName;
  405.  
  406. if ( $_REQUEST[ 'saved' ] ) echo '<div id="message" class="updated fade"><p><strong>Settings saved.</strong></p></div>';
  407. if ( $_REQUEST[ 'reset' ] ) echo '<div id="message" class="updated fade"><p><strong>Settings reset.</strong></p></div>';
  408.  
  409. ?>
  410.  
  411. <style>
  412. h3 { border-bottom:1px solid #ddd; padding-top:20px; padding-bottom:3px; }
  413.  
  414.  
  415. </style>
  416.  
  417. <div class="wrap">
  418. <form method="post">
  419. <h2 style="border-bottom:none;"><?php echo $ThemeName; ?> Theme Configuration</h2>
  420.  
  421.  
  422.  
  423. <?php if ( function_exists('wp_nonce_field') ) { wp_nonce_field( 'save-theme-properties' ); } ?>
  424.  
  425. <div style="padding-bottom:30px;">
  426.  
  427. <h3>General Settings</h3>
  428. <p>You can assign categories for headline, featured, and video section here. <strong>For category bar and category spoilers, select multiple categories by holding the Ctrl key.</strong> Category description in the category bar can be edited from Manage>Categories menu in Wordpress admin panel.</p>
  429.  
  430. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  431. <?php
  432.  
  433. $cp_categories = get_categories('hide_empty=0');
  434. foreach ( $cp_categories as $b ) {
  435. $cp_cat[] = array( $b->cat_ID, $b->cat_name );
  436. }
  437.  
  438. cp_th( "Headline" );
  439. cp_select( "ar_headline", $cp_cat, get_settings( "ar_headline" ), "" );
  440. cp_cth();
  441.  
  442. cp_th( "Featured" );
  443. cp_select( "ar_featured", $cp_cat, get_settings( "ar_featured" ), "" );
  444. cp_cth();
  445.  
  446. cp_th( "Video" );
  447. cp_select( "ar_video", $cp_cat, get_settings( "ar_video" ), "" );
  448. cp_cth();
  449.  
  450. cp_th( "Category Bar" );
  451. cp_multiSelect( "ar_categories[]", $cp_cat, get_settings( "ar_categories" ), "", "Hold down Ctrl button to select multiple categories. You must select 5 categories to get the best layout." );
  452. cp_cth();
  453.  
  454. cp_th( "Category Spoilers" );
  455. cp_multiSelect( "ar_spoilers[]", $cp_cat, get_settings( "ar_spoilers" ), "", "Hold down Ctrl button to select multiple categories." );
  456. cp_cth();
  457.  
  458. ?>
  459. </table>
  460.  
  461. <h3>Theme Sections and Thumbnail Settings</h3>
  462. <p>Configuration for page sections and thumbnail generation across your website. Thumbnail are generated and resized automatically using the TimThumb script. <strong>Do not forget to make the 'scripts' and 'cache' folder of the theme writable</strong> (CHMOD 777 or 755 from FTP).</p>
  463.  
  464. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  465. <?php
  466. $cp_thumb[] = array( "first", "First Image" );
  467. $cp_thumb[] = array( "", "Post Custom Field" );
  468.  
  469. cp_th( "Thumbnail assignment" );
  470. cp_select( "cp_thumbAuto", $cp_thumb, get_settings( "cp_thumbAuto" ), "" );
  471. cp_cth();
  472. ?>
  473. </table>
  474.  
  475. <p>In case you want to have full control over the image thumbnail assignment, please refer to the tutorial <a href="http://colorlabsproject.com/knowledgebase-tutorials/tutorial-timthumb-thumbnail-generation-with-arthemia-theme/" target="_blank">here</a>. You have to do manual thumbnail assignment using Custom Field if you don't want to assign the first image of the post as thumbnail, or perhaps to have a different image as thumbnail.</p>
  476.  
  477. <h4>Front Page Settings</h4>
  478. <p>You can customize the front page here. Thumbnail sizes are in pixels (px). To control number of post shown in the column list, go to Settings > Reading > Blog post.</p>
  479.  
  480. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  481. <?php
  482.  
  483. $cp_headimage[] = array( "wide", "Wide Image" );
  484. $cp_headimage[] = array( "", "Square Image" );
  485.  
  486. cp_th( "Headline Style" );
  487. cp_select( "cp_styleHead", $cp_headimage, get_settings( "cp_styleHead" ), "" );
  488. cp_cth();
  489.  
  490. cp_th( "Featured Items" );
  491. cp_input( "cp_numFeatured", "smalltext", "Total item in vertical carousel", get_settings( "cp_numFeatured" ) );
  492. cp_cth();
  493.  
  494. $cp_scroll[] = array( "", "Yes" );
  495. $cp_scroll[] = array( "No", "No" );
  496.  
  497. cp_th( "Auto scroll carousel?" );
  498. cp_select( "cp_autoScroll", $cp_scroll, get_settings( "cp_autoScroll" ), "" );
  499. cp_cth();
  500.  
  501. cp_th( "Carousel pause time" );
  502. cp_input( "cp_ScrollSpeed", "smalltext", "in miliseconds (default: 2000)", get_settings( "cp_ScrollSpeed" ) );
  503. cp_cth();
  504.  
  505. ?>
  506. </table>
  507.  
  508. <div style="font-size:0.9em; color:#999;"><p>For the best layout, assign more than 6 posts to the Featured category.</div>
  509.  
  510. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  511.  
  512. <?php
  513. cp_th( "Latest Post Section" );
  514. cp_input( "cp_thumbWidth_LatestPost", "smalltext", "Thumbnail Width (default. 150)", get_settings( "cp_thumbWidth_LatestPost" ) );
  515. cp_input( "cp_thumbHeight_LatestPost", "smalltext", "Thumbnail Height (default. 150)", get_settings( "cp_thumbHeight_LatestPost" ) );
  516. cp_cth();
  517. ?>
  518.  
  519. </table>
  520.  
  521. <div style="font-size:0.9em; color:#999;"><p>Latest Post automated thumbnail will be hidden if you assign thumbnails to be taken from First Image in posts.</p></div>
  522.  
  523. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  524.  
  525. <?php
  526. $cp_column[] = array( "no", "Hide Post Excerpt" );
  527. $cp_column[] = array( "", "Show Post Excerpt" );
  528. $cp_num_column[] = array( "", "Show Two-Column List" );
  529. $cp_num_column[] = array( "one", "Show One-Column List" );
  530.  
  531. cp_th( "Column List" );
  532. cp_input( "cp_thumbWidth_Column", "smalltext", "Thumbnail Width (default. 80)", get_settings( "cp_thumbWidth_Column" ) );
  533. cp_input( "cp_thumbHeight_Column", "smalltext", "Thumbnail Height (default. 80)", get_settings( "cp_thumbHeight_Column" ) );
  534. cp_select( "cp_excerptColumn", $cp_column, get_settings( "cp_excerptColumn" ), "" );
  535. cp_select ("cp_status_Column", $cp_num_column, get_settings( "cp_status_Column" ), "" );
  536. cp_cth();
  537.  
  538.  
  539. ?>
  540. </table>
  541.  
  542. <div style="font-size:0.9em; color:#999;"><p>Recommended values for above Column List fields are:
  543. <ul><li>width = 80, height = 80, show post excerpts, two-column list</li><li>width = 265, height = 80, show post excerpts, two-column list</li><li>width = 265, height = 80, hide post excerpts, two-column list</li><li>width = 150, height = 90, show post excerpts, one-column list</li></ul></p></div>
  544.  
  545. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  546.  
  547. <?php
  548. $cp_indexcatbar[] = array( "no", "Hide Category Bar" );
  549. $cp_indexcatbar[] = array( "", "Show Category Bar" );
  550.  
  551. $cp_indexgallery[] = array( "no", "Hide Video and Random Post Gallery" );
  552. $cp_indexgallery[] = array( "", "Show Video and Random Post Gallery" );
  553.  
  554. cp_th( "Index Page" );
  555. cp_select( "cp_showindexcatbar", $cp_indexcatbar, get_settings( "cp_showindexcatbar" ), "" );
  556. cp_select( "cp_showindexgallery", $cp_indexgallery, get_settings( "cp_showindexgallery" ), "" );
  557.  
  558. cp_cth();
  559.  
  560.  
  561. ?>
  562. </table>
  563.  
  564. <h4>Sidebar Settings</h4>
  565. <p>You can customize category spoilers here. To add widgets in sidebar and footer, you need to go to Design > Widgets.</p>
  566. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  567.  
  568. <?php
  569.  
  570. $cp_spoilers[] = array( "no", "Hide Post Excerpt" );
  571. $cp_spoilers[] = array( "", "Show Post Excerpt" );
  572.  
  573. $cp_showspoilers[] = array( "no", "Hide Category Spoilers" );
  574. $cp_showspoilers[] = array( "", "Show Category Spoilers" );
  575.  
  576. cp_th( "Category Spoilers" );
  577. cp_input( "cp_thumbWidth_Spoilers", "smalltext", "Thumbnail Width (default. 80)", get_settings( "cp_thumbWidth_Spoilers" ) );
  578. cp_input( "cp_thumbHeight_Spoilers", "smalltext", "Thumbnail Height (default. 80)", get_settings( "cp_thumbHeight_Spoilers" ) );
  579. cp_select( "cp_excerptSpoilers", $cp_spoilers, get_settings( "cp_excerptSpoilers" ), "" );
  580. cp_select( "cp_catSpoilers", $cp_showspoilers, get_settings( "cp_catSpoilers" ), "" );
  581.  
  582. cp_cth();
  583.  
  584. ?>
  585. </table>
  586.  
  587. <div style="font-size:0.9em; color:#999;"><p>Recommended values for above Category Spoilers fields are:
  588. <ul><li>width = 80, height = 80, and show post excerpts</li><li>width = 290, height = 80, and hide post excerpts</li></ul></p></div>
  589.  
  590. <h4>Single Post Page Settings</h4>
  591. <p>You can customize the single-post page here.</p>
  592. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  593.  
  594. <?php
  595.  
  596. $cp_postview[] = array( "no", "Hide Top-Left Thumbnail" );
  597. $cp_postview[] = array( "", "Show Top-Left Thumbnail" );
  598.  
  599. $cp_postcatbar[] = array( "no", "Hide Category Bar" );
  600. $cp_postcatbar[] = array( "", "Show Category Bar" );
  601.  
  602. $cp_postheadline[] = array( "no", "Hide Headline Spoiler" );
  603. $cp_postheadline[] = array( "", "Show Headline Spoiler" );
  604.  
  605. $cp_postgallery[] = array( "no", "Hide Video and Random Post Gallery" );
  606. $cp_postgallery[] = array( "", "Show Video and Random Post Gallery" );
  607.  
  608. cp_th( "Single Post View" );
  609. cp_input( "cp_thumbWidth_Post", "smalltext", "Thumbnail Width (default. 150)", get_settings( "cp_thumbWidth_Post" ) );
  610. cp_input( "cp_thumbHeight_Post", "smalltext", "Thumbnail Height (default. 150)", get_settings( "cp_thumbHeight_Post" ) );
  611. cp_select( "cp_postThumb", $cp_postview, get_settings( "cp_postThumb" ), "" );
  612. cp_select( "cp_showpostcatbar", $cp_postcatbar, get_settings( "cp_showpostcatbar" ), "" );
  613. cp_select( "cp_showpostheadline", $cp_postheadline, get_settings( "cp_showpostheadline" ), "" );
  614. cp_select( "cp_showpostgallery", $cp_postgallery, get_settings( "cp_showpostgallery" ), "" );
  615.  
  616. cp_cth(); ?>
  617.  
  618. </table>
  619.  
  620. <div style="font-size:0.9em; color:#999;"><p>Single-Post View automated thumbnail will be hidden if you assign thumbnails to be taken from First Image in posts.</p></div>
  621.  
  622. <h4>Archive and Search Page Settings</h4>
  623. <p>You can customize the archive and search page here.</p>
  624.  
  625. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  626.  
  627. <?php
  628.  
  629. $cp_archivecatbar[] = array( "no", "Hide Category Bar" );
  630. $cp_archivecatbar[] = array( "", "Show Category Bar" );
  631.  
  632. $cp_archiveheadline[] = array( "no", "Hide Headline Spoiler" );
  633. $cp_archiveheadline[] = array( "", "Show Headline Spoiler" );
  634.  
  635. $cp_archivegallery[] = array( "no", "Hide Video and Random Post Gallery" );
  636. $cp_archivegallery[] = array( "", "Show Video and Random Post Gallery" );
  637.  
  638. cp_th( "Archive and Search" );
  639. cp_input( "cp_thumbWidth_Archive", "smalltext", "Thumbnail Width (default. 150)", get_settings( "cp_thumbWidth_Archive" ) );
  640. cp_input( "cp_thumbHeight_Archive", "smalltext", "Thumbnail Height (default. 150)", get_settings( "cp_thumbHeight_Archive" ) );
  641. cp_select( "cp_showarchivecatbar", $cp_archivecatbar, get_settings( "cp_showarchivecatbar" ), "" );
  642. cp_select( "cp_showarchiveheadline", $cp_archiveheadline, get_settings( "cp_showarchiveheadline" ), "" );
  643. cp_select( "cp_showarchivegallery", $cp_archivegallery, get_settings( "cp_showarchivegallery" ), "" );
  644. cp_cth();
  645.  
  646. ?>
  647. </table>
  648.  
  649. <h3>Post Duplication Prevention</h3>
  650. <p>You can prevent posts from being displayed more than once on the front page. <strong>Notice: this settings will be only implemented on the front page.</strong></p>
  651. <div style="font-size:0.9em; color:#999;"><p>Default settings:
  652. <ul><li>headline and featured posts are only displayed in the top-fold of the front page and are excluded from the latest post list (column list on the left) and from the category spoilers in the sidebar.</li>
  653. <li>latest posts on the column list will not be displayed again in the category spoilers. (This will make category spoilers' content vary in every page.)</li>
  654. </ul>
  655. </p></div>
  656. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  657. <?php
  658.  
  659. $cp_headpost[] = array( "", "Yes" );
  660. $cp_headpost[] = array( "No", "No" );
  661.  
  662. cp_th( "Headline and featured post exclusion?" );
  663. cp_select( "cp_preventHeadline", $cp_headpost, get_settings( "cp_preventHeadline" ), "" );
  664. cp_cth();
  665.  
  666. $cp_latestpost[] = array( "", "Yes" );
  667. $cp_latestpost[] = array( "No", "No" );
  668.  
  669. cp_th( "Column list posts exclusion on category spoilers?" );
  670. cp_select( "cp_preventLatest", $cp_latestpost, get_settings( "cp_preventLatest" ), "" );
  671. cp_cth();
  672.  
  673.  
  674. ?>
  675. </table>
  676.  
  677.  
  678. <h3>Logo Image</h3>
  679. <p>Logo is shown in the top-left section of your website. To set up a logo, <strong>upload an image to the logo folder in the theme folder</strong>. To set up favorite/bookmark icon, <strong>upload an icon file to the icons folder in the theme folder</strong>.</p>
  680.  
  681. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  682. <?php
  683.  
  684. // get styles
  685. $cp_logoDir = opendir( TEMPLATEPATH . "/images/logo/" );
  686. $cp_Alogo[] = array( "", "None (default)" );
  687. // Open a known directory, and proceed to read its contents
  688. while (false !== ( $cp_logoFolder = readdir( $cp_logoDir ) ) ) {
  689. if( $cp_logoFolder != "." && $cp_logoFolder != ".." ) {
  690. $cp_logoName = $cp_logoFolder;
  691. $cp_Alogo[] = array( $cp_logoFolder, $cp_logoName );
  692. }
  693. }
  694.  
  695. closedir( $cp_logoDir );
  696.  
  697. cp_th( "Logo" );
  698. cp_select( "cp_logo", $cp_Alogo, get_settings( "cp_logo" ), "" );
  699. cp_cth();
  700.  
  701.  
  702. // get styles
  703. $cp_icoDir = opendir( TEMPLATEPATH . "/images/icons/" );
  704.  
  705. $cp_Aico[] = array( "", "None (default)" );
  706. // Open a known directory, and proceed to read its contents
  707. while (false !== ( $cp_icoFolder = readdir( $cp_icoDir ) ) ) {
  708. if( $cp_icoFolder != "." && $cp_icoFolder != ".." ) {
  709. $cp_icoName = $cp_icoFolder;
  710. $cp_Aico[] = array( $cp_icoFolder, $cp_icoName );
  711. }
  712. }
  713.  
  714. closedir( $cp_icoDir );
  715.  
  716. cp_th( "Favorite Icons" );
  717. cp_select( "cp_favICON", $cp_Aico, get_settings( "cp_favICON" ), "" );
  718.  
  719. cp_cth();
  720.  
  721.  
  722. ?>
  723. </table>
  724.  
  725. <h3>Category Color Assignment</h3>
  726. <p>Assign color to each category here. You can only assign one color per category. This list below will display all categories you have and the order does not represent the category order in the front page as categories are always sorted alphabetically.</p>
  727.  
  728. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  729. <?php
  730.  
  731. $cp_categories = get_categories('hide_empty=0');
  732. $cp_numCats = 0;
  733. foreach ( $cp_categories as $b ) {
  734. $cp_Colorcat[] = array( $b->cat_ID, $b->cat_name );
  735. $cp_numCats ++;
  736. }
  737.  
  738. cp_th( "Category Spoilers Title Color" );
  739. cp_input( "cp_catColor", "smalltext", "Text (start with #)", get_settings( "cp_catColor" ) );
  740. cp_cth();
  741.  
  742. cp_th( "Category Bar Colors" );
  743. for( $cp_x = 1; $cp_x <= $cp_numCats; $cp_x ++ ) {
  744.  
  745. cp_select ( "cp_colorCategory_" . $cp_x, $cp_Colorcat, get_settings( "cp_colorCategory_" . $cp_x ), "" );
  746. echo '<br />'; cp_input( "cp_hexColor_" . $cp_x, "smalltext", "Background (start with #)", get_settings( "cp_hexColor_" . $cp_x ) );
  747. cp_input( "cp_textColor_" . $cp_x, "smalltext", "Text (start with #)", get_settings( "cp_textColor_" . $cp_x ) );
  748. cp_input( "cp_hoverColor_" . $cp_x, "smalltext", "Link Hover (start with #)", get_settings( "cp_hoverColor_" . $cp_x ) );
  749. echo '<br />'; }
  750. cp_cth();
  751.  
  752. ?>
  753. </table>
  754.  
  755. <h3>RSS and Statistics Settings</h3>
  756. <p>Manage your RSS Feeds with Google Feedburner and website statistics with Google Analytics. Put your Feedburner URLs and Analytics ID here.</p>
  757.  
  758. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  759. <?php
  760. cp_th( "Google Analytics ID" );
  761. cp_input( "cp_analytics", "smalltext", "Google Analytics ID. Start with UA-", get_settings( "cp_analytics" ) );
  762. cp_cth();
  763.  
  764. cp_th( "Feedburner URL" );
  765. cp_input( "cp_feedlinkURL", "text", "Feedburner URL. This will replace RSS feed link. Start with http://", get_settings( "cp_feedlinkURL" ) );
  766. cp_cth();
  767.  
  768. cp_th( "Feedburner Comments URL" );
  769. cp_input( "cp_feedlinkComments", "text", "Feedburner URL. This will replace RSS comment feed link. Start with http://", get_settings( "cp_feedlinkComments" ) );
  770. cp_cth();
  771.  
  772.  
  773. ?>
  774. </table>
  775.  
  776. <h3>Google Adsense and User-Specified Ads</h3>
  777. <p>Ads will appear on the righthand sidebar of the homepage, top section of the page, and in single post views. To display ads from Google Adsense, complete the Adsense account settings and select "Adsense" from the drop-down menu below. Ad click URLs will be neglected.</p>
  778.  
  779. <h4>Global Ad Settings</h4>
  780. <p>If you want to set up your own ad simply <strong>upload the image to the ads folder in your theme folder</strong> and the ad file name will show up in the drop-down menu.</p>
  781.  
  782. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  783. <?php
  784. // get styles
  785. $cp_adsDir = opendir( TEMPLATEPATH . "/images/ads/" );
  786.  
  787. $cp_ads[] = array( "", "None (default)" );
  788. $cp_ads[] = array( "Adsense", "Adsense" );
  789. // Open a known directory, and proceed to read its contents
  790. while (false !== ( $cp_adsFolder = readdir( $cp_adsDir ) ) ) {
  791. if( $cp_adsFolder != "." && $cp_adsFolder != ".." ) {
  792. $cp_adName = $cp_adsFolder;
  793. $cp_ads[] = array( $cp_adsFolder, $cp_adName );
  794. }
  795. }
  796.  
  797. closedir( $cp_adsDir );
  798.  
  799. cp_th( "Header Section Ad" );
  800. cp_select( "cp_adImage_1", $cp_ads, get_settings( "cp_adImage_1" ), "" );
  801. echo "<br />";
  802. cp_input( "cp_adURL_1", "text", "Header Section Ad click URL", get_settings( "cp_adURL_1" ) );
  803. cp_cth();
  804.  
  805. cp_th( "Sidebar Section Ad" );
  806. cp_select( "cp_adImage_2", $cp_ads, get_settings( "cp_adImage_2" ), "" );
  807. echo "<br />";
  808. cp_input( "cp_adURL_2", "text", "Sidebar Section Ad click URL", get_settings( "cp_adURL_2" ) );
  809. cp_cth();
  810.  
  811. cp_th( "Single Post View Ad" );
  812. cp_select( "cp_adImage_3", $cp_ads, get_settings( "cp_adImage_3" ), "" );
  813. echo "<br />";
  814. cp_input( "cp_adURL_3", "text", "Single Post View Ad click URL", get_settings( "cp_adURL_3" ) );
  815. cp_cth();
  816.  
  817.  
  818. ?>
  819. </table>
  820.  
  821. <h4>Adsense Account Settings</h4>
  822. <p>To set up Adsense, <strong>add your Google Ad Client ID and Ad Slot IDs</strong> to the fields below.</p>
  823.  
  824. <p>This is the example code that you get from Google:</p>
  825. <pre><code style="font-size:0.8em;">&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
  826. google_ad_client = &quot;pub-XXXXXXXXXXXXXXXX&quot;;
  827. /* Your Ad description here */
  828. google_ad_slot = &quot;YYYYYYYYYY&quot;;
  829. google_ad_width = width;
  830. google_ad_height = height;
  831. //--&gt;
  832. &lt;/script&gt;
  833. &lt;script type=&quot;text/javascript&quot;
  834. src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
  835. &lt;/script&gt;</code></pre>
  836. <p>Notice the value for "google_ad_client" and "google_ad_slot".</p>
  837.  
  838. <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
  839. <?php
  840.  
  841. cp_th( "Google Ad Client ID" );
  842. cp_input( "cp_adGoogleID", "text", "Put your Google Ad Client ID here. (Eg. pub-XXXXXXXXXXXXXXXX)", get_settings( "cp_adGoogleID" ) );
  843. cp_cth();
  844.  
  845. cp_th( "728x90 Ad Slot ID" );
  846. cp_input( "cp_adAdsenseCode_1", "smalltext", "Put the Ad Slot ID for here. (Eg. YYYYYYYYYY)", get_settings( "cp_adAdsenseCode_1" ) );
  847. cp_cth();
  848.  
  849. cp_th( "300x225 Ad Slot ID" );
  850. cp_input( "cp_adAdsenseCode_2", "smalltext", "Put the Ad Slot ID for here. (Eg. YYYYYYYYYY)", get_settings( "cp_adAdsenseCode_2" ) );
  851. cp_cth();
  852.  
  853. cp_th( "468x60 Ad Slot ID" );
  854. cp_input( "cp_adAdsenseCode_3", "smalltext", "Put the Ad Slot ID for here. (Eg. YYYYYYYYYY)", get_settings( "cp_adAdsenseCode_3" ) );
  855. cp_cth();
  856.  
  857.  
  858. ?>
  859. </table>
  860.  
  861. </div>
  862.  
  863.  
  864. <br style="clear:both;" />
  865.  
  866. <input type="hidden" name="action" value="save" />
  867. <?php cp_input( "save", "submit", "", "Save Settings" ); ?>
  868.  
  869. </form>
  870. </div>
  871.  
  872. <?php
  873.  
  874.  
  875.  
  876. }
  877.  
  878. function cp_getProperty( $property ) {
  879.  
  880. global $ThemeName;
  881.  
  882. $value = get_settings( "ThemeName_" . $property );
  883. if( $value == "1" ) { return 1; } else { return 0; }
  884.  
  885. }
  886.  
  887. function cp_catProperties( $id ) {
  888.  
  889. global $cp_categories;
  890.  
  891. foreach( $cp_categories as $bC ) {
  892.  
  893. if( $bC->cat_ID == $id ) {
  894. return $bC;
  895. exit;
  896. }
  897.  
  898. }
  899.  
  900. }
  901.  
  902. // Plugin by Steve Smith - http://orderedlist.com/wordpress-plugins/feedburner-plugin/ and feedburner - http://www.feedburner.com/fb/a/help/wordpress_quickstart
  903. function feed_redirect() {
  904.  
  905. global $wp, $feed, $withcomments;
  906.  
  907. $newURL1 = trim( get_settings( "cp_feedlinkURL" ) );
  908. $newURL2 = trim( get_settings( "cp_feedlinkComments" ) );
  909.  
  910. if( is_feed() ) {
  911.  
  912. if ( $feed != 'comments-rss2'
  913. && !is_single()
  914. && $wp->query_vars[ 'category_name' ] == ''
  915. && !is_author()
  916. && ( $withcomments != 1 )
  917. && $newURL1 != '' ) {
  918.  
  919. if ( function_exists( 'status_header' ) ) { status_header( 302 ); }
  920. header( "Location:" . $newURL1 );
  921. header( "HTTP/1.1 302 Temporary Redirect" );
  922. exit();
  923.  
  924. } elseif ( ( $feed == 'comments-rss2' || $withcomments == 1 ) && $newURL2 != '' ) {
  925.  
  926. if ( function_exists( 'status_header' ) ) { status_header( 302 ); }
  927. header( "Location:" . $newURL2 );
  928. header( "HTTP/1.1 302 Temporary Redirect" );
  929. exit();
  930.  
  931. }
  932.  
  933. }
  934.  
  935. }
  936.  
  937. function feed_check_url() {
  938.  
  939. switch ( basename( $_SERVER[ 'PHP_SELF' ] ) ) {
  940. case 'wp-rss.php':
  941. case 'wp-rss2.php':
  942. case 'wp-atom.php':
  943. case 'wp-rdf.php':
  944.  
  945. $newURL = trim( get_settings( "cp_feedlinkURL" ) );
  946.  
  947. if ( $newURL != '' ) {
  948. if ( function_exists('status_header') ) { status_header( 302 ); }
  949. header( "Location:" . $newURL );
  950. header( "HTTP/1.1 302 Temporary Redirect" );
  951. exit();
  952. }
  953.  
  954. break;
  955.  
  956. case 'wp-commentsrss2.php':
  957.  
  958. $newURL = trim( get_settings( "cp_feedlinkComments" ) );
  959.  
  960. if ( $newURL != '' ) {
  961. if ( function_exists('status_header') ) { status_header( 302 ); }
  962. header( "Location:" . $newURL );
  963. header( "HTTP/1.1 302 Temporary Redirect" );
  964. exit();
  965. }
  966.  
  967. break;
  968. }
  969. }
  970.  
  971. if (!preg_match("/feedburner|feedvalidator/i", $_SERVER['HTTP_USER_AGENT'])) {
  972. add_action('template_redirect', 'feed_redirect');
  973. add_action('init','feed_check_url');
  974. }
  975. add_action( 'admin_menu', 'cp_addThemePage' );
  976.  
  977. add_action( 'wp_print_scripts', 'arthemia_add_javascript' );
  978. function arthemia_add_javascript( ) {
  979. if (is_home()) {
  980. wp_enqueue_script('jquery');
  981. wp_enqueue_script( 'jquery.jcarousel.pack', get_bloginfo('template_directory').'/scripts/jquery.jcarousel.pack.js', array( 'jquery' ) ); }
  982. }
  983.  
  984. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement