Advertisement
Guest User

Atul

a guest
Jun 3rd, 2010
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 31.53 KB | None | 0 0
  1. <?php
  2.  
  3. $themename = "WPSN";
  4. $shortname = "stylewp";
  5.  
  6. $stylewp_categories_obj = get_categories('hide_empty=0');
  7. $stylewp_categories = array();
  8.  
  9. $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");
  10.  
  11. foreach ($stylewp_categories_obj as $stylewp_cat) {
  12. $stylewp_categories[$stylewp_cat->cat_ID] = $stylewp_cat->cat_name;
  13. }
  14.  
  15. $categories_tmp = array_unshift($stylewp_categories, "Select a category:");
  16.  
  17. $options = array (
  18.  
  19.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">General Settings</h4></div>",
  20.                         "type" => "heading"),
  21.  
  22.                 array(  "name" => "Activate News Ticker?",
  23.                         "desc" => "Check to activate the RSS news ticker on your frontpage<br />(See users guide for setup instructions)<br /><br />",
  24.                         "id" => $shortname."_showticker",
  25.                         "std" => "true",
  26.                         "type" => "checkbox"),
  27.  
  28.                 array(  "name" => "Activate Pages Menu?",
  29.                         "desc" => "Check to activate your 'Pages' menu<br /><br />",
  30.                         "id" => $shortname."_showpagesmenu",
  31.                         "std" => "true",
  32.                         "type" => "checkbox"),
  33.  
  34.                 array(  "name" => "Activate Categories Menu?",
  35.                         "desc" => "Check to activate your 'Categories' menu<br /><br />",
  36.                         "id" => $shortname."_showcatsmenu",
  37.                         "std" => "true",
  38.                         "type" => "checkbox"),
  39.  
  40.                 array(  "name" => "Activate Todays Date?",
  41.                         "desc" => "Check to activate the date and time in your header<br /><br />",
  42.                         "id" => $shortname."_showdate",
  43.                         "std" => "true",
  44.                         "type" => "checkbox"),
  45.  
  46.                 array(  "name" => "More News Title",
  47.                         "desc" => "Edit the more news block.<br /><br />",
  48.                         "id" => $shortname."_haveyouread",
  49.                         "std" => "Have you read?",
  50.                         "type" => "text"),
  51.  
  52.                 array(  "name" => "Show 'Top' link?",
  53.                         "desc" => "Check to activate the 'top' link in your footer<br /><br />",
  54.                         "id" => $shortname."_showtop",
  55.                         "std" => "true",
  56.                         "type" => "checkbox"),
  57.  
  58.                 array(  "name" => "Edit 'Top' text",
  59.                         "desc" => "Edit the 'top' link text.<br /><br /><br />",
  60.                         "id" => $shortname."_toplink",
  61.                         "std" => "Back to the Top",
  62.                         "type" => "text"),
  63.  
  64.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Google Analytics</h4></div>",
  65.                         "type" => "heading"),
  66.  
  67.                 array(  "name" => "Analytics Code",
  68.                         "desc" => "Paste your Google analytics code here or<br />leave blank to deactivate this setting.<br /><br />",
  69.                         "id" => $shortname."_analytics",
  70.                         "std" => "",
  71.                         "type" => "textarea"),
  72.  
  73.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">META Settings</h4></div>",
  74.                         "type" => "heading"),
  75.  
  76.                 array(  "name" => "Keywords",
  77.                         "desc" => "Give your site some META keywords<br /><br />",
  78.                         "id" => $shortname."_keywords",
  79.                         "std" => "Enter keywords seperated with a comma",
  80.                         "type" => "textarea"),
  81.  
  82.                 array(  "name" => "Description",
  83.                         "desc" => "Give your site a META description<br /><br /><br />",
  84.                         "id" => $shortname."_description",
  85.                         "std" => "Enter a description for the search engines",
  86.                         "type" => "textarea"),
  87.  
  88.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Members Menu</h4></div>",
  89.                         "type" => "heading"),
  90.  
  91.                 array(  "name" => "Home Link",
  92.                         "desc" => "Give this link a suitable title.<br /><br />",
  93.                         "id" => $shortname."_toplinks1",
  94.                         "std" => "WPSN.com",
  95.                         "type" => "text"),
  96.  
  97.                 array(  "name" => "Admin Link",
  98.                         "desc" => "Give this link a suitable title.<br /><br />",
  99.                         "id" => $shortname."_toplinks3",
  100.                         "std" => "MyWPSN",
  101.                         "type" => "text"),
  102.  
  103.                 array(  "name" => "Profile Link",
  104.                         "desc" => "Give this link a suitable title.<br /><br />",
  105.                         "id" => $shortname."_toplinks4",
  106.                         "std" => "Profile",
  107.                         "type" => "text"),
  108.  
  109.                 array(  "name" => "Register Link",
  110.                         "desc" => "Give this link a suitable title.<br /><br />",
  111.                         "id" => $shortname."_toplinks5",
  112.                         "std" => "Register",
  113.                         "type" => "text"),
  114.  
  115.                 array(  "name" => "Password Link",
  116.                         "desc" => "Give this link a suitable title.<br /><br /><br />",
  117.                         "id" => $shortname."_toplinks6",
  118.                         "std" => "Forgot Password?",
  119.                         "type" => "text"),
  120.  
  121.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Search Settings</h4></div>",
  122.                         "type" => "heading"),
  123.  
  124.                 array(  "name" => "Search Tagline",
  125.                         "desc" => "Add a suitable tagline above your frontpage search field.<br /><br />",
  126.                         "id" => $shortname."_searchtagline",
  127.                         "std" => "Try the powerful WPSN search:",
  128.                         "type" => "text"),
  129.  
  130.                 array(  "name" => "Search field text",
  131.                         "desc" => "Add some text to your search field.<br /><br />",
  132.                         "id" => $shortname."_searchline",
  133.                         "std" => "Search our site . . .",
  134.                         "type" => "text"),
  135.  
  136.                 array(  "name" => "Selected Search Text",
  137.                         "desc" => "Add some text above your selected search area.<br /><br />",
  138.                         "id" => $shortname."_searchestagline",
  139.                         "std" => "Selected WPSN searches:",
  140.                         "type" => "text"),
  141.  
  142.                 array(  "name" => "Search Term #1",
  143.                         "desc" => "Add a single-word search term here.<br /><br />",
  144.                         "id" => $shortname."_search1",
  145.                         "std" => "Rankings",
  146.                         "type" => "text"),
  147.  
  148.                 array(  "name" => "Search Term #3",
  149.                         "desc" => "Add a single-word search term here.<br /><br />",
  150.                         "id" => $shortname."_search3",
  151.                         "std" => "Fantasy",
  152.                         "type" => "text"),
  153.  
  154.                 array(  "name" => "Search Term #4",
  155.                         "desc" => "Add a single-word search term here.<br /><br />",
  156.                         "id" => $shortname."_search4",
  157.                         "std" => "Picks",
  158.                         "type" => "text"),
  159.  
  160.                 array(  "name" => "Search Term #5",
  161.                         "desc" => "Add a single-word search term here.<br /><br />",
  162.                         "id" => $shortname."_search5",
  163.                         "std" => "Injuries",
  164.                         "type" => "text"),
  165.  
  166.                 array(  "name" => "Search Term #6",
  167.                         "desc" => "Add a single-word search term here.<br /><br />",
  168.                         "id" => $shortname."_search6",
  169.                         "std" => "Projections",
  170.                         "type" => "text"),
  171.  
  172.                 array(  "name" => "Search Term #7",
  173.                         "desc" => "Add a single-word search term here.<br /><br />",
  174.                         "id" => $shortname."_search7",
  175.                         "std" => "Rookies",
  176.                         "type" => "text"),
  177.  
  178.                 array(  "name" => "Search Term #2",
  179.                         "desc" => "Add a single-word search term here.<br /><br />",
  180.                         "id" => $shortname."_search2",
  181.                         "std" => "Blogs",
  182.                         "type" => "text"),
  183.  
  184.                 array(  "name" => "Search Term #8",
  185.                         "desc" => "Add a single-word search term here.<br /><br /><br />",
  186.                         "id" => $shortname."_search8",
  187.                         "std" => "Superbowl",
  188.                         "type" => "text"),
  189.  
  190.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Frontpage Static Links</h4></div>",
  191.                         "type" => "heading"),
  192.  
  193.                 array(  "name" => "Sub-Link #1",
  194.                         "desc" => "Give this link a suitable title.<br /><br />",
  195.                         "id" => $shortname."_lbox1txt",
  196.                         "std" => "Watch: Implications",
  197.                         "type" => "text"),
  198.  
  199.                 array(  "name" => "Sub-Link URL #1",
  200.                         "desc" => "Enter the link destination.<br /><br />",
  201.                         "id" => $shortname."_lbox1url",
  202.                         "std" => "#",
  203.                         "type" => "text"),
  204.  
  205.                 array(  "name" => "Sub-Link #3",
  206.                         "desc" => "Give this link a suitable title.<br /><br />",
  207.                         "id" => $shortname."_lbox3txt",
  208.                         "std" => "Zoom Gallery",
  209.                         "type" => "text"),
  210.  
  211.                 array(  "name" => "Sub-Link URL #3",
  212.                         "desc" => "Enter the link destination.<br /><br />",
  213.                         "id" => $shortname."_lbox3url",
  214.                         "std" => "#",
  215.                         "type" => "text"),
  216.  
  217.                 array(  "name" => "Sub-Link #4",
  218.                         "desc" => "Give this link a suitable title.<br /><br />",
  219.                         "id" => $shortname."_lbox4txt",
  220.                         "std" => "Giants 41 - 45 Redskins",
  221.                         "type" => "text"),
  222.  
  223.                 array(  "name" => "Sub-Link URL #4",
  224.                         "desc" => "Enter the link destination.<br /><br />",
  225.                         "id" => $shortname."_lbox4url",
  226.                         "std" => "#",
  227.                         "type" => "text"),
  228.  
  229.                 array(  "name" => "Sub-Link #5",
  230.                         "desc" => "Give this link a suitable title.<br /><br />",
  231.                         "id" => $shortname."_lbox5txt",
  232.                         "std" => "Leap of faith",
  233.                         "type" => "text"),
  234.  
  235.                 array(  "name" => "Sub-Link URL #5",
  236.                         "desc" => "Enter the link destination.<br /><br />",
  237.                         "id" => $shortname."_lbox5url",
  238.                         "std" => "#",
  239.                         "type" => "text"),
  240.  
  241.                 array(  "name" => "Sub-Link #6",
  242.                         "desc" => "Give this link a suitable title.<br /><br />",
  243.                         "id" => $shortname."_lbox6txt",
  244.                         "std" => "Bulls 99 - 103 Lakers",
  245.                         "type" => "text"),
  246.  
  247.                 array(  "name" => "Sub-Link URL #6",
  248.                         "desc" => "Enter the link destination.<br /><br />",
  249.                         "id" => $shortname."_lbox6url",
  250.                         "std" => "#",
  251.                         "type" => "text"),
  252.  
  253.                 array(  "name" => "Sub-Link #7",
  254.                         "desc" => "Give this link a suitable title.<br /><br />",
  255.                         "id" => $shortname."_lbox7txt",
  256.                         "std" => "NFL Europa LIVE!",
  257.                         "type" => "text"),
  258.  
  259.                 array(  "name" => "Sub-Link URL #7",
  260.                         "desc" => "Enter the link destination.<br /><br />",
  261.                         "id" => $shortname."_lbox7url",
  262.                         "std" => "#",
  263.                         "type" => "text"),
  264.  
  265.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Selectable News Block</h4></div>",
  266.                         "type" => "heading"),
  267.  
  268.                 array(  "name" => "Item #1",
  269.                         "desc" => "Select the category this area will display news from.<br /><br />",
  270.                         "id" => $shortname."_fl1l",
  271.                         "std" => "Select a category:",
  272.                         "type" => "select",
  273.                         "options" => $stylewp_categories),
  274.  
  275.                 array(  "name" => "Item #3",
  276.                         "desc" => "Select the category this area will display news from.<br /><br />",
  277.                         "id" => $shortname."_fl3l",
  278.                         "std" => "Select a category:",
  279.                         "type" => "select",
  280.                         "options" => $stylewp_categories),
  281.  
  282.                 array(  "name" => "Item #4",
  283.                         "desc" => "Select the category this area will display news from.<br /><br />",
  284.                         "id" => $shortname."_fl4l",
  285.                         "std" => "Select a category:",
  286.                         "type" => "select",
  287.                         "options" => $stylewp_categories),
  288.  
  289.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Latest News Links</h4></div>",
  290.                         "type" => "heading"),
  291.  
  292.                 array(  "name" => "Link #1",
  293.                         "desc" => "Give this link a suitable title.<br /><br />",
  294.                         "id" => $shortname."_newslink1",
  295.                         "std" => "Latest News",
  296.                         "type" => "text"),
  297.  
  298.                 array(  "name" => "Link #3",
  299.                         "desc" => "Give this link a suitable title.<br /><br />",
  300.                         "id" => $shortname."_newslink3",
  301.                         "std" => "Rumor Central",
  302.                         "type" => "text"),
  303.  
  304.                 array(  "name" => "Link #3 Destination",
  305.                         "desc" => "Paste the destination URL for this link.<br /><br />",
  306.                         "id" => $shortname."_newslink3url",
  307.                         "std" => "#",
  308.                         "type" => "text"),
  309.  
  310.                 array(  "name" => "Link #4",
  311.                         "desc" => "Give this link a suitable title.<br /><br />",
  312.                         "id" => $shortname."_newslink4",
  313.                         "std" => "On WPSN TV",
  314.                         "type" => "text"),
  315.  
  316.                 array(  "name" => "Link #4 Destination",
  317.                         "desc" => "Paste the destination URL for this link.<br /><br />",
  318.                         "id" => $shortname."_newslink4url",
  319.                         "std" => "#",
  320.                         "type" => "text"),
  321.  
  322.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Promotional Settings</h4></div>",
  323.                         "type" => "heading"),
  324.  
  325.                 array(  "name" => "<h5 style=\"color:#cc0000;\">Block #1</h5></div>",
  326.                         "type" => "heading"),
  327.  
  328.                 array(  "name" => "Block Title",
  329.                         "desc" => "Give this block a title.<br /><br /><br />",
  330.                         "id" => $shortname."_ptitle",
  331.                         "std" => "Featured Promotional Block",
  332.                         "type" => "text"),
  333.  
  334.                 array(  "name" => "Left Title",
  335.                         "desc" => "Enter a header for this block.<br /><br />",
  336.                         "id" => $shortname."_p1h1",
  337.                         "std" => "This is a suitable title for this block",
  338.                         "type" => "text"),
  339.  
  340.                 array(  "name" => "Left Image",
  341.                         "desc" => "Enter the URL to your chosen image.<br /><br />",
  342.                         "id" => $shortname."_p1img",
  343.                         "std" => "http://stylewp.com/assets/author_1.jpg",
  344.                         "type" => "text"),
  345.  
  346.                 array(  "name" => "Left Contents",
  347.                         "desc" => "Enter some relevant text here.<br /><br />",
  348.                         "id" => $shortname."_p1txt",
  349.                         "std" => "This is some text to accompany the above image and is controlled using the built-in theme control panel.",
  350.                         "type" => "textarea"),
  351.  
  352.                 array(  "name" => "Left Destination",
  353.                         "desc" => "Enter the destination URL here.<br /><br /><br />",
  354.                         "id" => $shortname."_p1url",
  355.                         "std" => "#",
  356.                         "type" => "text"),
  357.  
  358.                 array(  "name" => "Right Title",
  359.                         "desc" => "Enter a header for this block.<br /><br />",
  360.                         "id" => $shortname."_p3h1",
  361.                         "std" => "This is a suitable title for this block",
  362.                         "type" => "text"),
  363.  
  364.                 array(  "name" => "Right Image",
  365.                         "desc" => "Enter the URL to your chosen image.<br /><br />",
  366.                         "id" => $shortname."_p3img",
  367.                         "std" => "http://stylewp.com/assets/author_3.jpg",
  368.                         "type" => "text"),
  369.  
  370.                 array(  "name" => "Right Contents",
  371.                         "desc" => "Enter some relevant text here.<br /><br />",
  372.                         "id" => $shortname."_p3txt",
  373.                         "std" => "This is some text to accompany the above image and is controlled using the built-in theme control panel.",
  374.                         "type" => "textarea"),
  375.  
  376.                 array(  "name" => "Right Destination",
  377.                         "desc" => "Enter the destination URL here.<br /><br /><br />",
  378.                         "id" => $shortname."_p3url",
  379.                         "std" => "#",
  380.                         "type" => "text"),
  381.  
  382.                 array(  "name" => "<h5 style=\"color:#cc0000;\">Block #3</h5></div>",
  383.                         "type" => "heading"),
  384.  
  385.                 array(  "name" => "Block Title",
  386.                         "desc" => "Give this block a title.<br /><br /><br />",
  387.                         "id" => $shortname."_pbtitle",
  388.                         "std" => "Another Promotional Block",
  389.                         "type" => "text"),
  390.  
  391.                 array(  "name" => "Destination",
  392.                         "desc" => "Enter the destination URL here.<br /><br />",
  393.                         "id" => $shortname."_pburl",
  394.                         "std" => "#",
  395.                         "type" => "text"),
  396.  
  397.                 array(  "name" => "Image",
  398.                         "desc" => "Enter your chosen image URL.<br /><br />",
  399.                         "id" => $shortname."_pbimg",
  400.                         "std" => "http://stylewp.com/assets/400_promo.jpg",
  401.                         "type" => "text"),
  402.  
  403.                 array(  "name" => "Alt Text",
  404.                         "desc" => "Enter some relevant text which is used as the image alt.<br /><br /><br />",
  405.                         "id" => $shortname."_pbalt",
  406.                         "std" => "This is a promotional block",
  407.                         "type" => "text"),
  408.  
  409.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Inner Pages Control</h4></div>",
  410.  
  411.                         "type" => "heading"),
  412.  
  413.                 array(  "name" => "Author Sub-Text",
  414.                         "desc" => "Edit the line of text underneath each authors name.<br /><br />",
  415.                         "id" => $shortname."_authorsub",
  416.                         "std" => "for WPSN.com",
  417.                         "type" => "text"),
  418.  
  419.                 array(  "name" => "Published",
  420.                         "desc" => "Edit the published date text.<br /><br />",
  421.                         "id" => $shortname."_publishedon",
  422.                         "std" => "Published:",
  423.                         "type" => "text"),
  424.  
  425.                 array(  "name" => "Show Tags?",
  426.                         "desc" => "Check to show tags under each news item<br /><br />",
  427.                         "id" => $shortname."_showtags",
  428.                         "std" => "true",
  429.                         "type" => "checkbox"),
  430.  
  431.                 array(  "name" => "Show Gravatars?",
  432.                         "desc" => "Check to activate <a href=\"http://gravatar.com\">Gravatar</a> support for your comments<br /><br />",
  433.                         "id" => $shortname."_showava",
  434.                         "std" => "true",
  435.                         "type" => "checkbox"),
  436.  
  437.                 array(  "name" => "Related Items",
  438.                         "desc" => "Edit the Related Items header text.<br /><br />",
  439.                         "id" => $shortname."_siderelated",
  440.                         "std" => "Related News Headlines",
  441.                         "type" => "text"),
  442.  
  443.                 array(  "name" => "Latest Items",
  444.                         "desc" => "Edit the Latest Items header text.<br /><br />",
  445.                         "id" => $shortname."_sidelatest",
  446.                         "std" => "WPSN Latest",
  447.                         "type" => "text"),
  448.  
  449.                 array(  "name" => "How Many Latest Items?",
  450.                         "desc" => "Select how many Latest Items to show in your sidebar.",
  451.                         "id" => $shortname."_sidebarlatest",
  452.                         "std" => "Select a Number:",
  453.                         "type" => "select",
  454.                         "options" => $sidebarlatest),
  455.  
  456.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Advertisement Settings</h4></div>",
  457.                         "type" => "heading"),
  458.  
  459.                 array(  "name" => "Spot #1",
  460.                         "desc" => "Paste your <b>238x90</b> ad code above.<br /><br />",
  461.                         "id" => $shortname."_banner1",
  462.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner1.gif\" /></a>",
  463.                         "type" => "textarea"), 
  464.  
  465.                 array(  "name" => "Spot #3",
  466.                         "desc" => "Paste your <b>447x380</b> ad code above.<br /><br />",
  467.                         "id" => $shortname."_banner3",
  468.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner3.gif\" border=\"0\" /></a>",
  469.                         "type" => "textarea"), 
  470.  
  471.                 array(  "name" => "Spot #4",
  472.                         "desc" => "Paste your <b>400x60</b> ad code above.<br /><br />",
  473.                         "id" => $shortname."_banner4",
  474.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner4.gif\" border=\"0\" /></a>",
  475.                         "type" => "textarea"),
  476.  
  477.                 array(  "name" => "Spot #5",
  478.                         "desc" => "Paste your <b>400x360</b> ad code above.<br /><br />",
  479.                         "id" => $shortname."_banner5",
  480.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner5.gif\" border=\"0\" /></a>",
  481.                         "type" => "textarea"),
  482.  
  483.                 array(  "name" => "Spot #6 Title",
  484.                         "desc" => "Edit the title text above this ad spot.<br /><br />",
  485.                         "id" => $shortname."_sponsoredby",
  486.                         "std" => "WPSN Recommended Sponsors",
  487.                         "type" => "text"),
  488.  
  489.                 array(  "name" => "Spot #6",
  490.                         "desc" => "Paste your <b>360x360</b> ad code above.<br /><br />",
  491.                         "id" => $shortname."_banner6",
  492.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner6.gif\" border=\"0\" /></a>",
  493.                         "type" => "textarea"),
  494.  
  495.                 array(  "name" => "Show Spot #7?",
  496.                         "desc" => "Check to activate this banner spot<br /><br />",
  497.                         "id" => $shortname."_show7",
  498.                         "std" => "true",
  499.                         "type" => "checkbox"),
  500.  
  501.                 array(  "name" => "Spot #7",
  502.                         "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
  503.                         "id" => $shortname."_banner7",
  504.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner7.gif\" border=\"0\" alt=\"banner 7\" /></a>",
  505.                         "type" => "textarea"),
  506.  
  507.                 array(  "name" => "Show Spot #2?",
  508.                         "desc" => "Check to activate this banner spot<br /><br />",
  509.                         "id" => $shortname."_show2",
  510.                         "std" => "true",
  511.                         "type" => "checkbox"),
  512.  
  513.                 array(  "name" => "Spot #2",
  514.                         "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
  515.                         "id" => $shortname."_banner2",
  516.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner2.gif\" border=\"0\" alt=\"banner 2\" /></a>",
  517.                         "type" => "textarea"),
  518.  
  519.                 array(  "name" => "Show Spot #8?",
  520.                         "desc" => "Check to activate this banner spot<br /><br />",
  521.                         "id" => $shortname."_show8",
  522.                         "std" => "true",
  523.                         "type" => "checkbox"),
  524.  
  525.                 array(  "name" => "Spot #8",
  526.                         "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
  527.                         "id" => $shortname."_banner8",
  528.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner8.gif\" border=\"0\" alt=\"banner 8\" /></a>",
  529.                         "type" => "textarea"),
  530.  
  531.                 array(  "name" => "Show Spot #9?",
  532.                         "desc" => "Check to activate this banner spot<br /><br />",
  533.                         "id" => $shortname."_show9",
  534.                         "std" => "true",
  535.                         "type" => "checkbox"),
  536.  
  537.                 array(  "name" => "Spot #9",
  538.                         "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
  539.                         "id" => $shortname."_banner9",
  540.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner9.gif\" border=\"0\" alt=\"banner 9\" /></a>",
  541.                         "type" => "textarea"),
  542.  
  543.                 array(  "name" => "Show Spot #10?",
  544.                         "desc" => "Check to activate this banner spot<br /><br />",
  545.                         "id" => $shortname."_show10",
  546.                         "std" => "true",
  547.                         "type" => "checkbox"),
  548.  
  549.                 array(  "name" => "Spot #10",
  550.                         "desc" => "Paste your <b>345x160</b> ad code above.<br /><br />",
  551.                         "id" => $shortname."_banner10",
  552.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner10.gif\" border=\"0\" alt=\"banner 10\" /></a>",
  553.                         "type" => "textarea"),
  554.  
  555.                 array(  "name" => "Show Spot #11?",
  556.                         "desc" => "Check to activate this banner spot<br /><br />",
  557.                         "id" => $shortname."_show11",
  558.                         "std" => "true",
  559.                         "type" => "checkbox"),
  560.  
  561.                 array(  "name" => "Spot #11 Title",
  562.                         "desc" => "Edit the title text above this ad spot.<br /><br />",
  563.                         "id" => $shortname."_sptext",
  564.                         "std" => "Sponsored Links",
  565.                         "type" => "text"),
  566.  
  567.                 array(  "name" => "Spot #11",
  568.                         "desc" => "Paste your <b>447x380</b> ad code above.<br /><br />",
  569.                         "id" => $shortname."_banner11",
  570.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_banner11.gif\" border=\"0\" alt=\"banner 11\" /></a>",
  571.                         "type" => "textarea"),
  572.  
  573.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Featured Video Settings</h4></div>",
  574.                         "type" => "heading"),
  575.  
  576.                 array(  "name" => "Show Video?",
  577.                         "desc" => "Check to activate the featured video spot on<br />the frontpage.<br /><br />",
  578.                         "id" => $shortname."_showvideo",
  579.                         "std" => "true",
  580.                         "type" => "checkbox"),
  581.  
  582.                 array(  "name" => "Embed Code",
  583.                         "desc" => "Paste your chosen video embed code here.<br />(Be sure to resize the video to 345x300)<br /><br /><br />",
  584.                         "id" => $shortname."_featuredvideo",
  585.                         "std" => "<a href=\"#\"><img src=\"http://stylewp.com/assets/defaults/wpsn_featuredvideo.gif\" border=\"0\" /></a>",
  586.                         "type" => "textarea"), 
  587.  
  588.                 array(  "name" => "<div style=\"width:800px;padding:30px;background:#ffeded;\"><h4 style=\"color:#1c1c1c;\">Copyright Settings</h4></div>",
  589.                         "type" => "heading"),
  590.  
  591.                 array(  "name" => "Years",
  592.                         "desc" => "Enter the years of copyright<br /><br />",
  593.                         "id" => $shortname."_copyyear",
  594.                         "std" => "1992 - 3009",
  595.                         "type" => "text"),
  596.  
  597.                 array(  "name" => "URL",
  598.                         "desc" => "Enter the full URL to copyright holders site<br /><br />",
  599.                         "id" => $shortname."_copyurl",
  600.                         "std" => "http://www.google.com",
  601.                         "type" => "text"),
  602.  
  603.                 array(  "name" => "Name",
  604.                         "desc" => "Enter the copyright holders company name<br /><br />",
  605.                         "id" => $shortname."_copyco",
  606.                         "std" => "Your Great Company, LLC",
  607.                         "type" => "text"),
  608.  
  609.                 array(  "name" => "Rights",
  610.                         "desc" => "Enter the rights reserved text<br /><br />",
  611.                         "id" => $shortname."_copyrights",
  612.                         "std" => "All rights reserved.",
  613.                         "type" => "text"),
  614.                                                                                                                        
  615.           );
  616.        
  617. function mytheme_add_admin() {
  618.  
  619.     global $themename, $shortname, $options;
  620.  
  621.     if ( $_GET['page'] == basename(__FILE__) ) {
  622.    
  623.         if ( 'save' == $_REQUEST['action'] ) {
  624.  
  625.                 foreach ($options as $value) {
  626.                     if($value['type'] != 'multicheck'){
  627.                         update_option( $value['id'], $_REQUEST[ $value['id'] ] );
  628.                     }else{
  629.                         foreach($value['options'] as $mc_key => $mc_value){
  630.                             $up_opt = $value['id'].'_'.$mc_key;
  631.                             update_option($up_opt, $_REQUEST[$up_opt] );
  632.                         }
  633.                     }
  634.                 }
  635.  
  636.                 foreach ($options as $value) {
  637.                     if($value['type'] != 'multicheck'){
  638.                         if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); }
  639.                     }else{
  640.                         foreach($value['options'] as $mc_key => $mc_value){
  641.                             $up_opt = $value['id'].'_'.$mc_key;                    
  642.                             if( isset( $_REQUEST[ $up_opt ] ) ) { update_option( $up_opt, $_REQUEST[ $up_opt ]  ); } else { delete_option( $up_opt ); }
  643.                         }
  644.                     }
  645.                 }
  646.                 header("Location: themes.php?page=functions.php&saved=true");
  647.                 die;
  648.  
  649.         } else if( 'reset' == $_REQUEST['action'] ) {
  650.  
  651.             foreach ($options as $value) {
  652.                 if($value['type'] != 'multicheck'){
  653.                     delete_option( $value['id'] );
  654.                 }else{
  655.                     foreach($value['options'] as $mc_key => $mc_value){
  656.                         $del_opt = $value['id'].'_'.$mc_key;
  657.                         delete_option($del_opt);
  658.                     }
  659.                 }
  660.             }
  661.             header("Location: themes.php?page=functions.php&reset=true");
  662.             die;
  663.  
  664.         }
  665.     }
  666.  
  667.     add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
  668.  
  669. }
  670.  
  671. function mytheme_admin() {
  672.  
  673.     global $themename, $shortname, $options;
  674.  
  675.     if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings saved.</strong></p></div>';
  676.     if ( $_REQUEST['reset'] ) echo '<div id="message" class="updated fade"><p><strong>'.$themename.' settings reset.</strong></p></div>';
  677.    
  678. ?>
  679. <div class="wrap">
  680. <h3><?php echo $themename; ?> options</h3>
  681.  
  682. <form method="post">
  683.  
  684. <table class="optiontable">
  685.  
  686. <?php foreach ($options as $value) {
  687.    
  688.     switch ( $value['type'] ) {
  689.         case 'text':
  690.         option_wrapper_header($value);
  691.  
  692.         ?>
  693.                 <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']; } ?>" />
  694.         <?php
  695.         option_wrapper_footer($value);
  696.         break;
  697.        
  698.         case 'select':
  699.         option_wrapper_header($value);
  700.         ?>
  701.                 <select style="width:350px;" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">
  702.                     <?php foreach ($value['options'] as $option) { ?>
  703.                     <option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"'; } elseif ($option == $value['std']) { echo ' selected="selected"'; } ?>><?php echo $option; ?></option>
  704.                     <?php } ?>
  705.                 </select>
  706.         <?php
  707.         option_wrapper_footer($value);
  708.         break;
  709.        
  710.         case 'textarea':
  711.  
  712.  
  713.         $ta_options = $value['options'];
  714.         option_wrapper_header($value);
  715.         ?>
  716.                 <textarea name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" style="width:500px;height:100px;"><?php
  717.  
  718.                 if( get_settings($value['id']) != "") {
  719.                         echo stripslashes(get_settings($value['id']));
  720.                     }else{
  721.                         echo $value['std'];
  722.                 }?></textarea>
  723.  
  724.  
  725.         <?php
  726.         option_wrapper_footer($value);
  727.         break;
  728.  
  729.         case "radio":
  730.         option_wrapper_header($value);
  731.        
  732.         foreach ($value['options'] as $key=>$option) {
  733.                 $radio_setting = get_settings($value['id']);
  734.                 if($radio_setting != ''){
  735.                     if ($key == get_settings($value['id']) ) {
  736.                         $checked = "checked=\"checked\"";
  737.                         } else {
  738.                             $checked = "";
  739.                         }
  740.                 }else{
  741.                     if($key == $value['std']){
  742.                         $checked = "checked=\"checked\"";
  743.                     }else{
  744.                         $checked = "";
  745.  
  746.                     }
  747.                 }?>
  748.                 <input type="radio" name="<?php echo $value['id']; ?>" value="<?php echo $key; ?>" <?php echo $checked; ?> /><?php echo $option; ?><br />
  749.         <?php
  750.         }
  751.          
  752.         option_wrapper_footer($value);
  753.         break;
  754.        
  755.         case "checkbox":
  756.         option_wrapper_header($value);
  757.                         if(get_settings($value['id'])){
  758.                             $checked = "checked=\"checked\"";
  759.                         }else{
  760.                             $checked = "";
  761.                         }
  762.                     ?>
  763.                     <input type="checkbox" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>" value="true" <?php echo $checked; ?> />
  764.         <?php
  765.         option_wrapper_footer($value);
  766.         break;
  767.  
  768.         case "multicheck":
  769.         option_wrapper_header($value);
  770.        
  771.         foreach ($value['options'] as $key=>$option) {
  772.                 $pn_key = $value['id'] . '_' . $key;
  773.                 $checkbox_setting = get_settings($pn_key);
  774.                 if($checkbox_setting != ''){
  775.                     if (get_settings($pn_key) ) {
  776.                         $checked = "checked=\"checked\"";
  777.                         } else {
  778.                             $checked = "";
  779.                         }
  780.                 }else{
  781.                     if($key == $value['std']){
  782.                         $checked = "checked=\"checked\"";
  783.                     }else{
  784.                         $checked = "";
  785.                     }
  786.                 }?>
  787.                 <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 />
  788.         <?php
  789.         }
  790.          
  791.         option_wrapper_footer($value);
  792.         break;
  793.        
  794.         case "heading":
  795.         ?>
  796.         <tr valign="top">
  797.  
  798.             <td colspan="3" style="text-align: center;"><h4><?php echo $value['name']; ?></h4></td>
  799.         </tr>
  800.         <?php
  801.         break;
  802.        
  803.         default:
  804.  
  805.         break;
  806.     }
  807. }
  808. ?>
  809.  
  810. </table>
  811.  
  812. <p class="submit">
  813. <input name="save" type="submit" value="Save changes" />    
  814. <input type="hidden" name="action" value="save" />
  815. </p>
  816. </form>
  817. <form method="post">
  818. <p class="submit">
  819. <input name="reset" type="submit" value="Reset" />
  820. <input type="hidden" name="action" value="reset" />
  821. </p>
  822. </form>
  823.  
  824. <?php
  825. }
  826.  
  827. function option_wrapper_header($values){
  828.     ?>
  829.     <tr valign="top">
  830.         <th scope="row"><?php echo $values['name']; ?>:</th>
  831.         <td>
  832.     <?php
  833. }
  834.  
  835. function option_wrapper_footer($values){
  836.     ?>
  837.         </td>
  838.     </tr>
  839.     <tr valign="top">
  840.         <td>&nbsp;</td><td><small><?php echo $values['desc']; ?></small></td>
  841.     </tr>
  842.     <?php
  843. }
  844.  
  845. function mytheme_wp_head() {
  846.     $stylesheet = get_option('revmag_alt_stylesheet');
  847.     if($stylesheet != ''){
  848.  
  849.  }
  850. }
  851.  
  852. add_action('wp_head', 'mytheme_wp_head');
  853. add_action('admin_menu', 'mytheme_add_admin');
  854.  
  855.  function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
  856.     $content = get_the_content($more_link_text, $stripteaser, $more_file);
  857.     $content = apply_filters('the_content', $content);
  858.     $content = str_replace(']]>', ']]&gt;', $content);
  859.     $content = strip_tags($content);
  860.  
  861.    if (strlen($_GET['p']) > 0) {
  862.       echo "<p>";
  863.       echo $content;
  864.       echo "&nbsp;<a href='";
  865.       the_permalink();
  866.       echo "'>"."Read More &rarr;</a>";
  867.       echo "</p>";
  868.    }
  869.    else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
  870.         $content = substr($content, 0, $espacio);
  871.         $content = $content;
  872.         echo "<p>";
  873.         echo $content;
  874.         echo "...";
  875.         echo "&nbsp;<a href='";
  876.         the_permalink();
  877.         echo "'>".$more_link_text."</a>";
  878.         echo "</p>";
  879.    }
  880.    else {
  881.       echo "<p>";
  882.       echo $content;
  883.       echo "&nbsp;<a href='";
  884.       the_permalink();
  885.       echo "'>"."Read More &rarr;</a>";
  886.       echo "</p>";
  887.    }
  888. }
  889. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement