本文整理汇总了PHP中object2array函数的典型用法代码示例。如果您正苦于以下问题:PHP object2array函数的具体用法?PHP object2array怎么用?PHP object2array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了object2array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
}
Element\Editlock::lock($this->getParam("id"), "document");
$link = Document\Hardlink::getById($this->getParam("id"));
$link = clone $link;
$link->idPath = Element\Service::getIdPath($link);
$link->userPermissions = $link->getUserPermissions();
$link->setLocked($link->isLocked());
$link->setParent(null);
if ($link->getSourceDocument()) {
$link->sourcePath = $link->getSourceDocument()->getRealFullPath();
}
$this->addTranslationsData($link);
$this->minimizeProperties($link);
//Hook for modifying return value - e.g. for changing permissions based on object data
//data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
$returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($link));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $link, "returnValueContainer" => $returnValueContainer]);
if ($link->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(false);
}
开发者ID:solverat,项目名称:pimcore,代码行数:27,代码来源:HardlinkController.php
示例2: __construct
public function __construct($name)
{
parent::__construct();
$path = PATH . "/themes/" . $name . "/theme.xml";
// load the theme settings file if it exists
if ($xml = get_file($path)) {
// load xml object, and convert it to an array
$settings = object2array(simplexml_load_string($xml));
} else {
$settings = array();
}
$path = PATH . "/themes/" . $name . "/macros.xml";
// load the theme settings file if it exists
if ($xml = get_file($path)) {
// load xml object, and convert it to an array
$settings['macros'] = object2array(simplexml_load_string($xml));
} else {
$settings['macros'] = array();
}
$settings['path'] = $name;
$settings['name'] = $name;
foreach ($settings as $key => $value) {
if ($value !== "" && $value !== " ") {
$this->Settings[$key] = $value;
}
}
}
开发者ID:ericmuyser,项目名称:web2f,代码行数:27,代码来源:Theme.class.php
示例3: populateLanguage
function populateLanguage()
{
global $auto_update_language;
global $languageUrl;
global $languageArr;
global $language;
global $dir;
createSearchLanguageAPI();
if ($auto_update_language == true) {
if ($_SESSION['check_language'] == false || !isset($_SESSION['check_language'])) {
$languageArr = object2array('./language/language_' . $language . '.xml');
} else {
if (file_exists('./language/language_' . $language . '.xml')) {
$xmlServerData = object2array($languageUrl);
$xmlLocal = object2array('./language/language_' . $language . '.xml');
if ($xmlServerData['@attributes']['version'] != $xmlLocal['@attributes']['version']) {
$xml = file_get_contents($languageUrl);
file_put_contents('./language/language_' . $language . '.xml', $xml);
}
$_SESSION['check_language'] = true;
$languageArr = object2array('./language/language_' . $language . '.xml');
} else {
$xml = file_get_contents($languageUrl);
file_put_contents('./language/language_' . $language . '.xml', $xml);
$_SESSION['check_language'] = true;
$languageArr = object2array('./language/language_' . $language . '.xml');
}
}
} else {
$languageArr = object2array('./language/language_' . $language . '.xml');
}
}
开发者ID:resales-online,项目名称:webkit,代码行数:32,代码来源:incLanguage.php
示例4: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "document")]);
}
Element\Editlock::lock($this->getParam("id"), "document");
$email = Document\Newsletter::getById($this->getParam("id"));
$email = clone $email;
$email = $this->getLatestVersion($email);
$versions = Element\Service::getSafeVersionInfo($email->getVersions());
$email->setVersions(array_splice($versions, 0, 1));
$email->idPath = Element\Service::getIdPath($email);
$email->userPermissions = $email->getUserPermissions();
$email->setLocked($email->isLocked());
$email->setParent(null);
// unset useless data
$email->setElements(null);
$email->childs = null;
$this->addTranslationsData($email);
$this->minimizeProperties($email);
//Hook for modifying return value - e.g. for changing permissions based on object data
//data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
$returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($email));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $email, "returnValueContainer" => $returnValueContainer]);
if ($email->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(false);
}
开发者ID:pimcore,项目名称:pimcore,代码行数:30,代码来源:NewsletterController.php
示例5: getFeaturesData
function getFeaturesData()
{
global $featureDataUrl;
createSearchFeatureAPI();
$data = object2array($featureDataUrl);
return $data;
}
开发者ID:resales-online,项目名称:webkit,代码行数:7,代码来源:incSearchFunction.php
示例6: getVersionsAction
/**
* @throws \Exception
*/
public function getVersionsAction()
{
$id = intval($this->getParam("id"));
$type = $this->getParam("controller");
$allowedTypes = ["asset", "document", "object"];
if ($id && in_array($type, $allowedTypes)) {
$element = Model\Element\Service::getElementById($type, $id);
if ($element) {
if ($element->isAllowed("versions")) {
$schedule = $element->getScheduledTasks();
$schedules = [];
foreach ($schedule as $task) {
if ($task->getActive()) {
$schedules[$task->getVersion()] = $task->getDate();
}
}
$versions = $element->getVersions();
$versions = object2array($versions);
foreach ($versions as &$version) {
unset($version["user"]["password"]);
// remove password hash
$version["scheduled"] = null;
if (array_key_exists($version["id"], $schedules)) {
$version["scheduled"] = $schedules[$version["id"]];
}
}
$this->_helper->json(["versions" => $versions]);
} else {
throw new \Exception("Permission denied, " . $type . " id [" . $id . "]");
}
} else {
throw new \Exception($type . " with id [" . $id . "] doesn't exist");
}
}
}
开发者ID:solverat,项目名称:pimcore,代码行数:38,代码来源:Element.php
示例7: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (\Pimcore\Model\Element\Editlock::isLocked($this->getParam("id"), "document")) {
$this->_helper->json(["editlock" => \Pimcore\Model\Element\Editlock::getByElement($this->getParam("id"), "document")]);
}
\Pimcore\Model\Element\Editlock::lock($this->getParam("id"), "document");
$page = Document\Printpage::getById($this->getParam("id"));
$page = $this->getLatestVersion($page);
$page->getVersions();
$page->getScheduledTasks();
$page->idPath = Service::getIdPath($page);
$page->userPermissions = $page->getUserPermissions();
$page->setLocked($page->isLocked());
if ($page->getContentMasterDocument()) {
$page->contentMasterDocumentPath = $page->getContentMasterDocument()->getRealFullPath();
}
$this->addTranslationsData($page);
// unset useless data
$page->setElements(null);
$page->childs = null;
// cleanup properties
$this->minimizeProperties($page);
//Hook for modifying return value - e.g. for changing permissions based on object data
//data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
$returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($page));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $page, "returnValueContainer" => $returnValueContainer]);
if ($page->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(false);
}
开发者ID:pimcore,项目名称:pimcore,代码行数:32,代码来源:Printpage.php
示例8: exec_boku_call
function exec_boku_call($func, $data)
{
$url = "https://api2.boku.com/billing/request?action={$func}";
$url .= "&merchant-id=arktosgroup";
$url .= "&password=f1gz45hd5";
$url .= "&service-id=6dfb7ffc7a8c4f6724a3777d";
$url .= $data;
// setting the curl parameters.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 0);
// Get response from the server.
$resp = curl_exec($ch);
if (!$resp) {
exit('SMS prepare failed: ' . curl_error($ch) . '(' . curl_errno($ch) . ')');
}
// parse returned XML
$xml_obj = simplexml_load_string($resp);
$xml = object2array($xml_obj);
return $xml;
}
开发者ID:Mateuus,项目名称:website,代码行数:25,代码来源:Store_SMS.php
示例9: save
/**
* @return void
*/
public function save()
{
$arrayConfig = object2array($this);
$config = new \Zend_Config($arrayConfig);
$writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => $this->getConfigFile()));
$writer->write();
return true;
}
开发者ID:ChristophWurst,项目名称:pimcore,代码行数:11,代码来源:Config.php
示例10: getFeatureResults
function getFeatureResults($apiString)
{
$data = object2array($apiString);
if (isset($data['Property'])) {
return $data['Property'];
}
return NULL;
}
开发者ID:resales-online,项目名称:webkit,代码行数:8,代码来源:incFeatureFunction.php
示例11: object2Array
/**
* @public
* @recursve
*
* convert object to array
*/
public static function object2Array($obj)
{
$_arr = is_object($obj) ? get_object_vars($obj) : $obj;
$arr = array();
foreach ($_arr as $key => $val) {
$val = is_array($val) || is_object($val) ? object2array($val) : $val;
$arr[$key] = $val;
}
return $arr;
}
开发者ID:DevSKolb,项目名称:FLOWLite,代码行数:16,代码来源:ArrayHelper.php
示例12: save
/**
* @return void
*/
public function save()
{
$arrayConfig = object2array($this);
$items = $arrayConfig["items"];
$arrayConfig["items"] = array("item" => $items);
$params = $arrayConfig["params"];
$arrayConfig["params"] = array("param" => $params);
$config = new Zend_Config($arrayConfig);
$writer = new Zend_Config_Writer_Xml(array("config" => $config, "filename" => $this->getConfigFile()));
$writer->write();
return true;
}
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:15,代码来源:Config.php
示例13: getDataByIdAction
public function getDataByIdAction()
{
$document = Document::getById($this->getParam("id"));
$document = clone $document;
//Hook for modifying return value - e.g. for changing permissions based on object data
//data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
$returnValueContainer = new \Pimcore\Model\Tool\Admin\EventDataContainer(object2array($document));
\Pimcore::getEventManager()->trigger("admin.document.get.preSendData", $this, ["document" => $document, "returnValueContainer" => $returnValueContainer]);
if ($document->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(["success" => false, "message" => "missing_permission"]);
}
开发者ID:solverat,项目名称:pimcore,代码行数:13,代码来源:DocumentController.php
示例14: getDataByIdAction
public function getDataByIdAction()
{
// check for lock
if (Element\Editlock::isLocked($this->getParam("id"), "asset")) {
$this->_helper->json(["editlock" => Element\Editlock::getByElement($this->getParam("id"), "asset")]);
}
Element\Editlock::lock($this->getParam("id"), "asset");
$asset = Asset::getById(intval($this->getParam("id")));
$asset = clone $asset;
if (!$asset instanceof Asset) {
$this->_helper->json(["success" => false, "message" => "asset doesn't exist"]);
}
$asset->setMetadata(Asset\Service::expandMetadataForEditmode($asset->getMetadata()));
$asset->setProperties(Element\Service::minimizePropertiesForEditmode($asset->getProperties()));
//$asset->getVersions();
$asset->getScheduledTasks();
$asset->idPath = Element\Service::getIdPath($asset);
$asset->userPermissions = $asset->getUserPermissions();
$asset->setLocked($asset->isLocked());
$asset->setParent(null);
if ($asset instanceof Asset\Text) {
$asset->data = $asset->getData();
}
if ($asset instanceof Asset\Image) {
$imageInfo = [];
if ($asset->getWidth() && $asset->getHeight()) {
$imageInfo["dimensions"] = [];
$imageInfo["dimensions"]["width"] = $asset->getWidth();
$imageInfo["dimensions"]["height"] = $asset->getHeight();
}
$exifData = $asset->getEXIFData();
if (!empty($exifData)) {
$imageInfo["exif"] = $exifData;
}
$iptcData = $asset->getIPTCData();
if (!empty($exifData)) {
$imageInfo["iptc"] = $iptcData;
}
$imageInfo["exiftoolAvailable"] = (bool) \Pimcore\Tool\Console::getExecutable("exiftool");
$asset->imageInfo = $imageInfo;
}
$asset->setStream(null);
//Hook for modifying return value - e.g. for changing permissions based on object data
//data need to wrapped into a container in order to pass parameter to event listeners by reference so that they can change the values
$returnValueContainer = new Model\Tool\Admin\EventDataContainer(object2array($asset));
\Pimcore::getEventManager()->trigger("admin.asset.get.preSendData", $this, ["asset" => $asset, "returnValueContainer" => $returnValueContainer]);
if ($asset->isAllowed("view")) {
$this->_helper->json($returnValueContainer->getData());
}
$this->_helper->json(["success" => false, "message" => "missing_permission"]);
}
开发者ID:pimcore,项目名称:pimcore,代码行数:51,代码来源:AssetController.php
示例15: restore
function restore($db_a, $dir, $type = false)
{
global $sag;
if ($handle = opendir($dir)) {
try {
$sag->createDatabase($db_a);
} catch (Exception $e) {
echo $e->getMessage() . "DB:" . $db_a . "\n";
}
$sag->setDatabase($db_a);
while (false !== ($entry = readdir($handle))) {
if (".." == $entry || "." == $entry) {
continue;
}
$obj1 = get_entry($db_a, "/" . $entry);
$temp_rev = $obj1['res']->_rev;
$obj2 = json_decode(file_get_contents($dir . $entry . '/' . $entry . '.json'));
if (is_object($obj1)) {
$obj = update_together($obj1['res'], $obj2, 'object');
} else {
$obj = $obj2;
}
$obj = object2array($obj);
unset($obj['err']);
unset($obj['_rev']);
try {
if (preg_match("/^_/", urldecode($entry))) {
echo $sag->put(urldecode($entry), $obj)->body->ok;
} else {
echo $sag->put($entry, $obj)->body->ok;
}
} catch (Exception $e) {
if ($type == 'update') {
$obj['_rev'] = $temp_rev;
$obj['views'] = $obj['views'] + 1;
}
try {
if (preg_match("/^_/", urldecode($entry))) {
echo $sag->put(urldecode($entry), $obj)->body->ok;
} else {
echo $sag->put($entry, $obj)->body->ok;
}
} catch (Exception $e) {
echo $e->getMessage() . "DB:" . $db_a . " file:" . urlencode($entry) . "\n";
}
}
}
}
return "restore file->db finished\n";
}
开发者ID:urueedi,项目名称:kazoo-regextern,代码行数:50,代码来源:setup_functions.php
示例16: save
/**
* @return void
*/
public function save()
{
$arrayConfig = object2array($this);
$items = $arrayConfig["items"];
$arrayConfig["items"] = array("item" => $items);
$params = $arrayConfig["params"];
$arrayConfig["params"] = array("param" => $params);
$config = new \Zend_Config($arrayConfig);
$writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => $this->getConfigFile()));
$writer->write();
// clear cache tags
Cache::clearTags(array("tagmanagement", "output"));
return true;
}
开发者ID:sfie,项目名称:pimcore,代码行数:17,代码来源:Config.php
示例17: get_lat_long
function get_lat_long($address)
{
$Address = urlencode($address);
//"30 Sheikh Zayed Rd - Dubai, United Arab Emirates"
$request_url = "http://maps.googleapis.com/maps/api/geocode/xml?address=" . $Address . "&sensor=true";
$xml = simplexml_load_file($request_url) or die("url not loading");
$status = $xml->status;
if ($status == "OK") {
$arr = object2array($xml);
return $arr['result']['geometry']['location'];
} else {
return false;
}
}
开发者ID:farhanbashir,项目名称:woo,代码行数:14,代码来源:debug_helper.php
示例18: getListNameByID
function getListNameByID($id)
{
global $characterID, $keyID, $vCode;
$list = GetValue("SELECT list_name FROM list_names WHERE list_id={$id}");
if (!$list) {
$url = "https://api.eveonline.com/char/mailinglists.xml.aspx?characterID={$characterID}&keyID={$keyID}&vCode={$vCode}";
$xml_object = simplexml_load_string(file_get_contents($url));
$xml_array = object2array($xml_object);
foreach ($xml_array["result"]["rowset"]["row"] as $lst) {
$lstdata = array('list_id' => $lst['@attributes']['listID'], 'list_name' => $lst['@attributes']['displayName']);
@InsertData($lstdata, 'list_names');
}
}
$list = GetValue("SELECT list_name FROM list_names WHERE list_id={$id}");
return $list;
}
开发者ID:Covert-Inferno,项目名称:evegate,代码行数:16,代码来源:api_calls.php
示例19: object2array
/**
* converts StdClass objects to arrays
*
* @param mixed $object
* @return array
*/
function object2array($object)
{
if (is_object($object)) {
$array = array();
foreach ($object as $key => $value) {
if (is_object($value)) {
$array[$key] = object2array($value);
} else {
$array[$key] = $value;
}
}
} elseif (is_array($object)) {
$array = $object;
} else {
$array = array($object);
}
return $array;
}
开发者ID:pemiu01,项目名称:wp-automatic-theme-plugin-update,代码行数:24,代码来源:aide.php
示例20: generateClassDefinitionXml
/**
* @static
* @param Object_Class $class
* @return string
*/
public static function generateClassDefinitionXml($class)
{
$data = object2array($class);
unset($data["id"]);
unset($data["name"]);
unset($data["creationDate"]);
unset($data["modificationDate"]);
unset($data["userOwner"]);
unset($data["userModification"]);
unset($data["fieldDefinitions"]);
$referenceFunction = function (&$value, $key) {
$value = htmlspecialchars($value);
};
array_walk_recursive($data, $referenceFunction);
$config = new Zend_Config($data, true);
$writer = new Zend_Config_Writer_Xml(array("config" => $config));
return $writer->render();
}
开发者ID:ngocanh,项目名称:pimcore,代码行数:23,代码来源:Service.php
注:本文中的object2array函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论