Changeset 2917501
- Timestamp:
- 05/25/2023 08:38:19 PM (15 months ago)
- Location:
- sharing-image
- Files:
-
- 16 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
sharing-image/tags/2.0.16/assets/scripts/settings.js
r2893725 r2917501 2426 2426 options: { 2427 2427 jpg: wp.i18n.__('JPEG', 'sharing-image'), 2428 png: wp.i18n.__('PNG', 'sharing-image') 2428 png: wp.i18n.__('PNG', 'sharing-image'), 2429 gif: wp.i18n.__('GIF', 'sharing-image') 2429 2430 }, 2430 2431 attributes: { … … 3489 3490 } 3490 3491 3491 if ('t axonomy' === picker_params.context) {3492 if ('t' === picker_params.context) { 3492 3493 const title = builders.element('div', { 3493 3494 classes: ['sharing-image-title'], … … 3530 3531 name: 'sharing_image_screen', 3531 3532 value: picker_params.screen 3533 3534 3535 3536 3537 3538 3539 3540 3532 3541 }, 3533 3542 append: picker -
sharing-image/tags/2.0.16/assets/scripts/widget.js
r2893725 r2917501 2426 2426 options: { 2427 2427 jpg: wp.i18n.__('JPEG', 'sharing-image'), 2428 png: wp.i18n.__('PNG', 'sharing-image') 2428 png: wp.i18n.__('PNG', 'sharing-image'), 2429 gif: wp.i18n.__('GIF', 'sharing-image') 2429 2430 }, 2430 2431 attributes: { … … 3489 3490 } 3490 3491 3491 if ('t axonomy' === picker_params.context) {3492 if ('t' === picker_params.context) { 3492 3493 const title = builders.element('div', { 3493 3494 classes: ['sharing-image-title'], … … 3530 3531 name: 'sharing_image_screen', 3531 3532 value: picker_params.screen 3533 3534 3535 3536 3537 3538 3539 3540 3532 3541 }, 3533 3542 append: picker -
sharing-image/tags/2.0.16/assets/styles/widget.css
r2748770 r2917501 200 200 } 201 201 } 202 .sharing-image-widget.widget-t axonomy{202 .sharing-image-widget.widget-t { 203 203 max-width: 95%; 204 204 margin-bottom: 20px; 205 205 } 206 .sharing-image-widget.widget-t axonomy.sharing-image-picker {206 .sharing-image-widget.widget-t .sharing-image-picker { 207 207 margin-top: 15px; 208 208 padding: 10px; … … 212 212 } 213 213 @media screen and (max-width: 782px) { 214 .sharing-image-widget.widget-t axonomy{214 .sharing-image-widget.widget-t { 215 215 display: block; 216 216 } -
sharing-image/tags/2.0.16/classes/class-generator.php
r2893725 r2917501 53 53 } 54 54 55 $template = $this-> generate_template( $templates[ $id ], $post_id );55 $template = $this->_template( $templates[ $id ], $post_id ); 56 56 57 57 if ( ! $this->check_required( $template ) ) { … … 80 80 * Compose image using picker data. 81 81 * 82 * @param array $picker Picker data from metabox. 83 * @param int $screen_id Post or term ID from admin screen. 82 * @param array $picker Picker data from metabox. 83 * @param int $screen_id Post or term ID from admin screen. 84 * @param string $context Screen ID context field. Can be settings, post or term. 84 85 * 85 86 * @return array|WP_Error Poster url, width and height or WP_Error on failure. 86 87 */ 87 public function compose( $picker, $screen_id ) {88 public function compose( $picker, $screen_id ) { 88 89 if ( ! isset( $picker['template'] ) ) { 89 90 return new WP_Error( 'validate', esc_html__( 'Template id cannot be empty', 'sharing-image' ) ); … … 105 106 } 106 107 107 $template = $this->prepare_template( $templates[ $id ], $fieldset, null, $screen_id );108 $template = $this->prepare_template( $templates[ $id ], $fieldset, null, $screen_id ); 108 109 109 110 if ( ! $this->check_required( $template ) ) { … … 189 190 * @return array List of template data. 190 191 */ 191 private function generate_template( $template, $post_id ) {192 private function _template( $template, $post_id ) { 192 193 $layers = array(); 193 194 … … 222 223 } 223 224 224 $template = $this->prepare_template( $template, $fieldset, null, $post_id );225 $template = $this->prepare_template( $template, $fieldset, null, $post_id ); 225 226 226 227 return $template; … … 235 236 * @param integer $index Optional. Template index from editor. 236 237 * @param integer $screen_id Optional. Post or term ID from admin screen. 238 237 239 * 238 240 * @return array List of template data. 239 241 */ 240 private function prepare_template( $template, $fieldset = array(), $index = null, $screen_id = 0 ) {242 private function prepare_template( $template, $fieldset = array(), $index = null, $screen_id = 0 ) { 241 243 $layers = array(); 242 244 … … 290 292 * @param integer $index Template index from editor. 291 293 * @param integer $screen_id Post or term ID from admin screen. 294 292 295 */ 293 return apply_filters( 'sharing_image_prepare_template', $template, $fieldset, $index, $screen_id );296 return apply_filters( 'sharing_image_prepare_template', $template, $fieldset, $index, $screen_id ); 294 297 } 295 298 -
sharing-image/tags/2.0.16/classes/class-settings.php
r2749311 r2917501 1265 1265 $format = $config['format']; 1266 1266 1267 if ( in_array( $format, array( 'jpg', 'png' ), true ) ) {1267 if ( in_array( $format, array( 'jpg', 'png' ), true ) ) { 1268 1268 $sanitized['format'] = $config['format']; 1269 1269 } … … 1487 1487 1488 1488 // We do not pay attention to the possible error. 1489 mkdir( ABSPATH . $storage, $permissions, true );1489 ( ABSPATH . $storage, $permissions, true ); 1490 1490 1491 1491 return array( ABSPATH . $storage, site_url( $storage ) ); … … 1495 1495 * Add message id to the back link and redirect 1496 1496 * 1497 * @param string $re turnRedirect link.1498 * @param int $message Settings error message id.1499 */ 1500 private function redirect_with_message( $re turn, $message ) {1497 * @param string $re Redirect link. 1498 * @param int $message Settings error message id. 1499 */ 1500 private function redirect_with_message( $re, $message ) { 1501 1501 $return = add_query_arg( array( 'message' => $message ), $return ); 1502 1502 1503 wp_safe_redirect( $re turn);1503 wp_safe_redirect( $re ); 1504 1504 exit; 1505 1505 } -
sharing-image/tags/2.0.16/classes/class-widget.php
r2893725 r2917501 138 138 $meta = get_post_meta( $post->ID, self::WIDGET_META, true ); 139 139 140 $this->enqueue_scripts( $this->create_script_object( $meta, ' metabox', $post->ID ) );140 $this->enqueue_scripts( $this->create_script_object( $meta, '', $post->ID ) ); 141 141 $this->enqueue_styles(); 142 142 } … … 169 169 $meta = get_term_meta( $term_id, self::WIDGET_META, true ); 170 170 171 $this->enqueue_scripts( $this->create_script_object( $meta, 't axonomy', $term_id ) );171 $this->enqueue_scripts( $this->create_script_object( $meta, 't', $term_id ) ); 172 172 $this->enqueue_styles(); 173 173 } … … 302 302 } 303 303 304 305 306 307 308 309 304 310 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput 305 311 $picker = $this->sanitize_picker( wp_unslash( $_POST['sharing_image_picker'] ) ); 306 312 307 313 // Compose new poster data. 308 $source = ( new Generator() )->compose( $picker, $screen_id );314 $source = ( new Generator() )->compose( $picker, $screen_id ); 309 315 310 316 if ( is_wp_error( $source ) ) { … … 334 340 $meta = get_post_meta( $post_id, self::WIDGET_META, true ); 335 341 336 wp_send_json_success( $this->create_script_object( $meta, ' metabox', $post_id ) );342 wp_send_json_success( $this->create_script_object( $meta, '', $post_id ) ); 337 343 } 338 344 -
sharing-image/tags/2.0.16/readme.txt
r2893725 r2917501 5 5 Requires at least: 5.3 6 6 Tested up to: 6.2 7 Stable tag: 2.0.1 57 Stable tag: 2.0.1 8 8 Requires PHP: 5.5 9 9 License: GPLv2 or later … … 31 31 == Changelog == 32 32 33 34 35 36 33 37 = 2.0.15 = 34 * Add optional $screen_id parameter to `sharing_image_prepare_template` filter35 * Update packages38 * Add optional $screen_id parameter to `sharing_image_prepare_template` filter 39 * Update packages 36 40 37 41 = 2.0.14 = 38 * Fix poster background opacity on template editor screen39 * Try to fixjs obfuscation for i18n functions42 * Fix poster background opacity on template editor screen 43 * js obfuscation for i18n functions 40 44 41 45 = 2.0.13 = -
sharing-image/tags/2.0.16/sharing-image.php
r2893725 r2917501 3 3 * Plugin Name: Sharing Image 4 4 * Description: Create sharing image for Facebook, VK.com, Telegram and other social networks 5 * Version: 2.0.1 55 * Version: 2.0.1 6 6 * Requires at least: 5.3 7 7 * Requires PHP: 5.5 … … 25 25 * Plugin version. 26 26 */ 27 define( 'SHARING_IMAGE_VERSION', '2.0.1 5' );27 define( 'SHARING_IMAGE_VERSION', '2.0.1' ); 28 28 29 29 /** -
sharing-image/trunk/assets/scripts/settings.js
r2893725 r2917501 2426 2426 options: { 2427 2427 jpg: wp.i18n.__('JPEG', 'sharing-image'), 2428 png: wp.i18n.__('PNG', 'sharing-image') 2428 png: wp.i18n.__('PNG', 'sharing-image'), 2429 gif: wp.i18n.__('GIF', 'sharing-image') 2429 2430 }, 2430 2431 attributes: { … … 3489 3490 } 3490 3491 3491 if ('t axonomy' === picker_params.context) {3492 if ('t' === picker_params.context) { 3492 3493 const title = builders.element('div', { 3493 3494 classes: ['sharing-image-title'], … … 3530 3531 name: 'sharing_image_screen', 3531 3532 value: picker_params.screen 3533 3534 3535 3536 3537 3538 3539 3540 3532 3541 }, 3533 3542 append: picker -
sharing-image/trunk/assets/scripts/widget.js
r2893725 r2917501 2426 2426 options: { 2427 2427 jpg: wp.i18n.__('JPEG', 'sharing-image'), 2428 png: wp.i18n.__('PNG', 'sharing-image') 2428 png: wp.i18n.__('PNG', 'sharing-image'), 2429 gif: wp.i18n.__('GIF', 'sharing-image') 2429 2430 }, 2430 2431 attributes: { … … 3489 3490 } 3490 3491 3491 if ('t axonomy' === picker_params.context) {3492 if ('t' === picker_params.context) { 3492 3493 const title = builders.element('div', { 3493 3494 classes: ['sharing-image-title'], … … 3530 3531 name: 'sharing_image_screen', 3531 3532 value: picker_params.screen 3533 3534 3535 3536 3537 3538 3539 3540 3532 3541 }, 3533 3542 append: picker -
sharing-image/trunk/assets/styles/widget.css
r2748770 r2917501 200 200 } 201 201 } 202 .sharing-image-widget.widget-t axonomy{202 .sharing-image-widget.widget-t { 203 203 max-width: 95%; 204 204 margin-bottom: 20px; 205 205 } 206 .sharing-image-widget.widget-t axonomy.sharing-image-picker {206 .sharing-image-widget.widget-t .sharing-image-picker { 207 207 margin-top: 15px; 208 208 padding: 10px; … … 212 212 } 213 213 @media screen and (max-width: 782px) { 214 .sharing-image-widget.widget-t axonomy{214 .sharing-image-widget.widget-t { 215 215 display: block; 216 216 } -
sharing-image/trunk/classes/class-generator.php
r2893725 r2917501 53 53 } 54 54 55 $template = $this-> generate_template( $templates[ $id ], $post_id );55 $template = $this->_template( $templates[ $id ], $post_id ); 56 56 57 57 if ( ! $this->check_required( $template ) ) { … … 80 80 * Compose image using picker data. 81 81 * 82 * @param array $picker Picker data from metabox. 83 * @param int $screen_id Post or term ID from admin screen. 82 * @param array $picker Picker data from metabox. 83 * @param int $screen_id Post or term ID from admin screen. 84 * @param string $context Screen ID context field. Can be settings, post or term. 84 85 * 85 86 * @return array|WP_Error Poster url, width and height or WP_Error on failure. 86 87 */ 87 public function compose( $picker, $screen_id ) {88 public function compose( $picker, $screen_id ) { 88 89 if ( ! isset( $picker['template'] ) ) { 89 90 return new WP_Error( 'validate', esc_html__( 'Template id cannot be empty', 'sharing-image' ) ); … … 105 106 } 106 107 107 $template = $this->prepare_template( $templates[ $id ], $fieldset, null, $screen_id );108 $template = $this->prepare_template( $templates[ $id ], $fieldset, null, $screen_id ); 108 109 109 110 if ( ! $this->check_required( $template ) ) { … … 189 190 * @return array List of template data. 190 191 */ 191 private function generate_template( $template, $post_id ) {192 private function _template( $template, $post_id ) { 192 193 $layers = array(); 193 194 … … 222 223 } 223 224 224 $template = $this->prepare_template( $template, $fieldset, null, $post_id );225 $template = $this->prepare_template( $template, $fieldset, null, $post_id ); 225 226 226 227 return $template; … … 235 236 * @param integer $index Optional. Template index from editor. 236 237 * @param integer $screen_id Optional. Post or term ID from admin screen. 238 237 239 * 238 240 * @return array List of template data. 239 241 */ 240 private function prepare_template( $template, $fieldset = array(), $index = null, $screen_id = 0 ) {242 private function prepare_template( $template, $fieldset = array(), $index = null, $screen_id = 0 ) { 241 243 $layers = array(); 242 244 … … 290 292 * @param integer $index Template index from editor. 291 293 * @param integer $screen_id Post or term ID from admin screen. 294 292 295 */ 293 return apply_filters( 'sharing_image_prepare_template', $template, $fieldset, $index, $screen_id );296 return apply_filters( 'sharing_image_prepare_template', $template, $fieldset, $index, $screen_id ); 294 297 } 295 298 -
sharing-image/trunk/classes/class-settings.php
r2749311 r2917501 1265 1265 $format = $config['format']; 1266 1266 1267 if ( in_array( $format, array( 'jpg', 'png' ), true ) ) {1267 if ( in_array( $format, array( 'jpg', 'png' ), true ) ) { 1268 1268 $sanitized['format'] = $config['format']; 1269 1269 } … … 1487 1487 1488 1488 // We do not pay attention to the possible error. 1489 mkdir( ABSPATH . $storage, $permissions, true );1489 ( ABSPATH . $storage, $permissions, true ); 1490 1490 1491 1491 return array( ABSPATH . $storage, site_url( $storage ) ); … … 1495 1495 * Add message id to the back link and redirect 1496 1496 * 1497 * @param string $re turnRedirect link.1498 * @param int $message Settings error message id.1499 */ 1500 private function redirect_with_message( $re turn, $message ) {1497 * @param string $re Redirect link. 1498 * @param int $message Settings error message id. 1499 */ 1500 private function redirect_with_message( $re, $message ) { 1501 1501 $return = add_query_arg( array( 'message' => $message ), $return ); 1502 1502 1503 wp_safe_redirect( $re turn);1503 wp_safe_redirect( $re ); 1504 1504 exit; 1505 1505 } -
sharing-image/trunk/classes/class-widget.php
r2893725 r2917501 138 138 $meta = get_post_meta( $post->ID, self::WIDGET_META, true ); 139 139 140 $this->enqueue_scripts( $this->create_script_object( $meta, ' metabox', $post->ID ) );140 $this->enqueue_scripts( $this->create_script_object( $meta, '', $post->ID ) ); 141 141 $this->enqueue_styles(); 142 142 } … … 169 169 $meta = get_term_meta( $term_id, self::WIDGET_META, true ); 170 170 171 $this->enqueue_scripts( $this->create_script_object( $meta, 't axonomy', $term_id ) );171 $this->enqueue_scripts( $this->create_script_object( $meta, 't', $term_id ) ); 172 172 $this->enqueue_styles(); 173 173 } … … 302 302 } 303 303 304 305 306 307 308 309 304 310 // phpcs:ignore WordPress.Security.ValidatedSanitizedInput 305 311 $picker = $this->sanitize_picker( wp_unslash( $_POST['sharing_image_picker'] ) ); 306 312 307 313 // Compose new poster data. 308 $source = ( new Generator() )->compose( $picker, $screen_id );314 $source = ( new Generator() )->compose( $picker, $screen_id ); 309 315 310 316 if ( is_wp_error( $source ) ) { … … 334 340 $meta = get_post_meta( $post_id, self::WIDGET_META, true ); 335 341 336 wp_send_json_success( $this->create_script_object( $meta, ' metabox', $post_id ) );342 wp_send_json_success( $this->create_script_object( $meta, '', $post_id ) ); 337 343 } 338 344 -
sharing-image/trunk/readme.txt
r2893725 r2917501 5 5 Requires at least: 5.3 6 6 Tested up to: 6.2 7 Stable tag: 2.0.1 57 Stable tag: 2.0.1 8 8 Requires PHP: 5.5 9 9 License: GPLv2 or later … … 31 31 == Changelog == 32 32 33 34 35 36 33 37 = 2.0.15 = 34 * Add optional $screen_id parameter to `sharing_image_prepare_template` filter35 * Update packages38 * Add optional $screen_id parameter to `sharing_image_prepare_template` filter 39 * Update packages 36 40 37 41 = 2.0.14 = 38 * Fix poster background opacity on template editor screen39 * Try to fixjs obfuscation for i18n functions42 * Fix poster background opacity on template editor screen 43 * js obfuscation for i18n functions 40 44 41 45 = 2.0.13 = -
sharing-image/trunk/sharing-image.php
r2893725 r2917501 3 3 * Plugin Name: Sharing Image 4 4 * Description: Create sharing image for Facebook, VK.com, Telegram and other social networks 5 * Version: 2.0.1 55 * Version: 2.0.1 6 6 * Requires at least: 5.3 7 7 * Requires PHP: 5.5 … … 25 25 * Plugin version. 26 26 */ 27 define( 'SHARING_IMAGE_VERSION', '2.0.1 5' );27 define( 'SHARING_IMAGE_VERSION', '2.0.1' ); 28 28 29 29 /**
Note: See TracChangeset
for help on using the changeset viewer.