Plugin Directory

Changeset 2020451


Ignore:
Timestamp:
01/28/2019 01:39:31 PM (7 years ago)
Author:
frontkom
Message:

Release version 1.1.3

Location:
cloud-blocks
Files:
1 deleted
3 edited
43 copied

Legend:

Unmodified
Added
Removed
  • cloud-blocks/tags/1.1.3/core/Blocks/Blocks.php

    r2007547 r2020451  
    2828    add_action( 'wp_ajax_fgc_local_blocks', array( $this, 'local_blocks' ) );
    2929    add_action( 'wp_ajax_nopriv_fgc_local_blocks', array( $this, 'local_blocks' ) );
    30    
    31     // add_action( 'init', array( $this, 'custom_blocks' ) );
    3230  }
    3331
     
    153151    );
    154152    wp_send_json_success( $response );
    155   }
    156 
    157   /**
    158    * Check for existence of custom blocks and load them.
    159    * Custom blocks can be uploaded to /wp-content/gutenberg-blocks/
    160    * They must follow file structure like:
    161    * -/block-dir/
    162    * --/style.css
    163    * --/script.js
    164    *
    165    * @since 1.0.0
    166    * @param
    167    * @return
    168    */
    169   public function custom_blocks() {
    170     // First we must make sure files.php loaded
    171     if ( ! function_exists( 'get_home_path' ) ) {
    172       include_once ABSPATH . '/wp-admin/includes/file.php';
    173     }
    174     // list all blocks (The sub-directory of /gutenberg-blocks/).
    175     $gutenberg_blocks_dir = wp_upload_dir()['basedir'] . '/gutenberg-blocks/';
    176     $gutenberg_blocks = list_files($gutenberg_blocks_dir, 1);
    177     // Then loop through blocks.
    178     foreach ($gutenberg_blocks as $block) {
    179       preg_match( '/([a-zA-Z-_]*(:?\/))$/i', $block, $block_name);
    180       $block_name = str_replace('/', '', $block_name);
    181       // And list js and css files.
    182       $block_files = list_files($block . 'build', 1);
    183 
    184       // Reset script and styles of the block
    185       $block_style = null;
    186       $editor_style = null;
    187       $block_script = null;
    188      
    189       // Extract block js and css files
    190       foreach ($block_files as $file) {
    191         if ( preg_match('/style.css$/i', $file) ) {
    192           preg_match( '/wp-content\/uploads\/gutenberg-blocks\/[a-zA-Z0-9-_\/.]*/i', $file, $block_style );
    193         }
    194         if ( preg_match('/editor.css$/i', $file) ) {
    195           preg_match( '/wp-content\/uploads\/gutenberg-blocks\/[a-zA-Z0-9-_\/.]*/i', $file, $editor_style );
    196         }
    197         if ( preg_match('/index.js$/i', $file) ) {
    198           preg_match( '/wp-content\/uploads\/gutenberg-blocks\/[a-zA-Z0-9-_\/.]*/i', $file, $block_script );
    199         }
    200       }
    201       global $pagenow;
    202       if ( ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) && isset( $block_script ) && !empty( $block_script ) ) {
    203         wp_enqueue_script( $block_name[0], '/' . $block_script[0], array( 'wp-editor', 'wp-blocks', 'wp-element', 'wp-i18n' ), FGC_VERSION, true);
    204       }
    205       if ( ( $pagenow == 'post-new.php' || $pagenow == 'post.php' || !is_admin() ) && isset( $block_style ) && !empty( $block_style ) ) {
    206         wp_enqueue_style( $block_name[0], '/' . $block_style[0], array(), FGC_VERSION);
    207         if ( isset( $editor_style ) && !empty( $editor_style ) && is_admin() ) {
    208           wp_enqueue_style( $block_name[0] . '-editor', '/' . $editor_style[0], array(), FGC_VERSION);
    209         }
    210       }
    211     }
    212153  }
    213154
  • cloud-blocks/tags/1.1.3/docs/changelog.md

    r2020434 r2020451  
    44* **Fix**: Fix some translations
    55* **Fix**: Fix database table issue if plugin network activated [issue #13](https://github.com/front/cloud-blocks/issues/13)
     6* **Cleanup**: Remove custom_blocks method since its not used anymore. This method was for scanning local blocks inside /wp-content/gutenberg-blocks directory
    67
    78#### 1.1.2
  • cloud-blocks/tags/1.1.3/readme.txt

    r2020434 r2020451  
    7979* Fix: Fix some translations
    8080* Fix: Fix database table issue if plugin network activated [issue #13](https://github.com/front/cloud-blocks/issues/13)
     81* Cleanup: Remove custom_blocks method since its not used anymore. This method was for scanning local blocks inside /wp-content/gutenberg-blocks directory
    8182
    8283= 1.1.2 =
  • cloud-blocks/trunk/core/Blocks/Blocks.php

    r2007547 r2020451  
    2828    add_action( 'wp_ajax_fgc_local_blocks', array( $this, 'local_blocks' ) );
    2929    add_action( 'wp_ajax_nopriv_fgc_local_blocks', array( $this, 'local_blocks' ) );
    30    
    31     // add_action( 'init', array( $this, 'custom_blocks' ) );
    3230  }
    3331
     
    153151    );
    154152    wp_send_json_success( $response );
    155   }
    156 
    157   /**
    158    * Check for existence of custom blocks and load them.
    159    * Custom blocks can be uploaded to /wp-content/gutenberg-blocks/
    160    * They must follow file structure like:
    161    * -/block-dir/
    162    * --/style.css
    163    * --/script.js
    164    *
    165    * @since 1.0.0
    166    * @param
    167    * @return
    168    */
    169   public function custom_blocks() {
    170     // First we must make sure files.php loaded
    171     if ( ! function_exists( 'get_home_path' ) ) {
    172       include_once ABSPATH . '/wp-admin/includes/file.php';
    173     }
    174     // list all blocks (The sub-directory of /gutenberg-blocks/).
    175     $gutenberg_blocks_dir = wp_upload_dir()['basedir'] . '/gutenberg-blocks/';
    176     $gutenberg_blocks = list_files($gutenberg_blocks_dir, 1);
    177     // Then loop through blocks.
    178     foreach ($gutenberg_blocks as $block) {
    179       preg_match( '/([a-zA-Z-_]*(:?\/))$/i', $block, $block_name);
    180       $block_name = str_replace('/', '', $block_name);
    181       // And list js and css files.
    182       $block_files = list_files($block . 'build', 1);
    183 
    184       // Reset script and styles of the block
    185       $block_style = null;
    186       $editor_style = null;
    187       $block_script = null;
    188      
    189       // Extract block js and css files
    190       foreach ($block_files as $file) {
    191         if ( preg_match('/style.css$/i', $file) ) {
    192           preg_match( '/wp-content\/uploads\/gutenberg-blocks\/[a-zA-Z0-9-_\/.]*/i', $file, $block_style );
    193         }
    194         if ( preg_match('/editor.css$/i', $file) ) {
    195           preg_match( '/wp-content\/uploads\/gutenberg-blocks\/[a-zA-Z0-9-_\/.]*/i', $file, $editor_style );
    196         }
    197         if ( preg_match('/index.js$/i', $file) ) {
    198           preg_match( '/wp-content\/uploads\/gutenberg-blocks\/[a-zA-Z0-9-_\/.]*/i', $file, $block_script );
    199         }
    200       }
    201       global $pagenow;
    202       if ( ( $pagenow == 'post-new.php' || $pagenow == 'post.php' ) && isset( $block_script ) && !empty( $block_script ) ) {
    203         wp_enqueue_script( $block_name[0], '/' . $block_script[0], array( 'wp-editor', 'wp-blocks', 'wp-element', 'wp-i18n' ), FGC_VERSION, true);
    204       }
    205       if ( ( $pagenow == 'post-new.php' || $pagenow == 'post.php' || !is_admin() ) && isset( $block_style ) && !empty( $block_style ) ) {
    206         wp_enqueue_style( $block_name[0], '/' . $block_style[0], array(), FGC_VERSION);
    207         if ( isset( $editor_style ) && !empty( $editor_style ) && is_admin() ) {
    208           wp_enqueue_style( $block_name[0] . '-editor', '/' . $editor_style[0], array(), FGC_VERSION);
    209         }
    210       }
    211     }
    212153  }
    213154
  • cloud-blocks/trunk/docs/changelog.md

    r2020434 r2020451  
    44* **Fix**: Fix some translations
    55* **Fix**: Fix database table issue if plugin network activated [issue #13](https://github.com/front/cloud-blocks/issues/13)
     6* **Cleanup**: Remove custom_blocks method since its not used anymore. This method was for scanning local blocks inside /wp-content/gutenberg-blocks directory
    67
    78#### 1.1.2
  • cloud-blocks/trunk/readme.txt

    r2020434 r2020451  
    7979* Fix: Fix some translations
    8080* Fix: Fix database table issue if plugin network activated [issue #13](https://github.com/front/cloud-blocks/issues/13)
     81* Cleanup: Remove custom_blocks method since its not used anymore. This method was for scanning local blocks inside /wp-content/gutenberg-blocks directory
    8182
    8283= 1.1.2 =
Note: See TracChangeset for help on using the changeset viewer.