web/wp-content/themes/selecta/ocmx/ocmx-create-options.php
author ymh
Fri, 12 Mar 2010 13:29:04 +0000
changeset 1 0d28b7c10758
permissions -rw-r--r--
First commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
0d28b7c10758 First commit
ymh
parents:
diff changeset
     1
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
     2
global $general_site_options, $social_media_options, $advert_options, $category_menu_options, $page_menu_options, $menu_options, $which_array;
0d28b7c10758 First commit
ymh
parents:
diff changeset
     3
$general_site_options =
0d28b7c10758 First commit
ymh
parents:
diff changeset
     4
	array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
     5
		array("label" => "Custom Logo", "description" => "Full URL or folder path to your custom logo.", "name" => $input_prefix."custom_logo", "default" => "/images/layout/logo.gif", "id" => "", "input_type" => "file"),
0d28b7c10758 First commit
ymh
parents:
diff changeset
     6
		array("label" => "Color Options", "description" => "Select your desired colour option.", "name" => $input_prefix."theme_style", "default" => "blue", "id" => "", "input_type" => "select", "options" => array("Blue (Default)" => "blue", "Sea Blue" => "sea-blue", "White Rose" => "white-rose", "Blue &amp; Black" => "black-blue", "Black &amp; Green" => "black-green", "Black &amp; Red" => "black-red")),
0d28b7c10758 First commit
ymh
parents:
diff changeset
     7
		array("label" => "Home Page Posts", "description" => "Number of Posts to display on the Home Page.", "name" => $input_prefix."home_page_posts", "default" => "5", "id" => "", "input_type" => "select", "options" => array("1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10", "15" => "15", "20" => "20")),
0d28b7c10758 First commit
ymh
parents:
diff changeset
     8
		array("label" => "Home Page Categories", "description" => "Which Category will we display on the Home Page?", "name" => $input_prefix."home_page_categories", "default" => "", "id" => "", "input_type" => "select", "options" => "loop_categories"),
0d28b7c10758 First commit
ymh
parents:
diff changeset
     9
		array("label" => "Home Page Images", "description" => "This will automatically generate an image for your posts on the home page if you have not specified an image in the 'image url' field when adding/updating a post.", "name" => $input_prefix."auto_home_images", "default" => "yes", "id" => "", "input_type" => "select", "options" => array("Yes" => "yes", "No" => "no")),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    10
		array("label" => "Site Analytics", "description" => "Enter in the Google Analytics Script here.","name" => $input_prefix."googleAnalytics", "default" => "", "id" => "","input_type" => "memo")
0d28b7c10758 First commit
ymh
parents:
diff changeset
    11
	);
0d28b7c10758 First commit
ymh
parents:
diff changeset
    12
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    13
$social_media_options =
0d28b7c10758 First commit
ymh
parents:
diff changeset
    14
	array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    15
		array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    16
			"main_section" => "RSS Details",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    17
			"main_description" => "This will allow visitors to subscribe to your custom RSS feed, as well as your Feedburner Feed via e-mail.",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    18
			"sub_elements" => 
0d28b7c10758 First commit
ymh
parents:
diff changeset
    19
				array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    20
					array("label" => "RSS URL", "description" => "", "name" => $input_prefix."rss_url", "default" => "", "id" => "", "input_type" => "text"),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    21
					array("label" => "Feedburner ID", "description" => "", "name" => $input_prefix."feedburner_id", "default" => "", "id" => "", "input_type" => "text")
0d28b7c10758 First commit
ymh
parents:
diff changeset
    22
				)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    23
		),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    24
		array("label" => "Promote Post Options", "description" => "This will allow you to include Digg, Moo, Bump and Tweetmeme links in your posts.", "name" => $input_prefix."promote_posts", "default" => "yes", "id" => $input_prefix."promote_posts", "input_type" => "select", "options" => array("Yes" => "yes", "No" => "no"))
0d28b7c10758 First commit
ymh
parents:
diff changeset
    25
	);
0d28b7c10758 First commit
ymh
parents:
diff changeset
    26
0d28b7c10758 First commit
ymh
parents:
diff changeset
    27
$auto_advert_options =
0d28b7c10758 First commit
ymh
parents:
diff changeset
    28
	array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    29
		array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    30
			"main_section" => "3<sup>rd</sup> Party Adverts",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    31
			"main_description" => "These settings allow you to manage your 3<sup>rd</sup> party (eg. BuySellAds, Afrigator etc.) adverts which display in the right side bar, and underneathe the Article in your home and post pages.",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    32
			"sub_elements" => 
0d28b7c10758 First commit
ymh
parents:
diff changeset
    33
				array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    34
					array("label" => "Post Page Script", "description" => "", "name" => $input_prefix."main_ad_buysell_ads", "default" => "0", "id" => $input_prefix."main_ad_buysell_ads", "input_type" => "select", "options" => array("On" => "on", "Off" => "off")),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    35
					array("label" => "Insert Page Script", "description" => "", "name" => $input_prefix."main_ad_buysell_id", "default" => "", "id" => $input_prefix."main_ad_buysell_id", "input_type" => "memo"),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    36
					array("label" => "Right Sidebar Script", "description" => "", "name" => $input_prefix."small_buysell_ads", "default" => "0", "id" => $input_prefix."small_buysell_ads", "input_type" => "select", "options" => array("On" => "on", "Off" => "off")),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    37
					array("label" => "Insert Sidebar Script", "description" => "", "name" => $input_prefix."small_buysell_id", "default" => "", "id" => $input_prefix."small_buysell_id", "input_type" => "memo")
0d28b7c10758 First commit
ymh
parents:
diff changeset
    38
				)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    39
		)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    40
	);
0d28b7c10758 First commit
ymh
parents:
diff changeset
    41
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    42
$custom_advert_options =
0d28b7c10758 First commit
ymh
parents:
diff changeset
    43
	array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    44
		array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    45
			"main_section" => "Post Page Ads",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    46
			"main_description" => "These settings allow you to manage your custom adverts which display in the post pages of your site. (Recommended size for the post ad is 560px by 60px.)",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    47
			"sub_elements" => 
0d28b7c10758 First commit
ymh
parents:
diff changeset
    48
				array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    49
					array("label" => "Advert Title", "description" => "", "name" => $input_prefix."post_ad_title", "default" => "", "id" =>  $input_prefix."post_ad_title", "input_type" => "text"),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    50
					array("label" => "Advert Link", "description" => "", "name" => $input_prefix."post_ad_link", "default" => "", "id" =>  $input_prefix."post_ad_link", "input_type" => "text"),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    51
					array("label" => "Image URL", "description" => "", "name" => $input_prefix."post_ad_image", "default" => "", "id" =>  $input_prefix."post_ad_image", "input_type" => "text")
0d28b7c10758 First commit
ymh
parents:
diff changeset
    52
				)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    53
		),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    54
		array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    55
			"main_section" => "Sidebar Ads",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    56
			"main_description" => "These settings allow you to manage your custom adverts which display in the right side bar. Use the \"Media\" section to upload you ad image, and paste the image url into the \"Image url\" text field. (Recommended width is 125px by 125px.)",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    57
			"sub_elements" => 
0d28b7c10758 First commit
ymh
parents:
diff changeset
    58
				array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    59
					array("label" => "Number of Small Ads", "description" => "", "name" => $input_prefix."small_ads", "default" => "0", "id" =>  $input_prefix."small_ads", "input_type" => "select", "options" => array("None" => "0", "1" => "1", "2" => "2", "3" => "3", "4" => "4", "5" => "5", "6" => "6", "7" => "7", "8" => "8", "9" => "9", "10" => "10"))
0d28b7c10758 First commit
ymh
parents:
diff changeset
    60
				)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    61
		)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    62
	);
0d28b7c10758 First commit
ymh
parents:
diff changeset
    63
$menu_options = array(array("label" => "Menu Order", "description" => "Would you like to list your pages or categories first?", "name" => $input_prefix."page_category_order", "default" => "pages_first", "id" => "", "input_type" => "select", "options" => array("Pages First" => "pages_first", "Categories First" => "categories_first")));		
0d28b7c10758 First commit
ymh
parents:
diff changeset
    64
$page_menu_options =
0d28b7c10758 First commit
ymh
parents:
diff changeset
    65
	array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    66
		array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    67
			"main_section" => "Pages",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    68
			"main_description" => "Order your pages by the following.",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    69
			"sub_elements" => 
0d28b7c10758 First commit
ymh
parents:
diff changeset
    70
				array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    71
					array("label" => "Order By", "description" => "", "name" => $input_prefix."page_order", "default" => "", "id" =>  $input_prefix."page_order", "input_type" => "select", "options" => array("Title" => "post_title", "Page Order" => "menu_order", "Creation Date/Time" => "post_date", "Modified Date/Time" => "post_modified", "Page ID" => "ID", "Post Slug" => "post_name")),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    72
					array("label" => "Direction", "description" => "", "name" => $input_prefix."page_updown", "default" => "", "id" =>  $input_prefix."page_updown", "input_type" => "select", "options" => array("Ascending" => "ASC", "Descending" => "DESC"))
0d28b7c10758 First commit
ymh
parents:
diff changeset
    73
				)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    74
		)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    75
	);
0d28b7c10758 First commit
ymh
parents:
diff changeset
    76
$category_menu_options =
0d28b7c10758 First commit
ymh
parents:
diff changeset
    77
	array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    78
		array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    79
			"main_section" => "Categories",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    80
			"main_description" => "Order your categories by the following.",
0d28b7c10758 First commit
ymh
parents:
diff changeset
    81
			"sub_elements" => 
0d28b7c10758 First commit
ymh
parents:
diff changeset
    82
				array(
0d28b7c10758 First commit
ymh
parents:
diff changeset
    83
					array("label" => "Order By", "description" => "", "name" => $input_prefix."category_order", "default" => "ID", "id" =>  $input_prefix."category_order", "input_type" => "select", "options" => array("Category ID" => "ID", "Name" => "name")),
0d28b7c10758 First commit
ymh
parents:
diff changeset
    84
					array("label" => "Direction", "description" => "", "name" => $input_prefix."category_updown", "default" => "", "id" =>  $input_prefix."category_updown", "input_type" => "select", "options" => array("Ascending" => "ASC", "Descending" => "DESC"))
0d28b7c10758 First commit
ymh
parents:
diff changeset
    85
				)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    86
		)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    87
	);
0d28b7c10758 First commit
ymh
parents:
diff changeset
    88
// Set the global var to see which array we're dealing with
0d28b7c10758 First commit
ymh
parents:
diff changeset
    89
0d28b7c10758 First commit
ymh
parents:
diff changeset
    90
/*********************************************************************************/
0d28b7c10758 First commit
ymh
parents:
diff changeset
    91
/* Below we create the form containers, according to our arrays in functions.php */
0d28b7c10758 First commit
ymh
parents:
diff changeset
    92
function fetch_options($which_array)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    93
	{		
0d28b7c10758 First commit
ymh
parents:
diff changeset
    94
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
    95
		global $input, $counter, $label_class;
0d28b7c10758 First commit
ymh
parents:
diff changeset
    96
		if($which_array) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
    97
			foreach($which_array as $input)
0d28b7c10758 First commit
ymh
parents:
diff changeset
    98
				{
0d28b7c10758 First commit
ymh
parents:
diff changeset
    99
					// This option Has Sub Options, so loop them and give them slightly different classes
0d28b7c10758 First commit
ymh
parents:
diff changeset
   100
					if($input['description'] !== "") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   101
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   102
						<p class="section_notice"><?php echo $input["description"];?></p>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   103
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   104
					endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   105
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   106
					<div class="form_item clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   107
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   108
					// If this option has sub-options
0d28b7c10758 First commit
ymh
parents:
diff changeset
   109
					if($input["main_section"]) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   110
						$i = 0;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   111
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   112
						<h3><?php echo $input["main_section"] ?></h3>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   113
                          
0d28b7c10758 First commit
ymh
parents:
diff changeset
   114
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   115
						if($input["main_description"] && $input["main_description"] !== "") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   116
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   117
							 <p class="section_notice"><?php echo $input["main_description"]; ?></p>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   118
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   119
						endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   120
						foreach($input["sub_elements"] as $sub_input)
0d28b7c10758 First commit
ymh
parents:
diff changeset
   121
							{
0d28b7c10758 First commit
ymh
parents:
diff changeset
   122
								$i++;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   123
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   124
							 <div class="form_label">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   125
								<div class="input_label"><?php echo $sub_input["label"]; ?></div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   126
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   127
								/* Set the class for the div */
0d28b7c10758 First commit
ymh
parents:
diff changeset
   128
								if($sub_input["options"] && $sub_input["input_type"] == "checkbox")
0d28b7c10758 First commit
ymh
parents:
diff changeset
   129
									{$label_class = "catagories";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   130
								else
0d28b7c10758 First commit
ymh
parents:
diff changeset
   131
									{$label_class = "input_form";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   132
									
0d28b7c10758 First commit
ymh
parents:
diff changeset
   133
								/* Output the form items using the create_form function */
0d28b7c10758 First commit
ymh
parents:
diff changeset
   134
								create_form($sub_input, count($input), $label_class);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   135
								
0d28b7c10758 First commit
ymh
parents:
diff changeset
   136
								/* Special case, a bit of a hard-code we know - if this is the "Sidebar Ad Number" option, bring into play the small_ad_form function
0d28b7c10758 First commit
ymh
parents:
diff changeset
   137
								Which can be found below */
0d28b7c10758 First commit
ymh
parents:
diff changeset
   138
								if($sub_input["name"] == "ocmx_small_ads") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   139
									if(get_option("ocmx_small_buysell_ads") == "1") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   140
										$no_display = "no_display";
0d28b7c10758 First commit
ymh
parents:
diff changeset
   141
									else :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   142
										$no_display = ""; 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   143
									endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   144
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   145
                                    <br />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   146
                                    <div class="clearfix <?php echo $no_display; ?>" id="small-ads-div">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   147
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   148
                                    for($i = 1; $i <= get_option("ocmx_small_ads"); $i++)
0d28b7c10758 First commit
ymh
parents:
diff changeset
   149
                                        {small_ad_form($i);}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   150
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   151
                                    </div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   152
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   153
                                endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   154
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   155
							</div> 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   156
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   157
							}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   158
					//This Option just sits on its own...
0d28b7c10758 First commit
ymh
parents:
diff changeset
   159
					else :			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   160
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   161
                        <div class="form_label">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   162
							<div class="input_label"><?php echo $input["label"]; ?></div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   163
<?php 						
0d28b7c10758 First commit
ymh
parents:
diff changeset
   164
							if($input["options"] && $input["input_type"] == "checkbox")
0d28b7c10758 First commit
ymh
parents:
diff changeset
   165
								{$label_class = "catagories";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   166
							else
0d28b7c10758 First commit
ymh
parents:
diff changeset
   167
								{$label_class = "input_form";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   168
								
0d28b7c10758 First commit
ymh
parents:
diff changeset
   169
							/* Output the form items using the create_form function */
0d28b7c10758 First commit
ymh
parents:
diff changeset
   170
							create_form($input, count($input), $label_class);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   171
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   172
						</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   173
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   174
					endif;					
0d28b7c10758 First commit
ymh
parents:
diff changeset
   175
?>					
0d28b7c10758 First commit
ymh
parents:
diff changeset
   176
					</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   177
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   178
				}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   179
		endif;		
0d28b7c10758 First commit
ymh
parents:
diff changeset
   180
	}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   181
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
   182
/************************************************************************/
0d28b7c10758 First commit
ymh
parents:
diff changeset
   183
/* Below we check which kind of form item we're creating, and output it */
0d28b7c10758 First commit
ymh
parents:
diff changeset
   184
function create_form($input, $counter, $label_class)
0d28b7c10758 First commit
ymh
parents:
diff changeset
   185
	{
0d28b7c10758 First commit
ymh
parents:
diff changeset
   186
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   187
		<div class="<?php echo $label_class; ?>">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   188
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   189
		// Set the input value to default or get_option()
0d28b7c10758 First commit
ymh
parents:
diff changeset
   190
		if(!get_option($input["name"])) :			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   191
			$input_value = $input["default"];			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   192
		else :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   193
			$input_value = get_option($input["name"]);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   194
		endif;	
0d28b7c10758 First commit
ymh
parents:
diff changeset
   195
		
0d28b7c10758 First commit
ymh
parents:
diff changeset
   196
		// This denotes that we're using the wp-categories instead of set options
0d28b7c10758 First commit
ymh
parents:
diff changeset
   197
		if($input["options"] == "loop_categories") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   198
			$option_loop = get_categories();
0d28b7c10758 First commit
ymh
parents:
diff changeset
   199
		elseif($input["options"] == "loop_pages") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   200
			$option_loop = get_pages();
0d28b7c10758 First commit
ymh
parents:
diff changeset
   201
		else :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   202
			//$values =  array_values($input["options"]);	
0d28b7c10758 First commit
ymh
parents:
diff changeset
   203
			$option_loop = $input["options"];
0d28b7c10758 First commit
ymh
parents:
diff changeset
   204
		endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   205
		
0d28b7c10758 First commit
ymh
parents:
diff changeset
   206
		//Switch through the input_type
0d28b7c10758 First commit
ymh
parents:
diff changeset
   207
		switch($input["input_type"]) 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   208
			{
0d28b7c10758 First commit
ymh
parents:
diff changeset
   209
				case 'select';
0d28b7c10758 First commit
ymh
parents:
diff changeset
   210
				if($input['linked']) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   211
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   212
	    			<select size="1" name="<?php echo $input["name"]; ?>" id="<?php echo $input["id"]; ?>" onchange="javacript: check_linked('<?php echo $input['id'];?>', '<?php echo $input['linked'];?>')">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   213
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   214
				else :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   215
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   216
	    			<select size="1" name="<?php echo $input["name"]; ?>" id="<?php echo $input["id"]; ?>">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   217
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   218
				endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   219
					// Tiny little hack.. if we've set the options to loop through the categories, we must have an "All" option
0d28b7c10758 First commit
ymh
parents:
diff changeset
   220
					if ($input["options"] == "loop_categories") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   221
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   222
						<option <?php if($input_value == 0){echo "selected=\"selected\"";} ?> value="0">All</option>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   223
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   224
					elseif($input["options"] == "loop_pages") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   225
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   226
						<option <?php if($input_value == 0){echo "selected=\"selected\"";} ?> value="0">Use a Custom Description</option>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   227
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   228
					endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   229
                    foreach($option_loop as $option_label => $value)
0d28b7c10758 First commit
ymh
parents:
diff changeset
   230
                        { 	
0d28b7c10758 First commit
ymh
parents:
diff changeset
   231
							// Set the $value and $label for the options
0d28b7c10758 First commit
ymh
parents:
diff changeset
   232
							if($input["options"] == "loop_categories") : 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   233
								$use_value =  $value->slug;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   234
								$label =  $value->cat_name;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   235
							elseif($input["options"] == "loop_pages") : 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   236
								$use_value =  $value->ID;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   237
								$label =  $value->post_title;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   238
							else :		
0d28b7c10758 First commit
ymh
parents:
diff changeset
   239
								$use_value  =  $value;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   240
								$label =  $option_label;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   241
							endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   242
							//If this option == the value we set above, select it
0d28b7c10758 First commit
ymh
parents:
diff changeset
   243
                            if($use_value == $input_value)
0d28b7c10758 First commit
ymh
parents:
diff changeset
   244
                                {$selected = " selected='selected' ";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   245
                            else
0d28b7c10758 First commit
ymh
parents:
diff changeset
   246
                                {$selected = " ";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   247
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   248
                            <option <?php echo $selected; ?> value="<?php echo $use_value; ?>"><?php echo $label; ?></option>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   249
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   250
                        }
0d28b7c10758 First commit
ymh
parents:
diff changeset
   251
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   252
                </select>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   253
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   254
				break;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   255
				case 'checkbox' :								
0d28b7c10758 First commit
ymh
parents:
diff changeset
   256
?>			
0d28b7c10758 First commit
ymh
parents:
diff changeset
   257
                <div class="selection_catagory clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   258
                    <ul class="cat_option clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   259
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   260
					 foreach($option_loop as $option_label => $value) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   261
						// Set the $value and $label for the options
0d28b7c10758 First commit
ymh
parents:
diff changeset
   262
						if($input["options"] == "loop_categories") : 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   263
							$use_value =  $value->slug;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   264
							$label =  $value->cat_name;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   265
						elseif($input["options"] == "loop_pages") : 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   266
							$use_value =  $value->ID;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   267
							$label =  $value->post_title;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   268
						else :		
0d28b7c10758 First commit
ymh
parents:
diff changeset
   269
							$use_value  =  $value;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   270
							$label =  $option_label;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   271
						endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   272
						if($use_value == $input_value)
0d28b7c10758 First commit
ymh
parents:
diff changeset
   273
							{$selected = " checked='checkeds' ";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   274
						else
0d28b7c10758 First commit
ymh
parents:
diff changeset
   275
							{$selected = " ";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   276
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   277
						<li><input type="checkbox" name="<?php echo $input["name"]."_".$counter; ?>" value="<?php echo $use_value; ?>" /> <?php echo $label; ?></li>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   278
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   279
					endforeach;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   280
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   281
                    </ul>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   282
                </div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   283
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   284
				break;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   285
				case 'radio' :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   286
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   287
                <div class="selection_catagory clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   288
                    <ul class="cat_option">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   289
<?php                         
0d28b7c10758 First commit
ymh
parents:
diff changeset
   290
					 foreach($option_loop as $option_label => $value) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   291
					 	// Check whether we must loop through the categories for the options
0d28b7c10758 First commit
ymh
parents:
diff changeset
   292
						if($input["options"] == "loop_categories") : 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   293
							$use_value =  $value->slug;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   294
							$label =  $value->cat_name;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   295
						else :		
0d28b7c10758 First commit
ymh
parents:
diff changeset
   296
							$use_value  =  $value;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   297
							$label =  $option_label;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   298
						endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   299
						if($use_value == $input_value) {$selected = " selected='selected' ";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   300
						else
0d28b7c10758 First commit
ymh
parents:
diff changeset
   301
							{$selected = " ";}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   302
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   303
						<li><input type="radio" name="<?php echo $input["name"]; ?>" value="<?php echo $use_value; ?>" />&nbsp;<?php echo $option_label; ?> </li>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   304
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   305
					endforeach;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   306
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   307
                    </ul>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   308
                </div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   309
<?php                    
0d28b7c10758 First commit
ymh
parents:
diff changeset
   310
				break;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   311
				case 'memo':
0d28b7c10758 First commit
ymh
parents:
diff changeset
   312
					if($input['linked']) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   313
						if((get_option($input['linked'])) && get_option($input['linked']) !== "0") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   314
							$disabled_element = "disabled=\"disabled\"";
0d28b7c10758 First commit
ymh
parents:
diff changeset
   315
						else :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   316
							$disabled_element = "";
0d28b7c10758 First commit
ymh
parents:
diff changeset
   317
						endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   318
					else :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   319
							$disabled_element = "";
0d28b7c10758 First commit
ymh
parents:
diff changeset
   320
					endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   321
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   322
					<textarea name="<?php echo $input["name"]; ?>" id="<?php echo $input["id"]; ?>" <?php echo $disabled_element; ?> class="mceNoEditor"><?php echo stripslashes($input_value); ?></textarea>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   323
<?php 					
0d28b7c10758 First commit
ymh
parents:
diff changeset
   324
				break;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   325
				case 'file':
0d28b7c10758 First commit
ymh
parents:
diff changeset
   326
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   327
                    <input type="file" style="width: 300px;" name="<?php echo $input["name"]; ?>" id="<?php echo $input["id"]; ?>" value="<?php echo $input_value; ?>" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   328
                    <br /> <br />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   329
                    <em>Current Image</em>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   330
                    <div class="form-thumbnail">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   331
                    	<a id="<?php echo $ad_href_id; ?>" style="background: url('<?php bloginfo('wpurl');?><?php echo "/wp-content/uploads/".$input_value; ?>')  no-repeat center;" href="<?php bloginfo('wpurl');?><?php echo "/wp-content/uploads/".$input_value; ?>" class="std_link" rel="lightbox" target="_blank">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   332
	                    </a>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   333
                    </div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   334
					
0d28b7c10758 First commit
ymh
parents:
diff changeset
   335
<?php 					
0d28b7c10758 First commit
ymh
parents:
diff changeset
   336
				break;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   337
				case 'zip_file':
0d28b7c10758 First commit
ymh
parents:
diff changeset
   338
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   339
                    <input type="file" style="width: 300px;" name="<?php echo $input["name"]; ?>" id="<?php echo $input["id"]; ?>" value="<?php echo $input_value; ?>" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   340
<?php 					
0d28b7c10758 First commit
ymh
parents:
diff changeset
   341
				break;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   342
				default :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   343
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   344
					<input type="text" name="<?php echo $input["name"]; ?>" id="<?php echo $input["id"]; ?>" value="<?php echo $input_value; ?>" />
0d28b7c10758 First commit
ymh
parents:
diff changeset
   345
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   346
				break;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   347
			}		
0d28b7c10758 First commit
ymh
parents:
diff changeset
   348
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   349
		</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   350
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   351
	}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   352
function menu_options($defaults) {
0d28b7c10758 First commit
ymh
parents:
diff changeset
   353
		global $input_prefix, $parent_count, $advert_options, $page_menu_options, $category_menu_options, $menu_options;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   354
		$page_args = array("sort_column" => get_option("ocmx_page_order"), "sort_order" => get_option("ocmx_page_updown"));		
0d28b7c10758 First commit
ymh
parents:
diff changeset
   355
		$fetch_pages= get_pages($page_args);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   356
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   357
        <?php fetch_options($page_menu_options); ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   358
		<div class="selection_sections clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   359
            <ul class="section_option">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   360
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   361
				//Set the $i var to count through as we loop through the pages
0d28b7c10758 First commit
ymh
parents:
diff changeset
   362
				$i = 0;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   363
				foreach ($fetch_pages as $this_page) : 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   364
					$use_id = $input_prefix."menu_page_".$this_page->ID;					
0d28b7c10758 First commit
ymh
parents:
diff changeset
   365
					// Check/Uncheck Categories
0d28b7c10758 First commit
ymh
parents:
diff changeset
   366
					if(get_option($use_id)) : $main_checked = "checked='checked'"; else : $main_checked = ""; endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   367
					// If we're halfway then place create a new <ul> to seperate the categories
0d28b7c10758 First commit
ymh
parents:
diff changeset
   368
					if ($i == number_format(count($fetch_pages)/2, 0)) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   369
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   370
                        </ul>     
0d28b7c10758 First commit
ymh
parents:
diff changeset
   371
                        <ul class="section_option clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   372
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   373
					endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   374
					if($this_page->post_parent == 0) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   375
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   376
	                	<li class="clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   377
                        	<input type="checkbox" <?php echo $main_checked; ?> name="<?php echo $use_id ?>" id="main_page_<?php echo $this_page->ID; ?>" /> <?php echo $this_page->post_title; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   378
<?php 						$sub_page_count = 0;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   379
							if(get_option("ocmx_page_order") !== "post_title") :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   380
								$sub_page_defaults = array("child_of" => $this_page->ID, "sort_column" => get_option("ocmx_page_order"), "sort_order" => get_option("ocmx_page_updown"));
0d28b7c10758 First commit
ymh
parents:
diff changeset
   381
							else :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   382
								$sub_page_defaults = array("child_of" => $this_page->ID, "sort_order" => get_option("ocmx_page_updown"));
0d28b7c10758 First commit
ymh
parents:
diff changeset
   383
							endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   384
							$sub_pages = get_pages($sub_page_defaults);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   385
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   386
                            <ul class="section_option clearfix" id="sub_pages_<?php echo $this_page->ID; ?>" style="display: none;">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   387
                                <?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   388
                                    foreach ($sub_pages as $sub_page) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   389
                                        $use_id = "ocmx_subpage_".$sub_page->ID;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   390
                                        // Check/Uncheck Categories
0d28b7c10758 First commit
ymh
parents:
diff changeset
   391
                                        if(get_option($use_id)) : $sub_checked = "checked='checked'"; else : $sub_checked = ""; endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   392
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   393
                                    <li><input type="checkbox" <?php echo $sub_checked; ?> name="<?php echo $use_id ?>" id="<?php echo $use_id; ?>" /> <?php echo $sub_page->post_title; ?></li>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   394
                                <?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   395
                                    endforeach;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   396
                                ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   397
                            </ul>      
0d28b7c10758 First commit
ymh
parents:
diff changeset
   398
						</li>        
0d28b7c10758 First commit
ymh
parents:
diff changeset
   399
                                                
0d28b7c10758 First commit
ymh
parents:
diff changeset
   400
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   401
						$i++;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   402
					endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   403
				endforeach;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   404
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   405
			</ul>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   406
		</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   407
        <?php fetch_options($category_menu_options); ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   408
        <div class="selection_sections clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   409
            <ul class="section_option">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   410
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   411
			//Set the $i var to count through as we loop through the categories
0d28b7c10758 First commit
ymh
parents:
diff changeset
   412
			$i = 0;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   413
			$parent_count = 0;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   414
			$cat_args = array("orderby" => get_option("ocmx_category_order"), "order" => get_option("ocmx_category_updown"), "hide_empty" => false);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   415
			$parent_categories = get_categories($cat_args);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   416
			// Count the Parent Categories (That is Categories without Parents themselves (To be used in the loop, explained below)
0d28b7c10758 First commit
ymh
parents:
diff changeset
   417
			foreach ($parent_categories as $this_category) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   418
				if($this_category->category_parent == 0) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   419
					$parent_count++;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   420
				endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   421
			endforeach;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   422
			//Loop through the categories				
0d28b7c10758 First commit
ymh
parents:
diff changeset
   423
			foreach ($parent_categories as $this_category) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   424
				//Create the checkbox Name/Id
0d28b7c10758 First commit
ymh
parents:
diff changeset
   425
				$use_id = $input_prefix."maincategory_".$this_category->cat_ID;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   426
				
0d28b7c10758 First commit
ymh
parents:
diff changeset
   427
				// Check/Uncheck Categories
0d28b7c10758 First commit
ymh
parents:
diff changeset
   428
				if(get_option($use_id)) : $main_checked = "checked='checked'"; else : $main_checked = ""; endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   429
				
0d28b7c10758 First commit
ymh
parents:
diff changeset
   430
				// If we're halfway then place create a new <ul> to seperate the categories
0d28b7c10758 First commit
ymh
parents:
diff changeset
   431
				if ($i == number_format($parent_count/2, 0)) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   432
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   433
					</ul>     
0d28b7c10758 First commit
ymh
parents:
diff changeset
   434
					<ul class="section_option clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   435
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   436
				endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   437
				// Now List the Subcategories
0d28b7c10758 First commit
ymh
parents:
diff changeset
   438
				$sub_category_defaults = array('type' => 'post', 'child_of' => $this_category->cat_ID, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => false);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   439
				$sub_categories = get_categories($sub_category_defaults);
0d28b7c10758 First commit
ymh
parents:
diff changeset
   440
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
   441
				if($this_category->category_parent == 0) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   442
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   443
	
0d28b7c10758 First commit
ymh
parents:
diff changeset
   444
					<li class="clearfix">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   445
						<input type="checkbox" <?php echo $main_checked; ?> name="<?php echo $use_id; ?>" id="main_category_<?php echo $this_category->cat_ID; ?>" /> <?php echo $this_category->cat_name; ?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   446
						<ul class="section_option clearfix" id="sub_categories_<?php echo $this_category->cat_ID; ?>" style="display: none;">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   447
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   448
						foreach ($sub_categories as $sub_category) :
0d28b7c10758 First commit
ymh
parents:
diff changeset
   449
							//Create the checkbox name
0d28b7c10758 First commit
ymh
parents:
diff changeset
   450
							$sub_category->cat_name;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   451
							$use_id = $input_prefix."subcategory_".$sub_category->cat_ID;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   452
							
0d28b7c10758 First commit
ymh
parents:
diff changeset
   453
							// Check/Uncheck Categories
0d28b7c10758 First commit
ymh
parents:
diff changeset
   454
							if(get_option($use_id)) : $sub_checked = "checked='checked'"; else : $sub_checked = ""; endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   455
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   456
							<li><input type="checkbox" <?php echo $sub_checked; ?> name="<?php echo $use_id ?>" id="<?php echo $use_id; ?>" /> <?php echo $sub_category->cat_name; ?></li>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   457
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   458
						endforeach;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   459
?>                
0d28b7c10758 First commit
ymh
parents:
diff changeset
   460
						</ul>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   461
					</li>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   462
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   463
					$i++;	
0d28b7c10758 First commit
ymh
parents:
diff changeset
   464
				endif;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   465
			endforeach;	
0d28b7c10758 First commit
ymh
parents:
diff changeset
   466
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   467
            </ul>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   468
            <br class="clearboth "/>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   469
        </div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   470
<?php 
0d28b7c10758 First commit
ymh
parents:
diff changeset
   471
	}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   472
function small_ad_form($id) {
0d28b7c10758 First commit
ymh
parents:
diff changeset
   473
		global $input_prefix;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   474
		$ad_title_id = $input_prefix."small_ad_title_".$id;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   475
		$ad_link_id = $input_prefix."small_ad_link_".$id;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   476
		$ad_img_id = $input_prefix."small_ad_img_".$id;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   477
		$ad_href_id = $input_prefix."small_ad_href_".$id;
0d28b7c10758 First commit
ymh
parents:
diff changeset
   478
?>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   479
		<div class="form_label">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   480
			<div class="label_tag">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   481
				<div class="input_label">Advert Title</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   482
				<div class="input_form"><input type="text" name="<?php echo $ad_title_id ?>" id="<?php echo $ad_title_id ?>" value="<?php echo get_option($ad_title_id); ?>" /></div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   483
			</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   484
		</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   485
		<div class="form_label">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   486
			<div class="label_tag">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   487
				<div class="input_label">Advert Link</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   488
				<div class="input_form"><input type="text" name="<?php echo $ad_link_id ?>" id="<?php echo $ad_link_id ?>" value="<?php echo get_option($ad_link_id); ?>" /></div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   489
			</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   490
		</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   491
		<div class="form_label">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   492
			<div class="label_tag">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   493
				<div class="input_label">Image URL</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   494
				<div class="input_form"><input type="text" name="<?php echo $ad_img_id ?>" id="<?php echo $ad_img_id ?>" value="<?php echo get_option($ad_img_id); ?>" /></div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   495
			</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   496
		</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   497
		<div class="form_label">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   498
			<div class="label_tag">
0d28b7c10758 First commit
ymh
parents:
diff changeset
   499
				<div class="input_label">&nbsp;</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   500
				<div class="thumbnail"><a id="<?php echo $ad_href_id; ?>" style="background: url('<?php echo get_option($ad_img_id); ?>')  no-repeat center;" href="<?php echo get_option($ad_link_id); ?>" class="std_link" rel="lightbox" target="_blank">&nbsp;</a></div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   501
			</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   502
		</div>
0d28b7c10758 First commit
ymh
parents:
diff changeset
   503
0d28b7c10758 First commit
ymh
parents:
diff changeset
   504
<?php
0d28b7c10758 First commit
ymh
parents:
diff changeset
   505
	}
0d28b7c10758 First commit
ymh
parents:
diff changeset
   506
?>