Changeset 3051995
- Timestamp:
- 03/16/2024 12:43:56 AM (2 years ago)
- Location:
- emogics-tarot-reader-for-wp
- Files:
-
- 5 edited
-
assets/blueprint.json (modified) (1 diff)
-
tags/0.8.0/inc/EmogicTarotReader_Activator.php (modified) (5 diffs)
-
tags/0.8.0/inc/EmogicTarotReader_Deactivator.php (modified) (1 diff)
-
trunk/inc/EmogicTarotReader_Activator.php (modified) (5 diffs)
-
trunk/inc/EmogicTarotReader_Deactivator.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
emogics-tarot-reader-for-wp/assets/blueprint.json
r3051205 r3051995 1 1 { 2 "landingPage": "\/wp-admin\/ edit.php",2 "landingPage": "\/wp-admin\/plugins.php", 3 3 "preferredVersions": { 4 "php": " 7.4",5 "wp": " 5.9"4 "php": "8.0", 5 "wp": "latest" 6 6 }, 7 7 "phpExtensionBundles": [ 8 8 "kitchen-sink" 9 9 ], 10 "features": { 11 "networking": true 12 }, 10 13 "steps": [ 14 { 15 "step": "installPlugin", 16 "pluginZipFile": { 17 "resource": "url", 18 "url": "https:\/\/downloads.wordpress.org\/plugin\/emogics-tarot-reader-for-wp.0.8.0.zip" 19 }, 20 "options": { 21 "activate": true 22 } 23 }, 11 24 { 12 25 "step": "login", -
emogics-tarot-reader-for-wp/tags/0.8.0/inc/EmogicTarotReader_Activator.php
r3049406 r3051995 11 11 class EmogicTarotReader_Activator{ 12 12 13 public static function activate(){ 13 public static function activate(){ 14 14 self::read_and_create_pages(); 15 15 self::images_to_media_library(); … … 81 81 82 82 public static function images_to_media_library(){ 83 $deactivate_media_array = array(); 84 $from = EMOGIC_TAROT_PLUGIN_PATH . "images /";85 $to = get_home_path() . "wp-content/uploads/" .EMOGIC_TAROT_PLUGIN_MEDIA_FOLDER . "/";86 83 $deactivate_media_array = array(); 84 $from = EMOGIC_TAROT_PLUGIN_PATH . "images"; 85 $to = ABSPATH . "wp-content/uploads/" .EMOGIC_TAROT_PLUGIN_MEDIA_FOLDER ; 86 87 87 @mkdir($to, 0755); //create dest dir 88 88 self::recursive_copy($from , $to , $deactivate_media_array); //copy files … … 90 90 } 91 91 92 public static function recursive_copy($src , $dst , &$deactivate_media_array) { //$src and $dst must have lagging slashes93 $dir = opendir($src); 92 public static function recursive_copy($src , $dst , &$deactivate_media_array) { //$src and $dst do not have lagging slashes 93 $dir = opendir($src); 94 94 @mkdir($dst); 95 95 while(false !== ( $file = readdir($dir)) ) { 96 96 if (( $file != '.' ) && ( $file != '..' )) { 97 if ( is_dir($src . $file) ) {98 self::recursive_copy($src . $file . '/' , $dst . $file . '/' , $deactivate_media_array);97 if ( is_dir($src . '/' . $file) ) { 98 self::recursive_copy($src . '/' . $file, $dst . '/' . $file , $deactivate_media_array ); 99 99 } 100 else {101 copy($src . $file , $dst. $file);102 self::copy_image_to_media_library($dst . $file , $file , $deactivate_media_array);100 if ( is_file($src . '/' . $file) ) { 101 copy($src . '/' . $file , $dst . '/' . $file); 102 self::copy_image_to_media_library($dst . '/' . $file , $file , $deactivate_media_array); 103 103 } 104 104 } … … 110 110 $artdata = array( 111 111 'post_author' => 1, 112 //'post_date' => current_time('mysql'),113 //'post_date_gmt' => current_time('mysql'),114 112 'post_title' => $filename, 115 //'post_status' => 'inherit',116 113 'comment_status' => 'closed', 117 114 'ping_status' => 'closed', … … 120 117 'post_parent' => 0, 121 118 'post_type' => 'attachment', 122 //'guid' => $siteurl.'/'.$artDir.$new_filename,123 119 'guid' => $file_path, 124 'post_mime_type' => mime_content_type( $file_path ),120 'post_mime_type' => 'image/jpg', 125 121 'post_excerpt' => $filename, 126 122 'post_content' => $filename, 127 123 'size' => filesize( $file_path ), 128 124 ); 129 $attach_id = wp_insert_attachment( $artdata , $file_path , 0);125 $attach_id = wp_insert_attachment( $artdata , $file_path , 0); 130 126 131 127 //generate metadata and thumbnails 132 if ($attach_data = wp_generate_attachment_metadata( $attach_id ,$file_path)) {133 wp_update_attachment_metadata($attach_id , $attach_data);128 if ($attach_data = wp_generate_attachment_metadata( $attach_id , $file_path)) { 129 wp_update_attachment_metadata($attach_id , $attach_data); 134 130 } 135 131 array_push( $deactivate_media_array , $attach_id ); -
emogics-tarot-reader-for-wp/tags/0.8.0/inc/EmogicTarotReader_Deactivator.php
r3049406 r3051995 28 28 if( WP_Filesystem() ){ 29 29 global $wp_filesystem; 30 $image_folder = get_home_path(). "wp-content/uploads/" .EMOGIC_TAROT_PLUGIN_MEDIA_FOLDER . "/";30 $image_folder = ABSPATH . "wp-content/uploads/" .EMOGIC_TAROT_PLUGIN_MEDIA_FOLDER . "/"; 31 31 $wp_filesystem->rmdir($image_folder, true); 32 32 } -
emogics-tarot-reader-for-wp/trunk/inc/EmogicTarotReader_Activator.php
r3049406 r3051995 11 11 class EmogicTarotReader_Activator{ 12 12 13 public static function activate(){ 13 public static function activate(){ 14 14 self::read_and_create_pages(); 15 15 self::images_to_media_library(); … … 81 81 82 82 public static function images_to_media_library(){ 83 $deactivate_media_array = array(); 84 $from = EMOGIC_TAROT_PLUGIN_PATH . "images /";85 $to = get_home_path() . "wp-content/uploads/" .EMOGIC_TAROT_PLUGIN_MEDIA_FOLDER . "/";86 83 $deactivate_media_array = array(); 84 $from = EMOGIC_TAROT_PLUGIN_PATH . "images"; 85 $to = ABSPATH . "wp-content/uploads/" .EMOGIC_TAROT_PLUGIN_MEDIA_FOLDER ; 86 87 87 @mkdir($to, 0755); //create dest dir 88 88 self::recursive_copy($from , $to , $deactivate_media_array); //copy files … … 90 90 } 91 91 92 public static function recursive_copy($src , $dst , &$deactivate_media_array) { //$src and $dst must have lagging slashes93 $dir = opendir($src); 92 public static function recursive_copy($src , $dst , &$deactivate_media_array) { //$src and $dst do not have lagging slashes 93 $dir = opendir($src); 94 94 @mkdir($dst); 95 95 while(false !== ( $file = readdir($dir)) ) { 96 96 if (( $file != '.' ) && ( $file != '..' )) { 97 if ( is_dir($src . $file) ) {98 self::recursive_copy($src . $file . '/' , $dst . $file . '/' , $deactivate_media_array);97 if ( is_dir($src . '/' . $file) ) { 98 self::recursive_copy($src . '/' . $file, $dst . '/' . $file , $deactivate_media_array ); 99 99 } 100 else {101 copy($src . $file , $dst. $file);102 self::copy_image_to_media_library($dst . $file , $file , $deactivate_media_array);100 if ( is_file($src . '/' . $file) ) { 101 copy($src . '/' . $file , $dst . '/' . $file); 102 self::copy_image_to_media_library($dst . '/' . $file , $file , $deactivate_media_array); 103 103 } 104 104 } … … 110 110 $artdata = array( 111 111 'post_author' => 1, 112 //'post_date' => current_time('mysql'),113 //'post_date_gmt' => current_time('mysql'),114 112 'post_title' => $filename, 115 //'post_status' => 'inherit',116 113 'comment_status' => 'closed', 117 114 'ping_status' => 'closed', … … 120 117 'post_parent' => 0, 121 118 'post_type' => 'attachment', 122 //'guid' => $siteurl.'/'.$artDir.$new_filename,123 119 'guid' => $file_path, 124 'post_mime_type' => mime_content_type( $file_path ),120 'post_mime_type' => 'image/jpg', 125 121 'post_excerpt' => $filename, 126 122 'post_content' => $filename, 127 123 'size' => filesize( $file_path ), 128 124 ); 129 $attach_id = wp_insert_attachment( $artdata , $file_path , 0);125 $attach_id = wp_insert_attachment( $artdata , $file_path , 0); 130 126 131 127 //generate metadata and thumbnails 132 if ($attach_data = wp_generate_attachment_metadata( $attach_id ,$file_path)) {133 wp_update_attachment_metadata($attach_id , $attach_data);128 if ($attach_data = wp_generate_attachment_metadata( $attach_id , $file_path)) { 129 wp_update_attachment_metadata($attach_id , $attach_data); 134 130 } 135 131 array_push( $deactivate_media_array , $attach_id ); -
emogics-tarot-reader-for-wp/trunk/inc/EmogicTarotReader_Deactivator.php
r3049406 r3051995 28 28 if( WP_Filesystem() ){ 29 29 global $wp_filesystem; 30 $image_folder = get_home_path(). "wp-content/uploads/" .EMOGIC_TAROT_PLUGIN_MEDIA_FOLDER . "/";30 $image_folder = ABSPATH . "wp-content/uploads/" .EMOGIC_TAROT_PLUGIN_MEDIA_FOLDER . "/"; 31 31 $wp_filesystem->rmdir($image_folder, true); 32 32 }
Note: See TracChangeset
for help on using the changeset viewer.