Plugin Directory

Changeset 206397


Ignore:
Timestamp:
02/16/2010 07:45:58 AM (16 years ago)
Author:
holooli
Message:

Added support to Yamlify post tag field
Fiexd Yamlify post content

Location:
wp-yamli/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-yamli/trunk/readme.txt

    r205365 r206397  
    44Requires at least: 2.1
    55Tested up to: 2.9
    6 Stable tag: 1.1
     6Stable tag: 1.2
    77
    88WP Yamli allows blog editors and commenters to write Arabic spelling text in English or French and Yamli will convert them.
  • wp-yamli/trunk/yamli.php

    r205365 r206397  
    22/*
    33Plugin Name: WP Yamli
    4 Version: 1.1
     4Version: 1.2
    55Plugin URI: http://dev.holooli.com/2009/01/22/wp-yamli
    66Description: WP Yamli allows blog editors and commenters to write Arabic spelling text in English or French and Yamli will convert them.
     
    88Author URI: http://holooli.com
    99*/
    10 
    1110
    1211if( !class_exists('Yamli') ) {
     
    2625
    2726                #Execute Yamli script
    28                 add_action( 'admin_footer', array($this, 'execute') );
    29                 add_action( 'wp_footer', array($this, 'execute') );
     27                add_action('admin_footer', array($this, 'execute'));
     28                add_action('wp_footer', array($this, 'execute'));
    3029
    3130            //VERSION CONTROL
    32                 if ( $wp_version < 2.1 ) {
     31                if ($wp_version < 2.1) {
    3332                    add_action('admin_notices', array($this, 'versionWarning'));
    3433                }
    3534        }
    3635
    37         function versionWarning(){ //Show warning if plugin is installed on a WordPress lower than 2.1
    38 
     36        function versionWarning() { //Show warning if plugin is installed on a WordPress lower than 2.1
    3937            global $wp_version;
    4038
     
    4644                    "</strong></p>
    4745                </div>";
    48 
    4946        }
    5047
     
    5249        // Add action to build an yamli page
    5350        function addPanel() {
    54 
    5551            //Add the Settings and User Panels
    56             add_options_page( 'Yamli', 'Yamli', 10, 'yamli', array($this, 'yamliSettings') );
    57 
     52            add_options_page('Yamli', 'Yamli', 10, 'yamli', array($this, 'yamliSettings'));
    5853        }
    5954
     
    6459                                'title'             => '0',
    6560                                'content'           => '0',
     61                                'new-tag-post_tag'  => '0',
    6662                                'author'            => '0',
    6763                                'email'             => '0',
     
    7874            } else { // Set Defaults if new value does not exist
    7975                $yamli = get_option( 'yamli' );
     76
    8077                // Check to see if all defaults exists in option table's record, and assign values to empty keys
    81                 foreach( $default as $key => $val ) {
    82                     if ( !$yamli[$key] ) {
     78                foreach ($default as $key => $val) {
     79                    if (!$yamli[$key]) {
    8380                        $yamli[$key] = $val;
    8481                        $new = true;
     
    8784
    8885                if ( $new ) {
    89                     update_option( 'yamli', $yamli );
     86                    update_option('yamli', $yamli);
    9087                }
    9188            }
     
    119116                                <th scope="row"><label for="name"><?php _e('New Post:', 'yamli');?></label></th>
    120117                                <td>
    121                                     <label><input type="checkbox" name="yamli_title" value="1" <?php if( $yamli['title'] ) echo 'checked="checked"';?> /> <?php _e('Post title', 'yamli');?></label>
    122                                     <label><input type="checkbox" name="yamli_content" value="1" <?php if( $yamli['title'] ) echo 'checked="checked"';?> /> <?php _e('Post content', 'yamli');?></label>
     118                                    <label><input type="checkbox" name="yamli_title" value="1" <?php if ($yamli['title']) echo 'checked="checked"';?> /> <?php _e('Post title', 'yamli');?></label>
     119                                    <label><input type="checkbox" name="yamli_content" value="1" <?php if ($yamli['content']) echo 'checked="checked"';?> /> <?php _e('Post content', 'yamli');?></label>
     120                                    <label><input type="checkbox" name="yamli_tag" value="1" <?php if ($yamli['new-tag-post_tag']) echo 'checked="checked"';?> /> <?php _e('Post tag', 'yamli');?></label>
    123121                                </td>
    124122                            </tr>
     
    148146                                <th scope="row"><label for="text"><?php _e('Interface language:', 'yamli');?></label></th>
    149147                                <td>
    150                                     <label><input type="radio" name="yamli_language" value="en" <?php if( $yamli['language'] == 'en' ) echo 'checked="checked"';?> /> <?php _e('English', 'yamli');?></label> &nbsp;
    151                                     <label><input type="radio" name="yamli_language" value="ar" <?php if( $yamli['language'] == 'ar' ) echo 'checked="checked"';?> /> <?php _e('Arabic', 'yamli');?></label> &nbsp;
    152                                     <label><input type="radio" name="yamli_language" value="fr" <?php if( $yamli['language'] == 'fr' ) echo 'checked="checked"';?> /> <?php _e('French', 'yamli');?></label>
     148                                    <label><input type="radio" name="yamli_language" value="en" <?php if ($yamli['language'] == 'en') echo 'checked="checked"';?> /> <?php _e('English', 'yamli');?></label> &nbsp;
     149                                    <label><input type="radio" name="yamli_language" value="ar" <?php if ($yamli['language'] == 'ar') echo 'checked="checked"';?> /> <?php _e('Arabic', 'yamli');?></label> &nbsp;
     150                                    <label><input type="radio" name="yamli_language" value="fr" <?php if ($yamli['language'] == 'fr') echo 'checked="checked"';?> /> <?php _e('French', 'yamli');?></label>
    153151                                </td>
    154152                            </tr>
     
    156154                                <th scope="row"><label for="text"><?php _e('Placement:', 'yamli');?></label></th>
    157155                                <td>
    158                                     <label><input type="radio" name="yamli_placement" value="inside" <?php if( $yamli['placement'] == 'inside' ) echo 'checked="checked"';?> /> <?php _e('inside', 'yamli');?></label> &nbsp;
    159                                     <label><input type="radio" name="yamli_placement" value="bottomRight" <?php if( $yamli['placement'] == 'bottomRight' ) echo 'checked="checked"';?> /> <?php _e('bottom right', 'yamli');?></label> &nbsp;
    160                                     <label><input type="radio" name="yamli_placement" value="bottomLeft" <?php if( $yamli['placement'] == 'bottomLeft' ) echo 'checked="checked"';?> /> <?php _e('bottom left', 'yamli');?></label> &nbsp;
    161                                     <label><input type="radio" name="yamli_placement" value="topRight" <?php if( $yamli['placement'] == 'topRight' ) echo 'checked="checked"';?> /> <?php _e('top right', 'yamli');?></label> &nbsp;
    162                                     <label><input type="radio" name="yamli_placement" value="topLeft" <?php if( $yamli['placement'] == 'topLeft' ) echo 'checked="checked"';?> /> <?php _e('top left', 'yamli');?></label> &nbsp;
    163                                     <label><input type="radio" name="yamli_placement" value="rightTop" <?php if( $yamli['placement'] == 'rightTop' ) echo 'checked="checked"';?> /> <?php _e('right top', 'yamli');?></label> &nbsp;
    164                                     <label><input type="radio" name="yamli_placement" value="leftTop" <?php if( $yamli['placement'] == 'leftTop' ) echo 'checked="checked"';?> /> <?php _e('left top', 'yamli');?></label> &nbsp;
    165                                     <label><input type="radio" name="yamli_placement" value="rightBottom" <?php if( $yamli['placement'] == 'rightBottom' ) echo 'checked="checked"';?> /> <?php _e('right bottom', 'yamli');?></label> &nbsp;
    166                                     <label><input type="radio" name="yamli_placement" value="leftBottom" <?php if( $yamli['placement'] == 'leftBottom' ) echo 'checked="checked"';?> /> <?php _e('left bottom', 'yamli');?></label> &nbsp;
     156                                    <label><input type="radio" name="yamli_placement" value="inside" <?php if ($yamli['placement'] == 'inside') echo 'checked="checked"';?> /> <?php _e('inside', 'yamli');?></label> &nbsp;
     157                                    <label><input type="radio" name="yamli_placement" value="bottomRight" <?php if ($yamli['placement'] == 'bottomRight') echo 'checked="checked"';?> /> <?php _e('bottom right', 'yamli');?></label> &nbsp;
     158                                    <label><input type="radio" name="yamli_placement" value="bottomLeft" <?php if ($yamli['placement'] == 'bottomLeft') echo 'checked="checked"';?> /> <?php _e('bottom left', 'yamli');?></label> &nbsp;
     159                                    <label><input type="radio" name="yamli_placement" value="topRight" <?php if ($yamli['placement'] == 'topRight') echo 'checked="checked"';?> /> <?php _e('top right', 'yamli');?></label> &nbsp;
     160                                    <label><input type="radio" name="yamli_placement" value="topLeft" <?php if ($yamli['placement'] == 'topLeft') echo 'checked="checked"';?> /> <?php _e('top left', 'yamli');?></label> &nbsp;
     161                                    <label><input type="radio" name="yamli_placement" value="rightTop" <?php if ($yamli['placement'] == 'rightTop') echo 'checked="checked"';?> /> <?php _e('right top', 'yamli');?></label> &nbsp;
     162                                    <label><input type="radio" name="yamli_placement" value="leftTop" <?php if ($yamli['placement'] == 'leftTop') echo 'checked="checked"';?> /> <?php _e('left top', 'yamli');?></label> &nbsp;
     163                                    <label><input type="radio" name="yamli_placement" value="rightBottom" <?php if ($yamli['placement'] == 'rightBottom') echo 'checked="checked"';?> /> <?php _e('right bottom', 'yamli');?></label> &nbsp;
     164                                    <label><input type="radio" name="yamli_placement" value="leftBottom" <?php if ($yamli['placement'] == 'leftBottom') echo 'checked="checked"';?> /> <?php _e('left bottom', 'yamli');?></label> &nbsp;
    167165                                </td>
    168166                            </tr>
     
    184182
    185183            // Get the new values from the submitted POST
    186             $update['title']    = $_POST['yamli_title'];
    187             $update['content']  = $_POST['yamli_content'];
    188             $update['author']   = $_POST['yamli_author'];
    189             $update['email']    = $_POST['yamli_email'];
    190             $update['url']      = $_POST['yamli_url'];
    191             $update['comment']  = $_POST['yamli_comment'];
    192             $update['s']        = $_POST['yamli_s'];
    193 
    194             $update['language']     = $_POST['yamli_language'];
    195             $update['placement']    = $_POST['yamli_placement'];
     184            $update['title']            = $_POST['yamli_title'];
     185            $update['content']          = $_POST['yamli_content'];
     186            $update['new-tag-post_tag'] = $_POST['yamli_tag'];
     187            $update['author']           = $_POST['yamli_author'];
     188            $update['email']            = $_POST['yamli_email'];
     189            $update['url']              = $_POST['yamli_url'];
     190            $update['comment']          = $_POST['yamli_comment'];
     191            $update['s']                = $_POST['yamli_s'];
     192
     193            $update['language']         = $_POST['yamli_language'];
     194            $update['placement']        = $_POST['yamli_placement'];
    196195
    197196            // Save the new settings to option table's record
Note: See TracChangeset for help on using the changeset viewer.