本文整理汇总了PHP中plugin_is_active函数的典型用法代码示例。如果您正苦于以下问题:PHP plugin_is_active函数的具体用法?PHP plugin_is_active怎么用?PHP plugin_is_active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plugin_is_active函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
if (plugin_is_active('SimplePages')) {
$this->_filters[] = 'api_extend_simple_pages';
}
if (plugin_is_active('ExhibitBuilder')) {
$this->_filters[] = 'api_extend_exhibit_pages';
}
parent::setUp();
}
示例2: testMetsAlto
public function testMetsAlto()
{
if (!plugin_is_active('OcrElementSet')) {
$this->markTestSkipped(__('This test requires OcrElementSet.'));
}
$uri = TEST_FILES_DIR . DIRECTORY_SEPARATOR . 'Folder_Test_Mets_Alto';
$parameters = array('add_relations' => true, 'ocr_fill_text' => true, 'ocr_fill_data' => true, 'ocr_fill_process' => true);
$this->_expectedXml = $this->_expectedBaseDir . DIRECTORY_SEPARATOR . 'FolderTest_Mets_Alto.xml';
$this->_prepareFolderTest($uri, $parameters);
$this->_checkFolder();
}
示例3: get_child_collections
function get_child_collections($collectionId)
{
if (plugin_is_active('CollectionTree')) {
$treeChildren = get_db()->getTable('CollectionTree')->getChildCollections($collectionId);
$childCollections = array();
foreach ($treeChildren as $treeChild) {
$childCollections[] = get_record_by_id('collection', $treeChild['id']);
}
return $childCollections;
}
return array();
}
示例4: _installPluginOrSkip
/**
* Install the passed plugin. If the installation fails, skip the test.
*
* @param string $pluginName The plugin name.
*/
protected function _installPluginOrSkip($pluginName)
{
// Break if plugin is already installed. (Necessary to prevent errors
// caused by trying to re-activate the Exhibit Builder ACL.)
if (plugin_is_active($pluginName)) {
return;
}
try {
$this->helper->setUp($pluginName);
} catch (Exception $e) {
$this->markTestSkipped("Plugin {$pluginName} can't be installed.");
}
}
示例5: __construct
public function __construct($uri, $parameters)
{
// Set the default value.
if (plugin_is_active('DublinCoreExtended')) {
$this->_parametersFormat['use_dcterms'] = true;
}
$this->_uri = $uri;
$this->_parameters = $parameters;
if ($this->_parametersFormat['use_dcterms']) {
$this->_loadDcmiElements();
}
$this->_managePaths = new ArchiveFolder_Tool_ManagePaths($this->_uri, $this->_parameters);
}
示例6: testMappings
public function testMappings()
{
$notReady = array();
foreach ($this->_metadataFilesByFolder as $folder => $metadataFiles) {
foreach ($metadataFiles as $metadataFile) {
$prefix = key($metadataFile);
$metadataFile = reset($metadataFile);
$uri = TEST_FILES_DIR . DIRECTORY_SEPARATOR . $folder;
$filepath = TEST_FILES_DIR . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $metadataFile;
$expectedPath = TEST_FILES_DIR . DIRECTORY_SEPARATOR . 'Results' . DIRECTORY_SEPARATOR . 'Mappings' . DIRECTORY_SEPARATOR . basename($filepath) . '.json';
if ($prefix == 'omeka' || $prefix == 'mag') {
$notReady[] = basename($expectedPath);
continue;
}
if (!file_exists($expectedPath)) {
$notReady[] = basename($expectedPath);
continue;
}
if ($prefix == 'mets' && !plugin_is_active('OcrElementSet')) {
$notReady[] = basename($expectedPath);
// $this->markTestSkipped(
// __('This test requires OcrElementSet.')
// );
continue;
}
$expected = file_get_contents($expectedPath);
$expected = trim($expected);
$this->assertTrue(strlen($expected) > 0, __('Result for file "%s" (prefix "%s") is not readable.', basename($filepath), $prefix));
$mapping = $this->_mappings[$prefix]['class'];
$mapping = new $mapping($uri, array());
$result = $mapping->isMetadataFile($filepath);
$this->assertTrue($result, __('The file "%s" is not recognized as format "%s".', basename($filepath), $prefix));
if (version_compare(phpversion(), '5.4.0', '<')) {
$this->markTestSkipped(__('This test requires php 5.4.0 or higher.'));
}
$result = $mapping->listDocuments($filepath);
$result = json_encode($result, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
// Remove local paths before comparaison.
$jsonUri = trim(json_encode($uri, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), '"');
$expected = str_replace($jsonUri, '::ExampleBasePath::', $expected);
$result = str_replace($jsonUri, '::ExampleBasePath::', $result);
$this->assertEquals($expected, $result, __('The list of documents for file "%s" (prefix "%s") is not correct.', basename($filepath), $prefix));
}
}
if ($notReady) {
$this->markTestIncomplete(__('Some file for the mapping test are not ready: "%s".', implode('", "', $notReady)));
}
}
示例7: setUp
public function setUp()
{
parent::setUp();
if (plugin_is_active('UserProfiles')) {
$this->_hooks[] = 'user_profiles_user_page';
}
if (!is_admin_theme()) {
//dig up all the elements being used, and add their ElementForm hook
$elementsTable = $this->_db->getTable('Element');
$select = $elementsTable->getSelect();
$select->join(array('contribution_type_elements' => $this->_db->ContributionTypeElement), 'element_id = elements.id', array());
$elements = $elementsTable->fetchObjects($select);
foreach ($elements as $element) {
add_filter(array('ElementForm', 'Item', $element->set_name, $element->name), array($this, 'elementFormFilter'), 2);
add_filter(array('ElementInput', 'Item', $element->set_name, $element->name), array($this, 'elementInputFilter'), 2);
}
}
}
示例8: nl_getNeatlineFeaturesWkt
/**
* Return record coverage data from the NeatlineFeatures plugin.
*
* @param $record NeatlineRecord The record to get the feature for.
* @return string|null
*/
function nl_getNeatlineFeaturesWkt($record)
{
// Halt if Features is not present.
if (!plugin_is_active('NeatlineFeatures')) {
return;
}
$db = get_db();
// Get raw coverage.
$result = $db->fetchOne("SELECT geo FROM `{$db->prefix}neatline_features`\n WHERE is_map=1 AND item_id=?;", $record->item_id);
if ($result) {
// If KML, convert to WKT.
if (strpos($result, '<kml') !== false) {
$result = nl_extractWkt(trim($result));
} else {
$result = 'GEOMETRYCOLLECTION(' . implode(',', explode('|', $result)) . ')';
}
}
return $result;
}
示例9: _getForm
private function _getForm()
{
$form = new Omeka_Form_Admin(array('type' => 'contribution_settings'));
$form->addElementToEditGroup('text', 'contribution_page_path', array('label' => __('Contribution Slug'), 'description' => __('Relative path from the Omeka root to the desired location for the contribution form. If left blank, the default path will be named “contribution.”'), 'filters' => array(array('StringTrim', '/\\\\s'))));
$form->addElementToEditGroup('text', 'contribution_email_sender', array('label' => __('Contribution Confirmation Email'), 'description' => __('An email message will be sent to each contributor from this address confirming that they submitted a contribution to this website. Leave blank if you do not want an email sent.'), 'validators' => array('EmailAddress')));
$form->addElementToEditGroup('textarea', 'contribution_email_recipients', array('label' => __('New Contribution Notification Emails'), 'description' => __('An email message will be sent to each address here whenever a new item is contributed. Leave blank if you do not want anyone to be alerted of contributions by email.'), 'attribs' => array('rows' => '5')));
$form->addElementToEditGroup('textarea', 'contribution_consent_text', array('label' => __('Text of Terms of Service'), 'description' => __('The text of the legal disclaimer to which contributors will agree.'), 'attribs' => array('class' => 'html-editor', 'rows' => '15')));
$form->addElementToEditGroup('checkbox', 'contribution_simple', array('label' => __("Use 'Simple' Options"), 'description' => __("This will require an email address from contributors, and create a guest user from that information. If those users want to use the account, they will have to request a new password for the account. If you want to collect additional information about contributors, you cannot use the simple option. See <a href='http://omeka.org/codex/Plugins/Contribution_2.0'>documentation</a> for details. ")), array('checked' => (bool) get_option('contribution_simple') ? 'checked' : ''));
$form->addElementToEditGroup('textarea', 'contribution_email', array('label' => __("Email text to send to contributors"), 'description' => __("Email text to send to contributors when they submit an item. A link to their contribution will be appended. If using the 'Simple' option, we recommend that you notify contributors that a guest user account has been created for them, and what they gain by confirming their account."), 'attribs' => array('class' => 'html-editor', 'rows' => '15')));
$collections = get_db()->getTable('Collection')->findPairsForSelectForm();
$collections = array('' => __('Do not put contributions in any collection')) + $collections;
$form->addElementToEditGroup('select', 'contribution_collection_id', array('label' => __('Contribution Collection'), 'description' => __('The collection to which contributions will be added. Changes here will only affect new contributions.'), 'multiOptions' => $collections));
$types = get_db()->getTable('ContributionType')->findPairsForSelectForm();
$types = array('' => __('No default type')) + $types;
$form->addElementToEditGroup('select', 'contribution_default_type', array('label' => __('Default Contribution Type'), 'description' => __('The type that will be chosen for contributors by default.'), 'multiOptions' => $types));
if (plugin_is_active('UserProfiles')) {
$profileTypes = $this->_helper->db->getTable('UserProfilesType')->findPairsForSelectForm();
$form->addElementToEditGroup('select', 'contribution_user_profile_type', array('label' => __('Choose a profile type for contributors'), 'description' => __('Configure the profile type under User Profiles'), 'multiOptions' => array('' => __("None")) + $profileTypes));
}
return $form;
}
示例10: linkToOwnerProfile
public function linkToOwnerProfile($args)
{
if (isset($args['owner'])) {
$owner = $args['owner'];
}
if (!isset($args['owner']) && isset($args['item'])) {
$item = $args['item'];
$owner = $item->getOwner();
}
if (!isset($args['type'])) {
//get the first type
$types = get_db()->getTable('UserProfilesType')->findBy(array(), 1);
if (!isset($types[0])) {
return '';
}
$type = $types[0];
}
if (isset($args['text'])) {
$text = $args['text'];
} else {
$text = '';
}
$html = "";
if ($owner) {
$html .= "<div id='user-profiles-link-to-owner'>";
$html .= "{$text} <a href='" . url('user-profiles/profiles/user/id/' . $owner->id . '/type/' . $type->id) . "'>{$owner->name}</a>";
$html .= "</div>";
}
//hack to enforce compatibility with Contribution's anonymous contribution option
if (plugin_is_active('Contribution')) {
if (!empty($item)) {
$contributedItem = get_db()->getTable('ContributionContributedItem')->findByItem($item);
}
if (isset($contributedItem) && $contributedItem->anonymous) {
return;
}
}
return $html;
}
示例11: ProcessPost
/**
* Process the data from the form and save changes to options
*
*@return void
*/
public static function ProcessPost()
{
if (!empty($_REQUEST['derivImages'])) {
set_option('mets_includeDeriv', 'true');
} else {
set_option('mets_includeDeriv', 'false');
}
if (plugin_is_active('HistoryLog')) {
if (!empty($_REQUEST['includeLogs'])) {
set_option('mets_includeLogs', 'true');
} else {
set_option('mets_includeLogs', 'false');
}
}
if (isset($_REQUEST['admElements'])) {
$options = array();
foreach ($_REQUEST['admElements'] as $elementName) {
$options[$elementName] = $_REQUEST['adm_type_' . str_replace(' ', '', $elementName)];
}
set_option('mets_admElements', serialize($options));
}
}
示例12: _skipIfNotPlugin
/**
* If the passed plugin is not installed/active, skip the test.
*
* @param string $pluginName The plugin name.
*/
protected function _skipIfNotPlugin($pluginName)
{
if (!plugin_is_active($pluginName)) {
$this->markTestSkipped();
}
}
示例13: _getElementOptions
/**
* Get an array to be used in html select input containing all elements.
*
* @return array $elementOptions Array of options for a dropdown
* menu containing all elements applicable to records of type Item
*/
private function _getElementOptions()
{
/*
$options = get_table_options('Element', null, array(
'record_types' => array('Item', 'All'),
'sort' => 'alphaBySet')
);
unset($options['']);
return $options;
*/
$db = get_db();
$sql = "\n SELECT es.name AS element_set_name, e.id AS element_id,\n e.name AS element_name, it.name AS item_type_name\n FROM {$db->ElementSet} es\n JOIN {$db->Element} e ON es.id = e.element_set_id\n LEFT JOIN {$db->ItemTypesElements} ite ON e.id = ite.element_id\n LEFT JOIN {$db->ItemType} it ON ite.item_type_id = it.id\n WHERE es.record_type IS NULL OR es.record_type = 'Item'\n ORDER BY es.name, it.name, e.name";
$elements = $db->fetchAll($sql);
$options = array();
// $options = array('' => __('Select Below'));
foreach ($elements as $element) {
$element_id = $element['element_id'];
// Do not allow modification of elements linked to authorities
if (plugin_is_active('ElementTypes')) {
$element_types_by_id = Zend_Registry::get('element_types_by_id');
if (array_key_exists($element_id, $element_types_by_id)) {
$element_type = $element_types_by_id[$element_id];
if ($element_type->element_type == 'koha-authority') {
continue;
}
}
}
$optGroup = $element['item_type_name'] ? __('Item Type') . ': ' . __($element['item_type_name']) : __($element['element_set_name']);
$value = __($element['element_name']);
$options[$optGroup][$element_id] = $value;
}
return $options;
}
示例14: _usePreTiled
/**
* Get a pre tiled image.
*
* @todo Prebuild tiles directly with the IIIF standard (same type of url).
*
* @internal Because the position of the requested region may be anything
* (it depends of the client), until four images may be needed to build the
* resulting image. It's always quicker to reassemble them rather than
* extracting the part from the full image, specially with big ones.
* Nevertheless, OpenSeaDragon tries to ask 0-based tiles, so only this case
* is managed currently.
* @todo For non standard requests, the tiled images may be used to rebuild
* a fullsize image that is larger the Omeka derivatives. In that case,
* multiple tiles should be joined.
*
* @todo If OpenLayersZoom uses an IIPImage server, it simpler to link it
* directly to Universal Viewer.
*
* @param File $file
* @param array $transform
* @return array|null Associative array with the file path, the derivative
* type, the width and the height. Null if none.
*/
protected function _usePreTiled($file, $transform)
{
// Some requirements to get tiles.
if (!in_array($transform['region']['feature'], array('regionByPx', 'full')) || !in_array($transform['size']['feature'], array('sizeByW', 'sizeByH', 'sizeByWh', 'sizeByWhListed', 'full'))) {
return;
}
// Check if the file is pretiled with the OpenLayersZoom.
if (plugin_is_active('OpenLayersZoom') && $this->view->openLayersZoom()->isZoomed($file)) {
// Get the level and position x and y of the tile.
$data = $this->_getLevelAndPosition($file, $transform['source'], $transform['region'], $transform['size']);
if (is_null($data)) {
return;
}
// Determine the tile group.
$tileGroup = $this->_getTileGroup(array('width' => $transform['source']['width'], 'height' => $transform['source']['height']), $data);
if (is_null($tileGroup)) {
return;
}
// Set the image path.
$olz = new OpenLayersZoom_Creator();
$dirWeb = $olz->getZDataWeb($file);
$dirpath = $olz->useIIPImageServer() ? $dirWeb : $olz->getZDataDir($file);
$path = sprintf('/TileGroup%d/%d-%d-%d.jpg', $tileGroup, $data['level'], $data['x'], $data['y']);
// The imageUrl is used when there is no transformation.
$imageUrl = $dirWeb . $path;
$imagePath = $dirpath . $path;
$derivativeType = 'zoom_tiles';
list($tileWidth, $tileHeight) = array_values($this->_getWidthAndHeight($imagePath));
return array('fileurl' => $imageUrl, 'filepath' => $imagePath, 'derivativeType' => $derivativeType, 'mime_type' => 'image/jpeg', 'width' => $tileWidth, 'height' => $tileHeight);
}
}
示例15: _getElementSlug
/**
*Retrieve the slug for a given metadata element name
*
*@param string $elementName The name of the metadata element
* currently being exported
*@return string $slug The standard shortened form of the
*metadata element name, or "unknown"
*/
private function _getElementSlug($elementName, $elementSetName = '')
{
if ($elementSetName == "UCLDC Schema" && plugin_is_active('NuxeoLink')) {
require_once dirname(dirname(dirname(__FILE__))) . '/NuxeoLink/helpers/APIfunctions.php';
return NuxeoOmekaSession::GetElementSlug($elementName);
}
return strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $elementName));
}