本文整理汇总了PHP中module_enabled函数的典型用法代码示例。如果您正苦于以下问题:PHP module_enabled函数的具体用法?PHP module_enabled怎么用?PHP module_enabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了module_enabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForgetPasswordForm
static function renderForgetPasswordForm()
{
$rtn = Message::renderMessages() . '
<form role="form" action="" method="post" id="forget_password">
<fieldset>
<div class="form-group">
<label for="email">' . i18n(array('en' => 'Your E-mail address', 'zh' => '您的电子箱地址')) . '</label>
<input class="form-control" name="email" type="email" id="email" autofocus required="">
</div>
<input type="submit" name="submit" class="btn btn-primary btn-block ' . (module_enabled('form') ? 'disabled' : '') . '" value="' . i18n(array('en' => 'Confirm', 'zh' => '确认')) . '" />
' . (module_enabled('form') ? Form::loadSpamToken('#forget_password', SITEUSER_FORM_SPAM_TOKEN) : '') . '
<div style="text-align:center;"><br /><small><a href="' . uri('users') . '">返回登录界面</a></small></div>
</fieldset>
</form>
';
return $rtn;
}
示例2: read_more
static function read_more($text, $string = null)
{
if (!substr_count($text, "e51b2b9a58824dd068d8777ec6e97e4d")) {
return $text;
}
if (Route::current()->action == "view") {
return preg_replace('/(<p>)?<a class="read_more" href="([^"]+)">e51b2b9a58824dd068d8777ec6e97e4d<\\/a>\\(\\(\\(more(\\((.+)\\))?\\)\\)\\)(<\\/p>(\\n\\n<\\/p>(\\n\\n)?)?)?/', "", $text);
}
if (module_enabled('smartypants')) {
preg_match_all("/e51b2b9a58824dd068d8777ec6e97e4d(\\(\\(\\(more(\\((.+)\\))?\\)\\)\\))/", preg_replace("/<[^>]+>/", "", html_entity_decode(Smartypants::stupify($text), ENT_QUOTES, 'UTF-8')), $more, PREG_OFFSET_CAPTURE);
$body = truncate(html_entity_decode(Smartypants::stupify($text), ENT_QUOTES, 'UTF-8'), $more[1][0][1], "", true, true);
} else {
preg_match_all("/e51b2b9a58824dd068d8777ec6e97e4d(\\(\\(\\(more(\\((.+)\\))?\\)\\)\\))/", preg_replace("/<[^>]+>/", "", html_entity_decode(str_replace(" ", " ", $text), ENT_QUOTES, 'UTF-8')), $more, PREG_OFFSET_CAPTURE);
$body = truncate($text, $more[1][0][1], "", true, true);
}
$body .= @$more[3][0];
if (!empty($more[2][0])) {
$string = $more[2][0];
} elseif (!isset($string) or $string instanceof Post) {
# If it's called from anywhere but Twig the post will be passed as a second argument.
$string = __("Read More »", "theme");
}
return str_replace("e51b2b9a58824dd068d8777ec6e97e4d", $string, $body);
}
示例3: mktable
function mktable($title, $content) {
echo "<h3>$title</h3>\n";
echo $content;
}
if (ldap_get_right("lcs_is_admin",$login)!="Y")
die (gettext("Vous n'avez pas les droits suffisants pour accèder à cette fonction.")."</BODY></HTML>");
function module_enabled($name) {
return function_exists('apache_get_modules') && in_array($name, apache_get_modules());
}
if (module_enabled('mod_security2')) {
echo "<h2>Le module de sécurité est actif.</h2>";
if ( file_exists("/tmp/disablemodesecurity.lock") ) {
#echo "Désactivation du mode sécurité en cours !..<br />";
echo "<div align='center'>\n
<img src=\"Images/wait.gif\" title=\"Patientez...\" align=\"middle\" border=\"0\" ALT=\"Patientez\">\n Désactivation du mode sécurité en cours ! Veuillez patienter...
</div>\n";
} else {
if (!isset($disable))
{
echo "<form name ='security' action='mod_security.php' method='post'>\n";
echo " </select></br><input name=disable type='submit' value='Désactiver le mode sécurité' />\n";
echo '<input name="jeton" type="hidden" value="'.md5($_SESSION['token'].htmlentities($_SERVER['PHP_SELF'])).'" />';
echo "<input type=\"hidden\" name=\"reload\" value=\"true\">\n";
echo "</form>\n";
}
示例4: lang
}
if ($hasDocuments) {
tpl_assign("widgetClass", 'dashDocuments');
tpl_assign("widgetTitle", lang('documents'));
tpl_assign("widgetTemplate", 'documents');
$this->includeTemplate(get_template_path('widget', 'dashboard'));
}
?>
</td>
<?php if ($hasMessages || $hasCharts || $hasEmails || $hasComments || $showWorkspaceInfo){ ?>
<td style="<?php echo ($hasPendingTasks || $hasLate || $hasToday || $hasDocuments)? 'width:38%;min-width:330px' : 'width:100%' ?>">
<?php
if ($hasEmails && (module_enabled('mails', defined('SHOW_MAILS_TAB') ? SHOW_MAILS_TAB : 0))) {
tpl_assign("widgetClass", 'dashUnreadEmails');
tpl_assign("widgetTitle", $unread_emails?lang('unread emails'):lang('workspace emails'));
tpl_assign("widgetTemplate", 'emails');
$this->includeTemplate(get_template_path('widget', 'dashboard'));
}
if ($hasMessages) {
tpl_assign("widgetClass", 'dashMessages');
tpl_assign("widgetTitle", lang('messages'));
tpl_assign("widgetTemplate", 'messages');
$this->includeTemplate(get_template_path('widget', 'dashboard'));
}
if ($hasComments) {
tpl_assign("widgetClass", 'dashComments');
示例5: i18n_echo
</div>
<div class="checkbox">
<label>
<input name="remember" type="checkbox" value="Remeber me" <?php
if (isset($_POST['remember'])) {
?>
checked="checked"<?php
}
?>
><?php
i18n_echo(array('en' => 'Remember Me', 'zh' => '下次自动登录'));
?>
</label>
</div>
<!-- Change this to a button or input when using this as a form -->
<input type="submit" name="submit" class="btn btn-success btn-block disabled" value="<?php
i18n_echo(array('en' => 'Login', 'zh' => '登录'));
?>
" />
<?php
if (module_enabled('form')) {
?>
<?php
Form::loadSpamToken('#login', UID_BACKEND_LOGIN_FORM);
?>
<?php
}
?>
</fieldset>
</form>
示例6: disable
/**
* Function: disable
* Disables a module or feather.
*/
public function disable()
{
$config = Config::current();
$visitor = Visitor::current();
$type = isset($_GET['module']) ? "module" : "feather";
if (!$visitor->group->can("toggle_extensions")) {
if ($type == "module") {
show_403(__("Access Denied"), __("You do not have sufficient privileges to enable/disable modules."));
} else {
show_403(__("Access Denied"), __("You do not have sufficient privileges to enable/disable feathers."));
}
}
if ($type == "module" and !module_enabled($_GET[$type])) {
Flash::warning(__("Module already disabled."), "/admin/?action=modules");
}
if ($type == "feather" and !feather_enabled($_GET[$type])) {
Flash::warning(__("Feather already disabled."), "/admin/?action=feathers");
}
$enabled_array = $type == "module" ? "enabled_modules" : "enabled_feathers";
$folder = $type == "module" ? MODULES_DIR : FEATHERS_DIR;
$class_name = camelize($_GET[$type]);
if (method_exists($class_name, "__uninstall")) {
call_user_func(array($class_name, "__uninstall"), false);
}
$config->set($type == "module" ? "enabled_modules" : "enabled_feathers", array_diff($config->{$enabled_array}, array($_GET[$type])));
$info = YAML::load($folder . "/" . $_GET[$type] . "/info.yaml");
if ($type == "module") {
Flash::notice(_f("“%s” module disabled.", array($info["name"])), "/admin/?action=" . pluralize($type));
} elseif ($type == "feather") {
Flash::notice(_f("“%s” feather disabled.", array($info["name"])), "/admin/?action=" . pluralize($type));
}
}
示例7: Message
}
if ($active !== false) {
$user->setActive($active == "1" ? 1 : 0);
$user->setEmailActivated(1);
}
// for new user
if (empty($uid)) {
$user->setCreatedAt(time());
// if $noemailnotification flag is not set
if (!$noemailnotification) {
$user->setEmailActivated(0);
}
}
if ($user->save()) {
// update profile
if (module_enabled('siteuser_profile')) {
require MODULESROOT . '/siteuser_profile/controllers/fields_update.php';
}
if (empty($uid)) {
if (!$noemailnotification) {
$user->sendAccountActivationEmail();
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Thank you for registering with us. An activation email has been sent to your mail box. Please activate your account by clicking the link in the mail.', 'zh' => '感谢您注册新帐号。我们刚给您的注册邮箱发送了一份帐号激活邮件,请点击邮件内的激活链接')) . '<br /><br />' . i18n(array('en' => 'After you activate your account, you can ', 'zh' => '激活您的账号后,您可以')) . '<a href="' . uri('users') . '">' . i18n(array('en' => 'login here', 'zh' => '在此登录')) . '</a>'));
} else {
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'New user created successfully', 'zh' => '新用户添加成功'))));
// clear $_POST so that our form is not pre-populated
unset($_POST);
}
} else {
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'User updated successfully', 'zh' => '用户更新成功'))));
}
// update user-role
示例8: delete
/**
* Function: delete
* Deletes the given milestone. Calls the "delete_milestone" trigger and passes the <Milestone> as an argument.
*
* Parameters:
* $id - The milestone to delete.
*/
static function delete($id)
{
parent::destroy(get_class(), $id);
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}
示例9: exit
<?php
if (version_compare(PHP_VERSION, "5.1.3", "<")) {
exit("Chyrp requires PHP 5.1.3 or greater.");
}
require_once "../includes/common.php";
# Prepare the controller.
$extend = ExtendController::current();
# Parse the route.
$route = Route::current($extend);
if (module_enabled("cacher") and !empty(Modules::$instances["cacher"]->cacher->path)) {
$cacher =& Modules::$instances["cacher"]->cacher;
$cacher->caches = INCLUDES_DIR . "/caches/extend";
$cacher->path = str_replace(INCLUDES_DIR . "/caches", INCLUDES_DIR . "/caches/extend", $cacher->path);
$cacher->file = $cacher->path . "/" . md5($cacher->url) . ".html";
$cacher->remove_expired();
}
# Execute the appropriate Controller responder.
$route->init();
# If the route failed or nothing was displayed, check for:
# 1. Module-provided pages.
# 2. Feather-provided pages.
# 3. Theme-provided pages.
if (!$route->success) {
$displayed = false;
if (!$displayed and $theme->file_exists("pages/" . $route->action)) {
$extend->display("pages/extend/" . $route->action);
} elseif (!$displayed) {
show_404();
}
}
示例10: Message
if (empty($msg)) {
$messages[] = new Message(Message::DANGER, i18n(array('en' => 'Please enter your message', 'zh' => '请填写您的留言')));
}
if (!empty($messages)) {
Message::register($messages);
HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
}
// check spam
if (module_enabled('form') && !Form::checkSpamToken('global contact form')) {
$message = new Message(Message::DANGER, i18n(array('en' => 'Form login session expired. Please try again', 'zh' => '表单提交时限过期,请重新尝试登录')));
Message::register($message);
HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
}
/** success action **/
Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Thank you for your contact ;) We will get back to you soon.', 'zh' => '感谢您的留言 ;) 我们会及时和您沟通'))));
if (module_enabled('mail')) {
$message = array();
foreach ($_POST['contact'] as $key => $val) {
$message[] = "<p><strong>{$key}</strong>:<br />" . str_replace("\n", "<br />", $val) . "</p><br />";
}
$message = implode("\n", $message);
sendemailAdmin('Site contact form', $message);
}
HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form');
}
$html = new HTML();
$html->renderOut('site/components/html_header', array('title' => 'Contact', 'body_class' => 'page page-template page-template-templates page-template-full-width page-template-templatesfull-width-php has-toolbar'));
$html->output('<div id="page-container">');
//$html->renderOut('site/components/toptoolbar');
$html->renderOut('site/components/header');
$html->renderOut('site/contact', array('pagetitle' => $page->getTitle(), 'content' => $page->getContent(), 'googlemap' => $html->render('site/components/googlemap', array('latitude' => '-33.877348', 'longitude' => '151.2079613')), 'full_page_sidebar_right' => $html->render('site/components/full_page_sidebar_right', array('blocks' => array(Block::findByName('Get in Touch'), Block::findByName('Apply Now'))))));
示例11: getDashboardObjectQueries
//.........这里部分代码省略.........
// Show all objects in trash
$comments_arch_cond = "1 = 1";
} else {
$trashed_cond = '`trashed_on` = ' . DB::escape(EMPTY_DATETIME);
if ($archived) {
$archived_cond = "`archived_by_id` > 0";
$comments_arch_cond = "1 = 0";
// Don't show comments in archived objects listings
} else {
$archived_cond = "`archived_by_id` = 0";
$comments_arch_cond = "1 = 1";
}
}
if (isset($tag) && $tag && $tag != '') {
$tag_str = " AND EXISTS (SELECT * FROM `" . TABLE_PREFIX . "tags` `t` WHERE `tag`= " . DB::escape($tag) . " AND `co`.`id` = `t`.`rel_object_id` AND `t`.`rel_object_manager` = `object_manager_value`) ";
} else {
$tag_str = ' ';
}
if ($linkedObject instanceof ProjectDataObject) {
$link_id = $linkedObject->getId();
$link_mgr = get_class($linkedObject->manager());
$link_str = " AND EXISTS (SELECT * FROM `" . TABLE_PREFIX . "linked_objects` `t` WHERE\n\t\t\t(`t`.`object_id`=" . DB::escape($link_id) . " AND `t`.object_manager = " . DB::escape($link_mgr) . " AND `co`.`id` = `t`.`rel_object_id` AND `t`.`rel_object_manager` = `object_manager_value`) OR\n\t\t\t(`t`.`rel_object_id`=" . DB::escape($link_id) . " AND `t`.rel_object_manager = " . DB::escape($link_mgr) . " AND `co`.`id` = `t`.`object_id` AND `t`.`object_manager` = `object_manager_value`)) ";
} else {
$link_str = ' ';
}
$tag_str .= $link_str;
$res = array();
/** If the name of the query ends with Comments it is assumed to be a list of Comments **/
$cfn = '';
if ($filterName != '') {
$cfn = " AND text LIKE '%" . $filterName . "%'";
}
// Notes
if (module_enabled('notes')) {
$fn = '';
if ($filterName != '') {
$fn = " AND title LIKE '%" . $filterName . "%'";
}
$permissions = ' AND ( ' . permissions_sql_for_listings(ProjectMessages::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
if ($filterManager == '' || $filterManager == "ProjectMessages") {
$res['ProjectMessages'] = "SELECT 'ProjectMessages' AS `object_manager_value`, `id` AS `oid`, {$order_crit_messages} AS `order_value` FROM `" . TABLE_PREFIX . "project_messages` `co` WHERE " . $trashed_cond . " AND {$archived_cond} AND " . $proj_cond_messages . str_replace('= `object_manager_value`', "= 'ProjectMessages'", $tag_str) . $permissions . $fn;
}
if ($filterManager == '' || $filterManager == "Comments") {
$res['ProjectMessagesComments'] = "SELECT 'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'ProjectMessages' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "project_messages` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND " . $proj_cond_messages . str_replace('= `object_manager_value`', "= 'ProjectMessages'", $tag_str) . $permissions . $cfn . ")";
}
}
// Events
if (module_enabled("calendar")) {
$fn = '';
if ($filterName != '') {
$fn = " AND subject LIKE '%" . $filterName . "%'";
}
$permissions = ' AND ( ' . permissions_sql_for_listings(ProjectEvents::instance(), ACCESS_LEVEL_READ, logged_user(), '`project_id`', '`co`') . ')';
if ($filterManager == '' || $filterManager == "ProjectEvents") {
$res['ProjectEvents'] = "SELECT 'ProjectEvents' AS `object_manager_value`, `id` AS `oid`, {$order_crit_calendar} AS `order_value` FROM `" . TABLE_PREFIX . "project_events` `co` WHERE " . $trashed_cond . " AND {$archived_cond} AND " . $proj_cond_events . str_replace('= `object_manager_value`', "= 'ProjectEvents'", $tag_str) . $permissions . $fn;
}
if ($filterManager == '' || $filterManager == "Comments") {
$res['ProjectEventsComments'] = "SELECT 'Comments' AS `object_manager_value`, `id` AS `oid`, {$order_crit_comments} AS `order_value` FROM `" . TABLE_PREFIX . "comments` WHERE {$trashed_cond} AND `rel_object_manager` = 'ProjectEvents' AND `rel_object_id` IN (SELECT `co`.`id` FROM `" . TABLE_PREFIX . "project_events` `co` WHERE `trashed_by_id` = 0 AND {$comments_arch_cond} AND " . $proj_cond_events . str_replace('= `object_manager_value`', "= 'ProjectEvents'", $tag_str) . $permissions . $cfn . ")";
}
}
// Documents
if (module_enabled("documents")) {
$fn = '';
if ($filterName != '') {
$fn = " AND filename LIKE '%" . $filterName . "%'";
}
示例12: delete
/**
* Function: delete
* Deletes the given version, including its notes. Calls the "delete_version" trigger and passes the <Version> as an argument.
*
* Parameters:
* $id - The version to delete.
*/
static function delete($id)
{
$version = new self($id);
foreach ($version->notes as $note) {
Note::delete($note->id);
}
foreach ($version->attachments as $attachment) {
Attachment::delete($attachment->id);
}
@unlink(uploaded($version->filename, false));
@unlink(uploaded($version->preview, false));
parent::destroy(get_class(), $id);
if (module_enabled("cacher")) {
Modules::$instances["cacher"]->regenerate();
}
}
示例13: die
<?php
// dependency check
if (!module_enabled('crawler')) {
die('Please enable crawler module');
}
$user = User::getInstance();
if (!is_cli() && $user->isLogin() && is_backend()) {
// register admin
Backend::registerSideNav('
<li>
<a href="' . uri('admin/queue/list') . '"><i class="fa fa-tasks"></i> ' . i18n(array('en' => 'Queue', 'zh' => '队列')) . '</a>
</li>
');
}
示例14: isset
<?php
$user = User::getInstance();
// we only do stuff when the user is not login
if (!$user->isLogin()) {
$isSubmit = isset($_POST['submit']) ? true : false;
// is submission or not;
// deal with form submission
if ($isSubmit) {
// check spam
if (module_enabled('form') && !Form::checkSpamToken(UID_BACKEND_LOGIN_FORM)) {
$message = new Message(Message::DANGER, 'Form submission error.');
Message::register($message);
HTML::forwardBackToReferer();
}
// authentication
$authentication_success = false;
$email = isset($_POST['email']) ? strip_tags($_POST['email']) : null;
$password = isset($_POST['password']) ? strip_tags($_POST['password']) : null;
$settings = Vars::getSettings();
foreach ($settings['users'] as $u) {
if ($u['email'] == $email && $u['password'] == $password) {
$authentication_success = true;
}
}
// if success
if ($authentication_success) {
$user = User::findByEmail($email);
$user->login();
HTML::forwardBackToReferer();
// if fail
示例15: array_push
$new = $config->{$enabled_array};
array_push($new, $_POST["extension"]);
$config->set($enabled_array, $new);
exit('{ notifications: [' . (!empty($info["notifications"]) ? '"' . implode('", "', $info["notifications"]) . '"' : "") . '] }');
break;
case "disable_module":
case "disable_feather":
$type = $_POST['action'] == "disable_module" ? "module" : "feather";
if (!$visitor->group->can("change_settings")) {
if ($type == "module") {
exit("{ notifications: ['" . __("You do not have sufficient privileges to enable/disable modules.") . "'] }");
} else {
exit("{ notifications: ['" . __("You do not have sufficient privileges to enable/disable feathers.") . "'] }");
}
}
if ($type == "module" and !module_enabled($_POST['extension']) or $type == "feather" and !feather_enabled($_POST['extension'])) {
exit("{ notifications: [] }");
}
$class_name = camelize($_POST["extension"]);
if (method_exists($class_name, "__uninstall")) {
call_user_func(array($class_name, "__uninstall"), $_POST['confirm'] == "1");
}
$enabled_array = $type == "module" ? "enabled_modules" : "enabled_feathers";
$config->set($enabled_array, array_diff($config->{$enabled_array}, array($_POST['extension'])));
exit('{ notifications: [] }');
break;
case "reorder_feathers":
$reorder = oneof(@$_POST['list'], $config->enabled_feathers);
foreach ($reorder as &$value) {
$value = preg_replace("/feathers\\[([^\\]]+)\\]/", "\\1", $value);
}