Commit inicial, se subio el proyecto
This commit is contained in:
+5
@@ -0,0 +1,5 @@
|
||||
/*!
|
||||
* Plugin: Rank Math
|
||||
* URL: https://rankmath.com/wordpress/plugin/seo-suite/
|
||||
* Name: rank-math-review-snippet.css
|
||||
*/@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(-360deg)}}@keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(-360deg)}}@keyframes bounce{from{-webkit-transform:translateY(0px);transform:translateY(0px)}to{-webkit-transform:translateY(-5px);transform:translateY(-5px)}}@-webkit-keyframes bounce{from{-webkit-transform:translateY(0px);transform:translateY(0px)}to{-webkit-transform:translateY(-5px);transform:translateY(-5px)}}@-webkit-keyframes loading{0%{background-size:20% 50%,20% 50%,20% 50%}20%{background-size:20% 20%,20% 50%,20% 50%}40%{background-size:20% 100%,20% 20%,20% 50%}60%{background-size:20% 50%,20% 100%,20% 20%}80%{background-size:20% 50%,20% 50%,20% 100%}100%{background-size:20% 50%,20% 50%,20% 50%}}@keyframes loading{0%{background-size:20% 50%,20% 50%,20% 50%}20%{background-size:20% 20%,20% 50%,20% 50%}40%{background-size:20% 100%,20% 20%,20% 50%}60%{background-size:20% 50%,20% 100%,20% 20%}80%{background-size:20% 50%,20% 50%,20% 100%}100%{background-size:20% 50%,20% 50%,20% 50%}}:root{--rankmath-wp-adminbar-height: 0}#rank-math-rich-snippet-wrapper{overflow:hidden}#rank-math-rich-snippet-wrapper h5.rank-math-title{display:block;font-size:18px;line-height:1.4}#rank-math-rich-snippet-wrapper .rank-math-review-image{float:right;max-width:40%;margin-left:15px}#rank-math-rich-snippet-wrapper .rank-math-review-data{margin-bottom:15px}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper{width:100%;padding:0 0 20px 0;float:left;clear:both;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-total{border:0;display:block;margin:0;width:auto;float:left;text-align:left;padding:0;font-size:24px;line-height:1;font-weight:700;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star{float:left;margin-left:15px;margin-top:5px;position:relative;z-index:99;line-height:1}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result-wrapper{display:inline-block;white-space:nowrap;position:relative;color:#e7e7e7}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result-wrapper .rank-math-review-result{position:absolute;top:0;left:0;overflow:hidden;white-space:nowrap;color:#ffbe01}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result-wrapper i{font-size:18px;-webkit-text-stroke-width:1px;font-style:normal;padding:0 2px;line-height:inherit}#rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result-wrapper i:before{content:"★"}body.rtl #rank-math-rich-snippet-wrapper .rank-math-review-image{float:left;margin-left:0;margin-right:15px}body.rtl #rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-total{float:right}body.rtl #rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star{float:right;margin-left:0;margin-right:15px}body.rtl #rank-math-rich-snippet-wrapper .rank-math-total-wrapper .rank-math-review-star .rank-math-review-result{left:auto;right:0}@media screen and (max-width: 480px){#rank-math-rich-snippet-wrapper .rank-math-review-image{display:block;max-width:100%;width:100%;text-align:center;margin-right:0}#rank-math-rich-snippet-wrapper .rank-math-review-data{clear:both}}.clear{clear:both}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase -- This filename format is required to dynamically load the necessary block dependencies.
|
||||
/**
|
||||
* Block script dependencies.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Schema
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
return [
|
||||
'dependencies' => [
|
||||
'wp-api-fetch',
|
||||
'wp-blocks',
|
||||
'wp-block-editor',
|
||||
'wp-components',
|
||||
'wp-compose',
|
||||
'wp-data',
|
||||
'wp-element',
|
||||
'wp-hooks',
|
||||
'wp-i18n',
|
||||
'wp-url',
|
||||
],
|
||||
'version' => rank_math()->version,
|
||||
];
|
||||
+1
File diff suppressed because one or more lines are too long
+143
@@ -0,0 +1,143 @@
|
||||
// compileCompressed: ../css/$1.css
|
||||
|
||||
/*!
|
||||
* Plugin: Rank Math
|
||||
* URL: https://rankmath.com/wordpress/plugin/seo-suite/
|
||||
* Name: rank-math-review-snippet.css
|
||||
*/
|
||||
|
||||
// Common and Vendors
|
||||
@import '../../../../../../../assets/vendor/bourbon/bourbon';
|
||||
@import '../../../../../../../assets/admin/scss/mixins';
|
||||
@import '../../../../../../../assets/admin/scss/variables';
|
||||
|
||||
/**
|
||||
* Styling for Rank Math [rank_math_review_snippet] shortcode
|
||||
*/
|
||||
#rank-math-rich-snippet-wrapper {
|
||||
overflow: hidden;
|
||||
|
||||
h5.rank-math-title {
|
||||
display: block;
|
||||
font-size: 18px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.rank-math-review-image {
|
||||
float: right;
|
||||
max-width: 40%;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.rank-math-review-data {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.rank-math-total-wrapper {
|
||||
width: 100%;
|
||||
padding: 0 0 20px 0;
|
||||
float: left;
|
||||
clear: both;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
|
||||
.rank-math-total {
|
||||
border: 0;
|
||||
display: block;
|
||||
margin: 0;
|
||||
width: auto;
|
||||
float: left;
|
||||
text-align: left;
|
||||
padding: 0;
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
font-weight: 700;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rank-math-review-star {
|
||||
float: left;
|
||||
margin-left: 15px;
|
||||
margin-top: 5px;
|
||||
position: relative;
|
||||
z-index: 99;
|
||||
line-height: 1;
|
||||
|
||||
.rank-math-review-result-wrapper {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
position: relative;
|
||||
color: #e7e7e7;
|
||||
|
||||
.rank-math-review-result {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
color:#ffbe01;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 18px;
|
||||
-webkit-text-stroke-width: 1px;
|
||||
font-style: normal;
|
||||
padding: 0 2px;
|
||||
line-height: inherit;
|
||||
|
||||
&:before {
|
||||
content: "\2605";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
body.rtl {
|
||||
#rank-math-rich-snippet-wrapper {
|
||||
.rank-math-review-image {
|
||||
float: left;
|
||||
margin-left: 0;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.rank-math-total-wrapper {
|
||||
.rank-math-total {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.rank-math-review-star {
|
||||
float: right;
|
||||
margin-left: 0;
|
||||
margin-right: 15px;
|
||||
|
||||
.rank-math-review-result {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 480px) {
|
||||
#rank-math-rich-snippet-wrapper {
|
||||
.rank-math-review-image {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.rank-math-review-data {
|
||||
clear: both;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.clear {
|
||||
clear: both;
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { startCase, forEach } from 'lodash'
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
import { __ } from '@wordpress/i18n'
|
||||
import { useBlockProps, InspectorControls } from '@wordpress/block-editor'
|
||||
import { TextControl, PanelBody } from '@wordpress/components'
|
||||
import ServerSideRender from '@wordpress/server-side-render'
|
||||
|
||||
export default ( {
|
||||
attributes,
|
||||
setAttributes,
|
||||
} ) => {
|
||||
const blockProps = useBlockProps()
|
||||
const controllers = []
|
||||
|
||||
if ( ! attributes.post_id ) {
|
||||
attributes.post_id = rankMath.objectID
|
||||
setAttributes( { post_id: rankMath.objectID } )
|
||||
}
|
||||
forEach( attributes, ( attribute, slug ) => {
|
||||
if ( 'post_id' === slug ) {
|
||||
controllers.push(
|
||||
<TextControl
|
||||
key={ slug }
|
||||
label={ __( startCase( slug ), 'seo-by-rank-math' ) }
|
||||
value={ attributes[ slug ] }
|
||||
type="number"
|
||||
min={ 1 }
|
||||
step={ 1 }
|
||||
onChange={ ( newID ) => {
|
||||
const attrs = {}
|
||||
attrs[ slug ] = newID ? newID : rankMath.objectID
|
||||
setAttributes( attrs )
|
||||
} }
|
||||
__next40pxDefaultSize={ true }
|
||||
__nextHasNoMarginBottom={ true }
|
||||
/>
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if ( 'className' !== slug ) {
|
||||
controllers.push(
|
||||
<TextControl
|
||||
key={ slug }
|
||||
label={ __( startCase( slug ), 'seo-by-rank-math' ) }
|
||||
value={ attributes[ slug ] }
|
||||
type="string"
|
||||
onChange={ ( nextID ) => {
|
||||
const attrs = {}
|
||||
attrs[ slug ] = nextID
|
||||
setAttributes( attrs )
|
||||
} }
|
||||
__next40pxDefaultSize={ true }
|
||||
__nextHasNoMarginBottom={ true }
|
||||
/>
|
||||
)
|
||||
}
|
||||
} )
|
||||
|
||||
return (
|
||||
<div { ...blockProps }>
|
||||
<InspectorControls>
|
||||
<PanelBody title={ __( 'Settings', 'seo-by-rank-math' ) }>
|
||||
{ controllers }
|
||||
</PanelBody>
|
||||
</InspectorControls>
|
||||
|
||||
<ServerSideRender
|
||||
block="rank-math/rich-snippet"
|
||||
attributes={ attributes }
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* External Dependencies
|
||||
*/
|
||||
import { isUndefined } from 'lodash'
|
||||
|
||||
/**
|
||||
* WordPress dependencies
|
||||
*/
|
||||
import { registerBlockType } from '@wordpress/blocks'
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import edit from './edit'
|
||||
|
||||
/**
|
||||
* Register Schema block.
|
||||
*/
|
||||
registerBlockType(
|
||||
'rank-math/rich-snippet',
|
||||
{
|
||||
edit,
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"apiVersion": 3,
|
||||
"title": "Schema by Rank Math",
|
||||
"description": "Add the Schema generated by Rank Math anywhere on your page using this Block.",
|
||||
"name": "rank-math/rich-snippet",
|
||||
"category": "rank-math-blocks",
|
||||
"icon": "editor-ul",
|
||||
"textdomain": "seo-by-rank-math",
|
||||
"keywords": [ "Schema", "Markup", "Structured Data", "Rich Snippet", "SEO", "Rank Math", "Yoast" ],
|
||||
"editorScript": "file:./assets/js/index.js",
|
||||
"editorStyle": "file:./assets/css/schema.css",
|
||||
"attributes": {
|
||||
"post_id": {
|
||||
"type": "string",
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
/**
|
||||
* The Schema Block
|
||||
*
|
||||
* @since 1.0.233
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Schema
|
||||
* @author Rank Math <support@rankmath.com>
|
||||
*/
|
||||
|
||||
namespace RankMath\Schema;
|
||||
|
||||
use WP_Block_Type_Registry;
|
||||
use RankMath\Traits\Hooker;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Schema Block class.
|
||||
*/
|
||||
class Block_Schema {
|
||||
|
||||
use Hooker;
|
||||
|
||||
/**
|
||||
* Block type name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $block_type = 'rank-math/rich-snippet';
|
||||
|
||||
/**
|
||||
* The single instance of the class.
|
||||
*
|
||||
* @var Block_Schema
|
||||
*/
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Retrieve main Block_TOC instance.
|
||||
*
|
||||
* Ensure only one instance is loaded or can be loaded.
|
||||
*
|
||||
* @return Block_Schema
|
||||
*/
|
||||
public static function get() {
|
||||
if ( is_null( self::$instance ) && ! ( self::$instance instanceof Block_Schema ) ) {
|
||||
self::$instance = new Block_Schema();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( WP_Block_Type_Registry::get_instance()->is_registered( $this->block_type ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
register_block_type(
|
||||
RANK_MATH_PATH . 'includes/modules/schema/blocks/schema/block.json',
|
||||
[
|
||||
'render_callback' => [ $this, 'rich_snippet' ],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Schema Block render callback.
|
||||
*
|
||||
* @param array $attributes Block Attributes.
|
||||
*/
|
||||
public function rich_snippet( $attributes ) {
|
||||
$output = '';
|
||||
foreach ( $attributes as $key => $value ) {
|
||||
$output .= $key . '="' . esc_attr( $value ) . '" ';
|
||||
}
|
||||
|
||||
return do_shortcode( '[rank_math_rich_snippet ' . trim( $output ) . ']' );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user