Exemplo n.º 1
0
 public function testMultiple()
 {
     $metadata = new Metadata();
     $metadata->set('a', array('A'));
     $metadata->set('b', array('B', 'BB', 'BBB'));
     $this->assertCount(1, $metadata->getList('a'));
     $this->assertEquals('A', $metadata->get('a'));
     $this->assertCount(3, $b = $metadata->getList('b'));
     $this->assertEquals(array('B', 'BB', 'BBB'), $b);
     $this->assertEquals('B', $metadata->get('b'));
 }
Exemplo n.º 2
0
 public function set_password($password)
 {
     $this->salt = substr(md5(rand()), 0, 25);
     $this->password = md5($password . $this->salt);
     Metadata::set('password', $this->password, "user.{$this->id}");
     Metadata::set('salt', $this->salt, "user.{$this->id}");
 }
Exemplo n.º 3
0
 public static function add($role, $subject, $action)
 {
     $code = md5($role . $subject . $action);
     Metadata::set('user', $role, "perm.{$code}");
     Metadata::set('subject', $subject, "perm.{$code}");
     Metadata::set('action', $action, "perm.{$code}");
 }
Exemplo n.º 4
0
 function __set($property, $value)
 {
     $ipn = '_' . $property;
     if (in_array($property, array('Cal', 'Image', 'Activated'))) {
         if ($property == 'Activated') {
             $value2 = $value;
             $value = (int) (bool) $value;
         }
         if ($value != @$this->{$ipn} && ($value || @$this->{$ipn})) {
             if (@$this->{$ipn} !== false && $this->mayI(EDIT)) {
                 if (!$this->mayI(EDIT)) {
                     return false;
                 }
                 if ($property == 'Activated') {
                     if (!$this->mayI(PUBLISH)) {
                         return false;
                     }
                 } elseif ($property == 'Cal') {
                     $this->registerUpdate();
                     if (is_object($value)) {
                         $this->_Cal = $value;
                         $value = $value->ID;
                     }
                 }
                 Metadata::set($property, $value);
             }
         }
         $this->{$ipn} = $property == 'Activated' && $value2 == '' ? $value2 : $value;
     } elseif ($property == 'Publish') {
         $this->setActive($value);
     } else {
         parent::__set($property, $value);
     }
 }
Exemplo n.º 5
0
 public function add_user($user)
 {
     Metadata::set("{$user}", $this->name, "has.{$this->name}");
 }
Exemplo n.º 6
0
 public function showDone()
 {
     Metadata::set('installed', true);
     return View::make('install/done');
 }
Exemplo n.º 7
0
 function test_set()
 {
     $this->assertTrue(Metadata::set('key', 'value', 'namespace'));
 }