/** * This method returns statistics for an entity. * * @param string $methodName * @param int $entityId * @param Pear::Date $oStartDate * @param Pear::Date $oEndDate * @return array result data */ function _callStatisticsMethod($methodName, $entityId, $oStartDate = null, $oEndDate = null, $useManagerTimezone = false) { $dataArray = array((int) $entityId); if (is_object($oStartDate)) { $dataArray[] = XML_RPC_iso8601_encode($oStartDate->getDate(DATE_FORMAT_UNIXTIME)); if (is_object($oEndDate)) { $dataArray[] = XML_RPC_iso8601_encode($oEndDate->getDate(DATE_FORMAT_UNIXTIME)); } } $dataArray[] = (bool) $useManagerTimezone; $statisticsData = $this->_sendWithSession($methodName, $dataArray); return $statisticsData; }
function universal_setEntry(&$entry, &$tmp) { global $serendipity; $tmp = array('dateCreated' => new XML_RPC_Value(XML_RPC_iso8601_encode($entry['timestamp'], $serendipity['XMLRPC_GMT']) . ($serendipity['XMLRPC_GMT'] ? 'Z' : ''), 'dateTime.iso8601'), 'postid' => new XML_RPC_Value($entry['id'], 'string'), 'userid' => new XML_RPC_Value($entry['authorid'], 'string'), 'description' => new XML_RPC_Value($entry['body'], 'string'), 'mt_excerpt' => new XML_RPC_Value('', 'string'), 'mt_allow_comments' => new XML_RPC_Value(1, 'int'), 'mt_allow_pings' => new XML_RPC_Value(1, 'int'), 'mt_convert_breaks' => new XML_RPC_Value('', 'string'), 'mt_keywords' => new XML_RPC_Value('', 'string'), 'title' => new XML_RPC_Value($entry['title'], 'string'), 'permalink' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES . '/' . $entry['id'] . '_.html', 'baseURL'), 'string'), 'link' => new XML_RPC_Value(serendipity_rewriteURL(PATH_ARCHIVES . '/' . $entry['id'] . '_.html', 'baseURL'), 'string')); return array_merge($entry, $tmp); }
/** * This method returns statistics for an entity. * * @param string $serviceFileName * @param string $methodName * @param int $entityId * @param Pear::Date $oStartDate * @param Pear::Date $oEndDate * @return array result data */ function _callStatisticsMethod($serviceFileName, $methodName, $entityId, $oStartDate = null, $oEndDate = null) { $dataArray = array((int) $entityId); if (is_object($oStartDate)) { $dataArray[] = XML_RPC_iso8601_encode($oStartDate->getDate(DATE_FORMAT_UNIXTIME)); if (is_object($oEndDate)) { $dataArray[] = XML_RPC_iso8601_encode($oEndDate->getDate(DATE_FORMAT_UNIXTIME)); } } $statisticsData = $this->_sendWithSession($serviceFileName, $methodName, $dataArray); return $statisticsData; }
function array_encode($arguments = array(), $in_struct = 0) { $result = array(); if (is_array($arguments) && sizeof($arguments) > 0) { while (list($key, $value) = each($arguments)) { if (is_int($key)) { switch (gettype($value)) { case "array": $nest_array = XMLRPC::array_encode($value); array_push($result, new XML_RPC_Value($nest_array, "array")); break; case "integer": array_push($result, new XML_RPC_Value($value, "int")); break; case "string": array_push($result, new XML_RPC_Value($value, "string")); break; default: array_push($result, new XML_RPC_Value($value)); break; } } else { $pieces = explode(":", $key); if (is_array($pieces) && sizeof($pieces) == 1) { // name switch (gettype($value)) { case "array": $nest_array = XMLRPC::array_encode($value); array_push($result, new XML_RPC_Value($nest_array, "array")); break; case "integer": array_push($result, new XML_RPC_Value($value, "int")); break; case "string": array_push($result, new XML_RPC_Value($value, "string")); break; default: array_push($result, new XML_RPC_Value($value)); break; } } elseif (is_array($pieces)) { // type:name $type = $pieces[0]; $name = $pieces[1]; switch ($type) { case "struct": $nest = XMLRPC::array_encode($value, 1); if ($name == "" || $in_struct == 0) { array_push($result, new XML_RPC_Value($nest, $type)); } else { $result[$name] = new XML_RPC_Value($nest, $type); } break; case "array": $nest = XMLRPC::array_encode($value); if ($name == "" || $in_struct == 0) { array_push($result, new XML_RPC_Value($nest, $type)); } else { $result[$name] = new XML_RPC_Value($nest, $type); } break; case "datetime": if (is_int($value)) { $datetime = XML_RPC_iso8601_encode($value); } else { $datetime = $value; } if ($name == "" || $in_struct == 0) { array_push($result, new XML_RPC_Value($datetime, "dateTime.iso8601")); } else { $result[$name] = new XML_RPC_Value($datetime, $type); } break; case "i4": case "int": case "double": case "base64": case "string": case "boolean": default: if ($name == "" || $in_struct == 0) { array_push($result, new XML_RPC_Value($value, $type)); } else { $result[$name] = new XML_RPC_Value($value, $type); } break; break; } } } } } return $result; }