public function check_word_count($submissiontext) {
        global $OUTPUT;

        $wordlimitenabled = $this->get_config('wordlimitenabled');
        $wordlimit = $this->get_config('wordlimit');

        if ($wordlimitenabled == 0) {
            return null;
        }

        // Count words and compare to limit.
        $wordcount = count_words($submissiontext);
        if ($wordcount <= $wordlimit) {
            return null;
        } else {
            $errormsg = get_string('wordlimitexceeded', 'assignsubmission_onlinetext',
                    array('limit' => $wordlimit, 'count' => $wordcount));
            return $OUTPUT->error_text($errormsg);
        }
    }
public function check_word_count($submissiontext) {
        global $OUTPUT;

        $wordlimitenabled = $this->get_config('wordlimitenabled');
        $wordlimit = $this->get_config('wordlimit');

        if ($wordlimitenabled == 0) {
            return null;
        }

        // Count words and compare to limit.
        $wordcount = count_words($submissiontext);
        if ($wordcount <= $wordlimit) {
            return null;
        } else {
            $errormsg = get_string('wordlimitexceeded', 'assignsubmission_onlinetext',
                    array('limit' => $wordlimit, 'count' => $wordcount));
            return $OUTPUT->error_text($errormsg);
        }
    }
public function check_word_count ( $ submissiontext ) { global $ OUTPUT ; $ wordlimitenabled = $ this -> get_config ( 'wordlimitenabled' ) ; $ wordlimit = $ this -> get_config ( 'wordlimit' ) ; if ( $ wordlimitenabled == 0 ) { return null ; } // Count words and compare to limit. $ wordcount = count_words ( $ submissiontext ) ; if ( $ wordcount <= $ wordlimit ) { return null ; } else { $ errormsg = get_string ( 'wordlimitexceeded' , 'assignsubmission_onlinetext' , array ( 'limit' => $ wordlimit , 'count' => $ wordcount ) ) ; return $ OUTPUT -> error_text ( $ errormsg ) ; } }
Compare word count of onlinetext submission to word limit, and return result.

@param string $submissiontext Onlinetext submission text from editor
@return string Error message if limit is enabled and exceeded, otherwise null
Compare word count of onlinetext submission to word limit and return result .