src/Service/Cdn.php
public function getBuckets($page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select('b.id,b.slug,b.label,b.allowed_types,b.max_size,b.created,b.created_by');
        $oDb->select('b.modified,b.modified_by');

        //  Apply common items; pass $data
        $this->getCountCommonBuckets($data);

        // --------------------------------------------------------------------------

        //  Facilitate pagination
        if (!is_null($page)) {

            /**
             * Adjust the page variable, reduce by one so that the offset is calculated
             * correctly. Make sure we don't go into negative numbers
             */

            $page--;
            $page = $page < 0 ? 0 : $page;

            //  Work out what the offset should be
            $perPage = is_null($perPage) ? 50 : (int) $perPage;
            $offset  = $page * $perPage;

            $oDb->limit($perPage, $offset);
        }

        // --------------------------------------------------------------------------

        $buckets    = $oDb->get(NAILS_DB_PREFIX . 'cdn_bucket b')->result();
        $numBuckets = count($buckets);

        for ($i = 0; $i < $numBuckets; $i++) {

            //  Format the object, make it pretty
            $this->formatBucket($buckets[$i]);
        }

        return $buckets;
    }
public function getBuckets($page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select('b.id,b.slug,b.label,b.allowed_types,b.max_size,b.created,b.created_by');
        $oDb->select('b.modified,b.modified_by');

        //  Apply common items; pass $data
        $this->getCountCommonBuckets($data);

        // --------------------------------------------------------------------------

        //  Facilitate pagination
        if (!is_null($page)) {

            /**
             * Adjust the page variable, reduce by one so that the offset is calculated
             * correctly. Make sure we don't go into negative numbers
             */

            $page--;
            $page = $page < 0 ? 0 : $page;

            //  Work out what the offset should be
            $perPage = is_null($perPage) ? 50 : (int) $perPage;
            $offset  = $page * $perPage;

            $oDb->limit($perPage, $offset);
        }

        // --------------------------------------------------------------------------

        $buckets    = $oDb->get(NAILS_DB_PREFIX . 'cdn_bucket b')->result();
        $numBuckets = count($buckets);

        for ($i = 0; $i < $numBuckets; $i++) {

            //  Format the object, make it pretty
            $this->formatBucket($buckets[$i]);
        }

        return $buckets;
    }
public function getBuckets ( $ page = null , $ perPage = null , $ data = [ ] ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> select ( 'b.id,b.slug,b.label,b.allowed_types,b.max_size,b.created,b.created_by' ) ; $ oDb -> select ( 'b.modified,b.modified_by' ) ; //  Apply common items; pass $data $ this -> getCountCommonBuckets ( $ data ) ; // -------------------------------------------------------------------------- //  Facilitate pagination if ( ! is_null ( $ page ) ) { /**
             * Adjust the page variable, reduce by one so that the offset is calculated
             * correctly. Make sure we don't go into negative numbers
             */ $ page -- ; $ page = $ page < 0 ? 0 : $ page ; //  Work out what the offset should be $ perPage = is_null ( $ perPage ) ? 50 : ( int ) $ perPage ; $ offset = $ page * $ perPage ; $ oDb -> limit ( $ perPage , $ offset ) ; } // -------------------------------------------------------------------------- $ buckets = $ oDb -> get ( NAILS_DB_PREFIX . 'cdn_bucket b' ) -> result ( ) ; $ numBuckets = count ( $ buckets ) ; for ( $ i = 0 ; $ i < $ numBuckets ; $ i ++ ) { //  Format the object, make it pretty $ this -> formatBucket ( $ buckets [ $ i ] ) ; } return $ buckets ; }
Returns an array of buckets

@param integer $page    The page to return
@param integer $perPage The number of items to return per page
@param array   $data    An array of data to pass to getCountCommonBuckets()

@return array
Returns an array of buckets