本文整理汇总了PHP中CPGPluginAPI::installed方法的典型用法代码示例。如果您正苦于以下问题:PHP CPGPluginAPI::installed方法的具体用法?PHP CPGPluginAPI::installed怎么用?PHP CPGPluginAPI::installed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPGPluginAPI
的用法示例。
在下文中一共展示了CPGPluginAPI::installed方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mirror_configure
function mirror_configure()
{
global $CONFIG, $CPG_PLUGINS;
$icon_array['ok'] = cpg_fetch_icon('ok', 1);
$icon_array['cancel'] = cpg_fetch_icon('cancel', 1);
$allow_continue = 1;
echo <<<EOT
<form action="" method="post" name="mirror_config" id="mirror_config">
<ul>
EOT;
if ($CONFIG['transparent_overlay'] != '0') {
echo <<<EOT
<li>The mirror plugin doesn't work with the config option '<em>Insert a transparent overlay to minimize image theft</em>'. If you decide to continue, that option will be disabled for you. Don't turn it back on while using this plugin.</li>
EOT;
}
if (($plugin_id = CPGPluginAPI::installed('image_manipulation')) !== false) {
echo <<<EOT
<li>You have installed the plugin '<em>Image Manipulation (image_manipulation)</em>' that can't be run at the same time with the Mirror plugin. Return to the plugin manager and uninstall that other plugin first before installing this plugin.</li>
EOT;
$allow_continue = 0;
}
echo <<<EOT
</ul>
EOT;
if ($allow_continue == 1) {
echo <<<EOT
<input type="hidden" name="mirror_continue_anyway" id="mirror_continue_anyway" value="1" />
<button type="submit" class="button" name="submit" value="Continue anyway">{$icon_array['ok']}Continue anyway</button>
EOT;
}
echo <<<EOT
<a href="pluginmgr.php" class="admin_menu">{$icon_array['cancel']}Cancel</a>
EOT;
echo <<<EOT
</form>
EOT;
}
示例2: display_plugin_list
function display_plugin_list()
{
global $CPG_PLUGINS, $lang_pluginmgr_php, $lang_plugin_php, $lang_common, $CONFIG, $CPG_PHP_SELF;
list($timestamp, $form_token) = getFormToken();
$help = ' ' . cpg_display_help('f=plugins.htm&as=plugin_manager&ae=plugin_manager_end&top=1', '800', '600');
$help_plugin_enable = cpg_display_help('f=configuration.htm&as=admin_general_enable-plugins&ae=admin_general_enable-plugins_end', 400, 300);
// configure plugin api (enabled or disabled)
$yes_selected = $CONFIG['enable_plugins'] ? 'checked="checked"' : '';
$no_selected = !$CONFIG['enable_plugins'] ? 'checked="checked"' : '';
print '<form name="pluginenableconfig" id="cpgform2" action="' . $CPG_PHP_SELF . '" method="post" style="margin:0px;padding:0px">';
starttable('-1', cpg_fetch_icon('plugin_mgr', 2) . $lang_pluginmgr_php['pmgr'] . $help, 3);
echo <<<EOT
<tr>
<td class="tableh2" colspan="3">
{$lang_pluginmgr_php['explanation']}
</td>
</tr>
<tr>
<td class="tableb">
{$lang_pluginmgr_php['plugin_enabled']}
</td>
<td class="tableb">
<input type="radio" id="enable_plugins1" name="enable_plugins" value="1" onclick="document.pluginenableconfig.submit();" {$yes_selected} class="radio" /><label for="enable_plugins1" class="clickable_option">{$lang_common['yes']}</label>
<input type="radio" id="enable_plugins0" name="enable_plugins" value="0" onclick="document.pluginenableconfig.submit();" {$no_selected} class="radio" /><label for="enable_plugins0" class="clickable_option">{$lang_common['no']}</label>
<input type="hidden" name="update_config" value="1" />
<input type="hidden" name="form_token" value="{$form_token}" />
<input type="hidden" name="timestamp" value="{$timestamp}" />
</td>
<td class="tableb">
{$help_plugin_enable}
</td>
</tr>
EOT;
endtable();
print '</form>';
echo <<<EOT
<br />
EOT;
$help = ' ' . cpg_display_help('f=plugins.htm&as=plugin_manager_uninstall&ae=plugin_manager_uninstall_end&top=1', '640', '480');
$available_plugins = cpg_get_dir_list('./plugins/');
starttable('100%');
echo <<<EOT
<tr>
<td class="tableh1" width="90%"><strong><span class="statlink">{$lang_pluginmgr_php['i_plugins']}</span></strong></td>
<td colspan="3" class="tableh1" align="center" width="10%"><strong><span class="statlink">{$lang_pluginmgr_php['operation']}</span></strong>{$help}</td>
</tr>
EOT;
unset($installed_plugins);
if ($CONFIG['enable_plugins'] == 1) {
$loop_counter = 0;
foreach ($CPG_PLUGINS as $thisplugin) {
$installed_plugins[$loop_counter] = array('index' => $thisplugin->index, 'plugin_id' => $thisplugin->plugin_id, 'path' => $thisplugin->path, 'priority' => $thisplugin->priority, 'error' => $thisplugin->error);
$loop_counter++;
}
} else {
// If plugin system is turned off, grab installed plugins from database table
$query = 'SELECT * FROM ' . $CONFIG['TABLE_PLUGINS'] . ' ORDER BY priority ASC;';
$result = cpg_db_query($query);
$loop_counter = 0;
while ($installed_plugin = mysql_fetch_assoc($result)) {
$installed_plugins[$loop_counter] = array('index' => $loop_counter, 'plugin_id' => $installed_plugin['plugin_id'], 'path' => $installed_plugin['path'], 'priority' => $installed_plugin['priority'], 'error' => array());
$loop_counter++;
}
}
$installed_count = 0;
$loop_counter = 0;
if (isset($installed_plugins) == TRUE) {
$plugins_count = count($installed_plugins);
foreach ($installed_plugins as $thisplugin) {
$installed_count++;
unset($extra_info);
unset($install_info);
include './plugins/' . $thisplugin['path'] . '/configuration.php';
$pluginPath = $thisplugin['path'];
$safename = addslashes(str_replace(' ', '', $name));
if (isset($extra_info) == TRUE) {
$extra = $extra_info;
} else {
$extra = '';
}
if (sizeof($thisplugin['error']) > 0) {
$error = $thisplugin['error']['desc'];
$extra = '<tr><td class="tableb" width="100%" colspan="2">' . '<strong>' . $lang_common['error'] . ':</strong> <span style="color:red;">' . $error . '</span>' . '</td></tr>' . $extra;
}
if ($loop_counter == 0) {
$row_style_class = 'tableb';
} else {
$row_style_class = 'tableb tableb_alternate';
}
$loop_counter++;
if ($loop_counter > 1) {
$loop_counter = 0;
}
echo <<<EOT
<tr>
<td width="90%" class="{$row_style_class}">
<a name="{$pluginPath}"></a>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="maintable">
<tr>
//.........这里部分代码省略.........
示例3: display_plugin_list
function display_plugin_list()
{
global $CPG_PLUGINS, $lang_pluginmgr_php, $lang_plugin_php, $lang_common, $CONFIG, $CPG_PHP_SELF;
$help = ' ' . cpg_display_help('f=plugins.htm&as=plugin_manager&ae=plugin_manager_end&top=1', '800', '600');
$help_plugin_enable = cpg_display_help('f=configuration.htm&as=admin_general_enable-plugins&ae=admin_general_enable-plugins_end', 400, 300);
// configure plugin api (enabled or disabled)
$yes_selected = $CONFIG['enable_plugins'] ? 'checked="checked"' : '';
$no_selected = !$CONFIG['enable_plugins'] ? 'checked="checked"' : '';
print '<form name="pluginenableconfig" id="cpgform2" action="' . $CPG_PHP_SELF . '" method="post" style="margin:0px;padding:0px">';
starttable('-1', $lang_pluginmgr_php['pmgr'] . $help, 3);
echo <<<EOT
<tr>
<td class="tableh2" colspan="3">
{$lang_pluginmgr_php['explanation']}
</td>
</tr>
<tr>
<td class="tableb">
{$lang_pluginmgr_php['plugin_enabled']}
</td>
<td class="table">
<input type="radio" id="enable_plugins1" name="enable_plugins" value="1" onclick="document.pluginenableconfig.submit();" {$yes_selected} /><label for="enable_plugins1" class="clickable_option">{$lang_common['yes']}</label>
<input type="radio" id="enable_plugins0" name="enable_plugins" value="0" onclick="document.pluginenableconfig.submit();" {$no_selected} /><label for="enable_plugins0" class="clickable_option">{$lang_common['no']}</label>
<input type="hidden" name="update_config" value="1" />
</td>
<td class="tableb">
{$help_plugin_enable}
</td>
</tr>
EOT;
endtable();
print '</form>';
echo <<<EOT
<br />
EOT;
$help = ' ' . cpg_display_help('f=plugins.htm&as=plugin_manager_uninstall&ae=plugin_manager_uninstall_end&top=1', '640', '480');
$available_plugins = cpg_get_dir_list('./plugins/');
starttable('100%');
echo <<<EOT
<tr>
<td class="tableh1" width="90%"><strong><span class="statlink">{$lang_pluginmgr_php['i_plugins']}</span></strong></td>
<td colspan="3" class="tableh1" align="center" width="10%"><strong><span class="statlink">{$lang_pluginmgr_php['operation']}</span></strong>{$help}</td>
</tr>
EOT;
$installed_count = 0;
$loop_counter = 0;
foreach ($CPG_PLUGINS as $thisplugin) {
$installed_count++;
unset($extra_info);
unset($install_info);
include './plugins/' . $thisplugin->path . '/configuration.php';
$pluginPath = $thisplugin->path;
$safename = addslashes(str_replace(' ', '', $name));
if (isset($extra_info) == TRUE) {
$extra = $extra_info;
} else {
$extra = '';
}
if (sizeof($thisplugin->error) > 0) {
$error = $thisplugin->error['desc'];
$extra = '<tr><td class="tableb" width="100%" colspan="2">' . '<strong>' . $lang_common['error'] . ':</strong> <span style="color:red;">' . $error . '</span>' . '</td></tr>' . $extra;
}
if ($loop_counter == 0) {
$row_style_class = 'tableb';
} else {
$row_style_class = 'tableb tableb_alternate';
}
$loop_counter++;
if ($loop_counter > 1) {
$loop_counter = 0;
}
echo <<<EOT
<tr>
<td width="90%" class="{$row_style_class}">
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="maintable">
<tr>
<td colspan="2" class="tableh1">{$name} ({$pluginPath}): {$lang_pluginmgr_php['vers']}{$version}</td>
</tr>
<tr>
<td class="tableb" width="20%" valign="top">{$lang_pluginmgr_php['extra']}:</td>
<td class="tableb" valign="top">{$extra}</td>
</tr>
<tr>
<td class="tableb tableb_alternate" valign="top">{$lang_pluginmgr_php['author']}:</td>
<td class="tableb tableb_alternate" valign="top">{$author}</td>
</tr>
<tr>
<td class="tableb" valign="top">{$lang_pluginmgr_php['desc']}</td>
<td class="tableb" valign="top">{$description}</td>
</tr>
</table>
</td>
<td class="{$row_style_class}" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
EOT;
if ($thisplugin->index > 0 && count($CPG_PLUGINS) > 1) {
echo <<<EOT
<td width="3%" align="center" valign="middle">
//.........这里部分代码省略.........
示例4: install
/**
* CPGPluginAPI::install()
*
* Installs a plugin and executes 'plugin_install' action
*
* @param string $path_to_plugin_folder
* @return N/A
**/
public static function install($path)
{
global $CONFIG, $thisplugin, $CPG_PLUGINS, $lang_plugin_api;
// If this plugin is already installed return true
if (CPGPluginAPI::installed($path)) {
return true;
}
// If codebase.php or configuration.php don't exist, skip this plugin
if (!(file_exists('./plugins/' . $path . '/codebase.php') && file_exists('./plugins/' . $path . '/configuration.php'))) {
return false;
}
// Load language files
$lg = 'lang_plugin_' . $path;
global ${$lg};
cpg_load_plugin_language_file($path);
// Get the lowest priority level (highest number) from the database
$sql = "SELECT priority FROM {$CONFIG['TABLE_PLUGINS']} ORDER BY priority DESC LIMIT 1";
$result = cpg_db_query($sql);
$data = mysql_fetch_assoc($result);
mysql_free_result($result);
// Set the execution priority to last
$priority = is_null($data['priority']) ? 0 : $data['priority'] + 1;
// Grab the plugin's credits
include_once './plugins/' . $path . '/configuration.php';
// Create a generic plugin object
$thisplugin = new CPGPlugin(array('plugin_id' => 'new', 'name' => $name, 'priority' => $priority, 'path' => $path));
$thisplugin->awake = true;
// Grab plugin's code
include_once './plugins/' . $path . '/codebase.php';
// Copy it to the global scope
$CPG_PLUGINS['new'] = $thisplugin;
// If the plugin has an install action, execute it
$installed = CPGPluginAPI::action('plugin_install', true, CPG_EXEC_NEW);
// If $installed is boolean then plugin was installed; Return true
if (is_bool($installed) && $installed) {
$sql = "INSERT INTO {$CONFIG['TABLE_PLUGINS']} (name, path, priority) VALUES ('" . addslashes($name) . "', '" . addslashes($path) . "', {$priority})";
$result = cpg_db_query($sql);
if ($CONFIG['log_mode']) {
log_write("Plugin '" . $name . "' installed", CPG_GLOBAL_LOG);
}
return $installed;
// If $installed is an integer then the plugin needs to be configured; Return the value
} elseif (is_int($installed)) {
return $installed;
// Plugin wasn't installed; Display an error
} else {
// The plugin's install function failed
cpg_die(CRITICAL_ERROR, sprintf($lang_plugin_api['error_install'], $thisplugin->name), __FILE__, __LINE__);
}
}
示例5: install
/**
* CPGPluginAPI::install()
*
* Installs a plugin and executes 'plugin_install' action
*
* @param string $path_to_plugin_folder
* @return N/A
**/
function install($path)
{
global $CONFIG, $thisplugin, $CPG_PLUGINS, $lang_plugin_api;
// If this plugin is already installed return true
if (CPGPluginAPI::installed($path)) {
return true;
}
// If the codebase and configuration.php file is missing return false
if (!file_exists('./plugins/' . $path . '/codebase.php') && !file_exists('./plugins/' . $path . '/configuration.php')) {
return false;
}
// Get the lowest priority level (highest number) from the database
$sql = 'select priority from ' . $CONFIG['TABLE_PLUGINS'] . ' order by priority desc limit 1;';
$result = cpg_db_query($sql);
$data = mysql_fetch_assoc($result);
mysql_free_result($result);
// Set the execution priority to last
$priority = is_null($data['priority']) ? 0 : $data['priority'] + 1;
// Grab the plugin's credits
include_once './plugins/' . $path . '/configuration.php';
// Create a generic plugin object
$thisplugin = new CPGPlugin(array('plugin_id' => 'new', 'name' => $name, 'priority' => $priority, 'path' => $path));
$thisplugin->awake = true;
// Grab plugin's code
include_once './plugins/' . $path . '/codebase.php';
// Copy it to the global scope
$CPG_PLUGINS['new'] = $thisplugin;
// If the plugin has an install action, execute it
$installed = CPGPluginAPI::action('plugin_install', true, CPG_EXEC_NEW);
// If $installed is boolean then plugin was installed; Return true
if (is_bool($installed) && $installed) {
$sql = 'insert into ' . $CONFIG['TABLE_PLUGINS'] . ' ' . '(name, path,priority) ' . ' values ' . '("' . addslashes($name) . '",' . '"' . addslashes($path) . '",' . $priority . ');';
$result = cpg_db_query($sql);
if ($CONFIG['log_mode']) {
log_write("Plugin '" . $name . "' installed at " . date("F j, Y, g:i a"), CPG_GLOBAL_LOG);
}
return $installed;
// If $installed is an integer then the plugin needs to be configured; Return the value
} elseif (is_int($installed)) {
return $installed;
// Plugin wasn't installed; Display an error
} else {
// The plugin's install function failed
cpg_die(CRITICAL_ERROR, sprintf($lang_plugin_api['error_install'], $thisplugin->name), __FILE__, __LINE__);
}
}
示例6: image_manipulation_configure
function image_manipulation_configure()
{
global $CONFIG, $CPG_PLUGINS, $lang_plugin_image_manipulation;
require './plugins/image_manipulation/init.inc.php';
$icon_array['ok'] = cpg_fetch_icon('ok', 1);
$icon_array['cancel'] = cpg_fetch_icon('cancel', 1);
$allow_continue = 1;
echo <<<EOT
<form action="" method="post" name="image_manipulation_config" id="image_manipulation_config">
<ul>
EOT;
if ($CONFIG['transparent_overlay'] != '0') {
echo <<<EOT
<li>{$lang_plugin_image_manipulation['transparent_overlay_warning']}
{$lang_plugin_image_manipulation['continue_will_disable_warning']}
{$lang_plugin_image_manipulation['do_not_turn_on_again']}</li>
EOT;
}
if (($plugin_id = CPGPluginAPI::installed('mirror')) !== false) {
$warning_coexist = sprintf($lang_plugin_image_manipulation['plugins_cant_coexist'], '<em>Mirror</em>');
echo <<<EOT
<li>{$warning_coexist}</li>
EOT;
$allow_continue = 0;
}
echo <<<EOT
</ul>
EOT;
if ($allow_continue == 1) {
echo <<<EOT
<input type="hidden" name="image_manipulation_continue_anyway" id="image_manipulation_continue_anyway" value="1" />
<button type="submit" class="button" name="submit" value="{$lang_plugin_image_manipulation['continue_anyway']}">{$icon_array['ok']}{$lang_plugin_image_manipulation['continue_anyway']}</button>
EOT;
}
echo <<<EOT
<a href="pluginmgr.php" class="admin_menu">{$icon_array['cancel']}{$lang_plugin_image_manipulation['cancel']}</a>
EOT;
echo <<<EOT
</form>
EOT;
}
示例7: display_plugin_list
function display_plugin_list()
{
global $CPG_PLUGINS, $lang_pluginmgr_php;
$available_plugins = cpg_get_dir_list('./plugins/');
starttable('100%');
echo <<<EOT
<tr>
<td class="tableh1" width="90%"><b><span class="statlink">{$lang_pluginmgr_php['i_plugins']}</span></b></td>
<td colspan="3" class="tableh1" align="center" width="10%"><b><span class="statlink">{$lang_pluginmgr_php['operation']}</span></b></td>
</tr>
EOT;
$installed_count = 0;
foreach ($CPG_PLUGINS as $thisplugin) {
$installed_count++;
unset($extra_info);
unset($install_info);
include './plugins/' . $thisplugin->path . '/configuration.php';
$safename = addslashes(str_replace(' ', '', $name));
$extra = isset($install_info) ? $install_info : null;
if (sizeof($thisplugin->error) > 0) {
$error = $thisplugin->error['desc'];
$extra = '<tr><td class="tableb" width="100%" colspan="2">' . '<b>Error:</b> <span style="color:red;">' . $error . '</span>' . '</td></tr>' . $extra;
}
echo <<<EOT
<tr>
<td width="90%">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="tableh2" width="50%"><b>{$lang_pluginmgr_php['name']}</b> {$name} {$lang_pluginmgr_php['vers']}{$version}</td>
<td class="tableh2" width="50%">{$extra}</td>
</tr>
<tr>
<td class="tableb" colspan="2" width="100%"><b>{$lang_pluginmgr_php['author']}</b> {$author}</td>
</tr>
<tr>
<td class="tableb" colspan="2" width="100%"><b>{$lang_pluginmgr_php['desc']}</b> {$description}</td>
</tr>
</table>
</td>
<td class="tableh1" valign="top">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
EOT;
if ($thisplugin->index > 0 && count($CPG_PLUGINS) > 1) {
echo <<<EOT
<td width="3%" align="center" valign="middle">
<a href="pluginmgr.php?op=moveu&p={$thisplugin->plugin_id}"><img src="images/up.gif" border="0" alt="" /></a>
</td>
EOT;
} else {
echo '<td width="3%"><img src="images/spacer.gif" width="16" height="16" /></td>';
}
if ($thisplugin->index < count($CPG_PLUGINS) - 1) {
echo <<<EOT
<td width="3%" align="center" valign="middle">
<a href="pluginmgr.php?op=moved&p={$thisplugin->plugin_id}"><img src="images/down.gif" border="0" alt="" /></a>
</td>
EOT;
} else {
echo '<td width="3%"><img src="images/spacer.gif" width="16" height="16" /></td>';
}
echo <<<EOT
<td width="3%" align="center" valign="middle">
<a href="pluginmgr.php?op=uninstall&p={$thisplugin->plugin_id}" onClick="return confirmUninstall('{$safename}')">
<img src="images/delete.gif" border="0" alt="" />
</a>
</td>
</tr>
</table>
</td>
</tr>
EOT;
}
if ($installed_count == 0) {
echo '<tr><td colspan="4" class="tableb" align="center">' . $lang_pluginmgr_php['none_installed'] . '</td></tr>';
}
endtable();
echo '<p> </p>';
echo '<form action="pluginmgr.php?op=upload" method="post" enctype="multipart/form-data">';
starttable('100%');
echo <<<EOT
<tr>
<td class="tableh1" width="90%">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left">
<b><span class="statlink">{$lang_pluginmgr_php['n_plugins']}</span></b>
</td>
<td align="right">
<input type="file" size="40" name="plugin" />
<input type="submit" style="font-size: 12;" value="{$lang_pluginmgr_php['upload']}" />
</td>
</tr>
</table>
</td>
<td colspan="3" class="tableh1" align="center" width="10%"><b><span class="statlink">{$lang_pluginmgr_php['operation']}</span></b></td>
</tr>
EOT;
foreach ($available_plugins as $path) {
//.........这里部分代码省略.........