diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2020-01-06 14:32:30 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2020-01-06 14:32:30 -0500 |
commit | 10ef81bf85ad0a4bad0d204838e14c99ca2526f7 (patch) | |
tree | b4bb36a326d41de12d1a6181d2a2baf34696ac24 /plugins/jetpack/extensions/blocks/wordads | |
parent | Updating script for Update (diff) | |
download | blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.gz blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.bz2 blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.zip |
Update jetpack 8.0
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/extensions/blocks/wordads')
7 files changed, 6 insertions, 302 deletions
diff --git a/plugins/jetpack/extensions/blocks/wordads/constants.js b/plugins/jetpack/extensions/blocks/wordads/constants.js deleted file mode 100644 index 6cf647af..00000000 --- a/plugins/jetpack/extensions/blocks/wordads/constants.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * External dependencies - */ -import { __ } from '@wordpress/i18n'; -import { Path, SVG } from '@wordpress/components'; - -export const DEFAULT_FORMAT = 'mrec'; -export const AD_FORMATS = [ - { - height: 250, - icon: ( - <SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> - <Path fill="none" d="M0 0h24v24H0V0z" /> - <Path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-7-2h2V7h-4v2h2z" /> - </SVG> - ), - name: __( 'Rectangle 300x250', 'jetpack' ), - tag: DEFAULT_FORMAT, - width: 300, - editorPadding: 30, - }, - { - height: 90, - icon: ( - <SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> - <Path fill="none" d="M0 0h24v24H0V0z" /> - <Path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4h-4v-2h2c1.1 0 2-.89 2-2V9c0-1.11-.9-2-2-2H9v2h4v2h-2c-1.1 0-2 .89-2 2v4h6v-2z" /> - </SVG> - ), - name: __( 'Leaderboard 728x90', 'jetpack' ), - tag: 'leaderboard', - width: 728, - editorPadding: 60, - }, - { - height: 50, - icon: ( - <SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> - <Path fill="none" d="M0 0h24v24H0V0z" /> - <Path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-4-4v-1.5c0-.83-.67-1.5-1.5-1.5.83 0 1.5-.67 1.5-1.5V9c0-1.11-.9-2-2-2H9v2h4v2h-2v2h2v2H9v2h4c1.1 0 2-.89 2-2z" /> - </SVG> - ), - name: __( 'Mobile Leaderboard 320x50', 'jetpack' ), - tag: 'mobile_leaderboard', - width: 320, - editorPadding: 100, - }, - { - height: 600, - icon: ( - <SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> - <Path fill="none" d="M.04 0h24v24h-24V0z" /> - <Path d="M19.04 3h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16h-14V5h14v14zm-6-2h2V7h-2v4h-2V7h-2v6h4z" /> - </SVG> - ), - name: __( 'Wide Skyscraper 160x600', 'jetpack' ), - tag: 'wideskyscraper', - width: 160, - editorPadding: 30, - }, -]; diff --git a/plugins/jetpack/extensions/blocks/wordads/edit.js b/plugins/jetpack/extensions/blocks/wordads/edit.js deleted file mode 100644 index 2067d0cd..00000000 --- a/plugins/jetpack/extensions/blocks/wordads/edit.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * External dependencies - */ -import { __ } from '@wordpress/i18n'; -import { BlockControls } from '@wordpress/editor'; -import { Component, Fragment } from '@wordpress/element'; -import { Placeholder, ToggleControl } from '@wordpress/components'; - -/** - * Internal dependencies - */ -import FormatPicker from './format-picker'; -import { AD_FORMATS } from './constants'; -import { icon, title } from './'; - -import './editor.scss'; - -class WordAdsEdit extends Component { - handleHideMobileChange = hideMobile => { - this.props.setAttributes( { hideMobile: !! hideMobile } ); - }; - - render() { - const { attributes, setAttributes } = this.props; - const { format, hideMobile } = attributes; - const selectedFormatObject = AD_FORMATS.filter( ( { tag } ) => tag === format )[ 0 ]; - - return ( - <Fragment> - <BlockControls> - <FormatPicker - value={ format } - onChange={ nextFormat => setAttributes( { format: nextFormat } ) } - /> - </BlockControls> - <div className={ `wp-block-jetpack-wordads jetpack-wordads-${ format }` }> - <div - className="jetpack-wordads__ad" - style={ { - width: selectedFormatObject.width, - height: selectedFormatObject.height + selectedFormatObject.editorPadding, - } } - > - <Placeholder icon={ icon } label={ title } /> - <ToggleControl - checked={ Boolean( hideMobile ) } - label={ __( 'Hide ad on mobile views', 'jetpack' ) } - onChange={ this.handleHideMobileChange } - /> - </div> - </div> - </Fragment> - ); - } -} -export default WordAdsEdit; diff --git a/plugins/jetpack/extensions/blocks/wordads/editor.js b/plugins/jetpack/extensions/blocks/wordads/editor.js deleted file mode 100644 index d05f4039..00000000 --- a/plugins/jetpack/extensions/blocks/wordads/editor.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * Internal dependencies - */ -import registerJetpackBlock from '../../shared/register-jetpack-block'; -import { name, settings } from '.'; - -registerJetpackBlock( name, settings ); diff --git a/plugins/jetpack/extensions/blocks/wordads/editor.scss b/plugins/jetpack/extensions/blocks/wordads/editor.scss deleted file mode 100644 index b7be4878..00000000 --- a/plugins/jetpack/extensions/blocks/wordads/editor.scss +++ /dev/null @@ -1,52 +0,0 @@ -@import '../../shared/styles/gutenberg-colors.scss'; - -.wp-block-jetpack-wordads { - background: $white; -} - -[data-type='jetpack/wordads'][data-align='center'] .jetpack-wordads__ad { - margin: 0 auto; -} - -.jetpack-wordads__ad { - display: flex; - overflow: hidden; - flex-direction: column; - max-width: 100%; - - .components-placeholder { - flex-grow: 2; - } - - .components-toggle-control__label { - line-height: 1.4em; - } - - .components-base-control__field { - padding: 7px; - } -} - -.jetpack-wordads-leaderboard .components-placeholder { - min-height: 90px; -} - -.jetpack-wordads-mobile_leaderboard .components-placeholder { - min-height: 72px; -} - -.wp-block-jetpack-wordads__format-picker { - $active-item-outline-width: 2px; - - padding: 7px; - - // Leave space between elements for active state styling - .components-menu-item__button + .components-menu-item__button { - margin-top: $active-item-outline-width; - } - - .components-menu-item__button.is-active { - color: $dark-gray-900; - box-shadow: 0 0 0 $active-item-outline-width $dark-gray-500 !important; - } -} diff --git a/plugins/jetpack/extensions/blocks/wordads/format-picker.js b/plugins/jetpack/extensions/blocks/wordads/format-picker.js deleted file mode 100644 index b058ab03..00000000 --- a/plugins/jetpack/extensions/blocks/wordads/format-picker.js +++ /dev/null @@ -1,59 +0,0 @@ -/** - * External Dependencies - */ -import { __ } from '@wordpress/i18n'; -import { Dropdown, MenuItem, NavigableMenu, Path, SVG, Toolbar } from '@wordpress/components'; - -/** - * Internal dependencies - */ -import { AD_FORMATS } from './constants'; - -const label = __( 'Pick an ad format', 'jetpack' ); - -export default function FormatPicker( { value, onChange } ) { - return ( - <Dropdown - position="bottom right" - renderToggle={ ( { onToggle, isOpen } ) => { - return ( - <Toolbar - controls={ [ - { - icon: ( - <SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> - <Path fill="none" d="M0 0h24v24H0V0z" /> - <Path d="M1 9h2V7H1v2zm0 4h2v-2H1v2zm0-8h2V3c-1.1 0-2 .9-2 2zm8 16h2v-2H9v2zm-8-4h2v-2H1v2zm2 4v-2H1c0 1.1.9 2 2 2zM21 3h-8v6h10V5c0-1.1-.9-2-2-2zm0 14h2v-2h-2v2zM9 5h2V3H9v2zM5 21h2v-2H5v2zM5 5h2V3H5v2zm16 16c1.1 0 2-.9 2-2h-2v2zm0-8h2v-2h-2v2zm-8 8h2v-2h-2v2zm4 0h2v-2h-2v2z" /> - </SVG> - ), - title: label, - onClick: onToggle, - extraProps: { 'aria-expanded': isOpen }, - className: 'wp-block-jetpack-wordads__format-picker-icon', - }, - ] } - /> - ); - } } - renderContent={ ( { onClose } ) => ( - <NavigableMenu className="wp-block-jetpack-wordads__format-picker"> - { AD_FORMATS.map( ( { tag, name, icon } ) => ( - <MenuItem - className={ tag === value ? 'is-active' : undefined } - icon={ icon } - isSelected={ tag === value } - key={ tag } - onClick={ () => { - onChange( tag ); - onClose(); - } } - role="menuitemcheckbox" - > - { name } - </MenuItem> - ) ) } - </NavigableMenu> - ) } - /> - ); -} diff --git a/plugins/jetpack/extensions/blocks/wordads/index.js b/plugins/jetpack/extensions/blocks/wordads/index.js deleted file mode 100644 index 7a6a0238..00000000 --- a/plugins/jetpack/extensions/blocks/wordads/index.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * External dependencies - */ -import { __ } from '@wordpress/i18n'; -import { ExternalLink, Path, SVG } from '@wordpress/components'; -import { Fragment } from '@wordpress/element'; - -/** - * Internal dependencies - */ -import edit from './edit'; -import { DEFAULT_FORMAT } from './constants'; - -export const name = 'wordads'; -export const title = __( 'Ad', 'jetpack' ); - -export const icon = ( - <SVG xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> - <Path fill="none" d="M0 0h24v24H0V0z" /> - <Path d="M12,8H4A2,2 0 0,0 2,10V14A2,2 0 0,0 4,16H5V20A1,1 0 0,0 6,21H8A1,1 0 0,0 9,20V16H12L17,20V4L12,8M15,15.6L13,14H4V10H13L15,8.4V15.6M21.5,12C21.5,13.71 20.54,15.26 19,16V8C20.53,8.75 21.5,10.3 21.5,12Z" /> - </SVG> -); - -export const settings = { - title, - - description: ( - <Fragment> - <p>{ __( 'Earn income by adding high quality ads to your post', 'jetpack' ) }</p> - <ExternalLink href="https://wordads.co/"> - { __( 'Learn all about WordAds', 'jetpack' ) } - </ExternalLink> - </Fragment> - ), - - icon, - attributes: { - align: { - type: 'string', - default: 'center', - }, - format: { - type: 'string', - default: DEFAULT_FORMAT, - }, - hideMobile: { - type: 'boolean', - default: false, - }, - }, - - category: 'jetpack', - - keywords: [ __( 'ads', 'jetpack' ), 'WordAds', __( 'Advertisement', 'jetpack' ) ], - - supports: { - align: [ 'left', 'center', 'right' ], - alignWide: false, - className: false, - customClassName: false, - html: false, - reusable: false, - }, - edit, - save: () => null, -}; diff --git a/plugins/jetpack/extensions/blocks/wordads/wordads.php b/plugins/jetpack/extensions/blocks/wordads/wordads.php index 8cb8ea2a..9f67d58b 100644 --- a/plugins/jetpack/extensions/blocks/wordads/wordads.php +++ b/plugins/jetpack/extensions/blocks/wordads/wordads.php @@ -76,7 +76,12 @@ class Jetpack_WordAds_Gutenblock { global $wordads; /** This filter is already documented in modules/wordads/wordads.php `insert_ad()` */ - if ( empty( $wordads ) || is_feed() || apply_filters( 'wordads_inpost_disable', false ) ) { + if ( + empty( $wordads ) + || empty( $wordads->params ) + || is_feed() + || apply_filters( 'wordads_inpost_disable', false ) + ) { return ''; } |