Plugin Directory

Changeset 2917501

Timestamp:
05/25/2023 08:38:19 PM (15 months ago)
Author:
antonlukin
Message:

Update to version 2.0.16 from GitHub

Location:
sharing-image
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sharing-image/tags/2.0.16/assets/scripts/settings.js

    r2893725 r2917501  
    24262426      options: {
    24272427        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')
    24292430      },
    24302431      attributes: {
     
    34893490  }
    34903491
    3491   if ('taxonomy' === picker_params.context) {
     3492  if ('t' === picker_params.context) {
    34923493    const title = builders.element('div', {
    34933494      classes: ['sharing-image-title'],
     
    35303531      name: 'sharing_image_screen',
    35313532      value: picker_params.screen
     3533
     3534
     3535
     3536
     3537
     3538
     3539
     3540
    35323541    },
    35333542    append: picker
  • sharing-image/tags/2.0.16/assets/scripts/widget.js

    r2893725 r2917501  
    24262426      options: {
    24272427        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')
    24292430      },
    24302431      attributes: {
     
    34893490  }
    34903491
    3491   if ('taxonomy' === picker_params.context) {
     3492  if ('t' === picker_params.context) {
    34923493    const title = builders.element('div', {
    34933494      classes: ['sharing-image-title'],
     
    35303531      name: 'sharing_image_screen',
    35313532      value: picker_params.screen
     3533
     3534
     3535
     3536
     3537
     3538
     3539
     3540
    35323541    },
    35333542    append: picker
  • sharing-image/tags/2.0.16/assets/styles/widget.css

    r2748770 r2917501  
    200200  }
    201201}
    202 .sharing-image-widget.widget-taxonomy {
     202.sharing-image-widget.widget-t {
    203203  max-width: 95%;
    204204  margin-bottom: 20px;
    205205}
    206 .sharing-image-widget.widget-taxonomy .sharing-image-picker {
     206.sharing-image-widget.widget-t .sharing-image-picker {
    207207  margin-top: 15px;
    208208  padding: 10px;
     
    212212}
    213213@media screen and (max-width: 782px) {
    214   .sharing-image-widget.widget-taxonomy {
     214  .sharing-image-widget.widget-t {
    215215    display: block;
    216216  }
  • sharing-image/tags/2.0.16/classes/class-generator.php

    r2893725 r2917501  
    5353        }
    5454
    55         $template = $this->generate_template( $templates[ $id ], $post_id );
     55        $template = $this->_template( $templates[ $id ], $post_id );
    5656
    5757        if ( ! $this->check_required( $template ) ) {
     
    8080     * Compose image using picker data.
    8181     *
    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.
    8485     *
    8586     * @return array|WP_Error Poster url, width and height or WP_Error on failure.
    8687     */
    87     public function compose( $picker, $screen_id ) {
     88    public function compose( $picker, $screen_id ) {
    8889        if ( ! isset( $picker['template'] ) ) {
    8990            return new WP_Error( 'validate', esc_html__( 'Template id cannot be empty', 'sharing-image' ) );
     
    105106        }
    106107
    107         $template = $this->prepare_template( $templates[ $id ], $fieldset, null, $screen_id );
     108        $template = $this->prepare_template( $templates[ $id ], $fieldset, null, $screen_id );
    108109
    109110        if ( ! $this->check_required( $template ) ) {
     
    189190     * @return array List of template data.
    190191     */
    191     private function generate_template( $template, $post_id ) {
     192    private function _template( $template, $post_id ) {
    192193        $layers = array();
    193194
     
    222223        }
    223224
    224         $template = $this->prepare_template( $template, $fieldset, null, $post_id );
     225        $template = $this->prepare_template( $template, $fieldset, null, $post_id );
    225226
    226227        return $template;
     
    235236     * @param integer $index     Optional. Template index from editor.
    236237     * @param integer $screen_id Optional. Post or term ID from admin screen.
     238
    237239     *
    238240     * @return array List of template data.
    239241     */
    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 ) {
    241243        $layers = array();
    242244
     
    290292         * @param integer $index     Template index from editor.
    291293         * @param integer $screen_id Post or term ID from admin screen.
     294
    292295         */
    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 );
    294297    }
    295298
  • sharing-image/tags/2.0.16/classes/class-settings.php

    r2749311 r2917501  
    12651265            $format = $config['format'];
    12661266
    1267             if ( in_array( $format, array( 'jpg', 'png' ), true ) ) {
     1267            if ( in_array( $format, array( 'jpg', 'png' ), true ) ) {
    12681268                $sanitized['format'] = $config['format'];
    12691269            }
     
    14871487
    14881488        // We do not pay attention to the possible error.
    1489         mkdir( ABSPATH . $storage, $permissions, true );
     1489        ( ABSPATH . $storage, $permissions, true );
    14901490
    14911491        return array( ABSPATH . $storage, site_url( $storage ) );
     
    14951495     * Add message id to the back link and redirect
    14961496     *
    1497      * @param string $return Redirect link.
    1498      * @param int    $message Settings error message id.
    1499      */
    1500     private function redirect_with_message( $return, $message ) {
     1497     * @param string $re Redirect link.
     1498     * @param int    $message Settings error message id.
     1499     */
     1500    private function redirect_with_message( $re, $message ) {
    15011501        $return = add_query_arg( array( 'message' => $message ), $return );
    15021502
    1503         wp_safe_redirect( $return );
     1503        wp_safe_redirect( $re );
    15041504        exit;
    15051505    }
  • sharing-image/tags/2.0.16/classes/class-widget.php

    r2893725 r2917501  
    138138        $meta = get_post_meta( $post->ID, self::WIDGET_META, true );
    139139
    140         $this->enqueue_scripts( $this->create_script_object( $meta, 'metabox', $post->ID ) );
     140        $this->enqueue_scripts( $this->create_script_object( $meta, '', $post->ID ) );
    141141        $this->enqueue_styles();
    142142    }
     
    169169        $meta = get_term_meta( $term_id, self::WIDGET_META, true );
    170170
    171         $this->enqueue_scripts( $this->create_script_object( $meta, 'taxonomy', $term_id ) );
     171        $this->enqueue_scripts( $this->create_script_object( $meta, 't', $term_id ) );
    172172        $this->enqueue_styles();
    173173    }
     
    302302        }
    303303
     304
     305
     306
     307
     308
     309
    304310        // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
    305311        $picker = $this->sanitize_picker( wp_unslash( $_POST['sharing_image_picker'] ) );
    306312
    307313        // Compose new poster data.
    308         $source = ( new Generator() )->compose( $picker, $screen_id );
     314        $source = ( new Generator() )->compose( $picker, $screen_id );
    309315
    310316        if ( is_wp_error( $source ) ) {
     
    334340        $meta = get_post_meta( $post_id, self::WIDGET_META, true );
    335341
    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 ) );
    337343    }
    338344
  • sharing-image/tags/2.0.16/readme.txt

    r2893725 r2917501  
    55Requires at least: 5.3
    66Tested up to: 6.2
    7 Stable tag: 2.0.15
     7Stable tag: 2.0.1
    88Requires PHP: 5.5
    99License: GPLv2 or later
     
    3131== Changelog ==
    3232
     33
     34
     35
     36
    3337= 2.0.15 =
    34 * Add optional $screen_id parameter to `sharing_image_prepare_template` filter
    35 * Update packages
     38* Add optional $screen_id parameter to `sharing_image_prepare_template` filter
     39* Update packages
    3640
    3741= 2.0.14 =
    38 * Fix poster background opacity on template editor screen
    39 * Try to fix js obfuscation for i18n functions
     42* Fix poster background opacity on template editor screen
     43* js obfuscation for i18n functions
    4044
    4145= 2.0.13 =
  • sharing-image/tags/2.0.16/sharing-image.php

    r2893725 r2917501  
    33 * Plugin Name:       Sharing Image
    44 * Description:       Create sharing image for Facebook, VK.com, Telegram and other social networks
    5  * Version:           2.0.15
     5 * Version:           2.0.1
    66 * Requires at least: 5.3
    77 * Requires PHP:      5.5
     
    2525 * Plugin version.
    2626 */
    27 define( 'SHARING_IMAGE_VERSION', '2.0.15' );
     27define( 'SHARING_IMAGE_VERSION', '2.0.1' );
    2828
    2929/**
  • sharing-image/trunk/assets/scripts/settings.js

    r2893725 r2917501  
    24262426      options: {
    24272427        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')
    24292430      },
    24302431      attributes: {
     
    34893490  }
    34903491
    3491   if ('taxonomy' === picker_params.context) {
     3492  if ('t' === picker_params.context) {
    34923493    const title = builders.element('div', {
    34933494      classes: ['sharing-image-title'],
     
    35303531      name: 'sharing_image_screen',
    35313532      value: picker_params.screen
     3533
     3534
     3535
     3536
     3537
     3538
     3539
     3540
    35323541    },
    35333542    append: picker
  • sharing-image/trunk/assets/scripts/widget.js

    r2893725 r2917501  
    24262426      options: {
    24272427        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')
    24292430      },
    24302431      attributes: {
     
    34893490  }
    34903491
    3491   if ('taxonomy' === picker_params.context) {
     3492  if ('t' === picker_params.context) {
    34923493    const title = builders.element('div', {
    34933494      classes: ['sharing-image-title'],
     
    35303531      name: 'sharing_image_screen',
    35313532      value: picker_params.screen
     3533
     3534
     3535
     3536
     3537
     3538
     3539
     3540
    35323541    },
    35333542    append: picker
  • sharing-image/trunk/assets/styles/widget.css

    r2748770 r2917501  
    200200  }
    201201}
    202 .sharing-image-widget.widget-taxonomy {
     202.sharing-image-widget.widget-t {
    203203  max-width: 95%;
    204204  margin-bottom: 20px;
    205205}
    206 .sharing-image-widget.widget-taxonomy .sharing-image-picker {
     206.sharing-image-widget.widget-t .sharing-image-picker {
    207207  margin-top: 15px;
    208208  padding: 10px;
     
    212212}
    213213@media screen and (max-width: 782px) {
    214   .sharing-image-widget.widget-taxonomy {
     214  .sharing-image-widget.widget-t {
    215215    display: block;
    216216  }
  • sharing-image/trunk/classes/class-generator.php

    r2893725 r2917501  
    5353        }
    5454
    55         $template = $this->generate_template( $templates[ $id ], $post_id );
     55        $template = $this->_template( $templates[ $id ], $post_id );
    5656
    5757        if ( ! $this->check_required( $template ) ) {
     
    8080     * Compose image using picker data.
    8181     *
    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.
    8485     *
    8586     * @return array|WP_Error Poster url, width and height or WP_Error on failure.
    8687     */
    87     public function compose( $picker, $screen_id ) {
     88    public function compose( $picker, $screen_id ) {
    8889        if ( ! isset( $picker['template'] ) ) {
    8990            return new WP_Error( 'validate', esc_html__( 'Template id cannot be empty', 'sharing-image' ) );
     
    105106        }
    106107
    107         $template = $this->prepare_template( $templates[ $id ], $fieldset, null, $screen_id );
     108        $template = $this->prepare_template( $templates[ $id ], $fieldset, null, $screen_id );
    108109
    109110        if ( ! $this->check_required( $template ) ) {
     
    189190     * @return array List of template data.
    190191     */
    191     private function generate_template( $template, $post_id ) {
     192    private function _template( $template, $post_id ) {
    192193        $layers = array();
    193194
     
    222223        }
    223224
    224         $template = $this->prepare_template( $template, $fieldset, null, $post_id );
     225        $template = $this->prepare_template( $template, $fieldset, null, $post_id );
    225226
    226227        return $template;
     
    235236     * @param integer $index     Optional. Template index from editor.
    236237     * @param integer $screen_id Optional. Post or term ID from admin screen.
     238
    237239     *
    238240     * @return array List of template data.
    239241     */
    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 ) {
    241243        $layers = array();
    242244
     
    290292         * @param integer $index     Template index from editor.
    291293         * @param integer $screen_id Post or term ID from admin screen.
     294
    292295         */
    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 );
    294297    }
    295298
  • sharing-image/trunk/classes/class-settings.php

    r2749311 r2917501  
    12651265            $format = $config['format'];
    12661266
    1267             if ( in_array( $format, array( 'jpg', 'png' ), true ) ) {
     1267            if ( in_array( $format, array( 'jpg', 'png' ), true ) ) {
    12681268                $sanitized['format'] = $config['format'];
    12691269            }
     
    14871487
    14881488        // We do not pay attention to the possible error.
    1489         mkdir( ABSPATH . $storage, $permissions, true );
     1489        ( ABSPATH . $storage, $permissions, true );
    14901490
    14911491        return array( ABSPATH . $storage, site_url( $storage ) );
     
    14951495     * Add message id to the back link and redirect
    14961496     *
    1497      * @param string $return Redirect link.
    1498      * @param int    $message Settings error message id.
    1499      */
    1500     private function redirect_with_message( $return, $message ) {
     1497     * @param string $re Redirect link.
     1498     * @param int    $message Settings error message id.
     1499     */
     1500    private function redirect_with_message( $re, $message ) {
    15011501        $return = add_query_arg( array( 'message' => $message ), $return );
    15021502
    1503         wp_safe_redirect( $return );
     1503        wp_safe_redirect( $re );
    15041504        exit;
    15051505    }
  • sharing-image/trunk/classes/class-widget.php

    r2893725 r2917501  
    138138        $meta = get_post_meta( $post->ID, self::WIDGET_META, true );
    139139
    140         $this->enqueue_scripts( $this->create_script_object( $meta, 'metabox', $post->ID ) );
     140        $this->enqueue_scripts( $this->create_script_object( $meta, '', $post->ID ) );
    141141        $this->enqueue_styles();
    142142    }
     
    169169        $meta = get_term_meta( $term_id, self::WIDGET_META, true );
    170170
    171         $this->enqueue_scripts( $this->create_script_object( $meta, 'taxonomy', $term_id ) );
     171        $this->enqueue_scripts( $this->create_script_object( $meta, 't', $term_id ) );
    172172        $this->enqueue_styles();
    173173    }
     
    302302        }
    303303
     304
     305
     306
     307
     308
     309
    304310        // phpcs:ignore WordPress.Security.ValidatedSanitizedInput
    305311        $picker = $this->sanitize_picker( wp_unslash( $_POST['sharing_image_picker'] ) );
    306312
    307313        // Compose new poster data.
    308         $source = ( new Generator() )->compose( $picker, $screen_id );
     314        $source = ( new Generator() )->compose( $picker, $screen_id );
    309315
    310316        if ( is_wp_error( $source ) ) {
     
    334340        $meta = get_post_meta( $post_id, self::WIDGET_META, true );
    335341
    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 ) );
    337343    }
    338344
  • sharing-image/trunk/readme.txt

    r2893725 r2917501  
    55Requires at least: 5.3
    66Tested up to: 6.2
    7 Stable tag: 2.0.15
     7Stable tag: 2.0.1
    88Requires PHP: 5.5
    99License: GPLv2 or later
     
    3131== Changelog ==
    3232
     33
     34
     35
     36
    3337= 2.0.15 =
    34 * Add optional $screen_id parameter to `sharing_image_prepare_template` filter
    35 * Update packages
     38* Add optional $screen_id parameter to `sharing_image_prepare_template` filter
     39* Update packages
    3640
    3741= 2.0.14 =
    38 * Fix poster background opacity on template editor screen
    39 * Try to fix js obfuscation for i18n functions
     42* Fix poster background opacity on template editor screen
     43* js obfuscation for i18n functions
    4044
    4145= 2.0.13 =
  • sharing-image/trunk/sharing-image.php

    r2893725 r2917501  
    33 * Plugin Name:       Sharing Image
    44 * Description:       Create sharing image for Facebook, VK.com, Telegram and other social networks
    5  * Version:           2.0.15
     5 * Version:           2.0.1
    66 * Requires at least: 5.3
    77 * Requires PHP:      5.5
     
    2525 * Plugin version.
    2626 */
    27 define( 'SHARING_IMAGE_VERSION', '2.0.15' );
     27define( 'SHARING_IMAGE_VERSION', '2.0.1' );
    2828
    2929/**
Note: See TracChangeset for help on using the changeset viewer.