Webcreations907 / WBC-Importer-extension

One click demo content importer extension for Reduxframework
GNU General Public License v2.0
66 stars 39 forks source link

Theme Check Errors #78

Open mtaddia opened 7 years ago

mtaddia commented 7 years ago

hi,

i am getting the following errors from theme check can someone please let me know how to fix this or if it's not fixable what do i tell ThemeForest reviewers when they see these errors?

WARNING: fopen was found in the file admin/redux-extensions/extensions/wbc_importer/inc/importer/parsers.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.

Line 415: $fp = $this->fopen( $file, 'r' );

Line 641: function fopen( $filename, $mode = 'r' ) {

Line 644: return fopen( $filename, $mode );

WARNING: file_get_contents was found in the file admin/redux-extensions/extensions/wbc_importer/inc/importer/radium-importer.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.

Line 263: $data = file_get_contents( $file );

Line 338: $data = file_get_contents( $file );

WARNING: file_get_contents was found in the file admin/redux-extensions/extensions/wbc_importer/inc/importer/parsers.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.

Line 66: $success = $dom->loadXML( file_get_contents( $file ) );

Line 269: if ( ! xml_parse( $xml, file_get_contents( $file ), true ) ) {

WARNING: fclose was found in the file admin/redux-extensions/extensions/wbc_importer/inc/importer/parsers.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls.

Line 464: $this->fclose($fp);

Line 659: function fclose( $fp ) {

Line 662: return fclose( $fp );

Webcreations907 commented 7 years ago

Hello,

It's best to place the extension into a plugin so that you don't have to worry about the theme check errors.

mtaddia commented 7 years ago

ok i tried moving it to my own plugin folder inside a folder called "extensions" but that doesnt seem to work.

Where should i place the files for this plugin- if i put it inside the "extensions" folder in the redux plugin like the instructions wont it get deleted if they update the plugin?

I would like to place it in its own plugin how do i do this and make sure it gets loaded by redux? Do i simply place the "wbc_importer" folder in a new folder and add a php file to include the plugin header info? Do i need to add any code to load the extension or will redux automatically find it in the plugin folder? Sorry this is my first theme and im confused any help would be greatly appreciated

mtaddia commented 7 years ago

so now the plugin doesnt work at all for some reason. I export the Wordpress xml file rename it and upload it as usual its larger than before but still should work. It just spins never imports the content. Other demos added with really tiny content.xml files seem to work but not the real demo files that i exported out of my current install of my theme. Do you know what could be causing this? Ive been struggling for hours any help would be appreciated.

mtaddia commented 7 years ago

yah it imported the menu and the theme settings but it wont import the sliders or the pages, posts, media, etc.

mtaddia commented 7 years ago

this is in my functions file

/**

if ( !function_exists( 'wbc_filter_title' ) ) { /**

add_filter( 'wbc_importer_directory_title', 'wbc_filter_title', 10 ); }

/**

if ( !function_exists( 'wbc_extended_example' ) ) { function wbc_extended_example( $demo_active_import , $demo_directory_path ) { reset( $demo_active_import ); $current_key = key( $demo_active_import ); /****

/**

// array of demos/homepages to check/select from

    $wbc_home_pages = array(
        'Events' => 'Home 2',
        'Corporate-Finance' => 'Home 2',
    );
    if ( isset( $demo_active_import[$current_key]['directory'] ) && !empty( $demo_active_import[$current_key]['directory'] ) && array_key_exists( $demo_active_import[$current_key]['directory'], $wbc_home_pages ) ) {
        $page = get_page_by_title( $wbc_home_pages[$demo_active_import[$current_key]['directory']] );
        if ( isset( $page->ID ) ) {
            update_option( 'page_on_front', $page->ID );
            update_option( 'show_on_front', 'page' );
        }
    }
}

add_action( 'wbc_importer_after_content_import', 'wbc_extended_example', 10, 2 );

}

mtaddia commented 7 years ago

could you please help me? I cant get the plugin to work now it just spins and doesnt import the content.xml or the sliders or the menus but it imports the widgets and theme options files.

I have spent hours and hours on this theme and would really really appreciate it if you could help me solve this problem with the plugin to get it working

mtaddia commented 7 years ago

i have my phprc file as follows upload_max_filesize = 300M post_max_size = 505M max_execution_time = 5000 max_input_time = 5000 max_input_vars = 100000 memory_limit = 128M

so i dont think it has to do with server load- as mentioned i had the pluginoriginally installed in the redux admin folder in my theme and was able to import multiple sliders and a 1.6mb content.xml file - now i can only import one slider the array i added to my functions file no longer works for loading more than one slider (any suggestions on my code above to make it load more than one slider?) and it doesnt load the content.xml file it just spins if i replace the content.xml file witha nothing file with no media it loads the widgets and content

so i dont know could it be permissions on the site's upload folder i am importing the content from or is there something different going on

i also still dontknow if i should install it as a separate plugin or drop it into the extensions folder of the redux plugin seems to load either way but which way do u suggest?

mtaddia commented 7 years ago

ok i redownloaded the plugin files and it works now- can u confirm for me though one thing-

should i add it in a sep plugin folder called wbc-importer and add this to the php file for the plugin? // All extensions placed within the extensions directory will be auto-loaded for your Redux instance. Redux::setExtensions( 'redux_builder_daylight', dirname( FILE ) . '/extensions/' );

is this the best wayt o do this?

ashawkat commented 7 years ago

@mtaddia how did you managed to import the menu & homepage settings. As I'm also getting issues like this one. Importing content but the menu & settings are not ok. Can you please let me know what you've done so that I can do that also.

paudelvinay commented 6 years ago

@ashawkat did you get chance to solve the issue? If so, please share. @mtaddia please share thw ay you have solved the issue.