Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ?><?php
- $themename = "WPSN";
- $shortname = "stylewp";
- $featured = array("Select a Number:","0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50");
- $agi_options = array (
- 'welcome' => array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Options</h2></div>",
- "type" => "heading"),
- ),
- 'global' => array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Global Options</h2></div>",
- "type" => "heading"),
- array( "name" => "Membership Login?",
- "desc" => "Check to <b>disable</b> the members login area<br /><b>NOTE:</b> To make use of the register & login links you must first enable registrations<br />from your admin general settings page.<br /><br />",
- "id" => $shortname."_regs",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Disable Drop-Downs?",
- "desc" => "Check to <b>disable</b> the drop-down functionality of the main menu<br /><br />",
- "id" => $shortname."_showdropdown",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Custom RSS feed",
- "desc" => "Enter your custom RSS feed URL from services such as <a href=\"http://feedburner.com\" target=\"_blank\">Feedburner</a><br />(or <b>leave blank</b> to use the standard Wordpress RSS feed)<br /><br />",
- "id" => $shortname."_customrss",
- "std" => "",
- "type" => "text"),
- array( "name" => "RSS Link Text",
- "desc" => "Enter some text to link to your RSS feed<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_rsstitle",
- "std" => "",
- "type" => "text"),
- array( "name" => "Disable Wordpress Logo?",
- "desc" => "Check to <b>disable</b> the <a href=\"http://wordpress.org\" target=\"_blank\">Wordpress</a> logo in the theme footer<br /><br />",
- "id" => $shortname."_lovewp",
- "std" => "true",
- "type" => "checkbox"),
- ),
- 'frontpage' => array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Frontpage Settings</h2></div>",
- "type" => "heading"),
- array( "name" => "More News",
- "desc" => "Edit the 'More News' block title here<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_textmorenews",
- "std" => "",
- "type" => "text"),
- array( "name" => "Google Ads (left)",
- "desc" => "Edit the 'Ads by Google' block title here (Banner #4)<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_textbanner4",
- "std" => "",
- "type" => "text"),
- array( "name" => "Latest Headlines",
- "desc" => "Edit the 'Latest Headlines' block title here<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_textheadlines",
- "std" => "",
- "type" => "text"),
- array( "name" => "Photo of the Day",
- "desc" => "Edit the 'Photo of the Day' block title here<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_textphotoday",
- "std" => "",
- "type" => "text"),
- array( "name" => "Have You Read?",
- "desc" => "Edit the 'Have You Read?' block title here<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_texthaveu",
- "std" => "",
- "type" => "text"),
- array( "name" => "Spotlight",
- "desc" => "Edit the 'Spotlight' block title here<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_textspotlight",
- "std" => "",
- "type" => "text"),
- array( "name" => "Google Ads (right)",
- "desc" => "Edit the 'Ads by Google' block title here (Banner #5)<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_textbanner5",
- "std" => "",
- "type" => "text"),
- ),
- 'banner' => array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Banner Settings</h2></div>",
- "type" => "heading"),
- array( "name" => "Banner #1",
- "desc" => "Add your <b>728*90</b> banner code here, or leave blank to not show this banner<br /><br />",
- "id" => $shortname."_banner1",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Banner #2",
- "desc" => "Add your <b>300*66</b> banner code here, or leave blank to not show this banner<br /><br />",
- "id" => $shortname."_banner2",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Banner #3",
- "desc" => "Add your <b>300*250</b> banner code here, or leave blank to not show this banner<br /><br />",
- "id" => $shortname."_banner3",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Banner #4",
- "desc" => "Add your <b>336*280</b> banner code here, or leave blank to not show this banner<br /><br />",
- "id" => $shortname."_banner4",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Banner #5",
- "desc" => "Add your <b>200*200</b> banner code here, or leave blank to not show this banner<br /><br />",
- "id" => $shortname."_banner5",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Banner #6",
- "desc" => "Add your <b>300*250</b> banner code here, or leave blank to not show this banner<br /><br />",
- "id" => $shortname."_banner6",
- "std" => "",
- "type" => "textarea"),
- ),
- 'livechat' => array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Livechat Settings</h2></div>",
- "type" => "heading"),
- array( "name" => "Chat Code",
- "desc" => "Enter your <a href=\"http://shoutmix.com\" target=\"_blank\">ShoutMix</a> chatcode here as shown in the user guide<br />(or leave blank to disable <b>all</b> livechat functionality)<br /><br /><b>NOTE:</b> Activating the live chat feature will invalidate the code.<br /><br />",
- "id" => $shortname."_chatcode",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Chat Link Text",
- "desc" => "Enter some text to use as the LiveChat toggle text<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_livechattitle",
- "std" => "",
- "type" => "text"),
- array( "name" => "Members Only?",
- "desc" => "Check to make the livechat a <b>members-only</b> feature<br /><br />",
- "id" => $shortname."_chatregs",
- "std" => "true",
- "type" => "checkbox"),
- ),
- 'video' => array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Featured Video</h2></div>",
- "type" => "heading"),
- array( "name" => "Video Code",
- "desc" => "Enter your video embed code here, or <b>leave blank</b> to disable<br />(Resize videos to 214* 175)<br /><br />",
- "id" => $shortname."_videofeat",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Video Title",
- "desc" => "Enter the video block title text<br />(or <b>leave blank</b> to use the default text)<br /><br />",
- "id" => $shortname."_videotitle",
- "std" => "",
- "type" => "text"),
- array( "name" => "Members Only?",
- "desc" => "Check to make the featured video a <b>members-only</b> feature<br /><br />",
- "id" => $shortname."_videoregs",
- "std" => "true",
- "type" => "checkbox"),
- ),
- 'misc' => array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Miscellaneous Settings</h2></div>",
- "type" => "heading"),
- array( "name" => "META Keywords",
- "desc" => "Add some keywords that are relevant to your website<br />(seperate with comma's)<br /><br />",
- "id" => $shortname."_keywords",
- "std" => "",
- "type" => "textarea"),
- array("name" => "META Description",
- "desc" => "Enter a description of your site for the search engines<br /><br />",
- "id" => $shortname."_description",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Google Analytics",
- "desc" => "Add your Google Analytics tracking code here<br />(or leave blank to not track your stats)<br /><br />",
- "id" => $shortname."_analytics",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "Additional Code",
- "desc" => "Here you can add code that will be positioned directly <b>after your closing body<br />tag</b> (HTML allowed)<br /><br />",
- "id" => $shortname."_afterbody",
- "std" => "",
- "type" => "textarea"),
- ),
- 'copyright' => array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Copyright Information</h2></div>",
- "type" => "heading"),
- array( "name" => "Years Protected",
- "desc" => "Edit the years of copyright<br /><b>EXAMPLE:</b> 1997 - 2009<br /><br />",
- "id" => $shortname."_crightyear",
- "std" => "",
- "type" => "text"),
- array( "name" => "Copyright Holder",
- "desc" => "Edit the copyright holders name<br /><b>EXAMPLE:</b> Your Company Name<br /><br />",
- "id" => $shortname."_cright",
- "std" => "",
- "type" => "text"),
- array( "name" => "Link Destination",
- "desc" => "Edit the destination of the copyright holders link<br /><b>EXAMPLE:</b> http://yourcompany.com<br /><br />",
- "id" => $shortname."_crighturl",
- "std" => "",
- "type" => "text"),
- array( "name" => "Your Rights",
- "desc" => "Edit the rights reserved text<br /><b>EXAMPLE:</b> All rights reserved.<br /><br />",
- "id" => $shortname."_crightsub",
- "std" => "",
- "type" => "text"),
- ),
- );
- function mytheme_add_admin() {
- global $themename, $shortname,$menu,$agi_options;
- $arrs =array(
- 'mt_agi_manage_page',
- 'mt-agi-global-settings-page',
- 'mt-agi-frontpage-settings-page',
- 'mt-agi-banner-settings-page',
- 'mt-agi-livechat-settings-page',
- 'mt-agi-video-settings-page',
- 'mt-agi-misc-settings-page',
- 'mt-agi-copyright-settings-page',
- 'mt-agi-page1name-page',
- 'mt-agi-page2name-page',
- );
- if ( in_array($_REQUEST['page'],$arrs) ) {
- if ( 'save' == $_REQUEST['action'] ) {
- foreach ($agi_options[$_REQUEST['agi']] as $value) {
- if($value['type'] != 'multicheck'){
- update_option( $value['id'], $_REQUEST[ $value['id'] ] );
- }else{
- foreach($value['options'] as $mc_key => $mc_value){
- $up_opt = $value['id'].'_'.$mc_key;
- update_option($up_opt, $_REQUEST[$up_opt] );
- }
- }
- }
- foreach ($agi_options as $value) {
- if($value['type'] != 'multicheck'){
- if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ] ); } else { delete_option( $value['id'] ); }
- }else{
- foreach($value['options'] as $mc_key => $mc_value){
- $up_opt = $value['id'].'_'.$mc_key;
- if( isset( $_REQUEST[ $up_opt ] ) ) { update_option( $up_opt, $_REQUEST[ $up_opt ] ); } else { delete_option( $up_opt ); }
- }
- }
- }
- //header("Location: themes.php?page=".$_REQUEST['page']."&saved=true");
- // die;
- } else if( 'reset' == $_REQUEST['action'] ) {
- foreach ($agi_options as $value) {
- if($value['type'] != 'multicheck'){
- delete_option( $value['id'] );
- }else{
- foreach($value['options'] as $mc_key => $mc_value){
- $del_opt = $value['id'].'_'.$mc_key;
- delete_option($del_opt);
- }
- }
- }
- //header("Location: themes.php?page=".$_REQUEST['page']."&reset=true");
- //die;
- }
- }
- // Add a new top-level menu (ill-advised):
- add_menu_page('WPSN', 'WPSN', 10, 'mt-agi-global-settings-page', 'mt_agi_global_settings_page');
- unset($menu[90][1]);
- // Global Settings:
- add_submenu_page('mt-agi-global-settings-page', 'Global Options', 'Global Options', 8, 'mt-agi-global-settings-page', 'mt_agi_global_settings_page');
- // Frontpage Settings:
- add_submenu_page('mt-agi-global-settings-page', 'Frontpage Settings', 'Frontpage Settings', 8, 'mt-agi-frontpage-settings-page', 'mt_agi_frontpage_settings_page');
- // Banner Settings:
- add_submenu_page('mt-agi-global-settings-page', 'Banner Settings', 'Banner Settings', 8, 'mt-agi-banner-settings-page', 'mt_agi_banner_settings_page');
- // Livechat Settings:
- add_submenu_page('mt-agi-global-settings-page', 'Livechat Settings', 'Livechat Settings', 8, 'mt-agi-livechat-settings-page', 'mt_agi_livechat_settings_page');
- // Video Settings:
- add_submenu_page('mt-agi-global-settings-page', 'Video Settings', 'Video Settings', 8, 'mt-agi-video-settings-page', 'mt_agi_video_settings_page');
- // Miscellaneous Settings:
- add_submenu_page('mt-agi-global-settings-page', 'Miscellaneous', 'Miscellaneous', 8, 'mt-agi-misc-settings-page', 'mt_agi_misc_settings_page');
- // Copyright Settings:
- add_submenu_page('mt-agi-global-settings-page', 'Copyright Info', 'Copyright Info', 8, 'mt-agi-copyright-settings-page', 'mt_agi_copyright_settings_page');
- }
- function mytheme_admin() {
- global $themename, $shortname, $agi_options;
- if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
- if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
- }
- function mytheme_wp_head() {
- $stylesheet = get_option('stylewp_alt');
- if($stylesheet != ''){?>
- <?php }
- }
- add_action('wp_head', 'mytheme_wp_head');
- add_action('admin_menu', 'mytheme_add_admin');
- ?>
- <?php function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
- $content = get_the_content($more_link_text, $stripteaser, $more_file);
- $content = apply_filters('the_content', $content);
- $content = str_replace(']]>', ']]>', $content);
- $content = strip_tags($content);
- if (strlen($_GET['p']) > 0) {
- echo "<p>";
- echo $content;
- echo " <a href='";
- the_permalink();
- echo "'>"."Read More →</a>";
- echo "</p>";
- }
- else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
- $content = substr($content, 0, $espacio);
- $content = $content;
- echo "<p>";
- echo $content;
- echo "...";
- echo " <a href='";
- the_permalink();
- echo "'>".$more_link_text."</a>";
- echo "</p>";
- }
- else {
- echo "<p>";
- echo $content;
- echo " <a href='";
- the_permalink();
- echo "'>"."Read More →</a>";
- echo "</p>";
- }
- }
- /*
- function mt_agi_page1_function_callback(){
- global $shortname;
- echo "<script type='text/javascript' src='".get_template_directory_uri()."/main.js'></script>";
- $agi_options = array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Option page 1</h2></div>",
- "type" => "heading"),
- array( "name" => "screenshot",
- "id" => "screenshot",
- 'url'=>get_template_directory_uri()."/screenshot.png",
- "type" => "screenshot"),
- );
- agi_template($agi_options,'welcome');
- }
- function mt_agi_page2_function_callback(){
- $agi_options = array (
- array( "name" => "<div style=\"width:100%;font-family: Georgia;\"><h2 style=\"color:#21759B;\">Option page 2</h2></div>",
- "type" => "heading")
- );
- agi_template($agi_options,'welcome');
- }
- */
- function mt_agi_manage_page(){
- global $agi_options;
- agi_template($agi_options['welcome'],'welcome');
- }
- function mt_agi_global_settings_page(){
- global $agi_options;
- agi_template($agi_options['global'],'global');
- }
- function mt_agi_frontpage_settings_page(){
- global $agi_options;
- agi_template($agi_options['frontpage'],'frontpage');
- }
- function mt_agi_banner_settings_page(){
- global $agi_options;
- agi_template($agi_options['banner'],'banner');
- }
- function mt_agi_livechat_settings_page(){
- global $agi_options;
- agi_template($agi_options['livechat'],'livechat');
- }
- function mt_agi_video_settings_page(){
- global $agi_options;
- agi_template($agi_options['video'],'video');
- }
- function mt_agi_misc_settings_page(){
- global $agi_options;
- agi_template($agi_options['misc'],'misc');
- }
- function mt_agi_copyright_settings_page(){
- global $agi_options;
- agi_template($agi_options['copyright'],'copyright');
- }
- function agi_template($options=array(),$agi=''){
- if(count($options)!=1){
- ?><div class="wrap">
- <form method="post" action="" enctype="multipart/form-data"><?php
- }?><table class="widefat fixed" style="max-width:800px;margin-top:20px;background: #ffffff" cellspacing="0">
- <?php
- foreach ($options as $value) {
- $class=($class!='alternate')?"alternate":"alternate1";
- switch ( $value['type'] ) {
- case 'file':
- case 'text':
- agi_option_wrapper_header($value,$class);
- ?><input style="width:400px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" type="<?php echo $value['type']; ?>" value="<?php if ( get_settings( $value['id'] ) != "") { echo get_settings( $value['id'] ); } else { echo $value['std']; } ?>" /><?php
- agi_option_wrapper_footer($value);
- break;
- case 'screenshot':
- agi_option_wrapper_header($value,$class);
- ?><p>In order to test screenshot preview roll over the <a href="http://www.cssglobe.com" class="screenshot" rel="<?php echo $value['url']; ?>">Css Globe</a> link.</p><?php
- agi_option_wrapper_footer($value);
- break;
- case 'select':
- agi_option_wrapper_header($value,$style);
- ?><select style="width:240px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
- <?php foreach ($value['options'] as $option) { ?>
- <option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
- <?php } ?>
- </select><?php
- agi_option_wrapper_footer($value);
- break;
- case 'textarea':
- $ta_options = $value['options'];
- agi_option_wrapper_header($value,$class);
- ?><textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" rows="60" cols="20" style="width:400px;height:100px;"><?php
- if( get_settings($value['id']) != "") {
- echo stripslashes(get_settings($value['id']));
- }else{
- echo $value['std'];
- }?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement