コード例 #1
0
	/**
	 * 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
0
 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
0
    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
0
 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
0
 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
0
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
0
 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
0
 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
0
 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
0
ファイル: favicons.php プロジェクト: vilmark/vilmark_main
	/**
	 * 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
0
ファイル: favicons.php プロジェクト: hscale/webento
 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
0
 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
0
ファイル: login-image.php プロジェクト: juliosd/legacy-master
    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 . "&amp;tab=images&amp;reset=yes&amp;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
0
	/**
	 * Sets plugin options.
	 * @param $opts
	 *
	 * @return bool
	 */
	private function _set_options ($opts) {
		return ub_update_option('admin_help_content', $opts);
	}
コード例 #15
0
 /**
  * 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;
     }
 }
コード例 #16
0
ファイル: UB_Admin_Bar.php プロジェクト: vilmark/vilmark_main
	/**
	 * Saves new menu order into database
	 *
	 * @since 1.6
	 * @access public
	 *
	 * @return void
	 */
	public function ajax_save_menu_ordering(){
		$order = $_POST['order'];

		$result = array(
			"status" => false
		);

		if( is_array( $order ) && count( $order ) > 0 ){

			ub_update_option( self::ORDER, $order );
			$result = array(
				"status" => true
			) ;
		}

		header('Content-Type: application/json');
		echo json_encode($result);
		wp_die();
	}
コード例 #17
0
        function process() {
            global $plugin_page;
            if (isset($_GET['reset']) && isset($_GET['page']) && $_GET['page'] == 'branding') {
                $colors = $this->colors();
                foreach ($colors as $color_section => $color_array) {
                    foreach ($color_array as $property => $value) {
                        ub_update_option($property, $color_array[$property]['default']);
                    }
                }
                wp_redirect('admin.php?page=branding&tab=ultimate-color-schemes');
            } elseif (isset($_POST['ucs_color_scheme_name'])) {
                foreach ($_POST as $key => $value) {
                    if (preg_match('/^ucs_/', $key)) {
                        ub_update_option($key, $value);
                    }
                }
            }

            return true;
        }
コード例 #18
0
    function update_site_generator_replacement_site_admin_options($status) {

        ub_update_option("site_generator_replacement", $_POST['site_generator_replacement']);
        ub_update_option("site_generator_replacement_link", $_POST['site_generator_replacement_link']);

        if ($status === false) {
            return $status;
        } else {
            return true;
        }
    }
コード例 #19
0
function ub_remove_wp_dashboard_widgets()
{
    global $wp_meta_boxes, $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
    /* Detect active widgets and save the array (only possible from the dashboard page) */
    $detected_widgets = array();
    if (isset($wp_meta_boxes['dashboard']['normal']['core']) && is_array($wp_meta_boxes['dashboard']['normal']['core'])) {
        foreach (array_keys($wp_meta_boxes['dashboard']['normal']['core']) as $name) {
            $detected_widgets[$name] = $wp_meta_boxes['dashboard']['normal']['core'][$name]['title'];
        }
    }
    if (isset($wp_meta_boxes['dashboard']['normal']['low']) && is_array($wp_meta_boxes['dashboard']['normal']['low'])) {
        foreach (array_keys($wp_meta_boxes['dashboard']['normal']['low']) as $name) {
            $detected_widgets[$name] = $wp_meta_boxes['dashboard']['normal']['low'][$name]['title'];
        }
    }
    if (isset($wp_meta_boxes['dashboard']['normal']['high']) && is_array($wp_meta_boxes['dashboard']['normal']['high'])) {
        foreach (array_keys($wp_meta_boxes['dashboard']['normal']['high']) as $name) {
            $detected_widgets[$name] = $wp_meta_boxes['dashboard']['normal']['high'][$name]['title'];
        }
    }
    if (isset($wp_meta_boxes['dashboard']['side']['core']) && is_array($wp_meta_boxes['dashboard']['side']['core'])) {
        foreach (array_keys($wp_meta_boxes['dashboard']['side']['core']) as $name) {
            $detected_widgets[$name] = $wp_meta_boxes['dashboard']['side']['core'][$name]['title'];
        }
    }
    if (isset($wp_meta_boxes['dashboard']['side']['low']) && is_array($wp_meta_boxes['dashboard']['side']['low'])) {
        foreach (array_keys($wp_meta_boxes['dashboard']['side']['low']) as $name) {
            $detected_widgets[$name] = $wp_meta_boxes['dashboard']['side']['low'][$name]['title'];
        }
    }
    if (isset($wp_meta_boxes['dashboard']['side']['high']) && is_array($wp_meta_boxes['dashboard']['side']['high'])) {
        foreach (array_keys($wp_meta_boxes['dashboard']['side']['high']) as $name) {
            $detected_widgets[$name] = $wp_meta_boxes['dashboard']['side']['high'][$name]['title'];
        }
    }
    ub_update_option('ub_rwp_all_active_dashboard_widgets', $detected_widgets);
    $active = ub_get_option('rwp_active_dashboard_widgets', array());
    foreach ($active as $key => $value) {
        remove_meta_box($key, 'dashboard', 'normal');
        remove_meta_box($key, 'dashboard', 'side');
    }
}
コード例 #20
0
 function transfer_old_settings()
 {
     $modules = ub_get_option('ultimatebranding_activated_modules', array());
     if (is_multisite() && function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('ultimate-branding/ultimate-branding.php')) {
         // Check for the original settings and if there are none, but there are some in the old location then move them across
         if (empty($modules)) {
             // none in our settings
             $othermodules = get_option('ultimatebranding_activated_modules', array());
             if (!empty($othermodules)) {
                 // We shall do a transfer across - first modules
                 ub_update_option('ultimatebranding_activated_modules', $othermodules);
                 // Next each set of settings for the activated modules
                 foreach ($othermodules as $key => $title) {
                     switch ($key) {
                         case 'favicons.php':
                             ub_update_option('ub_favicon_dir', get_option('ub_favicon_dir'));
                             ub_update_option('ub_favicon_url', get_option('ub_favicon_url'));
                             break;
                         case 'login-image.php':
                             ub_update_option('ub_login_image_dir', get_option('ub_login_image_dir'));
                             ub_update_option('ub_login_image_url', get_option('ub_login_image_url'));
                             break;
                         case 'custom-admin-bar.php':
                             ub_update_option('wdcab', get_option('wdcab'));
                             break;
                         case 'admin-help-content.php':
                             ub_update_option('admin_help_content', get_option('admin_help_content'));
                             break;
                         case 'global-footer-content.php':
                             ub_update_option('global_footer_content', get_option('global_footer_content'));
                             break;
                         case 'global-header-content.php':
                             ub_update_option('global_header_content', get_option('global_header_content'));
                             break;
                         case 'admin-menu.php':
                             ub_update_option('admin_menu', get_option('admin_menu'));
                             break;
                         case 'admin-footer-text.php':
                             ub_update_option('admin_footer_text', get_option('admin_footer_text'));
                             break;
                         case 'custom-dashboard-welcome.php':
                             break;
                         case 'remove-wp-dashboard-widgets.php':
                             ub_update_option('rwp_active_dashboard_widgets', get_option('rwp_active_dashboard_widgets'));
                             break;
                         case 'rebranded-meta-widget.php':
                             break;
                         case 'remove-permalinks-menu-item.php':
                             break;
                         case 'site-generator-replacement.php':
                             ub_update_option("site_generator_replacement", get_option('site_generator_replacement'));
                             ub_update_option("site_generator_replacement_link", get_option('site_generator_replacement_link'));
                             break;
                         case 'site-wide-text-change.php':
                             ub_update_option('translation_ops', get_option('translation_ops'));
                             ub_update_option('translation_table', get_option('translation_table'));
                             break;
                         case 'custom-login-css.php':
                             ub_update_option('global_login_css', get_option('global_login_css'));
                             break;
                         case 'custom-admin-css.php':
                             ub_update_option('global_admin_css', get_option('global_admin_css'));
                             break;
                     }
                 }
             }
         }
     }
 }
コード例 #21
0
function update_ub_activated_modules($data)
{
    ub_update_option('ultimatebranding_activated_modules', $data);
}
コード例 #22
0
 /**
  * Saves message to the db
  *
  * @since 1.2
  * @param $data
  */
 private function _save_message( $data ){
     ub_update_option("ub_custom_welcome_message", $data);
 }