コード例 #1
0
 public function setName($name)
 {
     if ($this->new) {
         if (SimpleStorage::validateName($name)) {
             if ($this->name == '') {
                 $this->name = $name;
             } else {
                 if (!SimpleStorage::checkExistByName($name)) {
                     $this->name = $name;
                 } else {
                     throw new Exception('Failed to rename the new piece from *' . $this->name . '* to *' . $name . '*, because the new piece name already exists.');
                 }
             }
         } else {
             throw new Exception('Illegal SimpleStorage piece name.');
         }
     } else {
         throw new Exception('Please use SimpleStorage::saveAs($name) to make a copy.');
     }
 }
コード例 #2
0
ファイル: V2EXCore.php プロジェクト: biaodianfu/project-babel
 public function vxPlayground()
 {
     _v_m_s();
     _v_b_l_s();
     _v_ico_map();
     echo ' <a href="/">' . Vocabulary::site_name . '</a> &gt; Playground';
     _v_d_e();
     _v_b_l_s();
     $ss = new SimpleStorage('testing');
     $ss->setName('sekai');
     $ss->set($this->User->usr_brief);
     $ss->save();
     echo 'NAME: ' . $ss->getName();
     echo '<br />';
     echo 'CONTENT: ' . $ss->get();
     echo '<br />';
     echo 'SIZE: ' . $ss->size;
     echo '<br />';
     echo 'SAVED: ' . $ss->saved;
     echo '<br />';
     echo 'HASH: ' . $ss->getHash();
     echo '<br />';
     _v_d_e();
     _v_d_e();
 }