本文整理汇总了PHP中OC_JSON::encodedPrint方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_JSON::encodedPrint方法的具体用法?PHP OC_JSON::encodedPrint怎么用?PHP OC_JSON::encodedPrint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_JSON
的用法示例。
在下文中一共展示了OC_JSON::encodedPrint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once '../../../lib/base.php';
OC_JSON::checkLoggedIn();
$firstdayofweek = OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'firstdayofweek', "1");
OC_JSON::encodedPrint(array("firstdayofweek" => $firstdayofweek));
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:12,代码来源:owncloud_apps_calendar_ajax_firstdayofweek.php
示例2: htmlentities
echo ' externalapp';
}
?>
" href="?appid=<?php
echo $app['id'];
?>
"><?php
echo htmlentities($app['name']);
?>
</a>
<script type="application/javascript">
appData_<?php
echo $app['id'];
?>
=<?php
OC_JSON::encodedPrint($app, false);
?>
;
</script>
<?php
if (!$app['internal']) {
echo '<small class="externalapp list">3rd party</small>';
}
?>
</li>
<?php
}
?>
</ul>
<div id="rightcontent">
<div class="appinfo">
示例3: encodedPrint
/**
* @brief Encode and print $data in JSON format
* @param array $data The data to use
* @param string $setContentType the optional content type
*/
public static function encodedPrint($data, $setContentType = true)
{
return \OC_JSON::encodedPrint($data, $setContentType);
}
示例4: DateTimeZone
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
$start_dt = $dtstart->getDateTime();
$start_dt->setTimezone(new DateTimeZone($user_timezone));
$end_dt = $dtend->getDateTime();
$end_dt->setTimezone(new DateTimeZone($user_timezone));
$year = $start_dt->format('Y');
$month = $start_dt->format('n') - 1;
// return is 0 based
$day = $start_dt->format('j');
$hour = $start_dt->format('G');
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
$hour = 'allday';
}
$return_event = array();
foreach (array('id', 'calendarid', 'objecttype', 'repeating') as $prop) {
$return_event[$prop] = $event[$prop];
}
$return_event['startdate'] = explode('|', $start_dt->format('Y|m|d|H|i'));
$return_event['enddate'] = explode('|', $end_dt->format('Y|m|d|H|i'));
$return_event['description'] = $event['summary'];
if ($hour == 'allday') {
$return_event['allday'] = true;
}
if (isset($return[$year][$month][$day][$hour])) {
$return[$year][$month][$day][$hour][] = $return_event;
} else {
$return[$year][$month][$day][$hour] = array(1 => $return_event);
}
}
OC_JSON::encodedPrint($return);
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:30,代码来源:owncloud_apps_calendar_ajax_getcal.php
示例5: dirname
require_once '../../../lib/base.php';
OC_JSON::checkAppEnabled('files_sharing');
require_once '../lib_share.php';
$userDirectory = "/" . OC_User::getUser() . "/files";
$source = $userDirectory . $_GET['source'];
$path = $source;
if ($users = OC_Share::getMySharedItem($source)) {
for ($i = 0; $i < count($users); $i++) {
if ($users[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
$users[$i]['token'] = OC_Share::getTokenFromSource($source);
}
}
}
$source = dirname($source);
while ($source != "" && $source != "/" && $source != "." && $source != $userDirectory) {
if ($values = OC_Share::getMySharedItem($source)) {
$values = array_values($values);
$parentUsers = array();
for ($i = 0; $i < count($values); $i++) {
if ($values[$i]['uid_shared_with'] == OC_Share::PUBLICLINK) {
$values[$i]['token'] = OC_Share::getTokenFromSource($source) . "&path=" . substr($path, strlen($source));
}
$parentUsers[basename($source) . "-" . $i] = $values[$i];
}
$users = array_merge($users, $parentUsers);
}
$source = dirname($source);
}
if (!empty($users)) {
OC_JSON::encodedPrint($users);
}
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_files_sharing_ajax_getitem.php
示例6:
<?php
/**
* ownCloud - Internal Bookmarks plugin
*
* @author Xavier Beurois
* @copyright 2012 Xavier Beurois www.djazz-lab.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once '../../../lib/base.php';
OC_JSON::checkAppEnabled('internal_bookmarks');
$c = $_POST['c'];
$k = OC_IntBks::getItemByTarget($c);
if (count($k) > 0) {
OC_JSON::encodedPrint($k);
}
示例7: header
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
$RUNTIME_NOAPPS = TRUE;
//no apps, yet
require_once '../../lib/base.php';
if (!OC_User::isLoggedIn()) {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="ownCloud Server"');
header('HTTP/1.0 401 Unauthorized');
echo 'Valid credentials must be supplied';
exit;
} else {
if (!OC_User::checkPassword($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
exit;
}
}
}
$groups = array();
foreach (OC_Group::getGroups() as $i) {
// Do some more work here soon
$groups[] = array("groupname" => $i);
}
OC_JSON::encodedPrint($groups);
示例8: header
* @copyright 2011 Hans Bakker hansmbakker+kde@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
$RUNTIME_NOAPPS = TRUE;
//no apps, yet
require_once '../../lib/base.php';
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="ownCloud Server"');
header('HTTP/1.0 401 Unauthorized');
echo 'Valid credentials must be supplied';
exit;
} else {
if (OC_User::checkPassword($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) {
OC_JSON::encodedPrint(array("username" => $_SERVER["PHP_AUTH_USER"], "user_valid" => "true"));
} else {
OC_JSON::encodedPrint(array("username" => $_SERVER["PHP_AUTH_USER"], "user_valid" => "false"));
}
}
示例9:
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once '../../../lib/base.php';
OC_JSON::checkLoggedIn();
$timeformat = OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'timeformat', "24");
OC_JSON::encodedPrint(array("timeformat" => $timeformat));
?>
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:13,代码来源:owncloud_apps_calendar_ajax_timeformat.php
示例10: OC_L10N
*
* @author Xavier Beurois
* @copyright 2012 Xavier Beurois www.djazz-lab.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
require_once '../../../lib/base.php';
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('storage_charts');
$l = new OC_L10N('storage_charts', OC_L10N::findLanguage(array('en', 'fr')));
// Update and save the new configuration
if (is_numeric($_POST['s']) && in_array($_POST['k'], array('hu_size', 'hu_size_hus'))) {
OC_DLStCharts::setUConfValue($_POST['k'], $_POST['s']);
if (strcmp($_POST['k'], 'hu_size') == 0) {
OC_JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('clines_usse', $l)));
} else {
OC_JSON::encodedPrint(array('r' => OC_DLStChartsLoader::loadChart('chisto_us', $l)));
}
}
示例11: dirname
} else {
$base = dirname($query);
}
$query = substr($query, strlen($base));
if ($base != '/') {
$query = substr($query, 1);
}
$queryLen = strlen($query);
$query = strtolower($query);
// echo "$base - $query";
$files = array();
if (OC_Filesystem::file_exists($base) and OC_Filesystem::is_dir($base)) {
$dh = OC_Filesystem::opendir($base);
if ($dh) {
if (substr($base, -1, 1) != '/') {
$base = $base . '/';
}
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != "..") {
if (substr(strtolower($file), 0, $queryLen) == $query) {
$item = $base . $file;
if (!$dirOnly or OC_Filesystem::is_dir($item)) {
$files[] = (object) array('id' => $item, 'label' => $item, 'name' => $item);
}
}
}
}
}
}
OC_JSON::encodedPrint($files);
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:30,代码来源:owncloud_files_ajax_autocomplete.php
示例12:
/**
* ownCloud - Compress plugin
*
* @author Xavier Beurois
* @copyright 2012 Xavier Beurois www.djazz-lab.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
$app_id = 'compress';
require_once '../../../lib/base.php';
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('compress');
OC::$CLASSPATH['OC_Compress'] = 'apps/' . $app_id . '/lib/' . $_POST['a'] . '.class.php';
if (OC_Compress::compressTarget($_POST['f'])) {
OC_JSON::encodedPrint(array('r' => TRUE));
} else {
OC_JSON::encodedPrint(array('r' => FALSE));
}
示例13: gmdate
// calc an offset of 24 hours
$offset = 3600 * 24;
// calc the string in GMT not localtime and add the offset
$expire = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
//output the HTTP header
header($expire);
header('Cache-Control: max-age=3600, must-revalidate');
header('Pragma: public');
header('Accept-Ranges: bytes');
header('Content-Length: ' . OC_Filesystem::filesize($arguments['path']));
$gmt_mtime = gmdate('D, d M Y H:i:s', OC_Filesystem::filemtime($arguments['path'])) . ' GMT';
header("Last-Modified: " . $gmt_mtime);
OC_Filesystem::readfile($arguments['path']);
exit;
case 'find_music':
OC_JSON::encodedPrint(findMusic());
exit;
}
}
function findMusic($path = '')
{
$music = array();
$dh = OC_Filesystem::opendir($path);
if ($dh) {
while ($filename = readdir($dh)) {
if ($filename[0] != '.') {
$file = $path . '/' . $filename;
if (OC_Filesystem::is_dir($file)) {
$music = array_merge($music, findMusic($file));
} else {
if (OC_MEDIA_SCANNER::isMusic($filename)) {
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_media_ajax_api.php
示例14: isset
<?php
/**
* ownCloud
*
* @author Robin Appelman
* @copyright 2010 Robin Appelman icewind1991@gmail.com
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// Check if we are a user
OC_JSON::checkLoggedIn();
$query = isset($_GET['query']) ? $_GET['query'] : '';
if ($query) {
$result = \OC::$server->getSearch()->search($query);
OC_JSON::encodedPrint($result);
} else {
echo 'false';
}
示例15: respond
/**
* respond to a call
* @param OC_OCS_Result $result
* @param string $format the format xml|json
*/
public static function respond($result, $format = 'xml')
{
// Send 401 headers if unauthorised
if ($result->getStatusCode() === self::RESPOND_UNAUTHORISED) {
header('WWW-Authenticate: Basic realm="Authorisation Required"');
header('HTTP/1.0 401 Unauthorized');
}
$response = array('ocs' => array('meta' => $result->getMeta(), 'data' => $result->getData()));
if ($format == 'json') {
OC_JSON::encodedPrint($response);
} else {
if ($format == 'xml') {
header('Content-type: text/xml; charset=UTF-8');
$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(true);
$writer->startDocument();
self::toXML($response, $writer);
$writer->endDocument();
echo $writer->outputMemory(true);
}
}
}