本文整理汇总了PHP中plugin_find_id函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_find_id函数的具体用法?PHP plugin_find_id怎么用?PHP plugin_find_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin_find_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PostInitialize
/**
* \brief This is where we check for
* changes to the full-debug setting.
*/
function PostInitialize()
{
if ($this->State != PLUGIN_STATE_VALID) {
return 0;
}
// don't re-run
// Make sure dependencies are met
foreach ($this->Dependency as $key => $val) {
$id = plugin_find_id($val);
if ($id < 0) {
$this->Destroy();
return 0;
}
}
$FullMenuDebug = GetParm("fullmenu", PARM_INTEGER);
if ($FullMenuDebug == 2) {
$_SESSION['fullmenudebug'] = 1;
}
if ($FullMenuDebug == 1) {
$_SESSION['fullmenudebug'] = 0;
}
// It worked, so mark this plugin as ready.
$this->State = PLUGIN_STATE_READY;
// Add this plugin to the menu
if ($this->MenuList !== "") {
menu_insert("Main::" . $this->MenuList, $this->MenuOrder, $this->Name, $this->MenuTarget);
}
return 1;
}
示例2: Output
/**
* \brief Generate output for this plug-in.
*/
function Output()
{
if ($this->State != PLUGIN_STATE_READY) {
return;
}
global $SysConf;
global $Plugins;
$html = "<table width='100%' border=0 cellpadding=0>\n <tr>\n";
$Uri = Traceback_dir();
if (@$SysConf['SYSCONFIG']['LogoImage'] and @$SysConf['SYSCONFIG']['LogoLink']) {
$LogoLink = $SysConf['SYSCONFIG']['LogoLink'];
$LogoImg = $SysConf['SYSCONFIG']['LogoImage'];
} else {
$LogoLink = 'http://fossology.org';
$LogoImg = Traceback_uri . 'images/fossology-logo.gif';
}
$html .= " <td width='15%'>";
$html .= "<a href='{$LogoLink}' target='_top'><img src='{$LogoImg}' align=absmiddle border=0></a>";
$html .= "</td>\n";
$html .= " <td valign='top'>";
$Menu =& $Plugins[plugin_find_id("menus")];
$Menu->OutputSet($this->OutputType, 0);
$html .= $Menu->Output();
$html .= " </td>\n";
$html .= " </tr>\n";
$html .= "</table>\n";
return $html;
}
示例3: menuToActiveSelect
/**
* @param $menu menu list need to show as list
* @param $parm a list of parameters to add to the URL.
* @param $uploadId upload id
*/
public static function menuToActiveSelect($menu, &$parm, $uploadId = "")
{
if (empty($menu)) {
return '';
}
$showFullName = isset($_SESSION) && array_key_exists('fullmenudebug', $_SESSION) && $_SESSION['fullmenudebug'] == 1;
$optionsOut = "";
foreach ($menu as $Val) {
if (!empty($Val->HTML)) {
$entry = $Val->HTML;
} else {
if (!empty($Val->URI)) {
if (!empty($uploadId) && "tag" == $Val->URI) {
$tagstatus = TagStatus($uploadId);
if (0 == $tagstatus) {
// tagging on this upload is disabled
break;
}
}
$entry = '<option value="' . Traceback_uri() . '?mod=' . $Val->URI . '&' . $parm . '"';
if (!empty($Val->Title)) {
$entry .= ' title="' . htmlentities($Val->Title, ENT_QUOTES) . '"';
}
$entry .= '>' . $Val->getName($showFullName) . '</option>';
} else {
$entry = "<option>" . $Val->getName($showFullName) . "</option>";
}
}
$optionsOut .= $entry;
}
if (plugin_find_id('showjobs') >= 0) {
$optionsOut .= '<option value="' . Traceback_uri() . '?mod=showjobs&upload=' . $uploadId . '" title="' . _("Scan History") . '" >' . _("History") . '</option>';
}
return '<select class="goto-active-option"><option>-- select action --</option>' . $optionsOut . '</select>';
}
示例4: PostInitialize
/**
* \brief This function is called before the plugin
* is used and after all plugins have been initialized.
*
* \return on success, false on failure.
* \note Do not assume that the plugin exists! Actually check it!
* Purpose: Only allow people who are logged in to edit their own properties.
*/
function PostInitialize()
{
global $Plugins;
if ($this->State != PLUGIN_STATE_VALID) {
return 0;
}
// don't run
if ($_SESSION['User'] == "Default User") {
/* Only valid if the user is logged in. */
$this->State = PLUGIN_STATE_INVALID;
return 0;
}
// Make sure dependencies are met
foreach ($this->Dependency as $key => $val) {
$id = plugin_find_id($val);
if ($id < 0) {
$this->Destroy();
return 0;
}
}
// It worked, so mark this plugin as ready.
$this->State = PLUGIN_STATE_READY;
// Add this plugin to the menu
if ($this->MenuList !== "") {
menu_insert("Main::" . $this->MenuList, $this->MenuOrder, $this->Name, $this->MenuTarget);
}
return $this->State == PLUGIN_STATE_READY;
}
示例5: Output
/**
* \brief Generate the text for this plugin.
*/
function Output()
{
if ($this->State != PLUGIN_STATE_READY) {
return;
}
global $PG_CONN;
$V = "";
switch ($this->OutputType) {
case "XML":
break;
case "HTML":
/* Get uploadtree_pk's for all debian uploads */
$sql = "SELECT uploadtree_pk, upload_pk, upload_filename FROM upload INNER JOIN uploadtree ON upload_fk=upload_pk AND parent IS NULL WHERE upload_filename LIKE '%debian%';";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
if (empty($row['upload_pk'])) {
$V .= "There are no uploads with 'debian' in the description.";
} else {
/* Loop thru results to obtain all licenses in their uploadtree recs*/
$Lics = array();
while ($Row = pg_fetch_array($result)) {
if (empty($Row['upload_pk'])) {
continue;
} else {
LicenseGetAll($Row[uploadtree_pk], $Lics);
}
$V .= "<option value='" . $Row['upload_pk'] . "'>{$Name}</option>\n";
}
$V .= "</select><P />\n";
arsort($Lics);
$V .= "<table border=1>\n";
foreach ($Lics as $key => $value) {
if ($key == " Total ") {
$V .= "<tr><th>{$key}<th>{$value}\n";
} else {
if (plugin_find_id('search_file_by_license') >= 0) {
$V .= "<tr><td><a href='/repo/?mod=search_file_by_license&item={$Row['uploadtree_pk']}&lic=" . urlencode($key) . "'>{$key}</a><td align='right'>{$value}\n";
} else {
$V .= "<tr><td>{$key}<td align='right'>{$value}\n";
}
}
}
$V .= "</table>\n";
// print "<pre>"; print_r($Lics); print "</pre>";
}
pg_free_result($result);
break;
case "Text":
break;
default:
break;
}
if (!$this->OutputToStdout) {
return $V;
}
print $V;
return;
}
示例6: OutputClose
/**
* \brief This function is called when user output is
* finished.
*/
function OutputClose()
{
if ($this->State != PLUGIN_STATE_READY) {
return 0;
}
global $Plugins;
$P =& $Plugins[plugin_find_id("Default")];
return $P->OutputClose();
}
示例7: Output
/**
* \brief This function is called when user output is
* requested. This function is responsible for content.
*/
function Output()
{
if ($this->State != PLUGIN_STATE_READY) {
return;
}
global $Plugins;
$P =& $Plugins[plugin_find_id("Default")];
$GoMod = GetParm("remod", PARM_STRING);
$GoOpt = GetParm("reopt", PARM_STRING);
$GoOpt = preg_replace("/--/", "&", $GoOpt);
return $P->Output($GoMod, $GoOpt);
}
示例8: handle
/**
* @param Request $request
* @return Response
*/
protected function handle(Request $request)
{
$show = $request->get('show');
if ($show == 'licensebrowser') {
return $this->render("getting_started_licensebrowser.html.twig");
}
$login = _("Login");
if (empty($_SESSION['User']) && plugin_find_id("auth") >= 0) {
$login = "<a href='" . Traceback_uri() . "?mod=auth'>{$login}</a>";
}
$vars = array('login' => $login, 'SiteURI' => Traceback_uri());
return $this->render('getting_started.html.twig', $this->mergeWithDefault($vars));
}
示例9: AgentsAdd
/**
* \brief Add an upload to multiple agents.
*
* \param $uploadpk
* \param $agentlist - list of agents
* \return NULL on success, error message string on failure
*/
function AgentsAdd($uploadpk, $agentlist)
{
global $Plugins;
global $PG_CONN;
global $SysConf;
$rc = "";
$Alist = array();
/* Make sure the uploadpk is valid */
if (!$uploadpk) {
return "agent-add.php AgentsAdd(): No upload_pk specified";
}
$sql = "SELECT upload_pk, upload_filename FROM upload WHERE upload_pk = '{$uploadpk}';";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
if (pg_num_rows($result) < 1) {
$ErrMsg = __FILE__ . ":" . __LINE__ . " " . _("Upload") . " " . $uploadpk . " " . _("not found");
return $ErrMsg;
}
$UploadRow = pg_fetch_assoc($result);
$ShortName = $UploadRow['upload_filename'];
pg_free_result($result);
/* Create Job */
$user_pk = $SysConf['auth']['UserId'];
$job_pk = JobAddJob($user_pk, $ShortName, $uploadpk);
/* Validate the agent list and add agents as needed. */
/** Don't worry about order or duplicates -- it will do the right thing. **/
$Depth = 0;
$agent_list = menu_find("Agents", $depth);
for ($al = 0; !empty($agentlist[$al]); $al++) {
/* check if the agent exists in the list of viable agents */
$Found = -1;
for ($ac = 0; $Found < 0 && !empty($agent_list[$ac]->URI); $ac++) {
if (!strcmp($agent_list[$ac]->URI, $agentlist[$al])) {
$Found = $al;
break;
}
}
if ($Found >= 0) {
//print "Adding to " . $agentlist[$Found] . "<br>\n";
$Dependencies = array();
$P =& $Plugins[plugin_find_id($agentlist[$Found])];
$rv = $P->AgentAdd($job_pk, $uploadpk, $ErrorMsg, $Dependencies);
if ($rv == -1) {
$rc .= $ErrorMsg;
}
} else {
$rc .= "Agent '" . htmlentities($agentlist[$al]) . "' not found.\n";
}
}
return $rc;
}
示例10: Output
/**
* \brief This function is called when user output is
* requested. This function is responsible for content. \n
* The $ToStdout flag is "1" if output should go to stdout, and
* 0 if it should be returned as a string. (Strings may be parsed
* and used by other plugins.)
*/
function Output()
{
global $PG_CONN;
if ($this->State != PLUGIN_STATE_READY) {
return;
}
$V = "";
global $Plugins;
$View =& $Plugins[plugin_find_id("view")];
$Item = GetParm("item", PARM_INTEGER);
$Upload = GetParm("upload", PARM_INTEGER);
$ModBack = GetParm("modback", PARM_STRING);
if (empty($ModBack)) {
$ModBack = 'copyrighthist';
}
$pfile = 0;
$sql = "SELECT * FROM uploadtree WHERE uploadtree_pk = " . $Item . ";";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
$row = pg_fetch_assoc($result);
pg_free_result($result);
if (!empty($row['pfile_fk'])) {
$pfile = $row['pfile_fk'];
} else {
$text = _("Could not locate the corresponding pfile.");
print $text;
}
$sql = "SELECT * FROM copyright WHERE copy_startbyte IS NOT NULL\n and pfile_fk=" . $pfile . ";";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
if (pg_num_rows($result) < 1) {
$text = _("No copyright data is available for this file.");
print $text;
return;
}
$row = pg_fetch_assoc($result, 0);
$colors = array();
$colors['statement'] = 0;
$colors['email'] = 1;
$colors['url'] = 2;
if (!empty($row['copy_startbyte'])) {
while ($row = pg_fetch_assoc($result)) {
$View->AddHighlight($row['copy_startbyte'], $row['copy_endbyte'], $colors[$row['type']], '', $row['content'], -1, Traceback_uri() . "?mod=copyrightlist&agent=" . $row['agent_fk'] . "&item={$Item}&hash=" . $row['hash'] . "&type=" . $row['type']);
}
$View->SortHighlightMenu();
}
pg_free_result($result);
$View->ShowView(NULL, $ModBack, 1, 1, NULL, True);
return;
}
示例11: handle
/**
* @param Request $request
* @return Response
*/
protected function handle(Request $request)
{
$vars = array('isSecure' => $request->isSecure());
if (array_key_exists('User', $_SESSION) && $_SESSION['User'] == "Default User" && plugin_find_id("auth") >= 0) {
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
$vars['protocol'] = "HTTPS";
} else {
$vars['protocol'] = preg_replace("@/.*@", "", @$_SERVER['SERVER_PROTOCOL']);
}
$vars['referrer'] = "?mod=browse";
$vars['authUrl'] = "?mod=auth";
}
return $this->render("home.html.twig", $this->mergeWithDefault($vars));
}
示例12: getAgentPluginNames
/**
* @param string $hook 'ParmAgents'|'Agents'|'UploadMulti'
* @return array
*/
public static function getAgentPluginNames($hook = 'Agents')
{
$maxDepth = 0;
$agentList = menu_find($hook, $maxDepth) ?: array();
$agentPluginNames = array();
if (is_array($agentList)) {
foreach ($agentList as $parmAgent) {
$agent = plugin_find_id($parmAgent->URI);
if (!empty($agent)) {
$agentPluginNames[] = $agent;
}
}
}
return $agentPluginNames;
}
示例13: Output
/**
* \brief Generate output for this plug-in.
*/
function Output()
{
global $Plugins;
global $SysConf;
if ($this->State != PLUGIN_STATE_READY) {
return;
}
$V = "";
switch ($this->OutputType) {
case "XML":
break;
case "HTML":
$Uri = Traceback_dir();
$V .= "<table width='100%' border=0 cellpadding=0>\n";
$V .= " <tr>\n";
/* custom or default logo? */
if (@$SysConf['SYSCONFIG']['LogoImage'] and @$SysConf['SYSCONFIG']['LogoLink']) {
$LogoLink = $SysConf['SYSCONFIG']['LogoLink'];
$LogoImg = $SysConf['SYSCONFIG']['LogoImage'];
} else {
$LogoLink = 'http://fossology.org';
$LogoImg = Traceback_uri . 'images/fossology-logo.gif';
}
$V .= " <td width='15%'>";
$V .= "<a href='{$LogoLink}' target='_top'><img src='{$LogoImg}' align=absmiddle border=0></a>";
$V .= "</td>\n";
$V .= " <td valign='top'>";
$Menu =& $Plugins[plugin_find_id("menus")];
$Menu->OutputSet($this->OutputType, 0);
$V .= $Menu->Output();
$Menu->OutputUnSet();
$V .= " </td>\n";
$V .= " </tr>\n";
$V .= "</table>\n";
break;
case "Text":
break;
default:
break;
}
if (!$this->OutputToStdout) {
return $V;
}
print "{$V}";
return;
}
示例14: Output
/**
* \brief Display the loaded menu and plugins.
*/
public function Output()
{
global $Plugins;
global $PG_CONN;
$UploadPk = GetParm("upload", PARM_INTEGER);
$Agent = GetParm("agent", PARM_STRING);
if (empty($UploadPk) || empty($Agent)) {
return new Response('missing parameter', Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
}
$sql = "SELECT upload_pk, upload_filename FROM upload WHERE upload_pk = '{$UploadPk}'";
$result = pg_query($PG_CONN, $sql);
DBCheckResult($result, $sql, __FILE__, __LINE__);
if (pg_num_rows($result) < 1) {
$errMsg = __FILE__ . ":" . __LINE__ . " " . _("Upload") . " " . $UploadPk . " " . _("not found");
return new Response($errMsg, Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
}
$UploadRow = pg_fetch_assoc($result);
$ShortName = $UploadRow['upload_filename'];
pg_free_result($result);
$user_pk = Auth::getUserId();
$group_pk = Auth::getGroupId();
$job_pk = JobAddJob($user_pk, $group_pk, $ShortName, $UploadPk);
$Dependencies = array();
$P =& $Plugins[plugin_find_id($Agent)];
$rv = $P->AgentAdd($job_pk, $UploadPk, $ErrorMsg, $Dependencies);
if ($rv <= 0) {
$text = _("Scheduling of Agent(s) failed: ");
return new Response($text . $rv . $ErrorMsg, Response::HTTP_BAD_REQUEST, array('Content-type' => 'text/plain'));
}
/** check if the scheudler is running */
$status = GetRunnableJobList();
$scheduler_msg = "";
if (empty($status)) {
$scheduler_msg .= _("Is the scheduler running? ");
}
$URL = Traceback_uri() . "?mod=showjobs&upload={$UploadPk}";
/* Need to refresh the screen */
$text = _("Your jobs have been added to job queue.");
$LinkText = _("View Jobs");
$msg = "{$scheduler_msg}" . "{$text} <a href={$URL}>{$LinkText}</a>";
$this->vars['message'] = $msg;
return new Response($msg, Response::HTTP_OK, array('Content-type' => 'text/plain'));
}
示例15: Output
/**
* \brief Generate the text for this plugin.
*/
function Output()
{
if ($this->State != PLUGIN_STATE_READY) {
return;
}
global $Plugins;
$V = "";
switch ($this->OutputType) {
case "XML":
break;
case "HTML":
/* If this is a POST, then process the request. */
$uploadpk = GetParm('uploadunpack', PARM_INTEGER);
if (!empty($uploadpk)) {
$P =& $Plugins[plugin_find_id("agent_unpack")];
$rc = $P->AgentAdd($uploadpk);
if (empty($rc)) {
/* Need to refresh the screen */
$text = _("Unpack added to job queue");
$V .= displayMessage($text);
} else {
$text = _("Unpack of Upload failed");
$V .= displayMessage("{$text}: {$rc}");
}
}
/* Set default values */
if (empty($GetURL)) {
$GetURL = 'http://';
}
//$V .= $this->ShowReunpackView($uploadtree_pk);
break;
case "Text":
break;
default:
break;
}
if (!$this->OutputToStdout) {
return $V;
}
print "{$V}";
return;
}