</tr> <?php } ?> <tr> <td class="title">Description</td> <td><?php echo nl2br($serviceInfo->description); ?> </td> </tr> <tr> <td class="title">Actions</td> <td class="odd"> <table cellspacing="0" class="service_actions"> <tr> <th>Name</th> <th>Description</th> </tr> <?php foreach ($actions as $actionId => $actionCallback) { $actionReflector = new KalturaActionReflector($service, $actionId, $actionCallback); $actionInfo = $actionReflector->getActionInfo(); echo '<tr><td><a href="?service=' . $service . '&action=' . $actionId . '">' . $actionReflector->getActionName() . '</td><td>' . nl2br($actionInfo->description) . '</td></tr>'; } ?> </table> </td> </tr> </table>
private function getServiceActionElement(KalturaActionReflector $actionReflector) { $outputTypeReflector = $actionReflector->getActionOutputType(); $actionInfo = $actionReflector->getActionInfo(); $actionParams = $actionReflector->getActionParams(); $outputType = null; if ($outputTypeReflector) { $outputType = $outputTypeReflector->getType(); } $actionElement = $this->_doc->createElement("action"); $actionElement->setAttribute("name", $actionReflector->getActionName()); foreach ($actionParams as $actionParam) { /* @var $actionParam KalturaParamInfo */ $actionParamElement = $this->_doc->createElement("param"); $actionParamElement->setAttribute("name", $actionParam->getName()); if ($actionParam->isAssociativeArray()) { $actionParamElement->setAttribute("type", "map"); $actionParamElement->setAttribute("arrayType", $actionParam->getArrayType()); } elseif ($actionParam->isArray()) { $actionParamElement->setAttribute("type", "array"); $actionParamElement->setAttribute("arrayType", $actionParam->getArrayType()); } elseif ($actionParam->isEnum()) { $actionParamElement->setAttribute("type", "int"); $actionParamElement->setAttribute("enumType", $actionParam->getType()); } else { if ($actionParam->isStringEnum()) { $actionParamElement->setAttribute("type", "string"); $actionParamElement->setAttribute("enumType", $actionParam->getType()); } else { $actionParamElement->setAttribute("type", $actionParam->getType()); } } $actionParamElement->setAttribute("optional", $actionParam->isOptional() ? "1" : "0"); if ($actionParam->isOptional()) { $defaultValue = $actionParam->getDefaultValue(); if ($defaultValue === null) { $defaultValue = "null"; } switch ($actionParam->getType()) { case "bool": if ($defaultValue === true) { $actionParamElement->setAttribute("default", "true"); } else { if ($defaultValue === false) { $actionParamElement->setAttribute("default", "false"); } } break; case "bigint": case "int": case "float": case "string": $actionParamElement->setAttribute("default", $defaultValue); break; default: if ($actionParam->isEnum()) { $actionParamElement->setAttribute("default", $defaultValue); } else { $actionParamElement->setAttribute("default", "null"); } } } $description = $actionParam->getDescription(); $description = $this->fixDescription($description); $actionParamElement->setAttribute("description", $description); $actionElement->appendChild($actionParamElement); } $resultElement = $this->_doc->createElement("result"); $arrayType = null; if ($outputTypeReflector) { if ($outputTypeReflector->isAssociativeArray()) { $resultElement->setAttribute("type", "map"); $arrayType = $outputTypeReflector->getArrayType(); $resultElement->setAttribute("arrayType", $arrayType); } else { if ($outputTypeReflector->isArray()) { $resultElement->setAttribute("type", "array"); $arrayType = $outputTypeReflector->getArrayType(); $resultElement->setAttribute("arrayType", $arrayType); } else { $resultElement->setAttribute("type", $outputType); } } } $description = $actionInfo->description; $description = $this->fixDescription($description); $actionElement->setAttribute("description", kString::stripUtf8InvalidChars($description)); $actionElement->setAttribute("enableInMultiRequest", $outputType === 'file' ? "0" : "1"); $actionElement->appendChild($resultElement); return $actionElement; }
<?php require_once "../../bootstrap.php"; KalturaLog::setContext("TESTME"); $service = $_GET["service"]; $serviceMap = KalturaServicesMap::getMap(); $serviceActionItem = $serviceMap[strtolower($service)]; if (!$service) { exit; } /* @var $serviceActionItem KalturaServiceActionItem */ $actionsArray = $serviceActionItem->actionMap; $actionNames = array_keys($actionsArray); sort($actionNames); $actions = array(); foreach ($actionNames as $actionName) { $actionReflector = new KalturaActionReflector($service, $actionName, $actionsArray[$actionName]); $actionInfo = $actionReflector->getActionInfo(); $actionDisplayName = $actionReflector->getActionId(); $actionLabel = $actionReflector->getActionName(); if ($actionInfo->deprecated) { $actionLabel .= ' (deprecated)'; } $actions[] = array('action' => $actionName, 'name' => $actionName, 'label' => $actionLabel); } echo json_encode($actions);