本文整理汇总了PHP中getImageForType函数的典型用法代码示例。如果您正苦于以下问题:PHP getImageForType函数的具体用法?PHP getImageForType怎么用?PHP getImageForType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getImageForType函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildInstallGrid
function buildInstallGrid($view)
{
$uh = new UpgradeHistory();
$installeds = $uh->getAll();
$upgrades_installed = 0;
$installed_objects = array();
foreach ($installeds as $installed) {
$filename = from_html($installed->filename);
$date_entered = $installed->date_entered;
$type = $installed->type;
$version = $installed->version;
$upgrades_installed++;
$link = "";
switch ($type) {
case "theme":
case "langpack":
case "module":
case "patch":
$manifest_file = extractManifest($filename);
require_once $manifest_file;
$name = empty($manifest['name']) ? $filename : $manifest['name'];
$description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
if (($upgrades_installed == 0 || $uh->UninstallAvailable($installeds, $installed)) && is_file($filename) && !empty($manifest['is_uninstallable'])) {
$link = urlencode($filename);
} else {
$link = 'false';
}
break;
default:
break;
}
if ($view == 'default' && $type != 'patch') {
continue;
}
if ($view == 'module' && $type != 'module' && $type != 'theme' && $type != 'langpack') {
continue;
}
$target_manifest = remove_file_extension($filename) . "-manifest.php";
require_once "{$target_manifest}";
if (isset($manifest['icon']) && $manifest['icon'] != "") {
$manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
$manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
$manifest_icon = clean_path($manifest['icon']);
$icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir) + 1) : $manifest_icon) . "\">";
} else {
$icon = getImageForType($manifest['type']);
}
$installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link);
//print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" );
//print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" );
//print( "</form>\n" );
}
}
示例2: remove_file_extension
$upgrades_installed++;
$link = "";
$view = 'default';
$target_manifest = remove_file_extension($filename) . "-manifest.php";
// cn: bug 9174 - cleared out upgrade dirs, or corrupt entries in upgrade_history give us bad file paths
if (is_file($target_manifest)) {
require_once "{$target_manifest}";
$name = empty($manifest['name']) ? $filename : $manifest['name'];
$description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
if (isset($manifest['icon']) && $manifest['icon'] != "") {
$manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
$manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
$manifest_icon = clean_path($manifest['icon']);
$icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir) + 1) : $manifest_icon) . "\">";
} else {
$icon = getImageForType($manifest['type']);
}
$uwHistory .= "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" . "<tr><td>{$icon}</td><td>{$name}</td><td>{$type}</td><td>{$version}</td><td>{$date_entered}</td><td>{$description}</td><td>{$link}</td></tr>\n" . "</form>\n";
}
}
if ($upgrades_installed == 0) {
$uwHistory .= "<td class='tabDetailViewDF' colspan='6'>";
$uwHistory .= $mod_strings['LBL_UW_NO_INSTALLED_UPGRADES'];
$uwHistory .= "</td></tr>";
}
$uwHistory .= "</table>\n";
$uwHistory .= "</ul>\n";
//// END UPGRADE HISTORY
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// PAGE OUTPUT
示例3: getValidPatchName
/**
* gets valid patch file names that exist in upload/upgrade/patch/
*/
function getValidPatchName($returnFull = true)
{
global $base_upgrade_dir;
global $mod_strings;
global $uh;
global $sugar_version;
global $sugar_config;
$uh = new UpgradeHistory();
list($base_upgrade_dir, $base_tmp_upgrade_dir) = getUWDirs();
$return = array();
// scan for new files (that are not installed)
logThis('finding new files for upgrade');
$upgrade_content = '';
$upgrade_contents = findAllFiles($base_upgrade_dir, array(), false, 'zip');
//other variations of zip file i.e. ZIP, zIp,zIP,Zip,ZIp,ZiP
$ready = "<ul>\n";
$ready .= "\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_NAME']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_TYPE']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_VERSION']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_PUBLISHED']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_UNINSTALLABLE']}</b>\n\t\t\t\t</td>\n\t\t\t\t<td align=left>\n\t\t\t\t\t<b>{$mod_strings['LBL_ML_DESCRIPTION']}</b>\n\t\t\t\t</td>\n\t\t\t</tr>";
$disabled = '';
// assume old patches are there.
$upgradeToVersion = array();
// fill with valid patches - we will only use the latest qualified found patch
// cn: bug 10609 - notices for uninitialized variables
$icon = '';
$name = '';
$type = '';
$version = '';
$published_date = '';
$uninstallable = '';
$description = '';
$disabled = '';
foreach ($upgrade_contents as $upgrade_content) {
if (!preg_match("#.*\\.zip\$#i", $upgrade_content)) {
continue;
}
$the_base = basename($upgrade_content);
$the_md5 = md5_file($upgrade_content);
$md5_matches = $uh->findByMd5($the_md5);
/* If a patch is in the /patch dir AND has no record in the upgrade_history table we assume that it's the one we want.
* Edge-case: manual upgrade with a FTP of a patch; UH table has no entry for it. Assume nothing. :( */
if (0 == sizeof($md5_matches)) {
$target_manifest = remove_file_extension($upgrade_content) . '-manifest.php';
require_once $target_manifest;
if (empty($manifest['version'])) {
logThis("*** Potential error: patch found with no version [ {$upgrade_content} ]");
continue;
}
if (!isset($manifest['type']) || $manifest['type'] != 'patch') {
logThis("*** Potential error: patch found with either no 'type' or non-patch type [ {$upgrade_content} ]");
continue;
}
$upgradeToVersion[$manifest['version']] = urlencode($upgrade_content);
$name = empty($manifest['name']) ? $upgrade_content : $manifest['name'];
$version = empty($manifest['version']) ? '' : $manifest['version'];
$published_date = empty($manifest['published_date']) ? '' : $manifest['published_date'];
$icon = '';
$description = empty($manifest['description']) ? 'None' : $manifest['description'];
$uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes';
$type = getUITextForType($manifest['type']);
$manifest_type = $manifest['type'];
if (empty($manifest['icon'])) {
$icon = getImageForType($manifest['type']);
} else {
$path_parts = pathinfo($manifest['icon']);
$icon = "<!--not_in_theme!--><img src=\"" . remove_file_extension($upgrade_content) . "-icon." . $path_parts['extension'] . "\">";
}
}
}
// cn: bug 10488 use the NEWEST upgrade/patch available when running upgrade wizard.
ksort($upgradeToVersion);
$upgradeToVersion = array_values($upgradeToVersion);
$newest = array_pop($upgradeToVersion);
$_SESSION['install_file'] = urldecode($newest);
// in-case it was there from a prior.
logThis("*** UW using [ {$_SESSION['install_file']} ] as source for patch files.");
$cleanUpgradeContent = urlencode($_SESSION['install_file']);
// cn: 10606 - cannot upload a patch file since this returned always.
if (!empty($cleanUpgradeContent)) {
$ready .= "<tr><td>{$icon}</td><td>{$name}</td><td>{$type}</td><td>{$version}</td><td>{$published_date}</td><td>{$uninstallable}</td><td>{$description}</td>\n";
$ready .= <<<eoq
\t <td>
\t\t\t\t<form action="index.php" method="post">
\t\t\t\t\t<input type="hidden" name="module" value="UpgradeWizard">
\t\t\t\t\t<input type="hidden" name="action" value="index">
\t\t\t\t\t<input type="hidden" name="step" value="{$_REQUEST['step']}">
\t\t\t\t\t<input type="hidden" name="run" value="delete">
\t \t\t<input type=hidden name="install_file" value="{$cleanUpgradeContent}" />
\t \t\t<input type=submit value="{$mod_strings['LBL_BUTTON_DELETE']}" />
\t\t\t\t</form>
\t\t\t</td></table>
eoq;
$disabled = "DISABLED";
}
if (empty($cleanUpgradeContent)) {
$ready .= "<tr><td colspan='7'><i>None</i></td>\n";
$ready .= "</table>\n";
}
$ready .= "<br></ul>\n";
//.........这里部分代码省略.........
示例4: getValidPatchName
/**
* gets valid patch file names that exist in upload/upgrade/patch/
*/
function getValidPatchName($returnFull = true)
{
global $base_upgrade_dir;
global $mod_strings;
global $uh;
$return = array();
// scan for new files (that are not installed)
logThis('finding new files for upgrade');
$upgrade_content = '';
$upgrade_contents = findAllFiles($base_upgrade_dir, array(), false);
$upgrades_available = 0;
$ready = "<ul>\n";
$ready .= "\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<th></th>\n\t\t\t\t<th align=left>\n\t\t\t\t\t{$mod_strings['LBL_ML_NAME']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_TYPE']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_VERSION']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_PUBLISHED']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_UNINSTALLABLE']}\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t{$mod_strings['LBL_ML_DESCRIPTION']}\n\t\t\t\t</th>\n\t\t\t</tr>";
$disabled = '';
foreach ($upgrade_contents as $upgrade_content) {
if (!preg_match("#.*\\.zip\$#i", $upgrade_content)) {
continue;
}
$upgrade_content = clean_path($upgrade_content);
$the_base = basename($upgrade_content);
$the_md5 = md5_file($upgrade_content);
$md5_matches = $uh->findByMd5($the_md5);
if (0 == sizeof($md5_matches)) {
$target_manifest = remove_file_extension($upgrade_content) . '-manifest.php';
require_once $target_manifest;
$name = empty($manifest['name']) ? $upgrade_content : $manifest['name'];
$version = empty($manifest['version']) ? '' : $manifest['version'];
$published_date = empty($manifest['published_date']) ? '' : $manifest['published_date'];
$icon = '';
$description = empty($manifest['description']) ? 'None' : $manifest['description'];
$uninstallable = empty($manifest['is_uninstallable']) ? 'No' : 'Yes';
$type = getUITextForType($manifest['type']);
$manifest_type = $manifest['type'];
if ($manifest_type != 'patch') {
continue;
}
if (empty($manifest['icon'])) {
$icon = getImageForType($manifest['type']);
} else {
$path_parts = pathinfo($manifest['icon']);
$icon = "<img src=\"" . remove_file_extension($upgrade_content) . "-icon." . $path_parts['extension'] . "\">";
}
$upgrades_available++;
if ($upgrades_available > 1) {
logThis('ERROR: found more than 1 qualified upgrade file! Stopping upgrade.');
$stop = true;
// more than 1 upgrade?!?
} else {
logThis('found a valid upgrade file: ' . $upgrade_content);
$_SESSION['install_file'] = $upgrade_content;
// in-case it was there from a prior.
$stop = false;
}
$ready .= "<tr><td>{$icon}</td><td>{$name}</td><td>{$type}</td><td>{$version}</td><td>{$published_date}</td><td>{$uninstallable}</td><td>{$description}</td>\n";
$cleanUpgradeContent = urlencode($upgrade_content);
$ready .= <<<eoq
\t <td>
\t\t\t\t\t<form action="index.php" method="post">
\t\t\t\t\t\t<input type="hidden" name="module" value="UpgradeWizard">
\t\t\t\t\t\t<input type="hidden" name="action" value="index">
\t\t\t\t\t\t<input type="hidden" name="step" value="{$_REQUEST['step']}">
\t\t\t\t\t\t<input type="hidden" name="run" value="delete">
\t \t\t<input type=hidden name="install_file" value="{$cleanUpgradeContent}" />
\t \t\t<input type=submit value="{$mod_strings['LBL_BUTTON_DELETE']}" />
\t\t\t\t\t</form>
\t\t\t\t</td>
eoq;
$disabled = "DISABLED";
}
}
$ready .= "</table>\n";
if ($upgrades_available == 0) {
$ready .= "<i>None</i><br>\n";
}
$ready .= "</ul>\n";
$return['ready'] = $ready;
$return['disabled'] = $disabled;
if ($returnFull) {
return $return;
}
}