本文整理汇总了PHP中Convert::array_to_object方法的典型用法代码示例。如果您正苦于以下问题:PHP Convert::array_to_object方法的具体用法?PHP Convert::array_to_object怎么用?PHP Convert::array_to_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Convert
的用法示例。
在下文中一共展示了Convert::array_to_object方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($pair)
{
global $conf;
global $localUri;
global $uri;
global $acceptContentType;
global $endpoints;
global $lodspk;
global $results;
global $firstResults;
list($res, $page, $format) = $pair;
//If resource is not the page, send a 303 to the document
if ($res == $localUri) {
HTTPStatus::send303($page, $acceptContentType);
}
$uri = $res;
if ($conf['mirror_external_uris'] != false) {
$localUri = preg_replace("|^" . $conf['ns']['local'] . "|", $conf['basedir'], $res);
}
$extension = Utils::getExtension($format);
/*Redefine Content type based on the
* dcterms:format for this page
*/
$acceptContentType = $format;
//Check if files for model and view exist
$t = Queries::getClass($uri, $endpoints['local']);
$obj = $this->getModelandView($t, $extension);
$modelFile = $obj['modelFile'];
$lodspk['model'] = $conf['model']['directory'];
$viewFile = $obj['viewFile'];
$lodspk['view'] = $obj['view']['directory'];
if ($viewFile == null) {
$lodspk['transform_select_query'] = true;
}
$lodspk['type'] = $modelFile;
$lodspk['home'] = $conf['basedir'];
$lodspk['baseUrl'] = $conf['basedir'];
$lodspk['module'] = 'type';
$lodspk['root'] = $conf['root'];
$lodspk['contentType'] = $acceptContentType;
$lodspk['ns'] = $conf['ns'];
$lodspk['endpoint'] = $conf['endpoint'];
$lodspk['view'] = $conf['view']['directory'];
$lodspk['add_mirrored_uris'] = true;
$lodspk['this']['value'] = $uri;
$lodspk['this']['curie'] = Utils::uri2curie($uri);
$lodspk['local']['value'] = $localUri;
$lodspk['local']['curie'] = Utils::uri2curie($localUri);
$lodspk['this']['extension'] = $extension;
//chdir($conf['home'].$conf['model']['directory']);
Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults);
if (!$lodspk['resultRdf']) {
$results = Utils::internalize($results);
$firstAux = Utils::getfirstResults($results);
//chdir($conf['home']);
if (is_array($results)) {
$resultsObj = Convert::array_to_object($results);
$results = $resultsObj;
} else {
$resultsObj = $results;
}
$lodspk['firstResults'] = Convert::array_to_object($firstAux);
} else {
$resultsObj = $results;
}
//chdir($conf['home'].$conf['model']['directory']);
Utils::processDocument($viewFile, $lodspk, $resultsObj);
}
示例2: showView
public static function showView($lodspkData, $data, $view)
{
global $conf;
global $uri;
global $lodspk;
global $extension;
//$lodspk = $conf['view']['standard'];
$lodspk = $lodspkData;
if (isset($lodspkData['params'])) {
$lodspk['this']['params'] = $lodspkData['params'];
}
if (isset($lodspk['queryTimes'])) {
$lodspk['queryTimes'] = Convert::array_to_object($lodspk['queryTimes']);
}
require_once $conf['home'] . 'lib/Haanga/lib/Haanga.php';
$viewAux = explode("/", $view);
$viewFile = array_pop($viewAux);
//$viewFile = $view;
$viewPath = join("/", $viewAux);
Haanga::configure(array('template_dir' => $viewPath, 'cache_dir' => $conf['home'] . 'cache/'));
$rdf = null;
if (array_key_exists('rdf', $data)) {
$rdf = $data['rdf'];
unset($data['rdf']);
} else {
}
$models = $data;
Convert::getPaths($models, "");
$first = $lodspk['firstResults'];
unset($lodspk['firstResults']);
//unset($lodspk);
$vars = compact('uri', 'lodspk', 'conf', 'models', 'rdf', 'first');
if ($conf['debug']) {
//Logging::log(var_export($vars, true));
}
if (is_string($data)) {
echo $data;
} elseif (is_file($view)) {
try {
Haanga::Load($viewFile, $vars);
} catch (Exception $e) {
echo '<pre>';
echo $e->getMessage() . "' in " . $e->getFile() . ":" . $e->getLine() . "\nStack trace:\n" . $e->getTraceAsString();
echo '</pre>';
}
} elseif ($view == null) {
$fnc = Haanga::compile('{{models|safe}}');
$fnc($vars, TRUE);
} else {
echo $conf['home'] . $viewPath . " " . $viewFile;
$fnc = Haanga::compile($view);
$fnc($vars, TRUE);
}
}
示例3: execute
public function execute($service)
{
global $conf;
global $localUri;
global $uri;
global $acceptContentType;
global $endpoints;
global $lodspk;
global $firstResults;
global $results;
$context = array();
$context['contentType'] = $acceptContentType;
$context['endpoints'] = $endpoints;
//$f = $this->getFunction($localUri);
$params = array();
$params = $this->getParams($localUri);
//$params[] = $context;
//$acceptContentType = Utils::getBestContentType($_SERVER['HTTP_ACCEPT']);
$extension = Utils::getExtension($acceptContentType);
$args = array();
list($modelFile, $viewFile) = $service;
try {
$prefixHeader = array();
for ($i = 0; $i < sizeof($params); $i++) {
if ($conf['mirror_external_uris'] != false) {
$altUri = Utils::curie2uri($params[$i]);
$altUri = preg_replace("|^" . $conf['basedir'] . "|", $conf['ns']['local'], $altUri);
$params[$i] = Utils::uri2curie($altUri);
}
}
$segmentConnector = "";
for ($i = 0; $i < sizeof($params); $i++) {
Utils::curie2uri($params[$i]);
//echo $params[$i]." ".Utils::curie2uri($params[$i]);exit(0);
$auxPrefix = Utils::getPrefix($params[$i]);
if ($auxPrefix['ns'] != NULL) {
$prefixHeader[] = $auxPrefix;
}
$args["arg" . $i] = $params[$i];
$args["all"] .= $segmentConnector . $params[$i];
if ($segmentConnector == "") {
$segmentConnector = "/";
}
}
$results['params'] = $params;
$lodspk['home'] = $conf['basedir'];
$lodspk['baseUrl'] = $conf['basedir'];
$lodspk['module'] = 'service';
$lodspk['root'] = $conf['root'];
$lodspk['contentType'] = $acceptContentType;
$lodspk['ns'] = $conf['ns'];
$lodspk['this']['value'] = $uri;
$lodspk['this']['curie'] = Utils::uri2curie($uri);
$lodspk['local']['value'] = $localUri;
$lodspk['local']['curie'] = Utils::uri2curie($localUri);
$lodspk['contentType'] = $acceptContentType;
$lodspk['endpoint'] = $conf['endpoint'];
$lodspk['type'] = $modelFile;
$lodspk['header'] = $prefixHeader;
$lodspk['args'] = $args;
$lodspk['add_mirrored_uris'] = false;
$lodspk['baseUrl'] = $conf['basedir'];
$lodspk['this']['value'] = $uri;
if ($viewFile == null) {
$lodspk['transform_select_query'] = true;
}
// chdir($lodspk['model']);
Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults);
if (!$lodspk['resultRdf']) {
$results = Utils::internalize($results);
$firstAux = Utils::getfirstResults($results);
// chdir($conf['home']);
if (is_array($results)) {
$resultsObj = Convert::array_to_object($results);
$results = $resultsObj;
} else {
$resultsObj = $results;
}
$lodspk['firstResults'] = Convert::array_to_object($firstAux);
} else {
$resultsObj = $results;
}
//Need to redefine viewFile as 'local' i.e., inside service.foo/ so I can load files with the relative path correctly
//$viewFile = $extension.".template";
//chdir($conf['home']);
Utils::processDocument($viewFile, $lodspk, $results);
} catch (Exception $ex) {
echo $ex->getMessage();
if ($conf['debug']) {
Logging::log($ex->getMessage(), E_ERROR);
}
HTTPStatus::send500($uri);
}
}
示例4: execute
public function execute($p)
{
global $conf;
global $localUri;
global $uri;
global $acceptContentType;
global $endpoints;
global $lodspk;
global $results;
global $firstResults;
$res = $p['res'];
$page = $p['page'];
$format = $p['format'];
$modelFile = $p['modelFile'];
$viewFile = $p['viewFile'];
$uri = $res;
$curie = Utils::uri2curie($res);
//If resource is not the page, send a 303 to the document
if ($res == $localUri) {
HTTPStatus::send303($page, $acceptContentType);
}
$uri = $res;
if ($conf['mirror_external_uris'] != false) {
$localUri = preg_replace("|^" . $conf['ns']['local'] . "|", $conf['basedir'], $res);
}
$extension = Utils::getExtension($format);
/*Redefine Content type based on the
* dcterms:format for this page
*/
$acceptContentType = $format;
$curie = Utils::uri2curie($uri);
if ($modelFile == NULL) {
return;
}
//$lodspk = $conf['view']['standard'];
$lodspk['type'] = $modelFile;
$lodspk['home'] = $conf['basedir'];
$lodspk['module'] = 'uri';
$lodspk['add_mirrored_uris'] = true;
$lodspk['this']['value'] = $uri;
$lodspk['this']['curie'] = Utils::uri2curie($uri);
$lodspk['local']['value'] = $localUri;
$lodspk['local']['curie'] = Utils::uri2curie($localUri);
$lodspk['contentType'] = $acceptContentType;
$lodspk['model'] = $conf['model']['directory'];
$lodspk['view'] = $conf['view']['directory'];
$lodspk['ns'] = $conf['ns'];
//chdir($conf['home'].$conf['model']['directory']);
Utils::queryFile($modelFile, $endpoints['local'], $results, $firstResults);
if (!$lodspk['resultRdf']) {
$results = Utils::internalize($results);
$firstAux = Utils::getfirstResults($results);
chdir($conf['home']);
if (is_array($results)) {
$resultsObj = Convert::array_to_object($results);
$results = $resultsObj;
} else {
$resultsObj = $results;
}
$lodspk['firstResults'] = Convert::array_to_object($firstAux);
} else {
$resultsObj = $results;
}
//chdir($conf['home']);
if ($conf['debug']) {
Logging::log("Using template " . $viewFile);
}
Utils::processDocument($viewFile, $lodspk, $resultsObj);
}