Plugin Directory

Changeset 2384037


Ignore:
Timestamp:
09/17/2020 11:03:23 PM (5 years ago)
Author:
dottech
Message:

Version 1.0.6

Location:
dot-monetize-polls-quizzes/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • dot-monetize-polls-quizzes/trunk/dot-press.php

    r2383212 r2384037  
    33 * Plugin Name:       DOT | Monetize Polls & Quizzes
    44 * Description:      The easiest way to create and publish interactive polls and quizzes. Fully integrated monetization and analytics.
    5  * Version:           1.0.5
     5 * Version:           1.0.6
    66 * Requires at least: 5.2
    77 * Requires PHP:      7.2
     
    1717}
    1818
    19 define( 'DOT_PRESS_VERSION', '1.0.5' );
     19define( 'DOT_PRESS_VERSION', '1.0.6' );
    2020require_once plugin_dir_path(__FILE__) . 'constants.php';
    2121
  • dot-monetize-polls-quizzes/trunk/includes/class-dot-press-block-renderer.php

    r2381426 r2384037  
    113113            return $b['blockName'] === $block['blockName'];
    114114        });
    115        
     115
    116116        return DotPressArrayUtils::findIndex(function ($b) use ($block) {
    117117            return $b['innerHTML'] === $block['innerHTML'];
     
    122122    {
    123123        if ($block_type) {
    124             if (empty($this->posts)) {
     124            if (empty($this->posts) || !isset($block['blockName'])) {
    125125                return $block_content;
    126126            }
     
    183183        ];
    184184        $alignment = $placement->meta['alignment'][0];
    185         return sprintf('<div style="margin: %s; max-width: 600px;">', $marginOptions[$alignment]) . $carry . '</div>';
     185        return sprintf('<!-- wp:html --><div style="margin: %s; max-width: 600px;">', $marginOptions[$alignment]) . $carry . '</div><!-- /wp:html -->';
    186186    }
    187187
  • dot-monetize-polls-quizzes/trunk/includes/class-dot-press-public.php

    r2381426 r2384037  
    2121 * @author     Your Name <[email protected]>
    2222 */
    23 class DotPressPublic {
     23class DotPressPublic
     24{
    2425
    2526    /**
     
    2829     * @since    1.0.0
    2930     * @access   private
    30      * @var      string    $plugin_name    The ID of this plugin.
     31     * @var      string $plugin_name The ID of this plugin.
    3132     */
    3233    private $plugin_name;
     
    3738     * @since    1.0.0
    3839     * @access   private
    39      * @var      string    $version    The current version of this plugin.
     40     * @var      string $version The current version of this plugin.
    4041     */
    4142    private $version;
     
    5657     * @since    1.0.0
    5758     */
    58     public function __construct( $plugin_name, $version, $loader ) {
     59    public function __construct($plugin_name, $version, $loader)
     60    {
    5961
    6062        $this->plugin_name = $plugin_name;
     
    6264        $this->loader = $loader;
    6365
    64         $this->loader->add_action( 'wp_enqueue_scripts', $this, 'enqueue_scripts' );
     66        $this->loader->add_action('wp_enqueue_scripts', $this, 'enqueue_scripts');
    6567        $this->loader->add_action('loop_start', $this, 'load_renderer', 1);
    66         $this->loader->add_filter('render_block', $this, 'render_block', 10, 2);
     68        $this->loader->add_filter('the_content', $this, 'render_content', 999999999);
     69//        $this->loader->add_filter('render_block', $this, 'render_block', 0, 2);
    6770    }
    6871
     
    7275     * @since    1.0.0
    7376     */
    74     public function enqueue_scripts() {
     77    public function enqueue_scripts()
     78    {
    7579
    7680        /**
     
    8690         */
    8791
    88         wp_enqueue_script( $this->plugin_name, DOT_PRESS_ROOT_URL . 'js/dist/dot-press-public.js', array( 'jquery' ), filemtime(DOT_PRESS_ROOT . 'js/dist/dot-press-public.js'), false );
     92        wp_enqueue_script($this->plugin_name, DOT_PRESS_ROOT_URL . 'js/dist/dot-press-public.js', array('jquery'), filemtime(DOT_PRESS_ROOT . 'js/dist/dot-press-public.js'), false);
    8993
    9094    }
    9195
    92     public function load_renderer() {
     96    public function load_renderer()
     97    {
    9398        if (DotPressWpUtils::is_front_end()) {
    9499            global $post;
     
    97102    }
    98103
    99     public function render_block($block_content, $block) {
     104    public function render_content($content)
     105    {
     106        if (!DotPressWpUtils::is_front_end() || is_null($this->renderer)) {
     107            return $content;
     108        }
     109        global $post;
     110        $blocks = parse_blocks($post->post_content);
     111        $newBlocks = array_merge(...array_map(function ($block) {
     112            $parsed = parse_blocks($this->render_block(render_block($block), $block));
     113            return array_merge([$block], array_slice($parsed, 1));
     114        }, $blocks));
     115        return implode(array_map(function ($block) {
     116            return render_block($block);
     117        }, $newBlocks), '');
     118    }
     119
     120    public function render_block($block_content, $block)
     121    {
    100122        $block_type = $block['blockName'];
    101123
  • dot-monetize-polls-quizzes/trunk/readme.txt

    r2383212 r2384037  
    7777== Changelog ==
    7878
    79 = 1.0 =
    80 * First Release
     79= 1.0.6 =
     80* Now using the_content hook instead of render_block hook to render widgets to fix AMP compatibility
     81
     82= 1.0.5 =
     83* Added cache reset functionality for popular cache plugins
     84
     85= 1.0.4 =
     86* Now resetting post cache when saving or deleting placements
     87
     88= 1.0.3 =
     89* Tweaked placement render logic to be less prone to external plugin block usage
     90
     91= 1.0.2 =
     92* Stopped placement renderer from triggering when block rendering outside wp loop
    8193
    8294= 1.0.1 =
    8395* Added explicit output for unrecognised types
    8496
    85 = 1.0.2 =
    86 * Stopped placement renderer from triggering when block rendering outside wp loop
    87 
    88 = 1.0.3 =
    89 * Tweaked placement render logic to be less prone to external plugin block usage
    90 
    91 = 1.0.4 =
    92 * Now resetting post cache when saving or deleting placements
    93 
    94 = 1.0.5 =
    95 * Added cache reset functionality for popular cache plugins
     97= 1.0 =
     98* First Release
Note: See TracChangeset for help on using the changeset viewer.