Plugin Directory

Changeset 2830826


Ignore:
Timestamp:
12/08/2022 10:03:08 PM (3 years ago)
Author:
Lugat
Message:

Added shortcode for injects.

Location:
jinx-fast-cache/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • jinx-fast-cache/trunk/index.php

    r2726594 r2830826  
    55   * Plugin URI: https://wordpress.org/plugins/jixn-fast-cache/
    66   * Description: Blazing fast full page cache.
    7    * Version: 0.3.8
     7   * Version: 0.4.1
    88   * Author: SquareFlower Websolutions (Lukas Rydygel) <hallo@squareflower.de>
    99   * Author URI: http://squareflower.de
  • jinx-fast-cache/trunk/readme.txt

    r2726150 r2830826  
    33Tags: cache, fullpage, pagecache, filecache, rewrite, htaccess
    44Requires at least: 5.0
    5 Tested up to: 5.9.3
     5Tested up to: 6.0
    66Requires PHP: 7.0
    77Stable tag: 0.3.6
     
    1414
    1515Jinx Fast-Cache provides a very simple but efficient way of full page caching to WordPress.
    16 It will generate static HTML files which will be called using your apaches rewrite rules.
     16It will generate static HTML files which will be called using your servers rewrite rules.
    1717This feature will bypass the whole PHP process and render only a simple HTML file without the whole overhead.
    1818
     
    5151The warm process will create a queue which will be handled in a scheduled task (cron). When warming up a single post, it will skip the queue.
    5252
     53The plugin will automatically flush and warm the cache after an update has been completed.
     54
    5355== Developers ==
    5456
     
    7779Inject a template:
    7880
    79     do_action('jinx_fast_cache_inject_template', null, 'user');
     81    do_action('jinx_fast_cache_inject_template', 'user');
    8082
    8183This has the same result as:
    8284
    83     do_action('jinx_fast_cache_inject', null, 'get_template_part', ['user']);
     85    do_action('jinx_fast_cache_inject', 'get_template_part', ['user']);
    8486
    8587You may call every public function of PHP, your theme or plugin:
    8688
    87     do_action('jinx_fast_cache_inject', null, 'date', ['Y']);
    88     do_action('jinx_fast_cache_inject', null, 'my_function', ['param1', 'param2']);
    89     do_action('jinx_fast_cache_inject', null, 'namespace\MyClass::myMethod', ['param1', 'param2']);
    90     do_action('jinx_fast_cache_inject', null, ['namespace\MyClass', 'myMethod'], ['param1', 'param2']);
     89    do_action('jinx_fast_cache_inject', 'date', ['Y']);
     90    do_action('jinx_fast_cache_inject', 'my_function', ['param1', 'param2']);
     91    do_action('jinx_fast_cache_inject', 'namespace\MyClass::myMethod', ['param1', 'param2']);
     92    do_action('jinx_fast_cache_inject', ['namespace\MyClass', 'myMethod'], ['param1', 'param2']);
     93
     94Inside the editor, you may also use shortcodes to inject content.
     95
     96    [jinx_fast_cache_inject]My dynamic content or other shortcodes can be used here[/jinx_fast_cache_inject]
    9197
    9298== Roadmap ==
     
    100106- [ ] Provide exclude option for posts and terms in backend
    101107- [x] Add multisite support
     108- [x] Flush and warm after update complete
    102109- [ ] Provide cache timeout
    103110- [ ] Provide admin panel to change options
     111- [x] Add shortcode for injects
  • jinx-fast-cache/trunk/src/Admin.php

    r2726594 r2830826  
    2121      add_action('admin_enqueue_scripts', function() {
    2222        wp_enqueue_style('jinx-fast-cache', plugin_dir_url(__FILE__).'../assets/css/admin.css');
     23      });
     24     
     25      add_action('upgrader_process_complete', function($object, $options) {
     26        self::actionRefresh();
    2327      });
    2428     
  • jinx-fast-cache/trunk/src/Front.php

    r2726150 r2830826  
    4040      });
    4141     
    42       add_action('jinx_fast_cache_inject', function($placeholder, $function, array $args = []) {
     42      add_action('jinx_fast_cache_inject', function($function, array $args = [], $placeholder = null) {
    4343        echo self::inject($function, $args, $placeholder);
    4444      }, 10, 3);
    4545
    46       add_action('jinx_fast_cache_inject_template', function($placeholder, string $template) {
     46      add_action('jinx_fast_cache_inject_template', function(string $template, $placeholder = null) {
    4747        echo self::inject('get_template_part', [$template], $placeholder);
    4848      }, 10, 2);
     
    5050      add_filter('jinx_fast_cache_output', function($html) {
    5151        return apply_filters('jinx_fast_cache_minify', true) ? Helper::minify($html) : $html;
     52      });
     53     
     54      add_shortcode('jinx_fast_cache_inject', function($attr, $content) {
     55        return self::inject('do_shortcode', [$content]);
    5256      });
    5357     
Note: See TracChangeset for help on using the changeset viewer.