Plugin Directory

Changeset 3460601


Ignore:
Timestamp:
02/13/2026 09:17:28 AM (5 days ago)
Author:
devnethr
Message:

v.1.2.0

Location:
snap-blocks
Files:
78 added
10 deleted
24 edited
1 copied

Legend:

Unmodified
Added
Removed
  • snap-blocks/tags/1.2.0/README.txt

    r3418044 r3460601  
    11=== Snap Blocks ===
    22Contributors: devnethr, MarinMatosevic
    3 Tags: elementor, template, content blocks, repeatable blocks, layout
     3Tags: elementor, template, content blocks, repeatable content, layout
    44Requires PHP: 7.4
    5 Stable tag: 1.1.2
     5Stable tag: 1.2.0
    66Tested up to: 6.9
    77License: GPLv2 or later
     
    2020🛠️ Built for developers, designers, and content editors who want a smarter way to manage repeatable content across their WordPress sites.
    2121
     22### [DOCUMENTATION](https://devnet.hr/docs/snap-blocks/) | [SNAP BLOCKS PRO](https://devnet.hr/plugins/snap-blocks/)
    2223
    2324== Features ==
     
    2728- Insert blocks via **shortcode**, Elementor widget, or WPBakery element
    2829- Widgets include a dropdown selector for easy block selection
    29 - Organize blocks using a `Group` taxonomy
    30 - Built-in **Duplicate** action for faster block creation
    31 - Clean, minimal UI — integrates seamlessly with the WordPress dashboard
     30- Group taxonomy for better organization
     31- Duplicate blocks with one click
     32- Lightweight and clean admin UI
     33- No performance overhead
     34
     35== PRO Features ==
     36
     37With [Snap Blocks PRO](https://devnet.hr/plugins/snap-blocks/), you unlock automatic block insertion, advanced display conditions, precise hook placement control, and full compatibility with WooCommerce and core WordPress contexts.
     38
     39- Automatic block insertion (no shortcode needed)
     40- Hook position selector (WooCommerce & WordPress hooks)
     41- Display blocks based on context:
     42  - WooCommerce
     43    - Single Product
     44    - Product Archive
     45    - Cart
     46    - Checkout
     47    - Thank You page
     48    - My Account
     49  - WordPress
     50    - Single Post
     51    - Page
     52    - Post Archive
     53- Advanced conditions:
     54  - Specific products
     55  - Categories
     56  - Tags
     57  - Pages
     58  - Posts
     59- Multiple conditions support
     60- Custom hook name option
     61- Priority control for precise placement
     62- Developer-friendly architecture
    3263
    3364
     
    77108Here are some other plugins we have developed that you might find useful:
    78109
    79 - [Free Shipping Label](https://wordpress.org/plugins/free-shipping-label/) - Increase order revenue by showing your customers just how close they are to your free shipping threshold.
    80     - [FSL Discount Add-On](https://devnet.hr/plugins/free-shipping-label/#fsl-discount) - By setting customizable thresholds for single, double, or triple-step discounts, you’ll motivate shoppers to add more to their carts.
     110- [Free Shipping Label](https://wordpress.org/plugins/snap-blocks/) - Increase order revenue by showing your customers just how close they are to your free shipping threshold.
     111    - [FSL Discount Add-On](https://devnet.hr/plugins/snap-blocks/#fsl-discount) - By setting customizable thresholds for single, double, or triple-step discounts, you’ll motivate shoppers to add more to their carts.
    81112- [Product Price History](https://wordpress.org/plugins/product-price-history/) - Track product price history with customizable charts and graphs on your WooCommerce store. Show lowest price and increase customer trust.
    82113- [Easy Subscribe](https://wordpress.org/plugins/easy-subscribe/) - Effortlessly integrate customizable subscription forms on your WordPress site with a simple shortcode.
     
    128159== Changelog ==
    129160
     161= 1.2.0 =
     162
     163*2026-02-13*
     164
     165* Fix: Resolved edge case where shortcode rendered empty wrapper
     166* Fix: Minor admin UI styling inconsistencies
     167* Update: Freemius SDK updated to the latest version
     168* Improvement: Optimized block rendering performance
     169* UI: New centralized conditions modal interface
     170
     171
    130172= 1.1.2 =
    131173
  • snap-blocks/tags/1.2.0/admin/admin.php

    r3373574 r3460601  
    44
    55use Devnet\SnapBlocks\Admin\PostType;
    6 
    7 if (! defined('ABSPATH')) {
     6if ( !defined( 'ABSPATH' ) ) {
    87    exit;
    98}
     9final class AdminSide {
     10    private static $plugin_name;
    1011
     12    private static $version;
    1113
    12 class AdminSide
    13 {
    14     private $plugin_name;
    15     private $version;
    16 
    17     public function __construct($plugin_name, $version)
    18     {
    19 
    20         $this->plugin_name = $plugin_name;
    21         $this->version     = $version;
    22 
     14    public static function init( $plugin_name, $version ) {
     15        self::$plugin_name = $plugin_name;
     16        self::$version = $version;
    2317        // Setup post_type
    24         new PostType();
    25 
    26         $post_type = isset($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : null;
    27 
    28         add_filter('plugin_action_links_' . DEVNET_SNAP_BLOCKS_PATH_FILE, [$this, 'plugin_action_links']);
    29 
    30         if ($post_type === 'snap_block') {
    31             add_filter('admin_footer_text', [$this, 'admin_credits']);
     18        PostType::init();
     19        $post_type = ( isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : null );
     20        add_filter( 'plugin_action_links_' . DEVNET_SNAP_BLOCKS_PATH_FILE, [self::class, 'plugin_action_links'] );
     21        if ( $post_type === 'snap_block' ) {
     22            add_action( 'admin_enqueue_scripts', [self::class, 'enqueue_assets'] );
     23            add_filter( 'admin_footer_text', [self::class, 'admin_credits'] );
     24            add_action( 'all_admin_notices', [self::class, 'admin_notices'] );
    3225        }
    3326    }
    3427
    35 
    36     public function plugin_action_links($links)
    37     {
    38 
    39         $custom_links   = [];
    40         $custom_links[] = '<a href="' . esc_url(get_admin_url(null, 'edit.php?post_type=snap_block')) . '">' . esc_html__('Settings', 'snap-blocks') . '</a>';
    41 
    42         return array_merge($custom_links, $links);
     28    public static function enqueue_assets( string $hook ) : void {
     29        $screen = get_current_screen();
     30        if ( !$screen || $screen->post_type !== 'snap_block' ) {
     31            return;
     32        }
     33        $base_url = DEVNET_SNAP_BLOCKS_URL . 'assets/build/';
     34        wp_enqueue_style(
     35            self::$plugin_name . '-admin',
     36            $base_url . 'admin.css',
     37            [],
     38            self::$version
     39        );
     40        $asset_file = $base_url . 'admin.asset.php';
     41        $asset_data = ( file_exists( $asset_file ) ? include $asset_file : [
     42            'dependencies' => ['jquery'],
     43            'version'      => self::$version,
     44        ] );
     45        wp_enqueue_script(
     46            self::$plugin_name . '-admin',
     47            $base_url . 'admin.js',
     48            $asset_data['dependencies'],
     49            $asset_data['version'],
     50            true
     51        );
     52        wp_localize_script( self::$plugin_name . '-admin', 'devnet_snap_blocks_admin_script_data', [
     53            'ajaxurl' => admin_url( 'admin-ajax.php' ),
     54            'nonce'   => wp_create_nonce( 'snap_blocks_admin' ),
     55        ] );
    4356    }
    4457
     58    public static function plugin_action_links( $links ) {
     59        $custom_links = [];
     60        $custom_links[] = '<a href="' . esc_url( get_admin_url( null, 'edit.php?post_type=snap_block' ) ) . '">' . esc_html__( 'Settings', 'snap-blocks' ) . '</a>';
     61        return array_merge( $custom_links, $links );
     62    }
    4563
    46     public function admin_credits($footer_text)
    47     {
    48         $footer_text  = '';
     64    public static function admin_notices() {
     65        $screen = get_current_screen();
     66        if ( !$screen || $screen->post_type !== 'snap_block' || $screen->base !== 'edit' ) {
     67            return;
     68        }
     69        ?>
     70        <div class="notice notice-info is-dismissible snap-blocks-docs-notice">
     71            <p>
     72                <strong><?php
     73        esc_html_e( 'Need help with Snap Blocks?', 'snap-blocks' );
     74        ?></strong><br>
     75                <?php
     76        esc_html_e( 'Learn how to create reusable blocks, insert them via shortcode or widget, and use display conditions.', 'snap-blocks' );
     77        ?>
     78            </p>
     79
     80            <p>
     81                <a href="<?php
     82        echo esc_url( 'https://devnet.hr/docs/snap-blocks/' );
     83        ?>"
     84                    target="_blank"
     85                    class="button button-primary">
     86                    <?php
     87        esc_html_e( 'View Documentation', 'snap-blocks' );
     88        ?>
     89                </a>
     90            </p>
     91        </div>
     92<?php
     93    }
     94
     95    public static function admin_credits( $footer_text ) {
     96        $footer_text = '';
    4997        $footer_text .= '<div class="snap-blocks-admin-footer">';
    5098        $footer_text .= '<div class="snap-blocks-footer-message">';
    5199        $footer_text .= 'Please rate <strong>Snap Blocks</strong> <a href="https://wordpress.org/support/plugin/snap-blocks/reviews/?rate=5#new-post" target="_blank">★★★★★</a> on <a href="https://wordpress.org/support/plugin/snap-blocks/reviews/?rate=5#new-post" target="_blank">WordPress.org</a> to help us spread the word. Thank you from the <a href="https://devnet.hr/" target="_blank">Devnet</a> team!';
    52100        $footer_text .= '</div>';
     101        // $footer_text .= '<div class="snap-blocks-pro">';
     102        // $footer_text .= '<a href="https://devnet.hr/plugins/snap-blocks/" target="_blank">Go PRO: More Features, More Power!</a>';
     103        // $footer_text .= '</div>';
    53104        $footer_text .= '</div>';
    54         $footer_text .= '</div>';
    55 
    56105        return $footer_text;
    57106    }
     107
    58108}
  • snap-blocks/tags/1.2.0/admin/post-type.php

    r3418044 r3460601  
    99
    1010
    11 class PostType
     11final class PostType
    1212{
    13     public function __construct()
    14     {
    15         add_action('init', [$this, 'register_blocks'], 1);
    16         add_filter('manage_edit-snap_block_columns', [$this, 'edit_snap_blocks_columns']);
    17         add_action('manage_snap_block_posts_custom_column', [$this, 'manage_snap_blocks_columns'], 10, 2);
    18 
    19         add_filter('post_row_actions', [$this, 'duplicate_action'], 10, 2);
    20         add_filter('admin_action_snap_block_duplicate_post_as_draft', [$this, 'duplicate_post_as_draft'], 10, 2);
    21 
    22         add_filter('template_include', [$this, 'force_blank_template']);
    23     }
    24 
    25     public function register_blocks()
     13    public static function init()
     14    {
     15        add_action('init', [self::class, 'register_blocks'], 1);
     16        add_filter('manage_edit-snap_block_columns', [self::class, 'edit_snap_blocks_columns']);
     17        add_action('manage_snap_block_posts_custom_column', [self::class, 'manage_snap_blocks_columns'], 10, 2);
     18
     19        add_filter('post_row_actions', [self::class, 'duplicate_action'], 10, 2);
     20        add_filter('admin_action_snap_block_duplicate_post_as_draft', [self::class, 'duplicate_post_as_draft'], 10, 2);
     21
     22        add_filter('template_include', [self::class, 'force_blank_template']);
     23    }
     24
     25    public static function register_blocks()
    2626    {
    2727
     
    9797    }
    9898
    99     public function edit_snap_blocks_columns($columns)
     99    public static function edit_snap_blocks_columns($columns)
    100100    {
    101101        unset($columns['date']);
    102102
     103        $columns['taxonomy-snap_block_group'] = esc_html__('Group', 'snap-blocks');
     104
    103105        $new_columns = [
    104             'shortcode' => esc_html__('Shortcode', 'snap-blocks'),
    105             'group'     => esc_html__('Group', 'snap-blocks'),
    106             'date'      => esc_html__('Date', 'snap-blocks')
     106            'auto_insert' => esc_html__('Auto insert', 'snap-blocks'),
     107            'shortcode'   => esc_html__('Shortcode', 'snap-blocks'),
     108            'date'        => esc_html__('Date', 'snap-blocks')
    107109        ];
    108110
     
    111113    }
    112114
    113     public function manage_snap_blocks_columns($column, $post_id)
     115    public static function manage_snap_blocks_columns($column, $post_id)
    114116    {
    115117        switch ($column) {
     118
    116119            case 'shortcode':
    117                 echo '[snap_block id="' . absint($post_id) . '"]';
     120                $shortcode = '[snap_block id="' . absint($post_id) . '"]';
     121                echo '<input class="snap-blocks-input-shortcode" type="text" readonly="readonly" onfocus="this.select()" value="' . esc_attr($shortcode) . '">';
    118122                break;
    119             case 'group':
    120                 $terms     = wp_get_post_terms($post_id, 'snap_block_group');
    121                 $post_type = get_post_type($post_id);
    122                 $keys      = array_keys($terms);
    123                 $last_key  = end($keys);
    124 
    125                 if (!$terms) {
    126                     echo '—';
    127                     return;
    128                 }
    129 
    130                 foreach ($terms as $key => $term) {
    131                     $name = $term->name;
    132 
    133                     if ($key !== $last_key) {
    134                         $name .= ',';
    135                     }
    136 
    137                     $edit_url = 'edit.php?post_type=' . $post_type . '&snap_block_group=' . $term->slug;
    138 
    139                     echo '<a href="' . esc_url($edit_url) . '">';
    140                     echo esc_html($name);
    141                     echo '</a>';
    142                 }
    143 
    144                 break;
    145         }
    146     }
    147 
    148     public function duplicate_action($actions, $post)
     123        }
     124    }
     125
     126    public static function duplicate_action($actions, $post)
    149127    {
    150128        if ($post->post_type !== 'snap_block') {
     
    158136    }
    159137
    160     public function duplicate_post_as_draft()
     138    public static function duplicate_post_as_draft()
    161139    {
    162140        global $wpdb;
     
    232210    }
    233211
    234     public function force_blank_template($template)
     212    public static function force_blank_template($template)
    235213    {
    236214        if (is_singular('snap_block')) {
  • snap-blocks/tags/1.2.0/assets/build/admin-rtl.css

    r3289677 r3460601  
    1 
     1#wpfooter{background-color:#fff;display:block!important}#footer-upgrade{display:none}.snap-blocks-admin-footer{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between}.snap-blocks-admin-footer .snap-blocks-pro a{align-items:center;background-color:#311d7e;color:#fff;display:flex;justify-content:space-between;padding:1rem;text-decoration:none}.snap-blocks-admin-footer .snap-blocks-pro a:hover{text-decoration:underline}
  • snap-blocks/tags/1.2.0/assets/build/admin.asset.php

    r3289677 r3460601  
    1 <?php return array('dependencies' => array(), 'version' => 'fc8877339ae163dff5cd');
     1<?php return array('dependencies' => array(), 'version' => '9a933df12f9ea2e45913');
  • snap-blocks/tags/1.2.0/assets/build/admin.css

    r3289677 r3460601  
    1 
     1#wpfooter{background-color:#fff;display:block!important}#footer-upgrade{display:none}.snap-blocks-admin-footer{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between}.snap-blocks-admin-footer .snap-blocks-pro a{align-items:center;background-color:#311d7e;color:#fff;display:flex;justify-content:space-between;padding:1rem;text-decoration:none}.snap-blocks-admin-footer .snap-blocks-pro a:hover{text-decoration:underline}
  • snap-blocks/tags/1.2.0/includes/elementor/integration.php

    r3373574 r3460601  
    1111
    1212
    13 class Integration
     13final class Integration
    1414{
    1515
    16     public function __construct()
     16    public static function init()
    1717    {
    18         add_action('elementor/widgets/register', [$this, 'register_elementor_widget']);
    19         add_filter('elementor/default_generic_elementor_document_type', [$this, 'set_elementor_canvas_template'], 10, 2);
     18        add_action('elementor/widgets/register', [self::class, 'register_elementor_widget']);
     19        add_filter('elementor/default_generic_elementor_document_type', [self::class, 'set_elementor_canvas_template'], 10, 2);
    2020    }
    2121
    22     public function register_elementor_widget($widgets_manager)
     22    public static function register_elementor_widget($widgets_manager)
    2323    {
    2424        self::register_widget($widgets_manager);
    2525    }
    2626
    27     public function set_elementor_canvas_template($document_type, $post_type)
     27    public static function set_elementor_canvas_template($document_type, $post_type)
    2828    {
    2929        if ($post_type === 'snap_block') {
  • snap-blocks/tags/1.2.0/includes/plugin.php

    r3373574 r3460601  
    55use Devnet\SnapBlocks\Admin\AdminSide;
    66use Devnet\SnapBlocks\Includes\Shortcode;
     7use Devnet\SnapBlocks\Includes\Conditions\Bootstrap as ConditionsBootstrap;
    78use Devnet\SnapBlocks\Includes\Elementor\Integration as ElementorIntegration;
    89use Devnet\SnapBlocks\Includes\WPBakery\Integration as WPBIntegration;
     
    1415
    1516
    16 class Plugin
     17final class Plugin
    1718{
    1819
    19     protected $plugin_name;
    20     protected $version;
     20    protected $plugin_name = DEVNET_SNAP_BLOCKS_NAME;
     21    protected $version = DEVNET_SNAP_BLOCKS_VERSION;
    2122
    2223    public function __construct()
    2324    {
    24 
    25         $this->version = DEVNET_SNAP_BLOCKS_VERSION;
    26         $this->plugin_name = DEVNET_SNAP_BLOCKS_NAME;
    27 
    2825        $this->load_dependencies();
    2926    }
     
    3431        require_once DEVNET_SNAP_BLOCKS_PATH_DIR . '/admin/admin.php';
    3532        require_once DEVNET_SNAP_BLOCKS_PATH_DIR . '/admin/post-type.php';
     33
     34        require_once DEVNET_SNAP_BLOCKS_PATH_DIR . '/includes/conditions/bootstrap.php';
     35
    3636
    3737        require_once DEVNET_SNAP_BLOCKS_PATH_DIR . '/includes/shortcode.php';
     
    4646    {
    4747
    48         new AdminSide($this->get_plugin_name(), $this->get_version());
    49         new Shortcode();
    50         new ElementorIntegration();
     48        AdminSide::init($this->plugin_name, $this->version);
     49        Shortcode::init();
     50
     51        ElementorIntegration::init();
    5152
    5253        if (function_exists('vc_map')) {
    53             new WPBIntegration();
     54            WPBIntegration::init();
    5455        }
    55     }
    5656
    57     public function get_plugin_name()
    58     {
    59         return $this->plugin_name;
    60     }
    61 
    62     public function get_version()
    63     {
    64         return $this->version;
     57        (new ConditionsBootstrap())->init();
    6558    }
    6659}
  • snap-blocks/tags/1.2.0/includes/shortcode.php

    r3373574 r3460601  
    99
    1010
    11 class Shortcode
     11final class Shortcode
    1212{
    1313
    14     public function __construct()
     14    public static function init()
    1515    {
    16         add_shortcode('snap_block', [$this, 'render_shortcode']);
     16        add_shortcode('snap_block', [self::class, 'render_shortcode']);
    1717    }
    1818
    19     public function render_shortcode($atts)
     19    public static function render_shortcode($atts)
    2020    {
    2121        $atts = shortcode_atts([
  • snap-blocks/tags/1.2.0/includes/wpbakery/integration.php

    r3418044 r3460601  
    99
    1010
    11 class Integration
     11final class Integration
    1212{
    1313
    14     public function __construct()
     14    public static function init()
    1515    {
    16         add_action('vc_before_init', [$this, 'register_vc_element']);
     16        add_action('vc_before_init', [self::class, 'register_vc_element']);
    1717    }
    1818
    19     public function register_vc_element()
     19    public static function register_vc_element()
    2020    {
    2121
     
    3232                    'heading'     => __('Select Snap Block', 'snap-blocks'),
    3333                    'param_name'  => 'id',
    34                     'value'       => $this->get_snap_block_dropdown_options(),
     34                    'value'       => self::get_snap_block_dropdown_options(),
    3535                    'admin_label' => true,
    3636                    'description' => __('Choose which snap block to insert.', 'snap-blocks')
     
    4040    }
    4141
    42     private function get_snap_block_dropdown_options()
     42    private static function get_snap_block_dropdown_options()
    4343    {
    4444        $blocks = get_posts([
  • snap-blocks/tags/1.2.0/snap-blocks.php

    r3418044 r3460601  
    44 * Plugin Name:       Snap Blocks
    55 * Description:       Snap blocks with popular page builder support via shortcode or widget.
    6  * Version:           1.1.2
     6 * Version:           1.2.0
    77 * Requires at least: 6.4
    88 * Requires PHP:      7.4
     
    1212 * Text Domain:       snap-blocks
    1313 * Domain Path:       /languages
     14 *
    1415 */
    15 
    1616use Devnet\SnapBlocks\Includes\Plugin;
    17 
    18 if (!defined('ABSPATH')) {
     17if ( !defined( 'ABSPATH' ) ) {
    1918    exit;
    2019}
    21 
    22 if (function_exists('devnet_sb_fs')) {
    23     devnet_sb_fs()->set_basename(true, __FILE__);
     20if ( function_exists( 'devnet_sb_fs' ) ) {
     21    devnet_sb_fs()->set_basename( false, __FILE__ );
    2422} else {
    25     if (!function_exists('devnet_sb_fs')) {
     23    if ( !function_exists( 'devnet_sb_fs' ) ) {
    2624        // Create a helper function for easy SDK access.
    27         function devnet_sb_fs()
    28         {
     25        function devnet_sb_fs() {
    2926            global $devnet_sb_fs;
    30 
    31             if (!isset($devnet_sb_fs)) {
     27            if ( !isset( $devnet_sb_fs ) ) {
    3228                // Include Freemius SDK.
    3329                require_once __DIR__ . '/vendor/freemius/wordpress-sdk/start.php';
    34 
    35                 $devnet_sb_fs = fs_dynamic_init([
     30                $devnet_sb_fs = fs_dynamic_init( [
    3631                    'id'               => '21030',
    3732                    'slug'             => 'snap-blocks',
     
    4035                    'is_org_compliant' => true,
    4136                    'is_premium'       => false,
     37                    'premium_suffix'   => 'Pro',
    4238                    'has_addons'       => false,
    43                     'has_paid_plans'   => false,
     39                    'has_paid_plans'   => true,
     40                    'trial'            => [
     41                        'days'               => 7,
     42                        'is_require_payment' => true,
     43                    ],
    4444                    'menu'             => [
    45                         'slug'    => 'edit.php?post_type=snap_block',
    46                         'account' => false
    47                     ]
    48                 ]);
     45                        'slug' => 'edit.php?post_type=snap_block',
     46                    ],
     47                    'is_live'          => true,
     48                ] );
    4949            }
    50 
    5150            return $devnet_sb_fs;
    5251        }
     
    5554        devnet_sb_fs();
    5655        // Signal that SDK was initiated.
    57         do_action('devnet_sb_fs_loaded');
     56        do_action( 'devnet_sb_fs_loaded' );
    5857    }
    59 
    60     if (!function_exists('devnet_sb_fs_is_submenu_visible')) {
    61         function devnet_sb_fs_is_submenu_visible($is_visible, $menu_id)
    62         {
    63             if ('contact' != $menu_id) {
     58    if ( !function_exists( 'devnet_sb_fs_is_submenu_visible' ) ) {
     59        function devnet_sb_fs_is_submenu_visible(  $is_visible, $menu_id  ) {
     60            if ( 'contact' != $menu_id ) {
    6461                return $is_visible;
    6562            }
    66 
    6763            return devnet_sb_fs()->can_use_premium_code();
    6864        }
     65
    6966    }
     67    if ( !function_exists( 'devnet_sb_fs_custom_icon' ) ) {
     68        function devnet_sb_fs_custom_icon() {
     69            return dirname( __FILE__ ) . '/assets/images/logo.png';
     70        }
    7071
    71     if (!function_exists('devnet_sb_fs_custom_icon')) {
    72         function devnet_sb_fs_custom_icon()
    73         {
    74             return dirname(__FILE__) . '/assets/images/logo.png';
    75         }
    7672    }
    77 
    7873    /*
    7974     * Run Freemius actions and filters.
    8075     */
    81     if (function_exists('devnet_sb_fs')) {
    82         devnet_sb_fs()->add_filter('is_submenu_visible', 'devnet_sb_fs_is_submenu_visible', 10, 2);
    83         devnet_sb_fs()->add_filter('plugin_icon', 'devnet_sb_fs_custom_icon');
     76    if ( function_exists( 'devnet_sb_fs' ) ) {
     77        devnet_sb_fs()->add_filter(
     78            'is_submenu_visible',
     79            'devnet_sb_fs_is_submenu_visible',
     80            10,
     81            2
     82        );
     83        devnet_sb_fs()->add_filter( 'plugin_icon', 'devnet_sb_fs_custom_icon' );
    8484    }
    85 
    86     define('DEVNET_SNAP_BLOCKS_VERSION', '1.1.2');
    87     define('DEVNET_SNAP_BLOCKS_NAME', 'snap-blocks');
    88     define('DEVNET_SNAP_BLOCKS_PATH_DIR', plugin_dir_path(__FILE__));
    89     define('DEVNET_SNAP_BLOCKS_PATH_FILE', plugin_basename(__FILE__));
    90     define('DEVNET_SNAP_BLOCKS_URL', plugin_dir_url(__FILE__));
    91 
    92     add_action('plugins_loaded', function () {
    93 
     85    define( 'DEVNET_SNAP_BLOCKS_VERSION', '1.2.0' );
     86    define( 'DEVNET_SNAP_BLOCKS_NAME', 'snap-blocks' );
     87    define( 'DEVNET_SNAP_BLOCKS_PATH_DIR', plugin_dir_path( __FILE__ ) );
     88    define( 'DEVNET_SNAP_BLOCKS_PATH_FILE', plugin_basename( __FILE__ ) );
     89    define( 'DEVNET_SNAP_BLOCKS_URL', plugin_dir_url( __FILE__ ) );
     90    add_action( 'plugins_loaded', function () {
    9491        require DEVNET_SNAP_BLOCKS_PATH_DIR . 'includes/plugin.php';
    9592        $plugin = new Plugin();
    9693        $plugin->run();
    97     });
     94    } );
    9895}
  • snap-blocks/tags/1.2.0/vendor/composer/installed.php

    r3418044 r3460601  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '1b47485e1a756a86d640a0cc7e493b45589205f3',
     6        'reference' => '2dd9efb8d4ae4b9fa7f55d100b2920ac7e00b8c4',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '1b47485e1a756a86d640a0cc7e493b45589205f3',
     16            'reference' => '2dd9efb8d4ae4b9fa7f55d100b2920ac7e00b8c4',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • snap-blocks/trunk/README.txt

    r3418044 r3460601  
    11=== Snap Blocks ===
    22Contributors: devnethr, MarinMatosevic
    3 Tags: elementor, template, content blocks, repeatable blocks, layout
     3Tags: elementor, template, content blocks, repeatable content, layout
    44Requires PHP: 7.4
    5 Stable tag: 1.1.2
     5Stable tag: 1.2.0
    66Tested up to: 6.9
    77License: GPLv2 or later
     
    2020🛠️ Built for developers, designers, and content editors who want a smarter way to manage repeatable content across their WordPress sites.
    2121
     22### [DOCUMENTATION](https://devnet.hr/docs/snap-blocks/) | [SNAP BLOCKS PRO](https://devnet.hr/plugins/snap-blocks/)
    2223
    2324== Features ==
     
    2728- Insert blocks via **shortcode**, Elementor widget, or WPBakery element
    2829- Widgets include a dropdown selector for easy block selection
    29 - Organize blocks using a `Group` taxonomy
    30 - Built-in **Duplicate** action for faster block creation
    31 - Clean, minimal UI — integrates seamlessly with the WordPress dashboard
     30- Group taxonomy for better organization
     31- Duplicate blocks with one click
     32- Lightweight and clean admin UI
     33- No performance overhead
     34
     35== PRO Features ==
     36
     37With [Snap Blocks PRO](https://devnet.hr/plugins/snap-blocks/), you unlock automatic block insertion, advanced display conditions, precise hook placement control, and full compatibility with WooCommerce and core WordPress contexts.
     38
     39- Automatic block insertion (no shortcode needed)
     40- Hook position selector (WooCommerce & WordPress hooks)
     41- Display blocks based on context:
     42  - WooCommerce
     43    - Single Product
     44    - Product Archive
     45    - Cart
     46    - Checkout
     47    - Thank You page
     48    - My Account
     49  - WordPress
     50    - Single Post
     51    - Page
     52    - Post Archive
     53- Advanced conditions:
     54  - Specific products
     55  - Categories
     56  - Tags
     57  - Pages
     58  - Posts
     59- Multiple conditions support
     60- Custom hook name option
     61- Priority control for precise placement
     62- Developer-friendly architecture
    3263
    3364
     
    77108Here are some other plugins we have developed that you might find useful:
    78109
    79 - [Free Shipping Label](https://wordpress.org/plugins/free-shipping-label/) - Increase order revenue by showing your customers just how close they are to your free shipping threshold.
    80     - [FSL Discount Add-On](https://devnet.hr/plugins/free-shipping-label/#fsl-discount) - By setting customizable thresholds for single, double, or triple-step discounts, you’ll motivate shoppers to add more to their carts.
     110- [Free Shipping Label](https://wordpress.org/plugins/snap-blocks/) - Increase order revenue by showing your customers just how close they are to your free shipping threshold.
     111    - [FSL Discount Add-On](https://devnet.hr/plugins/snap-blocks/#fsl-discount) - By setting customizable thresholds for single, double, or triple-step discounts, you’ll motivate shoppers to add more to their carts.
    81112- [Product Price History](https://wordpress.org/plugins/product-price-history/) - Track product price history with customizable charts and graphs on your WooCommerce store. Show lowest price and increase customer trust.
    82113- [Easy Subscribe](https://wordpress.org/plugins/easy-subscribe/) - Effortlessly integrate customizable subscription forms on your WordPress site with a simple shortcode.
     
    128159== Changelog ==
    129160
     161= 1.2.0 =
     162
     163*2026-02-13*
     164
     165* Fix: Resolved edge case where shortcode rendered empty wrapper
     166* Fix: Minor admin UI styling inconsistencies
     167* Update: Freemius SDK updated to the latest version
     168* Improvement: Optimized block rendering performance
     169* UI: New centralized conditions modal interface
     170
     171
    130172= 1.1.2 =
    131173
  • snap-blocks/trunk/admin/admin.php

    r3373574 r3460601  
    44
    55use Devnet\SnapBlocks\Admin\PostType;
    6 
    7 if (! defined('ABSPATH')) {
     6if ( !defined( 'ABSPATH' ) ) {
    87    exit;
    98}
     9final class AdminSide {
     10    private static $plugin_name;
    1011
     12    private static $version;
    1113
    12 class AdminSide
    13 {
    14     private $plugin_name;
    15     private $version;
    16 
    17     public function __construct($plugin_name, $version)
    18     {
    19 
    20         $this->plugin_name = $plugin_name;
    21         $this->version     = $version;
    22 
     14    public static function init( $plugin_name, $version ) {
     15        self::$plugin_name = $plugin_name;
     16        self::$version = $version;
    2317        // Setup post_type
    24         new PostType();
    25 
    26         $post_type = isset($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : null;
    27 
    28         add_filter('plugin_action_links_' . DEVNET_SNAP_BLOCKS_PATH_FILE, [$this, 'plugin_action_links']);
    29 
    30         if ($post_type === 'snap_block') {
    31             add_filter('admin_footer_text', [$this, 'admin_credits']);
     18        PostType::init();
     19        $post_type = ( isset( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : null );
     20        add_filter( 'plugin_action_links_' . DEVNET_SNAP_BLOCKS_PATH_FILE, [self::class, 'plugin_action_links'] );
     21        if ( $post_type === 'snap_block' ) {
     22            add_action( 'admin_enqueue_scripts', [self::class, 'enqueue_assets'] );
     23            add_filter( 'admin_footer_text', [self::class, 'admin_credits'] );
     24            add_action( 'all_admin_notices', [self::class, 'admin_notices'] );
    3225        }
    3326    }
    3427
    35 
    36     public function plugin_action_links($links)
    37     {
    38 
    39         $custom_links   = [];
    40         $custom_links[] = '<a href="' . esc_url(get_admin_url(null, 'edit.php?post_type=snap_block')) . '">' . esc_html__('Settings', 'snap-blocks') . '</a>';
    41 
    42         return array_merge($custom_links, $links);
     28    public static function enqueue_assets( string $hook ) : void {
     29        $screen = get_current_screen();
     30        if ( !$screen || $screen->post_type !== 'snap_block' ) {
     31            return;
     32        }
     33        $base_url = DEVNET_SNAP_BLOCKS_URL . 'assets/build/';
     34        wp_enqueue_style(
     35            self::$plugin_name . '-admin',
     36            $base_url . 'admin.css',
     37            [],
     38            self::$version
     39        );
     40        $asset_file = $base_url . 'admin.asset.php';
     41        $asset_data = ( file_exists( $asset_file ) ? include $asset_file : [
     42            'dependencies' => ['jquery'],
     43            'version'      => self::$version,
     44        ] );
     45        wp_enqueue_script(
     46            self::$plugin_name . '-admin',
     47            $base_url . 'admin.js',
     48            $asset_data['dependencies'],
     49            $asset_data['version'],
     50            true
     51        );
     52        wp_localize_script( self::$plugin_name . '-admin', 'devnet_snap_blocks_admin_script_data', [
     53            'ajaxurl' => admin_url( 'admin-ajax.php' ),
     54            'nonce'   => wp_create_nonce( 'snap_blocks_admin' ),
     55        ] );
    4356    }
    4457
     58    public static function plugin_action_links( $links ) {
     59        $custom_links = [];
     60        $custom_links[] = '<a href="' . esc_url( get_admin_url( null, 'edit.php?post_type=snap_block' ) ) . '">' . esc_html__( 'Settings', 'snap-blocks' ) . '</a>';
     61        return array_merge( $custom_links, $links );
     62    }
    4563
    46     public function admin_credits($footer_text)
    47     {
    48         $footer_text  = '';
     64    public static function admin_notices() {
     65        $screen = get_current_screen();
     66        if ( !$screen || $screen->post_type !== 'snap_block' || $screen->base !== 'edit' ) {
     67            return;
     68        }
     69        ?>
     70        <div class="notice notice-info is-dismissible snap-blocks-docs-notice">
     71            <p>
     72                <strong><?php
     73        esc_html_e( 'Need help with Snap Blocks?', 'snap-blocks' );
     74        ?></strong><br>
     75                <?php
     76        esc_html_e( 'Learn how to create reusable blocks, insert them via shortcode or widget, and use display conditions.', 'snap-blocks' );
     77        ?>
     78            </p>
     79
     80            <p>
     81                <a href="<?php
     82        echo esc_url( 'https://devnet.hr/docs/snap-blocks/' );
     83        ?>"
     84                    target="_blank"
     85                    class="button button-primary">
     86                    <?php
     87        esc_html_e( 'View Documentation', 'snap-blocks' );
     88        ?>
     89                </a>
     90            </p>
     91        </div>
     92<?php
     93    }
     94
     95    public static function admin_credits( $footer_text ) {
     96        $footer_text = '';
    4997        $footer_text .= '<div class="snap-blocks-admin-footer">';
    5098        $footer_text .= '<div class="snap-blocks-footer-message">';
    5199        $footer_text .= 'Please rate <strong>Snap Blocks</strong> <a href="https://wordpress.org/support/plugin/snap-blocks/reviews/?rate=5#new-post" target="_blank">★★★★★</a> on <a href="https://wordpress.org/support/plugin/snap-blocks/reviews/?rate=5#new-post" target="_blank">WordPress.org</a> to help us spread the word. Thank you from the <a href="https://devnet.hr/" target="_blank">Devnet</a> team!';
    52100        $footer_text .= '</div>';
     101        // $footer_text .= '<div class="snap-blocks-pro">';
     102        // $footer_text .= '<a href="https://devnet.hr/plugins/snap-blocks/" target="_blank">Go PRO: More Features, More Power!</a>';
     103        // $footer_text .= '</div>';
    53104        $footer_text .= '</div>';
    54         $footer_text .= '</div>';
    55 
    56105        return $footer_text;
    57106    }
     107
    58108}
  • snap-blocks/trunk/admin/post-type.php

    r3418044 r3460601  
    99
    1010
    11 class PostType
     11final class PostType
    1212{
    13     public function __construct()
    14     {
    15         add_action('init', [$this, 'register_blocks'], 1);
    16         add_filter('manage_edit-snap_block_columns', [$this, 'edit_snap_blocks_columns']);
    17         add_action('manage_snap_block_posts_custom_column', [$this, 'manage_snap_blocks_columns'], 10, 2);
    18 
    19         add_filter('post_row_actions', [$this, 'duplicate_action'], 10, 2);
    20         add_filter('admin_action_snap_block_duplicate_post_as_draft', [$this, 'duplicate_post_as_draft'], 10, 2);
    21 
    22         add_filter('template_include', [$this, 'force_blank_template']);
    23     }
    24 
    25     public function register_blocks()
     13    public static function init()
     14    {
     15        add_action('init', [self::class, 'register_blocks'], 1);
     16        add_filter('manage_edit-snap_block_columns', [self::class, 'edit_snap_blocks_columns']);
     17        add_action('manage_snap_block_posts_custom_column', [self::class, 'manage_snap_blocks_columns'], 10, 2);
     18
     19        add_filter('post_row_actions', [self::class, 'duplicate_action'], 10, 2);
     20        add_filter('admin_action_snap_block_duplicate_post_as_draft', [self::class, 'duplicate_post_as_draft'], 10, 2);
     21
     22        add_filter('template_include', [self::class, 'force_blank_template']);
     23    }
     24
     25    public static function register_blocks()
    2626    {
    2727
     
    9797    }
    9898
    99     public function edit_snap_blocks_columns($columns)
     99    public static function edit_snap_blocks_columns($columns)
    100100    {
    101101        unset($columns['date']);
    102102
     103        $columns['taxonomy-snap_block_group'] = esc_html__('Group', 'snap-blocks');
     104
    103105        $new_columns = [
    104             'shortcode' => esc_html__('Shortcode', 'snap-blocks'),
    105             'group'     => esc_html__('Group', 'snap-blocks'),
    106             'date'      => esc_html__('Date', 'snap-blocks')
     106            'auto_insert' => esc_html__('Auto insert', 'snap-blocks'),
     107            'shortcode'   => esc_html__('Shortcode', 'snap-blocks'),
     108            'date'        => esc_html__('Date', 'snap-blocks')
    107109        ];
    108110
     
    111113    }
    112114
    113     public function manage_snap_blocks_columns($column, $post_id)
     115    public static function manage_snap_blocks_columns($column, $post_id)
    114116    {
    115117        switch ($column) {
     118
    116119            case 'shortcode':
    117                 echo '[snap_block id="' . absint($post_id) . '"]';
     120                $shortcode = '[snap_block id="' . absint($post_id) . '"]';
     121                echo '<input class="snap-blocks-input-shortcode" type="text" readonly="readonly" onfocus="this.select()" value="' . esc_attr($shortcode) . '">';
    118122                break;
    119             case 'group':
    120                 $terms     = wp_get_post_terms($post_id, 'snap_block_group');
    121                 $post_type = get_post_type($post_id);
    122                 $keys      = array_keys($terms);
    123                 $last_key  = end($keys);
    124 
    125                 if (!$terms) {
    126                     echo '—';
    127                     return;
    128                 }
    129 
    130                 foreach ($terms as $key => $term) {
    131                     $name = $term->name;
    132 
    133                     if ($key !== $last_key) {
    134                         $name .= ',';
    135                     }
    136 
    137                     $edit_url = 'edit.php?post_type=' . $post_type . '&snap_block_group=' . $term->slug;
    138 
    139                     echo '<a href="' . esc_url($edit_url) . '">';
    140                     echo esc_html($name);
    141                     echo '</a>';
    142                 }
    143 
    144                 break;
    145         }
    146     }
    147 
    148     public function duplicate_action($actions, $post)
     123        }
     124    }
     125
     126    public static function duplicate_action($actions, $post)
    149127    {
    150128        if ($post->post_type !== 'snap_block') {
     
    158136    }
    159137
    160     public function duplicate_post_as_draft()
     138    public static function duplicate_post_as_draft()
    161139    {
    162140        global $wpdb;
     
    232210    }
    233211
    234     public function force_blank_template($template)
     212    public static function force_blank_template($template)
    235213    {
    236214        if (is_singular('snap_block')) {
  • snap-blocks/trunk/assets/build/admin-rtl.css

    r3289677 r3460601  
    1 
     1#wpfooter{background-color:#fff;display:block!important}#footer-upgrade{display:none}.snap-blocks-admin-footer{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between}.snap-blocks-admin-footer .snap-blocks-pro a{align-items:center;background-color:#311d7e;color:#fff;display:flex;justify-content:space-between;padding:1rem;text-decoration:none}.snap-blocks-admin-footer .snap-blocks-pro a:hover{text-decoration:underline}
  • snap-blocks/trunk/assets/build/admin.asset.php

    r3289677 r3460601  
    1 <?php return array('dependencies' => array(), 'version' => 'fc8877339ae163dff5cd');
     1<?php return array('dependencies' => array(), 'version' => '9a933df12f9ea2e45913');
  • snap-blocks/trunk/assets/build/admin.css

    r3289677 r3460601  
    1 
     1#wpfooter{background-color:#fff;display:block!important}#footer-upgrade{display:none}.snap-blocks-admin-footer{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between}.snap-blocks-admin-footer .snap-blocks-pro a{align-items:center;background-color:#311d7e;color:#fff;display:flex;justify-content:space-between;padding:1rem;text-decoration:none}.snap-blocks-admin-footer .snap-blocks-pro a:hover{text-decoration:underline}
  • snap-blocks/trunk/includes/elementor/integration.php

    r3373574 r3460601  
    1111
    1212
    13 class Integration
     13final class Integration
    1414{
    1515
    16     public function __construct()
     16    public static function init()
    1717    {
    18         add_action('elementor/widgets/register', [$this, 'register_elementor_widget']);
    19         add_filter('elementor/default_generic_elementor_document_type', [$this, 'set_elementor_canvas_template'], 10, 2);
     18        add_action('elementor/widgets/register', [self::class, 'register_elementor_widget']);
     19        add_filter('elementor/default_generic_elementor_document_type', [self::class, 'set_elementor_canvas_template'], 10, 2);
    2020    }
    2121
    22     public function register_elementor_widget($widgets_manager)
     22    public static function register_elementor_widget($widgets_manager)
    2323    {
    2424        self::register_widget($widgets_manager);
    2525    }
    2626
    27     public function set_elementor_canvas_template($document_type, $post_type)
     27    public static function set_elementor_canvas_template($document_type, $post_type)
    2828    {
    2929        if ($post_type === 'snap_block') {
  • snap-blocks/trunk/includes/plugin.php

    r3373574 r3460601  
    55use Devnet\SnapBlocks\Admin\AdminSide;
    66use Devnet\SnapBlocks\Includes\Shortcode;
     7use Devnet\SnapBlocks\Includes\Conditions\Bootstrap as ConditionsBootstrap;
    78use Devnet\SnapBlocks\Includes\Elementor\Integration as ElementorIntegration;
    89use Devnet\SnapBlocks\Includes\WPBakery\Integration as WPBIntegration;
     
    1415
    1516
    16 class Plugin
     17final class Plugin
    1718{
    1819
    19     protected $plugin_name;
    20     protected $version;
     20    protected $plugin_name = DEVNET_SNAP_BLOCKS_NAME;
     21    protected $version = DEVNET_SNAP_BLOCKS_VERSION;
    2122
    2223    public function __construct()
    2324    {
    24 
    25         $this->version = DEVNET_SNAP_BLOCKS_VERSION;
    26         $this->plugin_name = DEVNET_SNAP_BLOCKS_NAME;
    27 
    2825        $this->load_dependencies();
    2926    }
     
    3431        require_once DEVNET_SNAP_BLOCKS_PATH_DIR . '/admin/admin.php';
    3532        require_once DEVNET_SNAP_BLOCKS_PATH_DIR . '/admin/post-type.php';
     33
     34        require_once DEVNET_SNAP_BLOCKS_PATH_DIR . '/includes/conditions/bootstrap.php';
     35
    3636
    3737        require_once DEVNET_SNAP_BLOCKS_PATH_DIR . '/includes/shortcode.php';
     
    4646    {
    4747
    48         new AdminSide($this->get_plugin_name(), $this->get_version());
    49         new Shortcode();
    50         new ElementorIntegration();
     48        AdminSide::init($this->plugin_name, $this->version);
     49        Shortcode::init();
     50
     51        ElementorIntegration::init();
    5152
    5253        if (function_exists('vc_map')) {
    53             new WPBIntegration();
     54            WPBIntegration::init();
    5455        }
    55     }
    5656
    57     public function get_plugin_name()
    58     {
    59         return $this->plugin_name;
    60     }
    61 
    62     public function get_version()
    63     {
    64         return $this->version;
     57        (new ConditionsBootstrap())->init();
    6558    }
    6659}
  • snap-blocks/trunk/includes/shortcode.php

    r3373574 r3460601  
    99
    1010
    11 class Shortcode
     11final class Shortcode
    1212{
    1313
    14     public function __construct()
     14    public static function init()
    1515    {
    16         add_shortcode('snap_block', [$this, 'render_shortcode']);
     16        add_shortcode('snap_block', [self::class, 'render_shortcode']);
    1717    }
    1818
    19     public function render_shortcode($atts)
     19    public static function render_shortcode($atts)
    2020    {
    2121        $atts = shortcode_atts([
  • snap-blocks/trunk/includes/wpbakery/integration.php

    r3418044 r3460601  
    99
    1010
    11 class Integration
     11final class Integration
    1212{
    1313
    14     public function __construct()
     14    public static function init()
    1515    {
    16         add_action('vc_before_init', [$this, 'register_vc_element']);
     16        add_action('vc_before_init', [self::class, 'register_vc_element']);
    1717    }
    1818
    19     public function register_vc_element()
     19    public static function register_vc_element()
    2020    {
    2121
     
    3232                    'heading'     => __('Select Snap Block', 'snap-blocks'),
    3333                    'param_name'  => 'id',
    34                     'value'       => $this->get_snap_block_dropdown_options(),
     34                    'value'       => self::get_snap_block_dropdown_options(),
    3535                    'admin_label' => true,
    3636                    'description' => __('Choose which snap block to insert.', 'snap-blocks')
     
    4040    }
    4141
    42     private function get_snap_block_dropdown_options()
     42    private static function get_snap_block_dropdown_options()
    4343    {
    4444        $blocks = get_posts([
  • snap-blocks/trunk/snap-blocks.php

    r3418044 r3460601  
    44 * Plugin Name:       Snap Blocks
    55 * Description:       Snap blocks with popular page builder support via shortcode or widget.
    6  * Version:           1.1.2
     6 * Version:           1.2.0
    77 * Requires at least: 6.4
    88 * Requires PHP:      7.4
     
    1212 * Text Domain:       snap-blocks
    1313 * Domain Path:       /languages
     14 *
    1415 */
    15 
    1616use Devnet\SnapBlocks\Includes\Plugin;
    17 
    18 if (!defined('ABSPATH')) {
     17if ( !defined( 'ABSPATH' ) ) {
    1918    exit;
    2019}
    21 
    22 if (function_exists('devnet_sb_fs')) {
    23     devnet_sb_fs()->set_basename(true, __FILE__);
     20if ( function_exists( 'devnet_sb_fs' ) ) {
     21    devnet_sb_fs()->set_basename( false, __FILE__ );
    2422} else {
    25     if (!function_exists('devnet_sb_fs')) {
     23    if ( !function_exists( 'devnet_sb_fs' ) ) {
    2624        // Create a helper function for easy SDK access.
    27         function devnet_sb_fs()
    28         {
     25        function devnet_sb_fs() {
    2926            global $devnet_sb_fs;
    30 
    31             if (!isset($devnet_sb_fs)) {
     27            if ( !isset( $devnet_sb_fs ) ) {
    3228                // Include Freemius SDK.
    3329                require_once __DIR__ . '/vendor/freemius/wordpress-sdk/start.php';
    34 
    35                 $devnet_sb_fs = fs_dynamic_init([
     30                $devnet_sb_fs = fs_dynamic_init( [
    3631                    'id'               => '21030',
    3732                    'slug'             => 'snap-blocks',
     
    4035                    'is_org_compliant' => true,
    4136                    'is_premium'       => false,
     37                    'premium_suffix'   => 'Pro',
    4238                    'has_addons'       => false,
    43                     'has_paid_plans'   => false,
     39                    'has_paid_plans'   => true,
     40                    'trial'            => [
     41                        'days'               => 7,
     42                        'is_require_payment' => true,
     43                    ],
    4444                    'menu'             => [
    45                         'slug'    => 'edit.php?post_type=snap_block',
    46                         'account' => false
    47                     ]
    48                 ]);
     45                        'slug' => 'edit.php?post_type=snap_block',
     46                    ],
     47                    'is_live'          => true,
     48                ] );
    4949            }
    50 
    5150            return $devnet_sb_fs;
    5251        }
     
    5554        devnet_sb_fs();
    5655        // Signal that SDK was initiated.
    57         do_action('devnet_sb_fs_loaded');
     56        do_action( 'devnet_sb_fs_loaded' );
    5857    }
    59 
    60     if (!function_exists('devnet_sb_fs_is_submenu_visible')) {
    61         function devnet_sb_fs_is_submenu_visible($is_visible, $menu_id)
    62         {
    63             if ('contact' != $menu_id) {
     58    if ( !function_exists( 'devnet_sb_fs_is_submenu_visible' ) ) {
     59        function devnet_sb_fs_is_submenu_visible(  $is_visible, $menu_id  ) {
     60            if ( 'contact' != $menu_id ) {
    6461                return $is_visible;
    6562            }
    66 
    6763            return devnet_sb_fs()->can_use_premium_code();
    6864        }
     65
    6966    }
     67    if ( !function_exists( 'devnet_sb_fs_custom_icon' ) ) {
     68        function devnet_sb_fs_custom_icon() {
     69            return dirname( __FILE__ ) . '/assets/images/logo.png';
     70        }
    7071
    71     if (!function_exists('devnet_sb_fs_custom_icon')) {
    72         function devnet_sb_fs_custom_icon()
    73         {
    74             return dirname(__FILE__) . '/assets/images/logo.png';
    75         }
    7672    }
    77 
    7873    /*
    7974     * Run Freemius actions and filters.
    8075     */
    81     if (function_exists('devnet_sb_fs')) {
    82         devnet_sb_fs()->add_filter('is_submenu_visible', 'devnet_sb_fs_is_submenu_visible', 10, 2);
    83         devnet_sb_fs()->add_filter('plugin_icon', 'devnet_sb_fs_custom_icon');
     76    if ( function_exists( 'devnet_sb_fs' ) ) {
     77        devnet_sb_fs()->add_filter(
     78            'is_submenu_visible',
     79            'devnet_sb_fs_is_submenu_visible',
     80            10,
     81            2
     82        );
     83        devnet_sb_fs()->add_filter( 'plugin_icon', 'devnet_sb_fs_custom_icon' );
    8484    }
    85 
    86     define('DEVNET_SNAP_BLOCKS_VERSION', '1.1.2');
    87     define('DEVNET_SNAP_BLOCKS_NAME', 'snap-blocks');
    88     define('DEVNET_SNAP_BLOCKS_PATH_DIR', plugin_dir_path(__FILE__));
    89     define('DEVNET_SNAP_BLOCKS_PATH_FILE', plugin_basename(__FILE__));
    90     define('DEVNET_SNAP_BLOCKS_URL', plugin_dir_url(__FILE__));
    91 
    92     add_action('plugins_loaded', function () {
    93 
     85    define( 'DEVNET_SNAP_BLOCKS_VERSION', '1.2.0' );
     86    define( 'DEVNET_SNAP_BLOCKS_NAME', 'snap-blocks' );
     87    define( 'DEVNET_SNAP_BLOCKS_PATH_DIR', plugin_dir_path( __FILE__ ) );
     88    define( 'DEVNET_SNAP_BLOCKS_PATH_FILE', plugin_basename( __FILE__ ) );
     89    define( 'DEVNET_SNAP_BLOCKS_URL', plugin_dir_url( __FILE__ ) );
     90    add_action( 'plugins_loaded', function () {
    9491        require DEVNET_SNAP_BLOCKS_PATH_DIR . 'includes/plugin.php';
    9592        $plugin = new Plugin();
    9693        $plugin->run();
    97     });
     94    } );
    9895}
  • snap-blocks/trunk/vendor/composer/installed.php

    r3418044 r3460601  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '1b47485e1a756a86d640a0cc7e493b45589205f3',
     6        'reference' => '2dd9efb8d4ae4b9fa7f55d100b2920ac7e00b8c4',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '1b47485e1a756a86d640a0cc7e493b45589205f3',
     16            'reference' => '2dd9efb8d4ae4b9fa7f55d100b2920ac7e00b8c4',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.