本文整理汇总了PHP中AJXP_Utils::getHooksFile方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Utils::getHooksFile方法的具体用法?PHP AJXP_Utils::getHooksFile怎么用?PHP AJXP_Utils::getHooksFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Utils
的用法示例。
在下文中一共展示了AJXP_Utils::getHooksFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listHooks
public function listHooks($dir, $root = NULL, $hash = null, $returnNodes = false)
{
$jsonContent = json_decode(file_get_contents(AJXP_Utils::getHooksFile()), true);
$config = '<columns switchDisplayMode="full" template_name="hooks.list">
<column messageId="ajxp_conf.17" attributeName="ajxp_label" sortType="String" defaultWidth="20%"/>
<column messageId="ajxp_conf.18" attributeName="description" sortType="String" defaultWidth="20%"/>
<column messageId="ajxp_conf.19" attributeName="triggers" sortType="String" defaultWidth="25%"/>
<column messageId="ajxp_conf.20" attributeName="listeners" sortType="String" defaultWidth="25%"/>
<column messageId="ajxp_conf.21" attributeName="sample" sortType="String" defaultWidth="10%"/>
</columns>';
if (!$returnNodes) {
AJXP_XMLWriter::sendFilesListComponentConfig($config);
}
$allNodes = array();
foreach ($jsonContent as $hookName => $hookData) {
$metadata = array("icon" => "preferences_plugin.png", "description" => $hookData["DESCRIPTION"], "sample" => $hookData["PARAMETER_SAMPLE"]);
$trigs = array();
foreach ($hookData["TRIGGERS"] as $trigger) {
$trigs[] = "<span>" . $trigger["FILE"] . " (" . $trigger["LINE"] . ")</span>";
}
$metadata["triggers"] = implode("<br/>", $trigs);
$listeners = array();
foreach ($hookData["LISTENERS"] as $listener) {
$listeners[] = "<span>Plugin " . $listener["PLUGIN_ID"] . ", in method " . $listener["METHOD"] . "</span>";
}
$metadata["listeners"] = implode("<br/>", $listeners);
$nodeKey = "/{$root}/hooks/{$hookName}/{$hookName}";
if (in_array($nodeKey, $this->currentBookmarks)) {
$metadata = array_merge($metadata, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
}
$xml = AJXP_XMLWriter::renderNode($nodeKey, $hookName, true, $metadata, true, false);
if ($returnNodes) {
$allNodes[$nodeKey] = $xml;
} else {
print $xml;
}
}
return $allNodes;
}