@@ -133,7 +133,7 @@ public function __construct($config = [])
133133 /**
134134 * Sets the storage directory.
135135 *
136- * The storage directory will contain the WordPress media files organized
136+ * The storage directory will contain the Source media files organized
137137 * in their original folder structure (e.g., 2024/01/image.jpg).
138138 *
139139 * @param string $dir The directory name (e.g., 'imports', 'custom', etc.).
@@ -276,9 +276,9 @@ protected function extractImageUrls(string $content): array
276276 }
277277
278278 // Match standard WordPress uploads URLs
279- preg_match_all ('/https?:\/\/[^\/]+\/wp-content\/uploads\/[^\s" \'<>]+\.(jpg|jpeg|png|gif|webp)/i ' , $ content , $ wpMatches );
280- if (!empty ($ wpMatches [0 ])) {
281- $ imageUrls = array_merge ($ imageUrls , $ wpMatches [0 ]);
279+ preg_match_all ('/https?:\/\/[^\/]+\/wp-content\/uploads\/[^\s" \'<>]+\.(jpg|jpeg|png|gif|webp)/i ' , $ content , $ urlMatches );
280+ if (!empty ($ urlMatches [0 ])) {
281+ $ imageUrls = array_merge ($ imageUrls , $ urlMatches [0 ]);
282282 }
283283
284284 // Match direct uploads folder URLs
@@ -310,22 +310,22 @@ protected function downloadAndProcessImage(string $imageUrl): ?string
310310 $ uploadPath = $ parsedUrl ['path ' ];
311311
312312 // Check for different WordPress upload path patterns
313- $ isWordPressUpload = false ;
313+ $ isSourceUpload = false ;
314314 $ relativePath = '' ;
315315
316316 if (strpos ($ uploadPath , '/wp-content/uploads/ ' ) !== false ) {
317317 // Standard WordPress structure: /wp-content/uploads/...
318- $ isWordPressUpload = true ;
318+ $ isSourceUpload = true ;
319319 preg_match ('/.*\/wp-content\/uploads\/(.+)$/ ' , $ uploadPath , $ matches );
320320 $ relativePath = $ matches [1 ] ?? '' ;
321321 } elseif (strpos ($ uploadPath , '/uploads/ ' ) !== false ) {
322322 // Direct uploads folder: /uploads/...
323- $ isWordPressUpload = true ;
323+ $ isSourceUpload = true ;
324324 preg_match ('/.*\/uploads\/(.+)$/ ' , $ uploadPath , $ matches );
325325 $ relativePath = $ matches [1 ] ?? '' ;
326326 }
327327
328- if (!$ isWordPressUpload || empty ($ relativePath )) {
328+ if (!$ isSourceUpload || empty ($ relativePath )) {
329329 $ this ->app ->enqueueMessage ("Not a WordPress upload path: $ uploadPath " , 'warning ' );
330330 return null ;
331331 }
@@ -609,7 +609,7 @@ protected function autoDetectDocumentRoot(): void
609609
610610 foreach ($ testScenarios as [$ root , $ contentPath ]) {
611611 $ canAccess = false ;
612- $ hasWordPressContent = false ;
612+ $ hasSourceContent = false ;
613613
614614 if ($ this ->connectionType === 'sftp ' && $ this ->sftpConnection ) {
615615 try {
@@ -621,13 +621,13 @@ protected function autoDetectDocumentRoot(): void
621621
622622 // Check for WordPress content structure
623623 if ($ this ->sftpConnection ->is_dir ($ checkPath )) {
624- $ hasWordPressContent = true ;
624+ $ hasSourceContent = true ;
625625
626626 // For wp-content, also check for uploads subdirectory
627627 if ($ contentPath === 'wp-content ' ) {
628628 $ uploadsPath = $ checkPath . '/uploads ' ;
629629 if ($ this ->sftpConnection ->is_dir ($ uploadsPath )) {
630- $ hasWordPressContent = true ;
630+ $ hasSourceContent = true ;
631631 }
632632 }
633633 }
@@ -644,12 +644,12 @@ protected function autoDetectDocumentRoot(): void
644644
645645 // Check for WordPress content structure
646646 if (@ftp_chdir ($ this ->ftpConnection , $ contentPath )) {
647- $ hasWordPressContent = true ;
647+ $ hasSourceContent = true ;
648648
649649 // For wp-content, also check for uploads subdirectory
650650 if ($ contentPath === 'wp-content ' ) {
651651 if (@ftp_chdir ($ this ->ftpConnection , 'uploads ' )) {
652- $ hasWordPressContent = true ;
652+ $ hasSourceContent = true ;
653653 // Return to wp-content
654654 @ftp_chdir ($ this ->ftpConnection , '.. ' );
655655 }
@@ -667,7 +667,7 @@ protected function autoDetectDocumentRoot(): void
667667 }
668668 }
669669
670- if ($ canAccess && $ hasWordPressContent ) {
670+ if ($ canAccess && $ hasSourceContent ) {
671671 $ this ->documentRoot = $ root ?: '. ' ;
672672 $ this ->documentRootDetected = true ;
673673
@@ -924,7 +924,7 @@ protected function processZipUpload(array $config): bool
924924 // Extract individual file to handle path structure better
925925 $ fileData = $ zip ->getFromIndex ($ i );
926926 if ($ fileData !== false ) {
927- // Handle WordPress uploads folder structure
927+ // Handle Source uploads folder structure
928928 $ relativePath = $ this ->normalizeUploadPath ($ filename );
929929 $ targetPath = $ extractPath . $ relativePath ;
930930
@@ -976,7 +976,7 @@ protected function processContentForZipUpload(string $content, array $imageUrls)
976976
977977 foreach ($ imageUrls as $ originalUrl ) {
978978 try {
979- // Extract the file path from the WordPress URL
979+ // Extract the file path from the Source URL
980980 // Typical WordPress URL: http://example.com/wp-content/uploads/2024/01/image.jpg
981981 $ newUrl = $ this ->findExtractedImageUrl ($ originalUrl );
982982 if ($ newUrl ) {
@@ -1124,9 +1124,9 @@ protected function disconnectSftp(): void
11241124 *
11251125 * @since 1.0.0
11261126 */
1127- public function getPlannedJoomlaUrl (string $ wordpressUrl ): ?string
1127+ public function getPlannedJoomlaUrl (string $ sourceUrl ): ?string
11281128 {
1129- $ parsedUrl = parse_url ($ wordpressUrl );
1129+ $ parsedUrl = parse_url ($ sourceUrl );
11301130 if (!$ parsedUrl || empty ($ parsedUrl ['path ' ])) {
11311131 return null ;
11321132 }
@@ -1287,22 +1287,22 @@ protected function prepareDownloadPaths(string $imageUrl): array
12871287 $ uploadPath = $ parsedUrl ['path ' ];
12881288
12891289 // Check for different WordPress upload path patterns
1290- $ isWordPressUpload = false ;
1290+ $ isSourceUpload = false ;
12911291 $ relativePath = '' ;
12921292
12931293 if (strpos ($ uploadPath , '/wp-content/uploads/ ' ) !== false ) {
12941294 // Standard WordPress structure: /wp-content/uploads/...
1295- $ isWordPressUpload = true ;
1295+ $ isSourceUpload = true ;
12961296 preg_match ('/.*\/wp-content\/uploads\/(.+)$/ ' , $ uploadPath , $ matches );
12971297 $ relativePath = $ matches [1 ] ?? '' ;
12981298 } elseif (strpos ($ uploadPath , '/uploads/ ' ) !== false ) {
12991299 // Direct uploads folder: /uploads/...
1300- $ isWordPressUpload = true ;
1300+ $ isSourceUpload = true ;
13011301 preg_match ('/.*\/uploads\/(.+)$/ ' , $ uploadPath , $ matches );
13021302 $ relativePath = $ matches [1 ] ?? '' ;
13031303 }
13041304
1305- if (!$ isWordPressUpload || empty ($ relativePath )) {
1305+ if (!$ isSourceUpload || empty ($ relativePath )) {
13061306 return [];
13071307 }
13081308
@@ -1757,9 +1757,9 @@ protected function normalizeUploadPath(string $zipPath): string
17571757 *
17581758 * @since 1.0.0
17591759 */
1760- public function getExpectedLocalPath (string $ wordpressUrl ): ?string
1760+ public function getExpectedLocalPath (string $ sourceUrl ): ?string
17611761 {
1762- $ parsedUrl = parse_url ($ wordpressUrl );
1762+ $ parsedUrl = parse_url ($ sourceUrl );
17631763 if (!$ parsedUrl || empty ($ parsedUrl ['path ' ])) {
17641764 return null ;
17651765 }
0 commit comments