Changeset 1449

Show
Ignore:
Timestamp:
12/07/2007 03:04:05 PM (10 months ago)
Author:
Geert
Message:
  • Added uri->rsegment_array(), uri->total_rsegments() and uri->last_rsegment()
  • Synced i18n/nl_NL
  • Some other minor changes
Location:
trunk/system
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/helpers/valid.php

    r1446 r1449  
    153153                                'luhn'   => TRUE 
    154154                        ), 
     155                        'maestro' => array 
     156                        ( 
     157                                'length' => '16,18', 
     158                                'prefix' => '50(?:20|38)|6(?:304|759)', 
     159                                'luhn'   => TRUE 
     160                        ), 
     161                        'mastercard' => array 
     162                        ( 
     163                                'length' => '16', 
     164                                'prefix' => '5[1-5]', 
     165                                'luhn'   => TRUE 
     166                        ), 
    155167                        'visa' => array 
    156168                        ( 
     
    159171                                'luhn'   => TRUE 
    160172                        ), 
    161                         'maestro' => array 
    162                         ( 
    163                                 'length' => '16,18', 
    164                                 'prefix' => '50(?:20|38)|6(?:304|759)', 
    165                                 'luhn'   => TRUE 
    166                         ), 
    167                         'mastercard' => array 
     173                        'visa electron' => array 
    168174                        ( 
    169175                                'length' => '16', 
    170                                 'prefix' => '5[1-5]', 
     176                                'prefix' => '4(?:17500|91[37]|508|844)', 
    171177                                'luhn'   => TRUE 
    172178                        ), 
     
    225231        public static function phone($number) 
    226232        { 
    227                 $number = preg_replace('/[^0-9]/', '', $number); 
     233                $number = preg_replace('/\D+/', '', $number); 
    228234 
    229235                if (strlen($number) > 10 AND substr($number, 0, 1) === '1') 
  • trunk/system/i18n/nl_NL/cache.php

    r1309 r1449  
    66        'unwritable'           => 'De geconfigureerde opslaglocatie, <tt>%s</tt>, is niet schrijfbaar.', 
    77        'resources'            => 'Het cachen van resources is onmogelijk omdat resources niet geserialized kunnen worden.', 
     8        'driver_error'         => '%s', 
    89); 
  • trunk/system/i18n/nl_NL/core.php

    r1297 r1449  
    1212        'page_not_found'        => 'De opgevraagde pagina, <tt>%s</tt>, kon niet gevonden worden.', 
    1313        'stats_footer'          => 'Geladen in {execution_time} seconden, met een geheugengebruik van {memory_usage}. Aangedreven door Kohana v{kohana_version}.', 
    14         'error_message'         => 'Fout vond plaats op <strong>lijn %s</strong> van <strong>%s</strong>.' 
     14        'error_message'         => 'Fout vond plaats op <strong>lijn %s</strong> van <strong>%s</strong>.', 
     15        'stack_trace'           => 'Stack Trace', 
    1516); 
  • trunk/system/libraries/Pagination.php

    r1419 r1449  
    9393                        } 
    9494 
    95                         // Create a generic base_url with {page} and {query_string} placeholders 
     95                        // Create a generic base_url including query string and a {page} placeholder 
    9696                        $this->base_url[$this->uri_segment - 1] = '{page}'; 
    9797                        $this->base_url = url::site(implode('/', $this->base_url)).Router::$query_string; 
  • trunk/system/libraries/Payment.php

    r1297 r1449  
    1717                'driver'      => NULL, 
    1818                // Curl config, see http://us.php.net/manual/en/function.curl-setopt.php for details 
    19                 'curl_config' => array(CURLOPT_HEADER => FALSE, 
    20                                CURLOPT_RETURNTRANSFER => TRUE, 
    21                                CURLOPT_SSL_VERIFYPEER => FALSE 
    22                               ), 
     19                'curl_config' => array 
     20                ( 
     21                        CURLOPT_HEADER         => FALSE, 
     22                        CURLOPT_RETURNTRANSFER => TRUE, 
     23                        CURLOPT_SSL_VERIFYPEER => FALSE 
     24                ), 
    2325                // Test mode is set to true by default 
    2426                'test_mode'   => TRUE, 
     
    6971                        $config = Config::item('payment.default'); 
    7072                } 
    71                 else if (is_string($config)) 
     73                elseif (is_string($config)) 
    7274                { 
    7375                        $this->config['driver'] = $config; 
  • trunk/system/libraries/URI.php

    r1230 r1449  
    126126 
    127127        /** 
     128         * Method: rsegment_array 
     129         *  Returns an array containing all the re-routed URI segments. 
     130         * 
     131         * Parameters: 
     132         *  offset      - rsegment offset 
     133         *  associative - return an associative array 
     134         * 
     135         * Returns: 
     136         *   Array of re-routed URI segments 
     137         */ 
     138        public function rsegment_array($offset = 0, $associative = FALSE) 
     139        { 
     140                $segment_array = self::$rsegments; 
     141                array_unshift($segment_array, 0); 
     142                $segment_array = array_slice($segment_array, $offset + 1, $this->total_segments(), TRUE); 
     143 
     144                if ( ! $associative) 
     145                        return $segment_array; 
     146 
     147                $segment_array_assoc = array(); 
     148 
     149                foreach (array_chunk($segment_array, 2) as $pair) 
     150                { 
     151                        $segment_array_assoc[$pair[0]] = isset($pair[1]) ? $pair[1] : ''; 
     152                } 
     153 
     154                return $segment_array_assoc; 
     155        } 
     156 
     157        /** 
    128158         * Method: string 
    129159         *  Returns the complete URI as a string. 
     
    136166                return self::$current_uri; 
    137167        } 
    138          
     168 
     169        /** 
     170         * Method: __toString 
     171         *  Magic method for converting an object to a string. 
     172         * 
     173         * Returns: 
     174         *  Full URI as string 
     175         */      
    139176        public function __toString() 
    140177        { 
     
    152189        { 
    153190                return count(self::$segments); 
     191        } 
     192 
     193        /** 
     194         * Method: total_rsegments 
     195         *  Returns the total number of re-routed URI segments. 
     196         * 
     197         * Returns: 
     198         *   Total number of re-routed URI segments 
     199         */ 
     200        public function total_rsegments() 
     201        { 
     202                return count(self::$rsegments); 
    154203        } 
    155204 
     
    169218        } 
    170219 
     220        /** 
     221         * Method: last_rsegment 
     222         *  Returns the last re-routed URI segment. 
     223         * 
     224         * Returns: 
     225         *   Last re-routed URI segment 
     226         */ 
     227        public function last_rsegment($default = FALSE) 
     228        { 
     229                if ($this->total_rsegments() < 1) 
     230                        return $default; 
     231                 
     232                return end(self::$rsegments); 
     233        } 
     234 
    171235} // End URI Class