public static function wrap($object, $class = 'ViewableWrapper', $add_init_code=true)
    {
        if (self::is_publishing()) {
            $class2 = "{$class}_LivePub";
            if (class_exists($class2, true)) {
                $class = $class2;
            }

            $obj = new $class($object);
            if ($add_init_code && ($init = $obj->getStaticInit())) {
                self::$init_code[] = $init;
            }
        } else {
            $obj = new $class($object);
        }

        return $obj;
    }
public static function wrap($object, $class = 'ViewableWrapper', $add_init_code=true)
    {
        if (self::is_publishing()) {
            $class2 = "{$class}_LivePub";
            if (class_exists($class2, true)) {
                $class = $class2;
            }

            $obj = new $class($object);
            if ($add_init_code && ($init = $obj->getStaticInit())) {
                self::$init_code[] = $init;
            }
        } else {
            $obj = new $class($object);
        }

        return $obj;
    }
public static function wrap ( $ object , $ class = 'ViewableWrapper' , $ add_init_code = true ) { if ( self :: is_publishing ( ) ) { $ class2 = "{$class}_LivePub" ; if ( class_exists ( $ class2 , true ) ) { $ class = $ class2 ; } $ obj = new $ class ( $ object ) ; if ( $ add_init_code && ( $ init = $ obj -> getStaticInit ( ) ) ) { self :: $ init_code [ ] = $ init ; } } else { $ obj = new $ class ( $ object ) ; } return $ obj ; }
factory method to create a new wrapper object. if we're
static publishing and an appropriate helper class is
available it will use that instead. A helper class shouldn't
be needed very often but would be used if you wanted a totally
different class for publishing vs normal mode

@param object|array $object
@param string $class - what class to wrap it in
@param boolean $add_init_code [optional] - if true, the classes default static init code will be added automatically
@return ViewableWrapper
factory method to create a new wrapper object . if we re static publishing and an appropriate helper class is available it will use that instead . A helper class shouldn t be needed very often but would be used if you wanted a totally different class for publishing vs normal mode