PHP utility collection with hybrid and fluent APIs.

⌈⌋ branch:  hybrid7 libraries


Check-in [4b0715e805]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Restructured directory layout.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4b0715e8056ba865cbad76ae181911b921876d0e
User & Date: mario 2014-08-14 07:38:04
Context
2014-08-14
07:39
Added static $defaults[] array instead of built-in constructor calls. Introduces ->assert() to test CURL/HTTP properties after ->exec(), and possibly drop the result on mismatches. check-in: 49b2714f5f user: mario tags: trunk
07:38
Restructured directory layout. check-in: 4b0715e805 user: mario tags: trunk
2014-07-27
16:04
Document :* expression args wrapping, allow literal SQL parts or param arrays for rejoining. check-in: 8020d1afd4 user: mario tags: trunk
Changes

Name change from php7/curl.php to curl.php.

Name change from php7/db.php to db.php.

366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
    }
    // used as PDO statement
    function __call($func, $args) {
        return call_user_func_array(array($this->results, $func), $args);
    }

    // Single column access
    function __get($name) {
    
        // get first result, transfuse into $this
        if (is_object($this->results)) {
            $this->exchangeArray($this->results->fetch());
            unset($this->results);
        }
        
        // suffice __get
        return $this[$name];
    }

    // Just let PDOStatement handle the Traversable
    function getIterator() {
        return isset($this->results)
             ? $this->results
             : new ArrayIterator($this);







|








|







366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
    }
    // used as PDO statement
    function __call($func, $args) {
        return call_user_func_array(array($this->results, $func), $args);
    }

    // Single column access
    function offsetGet($name) {
    
        // get first result, transfuse into $this
        if (is_object($this->results)) {
            $this->exchangeArray($this->results->fetch());
            unset($this->results);
        }
        
        // suffice __get
        return parent::offsetGet($name);
    }

    // Just let PDOStatement handle the Traversable
    function getIterator() {
        return isset($this->results)
             ? $this->results
             : new ArrayIterator($this);

Name change from php7/input.inspekt.php to input.inspekt.php.

Name change from php7/input.php to input.php.

303
304
305
306
307
308
309




310
311
312
313
314
315
316
...
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
...
933
934
935
936
937
938
939


940

941
942
943
944
945
946
947
                return($result[$match]);
            }
        }
        # cropping
        elseif (strpos($rx, "[^")) {
            return preg_replace($rx, "", $data);
        }




    }
    
    /**
     * [w]
     * Miximum and minimum string length.
     *
     */
................................................................................
     * Removes residual and certain HTML tags.
     * WARNING: This is no `strip_tags()` substitute, but purposefully leaves
     * lonesome < angle brackets > alone. Only strips coherent and well-known
     * presentational markup.
     *
     */
    function _strip_markup($data, $with="") {
        return preg_replace("~<\s*/?\s*(a|b|i|em|strong|sup|sub|ins|del|br|hr|big|small|font|span|div|table|tr|td|ol|ul|li|dl|dd|dt|abbr|h[1-6])\b".
               "(?>[^>\"\']+|\"[^\"]*\"|'[^']*')*>~", $with, $data);
    }


    /**
     * [e]
     * Escape all significant special chars.
     *
................................................................................
            $keys = $this->__varname;
        }
        else {
            $keys = explode(",", $this->__varname);
        }

        // slice out named values from ->__vars


        $data = array_intersect_key($this->__vars, array_flip($keys));


        // chain to _array multiplex handler
        if (!$pass_array) {
            return $this->_array($data);
        }
        // process fetched list as array (for user-land functions like http_build_query)
        else {







>
>
>
>







 







|
|







 







>
>
|
>







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
...
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
                return($result[$match]);
            }
        }
        # cropping
        elseif (strpos($rx, "[^")) {
            return preg_replace($rx, "", $data);
        }
        # replacing
        else {
            return preg_replace($rx, $match, $data);
        }
    }
    
    /**
     * [w]
     * Miximum and minimum string length.
     *
     */
................................................................................
     * Removes residual and certain HTML tags.
     * WARNING: This is no `strip_tags()` substitute, but purposefully leaves
     * lonesome < angle brackets > alone. Only strips coherent and well-known
     * presentational markup.
     *
     */
    function _strip_markup($data, $with="") {
        return preg_replace("~(<\s*/?\s*(a|b|i|em|strong|sup|sub|ins|del|br|hr|big|small|font|span|div|table|tr|td|ol|ul|li|dl|dd|dt|abbr|tt|code|pre|h[1-6])\b".
               "(?>[^>\"\']+|\"[^\"]*\"|'[^']*')*>)+~", $with, $data);
    }


    /**
     * [e]
     * Escape all significant special chars.
     *
................................................................................
            $keys = $this->__varname;
        }
        else {
            $keys = explode(",", $this->__varname);
        }

        // slice out named values from ->__vars
        $data = array_merge(
            array_fill_keys($keys, NULL),
            array_intersect_key($this->__vars, array_flip($keys))
        );

        // chain to _array multiplex handler
        if (!$pass_array) {
            return $this->_array($data);
        }
        // process fetched list as array (for user-land functions like http_build_query)
        else {

Name change from php7/template.php to template.php.