Plugin Directory

Changeset 2519583


Ignore:
Timestamp:
04/22/2021 07:20:04 AM (5 years ago)
Author:
addonspress
Message:

1.0.4

Location:
advanced-export
Files:
50 added
9 edited

Legend:

Unmodified
Added
Removed
  • advanced-export/trunk/admin/class-advanced-export-admin.php

    r2159845 r2519583  
    6868    public function __construct( $plugin_name, $version ) {
    6969
    70         $this->plugin_name = $plugin_name;
    71         $this->version = $version;
    72         $this->page_slug = apply_filters( 'advanced_export_page_slug','advanced-export' );
    73         $this->export_capability = apply_filters( 'advanced_export_capability','export' );
     70        $this->plugin_name       = $plugin_name;
     71        $this->version           = $version;
     72        $this->page_slug         = apply_filters( 'advanced_export_page_slug', 'advanced-export' );
     73        $this->export_capability = apply_filters( 'advanced_export_capability', 'export' );
    7474    }
    7575
     
    8181    public function enqueue_styles( $hook_suffix ) {
    8282
    83         if ( 'tools_page_'.$this->page_slug  == $hook_suffix ){
     83        if ( 'tools_page_' . $this->page_slug == $hook_suffix ) {
    8484            wp_enqueue_style( $this->plugin_name, ADVANCED_EXPORT_URL . 'assets/css/advanced-export-admin.css', array(), $this->version, 'all' );
    8585        }
     
    9393    public function enqueue_scripts( $hook_suffix ) {
    9494
    95         if ( 'tools_page_'.$this->page_slug  == $hook_suffix ){
     95        if ( 'tools_page_' . $this->page_slug == $hook_suffix ) {
    9696            wp_enqueue_script( $this->plugin_name, ADVANCED_EXPORT_URL . 'assets/js/advanced-export-admin.js', array( 'jquery' ), $this->version, false );
    97             wp_localize_script( $this->plugin_name, 'advanced_export_js_object', array(
    98                 'ajaxurl' => admin_url( 'admin-ajax.php' )
    99             ) );
     97            wp_localize_script(
     98                $this->plugin_name,
     99                'advanced_export_js_object',
     100                array(
     101                    'ajaxurl' => admin_url( 'admin-ajax.php' ),
     102                )
     103            );
    100104        }
    101105    }
     
    144148        // If the 'download' URL parameter is set, a Theme Data ZIP export file returned.
    145149        if ( isset( $_POST['advanced-export-download'] ) ) {
    146             if ( !current_user_can( $this->export_capability ) ){
    147                 wp_die( esc_html__( 'Sorry, you are not allowed to export the content of this site.', 'advanced-export') );
     150            if ( ! current_user_can( $this->export_capability ) ) {
     151                wp_die( esc_html__( 'Sorry, you are not allowed to export the content of this site.', 'advanced-export' ) );
    148152            }
    149153
     
    155159            if ( ! isset( $_POST['content'] ) || 'all' == $_POST['content'] ) {
    156160                $args['content'] = 'all';
    157             }
    158             elseif ( 'posts' == $_POST['content'] ) {
     161            } elseif ( 'posts' == $_POST['content'] ) {
    159162                $args['content'] = 'post';
    160163
    161                 if ( $_POST['cat'] ){
    162                     $args['category'] = absint( $_POST['cat'] ) ;
    163                 }
    164 
    165                 if ( $_POST['post_author'] ){
     164                if ( $_POST['cat'] ) {
     165                    $args['category'] = absint( $_POST['cat'] );
     166                }
     167
     168                if ( $_POST['post_author'] ) {
    166169                    $args['author'] = absint( $_POST['post_author'] );
    167                 }
     170                }
    168171
    169172                if ( $_POST['post_start_date'] || $_POST['post_end_date'] ) {
    170173                    $args['start_date'] = sanitize_text_field( $_POST['post_start_date'] );
    171                     $args['end_date'] = sanitize_text_field( $_POST['post_end_date'] );
    172                 }
    173 
    174                 if ( $_POST['post_status'] ){
    175                     $args['status'] = sanitize_text_field ( $_POST['post_status'] );
    176                 }
    177             }
    178             elseif ( 'pages' == $_POST['content'] ) {
     174                    $args['end_date']   = sanitize_text_field( $_POST['post_end_date'] );
     175                }
     176
     177                if ( $_POST['post_status'] ) {
     178                    $args['status'] = sanitize_text_field( $_POST['post_status'] );
     179                }
     180            } elseif ( 'pages' == $_POST['content'] ) {
    179181                $args['content'] = 'page';
    180182
    181                 if ( $_POST['page_author'] ){
     183                if ( $_POST['page_author'] ) {
    182184                    $args['author'] = absint( $_POST['page_author'] );
    183                 }
     185                }
    184186
    185187                if ( $_POST['page_start_date'] || $_POST['page_end_date'] ) {
    186188                    $args['start_date'] = sanitize_text_field( $_POST['page_start_date'] );
    187                     $args['end_date'] = sanitize_text_field ( $_POST['page_end_date'] );
    188                 }
    189 
    190                 if ( $_POST['page_status'] ){
     189                    $args['end_date']   = sanitize_text_field( $_POST['page_end_date'] );
     190                }
     191
     192                if ( $_POST['page_status'] ) {
    191193                    $args['status'] = sanitize_text_field( $_POST['page_status'] );
    192                 }
    193             }
    194             elseif ( 'attachment' == $_POST['content'] ) {
     194                }
     195            } elseif ( 'attachment' == $_POST['content'] ) {
    195196                $args['content'] = 'attachment';
    196197
    197198                if ( $_POST['attachment_start_date'] || $_POST['attachment_end_date'] ) {
    198199                    $args['start_date'] = sanitize_text_field( $_POST['attachment_start_date'] );
    199                     $args['end_date'] = sanitize_text_field( $_POST['attachment_end_date'] );
    200                 }
    201             }
    202             else {
    203                 $args['content'] = sanitize_text_field ( $_POST['content'] );
    204             }
    205             if( isset( $_POST['include_media'] ) &&  $_POST['include_media'] == 1 ){
     200                    $args['end_date']   = sanitize_text_field( $_POST['attachment_end_date'] );
     201                }
     202            } else {
     203                $args['content'] = sanitize_text_field( $_POST['content'] );
     204            }
     205            if ( isset( $_POST['include_media'] ) && $_POST['include_media'] == 1 ) {
    206206                $args['include_media'] = 1;
    207207            }
    208             if( isset( $_POST['widgets_data'] ) &&  $_POST['widgets_data'] == 1 ){
     208            if ( isset( $_POST['widgets_data'] ) && $_POST['widgets_data'] == 1 ) {
    209209                $args['widgets_data'] = 1;
    210210            }
    211             if( isset( $_POST['options_data'] ) &&  $_POST['options_data'] == 1 ){
     211            if ( isset( $_POST['options_data'] ) && $_POST['options_data'] == 1 ) {
    212212                $args['options_data'] = 1;
    213213            }
  • advanced-export/trunk/admin/function-create-zip.php

    r2328319 r2519583  
    55 * @since    1.0.0
    66 */
    7 if( !function_exists( 'advanced_export_create_zip') ){
     7if ( ! function_exists( 'advanced_export_create_zip' ) ) {
    88    function advanced_export_create_zip( $source, $wp_filesystem ) {
    99
    1010        /*Check if Zip Extension Installed*/
    11         if( !class_exists( 'ZipArchive')){
    12             die( esc_html__( 'ZIP extension is not installed, please install ZIP extension on your host or contact to your hosting provider and try again!','advanced-export') );
    13         }
    14 
    15         $zip = new ZipArchive;
    16         $zip_filename = esc_attr( get_option('template') ).'-data';
     11        if ( ! class_exists( 'ZipArchive' ) ) {
     12            die( esc_html__( 'ZIP extension is not installed, please install ZIP extension on your host or contact to your hosting provider and try again!', 'advanced-export' ) );
     13        }
     14
     15        $zip          = new ZipArchive;
     16        $zip_filename = esc_attr( get_option( 'template' ) ) . '-data';
    1717        $zip->open( $zip_filename, ZipArchive::CREATE && ZipArchive::OVERWRITE );
    1818
     
    2020        https://stackoverflow.com/questions/4914750/how-to-zip-a-whole-folder-using-php */
    2121        $files = new RecursiveIteratorIterator(
    22             new RecursiveDirectoryIterator($source),
     22            new RecursiveDirectoryIterator( $source ),
    2323            RecursiveIteratorIterator::LEAVES_ONLY
    2424        );
    2525        foreach ( $files as $name => $file ) {
    2626            /*Skip directories (they would be added automatically)*/
    27             if ( !$file->isDir() ) {
     27            if ( ! $file->isDir() ) {
    2828                /*Get real and relative path for current file*/
    29                 $filePath = $file->getRealPath();
    30                 $relativePath = substr($filePath, strlen($source));
     29                $filePath     = $file->getRealPath();
     30                $relativePath = substr( $filePath, strlen( $source ) );
    3131
    3232                /*Add current file/directory to archive*/
    33                 $zip->addFile( $filePath, $relativePath);
     33                $zip->addFile( $filePath, $relativePath );
    3434            }
    3535        }
     
    4141
    4242        /*delete temp zip files*/
    43         $wp_filesystem->rmdir($zip_filename, true );
    44         $wp_filesystem->rmdir($source, true );
     43        $wp_filesystem->rmdir( $zip_filename, true );
     44        $wp_filesystem->rmdir( $source, true );
    4545        die();
    4646    }
     
    5252 * @since    1.0.0
    5353 */
    54 if( !function_exists( 'advanced_export_create_data_files') ){
    55     function advanced_export_create_data_files( $form_args ){
    56 
    57         $defaults = array(
     54if ( ! function_exists( 'advanced_export_create_data_files' ) ) {
     55    function advanced_export_create_data_files( $form_args ) {
     56
     57        $defaults  = array(
    5858            'content'       => 'all',
    5959            'author'        => false,
     
    6464            'include_media' => false,
    6565            'widgets_data'  => false,
    66             'options_data'  => false
     66            'options_data'  => false,
    6767        );
    6868        $form_args = wp_parse_args( $form_args, $defaults );
     
    7676        WP_Filesystem();
    7777        global $wp_filesystem;
    78         if ( !file_exists( ADVANCED_EXPORT_TEMP ) ) {
    79             $wp_filesystem->mkdir(ADVANCED_EXPORT_TEMP);
    80         }
    81         if( 1 == $form_args['include_media'] ){
    82             if ( !file_exists( ADVANCED_EXPORT_TEMP_UPLOADS ) ) {
    83                 $wp_filesystem->mkdir(ADVANCED_EXPORT_TEMP_UPLOADS);
    84             }
    85         }
     78        if ( ! file_exists( ADVANCED_EXPORT_TEMP ) ) {
     79            $wp_filesystem->mkdir( ADVANCED_EXPORT_TEMP );
     80        }
     81        if ( 1 == $form_args['include_media'] ) {
     82            if ( ! file_exists( ADVANCED_EXPORT_TEMP_UPLOADS ) ) {
     83                $wp_filesystem->mkdir( ADVANCED_EXPORT_TEMP_UPLOADS );
     84            }
     85        }
    8686
    8787        /*default post types*/
     
    9090        if ( 'all' != $form_args['content'] && post_type_exists( $form_args['content'] ) ) {
    9191            $post_type_object = get_post_type_object( $form_args['content'] );
    92             if ( $post_type_object->can_export ){
     92            if ( $post_type_object->can_export ) {
    9393                $post_types = array( $form_args['content'] );
    9494            }
    95         }
    96         else {
     95        } else {
    9796            $post_types = get_post_types( array( 'can_export' => true ) );
    9897        }
     
    101100
    102101        /*ignore post type*/
    103         $ignore_post_types = apply_filters('advanced_export_ignore_post_types',array( 'revision') );
     102        $ignore_post_types = apply_filters( 'advanced_export_ignore_post_types', array( 'revision' ) );
    104103        foreach ( $post_types as $post_type ) {
    105104
     
    109108            }
    110109            /*default args*/
    111             $args = array( 'post_type' => $post_type, 'posts_per_page' => - 1 );
     110            $args = array(
     111                'post_type'      => $post_type,
     112                'posts_per_page' => - 1,
     113            );
    112114
    113115            /*setting post status*/
    114             if ( $form_args['status'] && ( 'post' == $post_type || 'page' == $post_type ) ){
     116            if ( $form_args['status'] && ( 'post' == $post_type || 'page' == $post_type ) ) {
    115117                $args['post_status'] = $form_args['status'];
    116             }
    117             else{
     118            } else {
    118119                $args['post_status'] = 'any';
    119120            }
     
    128129            /*setting date and author*/
    129130            if ( 'post' == $post_type || 'page' == $post_type || 'attachment' == $post_type ) {
    130                 if ( $form_args['author'] ){
     131                if ( $form_args['author'] ) {
    131132                    $args['author'] = $form_args['post_author'];
    132133                }
    133                 if ( $form_args['start_date'] &&  $form_args['end_date'] ) {
     134                if ( $form_args['start_date'] && $form_args['end_date'] ) {
    134135                    $args['date_query'] = array(
    135136                        'after'     => $form_args['start_date'],
     
    150151            if ( $object && isset( $object->labels->name ) && ! empty( $object->labels->name ) ) {
    151152                $type_title = $object->labels->name;
    152             }
    153             else {
     153            } else {
    154154                $type_title = ucwords( $post_type );
    155155            }
     
    165165
    166166                /*copy save images in exported folder if include media*/
    167                 if( 1 == $form_args['include_media'] && $post_type == 'attachment' ){
     167                if ( 1 == $form_args['include_media'] && $post_type == 'attachment' ) {
    168168                    $file = get_attached_file( $single_post_data->ID );
    169169                    if ( is_file( $file ) ) {
    170170                        if ( is_dir( ADVANCED_EXPORT_TEMP_UPLOADS ) ) {
    171                             copy( $file, ADVANCED_EXPORT_TEMP_UPLOADS. basename( $file ) );
     171                            copy( $file, ADVANCED_EXPORT_TEMP_UPLOADS . basename( $file ) );
    172172                        }
    173173                    }
     
    178178                foreach ( $taxonomies as $taxonomy ) {
    179179                    $terms_data[ $taxonomy ] = wp_get_post_terms( $single_post_data->ID, $taxonomy, array( 'fields' => 'all' ) );
    180                     if( $terms_data[$taxonomy] ){
    181                         foreach( $terms_data[$taxonomy] as $tax_id => $single_term ){
    182                             if( !empty( $single_term->term_id ) ) {
    183                                 $terms_data[ $taxonomy ][ $tax_id ] -> meta = get_term_meta( $single_term->term_id );
    184                                 if( !empty( $terms_data[ $taxonomy ][ $tax_id ] -> meta ) ){
    185                                     foreach( $terms_data[ $taxonomy ][ $tax_id ] -> meta as $key=>$val ){
    186                                         if( is_array( $val ) && count( $val ) == 1 && isset($val[0] ) ){
    187                                             $terms_data[ $taxonomy ][ $tax_id ] -> meta[$key] = $val[0];
     180                    if ( $terms_data[ $taxonomy ] ) {
     181                        foreach ( $terms_data[ $taxonomy ] as $tax_id => $single_term ) {
     182                            if ( ! empty( $single_term->term_id ) ) {
     183                                $terms_data[ $taxonomy ][ $tax_id ]->meta = get_term_meta( $single_term->term_id );
     184                                if ( ! empty( $terms_data[ $taxonomy ][ $tax_id ]->meta ) ) {
     185                                    foreach ( $terms_data[ $taxonomy ][ $tax_id ]->meta as $key => $val ) {
     186                                        if ( is_array( $val ) && count( $val ) == 1 && isset( $val[0] ) ) {
     187                                            $terms_data[ $taxonomy ][ $tax_id ]->meta[ $key ] = $val[0];
    188188                                        }
    189189                                    }
     
    209209                    'post_mime_type' => $single_post_data->post_mime_type,
    210210                    'meta'           => $post_meta_data,
    211                     'terms'          => $terms_data
     211                    'terms'          => $terms_data,
    212212                );
    213213            }
     
    218218        if ( $attachment ) {
    219219            unset( $content_data['attachment'] );
    220             $content_data =  array('attachment' => $attachment ) + $content_data;
    221         }
    222         /*Put post 3nd last*/
    223         $post = isset( $content_data['post'] ) ? $content_data['post'] : array();
    224         if ( $post ) {
    225             unset( $content_data['post'] );
    226             $content_data['post'] = $post;
    227         }
    228         /*Put page 2nd last*/
    229         $page = isset( $content_data['page'] ) ? $content_data['page'] : array();
    230         if ( $page ) {
    231             unset( $content_data['page'] );
    232             $content_data['page'] = $page;
    233         }
    234         /*Put nav last*/
     220            $content_data = array( 'attachment' => $attachment ) + $content_data;
     221        }
     222        /*Put post 3nd last*/
     223        $post = isset( $content_data['post'] ) ? $content_data['post'] : array();
     224        if ( $post ) {
     225            unset( $content_data['post'] );
     226            $content_data['post'] = $post;
     227        }
     228        /*Put page 2nd last*/
     229        $page = isset( $content_data['page'] ) ? $content_data['page'] : array();
     230        if ( $page ) {
     231            unset( $content_data['page'] );
     232            $content_data['page'] = $page;
     233        }
     234        /*Put nav last*/
    235235        $nav = isset( $content_data['nav_menu_item'] ) ? $content_data['nav_menu_item'] : array();
    236236        if ( $nav ) {
     
    240240
    241241        /*export widget settings.*/
    242         if( 1 == $form_args['widgets_data'] ){
     242        if ( 1 == $form_args['widgets_data'] ) {
    243243            $sidebars_widgets = get_option( 'sidebars_widgets' );
    244             $widget_data   = array();
     244            $widget_data      = array();
    245245            foreach ( $sidebars_widgets as $sidebar_name => $widgets ) {
    246246                if ( is_array( $widgets ) ) {
    247247                    foreach ( $widgets as $widget_name ) {
    248                         $widget_name_strip                    = preg_replace( '#-\d+$#', '', $widget_name );
     248                        $widget_name_strip                 = preg_replace( '#-\d+$#', '', $widget_name );
    249249                        $widget_data[ $widget_name_strip ] = get_option( 'widget_' . $widget_name_strip );
    250250                    }
     
    254254
    255255        /*export options and nav*/
    256         if( 1 == $form_args['options_data'] ){
     256        if ( 1 == $form_args['options_data'] ) {
    257257            /*nav menu data*/
    258             $menus    = get_terms( 'nav_menu' );
     258            $menus           = get_terms( 'nav_menu' );
    259259            $theme_locations = get_nav_menu_locations();
    260             $menu_data = array();
     260            $menu_data       = array();
    261261            foreach ( $menus as $menu ) {
    262                 foreach ( $theme_locations as $key => $theme_location ){
    263                     if( $menu->term_id == $theme_location ){
    264                         $menu_data[$key] = $menu->term_id;
     262                foreach ( $theme_locations as $key => $theme_location ) {
     263                    if ( $menu->term_id == $theme_location ) {
     264                        $menu_data[ $key ] = $menu->term_id;
    265265                    }
    266266                }
     
    268268
    269269            /*get all options*/
    270             $all_options = wp_load_alloptions();
    271             $theme_mode = 'theme_mods_'.get_option('template');
    272             $options_data = array();
     270            $all_options    = wp_load_alloptions();
     271            $theme_mode     = 'theme_mods_' . get_option( 'template' );
     272            $options_data   = array();
    273273            $needed_options = array(
    274274                'blogname',
     
    297297                'show_on_front',
    298298                'page_for_posts',
    299                 $theme_mode
     299                $theme_mode,
    300300            );
    301             $needed_options = apply_filters('advanced_export_include_options',$needed_options );
    302 
    303             foreach ( $all_options as $name => $value ) {
    304                 if( apply_filters('advanced_export_all_options',false ) ){
    305                     $options_data[ $name ] = maybe_unserialize( $value );
    306                     $options_data[ $name . '-child' ] = maybe_unserialize( $value );
    307                 }
    308                 else if ( in_array( $name, $needed_options )) {
    309                     $options_data[ $name ] = maybe_unserialize( $value );
     301            if ( is_child_theme() ) {
     302                $needed_options[] = 'theme_mods_' . get_option( 'stylesheet' );
     303            }
     304
     305            /*For Gutentor.*/
     306            if ( function_exists( 'run_gutentor' ) ) {
     307                $args       = array(
     308                    'orderby'    => 'id',
     309                    'hide_empty' => 0,
     310                );
     311                $categories = get_categories( $args );
     312                if ( $categories ) {
     313                    foreach ( $categories as $category_list ) {
     314                        $needed_options[] = 'gutentor-cat-' . $category_list->term_id;
     315                    }
     316                }
     317            }
     318
     319            $needed_options = apply_filters( 'advanced_export_include_options', $needed_options );
     320
     321            foreach ( $all_options as $name => $value ) {
     322                if ( apply_filters( 'advanced_export_all_options', false ) ) {
     323                    $options_data[ $name ]            = maybe_unserialize( $value );
    310324                    $options_data[ $name . '-child' ] = maybe_unserialize( $value );
    311                 }
    312                 if( $name == $theme_mode ){
     325                } elseif ( in_array( $name, $needed_options ) ) {
     326                    $options_data[ $name ]            = maybe_unserialize( $value );
     327                    $options_data[ $name . '-child' ] = maybe_unserialize( $value );
     328                }
     329                if ( $name == $theme_mode ) {
    313330                    unset( $options_data[ $name ]['nav_menu_locations'] );
    314331                }
     
    320337
    321338            /*content*/
    322             $wp_filesystem->put_contents( ADVANCED_EXPORT_TEMP . 'content.json' , json_encode( $content_data ) );
     339            $wp_filesystem->put_contents( ADVANCED_EXPORT_TEMP . 'content.json', json_encode( $content_data ) );
    323340
    324341            /*widgets*/
    325             if( 1 == $form_args['widgets_data'] ){
     342            if ( 1 == $form_args['widgets_data'] ) {
    326343                $combine_widgets_data = array();
    327                 if( !empty( $sidebars_widgets) ){
     344                if ( ! empty( $sidebars_widgets ) ) {
    328345                    $combine_widgets_data['widget_positions'] = $sidebars_widgets;
    329346                }
    330                 if( !empty( $widget_data ) ){
     347                if ( ! empty( $widget_data ) ) {
    331348                    $combine_widgets_data['widget_options'] = $widget_data;
    332349                }
    333                 $wp_filesystem->put_contents( ADVANCED_EXPORT_TEMP . 'widgets.json' , json_encode( $combine_widgets_data ) );
     350                $wp_filesystem->put_contents( ADVANCED_EXPORT_TEMP . 'widgets.json', json_encode( $combine_widgets_data ) );
    334351            }
    335352
    336353            /*options/customizer*/
    337             if( 1 == $form_args['options_data'] ){
     354            if ( 1 == $form_args['options_data'] ) {
    338355                $combine_options_data = array();
    339                 if( !empty( $menu_data ) ){
     356                if ( ! empty( $menu_data ) ) {
    340357                    $combine_options_data['menu'] = $menu_data;
    341358                }
    342                 if( !empty( $options_data ) ){
     359                if ( ! empty( $options_data ) ) {
    343360                    $combine_options_data['options'] = $options_data;
    344361                }
    345                 $wp_filesystem->put_contents( ADVANCED_EXPORT_TEMP . 'options.json' , json_encode( $combine_options_data ) );
    346             }
    347         }
    348         advanced_export_create_zip( ADVANCED_EXPORT_TEMP, $wp_filesystem);
     362                $wp_filesystem->put_contents( ADVANCED_EXPORT_TEMP . 'options.json', json_encode( $combine_options_data ) );
     363            }
     364        }
     365        advanced_export_create_zip( ADVANCED_EXPORT_TEMP, $wp_filesystem );
    349366    }
    350367}
    351 if( !function_exists( 'advanced_export_ziparchive') ){
    352     function advanced_export_ziparchive( $form_args ){
     368if ( ! function_exists( 'advanced_export_ziparchive' ) ) {
     369    function advanced_export_ziparchive( $form_args ) {
    353370        advanced_export_create_data_files( $form_args );
    354371    }
  • advanced-export/trunk/admin/function-form-load.php

    r2159845 r2519583  
    66 */
    77global $wpdb, $wp_locale;
    8 if( !function_exists( 'advanced_export_date_options') ){
     8if ( ! function_exists( 'advanced_export_date_options' ) ) {
    99    function advanced_export_date_options( $post_type = 'post' ) {
    1010        global $wpdb, $wp_locale;
    1111
    12         $months = $wpdb->get_results( $wpdb->prepare( "
     12        $months = $wpdb->get_results(
     13            $wpdb->prepare(
     14                "
    1315        SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
    1416        FROM $wpdb->posts
    1517        WHERE post_type = %s AND post_status != 'auto-draft'
    1618        ORDER BY post_date DESC
    17     ", $post_type ) );
     19    ",
     20                $post_type
     21            )
     22        );
    1823
    1924        $month_count = count( $months );
    20         if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
     25        if ( ! $month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
    2126            return;
     27        }
    2228
    2329        foreach ( $months as $date ) {
    24             if ( 0 == $date->year )
     30            if ( 0 == $date->year ) {
    2531                continue;
     32            }
    2633
    2734            $month = zeroise( $date->month, 2 );
    28             echo '<option value="' . esc_attr( $date->year ) . '-' . esc_attr($month  ) . '">' . esc_attr( $wp_locale->get_month( $month ) ) . ' ' . esc_attr( $date->year  ). '</option>';
     35            echo '<option value="' . esc_attr( $date->year ) . '-' . esc_attr( $month ) . '">' . esc_attr( $wp_locale->get_month( $month ) ) . ' ' . esc_attr( $date->year ) . '</option>';
    2936        }
    3037    }
    3138}
    3239
    33 function advanced_export_form(){
     40function advanced_export_form() {
    3441    global $wpdb, $wp_locale;
    3542    ?>
    3643    <div class="wrap">
    37         <h1><?php esc_html_e('Export Zip','advanced-export'); ?></h1>
    38 
    39         <p><?php esc_html_e('When you click the button below Plugin will create a Zip file to save to your computer.','advanced-export'); ?></p>
    40         <p><?php esc_html_e('Once you&#8217;ve saved the download zip file, you can use the Import function in another WordPress installation to import the content from this site.','advanced-export'); ?></p>
    41 
    42         <h2><?php esc_html_e('Choose what to export','advanced-export'); ?></h2>
     44        <h1><?php esc_html_e( 'Export Zip', 'advanced-export' ); ?></h1>
     45
     46        <p><?php esc_html_e( 'When you click the button below Plugin will create a Zip file to save to your computer.', 'advanced-export' ); ?></p>
     47        <p><?php esc_html_e( 'Once you&#8217;ve saved the download zip file, you can use the Import function in another WordPress installation to import the content from this site.', 'advanced-export' ); ?></p>
     48
     49        <h2><?php esc_html_e( 'Choose what to export', 'advanced-export' ); ?></h2>
    4350        <form method="post" id="advanced-export-filters" action="">
    4451            <?php
    4552            wp_nonce_field( 'advanced-export' );
    4653            ?>
    47             <legend class="screen-reader-text"><?php esc_html_e('Content to export','advanced-export'); ?></legend>
     54            <legend class="screen-reader-text"><?php esc_html_e( 'Content to export', 'advanced-export' ); ?></legend>
    4855            <fieldset class="single-item">
    4956                <input type="hidden" name="advanced-export-download" value="true" />
    50                 <p><label><input type="radio" name="content" value="all" checked="checked" aria-describedby="all-content-desc" /><?php esc_html_e('All content','advanced-export'); ?></label></p>
     57                <p><label><input type="radio" name="content" value="all" checked="checked" aria-describedby="all-content-desc" /><?php esc_html_e( 'All content', 'advanced-export' ); ?></label></p>
    5158                <p class="description" id="all-content-desc">
    52                     <?php esc_html_e('This will contain all of your posts, pages, comments, custom fields, terms, navigation menus, and custom posts.','advanced-export'); ?>
     59                    <?php esc_html_e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus, and custom posts.', 'advanced-export' ); ?>
    5360                </p>
    5461
    55                 <p><label><input type="radio" name="content" value="posts" /> <?php esc_html_e('Posts','advanced-export'); ?></label></p>
     62                <p><label><input type="radio" name="content" value="posts" /> <?php esc_html_e( 'Posts', 'advanced-export' ); ?></label></p>
    5663                <ul id="post-filters" class="advanced-export-filters">
    5764                    <li>
    5865                        <label><span class="label-responsive"><?php _e( 'Categories:' ); ?></span>
    59                             <?php wp_dropdown_categories( array( 'show_option_all' => esc_html__('All','advanced-export') ) ); ?>
     66                            <?php wp_dropdown_categories( array( 'show_option_all' => esc_html__( 'All', 'advanced-export' ) ) ); ?>
    6067                        </label>
    6168                    </li>
    6269                    <li>
    63                         <label><span class="label-responsive"><?php esc_html_e( 'Authors:' ,'advanced-export'); ?></span>
     70                        <label><span class="label-responsive"><?php esc_html_e( 'Authors:', 'advanced-export' ); ?></span>
    6471                            <?php
    6572                            $authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'" );
    66                             wp_dropdown_users( array(
    67                                 'include' => $authors,
    68                                 'name' => 'post_author',
    69                                 'multi' => true,
    70                                 'show_option_all' => esc_html__( 'All' ,'advanced-export'),
    71                                 'show' => 'display_name_with_login',
    72                             ) ); ?>
     73                            wp_dropdown_users(
     74                                array(
     75                                    'include'         => $authors,
     76                                    'name'            => 'post_author',
     77                                    'multi'           => true,
     78                                    'show_option_all' => esc_html__( 'All', 'advanced-export' ),
     79                                    'show'            => 'display_name_with_login',
     80                                )
     81                            );
     82                            ?>
    7383                        </label>
    7484                    </li>
    7585                    <li>
    7686                        <fieldset>
    77                             <legend class="screen-reader-text"><?php esc_html_e( 'Date range:','advanced-export' ); ?></legend>
    78                             <label for="post-start-date" class="label-responsive"><?php esc_html_e( 'Start date:','advanced-export' ); ?></label>
     87                            <legend class="screen-reader-text"><?php esc_html_e( 'Date range:', 'advanced-export' ); ?></legend>
     88                            <label for="post-start-date" class="label-responsive"><?php esc_html_e( 'Start date:', 'advanced-export' ); ?></label>
    7989                            <select name="post_start_date" id="post-start-date">
    80                                 <option value="0"><?php esc_html_e( '&mdash; Select &mdash;','advanced-export' ); ?></option>
     90                                <option value="0"><?php esc_html_e( '&mdash; Select &mdash;', 'advanced-export' ); ?></option>
    8191                                <?php advanced_export_date_options(); ?>
    8292                            </select>
    83                             <label for="post-end-date" class="label-responsive"><?php esc_html_e( 'End date:','advanced-export' ); ?></label>
     93                            <label for="post-end-date" class="label-responsive"><?php esc_html_e( 'End date:', 'advanced-export' ); ?></label>
    8494                            <select name="post_end_date" id="post-end-date">
    85                                 <option value="0"><?php esc_html_e( '&mdash; Select &mdash;','advanced-export' ); ?></option>
     95                                <option value="0"><?php esc_html_e( '&mdash; Select &mdash;', 'advanced-export' ); ?></option>
    8696                                <?php advanced_export_date_options(); ?>
    8797                            </select>
     
    8999                    </li>
    90100                    <li>
    91                         <label for="post-status" class="label-responsive"><?php esc_html_e( 'Status:','advanced-export'); ?></label>
     101                        <label for="post-status" class="label-responsive"><?php esc_html_e( 'Status:', 'advanced-export' ); ?></label>
    92102                        <select name="post_status" id="post-status">
    93                             <option value="0"><?php esc_html_e( 'All','advanced-export' ); ?></option>
    94                             <?php $post_stati = get_post_stati( array( 'internal' => false ), 'objects' );
    95                             foreach ( $post_stati as $status ) : ?>
     103                            <option value="0"><?php esc_html_e( 'All', 'advanced-export' ); ?></option>
     104                            <?php
     105                            $post_stati = get_post_stati( array( 'internal' => false ), 'objects' );
     106                            foreach ( $post_stati as $status ) :
     107                                ?>
    96108                                <option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
    97109                            <?php endforeach; ?>
     
    100112                </ul>
    101113
    102                 <p><label><input type="radio" name="content" value="pages" /> <?php esc_html_e( 'Pages','advanced-export' ); ?></label></p>
     114                <p><label><input type="radio" name="content" value="pages" /> <?php esc_html_e( 'Pages', 'advanced-export' ); ?></label></p>
    103115                <ul id="page-filters" class="advanced-export-filters">
    104116                    <li>
    105                         <label><span class="label-responsive"><?php esc_html_e( 'Authors:','advanced-export' ); ?></span>
     117                        <label><span class="label-responsive"><?php esc_html_e( 'Authors:', 'advanced-export' ); ?></span>
    106118                            <?php
    107119                            $authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'" );
    108                             wp_dropdown_users( array(
    109                                 'include' => $authors,
    110                                 'name' => 'page_author',
    111                                 'multi' => true,
    112                                 'show_option_all' =>esc_html__( 'All' ,'advanced-export'),
    113                                 'show' => 'display_name_with_login',
    114                             ) ); ?>
     120                            wp_dropdown_users(
     121                                array(
     122                                    'include'         => $authors,
     123                                    'name'            => 'page_author',
     124                                    'multi'           => true,
     125                                    'show_option_all' => esc_html__( 'All', 'advanced-export' ),
     126                                    'show'            => 'display_name_with_login',
     127                                )
     128                            );
     129                            ?>
    115130                        </label>
    116131                    </li>
    117132                    <li>
    118133                        <fieldset>
    119                             <legend class="screen-reader-text"><?php esc_html_e( 'Date range:','advanced-export' ); ?></legend>
    120                             <label for="page-start-date" class="label-responsive"><?php esc_html_e( 'Start date:' ,'advanced-export'); ?></label>
     134                            <legend class="screen-reader-text"><?php esc_html_e( 'Date range:', 'advanced-export' ); ?></legend>
     135                            <label for="page-start-date" class="label-responsive"><?php esc_html_e( 'Start date:', 'advanced-export' ); ?></label>
    121136                            <select name="page_start_date" id="page-start-date">
    122                                 <option value="0"><?php esc_html_e( '&mdash; Select &mdash;','advanced-export' ); ?></option>
     137                                <option value="0"><?php esc_html_e( '&mdash; Select &mdash;', 'advanced-export' ); ?></option>
    123138                                <?php advanced_export_date_options( 'page' ); ?>
    124139                            </select>
    125                             <label for="page-end-date" class="label-responsive"><?php esc_html_e( 'End date:','advanced-export' ); ?></label>
     140                            <label for="page-end-date" class="label-responsive"><?php esc_html_e( 'End date:', 'advanced-export' ); ?></label>
    126141                            <select name="page_end_date" id="page-end-date">
    127                                 <option value="0"><?php esc_html_e( '&mdash; Select &mdash;','advanced-export' ); ?></option>
     142                                <option value="0"><?php esc_html_e( '&mdash; Select &mdash;', 'advanced-export' ); ?></option>
    128143                                <?php advanced_export_date_options( 'page' ); ?>
    129144                            </select>
     
    131146                    </li>
    132147                    <li>
    133                         <label for="page-status" class="label-responsive"><?php esc_html_e( 'Status:','advanced-export' ); ?></label>
     148                        <label for="page-status" class="label-responsive"><?php esc_html_e( 'Status:', 'advanced-export' ); ?></label>
    134149                        <select name="page_status" id="page-status">
    135                             <option value="0"><?php esc_html_e( 'All' ,'advanced-export'); ?></option>
     150                            <option value="0"><?php esc_html_e( 'All', 'advanced-export' ); ?></option>
    136151                            <?php foreach ( $post_stati as $status ) : ?>
    137152                                <option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
     
    141156                </ul>
    142157
    143                 <?php foreach ( get_post_types( array( '_builtin' => false, 'can_export' => true ), 'objects' ) as $post_type ) : ?>
     158                <?php
     159                foreach ( get_post_types(
     160                    array(
     161                        '_builtin'   => false,
     162                        'can_export' => true,
     163                    ),
     164                    'objects'
     165                ) as $post_type ) :
     166                    ?>
    144167                    <p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p>
    145168                <?php endforeach; ?>
    146169
    147                 <p><label><input type="radio" name="content" value="attachment" /> <?php esc_html_e( 'Media','advanced-export' ); ?></label></p>
     170                <p><label><input type="radio" name="content" value="attachment" /> <?php esc_html_e( 'Media', 'advanced-export' ); ?></label></p>
    148171                <ul id="attachment-filters" class="advanced-export-filters">
    149172                    <li>
    150173                        <fieldset>
    151                             <legend class="screen-reader-text"><?php esc_html_e( 'Date range:','advanced-export' ); ?></legend>
    152                             <label for="attachment-start-date" class="label-responsive"><?php esc_html_e( 'Start date:','advanced-export' ); ?></label>
     174                            <legend class="screen-reader-text"><?php esc_html_e( 'Date range:', 'advanced-export' ); ?></legend>
     175                            <label for="attachment-start-date" class="label-responsive"><?php esc_html_e( 'Start date:', 'advanced-export' ); ?></label>
    153176                            <select name="attachment_start_date" id="attachment-start-date">
    154                                 <option value="0"><?php esc_html_e( '&mdash; Select &mdash;','advanced-export' ); ?></option>
     177                                <option value="0"><?php esc_html_e( '&mdash; Select &mdash;', 'advanced-export' ); ?></option>
    155178                                <?php advanced_export_date_options( 'attachment' ); ?>
    156179                            </select>
    157                             <label for="attachment-end-date" class="label-responsive"><?php esc_html_e( 'End date:','advanced-export' ); ?></label>
     180                            <label for="attachment-end-date" class="label-responsive"><?php esc_html_e( 'End date:', 'advanced-export' ); ?></label>
    158181                            <select name="attachment_end_date" id="attachment-end-date">
    159                                 <option value="0"><?php esc_html_e( '&mdash; Select &mdash;','advanced-export' ); ?></option>
     182                                <option value="0"><?php esc_html_e( '&mdash; Select &mdash;', 'advanced-export' ); ?></option>
    160183                                <?php advanced_export_date_options( 'attachment' ); ?>
    161184                            </select>
     
    167190            <fieldset class="single-item">
    168191                <input type="checkbox" name="widgets_data" id="widgets_data" value="1" checked>
    169                 <label for="widgets_data" class="label-responsive"><?php esc_html_e( 'Widget Data','advanced-export' ); ?></label>
     192                <label for="widgets_data" class="label-responsive"><?php esc_html_e( 'Widget Data', 'advanced-export' ); ?></label>
    170193            </fieldset>
    171194            <fieldset class="single-item">
    172195                <input type="checkbox" id="options_data" name="options_data" value="1" checked>
    173                 <label for="options_data" class="label-responsive"><?php esc_html_e( 'Customizer/Options Data','advanced-export' ); ?></label>
    174             </fieldset>
    175             <fieldset class="single-item">
    176                 <input type="checkbox" name="include_media" id="include_media" value="1">
    177                 <label for="include_media" class="label-responsive"><?php esc_html_e( 'Include Media' ,'advanced-export'); ?></label>
    178             </fieldset>
     196                <label for="options_data" class="label-responsive"><?php esc_html_e( 'Customizer/Options Data', 'advanced-export' ); ?></label>
     197            </fieldset>
     198            <fieldset class="single-item">
     199                <input type="checkbox" name="include_media" id="include_media" value="1">
     200                <label for="include_media" class="label-responsive"><?php esc_html_e( 'Include Media', 'advanced-export' ); ?></label>
     201            </fieldset>
    179202            <?php
    180203            do_action( 'advanced_export_form' );
    181             submit_button( esc_html__('Download Export File','advanced-export') );
     204            submit_button( esc_html__( 'Download Export File', 'advanced-export' ) );
    182205            ?>
    183206        </form>
  • advanced-export/trunk/advanced-export.php

    r2328319 r2519583  
    1515 * Plugin URI:        https://addonspress.com/item/advanced-export
    1616 * Description:       Advanced Export with Options to Export Widget, Customizer and Media Files
    17  * Version:           1.0.3
     17 * Version:           1.0.4
    1818 * Author:            AddonsPress
    1919 * Author URI:        https://addonspress.com/
     
    2525
    2626/*Define Constants for this plugin*/
    27 define( 'ADVANCED_EXPORT_VERSION', '1.0.3' );
     27define( 'ADVANCED_EXPORT_VERSION', '1.0.4' );
    2828define( 'ADVANCED_EXPORT_PATH', plugin_dir_path( __FILE__ ) );
    2929define( 'ADVANCED_EXPORT_URL', plugin_dir_url( __FILE__ ) );
    3030
    31 $upload_dir = wp_upload_dir();
    32 $advanced_export_temp = $upload_dir['basedir'] . '/advanced-export-temp/';
    33 $advanced_export_temp_uploads =  $advanced_export_temp . '/uploads/';
     31$upload_dir                   = wp_upload_dir();
     32$advanced_export_temp         = $upload_dir['basedir'] . '/advanced-export-temp/';
     33$advanced_export_temp_uploads = $advanced_export_temp . '/uploads/';
    3434
    3535define( 'ADVANCED_EXPORT_TEMP', $advanced_export_temp );
  • advanced-export/trunk/includes/class-advanced-export-activator.php

    r2159845 r2519583  
    3333
    3434    }
    35 
    3635}
  • advanced-export/trunk/includes/class-advanced-export-deactivator.php

    r2159845 r2519583  
    3333
    3434    }
    35 
    3635}
  • advanced-export/trunk/includes/class-advanced-export-i18n.php

    r2159845 r2519583  
    4040            dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
    4141        );
    42 
    4342    }
    4443}
  • advanced-export/trunk/includes/class-advanced-export.php

    r2159845 r2519583  
    130130    private function setup_globals() {
    131131
    132         $this->version = defined('ADVANCED_EXPORT_VERSION')?ADVANCED_EXPORT_VERSION:'1.0.0';
     132        $this->version     = defined( 'ADVANCED_EXPORT_VERSION' ) ? ADVANCED_EXPORT_VERSION : '1.0.0';
    133133        $this->plugin_name = 'advanced-export';
    134        
     134
    135135        //The array of actions and filters registered with this plugins.
    136136        $this->actions = array();
     
    138138
    139139        // Misc
    140         $this->domain         = 'advanced-export';      // Unique identifier for retrieving translated strings
    141         $this->errors         = new WP_Error(); // errors
     140        $this->domain = 'advanced-export';      // Unique identifier for retrieving translated strings
     141        $this->errors = new WP_Error(); // errors
    142142    }
    143143
     
    216216        $this->loader->add_action( 'admin_enqueue_scripts', $this->admin, 'enqueue_scripts' );
    217217        $this->loader->add_action( 'admin_menu', $this->admin, 'export_menu' );
    218         $this->loader->add_action( 'admin_init', $this->admin, 'export_content',1 );
     218        $this->loader->add_action( 'admin_init', $this->admin, 'export_content', 1 );
    219219        $this->loader->add_action( 'wp_ajax_advanced_export_ajax_form_load', $this->admin, 'form_load' );
    220220    }
  • advanced-export/trunk/readme.txt

    r2328319 r2519583  
    55Tags: export, advanced export, demo export, theme export, widget export, customizer export
    66Requires at least: 4.5
    7 Tested up to: 5.4.2
     7Tested up to: 5.7.1
    88Requires PHP: 5.6.20
    9 Stable tag: 1.0.3
     9Stable tag: 1.0.4
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    118118== Changelog ==
    119119
     120= 1.0.4 - 2021-04-22 =
     121* Updated : PHPCS
     122
    120123= 1.0.3 - 2020-06-22 =
    121124* Updated : Export post types order
Note: See TracChangeset for help on using the changeset viewer.