×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2010
    Location
    Rome
    Posts
    4

    Translate WML2 in WML1.1

    Hello everyone. As the title suggests I'm looking for the system to write posts on Wordpress using the WAP 1.1 browser present in my Nokia. I found a Wordpress interface mobile, but the pages are only available in WML2. Someone is able to translate the interface in WAP 1.1? I attach the two files that should be translated:

    login.php
    PHP Code:
     <?php

    require_once('wap-config.php');

    $action $_REQUEST['action'];
    $errors = array();

    if ( isset(
    $_GET['key']) )
        
    $action 'resetpass';

    nocache_headers();

    header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));

    if ( 
    defined('RELOCATE') ) { // Move flag is set
        
    if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
            
    $_SERVER['PHP_SELF'] = str_replace$_SERVER['PATH_INFO'], ''$_SERVER['PHP_SELF'] );

        
    $schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' 'http://';
        if ( 
    dirname($schema $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != _get_wap_home() )
            
    update_option('siteurl'dirname($schema $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) );
    }

    //Set a cookie now to see if they are supported by the browser.
    setcookie(TEST_COOKIE'WP Cookie check'0COOKIEPATHCOOKIE_DOMAIN);
    if ( 
    SITECOOKIEPATH != COOKIEPATH )
        
    setcookie(TEST_COOKIE'WP Cookie check'0SITECOOKIEPATHCOOKIE_DOMAIN);

    // Rather than duplicating this HTML all over the place, we'll stick it in function
    function login_header($title 'Login'$message '') {
        global 
    $errors$error$wp_locale;


        
    _wap_headerget_bloginfo('name') . '&rsaquo;' $titleget_bloginfo('name') . ' - ' __('Login','wap'));
        
    ?>
    <div id="login">
    <?php
        
    if ( !empty( $message ) ) echo apply_filters('login_message'$message) . "\n";

        
    // Incase a plugin uses $error rather than the $errors array
        
    if ( !empty( $error ) ) {
            
    $errors['error'] = $error;
            unset(
    $error);
        }

        if ( !empty( 
    $errors ) ) {
            if ( 
    is_array$errors ) ) {
                
    $newerrors "\n";
                foreach ( 
    $errors as $error $newerrors .= '    ' $error "<br />\n";
                
    $errors $newerrors;
            }

            echo 
    '<div id="login_error">' apply_filters('login_errors'$errors) . "</div>\n";
        }
    // End of login_header()


    switch ($action) {

    case 
    'logout' :

        
    wp_clearcookie();

        
    do_action('wp_logout');

        
    $redirect_to 'login.php?loggedout=true';

        
    //echo $redirect_to;
        
        //wp_safe_redirect($redirect_to);
        
    wp_redirect($redirect_to302);
        exit();

    break;

    case 
    'login' :
    default:

        
    $user_login '';
        
    $user_pass '';
        
    $using_cookie FALSE;

        
    $redirect_to 'writer.php';

        if ( !isset( 
    $_REQUEST['redirect_to'] ) || is_user_logged_in() )
            
    $redirect_to 'writer.php';
        else
            
    $redirect_to $_REQUEST['redirect_to'];

        if ( 
    $_POST ) {
            
    $user_login $_POST['log'];
            
    $user_login sanitize_user$user_login );
            
    $user_pass  $_POST['pwd'];
            
    $rememberme $_POST['rememberme'];
        } else {
            
    $cookie_login wp_get_cookie_login();
            if ( ! empty(
    $cookie_login) ) {
                
    $using_cookie true;
                
    $user_login $cookie_login['login'];
                
    $user_pass $cookie_login['password'];
            }
        }

        
    do_action_ref_array('wp_authenticate', array(&$user_login, &$user_pass));

        
    // If cookies are disabled we can't log in even with a valid user+pass
        
    if ( $_POST && empty($_COOKIE[TEST_COOKIE]) )
            
    $errors['test_cookie'] = __('<strong>ERROR</strong>: WordPress requires Cookies but your browser does not support them or they are blocked.');

        if ( 
    $user_login && $user_pass && empty( $errors ) ) {
            
    $user = new WP_User(0$user_login);

            
    // If the user can't edit posts, send them to their profile.
            
    if ( !$user->has_cap('edit_posts') && ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' ) )
                
    $redirect_to 'writer.php';

            if ( 
    wp_login($user_login$user_pass$using_cookie) ) {
                if ( !
    $using_cookie )
                    
    wp_setcookie($user_login$user_passfalse''''$rememberme);
                
    do_action('wp_login'$user_login);

                
    wp_redirect($redirect_to302);
                exit();
            } else {
                if ( 
    $using_cookie )
                    
    $errors['expiredsession'] = __('Your session has expired.');
            }
        }

        if ( 
    $_POST && empty( $user_login ) )
            
    $errors['user_login'] = __('<strong>ERROR</strong>: The username field is empty.');
        if ( 
    $_POST && empty( $user_pass ) )
            
    $errors['user_pass'] = __('<strong>ERROR</strong>: The password field is empty.');

        
    // Some parts of this script use the main login form to display a message
        
    if        ( TRUE == $_GET['loggedout'] )            $errors['loggedout']        = __('Successfully logged you out.','wap');
        elseif    ( 
    'disabled' == $_GET['registration'] )    $errors['registerdiabled']    = __('User registration is currently not allowed.','wap');
        elseif    ( 
    'confirm' == $_GET['checkemail'] )    $errors['confirm']            = __('Check your e-mail for the confirmation link.','wap');
        elseif    ( 
    'newpass' == $_GET['checkemail'] )    $errors['newpass']            = __('Check your e-mail for your new password.','wap');
        elseif    ( 
    'registered' == $_GET['checkemail'] )    $errors['registered']        = __('Registration complete. Please check your e-mail.','wap');

        
    login_header(__('Login','wap'));
    ?>

    <form name="loginform" id="loginform" action="login.php" method="post">
    <?php if ( !in_array$_GET['checkemail'], array('confirm''newpass') ) ) : ?>
        <p>
            <label><?php _e('Username:','wap'?><br />
            <input type="text" name="log" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
        </p>
        <p>
            <label><?php _e('Password:','wap'?><br />
            <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
        </p>
    <?php do_action('login_form'); ?>
        <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" checked="true" /> <?php _e('Remember me','wap'); ?></label></p>
        <p class="submit">
            <input type="submit" name="wp-submit" id="wp-submit" value="<?php _e('Login','wap'); ?> &raquo;" tabindex="100" />
            <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
        </p>
    <?php else : ?>
        <p>&nbsp;</p>
    <?php endif; ?>
    </form>
    </div>

    <?php _wap_footer();?>

    <?php

    break;
    // end action switch
    ?>
    GNU/Linux 4 ever!

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Rome
    Posts
    4

    Re: Translate WML2 in WML1.1

    writer.php

    PHP Code:
    <?php

    require_once('wap-config.php');

    _wap_header();


    if ( ! 
    current_user_can('edit_posts') ) { ?>
    <div class="wrap">
    <p><?php _e('You do not have sufficient permission to new posts.','wap'?>&nbsp;<a href="index.php"><?php _e('Return Home','wap'?></a>。
    </p>
    </div>
    <?php
        _wap_footer
    ();
        exit;
    }else{

        if ( isset(
    $_GET['posted']) && $_GET['posted'] ) : ?>
            <div id="message" class="updated fade"><p><strong><?php _e('Post saved.','wap'); ?></strong> <a href="index.php?p=<?php echo $_GET['posted']; ?>"><?php _e('View post &raquo;','wap'); ?></a></p></div>
        <?php
        
    endif;
    }

    // Show post form.
    $post get_default_post_to_edit();
    ?>


    <?php
    if ( isset($_GET['message']) )
        
    $_GET['message'] = (int) $_GET['message'];
    $messages[1] = __('Post updated');
    $messages[2] = __('Custom field updated');
    $messages[3] = __('Custom field deleted.');
    ?>
    <?php 
    if (isset($_GET['message'])) : ?>
    <div id="message" class="updated fade"><p><?php echo wp_specialchars($messages[$_GET['message']]); ?></p></div>
    <?php endif; ?>

    <form enctype="multipart/form-data" name="post" action="post.php" method="post" id="post">
    <?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
    <input type="hidden" name="mode" value="bookmarklet" />
    <?php endif; ?>

    <div class="wrap">
    <h2><?php _e('Write Post'?></h2>
    <?php

    if (== $post_ID) {
        
    $form_action 'post';
        
    $temp_ID = -time(); // don't change this formula without looking at wp_write_post()
        
    $form_extra "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
        
    wp_nonce_field('add-post');
    } else {
        
    $post_ID = (int) $post_ID;
        
    $form_action 'editpost';
        
    $form_extra "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
        
    wp_nonce_field('update-post_' .  $post_ID);
    }

    $form_pingback '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';

    $form_prevstatus '<input type="hidden" name="prev_status" value="' attribute_escape$post->post_status ) . '" />';

    $form_trackback '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'attribute_escapestr_replace("\n"' '$post->to_ping) ) .'" />';

    if (
    '' != $post->pinged) {
        
    $pings '<p>'__('Already pinged:') . '</p><ul>';
        
    $already_pinged explode("\n"trim($post->pinged));
        foreach (
    $already_pinged as $pinged_url) {
            
    $pings .= "\n\t<li>" wp_specialchars($pinged_url) . "</li>";
        }
        
    $pings .= '</ul>';
    }

    $saveasdraft '<input name="save" type="submit" id="save" tabindex="3" value="' attribute_escape__('Save and Continue Editing') ) . '" />';

    if (empty(
    $post->post_status)) $post->post_status 'draft';

    ?>

    <input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
    <input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
    <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
    <input type="hidden" name="post_author" value="<?php echo attribute_escape$post->post_author ); ?>" />
    <input type="hidden" id="post_type" name="post_type" value="post" />

    <?php echo $form_extra ?>
    <?php 
    if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && $_GET['message'])) : ?>
    <script type="text/javascript">
    function focusit() {
        // focus on first input field
        document.post.title.focus();
    }
    addLoadEvent(focusit);
    </script>
    <?php endif; ?>
    <div id="poststuff">

    <div id="post-body">

    <!-- 标题 -->
    <div>
        <h3><?php _e('Title','wap'?></h3>
        <div><input type="text" name="post_title" size="22" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" /></div>
    </div>

    <!-- 内容 -->
    <div>
        <h3><?php _e('Content','wap'?></h3>
        <?php
         $rows 
    get_option('default_post_edit_rows');
         if ((
    $rows 3) || ($rows 100)) {
             
    $rows 10;
         }
        
    ?>
        <script language="javascript">
            function outTagBR(){
                var eContent = document.getElementById("content");
                eContent.innerHTML += "&lt;br&gt;";
            }
        </script>
        <div><div class="stamp">HTML ( <?php _e("Auto add '&lt;br&gt;' tag","wap"?> )</div>
        <div><input type="button" onclick="javascript:outTagBR();" value="<?php _e('Insert a Blank Line','wap'?>" /><div>
        <textarea rows="5" cols="20" name="content" tabindex="2" id="content"><?php echo $post->post_content ?></textarea></div>
    </div>

    <!-- 图片 -->
    <div>
        <h3><?php _e('Picture','wap'?></h3>
        <div>
            <input type="file" name="picture" id="picture" tabindex="3" /><br>
            <input name="picture_position" type="checkbox" id="picture_position" value="bottom" checked="true"/>
            <?php _e('Before Text','wap'?>
        </div>
    </div>

    <!-- Tags -->
    <div>
        <h3><?php _e('Tags','wap'); ?></h3>
        <div><input type="text" name="tags_input" tabindex="10" class="tags-input" id="tags-input" size="22" tabindex="3" value="<?php echo get_tags_to_edit$post_ID ); ?>" /></div>
    </div>

    <!-- Categories -->
    <div>
        <h3><?php _e('Categories','wap'?></h3>
        <div class="dbx-content">
        <p id="jaxcat"></p>
        <ul id="categorychecklist"><?php dropdown_categories(); ?></ul></div>
    </div>

    <!-- 评论选项 -->
    <div>
    <h3 class="dbx-handle"><?php _e('Discussion','wap'?></h3>
    <div class="dbx-content">
    <input name="advanced_view" type="hidden" value="1" />
    <label for="comment_status" class="selectit">
    <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status'open'); ?> />
    <?php _e('Allow Comments','wap'?></label>
    <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status'open'); ?> /> <?php _e('Allow Pings','wap'?></label>
    </div>
    </div>

    <?php echo $form_pingback ?>
    <?php 
    echo $form_prevstatus ?>

    <p class="submit">
    <span id="autosave"></span>

    <?php
    if ( !in_array$post->post_status, array('publish''future') ) || == $post_ID ) {
    ?>
    <?php 
    if ( current_user_can('publish_posts') ) : ?>
        <input name="publish" type="submit" id="publish" tabindex="11" accesskey="p" value="<?php _e('Publish','wap'?>" />
    <?php else : ?>
        <input name="publish" type="submit" id="publish" tabindex="11" accesskey="p" value="<?php _e('Submit for Review','wap'?>" />
    <?php endif; ?>
    <?php
    }
    ?>
    <input type="submit" name="save" id="save-post" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" />
    <input name="referredby" type="hidden" id="referredby" value="<?php
    if ( !empty($_REQUEST['popupurl']) )
        echo 
    clean_url(stripslashes($_REQUEST['popupurl']));
    else if ( 
    url_to_postid(wp_get_referer()) == $post_ID )
        echo 
    'redo';
    else
        echo 
    clean_url(stripslashes(wp_get_referer()));
    ?>" /></p>

    <?php do_action('edit_form_advanced'); ?>


    <?php if ('edit' == $action) : $delete_nonce wp_create_nonce'delete-post_' $post_ID ); ?>
    <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php echo ( 'draft' == $post->post_status ) ? __('Delete this draft') : __('Delete this post'); ?><?php echo "onclick=\"if ( confirm('" js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""?> />
    <?php endif; ?>

    </div>
    </div>
    </div>

    </form>



    <?php _wap_footer();?>
    GNU/Linux 4 ever!

Similar Threads

  1. DTD WML2 vs XHTML?
    By milan_orszagh in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2006-07-12, 11:44
  2. 新手机仍支持 WML1.1?
    By sipingliu in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 1
    Last Post: 2005-09-28, 13:11
  3. wml2 wcss marquee problem
    By afjochnick in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2002-10-16, 13:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×