本文整理匯總了PHP中plugin_active函數的典型用法代碼示例。如果您正苦於以下問題:PHP plugin_active函數的具體用法?PHP plugin_active怎麽用?PHP plugin_active使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了plugin_active函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: lang
/**
* Shortcut function for retrieving single lang value
*
* @access public
* @param string $name
* @return string
*/
function lang($name)
{
// Get function arguments and remove first one.
$args = func_get_args();
if (is_array($args)) {
array_shift($args);
}
// if
// Get value and if we have NULL done!
if (plugin_active('i18n')) {
$value = lang_from_db($name);
} else {
$value = Localization::instance()->lang($name);
}
if (is_null($value)) {
return $value;
}
// if
// We have args? Replace all %s with arguments
if (is_array($args) && count($args)) {
foreach ($args as $arg) {
$value = str_replace_first('%s', $arg, $value);
}
// foreach
}
// if
// Done here...
return $value;
}
示例2: checkEventManager
function checkEventManager()
{
$events_manager_actived = plugin_active('events-manager/events-manager.php');
(bool) $events_manager_actived;
if ($events_manager_actived) {
$notice = null;
} else {
$notice = __("Event Manager Importer : Event Manager is not enabled. Please enable it before our plugin.", "emi");
}
parent::set_notice($notice);
}
示例3: emiStart
function emiStart()
{
if (is_admin() && plugin_active('events-manager/events-manager.php')) {
add_action('wp_ajax_get_file_info', 'get_file_info');
add_action('wp_ajax_nopriv_get_file_info', 'get_file_info');
upload_create();
$EmiController = new EmiController();
} else {
if (!plugin_active('events-manager/events-manager.php')) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
deactivate_plugins('wp-events-manager-importer/emi.php');
}
}
}
示例4: renderControl
/**
* Renders attachment control based on Object type
*
* @param void
* @return string
*/
function renderControl($control_name)
{
switch ($this->getRelObjectManager()) {
case 'Companies':
return select_company($control_name, $this->getRelObjectId(), array('class' => 'combobox'));
break;
case 'Contacts':
return select_contact($control_name, $this->getRelObjectId(), null, array('class' => 'combobox'));
break;
case 'ProjectFiles':
if (plugin_active('files')) {
return select_project_file($control_name, active_project(), $this->getRelObjectId(), null, array('class' => 'combobox'));
}
return '';
break;
case 'ProjectMessages':
return select_message($control_name, active_project(), $this->getRelObjectId(), array('class' => 'combobox'));
break;
case 'ProjectMilestones':
return select_milestone($control_name, active_project(), $this->getRelObjectId(), array('class' => 'combobox'));
break;
case 'ProjectTasks':
break;
case 'ProjectTaskLists':
return select_task_list($control_name, active_project(), $this->getRelObjectId(), array('class' => 'combobox'));
break;
case 'ProjectTickets':
if (plugin_active('tickets')) {
return select_ticket($control_name, active_project(), $this->getRelObjectId(), array('class' => 'combobox'));
}
return '';
break;
default:
return '';
break;
}
// switch
}
示例5: label_tag
?>
<div>
<?php
echo label_tag(lang('projects copy links'), 'projectFormCopyLinks');
?>
<?php
echo checkbox_field('project[copy_links]', true, array_var($project_data, 'copy_links'), array('id' => 'projectFormCopyLinks'));
?>
</div>
<?php
}
// if
?>
<?php
if (plugin_active('wiki')) {
?>
<div>
<?php
echo label_tag(lang('projects copy pages'), 'projectFormCopyPages');
?>
<?php
echo checkbox_field('project[copy_pages]', true, array_var($project_data, 'copy_pages'), array('id' => 'projectFormCopyPages'));
?>
</div>
<?php
}
// if
?>
<?php
示例6: clearFolders
/**
* Clear all folders
*
* @param void
* @return null
*/
private function clearFolders() {
if(!plugin_active('files')) { return null; }
$folders = $this->getFolders();
if (is_array($folders)) {
foreach ($folders as $folder) {
$folder->delete();
} // foreach
} // if
} // clearFolders
示例7: edit_locale
/**
* Edit locale
*
* @param void
* @return null
*/
function edit_locale()
{
$locale = I18nLocales::findById(get_id());
if (!$locale instanceof I18nLocale) {
flash_error(lang('locale dnx'));
$this->redirectTo('i18n', 'index');
}
// if
if (!$locale->canEdit(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectTo('i18n', 'index');
}
// if
$this->setTemplate('edit_locale');
$locale_data = array_var($_POST, 'locale');
if (!is_array($locale_data)) {
$tag_names = '';
//$tag_names = plugin_active('tags') ? $locale->getTagNames() : '';
$locale_data = array('name' => $locale->getName(), 'description' => $locale->getDescription(), 'language_code' => $locale->getLanguageCode(), 'country_code' => $locale->getCountryCode(), 'editor_id' => $locale->getEditorId(), 'translation_url' => $locale->getTranslationUrl(), 'tags' => is_array($tag_names) ? implode(', ', $tag_names) : '');
// array
}
// if
//tpl_assign('locale_data', $locale_data);
//tpl_assign('locale', $locale);
if (is_array(array_var($_POST, 'locale'))) {
$locale->setFromAttributes($locale_data);
try {
DB::beginWork();
$locale->save();
ApplicationLogs::createLog($locale, 0, ApplicationLogs::ACTION_EDIT);
if (plugin_active('tags')) {
// tags currently at project level and locale NOT project level
//$locale->setTagsFromCSV($locale_data['tags']);
}
DB::commit();
flash_success(lang('success edit locale'));
$this->redirectTo('i18n', 'index');
} catch (Exception $e) {
DB::rollback();
tpl_assign('error', $e);
}
// try
}
tpl_assign('locale', $locale);
tpl_assign('locale_data', $locale_data);
}
示例8: get_url
<a href="<?php
echo get_url('page_attachment', 'add_attachment', array('page_name' => 'project_overview', 'rel_object_manager' => 'ProjectMessages', 'order' => $counter, 'redirect_to' => get_url('project', 'edit', null, null, true)), null, true);
?>
"><?php
echo lang('add message');
?>
</a> |
<a href="<?php
echo get_url('page_attachment', 'add_attachment', array('page_name' => 'project_overview', 'rel_object_manager' => 'ProjectMilestones', 'order' => $counter, 'redirect_to' => get_url('project', 'edit', null, null, true)), null, true);
?>
"><?php
echo lang('add milestone');
?>
</a> |
<?php
if (plugin_active('tickets')) {
?>
<a href="<?php
echo get_url('page_attachment', 'add_attachment', array('page_name' => 'project_overview', 'rel_object_manager' => 'ProjectTickets', 'order' => $counter, 'redirect_to' => get_url('project', 'edit', null, null, true)), null, true);
?>
"><?php
echo lang('add ticket');
?>
</a>
<?php
}
?>
</div>
<?php
}
// foreach
示例9: render_object_tags
/**
* Render the tags of a specific object
*
* @param ProjectDataObject $object
* @return string
*/
function render_object_tags(ProjectDataObject $object)
{
if (plugin_active('tags')) {
tpl_assign('object', $object);
//tpl_assign('tags', $object->getTags());
return tpl_fetch(get_template_path('object_tags', 'tags'));
}
return '';
}
示例10: trace
<?php
trace(__FILE__, 'start');
set_page_title(lang('view task'));
project_tabbed_navigation('tasks');
project_crumbs(array(array(lang('tasks'), get_url('task')), array($task_list->getName(), $task_list->getViewUrl()), array(lang('view task'))));
$options = array();
if ($task->canEdit(logged_user())) {
$options[] = '<a href="' . $task->getEditUrl() . '">' . lang('edit') . '</a>';
}
if ($task->canDelete(logged_user())) {
$options[] = '<a href="' . $task->getDeleteUrl() . '">' . lang('delete') . '</a>';
}
if (plugin_active('time')) {
if (ProjectTime::canAdd(logged_user(), active_project())) {
$options[] = '<a href="' . get_url('time', 'add', array('task' => $task->getId())) . '">' . lang('add time') . '</a>';
}
}
if ($task->canChangeStatus(logged_user())) {
if ($task->isOpen()) {
$options[] = '<a href="' . $task->getCompleteUrl() . '">' . lang('mark task as completed') . '</a>';
} else {
$options[] = '<a href="' . $task->getOpenUrl() . '">' . lang('open task') . '</a>';
}
// if
}
// if
?>
<div id="taskDetails" class="block">
<div class="header"><?php
示例11: edit_file
/**
* Edit file
*
* @access public
* @param void
* @return null
*/
function edit_file()
{
$this->setTemplate('add_file');
$file = ProjectFiles::findById(get_id());
if (!$file instanceof ProjectFile) {
flash_error(lang('file dnx'));
$this->redirectToReferer(get_url('files'));
}
// if
if (!$file->canEdit(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectToReferer(get_url('files'));
}
// if
$file_data = array_var($_POST, 'file');
if (!is_array($file_data)) {
$tag_names = plugin_active('tags') ? $file->getTagNames() : '';
$file_data = array('folder_id' => $file->getFolderId(), 'description' => $file->getDescription(), 'is_private' => $file->getIsPrivate(), 'is_important' => $file->getIsImportant(), 'comments_enabled' => $file->getCommentsEnabled(), 'anonymous_comments_enabled' => $file->getAnonymousCommentsEnabled(), 'tags' => is_array($tag_names) && count($tag_names) ? implode(', ', $tag_names) : '');
// array
}
// if
tpl_assign('file', $file);
tpl_assign('file_data', $file_data);
if (is_array(array_var($_POST, 'file'))) {
try {
$old_is_private = $file->isPrivate();
$old_is_important = $file->getIsImportant();
$old_comments_enabled = $file->getCommentsEnabled();
$old_anonymous_comments_enabled = $file->getAnonymousCommentsEnabled();
DB::beginWork();
$handle_file = array_var($file_data, 'update_file') == 'checked';
// change file?
$post_revision = $handle_file && array_var($file_data, 'version_file_change') == 'checked';
// post revision?
$revision_comment = $post_revision ? trim(array_var($file_data, 'revision_comment')) : '';
// user comment?
$file->setFromAttributes($file_data);
if (!logged_user()->isMemberOfOwnerCompany()) {
$file->setIsPrivate($old_is_private);
$file->setIsImportant($old_is_important);
$file->setCommentsEnabled($old_comments_enabled);
$file->setAnonymousCommentsEnabled($old_anonymous_comments_enabled);
}
// if
$file->save();
if (plugin_active('tags')) {
$file->setTagsFromCSV(array_var($file_data, 'tags'));
}
$msg_name = basename($file->getFilename());
if ($handle_file) {
$file->handleUploadedFile(array_var($_FILES, 'file_file'), $post_revision, $revision_comment);
$msg_name .= '(' . ')';
}
// if
ApplicationLogs::createLog($file, active_project(), ApplicationLogs::ACTION_EDIT);
DB::commit();
flash_success(lang('success edit file', $msg_name));
$this->redirectToUrl($file->getDetailsUrl());
} catch (Exception $e) {
//@unlink($file->getFilePath());
DB::rollback();
tpl_assign('error', $e);
}
// try
}
// if
}
示例12: lang
<div class="private" title="<?php echo lang('private task list') ?>">
<span><?php echo lang('private task list') ?></span>
</div>
<?php endif ?>
</div>
<?php if (!is_null($task_list->getDueDate())) : ?>
<div class="dueDate"><span><?php echo lang('due date') ?>:</span> <?php echo ($task_list->getDueDate()->getYear() > DateTimeValueLib::now()->getYear()) ? format_date($task_list->getDueDate(), null, 0) : format_descriptive_date($task_list->getDueDate(), 0) ?></div>
<?php endif ?>
<?php if ($task_list->getDescription()): ?>
<div class="desc"><?php echo (do_textile($task_list->getDescription())) ?></div>
<?php endif ?>
<?php if (plugin_active('tags')): ?>
<div class="taskListTags"><span><?php echo lang('tags') ?>:</span> <?php echo project_object_tags($task_list, $task_list->getProject()) ?></div>
<?php endif ?>
<?php if (count($task_list_options)): ?>
<div class="options"><?php echo implode(' | ', $task_list_options) ?></div>
<?php endif ?>
<?php if (is_array($task_list->getOpenTasks())): ?>
<div class="openTasks">
<ul id="<?php echo $task_list->getId() ?>"><!--table class="blank"-->
<?php foreach ($task_list->getOpenTasks() as $task): ?>
<li id="<?php echo $task->getId() ?>" class="<?php odd_even_class($task_list_ln) ?>"><!--tr class="<?php odd_even_class($task_list_ln); ?>"-->
<!-- Task text and options -->
<!--td class="taskText"-->
<div class="task-text">
示例13: edit
/**
* Edit a wiki page
*
* @return void
*/
function edit()
{
if (!WikiPage::canEdit(logged_user())) {
flash_error(lang('no wiki page edit permissions'));
$this->redirectToReferer(get_url('wiki'));
}
//Get the page from the url params
$page = Wiki::getPageById(get_id(), active_project());
if (!instance_of($page, 'WikiPage')) {
//If the page doesn't exist, redirect to wiki index
flash_error(lang('wiki page dnx'));
$this->redirectToReferer(get_url('wiki'));
}
// if
//Check that the user can edit this entry
if (!$page->canEdit(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectTo(get_url('wiki'));
}
// if
// Check that the page isn't locked
if ($page->isLocked() && !$page->canUnlock(logged_user())) {
flash_error(lang('wiki page locked by', $page->getLockedByUser()->getUsername()));
$this->redirectToUrl($page->getViewUrl());
}
// if
//Here we will edit a wiki page
$preview = false;
$data = array_var($_POST, 'wiki', false);
if (false !== $data) {
$preview = array_key_exists('preview', $data);
}
if (!$preview && $data) {
//if(null !== ($data = array_var($_POST, 'wiki'))){
//If we have received data
//Make a new revision
$revision = $page->makeRevision();
$revision->setFromAttributes($data);
$page->setProjectIndex($data['project_index']);
$page->setProjectSidebar($data['project_sidebar']);
$page->setPublish($data['publish']);
$page->setParentId($data['parent_id']);
// Check to see if we want to lock this page
if (isset($data['locked'])) {
if ($data['locked'] == 1 && $page->canLock(logged_user()) && !$page->isLocked()) {
// If we want to lock this page and the user has permissions to lock it, and the page is not already locked
$page->setLocked(true);
$page->setLockedById(logged_user()->getId());
$page->setLockedOn(DateTimeValueLib::now());
} elseif ($data['locked'] == 0 & $page->canUnlock(logged_user()) && $page->isLocked()) {
// Else if we want to unlock the page, and the user is allowed to, and the page is locked
$page->setLocked(false);
}
// if
}
// if
//Set the users ID
$revision->setCreatedById(logged_user()->getId());
try {
//Start the transaction
DB::beginWork();
//Save the page and create revision
//The page will make sure that the revision's project and page Id are correct
$page->save();
ApplicationLogs::createLog($page, active_project(), ApplicationLogs::ACTION_EDIT);
if (plugin_active('tags')) {
//Set the tags
$page->setTagsFromCSV($data['tags']);
}
//Commit changes
DB::commit();
flash_success(lang('success edit wiki page'));
//Redirect to the page we just created
$this->redirectToUrl($page->getViewUrl());
} catch (Exception $e) {
//Get rid of any Db changes we've made
DB::rollback();
//Assign the problem to the template so we can tell the user
tpl_assign('error', $e);
}
//try
} else {
if (array_var($_GET, 'revision')) {
//If we want to make a new revision based off a revision
$revision = $page->getRevision($_GET['revision']);
} else {
$revision = $page->getLatestRevision();
}
}
//if
if (!$data) {
// there was no input POSTed
$data['content'] = $revision->getContent();
}
$data['preview_content'] = do_textile($data['content']);
//.........這裏部分代碼省略.........
示例14: time
/**
* Display time management tool
*
* @access public
* @param void
* @return null
*/
function time()
{
if (plugin_active('time')) {
tpl_assign('projects', logged_user()->getProjects());
tpl_assign('users', owner_company()->getUsers());
$status = array_var($_GET, 'status') ? array_var($_GET, 'status') : 0;
$times = ProjectTimes::getTimeByStatus($status);
$redirect_to = array_var($_GET, 'redirect_to');
if ($redirect_to == '') {
$redirect_to = get_url('administration', 'time', array('status' => $status));
$redirect_to = str_replace('&', '&', trim($redirect_to));
}
// if
tpl_assign('times', $times);
tpl_assign('redirect_to', $redirect_to);
} else {
$this->redirectTo('administration');
}
}
示例15: edit_link
/**
* Edit project link
*
* @param void
* @return null
*/
function edit_link() {
$project_link = ProjectLinks::findById(get_id());
if (!ProjectLink::canEdit(logged_user())) {
flash_error(lang('no access permissions'));
$this->redirectTo('links','index');
} // if
if (!($project_link instanceof ProjectLink)) {
flash_error(lang('project link dnx'));
$this->redirectTo('links');
} // if
$this->setTemplate('edit_link');
$this->addHelper('files', 'files');
$project_link_data = array_var($_POST, 'project_link');
if (!is_array($project_link_data)) {
$tag_names = plugin_active('tags') ? $project_link->getTagNames() : '';
$project_link_data = array(
'title' => $project_link->getTitle(),
'url' => $project_link->getUrl(),
'description' => $project_link->getDescription(),
'folder_id' => $project_link->getFolderId(),
'tags' => is_array($tag_names) ? implode(', ', $tag_names) : '',
); // array
} // if
tpl_assign('project_link_data', $project_link_data);
tpl_assign('project_link', $project_link);
if (is_array(array_var($_POST, 'project_link'))) {
$project_link->setFromAttributes($project_link_data);
$project_link->setProjectId(active_project()->getId());
try {
DB::beginWork();
$project_link->save();
ApplicationLogs::createLog($project_link, active_project(), ApplicationLogs::ACTION_EDIT);
if (plugin_active('tags')) {
$project_link->setTagsFromCSV($project_link_data['tags']);
}
DB::commit();
flash_success(lang('success edit link'));
$this->redirectTo('links');
} catch(Exception $e) {
DB::rollback();
tpl_assign('error', $e);
} // try
}
tpl_assign('project_link', $project_link);
tpl_assign('project_link_data', $project_link_data);
} // edit_link