public function testContentTypesCanBeAdded()
 {
     $types = Content_Type::getAll();
     $type_count = count($types);
     $new_type = new Content_Type('Test Type');
     $new_type->save();
     $this->assertEquals($type_count, $type_count + 1);
 }
Exemplo n.º 2
0
 private static function _setStaticContentType($type)
 {
     if (!$type instanceof Content_Type) {
         $type = Content_Type::getByName($type);
     }
     static::$_collectionName = $type->name;
     return $type;
 }
 public function register_custom_content_types()
 {
     $content_types = Content_Type::getAll();
     foreach ($content_types as $content_type) {
         $this->register_content_type($content_type->name);
         if (property_exists($content_type, 'taxonomies')) {
             foreach ($content_type->taxonomies as $taxonomy) {
                 $this->register_taxonomy($taxonomy->name, str_replace(" ", "_", strtolower($content_type->name)));
             }
         }
     }
     $taxonomies = Taxonomy::getAll();
     foreach ($taxonomies as $taxonomy) {
         $this->register_taxonomy($taxonomy->name, 'all');
     }
 }
Exemplo n.º 4
0
		var f = document.main_form;
	}// end popup_init()

	function popup_save(f) {
		var data = new Object();
		data["identifier"]  = owner.form_element_value(f.identifier);
		data["layout_type"] = owner.form_element_value(f.layout_type);
		data["css_class"]   = owner.form_element_value(f.css_class);
		data["content_type"] = owner.form_element_value(f.content_type);
		owner.bodycopy_save_insert_div(data);
	}

</script>
<?php 
require_once SQ_CORE_PACKAGE_PATH . '/content_type/content_type.inc';
$content_types = Content_Type::getAvailableContentTypes();
$default_content_type = $GLOBALS['SQ_SYSTEM']->getUserPrefs('bodycopy_container', 'SQ_DEFAULT_CONTENT_TYPE');
$default_pres_type = $GLOBALS['SQ_SYSTEM']->getUserPrefs('bodycopy_container', 'SQ_DEFAULT_PRESENTATION_TYPE');
$possible_types = array('div' => translate('Block (div)'), 'span' => translate('Inline (span)'), 'none' => translate('Raw (no formatting)'));
?>
<h1 class="title">
	<a href="#" onclick="javascript: popup_close(); return false;">
		<img src="<?php 
echo sq_web_path('lib');
?>
/web/images/icons/cancel.png" alt="Cancel" title="<?php 
echo translate('Cancel');
?>
" class="sq-icon">
	</a>
	<?php 
 private function deleteContentTypeAndTaxonomies($id)
 {
     $deleted = Content_Type::deleteContentType((int) $id);
     if (!$deleted) {
         return new WP_Error(500, "Could not delete content type");
         exit;
     } else {
         echo "<div class='wrap'>Deleted</div>";
         $this->content_types_admin_index();
     }
 }