Пример #1
0
 /**
  * Create an admin token for editing menus
  **/
 public function action_plugin_activation($file)
 {
     // create default access token
     ACL::create_token('manage_menus', _t('Manage menus', 'termmenus'), 'Administration', false);
     $group = UserGroup::get_by_name('admin');
     $group->grant('manage_menus');
     // register menu types
     Vocabulary::add_object_type('menu_link');
     Vocabulary::add_object_type('menu_spacer');
 }
 /**
  * Hook on activation of this plugin
  */
 public function action_plugin_activation()
 {
     // add the new content types
     Post::add_new_type('addon');
     // allow reading the new content types
     UserGroup::get_by_name('anonymous')->grant('post_addon', 'read');
     // create a permissions token
     ACL::create_token('manage_versions', _t('Manage Addon Versions', 'addon_catalog'), 'Addon Catalog', false);
     // create the addon vocabulary (type)
     Vocabulary::add_object_type('addon');
     // create the addon vocabulary
     $params = array('name' => self::CATALOG_VOCABULARY, 'description' => _t('A vocabulary for addon versions in the addons catalog', 'addon_catalog'));
     $vocabulary = Vocabulary::create($params);
     // @TODO: notification/log of some sort?
     // create the default content
     include 'create_core_addons.php';
 }
Пример #3
0
	public function test_object_type()
	{
		 $name = 'unit_test';
		 Vocabulary::add_object_type( $name );
		 $sql_id = DB::get_value( "SELECT id FROM {object_types} WHERE name = :vocab_name", array( 'vocab_name' => $name ) );
		 $id = Vocabulary::object_type_id( $name );
		 $this->assert_equal( $sql_id, $id, 'The sql id should equal the id returned.' );
		 DB::delete( '{object_types}', array( 'name' => $name ) );
	}