{"id":13534721,"url":"https://github.com/WordPressUtilities/wpucacheblocks","last_synced_at":"2025-04-02T00:30:40.675Z","repository":{"id":78941975,"uuid":"78289563","full_name":"WordPressUtilities/wpucacheblocks","owner":"WordPressUtilities","description":"Cache Blocks","archived":false,"fork":false,"pushed_at":"2023-08-02T15:57:43.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-02T08:09:38.834Z","etag":null,"topics":["wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WordPressUtilities.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-01-07T16:20:25.000Z","updated_at":"2023-08-02T15:57:47.000Z","dependencies_parsed_at":"2024-01-14T02:37:17.519Z","dependency_job_id":"2cef9bc4-f2e9-4a04-9ec1-39890cc3a484","html_url":"https://github.com/WordPressUtilities/wpucacheblocks","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WordPressUtilities%2Fwpucacheblocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WordPressUtilities%2Fwpucacheblocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WordPressUtilities%2Fwpucacheblocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WordPressUtilities%2Fwpucacheblocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WordPressUtilities","download_url":"https://codeload.github.com/WordPressUtilities/wpucacheblocks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222784453,"owners_count":17037192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress","wordpress-plugin"],"created_at":"2024-08-01T08:00:37.481Z","updated_at":"2024-11-02T22:30:53.855Z","avatar_url":"https://github.com/WordPressUtilities.png","language":"PHP","funding_links":[],"categories":["Caching Helping Plugins"],"sub_categories":[],"readme":"# WPU Cache Blocks\n\nCache Blocks\n\n## How to setup blocks.\n\n```php\nadd_filter('wpucacheblocks_blocks', 'demo_wpucacheblocks_blocks', 10, 1);\nfunction demo_wpucacheblocks_blocks($blocks) {\n    $blocks['headersearch'] = array(\n        'path' =\u003e '/tpl/header/searchform.php'\n    );\n    return $blocks;\n}\n```\n\n### Global settings :\n\n#### filter : wpucacheblocks_cacheprefix (string: default wpucacheblocks_)\n\nString used to prefix cache keys \u0026 cache filenames (only [a-z0-9_] chars). Default : *wpucacheblocks_*.\n\n#### filter : wpucacheblocks_cachetype (string: default file)\n\nCache method. You can choose between 'file' and 'apc'\n\n#### filter : wpucacheblocks_cachedir (string: default wp-content/uploads/wpucacheblocks/)\n\nAbsolute path to the file cache dir.\n\n### Settings per block :\n\n#### path (string)\n\nPath to the file, relative to the Stylesheet Directory.\nYou can also use 'fullpath', which is an absolute path to the file that will be cached.\n\n#### expires (int: default 3600)\n\nDuration in seconds after which the block will be refreshed.\nIf 0, the block will never be refreshed in front, only via a hook.\n\n#### reload_hooks (array of callbacks)\n\nAn array of hooks that will trigger a refresh for the block.\n\n#### callback_prefix (callback function)\n\nA callback for a function to prefix version of each cached block.\n\n## How to display a block content.\n\n```php\necho wpucacheblocks_block('headersearch');\n```\n\n## Custom function to allow plugin deactivation :\n\n```php\nfunction custom_wpucacheblocks_block($blockid) {\n    if (function_exists('wpucacheblocks_block')) {\n        return wpucacheblocks_block($blockid);\n    }\n    $blocks = apply_filters('wpucacheblocks_blocks', array());\n    if (!is_array($blocks) || !isset($blocks[$blockid], $blocks[$blockid]['path'])) {\n        return '';\n    }\n    ob_start();\n    include $blocks[$blockid]['path'];\n    return ob_get_clean();\n}\necho custom_wpucacheblocks_block('headersearch');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWordPressUtilities%2Fwpucacheblocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWordPressUtilities%2Fwpucacheblocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWordPressUtilities%2Fwpucacheblocks/lists"}