public function editLanguage($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        try {
            if(SnippetLanguage::get()->filter('Name:nocase', Convert::raw2sql($data->language))->Count()>0) {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.LANGUAGE_EXISTS', '_Language already exists');
            
                return $response;
            }
            
            
            $lang=SnippetLanguage::get()->byID(intval($data->id));
            if(empty($lang) || $lang===false || $lang->ID==0) {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.LANGUAGE_NOT_FOUND', '_Language not found');
                
                return $response;
            }
            
            
            //Update language and write
            if($lang->UserLanguage==true) {
                $lang->Name=$data->language;
                $lang->FileExtension=$data->fileExtension;
            }
            
            $lang->Hidden=$data->hidden;
            $lang->write();
            
            
            $response['status']='HELO';
            $response['message']="Language edited successfully";
        }catch (Exception $e) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.SERVER_ERROR', '_Server error has occured, please try again later');
        }
        
        return $response;
    }
public function editLanguage($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        try {
            if(SnippetLanguage::get()->filter('Name:nocase', Convert::raw2sql($data->language))->Count()>0) {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.LANGUAGE_EXISTS', '_Language already exists');
            
                return $response;
            }
            
            
            $lang=SnippetLanguage::get()->byID(intval($data->id));
            if(empty($lang) || $lang===false || $lang->ID==0) {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.LANGUAGE_NOT_FOUND', '_Language not found');
                
                return $response;
            }
            
            
            //Update language and write
            if($lang->UserLanguage==true) {
                $lang->Name=$data->language;
                $lang->FileExtension=$data->fileExtension;
            }
            
            $lang->Hidden=$data->hidden;
            $lang->write();
            
            
            $response['status']='HELO';
            $response['message']="Language edited successfully";
        }catch (Exception $e) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.SERVER_ERROR', '_Server error has occured, please try again later');
        }
        
        return $response;
    }
public function editLanguage ( $ data ) { $ response = CodeBank_ClientAPI :: responseBase ( ) ; try { if ( SnippetLanguage :: get ( ) -> filter ( 'Name:nocase' , Convert :: raw2sql ( $ data -> language ) ) -> Count ( ) > 0 ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.LANGUAGE_EXISTS' , '_Language already exists' ) ; return $ response ; } $ lang = SnippetLanguage :: get ( ) -> byID ( intval ( $ data -> id ) ) ; if ( empty ( $ lang ) || $ lang === false || $ lang -> ID == 0 ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.LANGUAGE_NOT_FOUND' , '_Language not found' ) ; return $ response ; } //Update language and write if ( $ lang -> UserLanguage == true ) { $ lang -> Name = $ data -> language ; $ lang -> FileExtension = $ data -> fileExtension ; } $ lang -> Hidden = $ data -> hidden ; $ lang -> write ( ) ; $ response [ 'status' ] = 'HELO' ; $ response [ 'message' ] = "Language edited successfully" ; } catch ( Exception $ e ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.SERVER_ERROR' , '_Server error has occured, please try again later' ) ; } return $ response ; }
Edits a language
@param {stdClass} $data Data passed from ActionScript
@return {array} Returns a standard response array
Edits a language