Plugin Directory

Changeset 655267


Ignore:
Timestamp:
01/19/2013 11:00:53 AM (13 years ago)
Author:
tosend.it
Message:

New 0.3 version is available

Location:
aeiou
Files:
3 edited
5 copied

Legend:

Unmodified
Added
Removed
  • aeiou/tags/0.3/index.php

    r654798 r655267  
    55Description: AEIOU is a powerfull plugin that export all wordpress users info into an XML file including user metadatas and allow to import the same xml file into a new wordpress keeping the metadata of each user. The plugin is able to export buddypress xprofile data too.
    66Author: toSend.it di Luisa Marra
    7 Version: 0.2
     7Version: 0.3
    88Author URI: http://tosend.it
    99*/
     
    1111if(!class_exists('AEIOU')){
    1212    class AEIOU{
    13         const VERSION = '0.2';
     13        const VERSION = '0.3';
    1414        const LANG_DOMAIN = 'AEIOU';
    1515       
     
    3939        private function toXMLItem($user){
    4040            echo("\t<user base_id=\"{$user->ID}\">\n");
    41                 echo("\t\t<user_login><![CDATA[{$user->user_login}]]></user_login>\n");
     41            echo("\t\t<user_login><![CDATA[{$user->user_login}]]></user_login>\n");
     42            /*
     43             * I should export Password too (as requested by user)
     44            */
     45            if(isset($_GET['pwd'])) echo("<user_pass><![CDATA[{$user->user_pass}]]></user_pass>\n");
     46           
     47            echo("\t\t<user_nicename><![CDATA[{$user->user_nicename}]]></user_nicename>\n");
     48            echo("\t\t<user_email><![CDATA[{$user->user_email}]]></user_email>\n");
     49            echo("\t\t<user_url><![CDATA[{$user->user_url}]]></user_url>\n");
     50            echo("\t\t<user_registered><![CDATA[{$user->user_registered}]]></user_registered>\n");
     51            echo("\t\t<user_activation_key><![CDATA[{$user->user_activation_key}]]></user_activation_key>\n");
     52            echo("\t\t<user_status><![CDATA[{$user->user_status}]]></user_status>\n");
     53            echo("\t\t<display_name><![CDATA[{$user->display_name}]]></display_name>\n");
     54           
     55            if($this->exportMetadata || $this->exportOptions){
    4256                /*
    43                  * I should export Password too (as requested by user)
     57                 * I should export metadata (as requested by user)
    4458                */
    45                 if(isset($_GET['pwd'])) echo("<user_pass><![CDATA[{$user->user_pass}]]></user_pass>\n");
    46                
    47                 echo("\t\t<user_nicename><![CDATA[{$user->user_nicename}]]></user_nicename>\n");
    48                 echo("\t\t<user_email><![CDATA[{$user->user_email}]]></user_email>\n");
    49                 echo("\t\t<user_url><![CDATA[{$user->user_url}]]></user_url>\n");
    50                 echo("\t\t<user_registered><![CDATA[{$user->user_registered}]]></user_registered>\n");
    51                 echo("\t\t<user_activation_key><![CDATA[{$user->user_activation_key}]]></user_activation_key>\n");
    52                 echo("\t\t<user_status><![CDATA[{$user->user_status}]]></user_status>\n");
    53                 echo("\t\t<display_name><![CDATA[{$user->display_name}]]></display_name>\n");
    54                
    55                 if($this->exportMetadata || $this->exportOptions){
     59                echo("\t\t<metadata>");
     60                global $wpdb;
     61                $umeta = get_user_meta($user->ID);
     62                foreach($umeta as $key => $value){
     63                    $isOption = preg_match("#^" . preg_quote($wpdb->prefix) ."#", $key);
     64                    if( ($isOption && $this->exportOptions) || (!$isOption && $this->exportMetadata) ){
     65                       
     66                        echo("\t\t\t<meta ");
     67                       
     68                        if(preg_match("#^" . preg_quote($wpdb->prefix) ."#", $key)){
     69                            /*
     70                             * If the value is an option i should remove the db prefix from the option
     71                             * name and add the attribute option to allow the importer to understand
     72                             * when a node is an option or a setting.
     73                             */
     74                            echo('option="true" ');
     75                            echo('global="false" ');
     76                            $key =substr($key, strlen($wpdb->prefix));
     77                        }
     78                        echo("key=\"$key\"><![CDATA[");
     79                        $value = $value[0];
     80                        echo base64_encode($value);
     81                        echo("]]></meta>\n");
     82                    }
     83                   
     84                }
     85                   
     86                echo("\t\t</metadata>");
     87            }
     88            if( class_exists('BuddyPress') ){
     89                if(class_exists('BP_XProfile_Group') && $this->exportXProfile ){
    5690                    /*
    57                      * I should export metadata (as requested by user)
    58                     */
    59                     echo("\t\t<metadata>");
    60                     global $wpdb;
    61                     $umeta = get_user_meta($user->ID);
    62                     foreach($umeta as $key => $value){
    63                         $isOption = preg_match("#^" . preg_quote($wpdb->prefix) ."#", $key);
    64                         if( ($isOption && $this->exportOptions) || (!$isOption && $this->exportMetadata) ){
     91                     * I should export xprofile data too.
     92                     */
     93                    $groups = BP_XProfile_Group::get( array(
     94                        'fetch_fields' => true
     95                    ) );
     96                    /*
     97                     * Fetching all groups
     98                     */
     99                    echo("\t\t<xprofile>");
     100                    foreach($groups as $group){
     101                        $groupName = $group->name;
     102                        if(!empty($group->fields)){
    65103                           
    66                             echo("\t\t\t<meta ");
    67                            
    68                             if(preg_match("#^" . preg_quote($wpdb->prefix) ."#", $key)){
    69                                 /*
    70                                  * If the value is an option i should remove the db prefix from the option
    71                                  * name and add the attribute option to allow the importer to understand
    72                                  * when a node is an option or a setting.
    73                                  */
    74                                 echo('option="true" ');
    75                                 echo('global="false" ');
    76                                 $key =substr($key, strlen($wpdb->prefix));
    77                             }
    78                             echo("key=\"$key\"><![CDATA[");
    79                             $value = $value[0];
    80                             echo base64_encode($value);
    81                             echo("]]></meta>\n");
    82                         }
    83                        
    84                     }
    85                        
    86                     echo("\t\t</metadata>");
    87                 }
    88                 if( class_exists('BuddyPress') ){
    89                     if(class_exists('BP_XProfile_Group') && $this->exportXProfile ){
    90                         /*
    91                          * I should export xprofile data too.
    92                          */
    93                         $groups = BP_XProfile_Group::get( array(
    94                             'fetch_fields' => true
    95                         ) );
    96                         /*
    97                          * Fetching all groups
    98                          */
    99                         echo("\t\t<xprofile>");
    100                         foreach($groups as $group){
    101                             $groupName = $group->name;
    102                             if(!empty($group->fields)){
    103                                
    104                                 /*
    105                                  * Has fields in group
    106                                  */
    107                                 foreach($group->fields as $field){
    108                                     $value = xprofile_get_field_data($field->id, $user->ID, 'array');
    109                                     echo("<field group=\"$groupName\" name=\"{$field->name}\">");
    110                                     $value = serialize($value);
    111                                     #$value = base64_encode($value);
    112                                     echo $value;
    113                                     echo("</field>");
    114                                 }
     104                            /*
     105                             * Has fields in group
     106                             */
     107                            foreach($group->fields as $field){
     108                                $value = xprofile_get_field_data($field->id, $user->ID, 'array');
     109                                echo("<field group=\"$groupName\" name=\"{$field->name}\">");
     110                                $value = serialize($value);
     111                                #$value = base64_encode($value);
     112                                echo $value;
     113                                echo("</field>");
    115114                            }
    116115                        }
    117                         echo("\t\t</xprofile>");
    118116                    }
    119                    
    120                 }
    121                
     117                    echo("\t\t</xprofile>");
     118                   
     119                }
     120            }
     121           
     122            do_action('aeiou_export_extra_data', $user);
    122123            echo("\t</user>\n\n");
    123124        }
     
    130131                 * Make the XML but ensure it will be downloaded
    131132                */
     133               
     134                $url = site_url();
     135                $url = preg_replace('#[^a-z0-9_\-.]+#i','_', $url);
     136                $date = date('Y-m-d-h-i-s');
     137               
    132138                header("Cache-Control: public");
    133139                header("Content-Description: File Transfer");
    134140                header('Content-type: application/xml; encoding=utf-8');
    135                 header("Content-Disposition: attachment; filename=aeiou_users.xml");
     141                header("Content-Disposition: attachment; filename=aeiou_{$url}_{$date}.xml");
    136142                header("Content-Transfer-Encoding: binary");
    137143               
  • aeiou/tags/0.3/parsers.php

    r654798 r655267  
    99        $internal_errors = libxml_use_internal_errors(true);
    1010        $xml = simplexml_load_file( $file );
     11       
    1112        // halt if loading produces an error
    1213        if ( ! $xml ){
     
    9798             * Since version 0.2 (can extend import object threating further informations from xml file)
    9899             */
     100           
    99101            $userRow = apply_filters('aeiou_filter_row', $userRow, $user);
    100102           
  • aeiou/tags/0.3/readme.txt

    r654798 r655267  
    55Requires at least: 3.4
    66Tested up to: 3.5
    7 Stable tag: 0.2
     7Stable tag: 0.3
    88License: GPLv2
    99
     
    4242== Changelog ==
    4343
     44= 0.3 (2013-01-19) =
     45* **New:** Added action aeiou_export_extra_data
     46* **New:** Now the export filename has the website name and the current date time.
     47* **Update:** Update software version
     48
     49
    4450= 0.2 (2013-01-18) =
    4551* **New:** Now you can export and import BuddyPress XProfile data too. If fields or group does not exists they will be created and the field will become of generic type `text`
  • aeiou/trunk/index.php

    r654798 r655267  
    55Description: AEIOU is a powerfull plugin that export all wordpress users info into an XML file including user metadatas and allow to import the same xml file into a new wordpress keeping the metadata of each user. The plugin is able to export buddypress xprofile data too.
    66Author: toSend.it di Luisa Marra
    7 Version: 0.2
     7Version: 0.3
    88Author URI: http://tosend.it
    99*/
     
    1111if(!class_exists('AEIOU')){
    1212    class AEIOU{
    13         const VERSION = '0.2';
     13        const VERSION = '0.3';
    1414        const LANG_DOMAIN = 'AEIOU';
    1515       
     
    3939        private function toXMLItem($user){
    4040            echo("\t<user base_id=\"{$user->ID}\">\n");
    41                 echo("\t\t<user_login><![CDATA[{$user->user_login}]]></user_login>\n");
     41            echo("\t\t<user_login><![CDATA[{$user->user_login}]]></user_login>\n");
     42            /*
     43             * I should export Password too (as requested by user)
     44            */
     45            if(isset($_GET['pwd'])) echo("<user_pass><![CDATA[{$user->user_pass}]]></user_pass>\n");
     46           
     47            echo("\t\t<user_nicename><![CDATA[{$user->user_nicename}]]></user_nicename>\n");
     48            echo("\t\t<user_email><![CDATA[{$user->user_email}]]></user_email>\n");
     49            echo("\t\t<user_url><![CDATA[{$user->user_url}]]></user_url>\n");
     50            echo("\t\t<user_registered><![CDATA[{$user->user_registered}]]></user_registered>\n");
     51            echo("\t\t<user_activation_key><![CDATA[{$user->user_activation_key}]]></user_activation_key>\n");
     52            echo("\t\t<user_status><![CDATA[{$user->user_status}]]></user_status>\n");
     53            echo("\t\t<display_name><![CDATA[{$user->display_name}]]></display_name>\n");
     54           
     55            if($this->exportMetadata || $this->exportOptions){
    4256                /*
    43                  * I should export Password too (as requested by user)
     57                 * I should export metadata (as requested by user)
    4458                */
    45                 if(isset($_GET['pwd'])) echo("<user_pass><![CDATA[{$user->user_pass}]]></user_pass>\n");
    46                
    47                 echo("\t\t<user_nicename><![CDATA[{$user->user_nicename}]]></user_nicename>\n");
    48                 echo("\t\t<user_email><![CDATA[{$user->user_email}]]></user_email>\n");
    49                 echo("\t\t<user_url><![CDATA[{$user->user_url}]]></user_url>\n");
    50                 echo("\t\t<user_registered><![CDATA[{$user->user_registered}]]></user_registered>\n");
    51                 echo("\t\t<user_activation_key><![CDATA[{$user->user_activation_key}]]></user_activation_key>\n");
    52                 echo("\t\t<user_status><![CDATA[{$user->user_status}]]></user_status>\n");
    53                 echo("\t\t<display_name><![CDATA[{$user->display_name}]]></display_name>\n");
    54                
    55                 if($this->exportMetadata || $this->exportOptions){
     59                echo("\t\t<metadata>");
     60                global $wpdb;
     61                $umeta = get_user_meta($user->ID);
     62                foreach($umeta as $key => $value){
     63                    $isOption = preg_match("#^" . preg_quote($wpdb->prefix) ."#", $key);
     64                    if( ($isOption && $this->exportOptions) || (!$isOption && $this->exportMetadata) ){
     65                       
     66                        echo("\t\t\t<meta ");
     67                       
     68                        if(preg_match("#^" . preg_quote($wpdb->prefix) ."#", $key)){
     69                            /*
     70                             * If the value is an option i should remove the db prefix from the option
     71                             * name and add the attribute option to allow the importer to understand
     72                             * when a node is an option or a setting.
     73                             */
     74                            echo('option="true" ');
     75                            echo('global="false" ');
     76                            $key =substr($key, strlen($wpdb->prefix));
     77                        }
     78                        echo("key=\"$key\"><![CDATA[");
     79                        $value = $value[0];
     80                        echo base64_encode($value);
     81                        echo("]]></meta>\n");
     82                    }
     83                   
     84                }
     85                   
     86                echo("\t\t</metadata>");
     87            }
     88            if( class_exists('BuddyPress') ){
     89                if(class_exists('BP_XProfile_Group') && $this->exportXProfile ){
    5690                    /*
    57                      * I should export metadata (as requested by user)
    58                     */
    59                     echo("\t\t<metadata>");
    60                     global $wpdb;
    61                     $umeta = get_user_meta($user->ID);
    62                     foreach($umeta as $key => $value){
    63                         $isOption = preg_match("#^" . preg_quote($wpdb->prefix) ."#", $key);
    64                         if( ($isOption && $this->exportOptions) || (!$isOption && $this->exportMetadata) ){
     91                     * I should export xprofile data too.
     92                     */
     93                    $groups = BP_XProfile_Group::get( array(
     94                        'fetch_fields' => true
     95                    ) );
     96                    /*
     97                     * Fetching all groups
     98                     */
     99                    echo("\t\t<xprofile>");
     100                    foreach($groups as $group){
     101                        $groupName = $group->name;
     102                        if(!empty($group->fields)){
    65103                           
    66                             echo("\t\t\t<meta ");
    67                            
    68                             if(preg_match("#^" . preg_quote($wpdb->prefix) ."#", $key)){
    69                                 /*
    70                                  * If the value is an option i should remove the db prefix from the option
    71                                  * name and add the attribute option to allow the importer to understand
    72                                  * when a node is an option or a setting.
    73                                  */
    74                                 echo('option="true" ');
    75                                 echo('global="false" ');
    76                                 $key =substr($key, strlen($wpdb->prefix));
    77                             }
    78                             echo("key=\"$key\"><![CDATA[");
    79                             $value = $value[0];
    80                             echo base64_encode($value);
    81                             echo("]]></meta>\n");
    82                         }
    83                        
    84                     }
    85                        
    86                     echo("\t\t</metadata>");
    87                 }
    88                 if( class_exists('BuddyPress') ){
    89                     if(class_exists('BP_XProfile_Group') && $this->exportXProfile ){
    90                         /*
    91                          * I should export xprofile data too.
    92                          */
    93                         $groups = BP_XProfile_Group::get( array(
    94                             'fetch_fields' => true
    95                         ) );
    96                         /*
    97                          * Fetching all groups
    98                          */
    99                         echo("\t\t<xprofile>");
    100                         foreach($groups as $group){
    101                             $groupName = $group->name;
    102                             if(!empty($group->fields)){
    103                                
    104                                 /*
    105                                  * Has fields in group
    106                                  */
    107                                 foreach($group->fields as $field){
    108                                     $value = xprofile_get_field_data($field->id, $user->ID, 'array');
    109                                     echo("<field group=\"$groupName\" name=\"{$field->name}\">");
    110                                     $value = serialize($value);
    111                                     #$value = base64_encode($value);
    112                                     echo $value;
    113                                     echo("</field>");
    114                                 }
     104                            /*
     105                             * Has fields in group
     106                             */
     107                            foreach($group->fields as $field){
     108                                $value = xprofile_get_field_data($field->id, $user->ID, 'array');
     109                                echo("<field group=\"$groupName\" name=\"{$field->name}\">");
     110                                $value = serialize($value);
     111                                #$value = base64_encode($value);
     112                                echo $value;
     113                                echo("</field>");
    115114                            }
    116115                        }
    117                         echo("\t\t</xprofile>");
    118116                    }
    119                    
    120                 }
    121                
     117                    echo("\t\t</xprofile>");
     118                   
     119                }
     120            }
     121           
     122            do_action('aeiou_export_extra_data', $user);
    122123            echo("\t</user>\n\n");
    123124        }
     
    130131                 * Make the XML but ensure it will be downloaded
    131132                */
     133               
     134                $url = site_url();
     135                $url = preg_replace('#[^a-z0-9_\-.]+#i','_', $url);
     136                $date = date('Y-m-d-h-i-s');
     137               
    132138                header("Cache-Control: public");
    133139                header("Content-Description: File Transfer");
    134140                header('Content-type: application/xml; encoding=utf-8');
    135                 header("Content-Disposition: attachment; filename=aeiou_users.xml");
     141                header("Content-Disposition: attachment; filename=aeiou_{$url}_{$date}.xml");
    136142                header("Content-Transfer-Encoding: binary");
    137143               
  • aeiou/trunk/parsers.php

    r654798 r655267  
    99        $internal_errors = libxml_use_internal_errors(true);
    1010        $xml = simplexml_load_file( $file );
     11       
    1112        // halt if loading produces an error
    1213        if ( ! $xml ){
     
    9798             * Since version 0.2 (can extend import object threating further informations from xml file)
    9899             */
     100           
    99101            $userRow = apply_filters('aeiou_filter_row', $userRow, $user);
    100102           
  • aeiou/trunk/readme.txt

    r654798 r655267  
    55Requires at least: 3.4
    66Tested up to: 3.5
    7 Stable tag: 0.2
     7Stable tag: 0.3
    88License: GPLv2
    99
     
    4242== Changelog ==
    4343
     44= 0.3 (2013-01-19) =
     45* **New:** Added action aeiou_export_extra_data
     46* **New:** Now the export filename has the website name and the current date time.
     47* **Update:** Update software version
     48
     49
    4450= 0.2 (2013-01-18) =
    4551* **New:** Now you can export and import BuddyPress XProfile data too. If fields or group does not exists they will be created and the field will become of generic type `text`
Note: See TracChangeset for help on using the changeset viewer.