Exemple #1
0
function wpmp_ms_mobile_admin()
{
    $base = get_option('home');
    if (($user = wp_get_current_user()) == null || $user->ID == 0) {
        header("Location: {$base}/wp-login.php?redirect_to=" . urlencode($base) . "%2Fwp-admin%2F");
    }
    $menu = array(__("Overview", 'wpmp') => "/wp-admin/index.php", __("New post", 'wpmp') => "/wp-admin/post-new.php", __("Edit post", 'wpmp') => "/wp-admin/post.php?action=edit", __("Comments", 'wpmp') => "/wp-admin/edit-comments.php", "_" . __("Comment", 'wpmp') => "/wp-admin/comment.php", __("Switcher", 'wpmp') => "/wp-admin/themes.php", __("Settings", 'wpmp') => "/wp-admin/options-general.php");
    if (function_exists('wp_logout_url')) {
        $menu[__("Log out", 'wpmp')] = wp_logout_url();
    } else {
        $menu[__("Log out", 'wpmp')] = "/wp-login.php?action=logout";
    }
    $page = $_SERVER['REQUEST_URI'];
    $function = "";
    foreach ($menu as $link) {
        if (strpos(strtolower($page), strtolower($link)) !== false) {
            $function = substr($link, 10);
            $function = explode(".", $function);
            $function = str_replace("-", "_", $function[0]);
            $function = strtolower($function);
            break;
        }
    }
    if (!function_exists("wpmp_msma_{$function}")) {
        $function = "overview";
    }
    if (!current_user_can('manage_options')) {
        // harsh but fair
        $menu = array();
        $function = "junior";
    }
    wpmp_ms_mobile_top("Admin", $menu);
    call_user_func("wpmp_msma_{$function}", $menu);
    wpmp_ms_mobile_bottom();
}
Exemple #2
0
function wpmp_switcher_login_header($title, $message = '', $wp_error = '')
{
    global $error;
    if (empty($wp_error)) {
        $wp_error = new WP_Error();
    }
    include_once 'mobile.php';
    wpmp_ms_mobile_top($title);
    if (!empty($message)) {
        echo apply_filters('login_message', $message) . "\n";
    }
    if (!empty($error)) {
        $wp_error->add('error', $error);
        unset($error);
    }
    if ($wp_error->get_error_code()) {
        $errors = '';
        $messages = '';
        foreach ($wp_error->get_error_codes() as $code) {
            $severity = $wp_error->get_error_data($code);
            foreach ($wp_error->get_error_messages($code) as $error) {
                if ('message' == $severity) {
                    $messages .= '	' . $error . "<br />\n";
                } else {
                    $errors .= '	' . $error . "<br />\n";
                }
            }
        }
        if (!empty($errors)) {
            echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
        }
        if (!empty($messages)) {
            echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
        }
    }
}
The WordPress Mobile Pack is Licensed under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with the
License.

You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
*/
include_once 'mobile.php';
wpmp_ms_mobile_top(__("Select site", 'wpmp'));
?>

<p><?php 
_e("You've requested the desktop site, but you appear to have a mobile browser.", 'wpmp');
?>
</p>
<p><?php 
print wpmp_switcher_link('mobile', __("Revert to the mobile site", 'wpmp'));
?>
</p>
<p><?php 
print wpmp_switcher_link('desktop', __("Continue to our desktop site", 'wpmp'));
?>
</p>