Plugin Directory

Changeset 3051995


Ignore:
Timestamp:
03/16/2024 12:43:56 AM (2 years ago)
Author:
vpelss
Message:

playground ready

Location:
emogics-tarot-reader-for-wp
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • emogics-tarot-reader-for-wp/assets/blueprint.json

    r3051205 r3051995  
    11{
    2     "landingPage": "\/wp-admin\/edit.php",
     2    "landingPage": "\/wp-admin\/plugins.php",
    33    "preferredVersions": {
    4         "php": "7.4",
    5         "wp": "5.9"
     4        "php": "8.0",
     5        "wp": "latest"
    66    },
    77    "phpExtensionBundles": [
    88        "kitchen-sink"
    99    ],
     10    "features": {
     11        "networking": true
     12    },
    1013    "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        },
    1124        {
    1225            "step": "login",
  • emogics-tarot-reader-for-wp/tags/0.8.0/inc/EmogicTarotReader_Activator.php

    r3049406 r3051995  
    1111class EmogicTarotReader_Activator{
    1212   
    13     public static function activate(){
     13    public static function activate(){ 
    1414        self::read_and_create_pages();
    1515        self::images_to_media_library();
     
    8181   
    8282    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               
    8787        @mkdir($to, 0755); //create dest dir
    8888        self::recursive_copy($from , $to , $deactivate_media_array); //copy files       
     
    9090    }
    9191   
    92     public static function recursive_copy($src , $dst , &$deactivate_media_array) { //$src and $dst must have lagging slashes
    93         $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);
    9494        @mkdir($dst);
    9595        while(false !== ( $file = readdir($dir)) ) {
    9696            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 );
    9999                }
    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);
    103103                }
    104104            }
     
    110110            $artdata = array(
    111111                'post_author' => 1,
    112                 //'post_date' => current_time('mysql'),
    113                 //'post_date_gmt' => current_time('mysql'),
    114112                'post_title' => $filename,
    115                 //'post_status' => 'inherit',
    116113                'comment_status' => 'closed',
    117114                'ping_status' => 'closed',
     
    120117                'post_parent' => 0,
    121118                'post_type' => 'attachment',
    122                 //'guid' => $siteurl.'/'.$artDir.$new_filename,
    123119                'guid' => $file_path,
    124                 'post_mime_type' => mime_content_type( $file_path ),
     120                'post_mime_type' => 'image/jpg',
    125121                'post_excerpt' => $filename,
    126122                'post_content' => $filename,
    127123                'size'     => filesize( $file_path ),
    128124            );
    129             $attach_id = wp_insert_attachment( $artdata, $file_path , 0);
     125            $attach_id = wp_insert_attachment( $artdata , $file_path , 0);
    130126   
    131127            //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);
    134130            }
    135131            array_push( $deactivate_media_array , $attach_id );
  • emogics-tarot-reader-for-wp/tags/0.8.0/inc/EmogicTarotReader_Deactivator.php

    r3049406 r3051995  
    2828        if( WP_Filesystem() ){
    2929            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 . "/";
    3131            $wp_filesystem->rmdir($image_folder, true);
    3232        }
  • emogics-tarot-reader-for-wp/trunk/inc/EmogicTarotReader_Activator.php

    r3049406 r3051995  
    1111class EmogicTarotReader_Activator{
    1212   
    13     public static function activate(){
     13    public static function activate(){ 
    1414        self::read_and_create_pages();
    1515        self::images_to_media_library();
     
    8181   
    8282    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               
    8787        @mkdir($to, 0755); //create dest dir
    8888        self::recursive_copy($from , $to , $deactivate_media_array); //copy files       
     
    9090    }
    9191   
    92     public static function recursive_copy($src , $dst , &$deactivate_media_array) { //$src and $dst must have lagging slashes
    93         $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);
    9494        @mkdir($dst);
    9595        while(false !== ( $file = readdir($dir)) ) {
    9696            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 );
    9999                }
    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);
    103103                }
    104104            }
     
    110110            $artdata = array(
    111111                'post_author' => 1,
    112                 //'post_date' => current_time('mysql'),
    113                 //'post_date_gmt' => current_time('mysql'),
    114112                'post_title' => $filename,
    115                 //'post_status' => 'inherit',
    116113                'comment_status' => 'closed',
    117114                'ping_status' => 'closed',
     
    120117                'post_parent' => 0,
    121118                'post_type' => 'attachment',
    122                 //'guid' => $siteurl.'/'.$artDir.$new_filename,
    123119                'guid' => $file_path,
    124                 'post_mime_type' => mime_content_type( $file_path ),
     120                'post_mime_type' => 'image/jpg',
    125121                'post_excerpt' => $filename,
    126122                'post_content' => $filename,
    127123                'size'     => filesize( $file_path ),
    128124            );
    129             $attach_id = wp_insert_attachment( $artdata, $file_path , 0);
     125            $attach_id = wp_insert_attachment( $artdata , $file_path , 0);
    130126   
    131127            //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);
    134130            }
    135131            array_push( $deactivate_media_array , $attach_id );
  • emogics-tarot-reader-for-wp/trunk/inc/EmogicTarotReader_Deactivator.php

    r3049406 r3051995  
    2828        if( WP_Filesystem() ){
    2929            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 . "/";
    3131            $wp_filesystem->rmdir($image_folder, true);
    3232        }
Note: See TracChangeset for help on using the changeset viewer.