本文整理汇总了PHP中set_option函数的典型用法代码示例。如果您正苦于以下问题:PHP set_option函数的具体用法?PHP set_option怎么用?PHP set_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
示例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);
}
示例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');
}
示例4: hookConfig
public function hookConfig($args)
{
$post = $args['post'];
foreach ($post as $key => $value) {
set_option($key, $value);
}
}
示例5: testAccessPermissions
public function testAccessPermissions()
{
set_option('display_system_info', true);
$this->currentuser->role = 'admin';
$this->dispatch('system-info');
$this->assertNotController('system-info');
}
示例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', '');
}
示例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");
}
示例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');
}
}
示例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'));
}
示例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);
}
示例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);
}
示例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]);
}
}
}
示例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']);
}
示例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();
}