-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See pewresearch/pewresearch-org@409dc7e from refs/heads/release/5.0
- Loading branch information
1 parent
8e50889
commit fdd9ff2
Showing
22 changed files
with
19,157 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Footnotes | ||
Contributors: Pew Research Center | ||
Tags: block | ||
Tested up to: 6.4 | ||
Stable tag: 0.1.0 | ||
License: GPL-2.0-or-later | ||
License URI: https://www.gnu.org/licenses/gpl-2.0.html | ||
|
||
A unique take on footnotes. Supports numoffset. | ||
|
||
## Description | ||
|
||
This is the long description. No limit, and you can use Markdown (as well as in the following sections). | ||
|
||
For backwards compatibility, if this section is missing, the full length of the short description will be used, and | ||
Markdown parsed. | ||
|
||
## Instructions | ||
|
||
This section describes how to use the block. | ||
|
||
## Frequently Asked Questions | ||
|
||
= A question that someone might have = | ||
|
||
An answer to that question. | ||
|
||
### What about foo bar? | ||
|
||
Answer to foo bar dilemma. | ||
|
||
## Screenshots | ||
|
||
1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). | ||
2. This is the second screen shot | ||
3. You can store screenshots in a .docs folder in this block directory... | ||
|
||
## Changelog | ||
|
||
= 0.1.0 = | ||
* Release | ||
|
||
## Developer Notes | ||
|
||
You may provide arbitrary sections, in the same format as the ones above. This may be of use for extremely complicated | ||
blocks where more information needs to be conveyed that doesn't fit into the categories of "description" or | ||
"installation." Arbitrary sections will be shown below the built-in sections outlined above. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 3, | ||
"name": "prc-block/footnotes", | ||
"version": "0.1.0", | ||
"title": "Footnotes", | ||
"category": "theme", | ||
"description": "A unique take on footnotes. Supports numoffset.", | ||
"attributes": { | ||
"allowedBlocks": { | ||
"type": "array" | ||
}, | ||
"orientation": { | ||
"type": "string", | ||
"default": "vertical" | ||
} | ||
}, | ||
"supports": { | ||
"anchor": true, | ||
"html": false, | ||
"spacing": { | ||
"blockGap": true, | ||
"margin": [ | ||
"top", | ||
"bottom" | ||
], | ||
"padding": true, | ||
"__experimentalDefaultControls": { | ||
"padding": true | ||
} | ||
}, | ||
"typography": { | ||
"fontSize": true, | ||
"__experimentalFontFamily": true, | ||
"__experimentalDefaultControls": { | ||
"fontSize": true, | ||
"__experimentalFontFamily": true | ||
} | ||
} | ||
}, | ||
"textdomain": "footnotes", | ||
"editorScript": "file:./index.js", | ||
"editorStyle": "file:./index.css", | ||
"style": "file:./style-index.css", | ||
"render": "file:./render.php" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php return array('dependencies' => array('react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '6f529b24430b20cc96d2'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.wp-block-prc-block-footnotes.wp-block{background:inherit;color:inherit} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
namespace PRC\Platform\Blocks; | ||
// PHP file to use when rendering the block type on the server to show on the front end. | ||
// The following variables are exposed to this file: | ||
|
||
// $attributes (array): The block attributes. | ||
// $content (string): The block default content. | ||
// $block (WP_Block): The block instance. | ||
|
||
$block_wrapper_attrs = get_block_wrapper_attributes(); | ||
|
||
echo wp_sprintf( | ||
'<div %1$s>%2$s</div>', | ||
$block_wrapper_attrs, | ||
$content, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.wp-block-prc-block-footnotes{background:inherit;color:inherit} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
namespace PRC\Platform\Blocks; | ||
|
||
class Footnotes_API { | ||
public $post_id = null; | ||
public $footnotes = []; | ||
|
||
public function __construct($post_id) { | ||
$this->post_id = $post_id; | ||
$this->footnotes = $this->get_footnotes(); | ||
} | ||
|
||
public function get_footnotes() { | ||
// loop through the content and extract out the shortcode based text... | ||
} | ||
|
||
public function process_content() { | ||
// return the content with the shortcodes converted to markup | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
namespace PRC\Platform\Blocks; | ||
|
||
/** | ||
* Block Name: Footnotes | ||
* Description: A unique take on footnotes. Supports numoffset. | ||
* Requires at least: 6.4 | ||
* Requires PHP: 8.1 | ||
* Author: Pew Research Center | ||
* | ||
* @package prc-block | ||
*/ | ||
|
||
class Footnotes { | ||
public static $block_json = null; | ||
public static $version; | ||
public static $block_name; | ||
public static $dir = __DIR__; | ||
|
||
public function __construct($loader) { | ||
$block_json_file = PRC_BLOCK_LIBRARY_DIR . '/blocks/footnotes/build/block.json'; | ||
self::$block_json = \wp_json_file_decode( $block_json_file, array( 'associative' => true ) ); | ||
self::$block_json['file'] = wp_normalize_path( realpath( $block_json_file ) ); | ||
self::$version = self::$block_json['version']; | ||
self::$block_name = self::$block_json['name']; | ||
$this->init($loader); | ||
} | ||
|
||
public function init($loader = null) { | ||
if ( null !== $loader ) { | ||
$loader->add_action('init', $this, 'block_init'); | ||
} | ||
} | ||
|
||
/** | ||
* Registers the block using the metadata loaded from the `block.json` file. | ||
* Behind the scenes, it registers also all assets so they can be enqueued | ||
* through the block editor in the corresponding context. | ||
* @hook init | ||
* | ||
* @see https://developer.wordpress.org/reference/functions/register_block_type/ | ||
*/ | ||
public function block_init() { | ||
register_block_type( self::$dir . '/build' ); | ||
} | ||
|
||
} |
Oops, something went wrong.