Skip to content

Commit

Permalink
Add update mechanism and vendor folder
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rgiosan committed Dec 3, 2024
1 parent 819170e commit 980ff06
Show file tree
Hide file tree
Showing 138 changed files with 12,473 additions and 52 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#---------------------------
# Project
#---------------------------
vendor/
node_modules/
.node_history
package-lock.json
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/).

## [Unreleased]
## [0.6.0] - 2024-12-03

### Added

- Update mechanism and vendor folder.

### Changed

Expand Down
2 changes: 1 addition & 1 deletion build/slide/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '0a740d6ca82e152eb287');
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-hooks', 'wp-i18n'), 'version' => 'e922184faa9549f3b07b');
2 changes: 1 addition & 1 deletion build/slide/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/slider/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '3bd03fa0e01bbd69886f');
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '1591790e6341766ae4c2');
2 changes: 1 addition & 1 deletion build/slider/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/slider/view.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '90143aba5963e7d99a98');
<?php return array('dependencies' => array(), 'version' => 'cc9ee6ffd51d8ecb9964');
2 changes: 1 addition & 1 deletion build/slider/view.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"autoload": {},
"require": {
"php": "^8.2",
"composer-plugin-api": "^2.3"
"composer-plugin-api": "^2.3",
"yahnis-elsts/plugin-update-checker": "^5.5"
},
"require-dev": {
"phpcompatibility/php-compatibility": "dev-develop as 9.99.99",
Expand Down
115 changes: 83 additions & 32 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 27 additions & 11 deletions slider-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Plugin URI: https://pixelalbatross.pt/?utm_source=wp-plugins&utm_medium=slider-block&utm_campaign=plugin-uri
* Requires at least: 6.1
* Requires PHP: 7.4
* Version: 0.5.0
* Version: 0.6.0
* Author: Pixel Albatross
* Author URI: https://pixelalbatross.pt/?utm_source=wp-plugins&utm_medium=slider-block&utm_campaign=author-uri
* License: GPL-2.0-or-later
Expand All @@ -17,12 +17,28 @@
* @package pixelalbatross/slider-block
*/

namespace PixelAlbatross\WP\AccordionBlock;

use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}

define( 'PIXELALBATROSS_SLIDER_BLOCK_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'PIXALB_SLIDER_BLOCK_PATH', plugin_dir_path( __FILE__ ) );

if ( file_exists( PIXALB_SLIDER_BLOCK_PATH . 'vendor/autoload.php' ) ) {
require_once PIXALB_SLIDER_BLOCK_PATH . 'vendor/autoload.php';
}

$updater = PucFactory::buildUpdateChecker(
'https://github.com/pixelalbatross/slider-block/',
__FILE__,
'slider-block'
);

$updater->setBranch( 'main' );

/**
* Registers the block using the metadata loaded from the `block.json` file.
Expand All @@ -31,9 +47,9 @@
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
function pixelalbatross_slider_block_init() {
function slider_block_init() {

$block_json_files = glob( PIXELALBATROSS_SLIDER_BLOCK_PLUGIN_PATH . 'build/*/block.json' );
$block_json_files = glob( PIXALB_SLIDER_BLOCK_PATH . 'build/*/block.json' );

foreach ( $block_json_files as $filename ) {

Expand All @@ -45,30 +61,30 @@ function pixelalbatross_slider_block_init() {
wp_set_script_translations(
$handle,
'slider-block',
PIXELALBATROSS_SLIDER_BLOCK_PLUGIN_PATH . 'languages'
PIXALB_SLIDER_BLOCK_PATH . 'languages'
);
}
}
}
}
add_action( 'init', 'pixelalbatross_slider_block_init' );
add_action( 'init', __NAMESPACE__ . '\slider_block_init' );

/**
* Registers the block textdomain.
*
* @return void
*/
function pixelalbatross_slider_block_i18n() {
load_plugin_textdomain( 'slider-block', false, plugin_basename( PIXELALBATROSS_SLIDER_BLOCK_PLUGIN_PATH ) . '/languages' );
function slider_block_i18n() {
load_plugin_textdomain( 'slider-block', false, plugin_basename( PIXALB_SLIDER_BLOCK_PATH ) . '/languages' );
}
add_action( 'plugins_loaded', 'pixelalbatross_slider_block_i18n' );
add_action( 'plugins_loaded', __NAMESPACE__ . '\slider_block_i18n' );

/**
* Handles JavaScript detection.
*
* Adds a `js` class to the root `<html>` element when JavaScript is detected.
*/
function pixelalbatross_slider_block_js_detection() {
function slider_block_js_detection() {
echo "<script>!function(s){s.classList.contains('js')?s.classList:s.classList.add('js')}(document.documentElement);</script>\n";
}
add_action( 'wp_head', 'pixelalbatross_slider_block_js_detection', 0 );
add_action( 'wp_head', __NAMESPACE__ . '\slider_block_js_detection', 0 );
Loading

0 comments on commit 980ff06

Please sign in to comment.