original_string: public function newSnippet($data) {
          $response=CodeBank_ClientAPI::responseBase();
          
          //Ensure logged in
          if(!Permission::check('CODE_BANK_ACCESS')) {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.PERMISSION_DENINED', '_Permission Denied');
              
              return $response;
          }
          
          
          try {
              $snippet=new Snippet();
              $snippet->Title=$data->title;
              $snippet->Description=$data->description;
              $snippet->Text=$data->code;
              $snippet->Tags=$data->tags;
              $snippet->LanguageID=$data->language;
              $snippet->CreatorID=Member::currentUserID();
              $snippet->PackageID=$data->packageID;
              
              if($data->folderID>0) {
                  $folder=SnippetFolder::get()->byID(intval($data->folderID));
                  if(empty($folder) || $folder===false || $folder->ID==0) {
                      $response['status']="EROR";
                      $response['message']=_t('CodeBankAPI.FOLDER_DOES_NOT_EXIST', '_Folder does not exist');
                      return $response;
                  }
                  
                  if($folder->LanguageID!=$snippet->LanguageID) {
                      $response['status']="EROR";
                      $response['message']=_t('CodeBankAPI.FOLDER_NOT_LANGUAGE', '_Folder is not in the same language as the snippet');
                      return $response;
                  }
              }
              
              $snippet->write();
              
              
              $response['status']="HELO";
          }catch(Exception $e) {
              $response['status']="EROR";
              $response['message']="Internal Server error occured";
          }
          
          
          return $response;
      }
code: public function newSnippet($data) {
          $response=CodeBank_ClientAPI::responseBase();
          
          //Ensure logged in
          if(!Permission::check('CODE_BANK_ACCESS')) {
              $response['status']='EROR';
              $response['message']=_t('CodeBankAPI.PERMISSION_DENINED', '_Permission Denied');
              
              return $response;
          }
          
          
          try {
              $snippet=new Snippet();
              $snippet->Title=$data->title;
              $snippet->Description=$data->description;
              $snippet->Text=$data->code;
              $snippet->Tags=$data->tags;
              $snippet->LanguageID=$data->language;
              $snippet->CreatorID=Member::currentUserID();
              $snippet->PackageID=$data->packageID;
              
              if($data->folderID>0) {
                  $folder=SnippetFolder::get()->byID(intval($data->folderID));
                  if(empty($folder) || $folder===false || $folder->ID==0) {
                      $response['status']="EROR";
                      $response['message']=_t('CodeBankAPI.FOLDER_DOES_NOT_EXIST', '_Folder does not exist');
                      return $response;
                  }
                  
                  if($folder->LanguageID!=$snippet->LanguageID) {
                      $response['status']="EROR";
                      $response['message']=_t('CodeBankAPI.FOLDER_NOT_LANGUAGE', '_Folder is not in the same language as the snippet');
                      return $response;
                  }
              }
              
              $snippet->write();
              
              
              $response['status']="HELO";
          }catch(Exception $e) {
              $response['status']="EROR";
              $response['message']="Internal Server error occured";
          }
          
          
          return $response;
      }
code_tokens: public function newSnippet ( $ data ) { $ response = CodeBank_ClientAPI :: responseBase ( ) ; //Ensure logged in if ( ! Permission :: check ( 'CODE_BANK_ACCESS' ) ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.PERMISSION_DENINED' , '_Permission Denied' ) ; return $ response ; } try { $ snippet = new Snippet ( ) ; $ snippet -> Title = $ data -> title ; $ snippet -> Description = $ data -> description ; $ snippet -> Text = $ data -> code ; $ snippet -> Tags = $ data -> tags ; $ snippet -> LanguageID = $ data -> language ; $ snippet -> CreatorID = Member :: currentUserID ( ) ; $ snippet -> PackageID = $ data -> packageID ; if ( $ data -> folderID > 0 ) { $ folder = SnippetFolder :: get ( ) -> byID ( intval ( $ data -> folderID ) ) ; if ( empty ( $ folder ) || $ folder === false || $ folder -> ID == 0 ) { $ response [ 'status' ] = "EROR" ; $ response [ 'message' ] = _t ( 'CodeBankAPI.FOLDER_DOES_NOT_EXIST' , '_Folder does not exist' ) ; return $ response ; } if ( $ folder -> LanguageID != $ snippet -> LanguageID ) { $ response [ 'status' ] = "EROR" ; $ response [ 'message' ] = _t ( 'CodeBankAPI.FOLDER_NOT_LANGUAGE' , '_Folder is not in the same language as the snippet' ) ; return $ response ; } } $ snippet -> write ( ) ; $ response [ 'status' ] = "HELO" ; } catch ( Exception $ e ) { $ response [ 'status' ] = "EROR" ; $ response [ 'message' ] = "Internal Server error occured" ; } return $ response ; }
docstring: Saves a new snippet
  @param {stdClass} $data Data passed from ActionScript
  @return {array} Standard response base
docstring_tokens: Saves a new snippet