本文整理汇总了PHP中enableExtension函数的典型用法代码示例。如果您正苦于以下问题:PHP enableExtension函数的具体用法?PHP enableExtension怎么用?PHP enableExtension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了enableExtension函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
global $_configMutex, $_zp_conf_vars;
$_configMutex->lock();
$zp_cfg = file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE);
$i = strpos($zp_cfg, "\$conf['special_pages']");
$j = strpos($zp_cfg, '//', $i);
if ($i === false || $j === false) {
$conf = array('special_pages' => array());
$this->conf_vars = $conf['special_pages'];
$i = strpos($zp_cfg, '/** Do not edit below this line. **/');
if ($i === false) {
zp_error(gettext('The Zenphoto configuration file is corrupt. You will need to restore it from a backup.'));
}
$this->zp_cfg_a = substr($zp_cfg, 0, $i);
$this->zp_cfg_b = "//\n" . substr($zp_cfg, $i);
} else {
$this->zp_cfg_a = substr($zp_cfg, 0, $i);
$this->zp_cfg_b = substr($zp_cfg, $j);
eval(substr($zp_cfg, $i, $j - $i));
$this->conf_vars = $conf['special_pages'];
foreach ($_zp_conf_vars['special_pages'] as $page => $element) {
if (isset($element['option'])) {
$this->plugin_vars[$page] = $element;
}
}
}
if (OFFSET_PATH == 2) {
$old = array_keys($conf['special_pages']);
$zp_cfg = file_get_contents(SERVERPATH . '/' . ZENFOLDER . '/zenphoto_cfg.txt');
$i = strpos($zp_cfg, "\$conf['special_pages']");
$j = strpos($zp_cfg, '//', $i);
eval(substr($zp_cfg, $i, $j - $i));
$new = array_keys($conf['special_pages']);
if ($old != $new) {
//Things have changed, need to reset to defaults;
setOption('rewriteTokens_restore', 1);
$this->handleOptionSave(NULL, NULL);
setupLog(gettext('rewriteTokens restored to default'), true);
}
} else {
enableExtension('rewriteTokens', 97 | ADMIN_PLUGIN);
// plugin must be enabled for saving options
}
}
示例2: __construct
function __construct()
{
global $_zp_authority, $_userAddressFields;
$firstTime = false;
$tablecols = db_list_fields('administrators');
foreach ($tablecols as $key => $datum) {
if ($datum['Field'] == 'custom_data') {
$firstTime = true;
enableExtension('userAddressFields', true);
break;
}
}
parent::constructor('userAddressFields', self::fields());
if ($firstTime) {
// migrate the custom data user data
$result = query('SELECT * FROM ' . prefix('administrators') . ' WHERE `valid`!=0');
if ($result) {
while ($row = db_fetch_assoc($result)) {
$custom = getSerializedArray($row['custom_data']);
if (!empty($custom)) {
$sql = 'UPDATE ' . prefix('administrators') . ' SET ';
foreach ($custom as $field => $val) {
$sql .= '`' . $field . '`=' . db_quote($val) . ',';
}
setupQuery($sql);
}
}
db_free_result($result);
}
setupQuery('ALTER TABLE ' . prefix('administrators') . ' DROP `custom_data`');
}
$cloneid = bin2hex(FULLWEBPATH);
if (OFFSET_PATH == 2 && isset($_SESSION['admin'][$cloneid])) {
$user = unserialize($_SESSION['admin'][$cloneid]);
$user2 = $_zp_authority->getAnAdmin(array('`user`=' => $user->getUser(), '`pass`=' => $user->getPass(), '`valid`=' => 1));
if ($user2) {
foreach (userAddressFields::fields() as $field) {
$user2->set($field['name'], $user->get($field['name']));
}
$user2->save();
}
}
}
示例3: gettext
/**
* Pseudo mailing handler for localhost testing
*
* A "mail" file named by the <i>subject</i> is created in the <var>%DATA_FOLDER%</var> folder. Multiple mailings with the
* same <i>subject</i> will overwrite.
*
* @package plugins
* @subpackage mail
*/
$plugin_is_filter = 5 | CLASS_PLUGIN;
$plugin_description = gettext("Pseudo mailing handler for localhost testing.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_version = '1.4.3';
$plugin_disable = zp_has_filter('sendmail') && !extensionEnabled('pseudomail') ? sprintf(gettext('Only one Email handler plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('sendmail'))) : '';
if ($plugin_disable) {
enableExtension('pseudomail', 0);
} else {
zp_register_filter('sendmail', 'pseudo_sendmail');
}
function pseudo_sendmail($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo)
{
$filename = str_replace(array('<', '>', ':', '"' . '/' . '\\', '|', '?', '*'), '_', $subject);
$path = SERVERPATH . '/' . DATA_FOLDER . '/' . $filename . '.txt';
$f = fopen($path, 'w');
fwrite($f, str_pad('*', 49, '-') . "\n");
$tolist = '';
foreach ($email_list as $to) {
$tolist .= ',' . $to;
}
fwrite($f, sprintf(gettext('To: %s'), substr($tolist, 1)) . "\n");
fwrite($f, sprintf('From: %1$s <%2$s>', $from_name, $from_mail) . "\n");
示例4: getOption
$publicKey = getOption('reCaptcha_public_key');
$lang = strtolower(substr(ZENPHOTO_LOCALE, 0, 2));
if (!getOption('reCaptcha_public_key')) {
return array('input' => '', 'html' => '<p class="errorbox">' . gettext('reCAPTCHA is not properly configured.') . '</p>', 'hidden' => '');
} else {
$source = getPlugin('reCaptcha/' . $theme . '/reCaptcha.html');
if ($source) {
$webpath = dirname(getplugin('reCaptcha/' . $theme . '/reCaptcha.html', false, true));
$tr = array('__GETHELP__' => gettext("Help"), '__GETIMAGE__' => gettext("Get a visual challenge"), '__GETAUDIO__' => gettext("Get an audio challenge"), '__RELOAD__' => gettext("Get another challenge"), '__WORDS__' => gettext("Type the two words"), '__NUMBERS__' => gettext("Type what you hear"), '__ERROR__' => gettext("Incorrect please try again"), '__SOURCEWEBPATH__' => $webpath);
$html = strtr(file_get_contents($source), $tr);
$theme = 'custom';
// to tell google to use the above
} else {
$html = '';
}
$themejs = '<script type="text/javascript">' . "\n" . " var RecaptchaOptions = {\n";
if (!in_array($lang, array('de', 'en', 'es', 'fr', 'nl', 'ru', 'pt', 'tr'))) {
// google's list as of June 2013
$themejs .= " custom_translations : {\n" . " instructions_visual : 'Type the two words',\n" . " instructions_audio : 'Type what you hear',\n" . " play_again : 'Play sound again',\n" . " cant_hear_this : 'Download the sound as MP3',\n" . " visual_challenge : 'Get a visual challenge',\n" . " audio_challenge : 'Get an audio challenge',\n" . " refresh_btn : 'Get another challenge',\n" . " help_btn : 'Help',\n" . " incorrect_try_again : 'Incorrect please try again',\n" . " },\n";
}
$themejs .= " lang : '{$lang}',\n" . "\t\t\t\ttheme : '{$theme}'\n" . "\t\t\t\t};\n" . "</script>\n";
$html .= recaptcha_get_html($publicKey, NULL, secureServer());
return array('html' => '<label class="captcha_label">' . $prompt . '</label>', 'input' => $themejs . $html);
}
}
}
if ($plugin_disable) {
enableExtension('reCaptcha', 0);
} else {
$_zp_captcha = new reCaptcha();
}
示例5: defaultExtension
* [MEDIAPLAYER album2 video2.mp4 <var>2</var>]
*
* <b>NOTE:</b> This player does not support external albums!
*
* @author Malte Müller (acrylian)
* @package plugins
* @subpackage media
*/
$plugin_is_filter = defaultExtension(5 | CLASS_PLUGIN);
$plugin_description = gettext("This plugin handles <code>flv</code>, <code>fla</code>, <code>mp3</code>, <code>mp4</code>, <code>m4v</code>, and <code>m4a</code> multi-media files.");
gettext("Please see <a href='http://jplayer.org'>jplayer.org</a> for more info about the player and its license.");
$plugin_author = "Malte Müller (acrylian)";
$plugin_disable = zpFunctions::pluginDisable(array(array(!extensionEnabled('class-video'), gettext('This plugin requires the <em>class-video</em> plugin')), array(!extensionEnabled('jplayer') && class_exists('Video') && Video::multimediaExtension() != 'pseudoPlayer', sprintf(gettext('jPlayer not enabled, %s is already instantiated.'), class_exists('Video') ? Video::multimediaExtension() : false)), array(getOption('album_folder_class') === 'external', gettext('This player does not support <em>External Albums</em>.'))));
$option_interface = 'jplayer_options';
if ($plugin_disable) {
enableExtension('jplayer', 0);
} else {
Gallery::addImageHandler('flv', 'Video');
Gallery::addImageHandler('fla', 'Video');
Gallery::addImageHandler('mp3', 'Video');
Gallery::addImageHandler('mp4', 'Video');
Gallery::addImageHandler('m4v', 'Video');
Gallery::addImageHandler('m4a', 'Video');
zp_register_filter('content_macro', 'jPlayer::macro');
}
class jplayer_options
{
public $name = 'jPlayer';
function __construct()
{
if (OFFSET_PATH == 2) {
示例6: defaultExtension
<?php
/**
* PHP sendmail mailing handler
*
* @author Stephen Billard (sbillard)
*
* @package plugins
* @subpackage mail
*/
$plugin_is_filter = defaultExtension(5 | CLASS_PLUGIN);
$plugin_description = gettext("Outgoing mail handler based on the PHP <em>mail</em> facility.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = zp_has_filter('sendmail') && !extensionEnabled('zenphoto_sendmail') ? sprintf(gettext('Only one Email handler plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('sendmail'))) : '';
if ($plugin_disable) {
enableExtension('zenphoto_sendmail', 0);
} else {
zp_register_filter('sendmail', 'zenphoto_sendmail');
}
function zenphoto_sendmail($msg, $email_list, $subject, $message, $from_mail, $from_name, $cc_addresses, $replyTo, $html = false)
{
$headers = sprintf('From: %1$s <%2$s>', $from_name, $from_mail) . "\n";
if (count($cc_addresses) > 0) {
$cclist = '';
foreach ($cc_addresses as $cc_name => $cc_mail) {
$cclist .= ',' . $cc_mail;
}
$headers .= 'Cc: ' . substr($cclist, 1) . "\n";
}
if ($replyTo) {
$headers .= 'Reply-To: ' . array_shift($replyTo) . "\n";
示例7: getOldCombiNews
<?php
class Combi extends Zenpage
{
function getOldCombiNews()
{
return $this->getCombiNews(NULL, NULL, 'published');
}
}
global $plugin_is_filter;
enableExtension('galleryArticles', $plugin_is_filter);
$obj = new Combi();
$combi = $obj->getOldCombiNews();
$cat = new ZenpageCategory('combiNews', true);
$cat->setTitle(gettext('combiNews'));
$cat->setDesc(gettext('Auto category for ported combi-news articles.'));
$cat->save();
foreach ($combi as $article) {
switch ($article['type']) {
case 'images':
$obj = newImage(NULL, array('folder' => $article['albumname'], 'filename' => $article['titlelink']), false);
if ($obj->exists) {
$obj->setPublishDate($article['date']);
self::publishArticle($obj, 'combiNews');
}
break;
case 'albums':
$obj = newAlbum($article['albumname'], false);
if ($obj->exists) {
$obj->setPublishDate($article['date']);
self::publishArticle($obj, 'combiNews');
示例8: getOption
$personality = getOption('themeSwitcher_effervescence_personality');
if (isset($_GET['themePersonality'])) {
$new = $_GET['themePersonality'];
if (in_array($new, $personalities)) {
setOption('themeSwitcher_effervescence_personality', $new);
$personality = $new;
}
}
if ($personality) {
setOption('effervescence_personality', $personality, false);
} else {
$personality = strtolower(getOption('effervescence_personality'));
}
}
if (($_ef_menu = getOption('effervescence_menu')) == 'effervescence' || $_ef_menu == 'zenpage') {
enableExtension('print_album_menu', 1 | THEME_PLUGIN, false);
}
require_once SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/' . $personality . '/functions.php';
$_oneImagePage = $handler->onePage();
$_zp_page_check = 'my_checkPageValidity';
}
function EF_head($ignore)
{
global $themeColor;
if (!$themeColor) {
$themeColor = getThemeOption('Theme_colors');
}
if (!file_exists(SERVERPATH . '/' . DATA_FOLDER . '/effervescence_plus/styles/' . $themeColor . '.css') || filemtime(SERVERPATH . '/' . DATA_FOLDER . '/effervescence_plus/styles/' . $themeColor . '.css') < filemtime(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/styles/' . $themeColor . '.txt')) {
eval(file_get_contents(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/styles/' . $themeColor . '.txt'));
$css = file_get_contents(SERVERPATH . '/' . THEMEFOLDER . '/effervescence_plus/base.css');
$css = strtr($css, $tr);
示例9: setupLog
// update the enabled priority
$priority = $plugin_is_filter & PLUGIN_PRIORITY;
if ($plugin_is_filter & CLASS_PLUGIN) {
$priority .= ' | CLASS_PLUGIN';
}
if ($plugin_is_filter & ADMIN_PLUGIN) {
$priority .= ' | ADMIN_PLUGIN';
}
if ($plugin_is_filter & FEATURE_PLUGIN) {
$priority .= ' | FEATURE_PLUGIN';
}
if ($plugin_is_filter & THEME_PLUGIN) {
$priority .= ' | THEME_PLUGIN';
}
setupLog(sprintf(gettext('Plugin:%s enabled (%2$s)'), $extension, $priority), true);
enableExtension($extension, $plugin_is_filter);
}
if ($option_interface) {
// prime the default options
setupLog(sprintf(gettext('Plugin:%1$s option interface instantiated (%2$s)'), $extension, $option_interface), true);
$option_interface = new $option_interface();
}
setupLog(sprintf(gettext('Plugin:%s setup completed'), $extension), true);
$iMutex->unlock();
$fp = fopen(SERVERPATH . '/' . ZENFOLDER . '/images/pass.png', 'rb');
// send the right headers
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header("Content-Type: image/png");
header("Content-Length: " . filesize(SERVERPATH . '/' . ZENFOLDER . '/images/pass.png'));
// dump the picture and stop the script
fpassthru($fp);
示例10: gettext
/**
* Use to tweet new objects as they are published.
*
* @author Stephen Billard (sbillard)
*
* @package plugins
* @subpackage admin
*/
$plugin_is_filter = 9 | FEATURE_PLUGIN;
$plugin_description = gettext('Tweet news articles when published.');
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = function_exists('curl_init') ? false : gettext('The <em>php_curl</em> extension is required');
$plugin_notice = extensionEnabled('TinyURL') ? '' : gettext('Enable the tinyURL plugin to shorten URLs in your tweets.');
$option_interface = 'tweet';
if ($plugin_disable) {
enableExtension('tweet_news', 0);
} else {
zp_register_filter('show_change', 'tweet::published');
if (getOption('tweet_news_albums')) {
zp_register_filter('new_album', 'tweet::published');
}
if (getOption('tweet_news_images')) {
zp_register_filter('new_image', 'tweet::published');
}
if (getOption('tweet_news_news')) {
zp_register_filter('new_article', 'tweet::newZenpageObject');
}
if (getOption('tweet_news_pages')) {
zp_register_filter('new_page', 'tweet::newZenpageObject');
}
zp_register_filter('admin_overview', 'tweet::errorsOnOverview');
示例11: printAlbumZip
/**
* @deprecated
* @since 1.4.3
*/
function printAlbumZip()
{
deprecated_functions::notify(gettext('Use downloadList plugin <code>printDownloadAlbumZipURL()</code>.'));
global $_zp_current_album;
enableExtension('downloadList', 20 | ADMIN_PLUGIN | THEME_PLUGIN, false);
require_once SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/downloadList.php';
printDownloadAlbumZipURL(gettext('Download a zip file of this album'), $_zp_current_album);
}
示例12: gettext
* message can be disabled to allow your scripts to continue to run. Visit the <i>deprecated-functions</i>
* plugin options. Find the function and uncheck the box by the function.
*
* A utility button is provided that allows you to search themes and plugins for uses of functions which have been deprecated.
* Use it to be proactive in replacing or changing these items.
*
* @author Stephen Billard (sbillard)
* @package plugins
* @subpackage development
*/
$plugin_description = gettext("Provides deprecated Zenphoto functions.");
$plugin_notice = gettext("This plugin is <strong>NOT</strong> required for the Zenphoto distributed functions.");
$option_interface = 'deprecated_functions';
$plugin_is_filter = 900 | CLASS_PLUGIN;
if (OFFSET_PATH == 2) {
enableExtension('deprecated-functions', $plugin_is_filter);
}
// Yes, I know some people will be annoyed that this keeps coming back,
// but each release may deprecated new functions which would then just give
// (perhaps unseen) errors. Better the user should disable this once he knows
// his site is working.
zp_register_filter('admin_utilities_buttons', 'deprecated_functions::button');
zp_register_filter('admin_tabs', 'deprecated_functions::tabs');
class deprecated_functions
{
var $listed_functions = array();
var $unique_functions = array();
function __construct()
{
global $_internalFunctions;
foreach (getPluginFiles('*.php') as $extension => $plugin) {
示例13: gettext
* Since uploads via the <var>files</var> tab are like FTP uploads and are not assigned to the user, you should not assign <var>files</var> rights
* to users with upload limits.
*
* @author Stephen Billard (sbillard)
*
* @package plugins
* @subpackage users
*/
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext("Provides a quota management system to limit the sum of sizes of images a user uploads.");
$plugin_notice = gettext("<strong>Note:</strong> if FTP is used to upload images, manual user assignment is necessary. ZIP file upload is disabled by default as quotas are not applied to the files contained therein.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = zp_has_filter('get_upload_header_text') && !extensionEnabled('quota_manager') ? sprintf(gettext('<a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('get_upload_header_text'))) : '';
$option_interface = 'quota_manager';
if ($plugin_disable) {
enableExtension('quota_manager', 0);
} else {
zp_register_filter('save_admin_custom_data', 'quota_manager::save_admin');
zp_register_filter('edit_admin_custom_data', 'quota_manager::edit_admin');
zp_register_filter('new_image', 'quota_manager::new_image');
zp_register_filter('image_refresh', 'quota_manager::image_refresh');
zp_register_filter('check_upload_quota', 'quota_manager::checkQuota');
zp_register_filter('get_upload_limit', 'quota_manager::getUploadLimit');
zp_register_filter('get_upload_header_text', 'quota_manager::get_header');
zp_register_filter('upload_filetypes', 'quota_manager::upload_filetypes');
zp_register_filter('upload_helper_js', 'quota_manager::upload_helper_js');
}
/**
* Option handler class
*
*/
示例14: gettext
<?php
/**
* Translates characters with diacritical marks to simple equivalents
* @package plugins
* @subpackage seo
*/
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext("SEO filter to translate extended characters into their basic alpha-numeric equivalents.");
$plugin_author = "Stephen Billard (sbillard)";
$plugin_disable = zp_has_filter('seoFriendly') && !extensionEnabled('seo_zenphoto') ? sprintf(gettext('Only one SEO filter plugin may be enabled. <a href="#%1$s"><code>%1$s</code></a> is already enabled.'), stripSuffix(get_filterScript('seoFriendly'))) : '';
$option_interface = 'zenphoto_seo';
if ($plugin_disable) {
enableExtension('zenphoto_seo', 0);
} else {
zp_register_filter('seoFriendly', 'zenphoto_seo::filter');
zp_register_filter('seoFriendly_js', 'zenphoto_seo::js');
}
/**
* Option handler class
*
*/
class zenphoto_seo
{
/**
* class instantiation function
*
* @return zenphoto_seo
*/
function __construct()
{
示例15: gettext
*
* This plugin provides an image upload handler for the <i>upload/images</i> admin tab
* based on the {@link https://github.com/blueimp/jQuery-File-Upload <i>jQuery File Upload Plugin</i>}
* by Sebastian Tschan.
*
* PHP 5.3 or greater is required by the encorporated software.
*
* @package plugins
* @subpackage uploader
*/
$plugin_is_filter = 5 | ADMIN_PLUGIN;
$plugin_description = gettext('<em>jQuery</em> image upload handler.');
$plugin_author = 'Stephen Billard (sbillard)';
$plugin_disable = version_compare(PHP_VERSION, '5.3') >= 0 ? false : gettext('jQuery uploader requires PHP 5.3 or greater.');
if ($plugin_disable) {
enableExtension('uploader_jQuery', 0);
} else {
if (OFFSET_PATH == 2) {
setoptiondefault('zp_plugin_uploader_jQuery', $plugin_is_filter);
}
if (zp_loggedin(UPLOAD_RIGHTS)) {
zp_register_filter('upload_handlers', 'jQueryUploadHandler');
zp_register_filter('admin_tabs', 'jQueryUploadHandler_admin_tabs', 5);
}
}
function jQueryUploadHandler($uploadHandlers)
{
$uploadHandlers['jQuery'] = SERVERPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/uploader_jQuery';
return $uploadHandlers;
}
function jQueryUploadHandler_admin_tabs($tabs)