Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $themename = "WPSN";
- $shortname = "stylewp";
- $stylewp_categories_obj = get_categories('hide_empty=0');
- $stylewp_categories = array();
- $sidebarlatest = array("Select a Number:","1","3","4","5","6","7","2","8","9","10","11","13","14","15","16","17","12","18","19","30","31","33","34","35","36","37","32","38","39","40","41","43","44","45","46","47","42","48","49","50","51","53","54","55","56","57","52","58","59","60");
- foreach ($stylewp_categories_obj as $stylewp_cat) {
- $stylewp_categories[$stylewp_cat->cat_ID] = $stylewp_cat->cat_name;
- }
- $categories_tmp = array_unshift($stylewp_categories, "Select a category:");
- $options = array (
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">General Settings</h4></div>",
- "type" => "heading"),
- array( "name" => "Activate News Ticker?",
- "desc" => "Check to activate the RSS news ticker on your frontpage<br />(See users guide for setup instructions)<br /><br />",
- "id" => $shortname."_showticker",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Activate Pages Menu?",
- "desc" => "Check to activate your 'Pages' menu<br /><br />",
- "id" => $shortname."_showpagesmenu",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Activate Categories Menu?",
- "desc" => "Check to activate your 'Categories' menu<br /><br />",
- "id" => $shortname."_showcatsmenu",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Activate Todays Date?",
- "desc" => "Check to activate the date and time in your header<br /><br />",
- "id" => $shortname."_showdate",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "More News Title",
- "desc" => "Edit the more news block.<br /><br />",
- "id" => $shortname."_haveyouread",
- "std" => "Have you read?",
- "type" => "text"),
- array( "name" => "Show 'Top' link?",
- "desc" => "Check to activate the 'top' link in your footer<br /><br />",
- "id" => $shortname."_showtop",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Edit 'Top' text",
- "desc" => "Edit the 'top' link text.<br /><br /><br />",
- "id" => $shortname."_toplink",
- "std" => "Back to the Top",
- "type" => "text"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Google Analytics</h4></div>",
- "type" => "heading"),
- array( "name" => "Analytics Code",
- "desc" => "Paste your Google analytics code here or<br />leave blank to deactivate this setting.<br /><br />",
- "id" => $shortname."_analytics",
- "std" => "",
- "type" => "textarea"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">META Settings</h4></div>",
- "type" => "heading"),
- array( "name" => "Keywords",
- "desc" => "Give your site some META keywords<br /><br />",
- "id" => $shortname."_keywords",
- "std" => "Enter keywords seperated with a comma",
- "type" => "textarea"),
- array( "name" => "Description",
- "desc" => "Give your site a META description<br /><br /><br />",
- "id" => $shortname."_description",
- "std" => "Enter a description for the search engines",
- "type" => "textarea"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Members Menu</h4></div>",
- "type" => "heading"),
- array( "name" => "Home Link",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_toplinks1",
- "std" => "WPSN.com",
- "type" => "text"),
- array( "name" => "Admin Link",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_toplinks3",
- "std" => "MyWPSN",
- "type" => "text"),
- array( "name" => "Profile Link",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_toplinks4",
- "std" => "Profile",
- "type" => "text"),
- array( "name" => "Register Link",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_toplinks5",
- "std" => "Register",
- "type" => "text"),
- array( "name" => "Password Link",
- "desc" => "Give this link a suitable title.<br /><br /><br />",
- "id" => $shortname."_toplinks6",
- "std" => "Forgot Password?",
- "type" => "text"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Search Settings</h4></div>",
- "type" => "heading"),
- array( "name" => "Search Tagline",
- "desc" => "Add a suitable tagline above your frontpage search field.<br /><br />",
- "id" => $shortname."_searchtagline",
- "std" => "Try the powerful WPSN search:",
- "type" => "text"),
- array( "name" => "Search field text",
- "desc" => "Add some text to your search field.<br /><br />",
- "id" => $shortname."_searchline",
- "std" => "Search our site . . .",
- "type" => "text"),
- array( "name" => "Selected Search Text",
- "desc" => "Add some text above your selected search area.<br /><br />",
- "id" => $shortname."_searchestagline",
- "std" => "Selected WPSN searches:",
- "type" => "text"),
- array( "name" => "Search Term #1",
- "desc" => "Add a single-word search term here.<br /><br />",
- "id" => $shortname."_search1",
- "std" => "Rankings",
- "type" => "text"),
- array( "name" => "Search Term #3",
- "desc" => "Add a single-word search term here.<br /><br />",
- "id" => $shortname."_search3",
- "std" => "Fantasy",
- "type" => "text"),
- array( "name" => "Search Term #4",
- "desc" => "Add a single-word search term here.<br /><br />",
- "id" => $shortname."_search4",
- "std" => "Picks",
- "type" => "text"),
- array( "name" => "Search Term #5",
- "desc" => "Add a single-word search term here.<br /><br />",
- "id" => $shortname."_search5",
- "std" => "Injuries",
- "type" => "text"),
- array( "name" => "Search Term #6",
- "desc" => "Add a single-word search term here.<br /><br />",
- "id" => $shortname."_search6",
- "std" => "Projections",
- "type" => "text"),
- array( "name" => "Search Term #7",
- "desc" => "Add a single-word search term here.<br /><br />",
- "id" => $shortname."_search7",
- "std" => "Rookies",
- "type" => "text"),
- array( "name" => "Search Term #2",
- "desc" => "Add a single-word search term here.<br /><br />",
- "id" => $shortname."_search2",
- "std" => "Blogs",
- "type" => "text"),
- array( "name" => "Search Term #8",
- "desc" => "Add a single-word search term here.<br /><br /><br />",
- "id" => $shortname."_search8",
- "std" => "Superbowl",
- "type" => "text"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Frontpage Static Links</h4></div>",
- "type" => "heading"),
- array( "name" => "Sub-Link #1",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_lbox1txt",
- "std" => "Watch: Implications",
- "type" => "text"),
- array( "name" => "Sub-Link URL #1",
- "desc" => "Enter the link destination.<br /><br />",
- "id" => $shortname."_lbox1url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "Sub-Link #3",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_lbox3txt",
- "std" => "Zoom Gallery",
- "type" => "text"),
- array( "name" => "Sub-Link URL #3",
- "desc" => "Enter the link destination.<br /><br />",
- "id" => $shortname."_lbox3url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "Sub-Link #4",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_lbox4txt",
- "std" => "Giants 41 - 45 Redskins",
- "type" => "text"),
- array( "name" => "Sub-Link URL #4",
- "desc" => "Enter the link destination.<br /><br />",
- "id" => $shortname."_lbox4url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "Sub-Link #5",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_lbox5txt",
- "std" => "Leap of faith",
- "type" => "text"),
- array( "name" => "Sub-Link URL #5",
- "desc" => "Enter the link destination.<br /><br />",
- "id" => $shortname."_lbox5url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "Sub-Link #6",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_lbox6txt",
- "std" => "Bulls 99 - 103 Lakers",
- "type" => "text"),
- array( "name" => "Sub-Link URL #6",
- "desc" => "Enter the link destination.<br /><br />",
- "id" => $shortname."_lbox6url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "Sub-Link #7",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_lbox7txt",
- "std" => "NFL Europa LIVE!",
- "type" => "text"),
- array( "name" => "Sub-Link URL #7",
- "desc" => "Enter the link destination.<br /><br />",
- "id" => $shortname."_lbox7url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Selectable News Block</h4></div>",
- "type" => "heading"),
- array( "name" => "Item #1",
- "desc" => "Select the category this area will display news from.<br /><br />",
- "id" => $shortname."_fl1l",
- "std" => "Select a category:",
- "type" => "select",
- "options" => $stylewp_categories),
- array( "name" => "Item #3",
- "desc" => "Select the category this area will display news from.<br /><br />",
- "id" => $shortname."_fl3l",
- "std" => "Select a category:",
- "type" => "select",
- "options" => $stylewp_categories),
- array( "name" => "Item #4",
- "desc" => "Select the category this area will display news from.<br /><br />",
- "id" => $shortname."_fl4l",
- "std" => "Select a category:",
- "type" => "select",
- "options" => $stylewp_categories),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Latest News Links</h4></div>",
- "type" => "heading"),
- array( "name" => "Link #1",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_newslink1",
- "std" => "Latest News",
- "type" => "text"),
- array( "name" => "Link #3",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_newslink3",
- "std" => "Rumor Central",
- "type" => "text"),
- array( "name" => "Link #3 Destination",
- "desc" => "Paste the destination URL for this link.<br /><br />",
- "id" => $shortname."_newslink3url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "Link #4",
- "desc" => "Give this link a suitable title.<br /><br />",
- "id" => $shortname."_newslink4",
- "std" => "On WPSN TV",
- "type" => "text"),
- array( "name" => "Link #4 Destination",
- "desc" => "Paste the destination URL for this link.<br /><br />",
- "id" => $shortname."_newslink4url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Promotional Settings</h4></div>",
- "type" => "heading"),
- array( "name" => "<h5 style=\"color:#cc0000;\">Block #1</h5></div>",
- "type" => "heading"),
- array( "name" => "Block Title",
- "desc" => "Give this block a title.<br /><br /><br />",
- "id" => $shortname."_ptitle",
- "std" => "Featured Promotional Block",
- "type" => "text"),
- array( "name" => "Left Title",
- "desc" => "Enter a header for this block.<br /><br />",
- "id" => $shortname."_p1h1",
- "std" => "This is a suitable title for this block",
- "type" => "text"),
- array( "name" => "Left Image",
- "desc" => "Enter the URL to your chosen image.<br /><br />",
- "id" => $shortname."_p1img",
- "std" => "http://stylewp.com/assets/author_1.jpg",
- "type" => "text"),
- array( "name" => "Left Contents",
- "desc" => "Enter some relevant text here.<br /><br />",
- "id" => $shortname."_p1txt",
- "std" => "This is some text to accompany the above image and is controlled using the built-in theme control panel.",
- "type" => "textarea"),
- array( "name" => "Left Destination",
- "desc" => "Enter the destination URL here.<br /><br /><br />",
- "id" => $shortname."_p1url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "Right Title",
- "desc" => "Enter a header for this block.<br /><br />",
- "id" => $shortname."_p3h1",
- "std" => "This is a suitable title for this block",
- "type" => "text"),
- array( "name" => "Right Image",
- "desc" => "Enter the URL to your chosen image.<br /><br />",
- "id" => $shortname."_p3img",
- "std" => "http://stylewp.com/assets/author_3.jpg",
- "type" => "text"),
- array( "name" => "Right Contents",
- "desc" => "Enter some relevant text here.<br /><br />",
- "id" => $shortname."_p3txt",
- "std" => "This is some text to accompany the above image and is controlled using the built-in theme control panel.",
- "type" => "textarea"),
- array( "name" => "Right Destination",
- "desc" => "Enter the destination URL here.<br /><br /><br />",
- "id" => $shortname."_p3url",
- "std" => "#",
- "type" => "text"),
- array( "name" => "<h5 style=\"color:#cc0000;\">Block #3</h5></div>",
- "type" => "heading"),
- array( "name" => "Block Title",
- "desc" => "Give this block a title.<br /><br /><br />",
- "id" => $shortname."_pbtitle",
- "std" => "Another Promotional Block",
- "type" => "text"),
- array( "name" => "Destination",
- "desc" => "Enter the destination URL here.<br /><br />",
- "id" => $shortname."_pburl",
- "std" => "#",
- "type" => "text"),
- array( "name" => "Image",
- "desc" => "Enter your chosen image URL.<br /><br />",
- "id" => $shortname."_pbimg",
- "std" => "http://stylewp.com/assets/400_promo.jpg",
- "type" => "text"),
- array( "name" => "Alt Text",
- "desc" => "Enter some relevant text which is used as the image alt.<br /><br /><br />",
- "id" => $shortname."_pbalt",
- "std" => "This is a promotional block",
- "type" => "text"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Inner Pages Control</h4></div>",
- "type" => "heading"),
- array( "name" => "Author Sub-Text",
- "desc" => "Edit the line of text underneath each authors name.<br /><br />",
- "id" => $shortname."_authorsub",
- "std" => "for WPSN.com",
- "type" => "text"),
- array( "name" => "Published",
- "desc" => "Edit the published date text.<br /><br />",
- "id" => $shortname."_publishedon",
- "std" => "Published:",
- "type" => "text"),
- array( "name" => "Show Tags?",
- "desc" => "Check to show tags under each news item<br /><br />",
- "id" => $shortname."_showtags",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Show Gravatars?",
- "desc" => "Check to activate <a href=\"http://gravatar.com\">Gravatar</a> support for your comments<br /><br />",
- "id" => $shortname."_showava",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Related Items",
- "desc" => "Edit the Related Items header text.<br /><br />",
- "id" => $shortname."_siderelated",
- "std" => "Related News Headlines",
- "type" => "text"),
- array( "name" => "Latest Items",
- "desc" => "Edit the Latest Items header text.<br /><br />",
- "id" => $shortname."_sidelatest",
- "std" => "WPSN Latest",
- "type" => "text"),
- array( "name" => "How Many Latest Items?",
- "desc" => "Select how many Latest Items to show in your sidebar.",
- "id" => $shortname."_sidebarlatest",
- "std" => "Select a Number:",
- "type" => "select",
- "options" => $sidebarlatest),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Advertisement Settings</h4></div>",
- "type" => "heading"),
- array( "name" => "Spot #1",
- "desc" => "Paste your <b>238x90</b> ad code above.<br /><br />",
- "id" => $shortname."_banner1",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner1.gif\" /></a>",
- "type" => "textarea"),
- array( "name" => "Spot #3",
- "desc" => "Paste your <b>447x380</b> ad code above.<br /><br />",
- "id" => $shortname."_banner3",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner3.gif\" border=\"0\" /></a>",
- "type" => "textarea"),
- array( "name" => "Spot #4",
- "desc" => "Paste your <b>400x60</b> ad code above.<br /><br />",
- "id" => $shortname."_banner4",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner4.gif\" border=\"0\" /></a>",
- "type" => "textarea"),
- array( "name" => "Spot #5",
- "desc" => "Paste your <b>400x360</b> ad code above.<br /><br />",
- "id" => $shortname."_banner5",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner5.gif\" border=\"0\" /></a>",
- "type" => "textarea"),
- array( "name" => "Spot #6 Title",
- "desc" => "Edit the title text above this ad spot.<br /><br />",
- "id" => $shortname."_sponsoredby",
- "std" => "WPSN Recommended Sponsors",
- "type" => "text"),
- array( "name" => "Spot #6",
- "desc" => "Paste your <b>360x360</b> ad code above.<br /><br />",
- "id" => $shortname."_banner6",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner6.gif\" border=\"0\" /></a>",
- "type" => "textarea"),
- array( "name" => "Show Spot #7?",
- "desc" => "Check to activate this banner spot<br /><br />",
- "id" => $shortname."_show7",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Spot #7",
- "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
- "id" => $shortname."_banner7",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner7.gif\" border=\"0\" alt=\"banner 7\" /></a>",
- "type" => "textarea"),
- array( "name" => "Show Spot #2?",
- "desc" => "Check to activate this banner spot<br /><br />",
- "id" => $shortname."_show2",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Spot #2",
- "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
- "id" => $shortname."_banner2",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner2.gif\" border=\"0\" alt=\"banner 2\" /></a>",
- "type" => "textarea"),
- array( "name" => "Show Spot #8?",
- "desc" => "Check to activate this banner spot<br /><br />",
- "id" => $shortname."_show8",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Spot #8",
- "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
- "id" => $shortname."_banner8",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner8.gif\" border=\"0\" alt=\"banner 8\" /></a>",
- "type" => "textarea"),
- array( "name" => "Show Spot #9?",
- "desc" => "Check to activate this banner spot<br /><br />",
- "id" => $shortname."_show9",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Spot #9",
- "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
- "id" => $shortname."_banner9",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner9.gif\" border=\"0\" alt=\"banner 9\" /></a>",
- "type" => "textarea"),
- array( "name" => "Show Spot #10?",
- "desc" => "Check to activate this banner spot<br /><br />",
- "id" => $shortname."_show10",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Spot #10",
- "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
- "id" => $shortname."_banner10",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner10.gif\" border=\"0\" alt=\"banner 10\" /></a>",
- "type" => "textarea"),
- array( "name" => "Show Spot #11?",
- "desc" => "Check to activate this banner spot<br /><br />",
- "id" => $shortname."_show11",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Spot #11 Title",
- "desc" => "Edit the title text above this ad spot.<br /><br />",
- "id" => $shortname."_sptext",
- "std" => "Sponsored Links",
- "type" => "text"),
- array( "name" => "Spot #11",
- "desc" => "Paste your <b>447x380</b> ad code above.<br /><br />",
- "id" => $shortname."_banner11",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner11.gif\" border=\"0\" alt=\"banner 11\" /></a>",
- "type" => "textarea"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Featured Video Settings</h4></div>",
- "type" => "heading"),
- array( "name" => "Show Video?",
- "desc" => "Check to activate the featured video spot on<br />the frontpage.<br /><br />",
- "id" => $shortname."_showvideo",
- "std" => "true",
- "type" => "checkbox"),
- array( "name" => "Embed Code",
- "desc" => "Paste your chosen video embed code here.<br />(Be sure to resize the video to 345x300)<br /><br /><br />",
- "id" => $shortname."_featuredvideo",
- "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_featuredvideo.gif\" border=\"0\" /></a>",
- "type" => "textarea"),
- array( "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Copyright Settings</h4></div>",
- "type" => "heading"),
- array( "name" => "Years",
- "desc" => "Enter the years of copyright<br /><br />",
- "id" => $shortname."_copyyear",
- "std" => "1992 - 3009",
- "type" => "text"),
- array( "name" => "URL",
- "desc" => "Enter the full URL to copyright holders site<br /><br />",
- "id" => $shortname."_copyurl",
- "std" => "http://www.google.com",
- "type" => "text"),
- array( "name" => "Name",
- "desc" => "Enter the copyright holders company name<br /><br />",
- "id" => $shortname."_copyco",
- "std" => "Your Great Company, LLC",
- "type" => "text"),
- array( "name" => "Rights",
- "desc" => "Enter the rights reserved text<br /><br />",
- "id" => $shortname."_copyrights",
- "std" => "All rights reserved.",
- "type" => "text"),
- );
- function mytheme_add_admin() {
- global $themename, $shortname, $options;
- if ( $_GET['page'] == basename(__FILE__) ) {
- if ( 'save' == $_REQUEST['action'] ) {
- foreach ($options 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 ($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=functions.php&saved=true");
- die;
- } else if( 'reset' == $_REQUEST['action'] ) {
- foreach ($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=functions.php&reset=true");
- die;
- }
- }
- add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
- }
- function mytheme_admin() {
- global $themename, $shortname, $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>';
- ?>
- <div class="wrap">
- <h3><?php echo $themename; ?> options</h3>
- <form method="post">
- <table class="optiontable">
- <?php foreach ($options as $value) {
- switch ( $value['type'] ) {
- case 'text':
- option_wrapper_header($value);
- ?>
- <input style="width:500px;" 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
- option_wrapper_footer($value);
- break;
- case 'select':
- option_wrapper_header($value);
- ?>
- <select style="width:350px;" 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
- option_wrapper_footer($value);
- break;
- case 'textarea':
- $ta_options = $value['options'];
- option_wrapper_header($value);
- ?>
- <textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" style="width:500px;height:100px;"><?php
- if( get_settings($value['id']) != "") {
- echo stripslashes(get_settings($value['id']));
- }else{
- echo $value['std'];
- }?></textarea>
- <?php
- option_wrapper_footer($value);
- break;
- case "radio":
- option_wrapper_header($value);
- foreach ($value['options'] as $key=>$option) {
- $radio_setting = get_settings($value['id']);
- if($radio_setting != ''){
- if ($key == get_settings($value['id']) ) {
- $checked = "checked=\"checked\"";
- } else {
- $checked = "";
- }
- }else{
- if($key == $value['std']){
- $checked = "checked=\"checked\"";
- }else{
- $checked = "";
- }
- }?>
- <input type="radio" name="<?php echo $value['id']; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><?php echo $option; ?><br />
- <?php
- }
- option_wrapper_footer($value);
- break;
- case "checkbox":
- option_wrapper_header($value);
- if(get_settings($value['id'])){
- $checked = "checked=\"checked\"";
- }else{
- $checked = "";
- }
- ?>
- <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
- <?php
- option_wrapper_footer($value);
- break;
- case "multicheck":
- option_wrapper_header($value);
- foreach ($value['options'] as $key=>$option) {
- $pn_key = $value['id'] . '_' . $key;
- $checkbox_setting = get_settings($pn_key);
- if($checkbox_setting != ''){
- if (get_settings($pn_key) ) {
- $checked = "checked=\"checked\"";
- } else {
- $checked = "";
- }
- }else{
- if($key == $value['std']){
- $checked = "checked=\"checked\"";
- }else{
- $checked = "";
- }
- }?>
- <input type="checkbox" name="<?php echo $pn_key; ?>" id="<?php echo $pn_key; ?>" value="true" <?php echo $checked; ?> /><label for="<?php echo $pn_key; ?>"><?php echo $option; ?></label><br />
- <?php
- }
- option_wrapper_footer($value);
- break;
- case "heading":
- ?>
- <tr valign="top">
- <td colspan="3" style="text-align: center;"><h4><?php echo $value['name']; ?></h4></td>
- </tr>
- <?php
- break;
- default:
- break;
- }
- }
- ?>
- </table>
- <p class="submit">
- <input name="save" type="submit" value="Save changes" />
- <input type="hidden" name="action" value="save" />
- </p>
- </form>
- <form method="post">
- <p class="submit">
- <input name="reset" type="submit" value="Reset" />
- <input type="hidden" name="action" value="reset" />
- </p>
- </form>
- <?php
- }
- function option_wrapper_header($values){
- ?>
- <tr valign="top">
- <th scope="row"><?php echo $values['name']; ?>:</th>
- <td>
- <?php
- }
- function option_wrapper_footer($values){
- ?>
- </td>
- </tr>
- <tr valign="top">
- <td> </td><td><small><?php echo $values['desc']; ?></small></td>
- </tr>
- <?php
- }
- function mytheme_wp_head() {
- $stylesheet = get_option('revmag_alt_stylesheet');
- if($stylesheet != ''){
- }
- }
- add_action('wp_head', 'mytheme_wp_head');
- add_action('admin_menu', 'mytheme_add_admin');
- 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>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement