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); }
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; } } }
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'); } }
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); }
function getFeaturesData() { global $featureDataUrl; createSearchFeatureAPI(); $data = object2array($featureDataUrl); return $data; }
/** * @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"); } } }
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); }
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; }
/** * @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; }
function getFeatureResults($apiString) { $data = object2array($apiString); if (isset($data['Property'])) { return $data['Property']; } return NULL; }
/** * @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; }
/** * @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; }
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"]); }
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"]); }
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"; }
/** * @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; }
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; } }
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; }
/** * 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; }
/** * @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(); }
function object2array($object) { $return = NULL; if (is_array($object)) { foreach ($object as $key => $value) { $return[$key] = object2array($value); } } else { $var = get_object_vars($object); if ($var) { foreach ($var as $key => $value) { $return[$key] = object2array($value); } } else { return strval($object); } } return $return; }
function object2array($object) { $array = array(); if (is_object($object)) { if ($var = get_object_vars($object)) { foreach ($var as $key => $value) { $array[$key] = $key && !$value ? strval($value) : object2array($value); } } } else { if (is_array($object)) { foreach ($object as $key => $value) { $array[$key] = object2array($value); } } else { $array = strval($object); } } // strval and everything is fine return $array; }
function captureError($type = "php", $severity = "", $uid = "", $message = "", $url = "", $lineNumber = "") { $this->ci->load->helper('arrays'); $arr = array('message' => $message, 'url' => $url, 'lineNumber' => $lineNumber, 'type' => $type); //$this->qb->query("SELECT * FROM errors WHERE ") $this->ci->db->like('error_data', addslashes(json_encode($arr))); $query = $this->ci->db->get('errors'); $this->ci->load->library('user_agent'); if ($this->ci->agent->is_browser()) { $data['browser'] = $this->ci->agent->browser() . ' ' . $this->ci->agent->version(); } elseif ($this->ci->agent->is_robot()) { $data['browser'] = $this->ci->agent->robot(); } elseif ($this->ci->agent->is_mobile()) { $data['browser'] = $this->ci->agent->mobile(); } else { $data['browser'] = 'Unidentified User Agent'; } $data['platform'] = $this->ci->agent->platform(); $data['severity'] = $severity; if ($query->num_rows > 0) { $row = $query->result(); $uids = json_decode($row[0]->uid); $uid_arr = object2array($uids); if (!in_array($uid, $uid_arr)) { $uid_arr[] = $uid; $data['uid'] = json_encode($uid_arr); } $data['count'] = $row[0]->count + 1; $data['date_created'] = date('Y-m-d H:i:s'); $this->ci->db->where('error_id', $row[0]->error_id); $this->ci->db->set($data); $this->ci->db->update('errors'); } else { $data['uid'] = json_encode(array($uid)); $data['error_data'] = json_encode($arr); $result = $this->ci->db->insert('errors', $data); } return $result; }
function getQueryIdByRefId($refId) { global $resaleResultsUrl; global $rentalResultsUrl; if (isFeatureSearch()) { $tmpUrl = $resaleResultsUrl . '&P_RefId=' . $refId; } else { $searchType = 'Resale'; if (isset($_SESSION["SearchType"])) { $searchType = $_SESSION["SearchType"]; } switch ($searchType) { case 'Resale': $tmpUrl = $resaleResultsUrl . '&P_RefId=' . $refId; break; default: $tmpUrl = $rentalResultsUrl . '&P_RefId=' . $refId; } } $data = object2array($tmpUrl); return $data['QueryInfo']['QueryId']; }
function get_packages() { $files = array(); $handler = opendir(ASSET_FOLDER); while ($file = readdir($handler)) { if ($file != "." && $file != ".." && pathinfo($file, PATHINFO_EXTENSION) == 'json') { $files[] = ASSET_FOLDER . '/' . $file; } } closedir($handler); ksort($files); $packages = array(); foreach ($files as $file) { $data = file_get_contents($file); $data = json_decode($data); if (is_a($data, 'StdClass')) { $package = object2array($data); $packages = array_merge_unique($packages, $package); } } return $packages; }
/** * Returns thumbnail config for webservice export. */ public function getForWebserviceExport() { $arrayConfig = object2array($this); $items = $arrayConfig["items"]; $arrayConfig["items"] = $items; return $arrayConfig; }
public function getCurrentUserAction() { header("Content-Type: text/javascript"); $user = $this->getUser(); $list = new User\Permission\Definition\Listing(); $definitions = $list->load(); foreach ($definitions as $definition) { $user->setPermission($definition->getKey(), $user->isAllowed($definition->getKey())); } // unset confidential informations $userData = object2array($user); $contentLanguages = Tool\Admin::reorderWebsiteLanguages($user, Tool::getValidLanguages()); $userData["contentLanguages"] = $contentLanguages; unset($userData["password"]); echo "pimcore.currentuser = " . \Zend_Json::encode($userData); exit; }
</div> <?php $Instagram_ID = "510627558"; $Instagram_Token = "510627558.98ec466.00e08393fe294c9aa6e2470c7f735acb"; $url = "https://api.instagram.com/v1/tags/masayahostel/media/recent?count=14&access_token=" . $Instagram_Token; $chI = curl_init(); curl_setopt($chI, CURLOPT_URL, $url); curl_setopt($chI, CURLOPT_RETURNTRANSFER, 1); curl_setopt($chI, CURLOPT_TIMEOUT, 0); curl_setopt($chI, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($chI, CURLOPT_SSL_VERIFYPEER, 0); $result = curl_exec($chI); curl_close($chI); $objectI = json_decode($result); $arrayI = object2array($objectI); // echo "<pre>"; // print_r($arrayI); // echo "</pre>"; ?> <div data-next-url="<?php echo $arrayI['pagination']['next_url']; ?> " class="col-lg-12 padding_none instgram-data-holder"> <div class="col-lg-6 col-sm-6 padding_none img"> <a href="<?php echo $arrayI['data'][0]['link']; ?> "><img src="<?php echo $arrayI['data'][0]['images']['standard_resolution']['url'];
/** * @return void */ public function save() { $arrayConfig = object2array($this); $items = $arrayConfig["columnConfiguration"]; $arrayConfig["columnConfiguration"] = array("columnConfiguration" => $items); if ($arrayConfig["dataSourceConfig"]) { $configArray = array(); foreach ($arrayConfig["dataSourceConfig"] as $config) { $configArray[] = json_encode($config); } $arrayConfig["dataSourceConfig"] = array("dataSourceConfig" => $configArray); } else { $arrayConfig["dataSourceConfig"] = array("dataSourceConfig" => array()); } $items = $arrayConfig["yAxis"]; $arrayConfig["yAxis"] = array("yAxis" => $items); $config = new \Zend_Config($arrayConfig); $writer = new \Zend_Config_Writer_Xml(array("config" => $config, "filename" => $this->getConfigFile())); $writer->write(); return true; }
public static function toObject($el) { if (is_object($el)) { $el = object2array($el); } $obj = new stdClass(); foreach ($el as $key => $value) { $obj->{$key} = $value; } return $obj; }