Slide 1

Slide 1 text

AUTHSOME PLUGINS FOR CAKEPHP

Slide 2

Slide 2 text

~WHOAMI • Jose Diaz-Gonzalez • Resident IRC Troll (savant) • Rants at http://josediazgonzalez.com • Harasses as @savant • Codes as josegonzalez on github • EMPLOYED at @seatgeek I’m also hot like sriracha sauce ➘ me ➘ not me

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

AUTHSOME https://github.com/felixge/cakephp-authsome /**  *  Finds  the  current  user  for  the  dashboard  *  *  @param  string  $state  Either  "before"  or  "after"  *  @param  array  $query  *  @return  mixed  array  of  results  or  false  if  none  found  *  @return  array  */        function  _findUser($state,  $query,  $results  =  array())  {                if  ($state  ==  'before')  {                        $user_id  =  false;                        if  (!empty($query[0]))  {                                $user_id  =  $query[0];                        }  elseif  (!empty($query['id'])){                                $user_id  =  $query['id'];                        }  else  {                                $user_id  =  Authsome::get($this-­‐>primaryKey);                        }                        if  (empty($user_id))  {                                throw  new  OutOfBoundsException(__('Invalid  maintainer',  true));                        }                        $query['contain']  =  false;                        $query['conditions']  =  array("{$this-­‐>alias}.{$this-­‐>primaryKey}"  =>  $user_id);                        $query['limit']  =  1;                        return  $query;                }  elseif  ($state  ==  'after')  {                        if  (empty($results[0]))  {                                throw  new  OutOfBoundsException(__('Invalid  user',  true));                        }                        return  $results[0];                }        }

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

SEARCH https://github.com/CakeDC/Search  array('with'  =>  'Tagged'));        public  $filterArgs  =  array(                array('name'  =>  'title',  'type'  =>  'like'),                array('name'  =>  'status',  'type'  =>  'value'),                array('name'  =>  'blog_id',  'type'  =>  'value'),                array('name'  =>  'search',  'type'  =>  'like',  'field'  =>  'Article.description'),                array('name'  =>  'username',  'type'  =>  'like',  'field'  =>  'User.username'),                array('name'  =>  'tags',  'type'  =>  'subquery',  'method'  =>  'findByTags',  'field'  =>  'Article.id'),                array('name'  =>  'filter',  'type'  =>  'query',  'method'  =>  'orConditions'),        );        public  function  findByTags($data  =  array())  {                $this-­‐>Tagged-­‐>Behaviors-­‐>attach('Containable',  array('autoFields'  =>  false));                $this-­‐>Tagged-­‐>Behaviors-­‐>attach('Search.Searchable');                $query  =  $this-­‐>Tagged-­‐>getQuery('all',  array(                        'conditions'  =>  array('Tag.name'    =>  $data['tags']),                        'fields'  =>  array('foreign_key'),                        'contain'  =>  array('Tag')                ));                return  $query;        }        public  function  orConditions($data  =  array())  {                $filter  =  $data['filter'];                $cond  =  array(                        'OR'  =>  array(                                $this-­‐>alias  .  '.title  LIKE'  =>  '%'  .  $filter  .  '%',                                $this-­‐>alias  .  '.body  LIKE'  =>  '%'  .  $filter  .  '%',                        ));                return  $cond;        } }

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

LAZY MODEL https://github.com/Phally/lazy_model

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

ASSET COMPRESS https://github.com/markstory/asset_compress

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

DEBUG KIT https://github.com/cakephp/debug_kit

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

CODE CHECK https://github.com/petteyg/code_check

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

RESQUE PLUGIN https://github.com/mikesmullin/CakePHP-PHP-Resque-Plugin

Slide 20

Slide 20 text

No content