Make WordPress Core


Ignore:
Timestamp:
01/18/2010 08:34:48 PM (15 years ago)
Author:
ryan
Message:

Coding standards, space after if

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/import/dotclear.php

    r12513 r12752  
    1313**/
    1414
    15 if(!function_exists('get_comment_count'))
    16 {
     15if (!function_exists('get_comment_count')) {
    1716    /**
    1817     * Get the comment count for posts.
     
    3130}
    3231
    33 if(!function_exists('link_exists'))
    34 {
     32if (!function_exists('link_exists')) {
    3533    /**
    3634     * Check whether link already exists.
     
    181179        $dccat2wpcat = array();
    182180        // Do the Magic
    183         if(is_array($categories))
    184         {
     181        if (is_array($categories)) {
    185182            echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
    186             foreach ($categories as $category)
    187             {
     183            foreach ($categories as $category) {
    188184                $count++;
    189185                extract($category);
     
    194190                $desc = $wpdb->escape(csc ($cat_desc));
    195191
    196                 if($cinfo = category_exists($name))
    197                 {
     192                if ($cinfo = category_exists($name)) {
    198193                    $ret_id = wp_insert_category(array('cat_ID' => $cinfo, 'category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc));
    199                 }
    200                 else
    201                 {
     194                } else {
    202195                    $ret_id = wp_insert_category(array('category_nicename' => $name, 'cat_name' => $title, 'category_description' => $desc));
    203196                }
     
    214207    }
    215208
    216     function users2wp($users='')
    217     {
     209    function users2wp($users='') {
    218210        // General Housekeeping
    219211        global $wpdb;
     
    222214
    223215        // Midnight Mojo
    224         if(is_array($users))
    225         {
     216        if (is_array($users)) {
    226217            echo '<p>'.__('Importing Users...').'<br /><br /></p>';
    227             foreach($users as $user)
    228             {
     218            foreach ($users as $user) {
    229219                $count++;
    230220                extract($user);
     
    234224                $RealName = $wpdb->escape(csc ($user_pseudo));
    235225
    236                 if($uinfo = get_userdatabylogin($name))
    237                 {
     226                if ($uinfo = get_userdatabylogin($name)) {
    238227
    239228                    $ret_id = wp_insert_user(array(
     
    245234                                'display_name'  => $Realname)
    246235                                );
    247                 }
    248                 else
    249                 {
     236                } else {
    250237                    $ret_id = wp_insert_user(array(
    251238                                'user_login'    => $user_id,
     
    263250                $user = new WP_User($ret_id);
    264251                $wp_perms = $user_level + 1;
    265                 if(10 == $wp_perms) { $user->set_role('administrator'); }
    266                 else if(9  == $wp_perms) { $user->set_role('editor'); }
    267                 else if(5  <= $wp_perms) { $user->set_role('editor'); }
    268                 else if(4  <= $wp_perms) { $user->set_role('author'); }
    269                 else if(3  <= $wp_perms) { $user->set_role('contributor'); }
    270                 else if(2  <= $wp_perms) { $user->set_role('contributor'); }
     252                if (10 == $wp_perms) { $user->set_role('administrator'); }
     253                else if (9  == $wp_perms) { $user->set_role('editor'); }
     254                else if (5  <= $wp_perms) { $user->set_role('editor'); }
     255                else if (4  <= $wp_perms) { $user->set_role('author'); }
     256                else if (3  <= $wp_perms) { $user->set_role('contributor'); }
     257                else if (2  <= $wp_perms) { $user->set_role('contributor'); }
    271258                else                     { $user->set_role('subscriber'); }
    272259
     
    290277    }// End function user2wp()
    291278
    292     function posts2wp($posts='')
    293     {
     279    function posts2wp($posts='') {
    294280        // General Housekeeping
    295281        global $wpdb;
     
    299285
    300286        // Do the Magic
    301         if(is_array($posts))
    302         {
     287        if (is_array($posts)) {
    303288            echo '<p>'.__('Importing Posts...').'<br /><br /></p>';
    304289            foreach($posts as $post)
     
    328313                // Import Post data into WordPress
    329314
    330                 if($pinfo = post_exists($Title,$post_content))
    331                 {
     315                if ($pinfo = post_exists($Title,$post_content)) {
    332316                    $ret_id = wp_insert_post(array(
    333317                            'ID'            => $pinfo,
     
    348332                    if ( is_wp_error( $ret_id ) )
    349333                        return $ret_id;
    350                 }
    351                 else
    352                 {
     334                } else {
    353335                    $ret_id = wp_insert_post(array(
    354336                            'post_author'       => $authorid,
     
    376358                $category1 = $category1->term_id;
    377359
    378                 if($cat1 = $category1) { $cats[1] = $cat1; }
    379 
    380                 if(!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
     360                if ($cat1 = $category1) { $cats[1] = $cat1; }
     361
     362                if (!empty($cats)) { wp_set_post_categories($ret_id, $cats); }
    381363            }
    382364        }
     
    388370    }
    389371
    390     function comments2wp($comments='')
    391     {
     372    function comments2wp($comments='') {
    392373        // General Housekeeping
    393374        global $wpdb;
     
    397378
    398379        // Magic Mojo
    399         if(is_array($comments))
    400         {
     380        if (is_array($comments)) {
    401381            echo '<p>'.__('Importing Comments...').'<br /><br /></p>';
    402             foreach($comments as $comment)
    403             {
     382            foreach ($comments as $comment) {
    404383                $count++;
    405384                extract($comment);
     
    450429    }
    451430
    452     function links2wp($links='')
    453     {
     431    function links2wp($links='') {
    454432        // General Housekeeping
    455433        global $wpdb;
     
    457435
    458436        // Deal with the links
    459         if(is_array($links))
    460         {
     437        if (is_array($links)) {
    461438            echo '<p>'.__('Importing Links...').'<br /><br /></p>';
    462             foreach($links as $link)
    463             {
     439            foreach ($links as $link) {
    464440                $count++;
    465441                extract($link);
     
    476452                    $description = $wpdb->escape(csc ($title));
    477453
    478                     if($linfo = link_exists($linkname)) {
     454                    if ($linfo = link_exists($linkname)) {
    479455                        $ret_id = wp_insert_link(array(
    480456                                    'link_id'       => $linfo,
     
    505481    }
    506482
    507     function import_categories()
    508     {
     483    function import_categories() {
    509484        // Category Import
    510485        $cats = $this->get_dc_cats();
     
    521496    }
    522497
    523     function import_users()
    524     {
     498    function import_users() {
    525499        // User Import
    526500        $users = $this->get_dc_users();
     
    533507    }
    534508
    535     function import_posts()
    536     {
     509    function import_posts() {
    537510        // Post Import
    538511        $posts = $this->get_dc_posts();
     
    547520    }
    548521
    549     function import_comments()
    550     {
     522    function import_comments() {
    551523        // Comment Import
    552524        $comments = $this->get_dc_comments();
     
    572544    }
    573545
    574     function cleanup_dcimport()
    575     {
     546    function cleanup_dcimport() {
    576547        delete_option('dcdbprefix');
    577548        delete_option('dc_cats');
     
    590561    }
    591562
    592     function tips()
    593     {
     563    function tips() {
    594564        echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from DotClear, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>';
    595565        echo '<h3>'.__('Users').'</h3>';
     
    609579    }
    610580
    611     function db_form()
    612     {
     581    function db_form() {
    613582        echo '<table class="form-table">';
    614583        printf('<tr><th><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('DotClear Database User:'));
     
    621590    }
    622591
    623     function dispatch()
    624     {
     592    function dispatch() {
    625593
    626594        if (empty ($_GET['step']))
     
    630598        $this->header();
    631599
    632         if ( $step > 0 )
    633         {
     600        if ( $step > 0 ) {
    634601            check_admin_referer('import-dotclear');
    635602
    636             if($_POST['dbuser'])
    637             {
     603            if ($_POST['dbuser']) {
    638604                if(get_option('dcuser'))
    639605                    delete_option('dcuser');
    640606                add_option('dcuser', sanitize_user($_POST['dbuser'], true));
    641607            }
    642             if($_POST['dbpass'])
    643             {
     608            if ($_POST['dbpass']) {
    644609                if(get_option('dcpass'))
    645610                    delete_option('dcpass');
     
    647612            }
    648613
    649             if($_POST['dbname'])
    650             {
    651                 if(get_option('dcname'))
     614            if ($_POST['dbname']) {
     615                if (get_option('dcname'))
    652616                    delete_option('dcname');
    653617                add_option('dcname', sanitize_user($_POST['dbname'], true));
    654618            }
    655             if($_POST['dbhost'])
    656             {
     619            if ($_POST['dbhost']) {
    657620                if(get_option('dchost'))
    658621                    delete_option('dchost');
    659622                add_option('dchost', sanitize_user($_POST['dbhost'], true));
    660623            }
    661             if($_POST['dccharset'])
    662             {
    663                 if(get_option('dccharset'))
     624            if ($_POST['dccharset']) {
     625                if (get_option('dccharset'))
    664626                    delete_option('dccharset');
    665627                add_option('dccharset', sanitize_user($_POST['dccharset'], true));
    666628            }
    667             if($_POST['dbprefix'])
    668             {
    669                 if(get_option('dcdbprefix'))
     629            if ($_POST['dbprefix']) {
     630                if (get_option('dcdbprefix'))
    670631                    delete_option('dcdbprefix');
    671632                add_option('dcdbprefix', sanitize_user($_POST['dbprefix'], true));
     
    675636        }
    676637
    677         switch ($step)
    678         {
     638        switch ($step) {
    679639            default:
    680640            case 0 :
     
    706666    }
    707667
    708     function Dotclear_Import()
    709     {
     668    function Dotclear_Import() {
    710669        // Nothing.
    711670    }
Note: See TracChangeset for help on using the changeset viewer.