本文整理汇总了PHP中ub_update_option函数的典型用法代码示例。如果您正苦于以下问题:PHP ub_update_option函数的具体用法?PHP ub_update_option怎么用?PHP ub_update_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ub_update_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_admin_menu_entry
/**
* Adds admin menu entry for Custom Admin bar module
* @return void
*/
function create_admin_menu_entry() {
if ( @$_POST && isset( $_POST['option_page'] ) ) {
$changed = false;
if ( 'wdcab_options' == @$_POST['option_page'] ) {
if ( isset( $_POST['wdcab']['links']['_last_'] ) ) {
$last = $_POST['wdcab']['links']['_last_'];
unset( $_POST['wdcab']['links']['_last_'] );
if ( @$last['url'] && @$last['title'] ) {
$_POST['wdcab']['links'][] = $last;
}
}
if ( isset( $_POST['wdcab']['links'] ) ) {
$_POST['wdcab']['links'] = array_filter( $_POST['wdcab']['links'] );
}
ub_update_option( 'wdcab', $_POST['wdcab'] );
$changed = true;
}
if ( $changed ) {
$goback = UB_Help::add_query_arg_raw( 'settings-updated', 'true', wp_get_referer() );
wp_redirect( $goback );
die;
}
}
$page = is_multisite() ? 'settings.php' : 'options-general.php';
$perms = is_multisite() ? 'manage_network_options' : 'manage_options';
add_submenu_page( $page, __( 'Custom Admin Bar', 'ub' ), __( 'Custom Admin Bar', 'ub' ), $perms, 'wdcab', array(
$this,
'create_admin_page'
) );
}
示例2: update_admin_options
function update_admin_options($status)
{
ub_update_option('admin_footer_text', stripslashes($_POST['admin_footer_text']));
if ($status === false) {
return $status;
} else {
return true;
}
}
示例3: update_custom_from_email
function update_custom_from_email($status) {
ub_update_option('ub_from_name', $_POST['ub_from_name']);
ub_update_option('ub_from_email', $_POST['ub_from_email']);
if ($status === false) {
return $status;
} else {
return true;
}
}
示例4: update_global_footer_options
function update_global_footer_options($status)
{
$global_footer_content = $_POST['global_footer_content'];
if ($global_footer_content == '') {
$global_footer_content = 'empty';
}
ub_update_option('global_footer_content', $global_footer_content);
if ($status === false) {
return $status;
} else {
return true;
}
}
示例5: update_custom_admin_css
function update_custom_admin_css($status)
{
$admincss = $_POST['admincss'];
if ($admincss == '') {
$admincss = 'empty';
}
ub_update_option('global_admin_css', $admincss);
if ($status === false) {
return $status;
} else {
return true;
}
}
示例6: ub_rwpwidgets_process_save
function ub_rwpwidgets_process_save($status)
{
$active = array();
//get_site_option( 'rwp_active_dashboard_widgets', array() );
foreach ((array) $_POST['active'] as $key => $value) {
if (!isset($active[$value])) {
$active[$value] = $value;
}
}
ub_update_option('rwp_active_dashboard_widgets', $active);
if ($status === false) {
return $status;
} else {
return true;
}
}
示例7: update_admin_page
function update_admin_page($status)
{
if (isset($_POST['wdcab']['links']['_last_'])) {
$last = $_POST['wdcab']['links']['_last_'];
unset($_POST['wdcab']['links']['_last_']);
if (@$last['url'] && @$last['title']) {
$_POST['wdcab']['links'][] = $last;
}
}
if (isset($_POST['wdcab']['links'])) {
$_POST['wdcab']['links'] = array_filter($_POST['wdcab']['links']);
}
ub_update_option('wdcab', $_POST['wdcab']);
if ($status === false) {
return $status;
} else {
return true;
}
}
示例8: update_global_footer_options
function update_global_footer_options($status)
{
$global_footer = $_POST['ub_global_footer'];
$global_footer_main = $_POST['ub_global_footer_main'];
if ('' === $global_footer['content']) {
$global_footer['content'] = 'empty';
}
$status *= ub_update_option('global_footer_content', $global_footer['content']);
$status *= ub_update_option('global_footer_bgcolor', $global_footer['bgcolor']);
$status *= ub_update_option('global_footer_fixedheight', $global_footer['fixedheight']);
if (is_multisite()) {
if ('' === $global_footer_main['content']) {
$global_footer_main['content'] = 'empty';
}
$status *= ub_update_option('global_footer_main_content', $global_footer_main['content']);
$status *= ub_update_option('global_footer_main_bgcolor', $global_footer_main['bgcolor']);
$status *= ub_update_option('global_footer_main_fixedheight', $global_footer_main['fixedheight']);
}
return (bool) $status;
}
示例9: process
function process()
{
global $plugin_page;
if (isset($_GET['resetfavicon']) && isset($_GET['page']) && $_GET['page'] == 'branding') {
//login_image_save
ub_delete_option('ub_favicon');
ub_delete_option('ub_favicon_id');
ub_delete_option('ub_favicon_size');
ub_delete_option('ub_favicon_dir');
ub_delete_option('ub_favicon_url');
$uploaddir = ub_wp_upload_dir();
$uploadurl = ub_wp_upload_url();
$response = wp_remote_head(admin_url() . 'images/wordpress-logo.svg');
ub_update_option('ub_favicon', false);
wp_redirect('admin.php?page=branding&tab=images');
} elseif (isset($_POST['wp_favicon'])) {
ub_update_option('ub_favicon', $_POST['wp_favicon']);
ub_update_option('ub_favicon_id', $_POST['wp_favicon_id']);
ub_update_option('ub_favicon_size', $_POST['wp_favicon_size']);
}
return true;
}
示例10: ajax_ub_save_favicon
/**
* Saves favicon to db using ajax
*
* @since 1.8.1
*
*/
public function ajax_ub_save_favicon(){
$data = $_POST['ub_favicons'];
$id = (int) key($data);
$data = current($data);
/**
* Empty url
*/
if( empty( $data['url'] ) ){
wp_send_json_error(
__("Please specify image", "ub")
);
}
/**
* Id = 0
*/
if( $id === 0 ){
wp_send_json_error(
__("Please specify image", "ub")
);
}
if( wp_verify_nonce($data['nonce'], "ub_save_favicon") ){
unset( $data['nonce'] );
ub_update_option( self::FAV_PREFIX . $id, $data );
wp_send_json_success(__("Favicon successfully updated", "ub"));
}
wp_die();
}
示例11: global_head
function global_head()
{
$uploaddir = ub_wp_upload_dir();
$uploadurl = ub_wp_upload_url();
$favicon_dir = ub_get_option('ub_favicon_dir', false);
$favicon_url = ub_get_option('ub_favicon_url', false);
// Check for backwards compatibility
if (!$favicon_dir && file_exists($uploaddir . '/ultimate-branding/includes/favicon/favicon.png')) {
ub_update_option('ub_favicon_dir', $uploaddir . '/ultimate-branding/includes/favicon/favicon.png');
ub_update_option('ub_favicon_url', $uploadurl . '/ultimate-branding/includes/favicon/favicon.png');
$favicon_dir = ub_get_option('ub_favicon_dir', false);
$favicon_url = ub_get_option('ub_favicon_url', false);
}
if ($favicon_dir && file_exists($favicon_dir)) {
$favicon_url = preg_replace(array('/http:/i', '/https:/i'), '', $favicon_url);
echo '<link rel="shortcut icon" href="' . $favicon_url . '" />';
}
}
示例12: process
function process()
{
global $plugin_page;
if (isset($_GET['reset']) && isset($_GET['page']) && $_GET['page'] == 'branding') {
//login_image_save
ub_delete_option('ub_login_image');
ub_delete_option('ub_login_image_id');
ub_delete_option('ub_login_image_size');
ub_delete_option('ub_login_image_width');
ub_delete_option('ub_login_image_height');
$uploaddir = ub_wp_upload_dir();
$uploadurl = ub_wp_upload_url();
$response = wp_remote_head(admin_url() . 'images/wordpress-logo.svg');
if (!is_wp_error($response) && !empty($response['response']['code']) && $response['response']['code'] == '200') {
//support for 3.8+
ub_update_option('ub_login_image', admin_url() . 'images/wordpress-logo.svg');
} else {
ub_update_option('ub_login_image', admin_url() . 'images/wordpress-logo.png');
}
wp_redirect('admin.php?page=branding&tab=images');
} elseif (isset($_POST['wp_login_image'])) {
ub_update_option('ub_login_image', $_POST['wp_login_image']);
ub_update_option('ub_login_image_id', $_POST['wp_login_image_id']);
ub_update_option('ub_login_image_size', $_POST['wp_login_image_size']);
ub_update_option('ub_login_image_width', $_POST['wp_login_image_width']);
ub_update_option('ub_login_image_height', $_POST['wp_login_image_height']);
}
return true;
}
示例13: manage_output
function manage_output()
{
global $wpdb, $current_site, $page;
if (isset($_GET['error'])) {
echo '<div id="message" class="error fade"><p>' . __('There was an error uploading the file, please try again.', 'ub') . '</p></div>';
} elseif (isset($_GET['updated'])) {
echo '<div id="message" class="updated fade"><p>' . __('Changes saved.', 'ub') . '</p></div>';
}
$uploaddir = ub_wp_upload_dir();
$uploadurl = ub_wp_upload_url();
$login_image_dir = ub_get_option('ub_login_image_dir', false);
$login_image_url = ub_get_option('ub_login_image_url', false);
// Check for backwards compatibility
if (!$login_image_dir && file_exists($uploaddir . '/ultimate-branding/includes/login-image/login-form-image.png')) {
ub_update_option('ub_login_image_dir', $uploaddir . '/ultimate-branding/includes/login-image/login-form-image.png');
ub_update_option('ub_login_image_url', $uploadurl . '/ultimate-branding/includes/login-image/login-form-image.png');
$login_image_dir = ub_get_option('ub_login_image_dir', false);
$login_image_url = ub_get_option('ub_login_image_url', false);
}
?>
<div class="postbox">
<h3 class="hndle" style='cursor:auto;'><span><?php
_e('Login Image', 'ub');
?>
</span></h3>
<div class="inside">
<p class='description'><?php
_e('This is the image that is displayed on the login page (wp-login.php) - ', 'ub');
?>
<a href='<?php
echo wp_nonce_url("?page=" . $page . "&tab=images&reset=yes&action=process", 'ultimatebranding_settings_menu_images');
?>
'><?php
_e('Reset the image', 'ub');
?>
</a>
</p>
<?php
if ($login_image_dir && file_exists($login_image_dir)) {
$login_image_url = preg_replace(array('/http:/i', '/https:/i'), '', $login_image_url);
echo '<img src="' . $login_image_url . '?' . md5(time()) . '" />';
} else {
echo '<img src="' . site_url('wp-admin/images/wordpress-logo.png') . '" />';
}
?>
</p>
<h4><?php
_e('Change Image', 'login_image');
?>
</h4>
<p class='description'>
<input type="hidden" name="MAX_FILE_SIZE" value="500000" />
<input name="login_form_image_file" id="login_form_image_file" size="20" type="file">
</p>
<p class='description'><?php
_e('Image must be 500KB maximum. It will be cropped to 310px wide and 70px tall. For best results use an image of this size. Allowed Formats: jpeg, gif, and png', 'ub');
?>
</p>
<p class='description'><?php
_e('Note that gif animations will not be preserved.', 'ub');
?>
</p>
</div>
</div>
<?php
}
示例14: _set_options
/**
* Sets plugin options.
* @param $opts
*
* @return bool
*/
private function _set_options ($opts) {
return ub_update_option('admin_help_content', $opts);
}
示例15: update_admin_page
/**
* Save admin settings
**/
function update_admin_page($status = false)
{
if (!empty($_POST['delete'])) {
$deletekeys = (array) $_POST['deletecheck'];
} else {
$deletekeys = array();
}
if (!empty($_POST['swtble'])) {
$save = array();
$op = array();
foreach ($_POST['swtble'] as $key => $table) {
if (!in_array($key, $deletekeys) && !empty($table['find'])) {
$save[addslashes($key)]['title'] = 'Text Change : ' . htmlentities($table['find'], ENT_QUOTES, 'UTF-8');
$save[addslashes($key)]['find'] = $table['find'];
$save[addslashes($key)]['ignorecase'] = $table['ignorecase'];
$save[addslashes($key)]['domain'] = $table['domain'];
$save[addslashes($key)]['replace'] = $table['replace'];
if ($table['ignorecase'] == '1') {
$op['domain-' . $table['domain']]['find'][] = '/' . str_replace('/', '\\/', stripslashes($table['find'])) . '/i';
} else {
$op['domain-' . $table['domain']]['find'][] = '/' . stripslashes($table['find']) . '/';
}
$op['domain-' . $table['domain']]['replace'][] = str_replace('/', '\\/', stripslashes($table['replace']));
}
}
if (!empty($op)) {
ub_update_option('translation_ops', $op);
ub_update_option('translation_table', $save);
} else {
ub_update_option('translation_ops', 'none');
ub_update_option('translation_table', 'none');
}
}
if ($status === false) {
return $status;
} else {
return true;
}
}