public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/import.php
/**
		 * Import a course using the specified XML filename. Returns no errors if it worked correctly.
		 *
		 * @param String $xmlFileName The name of the file to import.
		 *
		 * @return Array An array containing 'errors' with a list of errors, and 'course_id' of the newly created course ID.
		 */
Import a course using the specified XML filename. Returns no errors if it worked correctly.
@param String $xmlFileName The name of the file to import.

@return Array An array containing 'errors' with a list of errors, and 'course_id' of the newly created course ID.
Import a course using the specified XML filename . Returns no errors if it worked correctly . @param String $xmlFileName The name of the file to import . @return Array An array containing ' errors ' with a list of errors and ' course_id ' of the newly created course ID .
public static function importTrainingCourseFromXML( $xmlFileName ) {
			$errorList = array();
			libxml_use_internal_errors( true );
			$xml = simplexml_load_file( $xmlFileName );
			$newCourseID     = false;
			$newCoursePostID = false;
			if ( ! $xml ) {
				foreach ( libxml_get_errors() as $error ) {
					$errorList[] = sprintf( __( 'Line %d, Column %d, Error: %s', 'wp-courseware' ), $error->line, $error->column, $error->message );
				}
			} 
			else {
				$import = new WPCW_Import( $xml );
				$errorList = $import->importCourseIntoDatabase();
				if ( ! $errorList ) {
					$newCourseID     = $import->getNewCourseID();
					$newCoursePostID = $import->getNewCoursePostID();
				}
			}
			if ( count( $errorList ) == 0 ) {
				$errorList = false;
			}
			return array(
				'errors'         => $errorList,
				'course_id'      => $newCourseID,
				'course_post_id' => $newCoursePostID,
			);
		}
public static function importTrainingCourseFromXML ( $ xmlFileName ) { $ errorList = array ( ) ; libxml_use_internal_errors ( true ) ; $ xml = simplexml_load_file ( $ xmlFileName ) ; $ newCourseID = false ; $ newCoursePostID = false ; if ( ! $ xml ) { foreach ( libxml_get_errors ( ) as $ error ) { $ errorList [ ] = sprintf ( __ ( 'Line %d, Column %d, Error: %s' , 'wp-courseware' ) , $ error -> line , $ error -> column , $ error -> message ) ; } } else { $ import = new WPCW_Import ( $ xml ) ; $ errorList = $ import -> importCourseIntoDatabase ( ) ; if ( ! $ errorList ) { $ newCourseID = $ import -> getNewCourseID ( ) ; $ newCoursePostID = $ import -> getNewCoursePostID ( ) ; } } if ( count ( $ errorList ) == 0 ) { $ errorList = false ; } return array ( 'errors' => $ errorList , 'course_id' => $ newCourseID , 'course_post_id' => $ newCoursePostID , ) ; }
Import a course using the specified XML filename.
Import a course using the specified XML filename .
// Replaced with actual ID of newly created course. // Error loading XML file, store errors and return them. // No problems loading XML // At some point, might pass back errors from here. // Return false if no errors, for easier error checking // Return details back to code for processing