示例#1
0
 /**
  * Get the formatted error text
  */
 public function getErrorText($text = '')
 {
     $text = Utils::getValue($text, 'Too many failed attempts.');
     $count = $this->session->get($this->key . '.info.fail_count', 0);
     $total = $this->session->get($this->key . '.info.fail_total', 0);
     $last = $this->session->get($this->key . '.info.last_attempt', 0);
     $keymap = array('attempts' => $total, 'countdown' => Time::toCountdown($last, $this->cd_time), 'count' => '(' . $count . '/' . $this->cd_trigger . ')', 'total' => '(' . $total . '/' . $this->max_attempts . ')');
     return (string) Text::set($text)->mapReplace($keymap)->singleSpaces();
 }
示例#2
0
 /**
  * Reduces the size of a text entry for a specified char limit
  */
 public function shrinkText($row = array(), $column = '', $length = 140)
 {
     if (!empty($column) && array_key_exists($column, $row)) {
         $row[$column] = (string) Text::set($row[$column])->shrink($length);
     }
     return $row;
 }