├── add-ons └── bp-search-block │ ├── block │ ├── view.asset.php │ ├── index.asset.php │ ├── index.css │ ├── view.js │ ├── block.json │ ├── view.css │ └── index.js │ ├── languages │ ├── bp-search-block-fr_FR.mo │ ├── bp-search-block-fr_FR-bp-search-form-editor-script.json │ ├── bp-search-block-fr_FR.po │ └── bp-search-block.pot │ ├── assets │ └── search.svg │ ├── bp-search-block.php │ └── readme.txt ├── src ├── .babelrc └── bp-search-block │ ├── editor-style.scss │ ├── imports │ ├── options-radiogroup.js │ ├── option-checkbox.js │ ├── constants.js │ ├── save.js │ └── edit.js │ ├── block.json │ ├── index.js │ ├── view.js │ └── view-style.scss ├── .gitignore ├── README.md ├── bin ├── move-addon-assets.sh └── build-block-zip.sh ├── .editorconfig ├── inc ├── globals.php └── functions.php ├── webpack.config.js ├── composer.json ├── package.json ├── class-bp-blocks.php └── composer.lock /add-ons/bp-search-block/block/view.asset.php: -------------------------------------------------------------------------------- 1 | array('wp-dom-ready'), 'version' => '5da4f14f706cabd7e338'); 2 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/languages/bp-search-block-fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/buddypress/bp-blocks/HEAD/add-ons/bp-search-block/languages/bp-search-block-fr_FR.mo -------------------------------------------------------------------------------- /add-ons/bp-search-block/block/index.asset.php: -------------------------------------------------------------------------------- 1 | array('bp-block-data', 'lodash', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'aacab27abd26f86be867'); 2 | -------------------------------------------------------------------------------- /src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "ignore": ["./bp-*/js/view.js"], 3 | "presets": ["@wordpress/default"], 4 | "plugins": [ 5 | [ 6 | "transform-react-jsx", 7 | { 8 | "pragma": "createElement" 9 | } 10 | ] 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Operating system specific files 2 | .DS_Store 3 | .DS_* 4 | ._* 5 | .Spotlight-V100 6 | .Trashes 7 | ehthumbs.db 8 | Thumbs.db 9 | 10 | # Files and folders related to build/test tools 11 | node_modules 12 | npm-debug.log 13 | vendor 14 | dist 15 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/block/index.css: -------------------------------------------------------------------------------- 1 | .wp-block-bp-search-form .bp-search-button{align-items:center;border-radius:initial;display:flex;height:auto}.wp-block-bp-search-form__components-button-group{margin-top:10px}.wp-block[data-align=center] .wp-block-bp-search-form .bp-block-search__inside-wrapper{margin:auto} 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BuddyPress Blocks 2 | 3 | BuddyPress 6.0.0 introduced the BP Member and BP Group Blocks, let's develop some other blocks for BuddyPress using this repository. 4 | 5 | ![Blocks Category](https://bpdevel.files.wordpress.com/2019/07/screenshot.png) 6 | 7 | You're very welcome to contribute to this repository suggesting your Block Ideas or submitting pull requests. 8 | -------------------------------------------------------------------------------- /bin/move-addon-assets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit if any command fails 4 | set -e 5 | 6 | # Change to the expected directory 7 | cd ./dist/$1 8 | 9 | # Enable nicer messaging for build status 10 | YELLOW_BOLD='\033[1;33m'; 11 | COLOR_RESET='\033[0m'; 12 | status () { 13 | echo -e "\n${YELLOW_BOLD}$1${COLOR_RESET}\n" 14 | } 15 | 16 | # Rename assets 17 | status "Moving $1 Add-on assets..." 18 | 19 | for f in * 20 | do echo "Processing $f" 21 | mv $f ../../add-ons/$1/block 22 | done 23 | 24 | status "Done." 25 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | # WordPress Coding Standards 5 | # https://make.wordpress.org/core/handbook/coding-standards/ 6 | 7 | root = true 8 | 9 | [*] 10 | charset = utf-8 11 | end_of_line = lf 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | indent_style = tab 15 | 16 | [*.yml] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | 23 | [{*.txt,wp-config-sample.php}] 24 | end_of_line = crlf 25 | -------------------------------------------------------------------------------- /src/bp-search-block/editor-style.scss: -------------------------------------------------------------------------------- 1 | 2 | /* Styles for the Block editor. */ 3 | 4 | /* It's mainly a copy of the `wp-block-search` styles. */ 5 | 6 | .wp-block-bp-search-form { 7 | 8 | .bp-search-button { 9 | height: auto; 10 | border-radius: initial; 11 | display: flex; 12 | align-items: center; 13 | } 14 | 15 | &__components-button-group { 16 | margin-top: 10px; 17 | } 18 | } 19 | 20 | .wp-block[data-align="center"] { 21 | 22 | .wp-block-bp-search-form { 23 | 24 | .bp-block-search__inside-wrapper { 25 | margin: auto; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /bin/build-block-zip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit if any command fails 4 | set -e 5 | 6 | # Change to the expected directory 7 | cd "$(dirname "$0")" 8 | cd ../add-ons/$1 9 | 10 | # Enable nicer messaging for build status 11 | YELLOW_BOLD='\033[1;33m'; 12 | COLOR_RESET='\033[0m'; 13 | status () { 14 | echo -e "\n${YELLOW_BOLD}$1${COLOR_RESET}\n" 15 | } 16 | 17 | # Remove any existing zip file 18 | rm -f $1.zip 19 | 20 | # Generate the plugin zip file 21 | status "Creating archive..." 22 | zip -r $1.zip \ 23 | assets \ 24 | css \ 25 | js \ 26 | languages \ 27 | block.json \ 28 | $1.php \ 29 | readme.txt 30 | 31 | status "Done." 32 | -------------------------------------------------------------------------------- /src/bp-search-block/imports/options-radiogroup.js: -------------------------------------------------------------------------------- 1 | /** 2 | * WordPress dependencies. 3 | */ 4 | import { RadioControl } from '@wordpress/components'; 5 | import { useState } from '@wordpress/element'; 6 | 7 | const SearchOptionsRadioGroup = ( { selected, options, onSelected } ) => { 8 | const [ option, setOption ] = useState( selected ); 9 | 10 | const setChanged = ( value ) => { 11 | onSelected( value ); 12 | setOption( value ); 13 | }; 14 | 15 | return ( 16 | setChanged( value ) } 20 | /> 21 | ); 22 | }; 23 | 24 | export default SearchOptionsRadioGroup; 25 | -------------------------------------------------------------------------------- /inc/globals.php: -------------------------------------------------------------------------------- 1 | version = '12.0.0-alpha'; 25 | 26 | // Path. 27 | $bpb->dir = plugin_dir_path( dirname( __FILE__ ) ); 28 | 29 | // URL. 30 | $bpb->url = plugins_url( '', dirname( __FILE__ ) ); 31 | 32 | // Activity update recorded time. 33 | $bpb->activity_recorded_time = ''; 34 | } 35 | add_action( 'bp_include', __NAMESPACE__ . '\globals' ); 36 | -------------------------------------------------------------------------------- /src/bp-search-block/imports/option-checkbox.js: -------------------------------------------------------------------------------- 1 | /** 2 | * WordPress dependencies. 3 | */ 4 | import { 5 | CheckboxControl, 6 | Disabled, 7 | } from '@wordpress/components'; 8 | import { useState } from '@wordpress/element'; 9 | 10 | const SearchOptionCheckbox = ( { label, option, checked, onChecked, defaultOption } ) => { 11 | const [ isChecked, setChecked ] = useState(); 12 | 13 | const setChanged = ( value ) => { 14 | onChecked( option, value ); 15 | setChecked( value ); 16 | }; 17 | 18 | const optionCheckbox = ( 19 | setChanged( value ) } 23 | /> 24 | ); 25 | 26 | if ( option === defaultOption ) { 27 | return ( 28 | { optionCheckbox } 29 | ); 30 | } 31 | 32 | return optionCheckbox; 33 | }; 34 | 35 | export default SearchOptionCheckbox; 36 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/assets/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/block/view.js: -------------------------------------------------------------------------------- 1 | !function(){"use strict";var e={n:function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,{a:r}),r},d:function(t,r){for(var c in r)e.o(r,c)&&!e.o(t,c)&&Object.defineProperty(t,c,{enumerable:!0,get:r[c]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},t=window.wp.domReady,r=e.n(t);class c{constructor(){this.controls=document.querySelectorAll(".wp-block-bp-search-form"),this.increment=0}setForHtml(){this.controls.forEach((e=>{if(e.querySelector(".bp-search-label")){this.increment+=1;const t="bp-search-terms-"+this.increment;e.querySelector('[name="search-terms"]').setAttribute("id",t),e.querySelector(".bp-search-label").setAttribute("for",t)}}))}setRadioListeners(){this.controls.forEach((e=>{const t=e.querySelector('[name="search-terms"]');e.querySelectorAll('[name="search-which"]').forEach((e=>{e.addEventListener("click",(e=>{!0===e.target.checked&&t.setAttribute("placeholder",e.target.dataset.placeholder)}))}))}))}start(){this.setForHtml(),this.setRadioListeners()}}r()((()=>{document.querySelector("body").classList.contains("wp-admin")||(new c).start()}))}(); -------------------------------------------------------------------------------- /inc/functions.php: -------------------------------------------------------------------------------- 1 | 'text/x-php', 24 | ); 25 | } 26 | 27 | /** 28 | * Only includes Active components' blocks PHP script. 29 | * 30 | * @since 6.0.0 31 | */ 32 | function inc() { 33 | // BuddyPress add-ons blocks. 34 | $addons_dir = trailingslashit( bp_blocks()->dir ) . 'add-ons'; 35 | 36 | add_filter( 'mime_types', __NAMESPACE__ . '\filter_mimes' ); 37 | $blocks = bp_attachments_list_directory_files_recursively( $addons_dir ); 38 | remove_filter( 'mime_types', __NAMESPACE__ . '\filter_mimes' ); 39 | 40 | foreach ( $blocks as $block ) { 41 | if ( wp_basename( $block->parent_dir_path ) !== wp_basename( $block->name, '.php' ) ) { 42 | continue; 43 | } 44 | 45 | include_once $block->path; 46 | } 47 | } 48 | add_action( 'bp_include', __NAMESPACE__ . '\inc', 20 ); 49 | -------------------------------------------------------------------------------- /src/bp-search-block/imports/constants.js: -------------------------------------------------------------------------------- 1 | /** 2 | * WordPress dependencies. 3 | */ 4 | import { _x, __ } from '@wordpress/i18n'; 5 | 6 | /** 7 | * BP Search Form options. 8 | * 9 | * Depending on BP Active components, some of this options might be removed. 10 | * 11 | * @type {Array} 12 | */ 13 | export const SEARCH_OPTIONS = [ 14 | { 15 | label: _x( 'Activities', 'search form', 'bp-search-block' ), 16 | value: 'activity', 17 | requiredFeature: '', 18 | placeholder: __( 'Search activities', 'bp-search-block' ), 19 | }, 20 | { 21 | label: _x( 'Members', 'search form', 'bp-search-block' ), 22 | value: 'members', 23 | requiredFeature: '', 24 | placeholder: __( 'Search members', 'bp-search-block' ), 25 | }, 26 | { 27 | label: _x( 'Groups', 'search form', 'bp-search-block' ), 28 | value: 'groups', 29 | requiredFeature: '', 30 | placeholder: __( 'Search groups', 'bp-search-block' ), 31 | }, 32 | { 33 | label: _x( 'Blogs', 'search form', 'bp-search-block' ), 34 | value: 'blogs', 35 | requiredFeature: 'sites_directory', 36 | placeholder: __( 'Search blogs', 'bp-search-block' ), 37 | }, 38 | { 39 | label: _x( 'Posts', 'search form', 'bp-search-block' ), 40 | value: 'posts', 41 | placeholder: __( 'Search posts', 'bp-search-block' ), 42 | }, 43 | ]; 44 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require( 'path' ); 2 | 3 | /** 4 | * WordPress Dependencies 5 | */ 6 | const defaultConfig = require( '@wordpress/scripts/config/webpack.config.js' ); 7 | const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' ); 8 | 9 | module.exports = { 10 | ...defaultConfig, 11 | ...{ 12 | entry: { 13 | 'bp-search-block/index': './src/bp-search-block/index.js', 14 | 'bp-search-block/view': './src/bp-search-block/view.js', 15 | }, 16 | output: { 17 | filename: '[name].js', 18 | path: path.resolve( __dirname, 'dist' ), 19 | } 20 | }, 21 | plugins: [ 22 | ...defaultConfig.plugins.filter( 23 | ( plugin ) => 24 | plugin.constructor.name !== 'DependencyExtractionWebpackPlugin' 25 | ), 26 | new DependencyExtractionWebpackPlugin( { 27 | requestToExternal( request ) { 28 | if ( request === '@buddypress/block-components' ) { 29 | return [ 'bp', 'blockComponents' ]; 30 | } else if ( request === '@buddypress/block-data' ) { 31 | return [ 'bp', 'blockData' ]; 32 | } 33 | }, 34 | requestToHandle( request ) { 35 | if ( request === '@buddypress/block-components' ) { 36 | return 'bp-block-components'; 37 | } else if ( request === '@buddypress/block-data' ) { 38 | return 'bp-block-data'; 39 | } 40 | } 41 | } ) 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /src/bp-search-block/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 2, 3 | "name": "bp/search-form", 4 | "title": "Community Search", 5 | "category": "widgets", 6 | "icon": "search", 7 | "description": "A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!", 8 | "keywords": [ "BuddyPress", "search", "community" ], 9 | "textdomain": "bp-search-block", 10 | "attributes": { 11 | "label": { 12 | "type": "string", 13 | "source": "html", 14 | "selector": ".bp-search-label", 15 | "default": "Search" 16 | }, 17 | "useLabel": { 18 | "type": "boolean", 19 | "default": true 20 | }, 21 | "buttonText": { 22 | "type": "string", 23 | "source": "html", 24 | "selector": ".bp-search-button", 25 | "default": "Search" 26 | }, 27 | "useIcon": { 28 | "type": "boolean", 29 | "default": false 30 | }, 31 | "placeholder": { 32 | "type": "string", 33 | "default": "" 34 | }, 35 | "activeOptions": { 36 | "type": "array", 37 | "default": ["posts"] 38 | }, 39 | "defaultOption": { 40 | "type": "string", 41 | "default": "posts" 42 | }, 43 | "action": { 44 | "type": "string", 45 | "default": "" 46 | } 47 | }, 48 | "supports": { 49 | "align": true 50 | }, 51 | "editorScript": "file:index.js", 52 | "script": "file:view.js", 53 | "editorStyle": "file:index.css", 54 | "style": "file:view.css" 55 | } 56 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "buddypress/bp-blocks", 3 | "description": "BuddyPress Blocks development plugin.", 4 | "type": "buddypress-plugin", 5 | "homepage": "https://buddypress.org", 6 | "license": "GPL-2.0-or-later", 7 | "authors": [ { 8 | "name": "BuddyPress Community", 9 | "homepage": "https://buddypress.org/about/" 10 | } ], 11 | "support": { 12 | "forum": "https://buddypress.org/support/", 13 | "issues": "https://github.com/buddypress/bp-blocks/issues", 14 | "rss": "https://buddypress.org/feed/", 15 | "source": "https://github.com/buddypress/bp-blocks" 16 | }, 17 | "require": { 18 | "composer/installers": "^1.10.0", 19 | "php": ">=5.6.0" 20 | }, 21 | "require-dev": { 22 | "phpcompatibility/phpcompatibility-wp": "^2.1.0", 23 | "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", 24 | "squizlabs/php_codesniffer" : "^3.5.4", 25 | "wp-coding-standards/wpcs" : "^2.3.0", 26 | "php-parallel-lint/php-parallel-lint": "^1.3.0" 27 | }, 28 | "scripts": { 29 | "lint:wpcs": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs", 30 | "do:wpcs": "@php ./vendor/bin/phpcs --extensions=php --standard=WordPress inc build class-bp-blocks.php", 31 | "format": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf", 32 | "lint:php": "@php ./vendor/bin/parallel-lint --exclude .git --exclude node_modules --exclude vendor .", 33 | "phpcompat": "@php ./vendor/bin/phpcs -p --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 5.6- inc build class-bp-blocks.php" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/block/block.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 2, 3 | "name": "bp/search-form", 4 | "title": "Community Search", 5 | "category": "widgets", 6 | "icon": "search", 7 | "description": "A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!", 8 | "keywords": [ 9 | "BuddyPress", 10 | "search", 11 | "community" 12 | ], 13 | "textdomain": "bp-search-block", 14 | "attributes": { 15 | "label": { 16 | "type": "string", 17 | "source": "html", 18 | "selector": ".bp-search-label", 19 | "default": "Search" 20 | }, 21 | "useLabel": { 22 | "type": "boolean", 23 | "default": true 24 | }, 25 | "buttonText": { 26 | "type": "string", 27 | "source": "html", 28 | "selector": ".bp-search-button", 29 | "default": "Search" 30 | }, 31 | "useIcon": { 32 | "type": "boolean", 33 | "default": false 34 | }, 35 | "placeholder": { 36 | "type": "string", 37 | "default": "" 38 | }, 39 | "activeOptions": { 40 | "type": "array", 41 | "default": [ 42 | "posts" 43 | ] 44 | }, 45 | "defaultOption": { 46 | "type": "string", 47 | "default": "posts" 48 | }, 49 | "action": { 50 | "type": "string", 51 | "default": "" 52 | } 53 | }, 54 | "supports": { 55 | "align": true 56 | }, 57 | "editorScript": "file:index.js", 58 | "script": "file:view.js", 59 | "editorStyle": "file:index.css", 60 | "style": "file:view.css" 61 | } -------------------------------------------------------------------------------- /add-ons/bp-search-block/block/view.css: -------------------------------------------------------------------------------- 1 | .bp-search-button{background:#f7f7f7;border:1px solid #ccc;color:#32373c;font-family:inherit;font-size:inherit;line-height:inherit;margin-left:.625em;padding:.375em .625em;word-break:normal}.bp-search-button.has-icon{line-height:0}.bp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.bp-block-search-for__label,.bp-search-label{width:100%}.bp-block-search__input{border:1px solid #949494;flex-grow:1;font-family:inherit;font-size:inherit;line-height:inherit;min-width:3em;padding:8px}.bp-block-search.bp-block-search__button-only .bp-search-button{margin-left:0}.bp-block-search.bp-block-search__button-inside .bp-block-search__inside-wrapper{border:1px solid #949494;padding:4px}.bp-block-search.bp-block-search__button-inside .bp-block-search__inside-wrapper .bp-block-search__input{border:none;border-radius:0;padding:0 0 0 .25em}.bp-block-search.bp-block-search__button-inside .bp-block-search__inside-wrapper .bp-block-search__input:focus{outline:none}.bp-block-search.bp-block-search__button-inside .bp-block-search__inside-wrapper .bp-search-button{padding:.125em .5em}.bp-block-search.aligncenter .bp-block-search__inside-wrapper{margin:auto}.bp-block-search-for__wrapper{margin:.5em 0}.bp-block-search-for__wrapper .bp-block-search-for__options{list-style:none;margin:.2em 0;padding:0}.bp-block-search-for__wrapper .bp-block-search-for__options li label input[type=radio]{display:inline-block;margin-right:.5em}.bp-screen-reader-text{clip:rect(0 0 0 0);word-wrap:normal!important;border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px} 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bp-blocks", 3 | "version": "12.0.0-alpha", 4 | "description": "BuddyPress Blocks development plugin.", 5 | "engines": { 6 | "node": ">=14.15.0", 7 | "npm": ">=6.14.8" 8 | }, 9 | "scripts": { 10 | "wpcs": "composer run do:wpcs", 11 | "phpcompat": "composer run phpcompat", 12 | "pot:addon": "wp i18n make-pot add-ons/${npm_config_slug} add-ons/${npm_config_slug}/languages/${npm_config_slug}.pot --domain=${npm_config_slug} --exclude=\"assets,css,languages\" --headers='{\"Report-Msgid-Bugs-To\": \"https://github.com/buddypress/bp-blocks/issues\", \"Last-Translator\": \"imath \"}'", 13 | "po2json:addon": "wp i18n make-json add-ons/${npm_config_slug}/languages", 14 | "package:addon": "./bin/build-block-zip.sh ${npm_config_slug}", 15 | "move-addon-assets": "./bin/move-addon-assets.sh ${npm_config_slug}", 16 | "webpack:build": "wp-scripts build", 17 | "lint:css:src": "wp-scripts lint-style './src/**/*.scss'", 18 | "packages-update": "wp-scripts packages-update" 19 | }, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/buddypress/bp-blocks.git" 23 | }, 24 | "keywords": [ 25 | "buddypress", 26 | "blocks" 27 | ], 28 | "author": "The BuddyPress Contributors", 29 | "license": "GPL-2.0+", 30 | "bugs": { 31 | "url": "https://github.com/buddypress/bp-blocks/issues" 32 | }, 33 | "homepage": "https://github.com/buddypress/bp-blocks#readme", 34 | "devDependencies": { 35 | "@wordpress/babel-preset-default": "^7.12.0", 36 | "@wordpress/browserslist-config": "^5.11.0", 37 | "@wordpress/scripts": "^30.18.0", 38 | "postcss": "^8.4.31" 39 | }, 40 | "browserslist": [ 41 | "extends @wordpress/browserslist-config" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /src/bp-search-block/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * WordPress dependencies. 3 | */ 4 | import { registerBlockType } from '@wordpress/blocks'; 5 | import { __ } from '@wordpress/i18n'; 6 | 7 | /** 8 | * Internal dependencies. 9 | */ 10 | import './editor-style.scss'; 11 | import editSearchFormBlock from './imports/edit'; 12 | import saveSearchFormBlock from './imports/save'; 13 | import metadata from './block.json'; 14 | 15 | registerBlockType( metadata, { 16 | title: __( 'Community Search', 'bp-search-block' ), 17 | description: __( 'A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!', 'bp-search-block' ), 18 | icon: { 19 | background: '#fff', 20 | foreground: '#d84800', 21 | src: 'search', 22 | }, 23 | attributes: { 24 | label: { 25 | type: 'string', 26 | source: 'html', 27 | selector: '.bp-search-label', 28 | default: __( 'Search', 'bp-search-block' ), 29 | }, 30 | useLabel: { 31 | type: 'boolean', 32 | default: true, 33 | }, 34 | buttonText: { 35 | type: 'string', 36 | source: 'html', 37 | selector: '.bp-search-button', 38 | default: __( 'Search', 'bp-search-block' ), 39 | }, 40 | useIcon: { 41 | type: 'boolean', 42 | default: false, 43 | }, 44 | placeholder: { 45 | 'type': 'string', 46 | 'default': __( 'Search posts', 'bp-search-block' ), 47 | }, 48 | activeOptions: { 49 | type: 'array', 50 | default: ['posts'], 51 | }, 52 | defaultOption: { 53 | type: 'string', 54 | default: 'posts', 55 | }, 56 | action: { 57 | type: 'string', 58 | default: window.bpSearchFormAction || '', 59 | }, 60 | }, 61 | edit: editSearchFormBlock, 62 | save: saveSearchFormBlock, 63 | } ); 64 | -------------------------------------------------------------------------------- /src/bp-search-block/view.js: -------------------------------------------------------------------------------- 1 | /** 2 | * WordPress dependencies 3 | */ 4 | import domReady from '@wordpress/dom-ready'; 5 | 6 | /** 7 | * Internal dependency. 8 | */ 9 | import './view-style.scss'; 10 | 11 | /** 12 | * Sets the Search label for attribute and updates the search input's 13 | * placeholder according to the checked radio control. 14 | * 15 | * @since 1.0.0 16 | */ 17 | class BPSearchForm { 18 | constructor() { 19 | this.controls = document.querySelectorAll( '.wp-block-bp-search-form' ); 20 | this.increment = 0; 21 | } 22 | 23 | setForHtml() { 24 | this.controls.forEach( ( element ) => { 25 | const hasLabel = element.querySelector( '.bp-search-label' ); 26 | 27 | if ( !! hasLabel ) { 28 | this.increment +=1; 29 | const uniqId = 'bp-search-terms-' + this.increment; 30 | 31 | element.querySelector( '[name="search-terms"]' ).setAttribute( 'id', uniqId ); 32 | element.querySelector( '.bp-search-label' ).setAttribute( 'for', uniqId ); 33 | } 34 | } ); 35 | } 36 | 37 | setRadioListeners() { 38 | this.controls.forEach( ( element ) => { 39 | const searchTermsInput = element.querySelector( '[name="search-terms"]' ); 40 | 41 | element.querySelectorAll( '[name="search-which"]' ).forEach( ( radio ) => { 42 | radio.addEventListener( 'click', ( event ) => { 43 | if ( true === event.target.checked ) { 44 | searchTermsInput.setAttribute( 'placeholder', event.target.dataset.placeholder ); 45 | } 46 | } ); 47 | } ); 48 | } ); 49 | } 50 | 51 | start() { 52 | this.setForHtml(); 53 | this.setRadioListeners(); 54 | } 55 | } 56 | 57 | domReady( () => { 58 | if ( ! document.querySelector( 'body' ).classList.contains( 'wp-admin' ) ) { 59 | const bpSearchForm = new BPSearchForm(); 60 | 61 | bpSearchForm.start(); 62 | } 63 | } ); 64 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/languages/bp-search-block-fr_FR-bp-search-form-editor-script.json: -------------------------------------------------------------------------------- 1 | {"translation-revision-date":"2023-02-02 20:35+0100","generator":"WP-CLI\/2.5.0","source":"js\/index.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr","plural-forms":"nplurals=2; plural=(n > 1);"},"search form\u0004Activities":["Activit\u00e9s"],"Search activities":["Rechercher dans les activit\u00e9s"],"search form\u0004Members":["Membres"],"Search members":["Rechercher dans les membres"],"search form\u0004Groups":["Groupes"],"Search groups":["Rechercher dans les groupes"],"search form\u0004Blogs":["Sites"],"Search blogs":["Rechercher dans les sites"],"search form\u0004Posts":["Articles"],"Search posts":["Rechercher dans les articles"],"Search options":["Options de recherche"],"Display options":["Options d\u2019affichage"],"Show the search label":["Afficher le libell\u00e9 de recherche"],"Display a label over the search field.":["Affiche un libell\u00e9 au dessus du champ de recherche."],"Toggle to display a label over the search field.":["Activez pour afficher un libell\u00e9 au dessus du champ de recherche."],"Use a Search Icon":["Utiliser une ic\u00f4ne de recherche"],"Use a search icon instead of the search button text.":["Utilise une ic\u00f4ne de recherche en lieu et place du texte du bouton de recherche."],"Toggle to use a search icon instead of the search button text.":["Activez pour utiliser une ic\u00f4ne de recherche en lieu et place du texte du bouton de recherche."],"Label text":["Texte du libell\u00e9"],"Add label\u2026":["Ajouter un libell\u00e9\u2026"],"Search":["Recherche"],"Button text":["Texte du bouton"],"Add text\u2026":["Ajouter un texte\u2026"],"Search for:":["Rechercher :"],"Community Search":["Recherche communautaire"],"A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!":["Un bloc pour rechercher des articles, des sites, des activit\u00e9s, des membres ou des groupes depuis n\u2019importe quel article, page ou widget de votre site communautaire motoris\u00e9 par BuddyPress !"]}}} -------------------------------------------------------------------------------- /src/bp-search-block/view-style.scss: -------------------------------------------------------------------------------- 1 | 2 | /* Styles for the Front-end. */ 3 | 4 | /* It's mainly a copy of the `wp-block-search` styles. */ 5 | 6 | .bp-search-button { 7 | background: #f7f7f7; 8 | border: 1px solid #ccc; 9 | padding: 0.375em 0.625em; 10 | color: #32373c; 11 | margin-left: 0.625em; 12 | word-break: normal; 13 | font-size: inherit; 14 | font-family: inherit; 15 | line-height: inherit; 16 | 17 | &.has-icon { 18 | line-height: 0; 19 | } 20 | } 21 | 22 | .bp-block-search__inside-wrapper { 23 | display: flex; 24 | flex: auto; 25 | flex-wrap: nowrap; 26 | max-width: 100%; 27 | } 28 | 29 | .bp-search-label, 30 | .bp-block-search-for__label { 31 | width: 100%; 32 | } 33 | 34 | .bp-block-search__input { 35 | padding: 8px; 36 | flex-grow: 1; 37 | min-width: 3em; 38 | border: 1px solid #949494; 39 | font-size: inherit; 40 | font-family: inherit; 41 | line-height: inherit; 42 | } 43 | 44 | .bp-block-search.bp-block-search__button-only { 45 | 46 | .bp-search-button { 47 | margin-left: 0; 48 | } 49 | } 50 | 51 | .bp-block-search.bp-block-search__button-inside .bp-block-search__inside-wrapper { 52 | padding: 4px; 53 | border: 1px solid #949494; 54 | 55 | .bp-block-search__input { 56 | border-radius: 0; 57 | border: none; 58 | padding: 0 0 0 0.25em; 59 | 60 | &:focus { 61 | outline: none; 62 | } 63 | } 64 | 65 | .bp-search-button { 66 | padding: 0.125em 0.5em; 67 | } 68 | } 69 | 70 | .bp-block-search.aligncenter .bp-block-search__inside-wrapper { 71 | margin: auto; 72 | } 73 | 74 | .bp-block-search-for__wrapper { 75 | margin: 0.5em 0; 76 | 77 | .bp-block-search-for__options { 78 | list-style: none; 79 | padding: 0; 80 | margin: 0.2em 0; 81 | 82 | li label input[type="radio"] { 83 | display: inline-block; 84 | margin-right: 0.5em; 85 | } 86 | } 87 | } 88 | 89 | .bp-screen-reader-text { 90 | border: 0; 91 | clip: rect(0 0 0 0); 92 | height: 1px; 93 | margin: -1px; 94 | overflow: hidden; 95 | padding: 0; 96 | position: absolute; 97 | width: 1px; 98 | word-wrap: normal !important; 99 | } 100 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/bp-search-block.php: -------------------------------------------------------------------------------- 1 | \n" 6 | "Language-Team: \n" 7 | "MIME-Version: 1.0\n" 8 | "Content-Type: text/plain; charset=UTF-8\n" 9 | "Content-Transfer-Encoding: 8bit\n" 10 | "POT-Creation-Date: 2023-02-02T18:44:04+00:00\n" 11 | "PO-Revision-Date: 2023-02-02 20:35+0100\n" 12 | "Language: fr\n" 13 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" 14 | "X-Generator: Poedit 3.0.1\n" 15 | "X-Domain: bp-search-block\n" 16 | 17 | #. Plugin Name of the plugin 18 | msgid "BP Search Block" 19 | msgstr "BP Search Block" 20 | 21 | #. Plugin URI of the plugin 22 | msgid "https://github.com/buddypress/bp-blocks" 23 | msgstr "https://github.com/buddypress/bp-blocks" 24 | 25 | #. Description of the plugin 26 | msgid "Help the visitors or members of your BuddyPress powered community site to find the posts, the sites, the activities, the members or the groups they are looking for." 27 | msgstr "Aidez les visiteur·se·s ou membres de votre site communautaire motorisé par BuddyPress à trouver les articles, les sites, les activités, les membres ou les groupes qu’ils·elles recherchent." 28 | 29 | #. Author of the plugin 30 | msgid "The BuddyPress Community" 31 | msgstr "La communauté BuddyPress" 32 | 33 | #. Author URI of the plugin 34 | msgid "https://buddypress.org" 35 | msgstr "https://buddypress.org" 36 | 37 | #: block.json 38 | msgctxt "block title" 39 | msgid "Community Search" 40 | msgstr "Recherche communautaire" 41 | 42 | #: block.json 43 | msgctxt "block description" 44 | msgid "A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!" 45 | msgstr "Un bloc pour rechercher des articles, des sites, des activités, des membres ou des groupes depuis n’importe quel article, page ou widget de votre site communautaire motorisé par BuddyPress !" 46 | 47 | #: block.json 48 | msgctxt "block keyword" 49 | msgid "BuddyPress" 50 | msgstr "BuddyPress" 51 | 52 | #: block.json 53 | msgctxt "block keyword" 54 | msgid "search" 55 | msgstr "recherche" 56 | 57 | #: block.json 58 | msgctxt "block keyword" 59 | msgid "community" 60 | msgstr "communauté" 61 | -------------------------------------------------------------------------------- /src/bp-search-block/imports/save.js: -------------------------------------------------------------------------------- 1 | /** 2 | * WordPress dependencies. 3 | */ 4 | import { 5 | RichText, 6 | useBlockProps, 7 | } from '@wordpress/block-editor'; 8 | import { __ } from '@wordpress/i18n'; 9 | 10 | /** 11 | * Internal dependencies. 12 | */ 13 | import { SEARCH_OPTIONS } from './constants'; 14 | 15 | const saveSearchFormBlock = ( { attributes } ) => { 16 | const blockProps = useBlockProps.save(); 17 | const { 18 | label, 19 | useLabel, 20 | buttonText, 21 | useIcon, 22 | placeholder, 23 | activeOptions, 24 | defaultOption, 25 | action, 26 | } = attributes; 27 | const enabledSearchOptions = SEARCH_OPTIONS.filter( ( option ) => -1 !== activeOptions.indexOf( option.value ) ); 28 | let options = []; 29 | 30 | enabledSearchOptions.forEach( ( option, key ) => { 31 | let isChecked = false; 32 | 33 | if ( option.value === defaultOption ) { 34 | isChecked = 'checked'; 35 | } 36 | 37 | options.push( 38 |
  • 39 | 43 |
  • 44 | ); 45 | } ); 46 | 47 | return ( 48 |
    49 |
    50 | { useLabel && ( 51 | 52 | ) } 53 |
    54 | 60 | 61 | { !! useIcon && ( 62 | 70 | ) } 71 | 72 | { ! useIcon && ( 73 | 74 | ) } 75 |
    76 |
    77 | { __( 'Search for:', 'bp-search-block' ) } 78 |
      79 | { options } 80 |
    81 |
    82 | 83 |
    84 | ); 85 | }; 86 | 87 | export default saveSearchFormBlock; 88 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/readme.txt: -------------------------------------------------------------------------------- 1 | === BP Search Block === 2 | Contributors: buddypress 3 | Donate link: https://wordpressfoundation.org 4 | Tags: BuddyPress, block, search, community 5 | License: GPLv2 or later 6 | License URI: https://www.gnu.org/licenses/gpl-2.0.html 7 | Requires at least: 5.8 8 | Requires PHP: 5.6 9 | Tested up to: 6.6 10 | Stable tag: 1.2.0 11 | 12 | The BP Search Block is a BuddyPress Block to search for the content shared into your community site! 13 | 14 | == Description == 15 | 16 | Use the block inserter of your Block Editor to add the BP Search Block form inside you post, page or widgets area to help your visitors or members find the activities, the members, the groups, the posts (or the blogs on WordPress multisite) they are looking for. 17 | 18 | = Join our community = 19 | 20 | If you're interested in contributing to BuddyPress, we'd love to have you. Head over to the [BuddyPress Documentation](https://codex.buddypress.org/participate-and-contribute/) site to find out how you can pitch in. 21 | 22 | Growing the BuddyPress community means better software for everyone! 23 | 24 | == Installation == 25 | 26 | = Requirements = 27 | 28 | * WordPress 5.8. 29 | * BuddyPress 12.0.0 30 | 31 | = Automatic installation = 32 | 33 | Using the automatic installation let WordPress handles everything itself. To do an automatic install of "BP Search Block", log in to your WordPress dashboard, navigate to the Plugins menu. Click on the Add New link, then, activate the "BuddyPress Add-ons" tab to quickly find the "BP Search Block" plugin's card. 34 | 35 | Once you've found the BP Search card, you can view details about the latest release, such as community reviews, ratings, and description. Install the BP Search Block by simply pressing "Install Now". 36 | 37 | == Frequently Asked Questions == 38 | 39 | = Where can I get support? = 40 | 41 | Our community provides free support at https://buddypress.org/support/. 42 | 43 | = Where can I report a bug? = 44 | 45 | Report bugs or suggest ideas at https://github.com/buddypress/bp-blocks/issues, participate to this block or other BuddyPress Blocks development at https://github.com/buddypress/bp-blocks/pulls. 46 | 47 | = Who builds the BP Search Block? = 48 | 49 | The BP Search Block is a BuddyPress add-on and is free software, built by an international community of volunteers. Some contributors to BuddyPress are employed by companies that use BuddyPress, while others are consultants who offer BuddyPress-related services for hire. No one is paid by the BuddyPress project for his or her contributions. 50 | 51 | If you would like to provide monetary support to the BP Search Block or BuddyPress, please consider a donation to the WordPress Foundation, or ask your favorite contributor how they prefer to have their efforts rewarded. 52 | 53 | == Screenshots == 54 | 55 | 1. **Inserting the BP Search form into the Block Editor** 56 | 2. **Editing the BP Search form** 57 | 3. **Display of the BP Search form** 58 | 59 | == Upgrade Notice == 60 | 61 | = 1.1.0 = 62 | - Requires BuddyPress 11.0.0. 63 | 64 | = 1.0.0 = 65 | Initial version of the Search Block, no upgrade needed. 66 | 67 | == Changelog == 68 | 69 | = 1.1.0 = 70 | - Requires BuddyPress 11.0.0. 71 | - Makes sure the Blogs search is only available on Multisite configs. 72 | 73 | = 1.0.0 = 74 | Initial version of the Search Block. 75 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/languages/bp-search-block.pot: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2023 The BuddyPress Community 2 | # This file is distributed under the GPL-2.0+. 3 | msgid "" 4 | msgstr "" 5 | "Project-Id-Version: BP Search Block 1.1.0\n" 6 | "Report-Msgid-Bugs-To: https://github.com/buddypress/bp-blocks/issues\n" 7 | "Last-Translator: imath \n" 8 | "Language-Team: LANGUAGE \n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "POT-Creation-Date: 2023-02-17T19:57:59+00:00\n" 13 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 | "X-Generator: WP-CLI 2.5.0\n" 15 | "X-Domain: bp-search-block\n" 16 | 17 | #. Plugin Name of the plugin 18 | msgid "BP Search Block" 19 | msgstr "" 20 | 21 | #. Plugin URI of the plugin 22 | msgid "https://github.com/buddypress/bp-blocks" 23 | msgstr "" 24 | 25 | #. Description of the plugin 26 | msgid "Help the visitors or members of your BuddyPress powered community site to find the posts, the sites, the activities, the members or the groups they are looking for." 27 | msgstr "" 28 | 29 | #. Author of the plugin 30 | msgid "The BuddyPress Community" 31 | msgstr "" 32 | 33 | #. Author URI of the plugin 34 | msgid "https://buddypress.org" 35 | msgstr "" 36 | 37 | #: js/index.js:1 38 | msgctxt "search form" 39 | msgid "Activities" 40 | msgstr "" 41 | 42 | #: js/index.js:1 43 | msgid "Search activities" 44 | msgstr "" 45 | 46 | #: js/index.js:1 47 | msgctxt "search form" 48 | msgid "Members" 49 | msgstr "" 50 | 51 | #: js/index.js:1 52 | msgid "Search members" 53 | msgstr "" 54 | 55 | #: js/index.js:1 56 | msgctxt "search form" 57 | msgid "Groups" 58 | msgstr "" 59 | 60 | #: js/index.js:1 61 | msgid "Search groups" 62 | msgstr "" 63 | 64 | #: js/index.js:1 65 | msgctxt "search form" 66 | msgid "Blogs" 67 | msgstr "" 68 | 69 | #: js/index.js:1 70 | msgid "Search blogs" 71 | msgstr "" 72 | 73 | #: js/index.js:1 74 | msgctxt "search form" 75 | msgid "Posts" 76 | msgstr "" 77 | 78 | #: js/index.js:1 79 | msgid "Search posts" 80 | msgstr "" 81 | 82 | #: js/index.js:1 83 | msgid "Community Search" 84 | msgstr "" 85 | 86 | #: js/index.js:1 87 | msgid "A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!" 88 | msgstr "" 89 | 90 | #: js/index.js:1 91 | msgid "Search" 92 | msgstr "" 93 | 94 | #: js/index.js:1 95 | msgid "Search options" 96 | msgstr "" 97 | 98 | #: js/index.js:1 99 | msgid "Display options" 100 | msgstr "" 101 | 102 | #: js/index.js:1 103 | msgid "Show the search label" 104 | msgstr "" 105 | 106 | #: js/index.js:1 107 | msgid "Display a label over the search field." 108 | msgstr "" 109 | 110 | #: js/index.js:1 111 | msgid "Toggle to display a label over the search field." 112 | msgstr "" 113 | 114 | #: js/index.js:1 115 | msgid "Use a Search Icon" 116 | msgstr "" 117 | 118 | #: js/index.js:1 119 | msgid "Use a search icon instead of the search button text." 120 | msgstr "" 121 | 122 | #: js/index.js:1 123 | msgid "Toggle to use a search icon instead of the search button text." 124 | msgstr "" 125 | 126 | #: js/index.js:1 127 | msgid "Label text" 128 | msgstr "" 129 | 130 | #: js/index.js:1 131 | msgid "Add label…" 132 | msgstr "" 133 | 134 | #: js/index.js:1 135 | msgid "Button text" 136 | msgstr "" 137 | 138 | #: js/index.js:1 139 | msgid "Add text…" 140 | msgstr "" 141 | 142 | #: js/index.js:1 143 | msgid "Search for:" 144 | msgstr "" 145 | 146 | #: block.json 147 | msgctxt "block title" 148 | msgid "Community Search" 149 | msgstr "" 150 | 151 | #: block.json 152 | msgctxt "block description" 153 | msgid "A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!" 154 | msgstr "" 155 | 156 | #: block.json 157 | msgctxt "block keyword" 158 | msgid "BuddyPress" 159 | msgstr "" 160 | 161 | #: block.json 162 | msgctxt "block keyword" 163 | msgid "search" 164 | msgstr "" 165 | 166 | #: block.json 167 | msgctxt "block keyword" 168 | msgid "community" 169 | msgstr "" 170 | -------------------------------------------------------------------------------- /class-bp-blocks.php: -------------------------------------------------------------------------------- 1 | data[ $key ] ); 77 | } 78 | 79 | /** 80 | * Magic method for getting a plugin global variable. 81 | * 82 | * @since 12.0.0 83 | * 84 | * @param string $key Key to return the value for. 85 | * @return mixed 86 | */ 87 | public function __get( $key ) { 88 | $retval = null; 89 | if ( isset( $this->data[ $key ] ) ) { 90 | $retval = $this->data[ $key ]; 91 | } 92 | 93 | return $retval; 94 | } 95 | 96 | /** 97 | * Magic method for setting a plugin global variable. 98 | * 99 | * @since 12.0.0 100 | * 101 | * @param string $key Key to set a value for. 102 | * @param mixed $value Value to set. 103 | */ 104 | public function __set( $key, $value ) { 105 | $this->data[ $key ] = $value; 106 | } 107 | 108 | /** 109 | * Magic method for unsetting a plugin global variable. 110 | * 111 | * @since 12.0.0 112 | * 113 | * @param string $key Key to unset a value for. 114 | */ 115 | public function __unset( $key ) { 116 | if ( isset( $this->data[ $key ] ) ) { 117 | unset( $this->data[ $key ] ); 118 | } 119 | } 120 | 121 | /** 122 | * Return an instance of this class. 123 | * 124 | * @since 6.0.0 125 | */ 126 | public static function start() { 127 | 128 | // If the single instance hasn't been set, set it now. 129 | if ( null === self::$instance ) { 130 | self::$instance = new self(); 131 | } 132 | 133 | return self::$instance; 134 | } 135 | } 136 | 137 | /** 138 | * Start plugin. 139 | * 140 | * @since 6.0.0 141 | * 142 | * @return BP_Blocks The main instance of the plugin. 143 | */ 144 | function bp_blocks() { 145 | return BP_Blocks::start(); 146 | } 147 | add_action( 'bp_include', __NAMESPACE__ . '\bp_blocks', 9 ); 148 | 149 | /** 150 | * Removes the hook to register a BP Block category. 151 | * 152 | * @since 11.0.0 153 | */ 154 | function bp_admin() { 155 | if ( has_action( 'bp_init', 'bp_block_init_category_filter' ) ) { 156 | // Stop using a "BuddyPress" block category for BP Blocks. 157 | remove_action( 'bp_init', 'bp_block_init_category_filter' ); 158 | } 159 | } 160 | 161 | if ( is_admin() ) { 162 | add_action( 'bp_loaded', __NAMESPACE__ . '\bp_admin', 11 ); 163 | } 164 | -------------------------------------------------------------------------------- /src/bp-search-block/imports/edit.js: -------------------------------------------------------------------------------- 1 | /** 2 | * External dependencies. 3 | */ 4 | import { find } from 'lodash'; 5 | 6 | /** 7 | * WordPress dependencies. 8 | */ 9 | import { 10 | InspectorControls, 11 | RichText, 12 | useBlockProps, 13 | } from '@wordpress/block-editor'; 14 | import { 15 | PanelBody, 16 | ToggleControl, 17 | } from '@wordpress/components'; 18 | import { Fragment } from '@wordpress/element'; 19 | import { __ } from '@wordpress/i18n'; 20 | 21 | /** 22 | * BuddyPress dependencies. 23 | */ 24 | import { isActive } from '@buddypress/block-data'; 25 | 26 | /** 27 | * Internal dependencies. 28 | */ 29 | import { SEARCH_OPTIONS } from './constants'; 30 | import SearchOptionCheckbox from './option-checkbox'; 31 | import SearchOptionsRadioGroup from './options-radiogroup'; 32 | 33 | const editSearchFormBlock = ( { attributes, setAttributes } ) => { 34 | const blockProps = useBlockProps(); 35 | const { 36 | activeOptions, 37 | placeholder, 38 | action, 39 | label, 40 | useLabel, 41 | buttonText, 42 | useIcon, 43 | defaultOption, 44 | } = attributes; 45 | 46 | const setAvailableOptions = ( option, isChecked ) => { 47 | let newOptions = activeOptions; 48 | 49 | if ( ! isChecked ) { 50 | newOptions = newOptions.filter( ( currentOption ) => currentOption !== option ); 51 | } else { 52 | newOptions = [ option, ...newOptions ]; 53 | } 54 | 55 | newOptions.sort(); 56 | 57 | setAttributes( { activeOptions: newOptions } ); 58 | }; 59 | 60 | const searchSettings = SEARCH_OPTIONS.filter( ( option ) => 'posts' === option.value || isActive( option.value, option.requiredFeature ) ).map( ( option, key ) => { 61 | return ( 62 | 70 | ); 71 | } ); 72 | 73 | const enabledSearchOptions = SEARCH_OPTIONS.filter( ( option ) => -1 !== activeOptions.indexOf( option.value ) ); 74 | 75 | const setDefaultOption = ( option ) => { 76 | const defaultOption = find( SEARCH_OPTIONS, [ 'value', option ] ); 77 | 78 | setAttributes( { 79 | defaultOption: option, 80 | placeholder: defaultOption.placeholder, 81 | } ); 82 | }; 83 | 84 | return ( 85 | 86 | 87 | 88 | { searchSettings } 89 | 90 | 91 | { 95 | setAttributes( { useLabel: ! useLabel } ); 96 | } } 97 | help={ 98 | useLabel 99 | ? __( 'Display a label over the search field.', 'bp-search-block' ) 100 | : __( 'Toggle to display a label over the search field.', 'bp-search-block' ) 101 | } 102 | /> 103 | { 107 | setAttributes( { useIcon: ! useIcon } ); 108 | } } 109 | help={ 110 | useIcon 111 | ? __( 'Use a search icon instead of the search button text.', 'bp-search-block' ) 112 | : __( 'Toggle to use a search icon instead of the search button text.', 'bp-search-block' ) 113 | } 114 | /> 115 | 116 | 117 |
    118 |
    119 | { useLabel && ( 120 | setAttributes( { label: html } ) } 128 | /> 129 | ) } 130 |
    131 | 137 | 138 | { !! useIcon && ( 139 | 147 | ) } 148 | 149 | { ! useIcon && ( 150 | setAttributes( { buttonText: html } ) } 158 | /> 159 | ) } 160 |
    161 |
    162 | { __( 'Search for:', 'bp-search-block' ) } 163 |
    164 | 169 |
    170 |
    171 | 172 |
    173 |
    174 | ); 175 | }; 176 | 177 | export default editSearchFormBlock; 178 | -------------------------------------------------------------------------------- /add-ons/bp-search-block/block/index.js: -------------------------------------------------------------------------------- 1 | !function(){"use strict";var e=window.wp.blocks,t=window.wp.i18n,a=window.wp.element,l=window.lodash,c=window.wp.blockEditor,o=window.wp.components,r=window.bp.blockData;const s=[{label:(0,t._x)("Activities","search form","bp-search-block"),value:"activity",requiredFeature:"",placeholder:(0,t.__)("Search activities","bp-search-block")},{label:(0,t._x)("Members","search form","bp-search-block"),value:"members",requiredFeature:"",placeholder:(0,t.__)("Search members","bp-search-block")},{label:(0,t._x)("Groups","search form","bp-search-block"),value:"groups",requiredFeature:"",placeholder:(0,t.__)("Search groups","bp-search-block")},{label:(0,t._x)("Blogs","search form","bp-search-block"),value:"blogs",requiredFeature:"sites_directory",placeholder:(0,t.__)("Search blogs","bp-search-block")},{label:(0,t._x)("Posts","search form","bp-search-block"),value:"posts",placeholder:(0,t.__)("Search posts","bp-search-block")}];var n=e=>{let{label:t,option:l,checked:c,onChecked:r,defaultOption:s}=e;const[n,b]=(0,a.useState)(),p=(0,a.createElement)(o.CheckboxControl,{label:t,checked:n||c,onChange:e=>(e=>{r(l,e),b(e)})(e)});return l===s?(0,a.createElement)(o.Disabled,null,p):p},b=e=>{let{selected:t,options:l,onSelected:c}=e;const[r,s]=(0,a.useState)(t);return(0,a.createElement)(o.RadioControl,{selected:r||t,options:l,onChange:e=>(e=>{c(e),s(e)})(e)})},p=JSON.parse('{"apiVersion":2,"name":"bp/search-form","title":"Community Search","category":"widgets","icon":"search","description":"A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!","keywords":["BuddyPress","search","community"],"textdomain":"bp-search-block","attributes":{"label":{"type":"string","source":"html","selector":".bp-search-label","default":"Search"},"useLabel":{"type":"boolean","default":true},"buttonText":{"type":"string","source":"html","selector":".bp-search-button","default":"Search"},"useIcon":{"type":"boolean","default":false},"placeholder":{"type":"string","default":""},"activeOptions":{"type":"array","default":["posts"]},"defaultOption":{"type":"string","default":"posts"},"action":{"type":"string","default":""}},"supports":{"align":true},"editorScript":"file:index.js","script":"file:view.js","editorStyle":"file:index.css","style":"file:view.css"}');(0,e.registerBlockType)(p,{title:(0,t.__)("Community Search","bp-search-block"),description:(0,t.__)("A Block to search for posts, sites, activities, members or groups from any post, page or widget of your BuddyPress powered community site!","bp-search-block"),icon:{background:"#fff",foreground:"#d84800",src:"search"},attributes:{label:{type:"string",source:"html",selector:".bp-search-label",default:(0,t.__)("Search","bp-search-block")},useLabel:{type:"boolean",default:!0},buttonText:{type:"string",source:"html",selector:".bp-search-button",default:(0,t.__)("Search","bp-search-block")},useIcon:{type:"boolean",default:!1},placeholder:{type:"string",default:(0,t.__)("Search posts","bp-search-block")},activeOptions:{type:"array",default:["posts"]},defaultOption:{type:"string",default:"posts"},action:{type:"string",default:window.bpSearchFormAction||""}},edit:e=>{let{attributes:p,setAttributes:i}=e;const h=(0,c.useBlockProps)(),{activeOptions:u,placeholder:d,action:m,label:_,useLabel:k,buttonText:f,useIcon:g,defaultOption:y}=p,v=(e,t)=>{let a=u;a=t?[e,...a]:a.filter((t=>t!==e)),a.sort(),i({activeOptions:a})},w=s.filter((e=>"posts"===e.value||(0,r.isActive)(e.value,e.requiredFeature))).map(((e,t)=>(0,a.createElement)(n,{key:"option__"+t,label:e.label,checked:-1!==u.indexOf(e.value),option:e.value,onChecked:v,defaultOption:y}))),E=s.filter((e=>-1!==u.indexOf(e.value)));return(0,a.createElement)(a.Fragment,null,(0,a.createElement)(c.InspectorControls,null,(0,a.createElement)(o.PanelBody,{title:(0,t.__)("Search options","bp-search-block"),initialOpen:!0},w),(0,a.createElement)(o.PanelBody,{title:(0,t.__)("Display options","bp-search-block"),initialOpen:!1},(0,a.createElement)(o.ToggleControl,{label:(0,t.__)("Show the search label","bp-search-block"),checked:!!k,onChange:()=>{i({useLabel:!k})},help:k?(0,t.__)("Display a label over the search field.","bp-search-block"):(0,t.__)("Toggle to display a label over the search field.","bp-search-block")}),(0,a.createElement)(o.ToggleControl,{label:(0,t.__)("Use a Search Icon","bp-search-block"),checked:!!g,onChange:()=>{i({useIcon:!g})},help:g?(0,t.__)("Use a search icon instead of the search button text.","bp-search-block"):(0,t.__)("Toggle to use a search icon instead of the search button text.","bp-search-block")}))),(0,a.createElement)("div",h,(0,a.createElement)("form",{action:m,method:"post"},k&&(0,a.createElement)(c.RichText,{tagname:"label",className:"bp-search-label","aria-label":(0,t.__)("Label text","bp-search-block"),placeholder:(0,t.__)("Add label…","bp-search-block"),withoutInteractiveFormatting:!0,value:_,onChange:e=>i({label:e})}),(0,a.createElement)("div",{className:"bp-block-search__inside-wrapper"},(0,a.createElement)("input",{type:"search",className:"bp-block-search__input",name:"search-terms",placeholder:d}),!!g&&(0,a.createElement)("button",{type:"button",className:"wp-block-search__button button bp-search-button bp-block-search__icon-button has-icon"},(0,a.createElement)("div",{className:"bp-search-block-icon"},(0,a.createElement)("span",{className:"screen-reader-text"},(0,t.__)("Search","bp-search-block")))),!g&&(0,a.createElement)(c.RichText,{tagname:"button",className:"wp-block-search__button button bp-search-button","aria-label":(0,t.__)("Button text","bp-search-block"),placeholder:(0,t.__)("Add text…","bp-search-block"),withoutInteractiveFormatting:!0,value:f,onChange:e=>i({buttonText:e})})),(0,a.createElement)("div",{className:"bp-block-search-for__wrapper"},(0,a.createElement)("strong",{className:"bp-block-search-for__label"},(0,t.__)("Search for:","bp-search-block")),(0,a.createElement)("div",{className:"bp-block-search-for__options"},(0,a.createElement)(b,{selected:y,options:E,onSelected:e=>{const t=(0,l.find)(s,["value",e]);i({defaultOption:e,placeholder:t.placeholder})}}))))))},save:e=>{let{attributes:l}=e;const o=c.useBlockProps.save(),{label:r,useLabel:n,buttonText:b,useIcon:p,placeholder:i,activeOptions:h,defaultOption:u,action:d}=l,m=s.filter((e=>-1!==h.indexOf(e.value)));let _=[];return m.forEach(((e,t)=>{let l=!1;e.value===u&&(l="checked"),_.push((0,a.createElement)("li",{key:"bp-search-option__"+t},(0,a.createElement)("label",null,(0,a.createElement)("input",{type:"radio",name:"search-which",value:e.value,"data-placeholder":e.placeholder,checked:l}),e.label)))})),(0,a.createElement)("div",o,(0,a.createElement)("form",{action:d,method:"post"},n&&(0,a.createElement)(c.RichText.Content,{tagName:"label",value:r,className:"bp-search-label"}),(0,a.createElement)("div",{className:"bp-block-search__inside-wrapper"},(0,a.createElement)("input",{type:"search",className:"bp-block-search__input",name:"search-terms",placeholder:i}),!!p&&(0,a.createElement)("button",{type:"submit",className:"wp-block-search__button button bp-search-button bp-block-search__icon-button has-icon"},(0,a.createElement)("div",{className:"bp-search-block-icon"},(0,a.createElement)("span",{className:"bp-screen-reader-text"},(0,t.__)("Search","bp-search-block")))),!p&&(0,a.createElement)(c.RichText.Content,{tagName:"button",type:"submit",value:b,className:"wp-block-search__button button bp-search-button"})),(0,a.createElement)("div",{className:"bp-block-search-for__wrapper"},(0,a.createElement)("strong",{className:"bp-block-search-for__label"},(0,t.__)("Search for:","bp-search-block")),(0,a.createElement)("ul",{className:"bp-block-search-for__options"},_))))}})}(); -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "6b304e5a9ae350e8aae7ec0f2a906e49", 8 | "packages": [ 9 | { 10 | "name": "composer/installers", 11 | "version": "v1.11.0", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/composer/installers.git", 15 | "reference": "ae03311f45dfe194412081526be2e003960df74b" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b", 20 | "reference": "ae03311f45dfe194412081526be2e003960df74b", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "composer-plugin-api": "^1.0 || ^2.0" 25 | }, 26 | "replace": { 27 | "roundcube/plugin-installer": "*", 28 | "shama/baton": "*" 29 | }, 30 | "require-dev": { 31 | "composer/composer": "1.6.* || ^2.0", 32 | "composer/semver": "^1 || ^3", 33 | "phpstan/phpstan": "^0.12.55", 34 | "phpstan/phpstan-phpunit": "^0.12.16", 35 | "symfony/phpunit-bridge": "^4.2 || ^5", 36 | "symfony/process": "^2.3" 37 | }, 38 | "type": "composer-plugin", 39 | "extra": { 40 | "class": "Composer\\Installers\\Plugin", 41 | "branch-alias": { 42 | "dev-main": "1.x-dev" 43 | } 44 | }, 45 | "autoload": { 46 | "psr-4": { 47 | "Composer\\Installers\\": "src/Composer/Installers" 48 | } 49 | }, 50 | "notification-url": "https://packagist.org/downloads/", 51 | "license": [ 52 | "MIT" 53 | ], 54 | "authors": [ 55 | { 56 | "name": "Kyle Robinson Young", 57 | "email": "kyle@dontkry.com", 58 | "homepage": "https://github.com/shama" 59 | } 60 | ], 61 | "description": "A multi-framework Composer library installer", 62 | "homepage": "https://composer.github.io/installers/", 63 | "keywords": [ 64 | "Craft", 65 | "Dolibarr", 66 | "Eliasis", 67 | "Hurad", 68 | "ImageCMS", 69 | "Kanboard", 70 | "Lan Management System", 71 | "MODX Evo", 72 | "MantisBT", 73 | "Mautic", 74 | "Maya", 75 | "OXID", 76 | "Plentymarkets", 77 | "Porto", 78 | "RadPHP", 79 | "SMF", 80 | "Starbug", 81 | "Thelia", 82 | "Whmcs", 83 | "WolfCMS", 84 | "agl", 85 | "aimeos", 86 | "annotatecms", 87 | "attogram", 88 | "bitrix", 89 | "cakephp", 90 | "chef", 91 | "cockpit", 92 | "codeigniter", 93 | "concrete5", 94 | "croogo", 95 | "dokuwiki", 96 | "drupal", 97 | "eZ Platform", 98 | "elgg", 99 | "expressionengine", 100 | "fuelphp", 101 | "grav", 102 | "installer", 103 | "itop", 104 | "joomla", 105 | "known", 106 | "kohana", 107 | "laravel", 108 | "lavalite", 109 | "lithium", 110 | "magento", 111 | "majima", 112 | "mako", 113 | "mediawiki", 114 | "miaoxing", 115 | "modulework", 116 | "modx", 117 | "moodle", 118 | "osclass", 119 | "phpbb", 120 | "piwik", 121 | "ppi", 122 | "processwire", 123 | "puppet", 124 | "pxcms", 125 | "reindex", 126 | "roundcube", 127 | "shopware", 128 | "silverstripe", 129 | "sydes", 130 | "sylius", 131 | "symfony", 132 | "tastyigniter", 133 | "typo3", 134 | "wordpress", 135 | "yawik", 136 | "zend", 137 | "zikula" 138 | ], 139 | "support": { 140 | "issues": "https://github.com/composer/installers/issues", 141 | "source": "https://github.com/composer/installers/tree/v1.11.0" 142 | }, 143 | "funding": [ 144 | { 145 | "url": "https://packagist.com", 146 | "type": "custom" 147 | }, 148 | { 149 | "url": "https://github.com/composer", 150 | "type": "github" 151 | }, 152 | { 153 | "url": "https://tidelift.com/funding/github/packagist/composer/composer", 154 | "type": "tidelift" 155 | } 156 | ], 157 | "time": "2021-04-28T06:42:17+00:00" 158 | } 159 | ], 160 | "packages-dev": [ 161 | { 162 | "name": "dealerdirect/phpcodesniffer-composer-installer", 163 | "version": "v0.7.1", 164 | "source": { 165 | "type": "git", 166 | "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", 167 | "reference": "fe390591e0241955f22eb9ba327d137e501c771c" 168 | }, 169 | "dist": { 170 | "type": "zip", 171 | "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/fe390591e0241955f22eb9ba327d137e501c771c", 172 | "reference": "fe390591e0241955f22eb9ba327d137e501c771c", 173 | "shasum": "" 174 | }, 175 | "require": { 176 | "composer-plugin-api": "^1.0 || ^2.0", 177 | "php": ">=5.3", 178 | "squizlabs/php_codesniffer": "^2.0 || ^3.0 || ^4.0" 179 | }, 180 | "require-dev": { 181 | "composer/composer": "*", 182 | "phpcompatibility/php-compatibility": "^9.0", 183 | "sensiolabs/security-checker": "^4.1.0" 184 | }, 185 | "type": "composer-plugin", 186 | "extra": { 187 | "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" 188 | }, 189 | "autoload": { 190 | "psr-4": { 191 | "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" 192 | } 193 | }, 194 | "notification-url": "https://packagist.org/downloads/", 195 | "license": [ 196 | "MIT" 197 | ], 198 | "authors": [ 199 | { 200 | "name": "Franck Nijhof", 201 | "email": "franck.nijhof@dealerdirect.com", 202 | "homepage": "http://www.frenck.nl", 203 | "role": "Developer / IT Manager" 204 | } 205 | ], 206 | "description": "PHP_CodeSniffer Standards Composer Installer Plugin", 207 | "homepage": "http://www.dealerdirect.com", 208 | "keywords": [ 209 | "PHPCodeSniffer", 210 | "PHP_CodeSniffer", 211 | "code quality", 212 | "codesniffer", 213 | "composer", 214 | "installer", 215 | "phpcs", 216 | "plugin", 217 | "qa", 218 | "quality", 219 | "standard", 220 | "standards", 221 | "style guide", 222 | "stylecheck", 223 | "tests" 224 | ], 225 | "support": { 226 | "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", 227 | "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" 228 | }, 229 | "time": "2020-12-07T18:04:37+00:00" 230 | }, 231 | { 232 | "name": "php-parallel-lint/php-parallel-lint", 233 | "version": "v1.3.0", 234 | "source": { 235 | "type": "git", 236 | "url": "https://github.com/php-parallel-lint/PHP-Parallel-Lint.git", 237 | "reference": "772a954e5f119f6f5871d015b23eabed8cbdadfb" 238 | }, 239 | "dist": { 240 | "type": "zip", 241 | "url": "https://api.github.com/repos/php-parallel-lint/PHP-Parallel-Lint/zipball/772a954e5f119f6f5871d015b23eabed8cbdadfb", 242 | "reference": "772a954e5f119f6f5871d015b23eabed8cbdadfb", 243 | "shasum": "" 244 | }, 245 | "require": { 246 | "ext-json": "*", 247 | "php": ">=5.3.0" 248 | }, 249 | "replace": { 250 | "grogy/php-parallel-lint": "*", 251 | "jakub-onderka/php-parallel-lint": "*" 252 | }, 253 | "require-dev": { 254 | "nette/tester": "^1.3 || ^2.0", 255 | "php-parallel-lint/php-console-highlighter": "~0.3", 256 | "squizlabs/php_codesniffer": "^3.5" 257 | }, 258 | "suggest": { 259 | "php-parallel-lint/php-console-highlighter": "Highlight syntax in code snippet" 260 | }, 261 | "bin": [ 262 | "parallel-lint" 263 | ], 264 | "type": "library", 265 | "autoload": { 266 | "classmap": [ 267 | "./" 268 | ] 269 | }, 270 | "notification-url": "https://packagist.org/downloads/", 271 | "license": [ 272 | "BSD-2-Clause" 273 | ], 274 | "authors": [ 275 | { 276 | "name": "Jakub Onderka", 277 | "email": "ahoj@jakubonderka.cz" 278 | } 279 | ], 280 | "description": "This tool check syntax of PHP files about 20x faster than serial check.", 281 | "homepage": "https://github.com/php-parallel-lint/PHP-Parallel-Lint", 282 | "support": { 283 | "issues": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/issues", 284 | "source": "https://github.com/php-parallel-lint/PHP-Parallel-Lint/tree/v1.3.0" 285 | }, 286 | "time": "2021-04-07T14:42:48+00:00" 287 | }, 288 | { 289 | "name": "phpcompatibility/php-compatibility", 290 | "version": "9.3.5", 291 | "source": { 292 | "type": "git", 293 | "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", 294 | "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" 295 | }, 296 | "dist": { 297 | "type": "zip", 298 | "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", 299 | "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", 300 | "shasum": "" 301 | }, 302 | "require": { 303 | "php": ">=5.3", 304 | "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" 305 | }, 306 | "conflict": { 307 | "squizlabs/php_codesniffer": "2.6.2" 308 | }, 309 | "require-dev": { 310 | "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" 311 | }, 312 | "suggest": { 313 | "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", 314 | "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." 315 | }, 316 | "type": "phpcodesniffer-standard", 317 | "notification-url": "https://packagist.org/downloads/", 318 | "license": [ 319 | "LGPL-3.0-or-later" 320 | ], 321 | "authors": [ 322 | { 323 | "name": "Wim Godden", 324 | "homepage": "https://github.com/wimg", 325 | "role": "lead" 326 | }, 327 | { 328 | "name": "Juliette Reinders Folmer", 329 | "homepage": "https://github.com/jrfnl", 330 | "role": "lead" 331 | }, 332 | { 333 | "name": "Contributors", 334 | "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" 335 | } 336 | ], 337 | "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", 338 | "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", 339 | "keywords": [ 340 | "compatibility", 341 | "phpcs", 342 | "standards" 343 | ], 344 | "support": { 345 | "issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues", 346 | "source": "https://github.com/PHPCompatibility/PHPCompatibility" 347 | }, 348 | "time": "2019-12-27T09:44:58+00:00" 349 | }, 350 | { 351 | "name": "phpcompatibility/phpcompatibility-paragonie", 352 | "version": "1.3.1", 353 | "source": { 354 | "type": "git", 355 | "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", 356 | "reference": "ddabec839cc003651f2ce695c938686d1086cf43" 357 | }, 358 | "dist": { 359 | "type": "zip", 360 | "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", 361 | "reference": "ddabec839cc003651f2ce695c938686d1086cf43", 362 | "shasum": "" 363 | }, 364 | "require": { 365 | "phpcompatibility/php-compatibility": "^9.0" 366 | }, 367 | "require-dev": { 368 | "dealerdirect/phpcodesniffer-composer-installer": "^0.7", 369 | "paragonie/random_compat": "dev-master", 370 | "paragonie/sodium_compat": "dev-master" 371 | }, 372 | "suggest": { 373 | "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", 374 | "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." 375 | }, 376 | "type": "phpcodesniffer-standard", 377 | "notification-url": "https://packagist.org/downloads/", 378 | "license": [ 379 | "LGPL-3.0-or-later" 380 | ], 381 | "authors": [ 382 | { 383 | "name": "Wim Godden", 384 | "role": "lead" 385 | }, 386 | { 387 | "name": "Juliette Reinders Folmer", 388 | "role": "lead" 389 | } 390 | ], 391 | "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", 392 | "homepage": "http://phpcompatibility.com/", 393 | "keywords": [ 394 | "compatibility", 395 | "paragonie", 396 | "phpcs", 397 | "polyfill", 398 | "standards" 399 | ], 400 | "support": { 401 | "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", 402 | "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" 403 | }, 404 | "time": "2021-02-15T10:24:51+00:00" 405 | }, 406 | { 407 | "name": "phpcompatibility/phpcompatibility-wp", 408 | "version": "2.1.1", 409 | "source": { 410 | "type": "git", 411 | "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", 412 | "reference": "b7dc0cd7a8f767ccac5e7637550ea1c50a67b09e" 413 | }, 414 | "dist": { 415 | "type": "zip", 416 | "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b7dc0cd7a8f767ccac5e7637550ea1c50a67b09e", 417 | "reference": "b7dc0cd7a8f767ccac5e7637550ea1c50a67b09e", 418 | "shasum": "" 419 | }, 420 | "require": { 421 | "phpcompatibility/php-compatibility": "^9.0", 422 | "phpcompatibility/phpcompatibility-paragonie": "^1.0" 423 | }, 424 | "require-dev": { 425 | "dealerdirect/phpcodesniffer-composer-installer": "^0.7" 426 | }, 427 | "suggest": { 428 | "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", 429 | "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." 430 | }, 431 | "type": "phpcodesniffer-standard", 432 | "notification-url": "https://packagist.org/downloads/", 433 | "license": [ 434 | "LGPL-3.0-or-later" 435 | ], 436 | "authors": [ 437 | { 438 | "name": "Wim Godden", 439 | "role": "lead" 440 | }, 441 | { 442 | "name": "Juliette Reinders Folmer", 443 | "role": "lead" 444 | } 445 | ], 446 | "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", 447 | "homepage": "http://phpcompatibility.com/", 448 | "keywords": [ 449 | "compatibility", 450 | "phpcs", 451 | "standards", 452 | "wordpress" 453 | ], 454 | "support": { 455 | "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", 456 | "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" 457 | }, 458 | "time": "2021-02-15T12:58:46+00:00" 459 | }, 460 | { 461 | "name": "squizlabs/php_codesniffer", 462 | "version": "3.6.0", 463 | "source": { 464 | "type": "git", 465 | "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", 466 | "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" 467 | }, 468 | "dist": { 469 | "type": "zip", 470 | "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", 471 | "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", 472 | "shasum": "" 473 | }, 474 | "require": { 475 | "ext-simplexml": "*", 476 | "ext-tokenizer": "*", 477 | "ext-xmlwriter": "*", 478 | "php": ">=5.4.0" 479 | }, 480 | "require-dev": { 481 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" 482 | }, 483 | "bin": [ 484 | "bin/phpcs", 485 | "bin/phpcbf" 486 | ], 487 | "type": "library", 488 | "extra": { 489 | "branch-alias": { 490 | "dev-master": "3.x-dev" 491 | } 492 | }, 493 | "notification-url": "https://packagist.org/downloads/", 494 | "license": [ 495 | "BSD-3-Clause" 496 | ], 497 | "authors": [ 498 | { 499 | "name": "Greg Sherwood", 500 | "role": "lead" 501 | } 502 | ], 503 | "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", 504 | "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", 505 | "keywords": [ 506 | "phpcs", 507 | "standards" 508 | ], 509 | "support": { 510 | "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", 511 | "source": "https://github.com/squizlabs/PHP_CodeSniffer", 512 | "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" 513 | }, 514 | "time": "2021-04-09T00:54:41+00:00" 515 | }, 516 | { 517 | "name": "wp-coding-standards/wpcs", 518 | "version": "2.3.0", 519 | "source": { 520 | "type": "git", 521 | "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", 522 | "reference": "7da1894633f168fe244afc6de00d141f27517b62" 523 | }, 524 | "dist": { 525 | "type": "zip", 526 | "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", 527 | "reference": "7da1894633f168fe244afc6de00d141f27517b62", 528 | "shasum": "" 529 | }, 530 | "require": { 531 | "php": ">=5.4", 532 | "squizlabs/php_codesniffer": "^3.3.1" 533 | }, 534 | "require-dev": { 535 | "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", 536 | "phpcompatibility/php-compatibility": "^9.0", 537 | "phpcsstandards/phpcsdevtools": "^1.0", 538 | "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" 539 | }, 540 | "suggest": { 541 | "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." 542 | }, 543 | "type": "phpcodesniffer-standard", 544 | "notification-url": "https://packagist.org/downloads/", 545 | "license": [ 546 | "MIT" 547 | ], 548 | "authors": [ 549 | { 550 | "name": "Contributors", 551 | "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors" 552 | } 553 | ], 554 | "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", 555 | "keywords": [ 556 | "phpcs", 557 | "standards", 558 | "wordpress" 559 | ], 560 | "support": { 561 | "issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues", 562 | "source": "https://github.com/WordPress/WordPress-Coding-Standards", 563 | "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" 564 | }, 565 | "time": "2020-05-13T23:57:56+00:00" 566 | } 567 | ], 568 | "aliases": [], 569 | "minimum-stability": "stable", 570 | "stability-flags": [], 571 | "prefer-stable": false, 572 | "prefer-lowest": false, 573 | "platform": { 574 | "php": ">=5.6.0" 575 | }, 576 | "platform-dev": [], 577 | "plugin-api-version": "2.0.0" 578 | } 579 | --------------------------------------------------------------------------------