public function validate_settings($input)
 {
     if (!isset($input['reset_theme'])) {
         $options = get_option('ds106bank_options');
         // has the thing name changed? If so we need to update the taxonmy terms
         if ($input['thingname'] != THINGNAME) {
             // return ( substr( $thing, 0, -1 ) );
             bank106_update_tax(THINGNAME, $input['thingname']);
         }
         // has thumbnail sizes changed? If so, update option for thumbnail sizes
         if ($input['thumb_w'] != THUMBW) {
             update_option('thumbnail_size_w', $input['thumb_w']);
         }
         if ($input['thumb_h'] != THUMBH) {
             update_option('thumbnail_size_h', $input['thumb_h']);
         }
         // has page media width changed? if so, update options for medium sized images
         if ($input['page_media_width'] != MEDIAW) {
             update_option('medium_size_w', $input['page_media_width']);
             update_option('medium_size_h', $input['page_media_width']);
         }
         // if we new types list, add to assignmemttypes taxonomy
         if ($input['new_types'] != 'New Type Name') {
             bank106_add_new_types($input['new_types']);
         }
         // check for types to be deleted
         $assigntypes = get_assignment_types();
         // updates for thing types
         foreach ($assigntypes as $atype) {
             // name of setting
             $setting_name = 'thing_type_' . $atype->term_id;
             if ($input['del_' . $setting_name] == 1) {
                 // delete term if box is checked
                 wp_delete_term($atype->term_id, 'assignmenttypes');
             } else {
                 // update terms (whether changed or not, sigh, this seems easier)
                 wp_update_term($atype->term_id, 'assignmenttypes', array('name' => $input[$setting_name], 'slug' => sanitize_title($input[$setting_name]), 'description' => $input[$setting_name . '_descrip']));
             }
         }
         foreach ($this->checkboxes as $id) {
             if (isset($options[$id]) && !isset($input[$id])) {
                 unset($options[$id]);
             }
         }
         return $input;
     }
     return false;
 }
Exemplo n.º 2
0
        echo ' has-error ';
    }
    ?>
">
						<label for="assignmentType"><?php 
    _e('Type of ' . THINGNAME, 'wpbootstrap');
    ?>
</label>
						<span id="assignmentTypeHelpBlock" class="help-block">Choose at least one.</span>
				
					
					
						<?php 
    // build options based on assignment types
    // yes this might have been done with wp_dropdown_categories
    $atypes = get_assignment_types();
    foreach ($atypes as $thetype) {
        $checked = (is_array($assignmentType) and in_array($thetype->slug, $assignmentType)) ? 'checked="checked"' : '';
        echo '<div class="checkbox"><label><input type="checkbox" name="assignmentType[]" value="' . $thetype->slug . '" ' . $checked . '> ' . $thetype->name . '</label></div>';
    }
    ?>
	
					</div>
 
					<div class="form-group<?php 
    if (array_key_exists("assignmentTags", $errors)) {
        echo ' has-error ';
    }
    ?>
">
						<label for="assignmentTags"><?php 
Exemplo n.º 3
0
					    <footer>
					    </footer>
					</article>
					
					<?php 
}
?>
			
				</div> <!-- end #main -->    

				
				
				<?php 
// Generate the menu of "things"
// get all the terms for the custom post type for things, in sort order specified in settings
$assignmenttypes = get_assignment_types(ds106bank_option('thing_order'), ds106bank_option('thing_orderby'));
if (count($assignmenttypes) == 0) {
    // warning warning if no things have yet created
    echo '<div class="clearfix row"><div class="col-sm-2 col-sm-offset-4 clearfix"><p><strong>Woah Neo</strong>; No ' . THINGNAME . 's have been set up. You can do that if you explore the Assignment Bank Options under the <em>Types</em> tab.</p></div></div>';
} else {
    echo '<div id="assignmentmenu" class="clearfix row"> <!-- thing menu -->';
    $odd = false;
    foreach ($assignmenttypes as $atype) {
        if ($odd) {
            echo '<div class="col-sm-offset-1 col-sm-5">';
        } else {
            echo '<div class="clearfix row"><div class="col-sm-5">';
        }
        $odd = !$odd;
        // get the term for this type of taxonomy
        $items = get_term_by('id', $atype->term_id, 'assignmenttypes');