Plugin Directory

Changeset 1989442


Ignore:
Timestamp:
12/08/2018 06:51:13 PM (7 years ago)
Author:
nillc
Message:

Added support for Gutenberg editor

Location:
transform/trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • transform/trunk/css/nxf_transform.css

    r1923800 r1989442  
    1515.nxf-instance-select {
    1616    width: 540px;
     17}
     18
     19.nxf-instance-form {
     20    text-align: center;
     21    font-family: sans-serif;
    1722}
    1823
  • transform/trunk/lib/nxf_dashboard.php

    r1923800 r1989442  
    3636            add_action( 'admin_init',  array( 'NXF_Dashboard', 'transform_deactivate_license' ) );
    3737            add_action( 'admin_enqueue_scripts', array( 'NXF_Dashboard', 'transform_enqueue_styles' ) );
     38            add_action( 'init', array( 'NXF_Dashboard', 'transform_block' ) );
    3839        }
    3940       
     
    325326       
    326327        public static function transform_media_buttons() {
    327             //wp_enqueue_script('jquery-ui-dialog');
     328            wp_enqueue_script('jquery-ui-dialog');
    328329            wp_enqueue_style( 'wp-jquery-ui-dialog' );
    329330            wp_enqueue_style( 'nxfTransformStylesheet' );
    330331           
    331             print '<a href="#" id="insert-transform-media" class="button">' . __( 'Add a Transform', 'nxf-transform' ) . '</a><div id="nxf-dialog"></div>';
     332            print '<a href="#" id="insert-transform-media" class="button">' . __( 'Add a Transform', 'nxf-transform' ) . '</a>';
    332333        }
    333334       
     
    627628            exit;
    628629        }
     630
     631        public static function transform_block() {
     632            if ( ! function_exists( 'register_block_type' ) ) {
     633                // Gutenberg is not active.
     634                return;
     635            }
     636
     637            wp_register_script(
     638                'nxf-transform',
     639                /* plugins_url( 'js/block.js', __FILE__ ), */
     640                plugins_url( 'js/block.js', plugin_dir_path( __FILE__ ) ),
     641                array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor', 'underscore' ),
     642                filemtime( plugin_dir_path( __DIR__ ) . 'js/block.js' )
     643            );
     644
     645            register_block_type( 'nxf-transform/instance-insert', array(
     646                'script' => 'nxf-transform',
     647                'attributes' => array(
     648                    'instance' => array(
     649                        'type' => 'string'
     650                    ),
     651                ),
     652                'render_callback' => array( 'NXF_Transform', 'render_shortcode' ),
     653            ) );
     654           
     655            error_log("NXF: finished with register block type");
     656
     657            $nxf_dashboard_model = new NXF_Dashboard_Model( 'instancelist' );
     658
     659            wp_add_inline_script(
     660                'nxf-transform',
     661                sprintf(
     662                    'var nxf_transform = { model: ' . json_encode( $nxf_dashboard_model ) . ' };',
     663                    json_encode( wp_set_script_translations( 'nxf-transform', 'nxf-transform' ) )
     664                ),
     665                'before'
     666            );
     667        }
    629668    }
    630669}
    631 
  • transform/trunk/lib/nxf_transform.php

    r1923800 r1989442  
    1313            require_once( "$dir/nxf_dashboard.php" );
    1414           
    15             $nxf_dashboard = new NXF_Dashboard;
     15            $nxf_dashboard = new NXF_Dashboard();
    1616           
    1717            if ( !is_admin() ) {
     
    3939            return NXF_Transform_View::render( $transform );
    4040        }
     41       
     42        public static function render_shortcode( $atts ) {
     43            if ( $atts{'instance'} == '' ) { return ''; }
     44           
     45            $content = NXF_Transform::transform_feed( $atts );
     46            return $content;
     47        }
    4148    }
    4249}
  • transform/trunk/readme.txt

    r1923800 r1989442  
    11=== Transform ===
    22Contributors: nillc
    3 Tags: transform, json, xml, dust, xslt, data, transformation, integration
     3Tags: transform, json, xml, dust, xslt, data, transformation, integration, MVC, controller
    44Requires at least: 4.6
    5 Tested up to: 4.9
     5Tested up to: 54.9
    66Stable tag: trunk
    77Requires PHP: 5.6
     
    1010Donate link: https://netinnovationsllc.com/
    1111
    12 Transform reads URL or file JSON/XML data feeds and converts those feeds to HTML using Dust or XSLT.
     12Transform reads URL or file JSON/XML data feeds and converts those feeds to HTML using Dust or XSLT, acting as a controller in an MVC architecture.
    1313
    1414== Description ==
    1515
    16 Transform is a WordPress plugin that reads JSON or XML* feeds and transforms the feeds to HTML using display templates written in Dust (for JSON) or XSLT (for XML). Feeds and displays can be URLs to pages on the local or a remote web server, a path to a file on the site’s web server or static text in the WordPress database.
     16Transform is a WordPress plugin that reads JSON or XML* feeds and transforms the feeds to HTML using display templates written in Dust (for JSON) or XSLT (for XML). Feeds and displays can be URLs to pages on the local or a remote web server, a path to a file on the site’s web server or static text in the WordPress database. The plugin is the controller in an MVC environment.
    1717
    1818* Transforming XML feeds requires XSLT support in PHP (see http://php.net/manual/en/xsl.installation.php).
     
    4747== Changelog ==
    4848
     49= 1.4 =
     50* Added support for the Gutenberg editor
     51
    4952= 1.3 =
    5053* UI improvements when Ajax work is being done
    51 * Another change.
     54* Minor bug fix to selecting instances
    5255
    5356= 1.2 =
     
    6265== Upgrade Notice ==
    6366
    64 = 1.3 =
     67= 1.4 =
    6568Latest version of Transform
  • transform/trunk/transform.php

    r1923800 r1989442  
    77 * @license   GPL-2.0+
    88 * @link      http://wordpress.org/plugins/transform
    9  * @copyright 2014-2017 Net Innovations LLC - all rights reserved
     9 * @copyright 2014-2018 Net Innovations LLC - all rights reserved
    1010 *
    1111 * @wordpress-plugin
     
    1313 * Plugin URI:        http://wordpress.org/plugins/transform
    1414 * Description:       Transform data feeds to HTML using the Dust or XSLT transformation language
    15  * Version:           1.3.0
     15 * Version:           1.4.0
    1616 * Author:            Net Innovations LLC
    1717 * Author URI:        keith@netinnovationsllc.com
Note: See TracChangeset for help on using the changeset viewer.