本文整理汇总了PHP中osc_set_preference函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_set_preference函数的具体用法?PHP osc_set_preference怎么用?PHP osc_set_preference使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_set_preference函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: theme_install
function theme_install()
{
$categories = osc_get_categories();
$categories_ids = array();
addSubCategoories($categories, $categories_ids);
if (!osc_get_preference('keyword_placeholder', 'seeker')) {
osc_set_preference('keyword_placeholder', __('ie. PHP Programmer'), 'seeker');
}
if (!Field::newInstance()->findBySlug('s_department')) {
Field::newInstance()->insertField(__('Department or Unit', 'seeker'), 'TEXT', 's_department', 0, '', $categories_ids);
}
if (!Field::newInstance()->findBySlug('s_position_type')) {
Field::newInstance()->insertField(__('Employment Type', 'seeker'), 'DROPDOWN', 's_position_type', 0, __('Full Time', 'seeker') . ',' . __('Part Time', 'seeker') . ',' . __('Part Time to Full Time', 'seeker') . ',' . __('Temporary', 'seeker') . ',' . __('Temporary to Full Time', 'seeker') . ',' . __('Full Time', 'seeker') . ',' . __('Contracted', 'seeker') . ',' . __('Contracted to Full Time', 'seeker') . ',' . __('Internship', 'seeker') . ',' . __('Internship to Full Time', 'seeker') . ',' . __('Seasonal', 'seeker') . ',' . __('Volunteer', 'seeker'), $categories_ids);
}
if (!Field::newInstance()->findBySlug('s_job_experience')) {
Field::newInstance()->insertField(__('Minimum Experience', 'seeker'), 'DROPDOWN', 's_job_experience', 0, __('Student (High School)', 'seeker') . ',' . __('Student (College)', 'seeker') . ',' . __('Entry Level', 'seeker') . ',' . __('Mid Level', 'seeker') . ',' . __('Experienced', 'seeker') . ',' . __('Manager/Supervisor', 'seeker') . ',' . __('Senior Manager/Supervisor', 'seeker') . ',' . __('Executive', 'seeker') . ',' . __('Senior Executive'), $categories_ids);
}
if (!Field::newInstance()->findBySlug('s_number_positions')) {
Field::newInstance()->insertField(__('Number of positions', 'seeker'), 'TEXT', 's_number_positions', 0, '', $categories_ids);
}
if (!Field::newInstance()->findBySlug('s_salary')) {
Field::newInstance()->insertField(__('Salary', 'seeker'), 'TEXT', 's_salary', 0, '', $categories_ids);
}
$version = theme_version_info();
//Save that theme has installed
osc_set_preference($version['name'], $version['version'], 'seeker');
}
示例2: doModel
function doModel()
{
switch ($this->action) {
case 'latestsearches':
//calling the comments settings view
$this->doView('settings/searches.php');
break;
case 'latestsearches_post':
// updating comment
osc_csrf_check();
if (Params::getParam('save_latest_searches') == 'on') {
osc_set_preference('save_latest_searches', 1);
} else {
osc_set_preference('save_latest_searches', 0);
}
if (Params::getParam('customPurge') == '') {
osc_add_flash_error_message(_m('Custom number could not be left empty'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches');
} else {
osc_set_preference('purge_latest_searches', Params::getParam('customPurge'));
osc_add_flash_ok_message(_m('Last search settings have been updated'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=latestsearches');
}
break;
}
}
示例3: classified_theme_install
function classified_theme_install()
{
osc_set_preference('keyword_placeholder', __('ie. PHP Programmer', 'classified'), 'classified');
osc_set_preference('version', '1.0.0', 'classified');
osc_set_preference('default_logo', '1', 'classified');
osc_reset_preferences();
}
示例4: youtube_update
function youtube_update()
{
// convert version
$version = osc_get_preference('youtube_version', 'youtube');
if ($version == '') {
$version = 12;
}
if ($version < 200) {
$conn = DBConnectionClass::newInstance();
$data = $conn->getOsclassDb();
$dbCommand = new DBCommandClass($data);
$dbCommand->query(sprintf('ALTER TABLE %s ADD COLUMN s_id VARCHAR(15) NOT NULL DEFAULT \'-no-id-\' AFTER s_youtube', YOUTUBE_TABLE));
// update s_id
$dbCommand->select();
$dbCommand->from(YOUTUBE_TABLE);
$rs = $dbCommand->get();
if ($rs !== false) {
$result = $rs->result();
foreach ($result as $video) {
$video_code = youtube_get_code_from_url($video['s_youtube']);
$dbCommand->update(YOUTUBE_TABLE, array('s_id' => $video_code), array('fk_i_item_id' => $video['fk_i_item_id']));
}
}
osc_set_preference('youtube_version', '200', 'youtube', 'STRING');
osc_reset_preferences();
}
}
示例5: __construct
function __construct()
{
parent::__construct();
osc_run_hook('init_admin');
// check if exist a new version each day
if (time() - osc_last_version_check() > 24 * 3600) {
$data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?');
$data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data);
$json = json_decode($data);
if ($json->version > osc_version()) {
osc_set_preference('update_core_json', $data);
} else {
osc_set_preference('update_core_json', '');
}
osc_set_preference('last_version_check', time());
osc_reset_preferences();
}
$config_version = str_replace('.', '', OSCLASS_VERSION);
$config_version = preg_replace('|-.*|', '', $config_version);
if ($config_version > Preference::newInstance()->get('version')) {
if (get_class($this) == 'CAdminTools') {
} else {
if (get_class($this) != 'CAdminUpgrade') {
$this->redirectTo(osc_admin_base_url(true) . '?page=upgrade');
}
}
}
}
示例6: doModel
function doModel()
{
switch ($this->action) {
case 'advanced':
//calling the advanced settings view
$this->doView('settings/advanced.php');
break;
case 'advanced_post':
// updating advanced settings
if (defined('DEMO')) {
osc_add_flash_warning_message(_m("This action can't be done because it's a demo site"), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=advanced');
}
osc_csrf_check();
$subdomain_type = Params::getParam('e_type');
if (!in_array($subdomain_type, array('category', 'country', 'region', 'city', 'user'))) {
$subdomain_type = '';
}
$iUpdated = osc_set_preference('subdomain_type', $subdomain_type);
$iUpdated += osc_set_preference('subdomain_host', Params::getParam('s_host'));
if ($iUpdated > 0) {
osc_add_flash_ok_message(_m("Advanced settings have been updated"), 'admin');
}
osc_calculate_location_slug(osc_subdomain_type());
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=advanced');
break;
case 'advanced_cache_flush':
osc_cache_flush();
osc_add_flash_ok_message(_m("Cache flushed correctly"), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=settings&action=advanced');
break;
}
}
示例7: allSeo_call_after_install
function allSeo_call_after_install()
{
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/robots.txt")) {
$rob = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/robots.txt");
} else {
$rob = '';
}
if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/.htaccess")) {
$hta = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/.htaccess");
} else {
$hta = '';
}
ModelSeo::newInstance()->import('all_in_one/model/struct.sql');
osc_set_preference('allSeo_description', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_keywords', 'classified, free classified, classified web, free listings, cars for sale, sale', 'plugin-all_in_one', 'STRING');
osc_set_preference('allSeo_title_first', '0', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_robots', $rob, 'plugin-all_in_one', 'STRING');
osc_set_preference('allSeo_robots_enabled', '0', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_htaccess', $hta, 'plugin-all_in_one', 'STRING');
osc_set_preference('allSeo_htaccess_enabled', '0', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_delimiter', '|', 'plugin-all_in_one', 'STRING');
osc_set_preference('allSeo_city_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_city_order', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_region_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_region_order', '2', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_country_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_country_order', '3', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_category_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_category_order', '4', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_title_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_title_order', '5', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_body_order', '6', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_page_title', '', 'plugin-all_in_one', 'STRING');
osc_set_preference('allSeo_search_city_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_city_order', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_region_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_region_order', '2', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_country_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_country_order', '3', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_category_order', '4', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_pattern_order', '6', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_title_show', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_title_order', '5', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_search_page_title', '', 'plugin-all_in_one', 'STRING');
osc_set_preference('allSeo_search_improve_desc', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_other_page_title', '', 'plugin-all_in_one', 'STRING');
osc_set_preference('allSeo_sitemap_freq', 'weekly', 'plugin-all_in_one', 'STRING');
osc_set_preference('allSeo_links_footer', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_sitemap_items', '1', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_sitemap_items_limit', '1000', 'plugin-all_in_one', 'INTEGER');
osc_set_preference('allSeo_allow_custom_meta', '1', 'plugin-all_in_one', 'INTEGER');
//upload email templates
foreach (osc_listLocales() as $loc) {
//bo_mgr_email_expired template
$des_link[$loc['code']]['s_title'] = '{WEB_TITLE} - There is problem with backlink placed on your site';
$des_link[$loc['code']]['s_text'] = '<p>Dear Partner!</p> <p>Let us inform you, that we were not able to find link referring to our site: <strong>{LINK_TO}</strong> on your website <strong>{LINK_FROM}</strong>.</p> <p>Please add our link to your site or our cooperation in backlink building will be cancelled. If reason of removing link is maintenance or similar, please inform us about this.</p> <p>Regards, <br />{WEB_TITLE}</p>';
}
Page::newInstance()->insert(array('s_internal_name' => 'seo_link_problem', 'b_indelible' => '1'), $des_link);
}
示例8: digitalgoods_install
function digitalgoods_install()
{
DGModel::newInstance()->import('digitalgoods/struct.sql');
@mkdir(osc_content_path() . 'uploads/digitalgoods/');
osc_set_preference('upload_path', osc_content_path() . 'uploads/digitalgoods/', 'digitalgoods', 'STRING');
osc_set_preference('max_files', '1', 'digitalgoods', 'INTEGER');
osc_set_preference('allowed_ext', 'zip,rar,tgz', 'digitalgoods', 'INTEGER');
}
示例9: modern_compactmode_actions
function modern_compactmode_actions(){
$compactMode = osc_get_preference('compact_mode','modern_admin_theme');
$modeStatus = array('compact_mode'=>true);
if($compactMode == true){
$modeStatus['compact_mode'] = false;
}
osc_set_preference('compact_mode', $modeStatus['compact_mode'], 'modern_admin_theme');
echo json_encode($modeStatus);
}
示例10: qrcode_install
function qrcode_install()
{
@mkdir(osc_content_path() . 'uploads/qrcode/');
$conn = getConnection();
osc_set_preference('upload_path', osc_content_path() . 'uploads/qrcode/', 'qrcode', 'STRING');
osc_set_preference('upload_url', osc_base_url() . 'oc-content/uploads/qrcode/', 'qrcode', 'STRING');
osc_set_preference('code_size', '2', 'qrcode', 'INTEGER');
$conn->commit();
}
示例11: __construct
function __construct()
{
parent::__construct();
// check if is moderator and can enter to this page
if ($this->isModerator()) {
if (!in_array($this->page, array('items', 'comments', 'media', 'login', 'admins', 'ajax', 'stats', ''))) {
osc_add_flash_error_message(_m("You don't have enough permissions"), 'admin');
$this->redirectTo(osc_admin_base_url());
}
}
osc_run_hook('init_admin');
// check if exist a new version each day
if (time() - osc_last_version_check() > 24 * 3600) {
$data = osc_file_get_contents('http://osclass.org/latest_version.php?callback=?');
$data = preg_replace('|^\\?\\((.*?)\\);$|', '$01', $data);
$json = json_decode($data);
if ($json->version > osc_version()) {
osc_set_preference('update_core_json', $data);
} else {
osc_set_preference('update_core_json', '');
}
osc_set_preference('last_version_check', time());
osc_reset_preferences();
}
$config_version = str_replace('.', '', OSCLASS_VERSION);
$config_version = preg_replace('|-.*|', '', $config_version);
if ($config_version > Preference::newInstance()->get('version')) {
if (get_class($this) == 'CAdminTools') {
} else {
if (get_class($this) != 'CAdminUpgrade') {
$this->redirectTo(osc_admin_base_url(true) . '?page=upgrade');
}
}
}
// show messages subscribed
$status_subscribe = Params::getParam('subscribe_osclass');
if ($status_subscribe != '') {
switch ($status_subscribe) {
case -1:
osc_add_flash_error_message(_m('Entered an invalid email'), 'admin');
break;
case 0:
osc_add_flash_warning_message(_m("You're already subscribed"), 'admin');
break;
case 1:
osc_add_flash_ok_message(_m('Subscribed correctly'), 'admin');
break;
default:
osc_add_flash_warning_message(_m("Error subscribing"), 'admin');
break;
}
}
// show donation successful
if (Params::getParam('donation') == 'successful') {
osc_add_flash_ok_message(_m('Thank you very much for your donation'), 'admin');
}
}
示例12: voting_install
/**
* Set plugin preferences
*/
function voting_install()
{
ModelVoting::newInstance()->import('voting/struct.sql');
// vote items
osc_set_preference('item_voting', '1', 'voting', 'BOOLEAN');
osc_set_preference('open', '1', 'voting', 'BOOLEAN');
// vote users
osc_set_preference('user', '0', 'voting', 'BOOLEAN');
osc_set_preference('user_voting', '0', 'voting', 'BOOLEAN');
}
示例13: moreedit_install
function moreedit_install()
{
osc_set_preference('moderate_all', '0', 'moreedit', 'BOOLEAN');
osc_set_preference('moderate_edit', '0', 'moreedit', 'BOOLEAN');
osc_set_preference('disable_edit', '0', 'moreedit', 'BOOLEAN');
osc_set_preference('max_ads_week', '0', 'moreedit', 'INTEGER');
osc_set_preference('max_ads_month', '0', 'moreedit', 'INTEGER');
osc_set_preference('notify_edit', '0', 'moreedit', 'INTEGER');
ModelMoreedit::newInstance()->install();
}
示例14: payment_pro_blockchain_conf_save
function payment_pro_blockchain_conf_save()
{
osc_set_preference('blockchain_btc_address', Params::getParam("blockchain_btc_address") ? Params::getParam("blockchain_btc_address") : '', 'payment_pro', 'STRING');
osc_set_preference('blockchain_confirmations', is_numeric(Params::getParam("blockchain_confirmations")) ? Params::getParam("blockchain_confirmations") : '6', 'payment_pro', 'INTEGER');
osc_set_preference('blockchain_enabled', Params::getParam("blockchain_enabled") ? Params::getParam("blockchain_enabled") : '0', 'payment_pro', 'BOOLEAN');
if (Params::getParam("blockchain_enabled") == 1) {
payment_pro_register_service('Blockchain', __FILE__);
} else {
payment_pro_unregister_service('Blockchain');
}
}
示例15: item_success_update_version
function item_success_update_version()
{
$version = osc_get_preference('item_success_version', 'item_success');
if ($version == '') {
$version = 0;
}
if ($version < 110) {
osc_set_preference('item_success_add_meta_og', 'true', 'item_success', 'BOOLEAN');
osc_set_preference('item_success_version', '110', 'item_success', 'STRING');
osc_reset_preferences();
}
}