コード例 #1
0
ファイル: ValidateEmail.php プロジェクト: skipperbent/pecee
 public function validates()
 {
     if ($this->input->getValue()) {
         return Str::isEmail($this->input->getValue());
     }
     return true;
 }
コード例 #2
0
 public function search()
 {
     $query = input()->get('query');
     if (!empty($query)) {
         $results = new beemp3();
         $results = $results->search($query);
         if ($results) {
             $titles = array('query' => $query);
             $i = 0;
             foreach ($results as $result) {
                 $titles['OriginalTitles'][] = $result->title;
                 $titles['Titles'][] = Str::substr($result->title, 55);
                 if ($i > 10) {
                     break;
                 }
                 $i++;
             }
             echo json_encode($titles);
         }
     }
 }
コード例 #3
0
ファイル: ImageHandler.php プロジェクト: Monori/imgback
 protected function parseParameters()
 {
     $this->quality = $this->getParameter('q', self::QUALITY_DEFAULT);
     $this->height = $this->getParameter('h');
     $this->width = $this->getParameter('w');
     $this->fit = $this->getParameter('fit', self::FIT_MIN);
     $this->gamma = $this->getParameter('gam');
     $this->contrast = $this->getParameter('con');
     $this->brightness = $this->getParameter('bri');
     $this->sharpen = $this->getParameter('sharp');
     $this->greyscale = $this->getParameter('mono', false);
     $this->blur = $this->getParameter('blur');
     $this->format = $this->getParameter('fm', $this->format);
     if (strtolower($this->format) === self::FORMAT_AUTO) {
         $this->format = self::FORMAT_JPG;
         $this->quality = self::QUALITY_DEFAULT;
     }
     $this->rotation = $this->getParameter('rot');
     $this->orientation = $this->getParameter('or');
     $this->flip = $this->getParameter('flip');
     $this->text = $this->getParameter('txt');
     $this->font = $this->getParameter('txtfont', self::FONT_DEFAULT);
     $this->fontColor = $this->getParameter('txtclr', self::FONT_COLOR_DEFAULT);
     $this->fontSize = $this->getParameter('txtsize', self::FONT_SIZE_DEFAULT);
     $this->fontPadding = $this->getParameter('txtpad');
     $this->fontFit = strtolower($this->getParameter('txtfit'));
     $this->fontAlignHorizontal = 'center';
     $this->fontAlignVertical = 'middle';
     if ($this->getParameter('txtalign')) {
         $tmp = explode(',', $this->getParameter('txtalign'));
         foreach ($tmp as $value) {
             // Vertical alignment
             if (in_array(strtolower($value), array('top', 'bottom', 'middle'))) {
                 $this->fontAlignVertical = $value;
             }
             // Horizontal alignment
             if (in_array(strtolower($value), array('left', 'right', 'center'))) {
                 $this->fontAlignHorizontal = $value;
             }
         }
     }
     $this->watermark = $this->getParameter('mark');
     $this->watermarkAlign = $this->getParameter('markalign');
     $this->watermarkAlpha = $this->getParameter('markalpha');
     $this->watermarkFit = $this->getParameter('markfit');
     $this->watermarkHeight = $this->getParameter('markh');
     $this->watermarkWidth = $this->getParameter('markw');
     $this->watermarkScale = $this->getParameter('markscale');
     $this->watermarkX = $this->getParameter('markx');
     $this->watermarkY = $this->getParameter('marky');
     $this->watermarkPadding = $this->getParameter('markpad');
     $this->identifier = md5($this->filename . Str::getFirstOrDefault($this->quality, 0) . Str::getFirstOrDefault($this->height, 0) . Str::getFirstOrDefault($this->width, 0) . Str::getFirstOrDefault($this->fit, 0) . Str::getFirstOrDefault($this->gamma, 0) . Str::getFirstOrDefault($this->contrast, 0) . Str::getFirstOrDefault($this->brightness, 0) . Str::getFirstOrDefault($this->sharpen, 0) . Str::getFirstOrDefault($this->greyscale, 0) . Str::getFirstOrDefault($this->blur, 0) . Str::getFirstOrDefault($this->format, 0) . Str::getFirstOrDefault($this->flip, 0) . Str::getFirstOrDefault($this->orientation, 0) . Str::getFirstOrDefault($this->rotation, 0) . Str::getFirstOrDefault($this->text, 0) . Str::getFirstOrDefault($this->font, 0) . Str::getFirstOrDefault($this->fontColor, 0) . Str::getFirstOrDefault($this->fontSize, 0) . Str::getFirstOrDefault($this->fontPadding, 0) . Str::getFirstOrDefault($this->fontFit, 0) . Str::getFirstOrDefault($this->fontAlignVertical, 0) . Str::getFirstOrDefault($this->fontAlignHorizontal, 0) . Str::getFirstOrDefault($this->watermark, 0) . Str::getFirstOrDefault($this->watermarkAlign, 0) . Str::getFirstOrDefault($this->watermarkAlpha, 0) . Str::getFirstOrDefault($this->watermarkFit, 0) . Str::getFirstOrDefault($this->watermarkHeight, 0) . Str::getFirstOrDefault($this->watermarkWidth, 0) . Str::getFirstOrDefault($this->watermarkScale, 0) . Str::getFirstOrDefault($this->watermarkX, 0) . Str::getFirstOrDefault($this->watermarkY, 0) . Str::getFirstOrDefault($this->watermarkPadding, 0));
 }
コード例 #4
0
 public function firstOrFail()
 {
     $item = $this->first();
     if ($item === null) {
         throw new ModelNotFoundException(ucfirst(Str::camelize($this->model->getTable())) . ' was not found');
     }
     return $item;
 }
コード例 #5
0
ファイル: Model.php プロジェクト: skipperbent/pecee
 public function toArray()
 {
     $rows = $this->results['rows'];
     if ($rows && is_array($rows)) {
         foreach ($rows as $key => $row) {
             $key = isset($this->rename[$key]) ? $this->rename[$key] : $key;
             if (in_array($key, $this->hidden)) {
                 unset($rows[$key]);
                 continue;
             }
             $rows[$key] = $this->parseArrayData($row);
         }
         $this->orderArrayRows($rows);
     }
     if (count($this->getResults()) === 1) {
         foreach ($this->with as $with) {
             $method = Str::camelize($with);
             if (!method_exists($this, $method)) {
                 throw new ModelException('Missing required method ' . $method);
             }
             $output = call_user_func([$this, $method]);
             $with = isset($this->rename[$with]) ? $this->rename[$with] : $with;
             $rows[$with] = $output instanceof self || $output instanceof ModelCollection ? $output->toArray() : $output;
         }
         return $rows;
     }
     return $rows;
 }