This is the API documentation for concrete5 version 5.6 and earlier. View Current API Documentation
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 
<?php

defined('C5_EXECUTE') or die("Access Denied.");

/**
*
* @package Utilities
* The object class is extended by most objects in Concrete, but is mostly internal
* @access private 
*
*/
    class Concrete5_Library_Object {
    
        public $error = '';
        
        /* TODO: move these into an error class */
        
        function loadError($error) {
            $this->error = $error;
        }
        
        function isError() {
            $args = func_get_args();
            if (isset($args[0]) && $args[0]) {
                return $this->error == $args[0];
            } else {
                return $this->error;
            }
        }
        
        function getError() {
            return $this->error;
        }
        
        public function setPropertiesFromArray($arr) {
            foreach($arr as $key => $prop) {
                $this->{$key} = $prop;
            }
        }
        
        public static function camelcase($file) {
            // turns "asset_library" into "AssetLibrary"
            $r1 = ucwords(str_replace(array('_', '-', '/'), ' ', $file));
            $r2 = str_replace(' ', '', $r1);
            return $r2;     
        }

        public static function uncamelcase($string) {
            $v = preg_split('/([A-Z])/', $string, false, PREG_SPLIT_DELIM_CAPTURE);
            $a = array();
            array_shift($v);
            for($i = 0; $i < count($v); $i++) {
                if ($i % 2) {
                    if (function_exists('mb_strtolower')) {
                        $a[] = mb_strtolower($v[$i - 1] . $v[$i], APP_CHARSET);
                    } else {
                        $a[] = strtolower($v[$i - 1] . $v[$i]);
                    }
                }
            }
            return str_replace('__', '_', implode('_', $a));
        }       
    
    }