public function createLanguage($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=new SnippetLanguage();
            $lang->Name=$data->language;
            $lang->FileExtension=$data->fileExtension;
            $lang->HighlightCode='Plain';
            $lang->UserLanguage=1;
            $lang->write();
            
            
            $response['status']='HELO';
            $response['message']="Language added 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 createLanguage($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=new SnippetLanguage();
            $lang->Name=$data->language;
            $lang->FileExtension=$data->fileExtension;
            $lang->HighlightCode='Plain';
            $lang->UserLanguage=1;
            $lang->write();
            
            
            $response['status']='HELO';
            $response['message']="Language added 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 createLanguage ( $ 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 = new SnippetLanguage ( ) ; $ lang -> Name = $ data -> language ; $ lang -> FileExtension = $ data -> fileExtension ; $ lang -> HighlightCode = 'Plain' ; $ lang -> UserLanguage = 1 ; $ lang -> write ( ) ; $ response [ 'status' ] = 'HELO' ; $ response [ 'message' ] = "Language added successfully" ; } catch ( Exception $ e ) { $ response [ 'status' ] = 'EROR' ; $ response [ 'message' ] = _t ( 'CodeBankAPI.SERVER_ERROR' , '_Server error has occured, please try again later' ) ; } return $ response ; }
Creates a language in the database
@param {stdClass} $data Data passed from ActionScript
@return {array} Returns a standard response array
Creates a language in the database