本文整理汇总了PHP中Object::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::init方法的具体用法?PHP Object::init怎么用?PHP Object::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::init方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
parent::init();
\Pinst::$app->registerShutdownFunction(function ($app) {
$app->errorHandel->unregister();
});
}
示例2: loadOrder
/**
* Sets an order as the current order.
* @param Int | Order $order
* @return Boolean
*/
public function loadOrder($order)
{
//TODO: how to handle existing order
//TODO: permission check - does this belong to another member? ...or should permission be assumed already?
if (is_numeric($order)) {
$this->order = DataObject::get_by_id('Order', $order);
} elseif ($order instanceof Order) {
$this->order = $order;
}
if ($this->order) {
if ($this->order->canView()) {
$this->order->init(true);
$sessionVariableName = $this->sessionVariableName("OrderID");
Session::set($sessionVariableName, $this->order->ID);
$this->addMessage(_t("ShoppingCart.LOADEDEXISTING", "Order loaded."), 'good');
return true;
} else {
$this->addMessage(_t("ShoppingCart.NOPERMISSION", "You do not have permission to view this order."), 'bad');
return false;
}
} else {
$this->addMessage(_t("ShoppingCart.NOORDER", "Order can not be found."), 'bad');
return false;
}
}
示例3: init
protected function init(NamedArguments $arguments)
{
parent::init($arguments);
$this->issn = $arguments->issn;
$this->isbn = $arguments->isbn;
$this->config = new Configuration();
//determine the full URL
//change the string sent to SFX depending on whether ISBN or ISSN was passed in
if ($this->isbn) {
$stringAppend = "&isbn=" . $this->isbn;
} else {
$stringAppend = "&issn=" . $this->issn;
}
//get the sfx open URL out of the config settings
$open_url = $this->config->settings->open_url;
//check if there is already a ? in the URL so that we don't add another when appending the parms
if (strpos($open_url, "?") > 0) {
$open_url .= "&";
} else {
$open_url .= "?";
}
$sid = $this->config->settings->sid;
if ($sid) {
$open_url .= "rfr_id=info:sid/" . $sid;
}
$this->open_url = $open_url . "&sfx.ignore_date_threshold=1&sfx.response_type=simplexml" . $stringAppend;
}
示例4: init
protected function init(NamedArguments $arguments)
{
parent::init($arguments);
$this->issn = $arguments->issn;
$this->isbn = $arguments->isbn;
$this->config = new Configuration();
}
示例5: loadOrder
/**
* Sets an order as the current order.
* @param Int | Order $order
* @return Boolean
*/
public function loadOrder($order)
{
//TODO: how to handle existing order
//TODO: permission check - does this belong to another member? ...or should permission be assumed already?
if (is_numeric($order)) {
$this->order = Order::get()->byID($order);
} elseif (is_a($order, Object::getCustomClass("Order"))) {
$this->order = $order;
} else {
user_error("Bad order provided as parameter to ShoppingCart::loadOrder()");
}
if ($this->order) {
if ($this->order->canView()) {
$this->order->init(true);
$sessionVariableName = $this->sessionVariableName("OrderID");
Session::set($sessionVariableName, $this->order->ID);
$this->addMessage(_t("Order.LOADEDEXISTING", "Order loaded."), 'good');
return true;
} else {
$this->addMessage(_t("Order.NOPERMISSION", "You do not have permission to view this order."), 'bad');
return false;
}
} else {
$this->addMessage(_t("Order.NOORDER", "Order can not be found."), 'bad');
return false;
}
}
示例6: init
public function init()
{
parent::init();
\Pinst::$app->registerShutdownFunction(function ($app) {
$app->logger->save();
});
}
示例7: init
protected function init(NamedArguments $arguments)
{
parent::init($arguments);
$this->issn = $arguments->issn;
$this->isbn = $arguments->isbn;
$this->config = new Configuration();
//determine the full open URL
//change the string sent depending on whether ISBN or ISSN was passed in
if ($this->isbn) {
$stringAppend = "&rft.isbn=" . $this->isbn;
} else {
$stringAppend = "&rft.issn=" . $this->issn;
}
//get the client identifier out of the config settings
$client_identifier = $this->config->settings->client_identifier;
$this->open_url = "http://" . $client_identifier . ".openurl.xml.serialssolutions.com/openurlxml?version=1.0&url_ver=Z39.88-2004" . $stringAppend;
}
示例8: init
/**
* When initiating set value for self::$_self; so that it can be called from ::get();
* Multiple values will be set for that, one for each config variant that is initiated.
* @param string[] $config Config values that were used when the object was instantiated.
*/
protected function init($config)
{
$this->addNamespace(self::APP_DEVELOPER_VENDORKEY, APP_ROOT);
self::$_self[md5(serialize($config))] = $this;
return parent::init();
}
示例9: getType
$params[$k] = $v;
}
return $params;
}
public function getType()
{
return substr($this->_id, 0, strpos($this->_id, "."));
}
public function __toJSON()
{
if (defined('JSON_PRETTY_PRINT')) {
return json_encode($this->__toArray(true), JSON_PRETTY_PRINT);
} else {
return json_encode($this->__toArray(true));
}
}
public function __toString()
{
return $this->__toJSON();
}
public function __toArray($recursive = false)
{
if ($recursive) {
return Util::convertIxfObjectToArray($this->_values);
} else {
return $this->_values;
}
}
}
Object::init();
示例10: init
/**
* {@inheritdoc}
*/
public function init(array $data)
{
parent::init($data);
$this->setOption('target', $this->getId());
}