本文整理汇总了PHP中create_object函数的典型用法代码示例。如果您正苦于以下问题:PHP create_object函数的具体用法?PHP create_object怎么用?PHP create_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_object函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function &instantiate_session_object($class_name, $arguments = array())
{
if (!isset($_SESSION['global_' . $class_name]) || get_class($_SESSION['global_' . $class_name]) != $class_name) {
$obj =& create_object($class_name, $arguments);
$_SESSION['global_' . $class_name] =& $obj;
} else {
$obj =& $_SESSION['global_' . $class_name];
}
return $obj;
}
示例2: create_object
function &instantiate_object($class_name, $include_dir = '', $exact_dir = false)
{
if (!isset($GLOBALS['global_' . $class_name]) || get_class($GLOBALS['global_' . $class_name]) != $class_name) {
$obj =& create_object($class_name, $include_dir, $exact_dir);
$GLOBALS['global_' . $class_name] =& $obj;
} else {
$obj =& $GLOBALS['global_' . $class_name];
}
return $obj;
}
示例3: create
function create($class_name)
{
include_class($class_name, '/core/controllers/');
return create_object($class_name);
}
示例4: create
function create($class_name)
{
return create_object($class_name, '/core/controllers/');
}
示例5: create
function create($db_table_name)
{
return create_object($db_table_name . '_db_table', '/core/db_tables/');
}
示例6: create
function create($db_table_name)
{
include_class($db_table_name . '_db_table', '/core/db_tables/');
return create_object($db_table_name . '_db_table');
}
示例7: end_test
$t = end_test($t, '++$this->x', $overhead);
$x->pre_dec_prop(N);
$t = end_test($t, '--$this->x', $overhead);
$x->post_inc_prop(N);
$t = end_test($t, '$this->x++', $overhead);
$x->post_dec_prop(N);
$t = end_test($t, '$this->x--', $overhead);
$x->isset_prop(N);
$t = end_test($t, 'isset($this->x)', $overhead);
$x->empty_prop(N);
$t = end_test($t, 'empty($this->x)', $overhead);
$x->call(N);
$t = end_test($t, '$this->f()', $overhead);
$x->read_const(N);
$t = end_test($t, '$x = Foo::TEST', $overhead);
create_object(N);
$t = end_test($t, 'new Foo()', $overhead);
read_const(N);
$t = end_test($t, '$x = TEST', $overhead);
read_auto_global(N);
$t = end_test($t, '$x = $_GET', $overhead);
read_global_var(N);
$t = end_test($t, '$x = $GLOBALS[\'v\']', $overhead);
read_hash(N);
$t = end_test($t, '$x = $hash[\'v\']', $overhead);
read_str_offset(N);
$t = end_test($t, '$x = $str[0]', $overhead);
issetor(N);
$t = end_test($t, '$x = $a ?: null', $overhead);
issetor2(N);
$t = end_test($t, '$x = $f ?: tmp', $overhead);
示例8: create_author_obj
function create_author_obj($author_obj)
{
return create_object($author_obj, 'authors', author_columns());
}
示例9: time
$fileUpload = './a.txt';
$fileWriteTo = './a.' . time () . '.txt';
$baidu_bcs = new BaiduBCS ( $ak, $sk, $host );
/**
* ************************single test******************************************* *
* */
try {
create_bucket ( $baidu_bcs );
//list_bucket ( $baidu_bcs );
//list_object ( $baidu_bcs );
//set_bucket_acl_by_acl_type ( $baidu_bcs );
//set_bucket_acl_by_json_array ( $baidu_bcs );
//set_bucket_acl_by_json_string ( $baidu_bcs );
//get_bucket_acl ( $baidu_bcs );
//delete_bucket ( $baidu_bcs );
create_object ( $baidu_bcs );
//create_object_superfile ( $baidu_bcs );
//upload_directory ( $baidu_bcs );
//copy_object ( $baidu_bcs );
//set_object_meta ( $baidu_bcs );
//get_object ( $baidu_bcs );
//is_object_exist ( $baidu_bcs );
//get_object_info ( $baidu_bcs );
//get_object_acl ( $baidu_bcs );
//set_object_acl_by_acl_type ( $baidu_bcs );
//set_object_acl_by_json_array ( $baidu_bcs );
//set_object_acl_by_json_string($baidu_bcs);
//delete_object ( $baidu_bcs );
//generate_get_object_url ( $baidu_bcs );
//generate_put_object_url ( $baidu_bcs );
示例10: video_upload
function video_upload($args)
{
$ext = filext($args['file']);
if ($args['mime'] == 'video/ogg' || $ext == 'ogv' || $ext == 'ogg') {
// notice: we also handle ogg here although this also could be a
// different mime type
// make sure mime type is set
$mime = 'video/ogg';
} elseif ($args['mime'] == 'video/h264' || $ext == 'h264') {
// haven't seen these out there
$mime = 'video/h264';
} elseif ($args['mime'] == 'video/mp4' || $ext == 'mp4') {
// think this need not be h264, but well
$mime = 'video/mp4';
} elseif ($args['mime'] == 'video/webm' || $ext == 'webm') {
// again, webm could also be audio/webm
$mime = 'video/webm';
} else {
return false;
}
load_modules('glue');
$obj = create_object($args);
if ($obj['#error']) {
return false;
} else {
$obj = $obj['#data'];
}
$obj['type'] = 'video';
$obj['module'] = 'video';
$obj['video-file'] = $args['file'];
$obj['video-file-mime'] = $mime;
save_object($obj);
$ret = render_object(array('name' => $obj['name'], 'edit' => true));
if ($ret['#error']) {
return false;
} else {
return $ret['#data'];
}
}
示例11: image_upload
/**
* implements upload
*/
function image_upload($args)
{
// check if supported file
if (!in_array($args['mime'], array('image/jpeg', 'image/png', 'image/gif')) || $args['mime'] == '' && !in_array(filext($args['file']), array('jpg', 'jpeg', 'png', 'gif'))) {
return false;
}
load_modules('glue');
// create new object
$obj = create_object($args);
if ($obj['#error']) {
return false;
} else {
$obj = $obj['#data'];
}
$obj['type'] = 'image';
// this is for a potential future speedup
$obj['module'] = 'image';
$obj['image-file'] = $args['file'];
$obj['image-file-mime'] = $args['mime'];
// save original-{width,height} if we can calculate it
if (_gd_available()) {
$a = expl('.', $args['page']);
$size = _gd_get_imagesize(CONTENT_DIR . '/' . $a[0] . '/shared/' . $obj['image-file']);
$obj['image-file-width'] = $size[0];
$obj['object-width'] = $size[0] . 'px';
$obj['image-file-height'] = $size[1];
$obj['object-height'] = $size[1] . 'px';
}
save_object($obj);
// render object and return html
$ret = render_object(array('name' => $obj['name'], 'edit' => true));
log_msg('debug', 'image_upload: ' . print_r($ret, 1));
if ($ret['#error']) {
return false;
} else {
return $ret['#data'];
}
}
示例12: create_book_obj
function create_book_obj($book_obj)
{
return create_object($book_obj, 'books', book_columns());
}
示例13: clone_object
/**
* duplicate an object
*
* @param array $args arguments
* key 'name' name of the object to duplicate
* @return array response
* string name of new object if successful
*/
function clone_object($args)
{
// load old object
$old = load_object($args);
if ($old['#error']) {
return $old;
} else {
$old = $old['#data'];
}
// create new object
$a = expl('.', $old['name']);
$new = create_object(array('page' => $a[0] . '.' . $a[1]));
if ($new['#error']) {
return $new;
} else {
$new = $new['#data'];
}
// save old object as new
$new = array_merge($old, $new);
$ret = save_object($new);
if ($ret['#error']) {
return $ret;
} else {
// return name
return response($new['name']);
}
}
示例14: download_upload_fallback
function download_upload_fallback($args)
{
// we handle everything
load_modules('glue');
$obj = create_object($args);
if ($obj['#error']) {
return false;
} else {
$obj = $obj['#data'];
}
$obj['type'] = 'download';
$obj['module'] = 'download';
$obj['download-file'] = $args['file'];
$obj['download-file-mime'] = $args['mime'];
save_object($obj);
$ret = render_object(array('name' => $obj['name'], 'edit' => true));
if ($ret['#error']) {
return false;
} else {
return $ret['#data'];
}
}