本文整理汇总了PHP中set_option函数的典型用法代码示例。如果您正苦于以下问题:PHP set_option函数的具体用法?PHP set_option怎么用?PHP set_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_option函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: switchAction
public function switchAction()
{
$csrfForm = new Omeka_Form_SessionCsrf();
if (!$this->getRequest()->isPost() || !$csrfForm->isValid($_POST)) {
$this->_helper->flashMessenger(__('Invalid form submission.'), 'error');
$this->_helper->redirector('browse');
return;
}
$themeName = $this->_getParam(Theme::PUBLIC_THEME_OPTION);
// Theme names should be alphanumeric(-ish) (prevent security flaws).
if (preg_match('/[^a-z0-9\\-_]/i', $themeName)) {
$this->_helper->flashMessenger(__('You have chosen an illegal theme name. Please select another theme.'), 'error');
return;
}
$theme = Theme::getTheme($themeName);
$minVer = $theme->omeka_minimum_version;
if (!empty($minVer) && version_compare(OMEKA_VERSION, $theme->omeka_minimum_version, '<')) {
$this->_helper->flashMessenger(__('This theme requires a newer version of Omeka (%s).', $minVer), 'error');
$this->_helper->redirector('browse');
return;
}
// Set the public theme option according to the form post.
set_option(Theme::PUBLIC_THEME_OPTION, $themeName);
if (!Theme::getOptions($themeName) && ($configForm = new Omeka_Form_ThemeConfiguration(array('themeName' => $themeName)))) {
Theme::setOptions($themeName, $configForm->getValues());
}
$this->_helper->flashMessenger(__('The theme has been successfully changed.'), 'success');
$this->_helper->redirector('browse');
}
开发者ID:lchen01,项目名称:STEdwards,代码行数:29,代码来源:ThemesController.php
示例2: index
public function index()
{
if ($this->mongo_db->user->find()->count() && !$this->input->get('ok')) {
show_error('Kurulum zaten yapılmış!');
}
$this->load->library('form_validation');
$this->load->library('user/auth');
$data = array();
$this->form_validation->set_rules('password', 'Şifre', 'trim|required|xss_clean');
$this->form_validation->set_rules('confirm_password', 'Şifre tekrarı', 'trim|required|xss_clean|matches[password]');
$this->form_validation->set_rules('email', 'E-posta', 'trim|required|xss_clean|valid_email');
$this->form_validation->set_rules('name', 'İsim', 'trim|required|xss_clean');
if ($this->form_validation->run()) {
$data['name'] = set_value('name');
$data['permissions'] = set_value('permissions');
if ($this->auth->create(set_value('email'), set_value('password'), $data, TRUE)) {
set_option('site_name', set_value('site_name'));
set_option('site_email', set_value('site_email'));
set_option('per_page', 10);
set_option('per_page_admin', 20);
set_option('debug', 0);
$navigation = array('slug' => 'HEAD_MENU', 'title' => 'Üst Menü', 'items' => array(array('title' => 'Anasayfa', 'url' => '/', 'access_level' => '0', 'target' => ''), array('title' => 'İletişim', 'url' => '/contact', 'access_level' => '0', 'target' => '')));
$this->mongo_db->navigation->insert($navigation);
flash_message('success', 'Üye başarıyla eklendi.');
redirect('install?ok=1');
}
}
$this->load->view('index', $data);
}
开发者ID:navruzm,项目名称:navruz.net,代码行数:29,代码来源:install.php
示例3: testCanReachUpgradePageWithoutBeingLoggedIn
public function testCanReachUpgradePageWithoutBeingLoggedIn()
{
set_option('omeka_version', '1.0');
$this->db->query("TRUNCATE omeka_schema_migrations");
$this->dispatch('/upgrade');
$this->assertNotRedirectTo('/users/login');
}
开发者ID:emhoracek,项目名称:Omeka,代码行数:7,代码来源:UpgradeControllerTest.php
示例4: hookConfig
public function hookConfig($args)
{
$post = $args['post'];
foreach ($post as $key => $value) {
set_option($key, $value);
}
}
开发者ID:patrickmj,项目名称:DefaultSort,代码行数:7,代码来源:DefaultSortPlugin.php
示例5: testAccessPermissions
public function testAccessPermissions()
{
set_option('display_system_info', true);
$this->currentuser->role = 'admin';
$this->dispatch('system-info');
$this->assertNotController('system-info');
}
开发者ID:emhoracek,项目名称:Omeka,代码行数:7,代码来源:SystemInfoControllerTest.php
示例6: setUp
public function setUp()
{
parent::setUp();
// All tests are done with local paths to simplify them (no http layer).
if ($this->_allowLocalPaths) {
$settings = (object) array('local_folders' => (object) array('allow' => '1', 'check_realpath' => '0', 'base_path' => TEST_FILES_DIR));
Zend_Registry::set('oai_pmh_static_repository', $settings);
} else {
$settings = (object) array('local_folders' => (object) array('allow' => '0', 'check_realpath' => '0', 'base_path' => '/var/path/to/the/folder'));
Zend_Registry::set('oai_pmh_static_repository', $settings);
}
defined('TEST_FILES_WEB') or define('TEST_FILES_WEB', WEB_ROOT . DIRECTORY_SEPARATOR . basename(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'suite' . DIRECTORY_SEPARATOR . '_files');
$pluginHelper = new Omeka_Test_Helper_Plugin();
// ArchiveDocument is a required plugin.
$path = PLUGIN_DIR . DIRECTORY_SEPARATOR . 'ArchiveDocument' . DIRECTORY_SEPARATOR . 'ArchiveDocumentPlugin.php';
$this->assertTrue(is_file($path) && filesize($path), __('This plugin requires ArchiveDocument.'));
$pluginHelper->setUp('ArchiveDocument');
$pluginHelper->setUp(self::PLUGIN_NAME);
// OcrElementSet is an optional plugin, but required for some tests.
try {
$pluginHelper->setUp('OcrElementSet');
} catch (Omeka_Plugin_Loader_Exception $e) {
}
// Allow extensions "xml" and "json".
$whiteList = get_option(Omeka_Validate_File_Extension::WHITELIST_OPTION) . ',xml,json';
set_option(Omeka_Validate_File_Extension::WHITELIST_OPTION, $whiteList);
// Allow media types for "xml" and "json".
$whiteList = get_option(Omeka_Validate_File_MimeType::WHITELIST_OPTION) . ',application/xml,text/xml,application/json';
set_option(Omeka_Validate_File_MimeType::WHITELIST_OPTION, $whiteList);
}
开发者ID:Daniel-KM,项目名称:OaiPmhStaticRepository,代码行数:30,代码来源:OaiPmhStaticRepository_Test_AppTestCase.php
示例7: uninstall
public function uninstall()
{
$db = get_db();
$db->query("DROP TABLE IF EXISTS `{$db->MapfigStudio}`");
set_option('mapfig_studio_api_key', '');
set_option('mapfig_studio_url', '');
}
开发者ID:MapFig,项目名称:mapfig-omeka-studio-plugin,代码行数:7,代码来源:studioInstaller.class.php
示例8: testDisplayPrivateCollectionsNotChecked
/**
* If 'Display private items' is not checked, do not display private
* collections for exclusion.
*/
public function testDisplayPrivateCollectionsNotChecked()
{
set_option('solr_search_display_private_items', '0');
$this->dispatch('solr-search/collections');
$this->assertXpathContentContains("//dd[@id='solrexclude-element']/label", "public collection");
$this->assertNotXpathContentContains("//dd[@id='solrexclude-element']/label", "private collection");
}
开发者ID:fitnycdigitalinitiatives,项目名称:SolrSearch,代码行数:11,代码来源:CollectionsTest.php
示例9: set_fields
/**
* Standard modular run function for setting features from the setup wizard.
*/
function set_fields()
{
if (!addon_installed('banners')) {
return;
}
$usergroups = $GLOBALS['FORUM_DRIVER']->get_usergroup_list();
if (post_param_integer('have_default_banners_donation', 0) == 0) {
$test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => 'donate'));
if (!is_null($test)) {
require_code('banners2');
delete_banner('donate');
foreach (array_keys($usergroups) as $id) {
$GLOBALS['SITE_DB']->query_insert('group_page_access', array('page_name' => 'donate', 'zone_name' => 'site', 'group_id' => $id), false, true);
}
}
}
if (post_param_integer('have_default_banners_advertising', 0) == 0) {
$test = $GLOBALS['SITE_DB']->query_value_null_ok('banners', 'name', array('name' => 'advertise_here'));
if (!is_null($test)) {
require_code('banners2');
delete_banner('advertise_here');
foreach (array_keys($usergroups) as $id) {
$GLOBALS['SITE_DB']->query_insert('group_page_access', array('page_name' => 'advertise', 'zone_name' => 'site', 'group_id' => $id), false, true);
}
}
}
$test = $GLOBALS['SITE_DB']->query_value('banners', 'COUNT(*)');
if ($test == 0) {
set_option('is_on_banners', '0');
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:34,代码来源:banners.php
示例10: set_fields
/**
* Standard modular run function for setting features from the setup wizard.
*/
function set_fields()
{
if (!addon_installed('stats')) {
return;
}
set_option('stats_store_time', post_param('stats_store_time'));
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:10,代码来源:stats.php
示例11: testUpdatedOptions
public function testUpdatedOptions()
{
set_option('neatlinetime', serialize(array('item_title' => 1, 'item_date' => 2, 'item_description' => 3)));
$this->assertEquals(neatlinetime_get_option('item_title'), 1);
$this->assertEquals(neatlinetime_get_option('item_date'), 2);
$this->assertEquals(neatlinetime_get_option('item_description'), 3);
}
开发者ID:rameysar,项目名称:Omeka-Grinnell-RomanCiv,代码行数:7,代码来源:NeatlineTimeGetOptionTest.php
示例12: setUp
public function setUp()
{
parent::setUp();
$pluginHelper = new Omeka_Test_Helper_Plugin();
$pluginHelper->setUp(self::PLUGIN_NAME);
define('TEST_FILES_DIR', ARCHIVE_REPERTORY_DIR . '/tests/suite/_files');
// Add constraints if derivatives have been added in the config file.
$fileDerivatives = Zend_Registry::get('bootstrap')->getResource('Config')->fileDerivatives;
if (!empty($fileDerivatives) && !empty($fileDerivatives->paths)) {
foreach ($fileDerivatives->paths->toArray() as $type => $path) {
set_option($type . '_constraint', 1);
}
}
// Prepare config and set a test temporary storage in registry.
$config = new Omeka_Test_Resource_Config();
$configIni = $config->init();
if (isset($configIni->paths->imagemagick)) {
$this->convertDir = $configIni->paths->imagemagick;
} else {
$this->convertDir = dirname(`which convert`);
}
$storage = Zend_Registry::get('storage');
$adapter = $storage->getAdapter();
$adapterOptions = $adapter->getOptions();
$this->_storagePath = $adapterOptions['localDir'];
// Set default strategy for the creation of derivative files.
$this->strategy = new Omeka_File_Derivative_Strategy_ExternalImageMagick();
$this->strategy->setOptions(array('path_to_convert' => $this->convertDir));
$this->creator = new Omeka_File_Derivative_Creator();
$this->creator->setStrategy($this->strategy);
Zend_Registry::set('file_derivative_creator', $this->creator);
// Create one item on which attach files.
$this->item = insert_item(array('public' => true));
set_option('disable_default_file_validation', 1);
}
开发者ID:AdrienneSerra,项目名称:Digitalsc,代码行数:35,代码来源:ArchiveRepertory_Test_AppTestCase.php
示例13: hookConfig
/**
* Hook to plugin configuration form submission.
*
* Sets options submitted by the configuration form.
*/
public function hookConfig($args)
{
foreach (array_keys($this->_options) as $option) {
if (isset($args['post'][$option])) {
set_option($option, $args['post'][$option]);
}
}
}
开发者ID:AdrienneSerra,项目名称:Digitalsc,代码行数:13,代码来源:CentralAuthPlugin.php
示例14: hookConfig
public function hookConfig()
{
set_option('ef_displayOnMobile', (bool) (int) $_POST['ef_displayOnMobile']);
set_option('ef_notify', (bool) (int) $_POST['ef_notify']);
set_option('ef_isCalendar', (bool) (int) $_POST['ef_isCalendar']);
set_option('ef_cookieExpiration', (int) $_POST['ef_cookieExpiration']);
set_option('ef_rssfeed', $_POST['ef_rssfeed']);
}
开发者ID:elipousson,项目名称:ExternalFeed,代码行数:8,代码来源:ExternalFeedPlugin.php
示例15: testGeolocationGetCenter
/**
* Tests whether geolocation_get_center correctly returns the default latitude, longitude, and zoom level
*/
public function testGeolocationGetCenter()
{
$this->_checkValidCenter();
set_option('geolocation_default_latitude', '4');
set_option('geolocation_default_longitude', '5');
set_option('geolocation_default_zoom', '6');
$this->_checkValidCenter();
}
开发者ID:regan008,项目名称:WearingGayHistory-Plugins,代码行数:11,代码来源:GeolocationGetCenterTest.php
示例16: hookConfig
public function hookConfig()
{
set_option('ajs_items', (bool) (int) $_POST['ajs_items']);
set_option('ajs_collections', (bool) (int) $_POST['ajs_collections']);
set_option('ajs_showHighlights', (bool) (int) $_POST['ajs_showHighlights']);
set_option('ajs_displayOnMobile', (bool) (int) $_POST['ajs_displayOnMobile']);
//set_option('ajs_simplePages', (bool)(int)$_POST['ajs_simplePages']);
}
开发者ID:ebellempire,项目名称:Annotator,代码行数:8,代码来源:AnnotatorPlugin.php
示例17: active_theme
function active_theme()
{
$theme = hm_post('theme');
if (is_dir(BASEPATH . HM_THEME_DIR . '/' . $theme) and is_file(BASEPATH . HM_THEME_DIR . '/' . $theme . '/init.php')) {
$args = array('section' => 'system_setting', 'key' => 'theme', 'value' => $theme);
set_option($args);
}
}
开发者ID:butkimtinh,项目名称:hoamai-cms-beta-1.0,代码行数:8,代码来源:theme_model.php
示例18: indexAction
public function indexAction()
{
//check cli path
try {
Omeka_Job_Process_Dispatcher::getPHPCliPath();
} catch (RuntimeException $e) {
$this->_helper->flashMessenger(__("The background.php.path in config.ini is not valid. The correct path must be set for the import to work."), 'error');
}
if (isset($_POST['submit'])) {
set_option('omeka_api_import_override_element_set_data', $_POST['omeka_api_import_override_element_set_data']);
if (!empty($_POST['api_url'])) {
//do a quick check for whether the API is active
$client = new Zend_Http_Client();
$client->setUri($_POST['api_url'] . '/site');
$response = json_decode($client->request()->getBody(), true);
if (isset($response['message'])) {
$this->_helper->flashMessenger(__("The API at %s is not active", $_POST['api_url']), 'error');
} else {
$import = new OmekaApiImport();
$import->endpoint_uri = $_POST['api_url'];
$import->status = 'starting';
$import->save();
$args = array('endpointUri' => $_POST['api_url'], 'key' => $_POST['key'], 'importId' => $import->id);
try {
Zend_Registry::get('bootstrap')->getResource('jobs')->sendLongRunning('ApiImport_ImportJob_Omeka', $args);
} catch (Exception $e) {
$import->status = 'error';
$import->save();
_log($e);
}
}
}
if (isset($_POST['undo'])) {
$urls = $this->_helper->db->getTable('OmekaApiImport')->getImportedEndpoints();
foreach ($_POST['undo'] as $endpointIndex) {
$mapRecords = $this->_helper->db->getTable('OmekaApiImportRecordIdMap')->findBy(array('endpoint_uri' => $urls[$endpointIndex]));
foreach ($mapRecords as $record) {
$record->delete();
}
$imports = $this->_helper->db->getTable('OmekaApiImport')->findBy(array('endpoint_uri' => $urls[$endpointIndex]));
foreach ($imports as $import) {
$import->delete();
}
}
}
}
if (!isset($import)) {
$imports = $this->_helper->db->getTable('OmekaApiImport')->findBy(array('sort_field' => 'id', 'sort_dir' => 'd'), 1);
if (empty($imports)) {
$import = null;
} else {
$import = $imports[0];
}
}
$this->view->import = $import;
$urls = $this->_helper->db->getTable('OmekaApiImport')->getImportedEndpoints();
$this->view->urls = $urls;
}
开发者ID:Daniel-KM,项目名称:OmekaApiImport,代码行数:58,代码来源:IndexController.php
示例19: hookConfig
public function hookConfig($args)
{
$post = $args['post'];
set_option('honor_thy_contributors_page_path', $post['page_path']);
set_option('honor_thy_contributors_page_title', $post['page_title']);
set_option('honor_thy_contributors_pre_text', $post['pre_text']);
set_option('honor_thy_contributors_post_text', $post['post_text']);
set_option('honor_thy_contributors_element_id', $post['element_id']);
}
开发者ID:HCDigitalScholarship,项目名称:foster_fall2015,代码行数:9,代码来源:HonorThyContributorsPlugin.php
示例20: update_config_option_reference
/**
* Update a config option that references something, reflecting a new reference.
*
* @param ID_TEXT The old setting
* @param ID_TEXT The new setting
* @param ID_TEXT The config option type - presumably a type that holds references (e.g. "forum")
*/
function update_config_option_reference($old_setting, $new_setting, $type)
{
$options = $GLOBALS['SITE_DB']->query_select('config', array('the_name'), array('the_type' => $type));
foreach ($options as $option) {
if (get_option($option['the_name']) == $old_setting) {
set_option($option['the_name'], $new_setting);
}
}
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:16,代码来源:config2.php
注:本文中的set_option函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论