本文整理汇总了PHP中object函数的典型用法代码示例。如果您正苦于以下问题:PHP object函数的具体用法?PHP object怎么用?PHP object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importArticles
public function importArticles($filename, $dry_run = false)
{
// Open the file
$open_ok = $self->open($filename);
if ($open_ok !== true) {
return JError::raiseError(500, $open_ok);
}
// Read the data and import the articles
$num_records = 0;
while ($self->readNextRecord()) {
// Create the raw record
$record = object();
// Copy in the fields from the CSV data
$this->bind($record);
// Verify the category
$cat_ok = $this->_verifyCategory((int) $record->catid, $record->category_title);
if ($cat_ok !== true) {
return JError::raiseError(500, $cat_ok);
}
// Verify the creator
$creator_ok = $this->_verifyUser((int) $record->created_by, $record->created_by_name);
if ($creator_ok !== true) {
return JError::raiseError(500, $creator_ok);
}
// Save the record
if (!$dry_run) {
// ???
}
$num_records += 1;
}
$this->close();
}
示例2: __init
function __init()
{
access_policy('auth');
$this->menu = $this->makeMenu('index,auth,url' . (object('user')->isAdmin() ? ',#admin,login,server' : ''));
$this->invokeModel();
include_once 'lib/cq-forms.php';
}
示例3: friend_accept
function friend_accept($entityKey, $groupId)
{
$connection = new HubbubConnection(object('user')->ds['u_entity'], $entityKey);
$connection->group($groupId);
$friendEntity = new HubbubEntity($entityKey);
return($this->friend_request($friendEntity));
}
示例4: check
private function check($route)
{
if ($this->api->controller->method) {
return;
}
$route_callback = call_user_func_array(array($this->api->controller, 'route'), func_get_args());
$api_callback = null;
if ($route_callback->status) {
$this->api->controller->method = $this->api_method;
$args_object = object(array('method' => $this->api_method, 'match' => $route_callback->match));
if ($this->model_api_name) {
$model_api_name = "api_" . $this->model_api_name;
// $api_callback = $this->api->controller->model()->$model_api_name($args_object);
$this->api->controller->model_api_processor = $object = object(array("method" => $model_api_name, "args" => $args_object));
// $this->api->controller->api_callback = $api_callback;
}
if ($this->view_api_name && !\lib\router::get_storage('api')) {
$view_api_name = "view_" . $this->view_api_name;
if ($this->model_api_name) {
$args_object->api_callback = $api_callback;
}
// $api_callback = $this->api->controller->view()->$view_api_name($args_object);
$this->api->controller->view_api_processor = $object = object(array("method" => $view_api_name, "args" => $args_object));
}
}
}
示例5: check_route
public function check_route()
{
$this->match = object();
$args = func_get_args();
if (count($args) == 0) {
return;
}
$route = $args[0];
$fn = isset($args[1]) ? $args[1] : false;
if (is_string($route)) {
$this->url($route);
} else {
if (!isset($route['max']) && isset($route['url']) && is_array($route['url'])) {
$route['max'] = count($route['url']);
} elseif (!isset($route['max']) && !(isset($route['url']) && is_string($route['url']) && preg_match("/^(\\/.*\\/|#.*#|[.*])[gui]{0,3}\$/i", $route['url']))) {
$route['max'] = 0;
}
foreach ($route as $key => $value) {
if (method_exists($this, $key)) {
$this->{$key}($value);
}
}
}
if ($this->status === true && is_object($fn)) {
$arg = array_splice($args, 2);
array_push($arg, $this->match);
call_user_func_array($fn, $arg);
}
return $this->status;
}
示例6: __construct
public function __construct($object = false)
{
if (!$object) {
return;
}
$this->controller = $object->controller;
$this->data = new view\data();
$this->data->url = object();
$this->data->include = object();
$this->data->global = object();
$this->url = $this->data->url;
$this->global = $this->data->global;
$this->include = $this->data->include;
// default data property
$this->data->macro['forms'] = 'includes/macro/forms.html';
// default display value
$this->data->display['mvc'] = "includes/mvc/display.html";
$myurl = router::get_protocol() . '://' . router::get_domain() . $_SERVER['REQUEST_URI'];
if (isset($_SERVER['HTTP_REFERER']) && isset($_SESSION['debug'][md5($_SERVER['HTTP_REFERER'])])) {
$myurl = $_SERVER['HTTP_REFERER'];
}
if (isset($_SESSION['debug'][md5($myurl)])) {
$this->data->debug = $_SESSION['debug'][md5($myurl)];
// if(isset($_SESSION['debug'][md5($myurl)]['show']))
unset($_SESSION['debug'][md5($myurl)]);
// else
// $_SESSION['debug'][md5($myurl)]['show'] = true;
}
array_push($this->twig_include_path, root);
if (method_exists($this, 'mvc_construct')) {
$this->mvc_construct();
}
}
示例7: createform
function createform($_name, $_type = null)
{
$this->data->extendForm = true;
if (!$this->form) {
$this->twig_macro('form');
$this->form = new \lib\form();
$this->data->form = object();
}
$args = func_get_args();
if (count($args) === 2) {
$submit_value = T_('submit');
if ($_type == 'add') {
$submit_value = T_('submit');
} elseif ($_type == 'edit') {
$submit_value = T_('save');
} elseif ($_type == 'login') {
$submit_value = T_('sing in');
} elseif ($_type == 'register') {
$submit_value = T_('create an account');
} elseif (!empty($_type)) {
$submit_value = $_type;
}
array_push($args, $submit_value);
}
$form = call_user_func_array(array($this->form, 'make'), $args);
if (get_class($form) == 'lib\\form' || preg_match("/cls\\\\form/", get_class($form))) {
preg_match("/^(@[^\\.]+)*\\.(.+)\$/", $_name, $sName);
$this->data->form->{$sName[2]} = $form;
}
// if type of form is edit then fill it with related data
if ($_type == 'edit') {
$this->form_fill($form, $sName[2]);
}
return $form;
}
示例8: getAll
/**
* @desc - obtiene todos los registros de events
* @access public
* @author Iparra
* @return object
*/
public function getAll()
{
$query = $this->db->get('events');
if ($query->num_rows() > 0) {
return $query->result();
}
return object();
}
示例9: __construct
public function __construct($object = false)
{
if (!$object) {
return;
}
$this->querys = object();
$this->controller = $object->controller;
if (method_exists($this, '_construct')) {
$this->_construct();
}
}
示例10: object
/**
* @param array $array
*
* @return object
*/
function object($array = [])
{
$obj = (object) NULL;
foreach ($array as $key => $value) {
if (is_array($value)) {
$value = object($value);
}
$obj->{$key} = $value;
}
return $obj;
}
示例11: manifest_include_file
/**
* require an execommand manifest file
* @param string $_file_name manifest file name
*/
public function manifest_include_file($_file_name)
{
if (!array_key_exists($_file_name, manifest::$manifest_file_return)) {
$manifest = object();
$req = (require_once $_file_name);
$manifest = (array) $manifest;
$manifest = is_array($req) ? $req : $manifest;
manifest::$manifest_file_return[$_file_name] = $manifest;
} else {
$manifest = manifest::$manifest_file_return[$_file_name];
}
if (is_array($manifest)) {
$this->manifest_analyzer($manifest);
}
}
示例12: objectize
public function objectize($data)
{
if (is_array($data)) {
$ret = object($data);
}
if (is_string($data)) {
//see if it's a json struct?
$tmp = json_decode($data);
if (is_object($tmp)) {
$ret = $tmp;
} else {
throw new NinjaException("Couldn't convert {$data}", 50);
}
}
return $ret;
}
示例13: locale
/**
* @param string $lang
*/
function locale($lang)
{
global $config;
$lang = str_replace('..', '', $lang);
$lang = str_replace('/', '', $lang);
if (file_exists($file = '../locale/' . $lang . '.php')) {
require_once $file;
} elseif (file_exists($file = '../locale/en_US.php')) {
require_once $file;
} else {
$locale = array();
}
if (debug_assert(isset($locale), "locale {$lang} isn't defined")) {
$config->lang = $lang;
$config->locale = object($locale);
}
}
示例14: use_powerup
public function use_powerup($playerID)
{
Validate::player($playerID);
$playerModel = new PlayerModel();
if ($_POST['payload'] == 'true') {
Log::add("Payload pre hash: " . print_r($_POST, true));
$_POST['payload'] = Util::hashPost($_POST);
}
$remaining = $playerModel->removePowerup($playerID, $_POST['payload']);
if ($remaining) {
$response['status'] = 'ok';
$response['player'] = object(array("powerups" => $remaining));
} else {
$response['status'] = 'error';
}
$this->printJson($response);
}
示例15: setUsername
function setUsername($username)
{
$userObj = object('user');
$userObj->isNewUser = $this->ds['u_entity'] == 0;
$userObj->server = new HubbubServer(cfg('service/server'), true);
$userObj->loadEntity();
$userObj->entityDS['user'] = safename($username);
$userObj->entityDS['url'] = getDefault($userObj->entityDS['url'], cfg('service/server').'/'.(cfg('service/url_rewrite') ? '' : '?').$username);
$userObj->entityDS['_local'] = 'Y';
$userObj->entityDS['_serverkey'] = $userObj->server->ds['s_key'];
$userObj->entityDS['server'] = cfg('service/server');
if(trim($userObj->entityDS['user']) != '') $ekey = DB_UpdateDataset('entities', $userObj->entityDS);
$userObj->ds['u_entity'] = $ekey;
if(trim($userObj->ds['u_name']) != '') DB_UpdateDataset('users', $userObj->ds);
if($userObj->isNewUser) h2_execute_event('user_new', $userObj->entityDS, $userObj->ds);
}