Plugin Directory

Changeset 3011233


Ignore:
Timestamp:
12/18/2023 09:30:38 AM (2 years ago)
Author:
laolaweb
Message:

Release 2.6.1

Location:
personio-integration-light
Files:
12 edited
12 copied

Legend:

Unmodified
Added
Removed
  • personio-integration-light/tags/2.6.1/classes/class-helper.php

    r3003667 r3011233  
    88namespace personioIntegration;
    99
     10use Exception;
    1011use WP_Post;
    1112use WP_Post_Type;
     
    651652    }
    652653
    653     /**
    654      * Return the active Wordpress-language depending on our own support.
    655      * If language is unknown for our plugin, use english.
    656      *
    657      * @return string
    658      * @noinspection PhpUnused
    659      */
     654    /**
     655     * Return the active Wordpress-language depending on our own support.
     656     * If language is unknown for our plugin, use english.
     657     *
     658     * @return string
     659     * @noinspection PhpUnused
     660     * @throws Exception
     661     */
    660662    public static function get_wp_lang(): string
    661663    {
     
    676678        }
    677679
     680        /**
     681         * Get main language set in weglot for the web page.
     682         */
     683        if( self::is_plugin_active( 'weglot/weglot.php' ) && function_exists( 'weglot_get_service' ) ) {
     684            $language_object = weglot_get_service('Language_Service_Weglot')->get_original_language();
     685            if( $language_object ) {
     686                $wpLang = $language_object->getInternalCode();
     687            }
     688        }
     689
    678690        // if language not set, use default language.
    679691        if( empty($wpLang) ) {
     
    713725            $wpLang = apply_filters('wpml_current_language', NULL );
    714726        }
     727
     728        /**
     729         * Get current language set in weglot for the web page.
     730         */
     731        if( self::is_plugin_active( 'weglot/weglot.php' ) && function_exists( 'weglot_get_current_language' ) ) {
     732            $wpLang = weglot_get_current_language();
     733        }
    715734
    716735        // if language not set, use default language.
  • personio-integration-light/tags/2.6.1/classes/class-import.php

    r3003667 r3011233  
    8686            foreach( $languages as $key => $enabled ) {
    8787                // define the url.
    88                 $url = helper::get_personio_xml_url(get_option('personioIntegrationUrl', '')).'?language=' . esc_attr($key);
     88                $url = apply_filters( 'personio_integration_import_url', helper::get_personio_xml_url(get_option('personioIntegrationUrl', '')).'?language=' . esc_attr($key), $key );
    8989
    9090                // define settings for first request to get the last-modified-date.
     
    122122
    123123                // check if response was with http-status 200, all others are errors.
    124                 if( 200 === $httpStatus ) {
     124                if( 200 === apply_filters( 'personio_integration_import_header_status', $httpStatus ) ) {
    125125
    126126                    // check if last modified timestamp has been changed.
    127                     if( $lastModifiedTimestamp === absint(get_option(WP_PERSONIO_INTEGRATION_OPTION_IMPORT_TIMESTAMP . $key, 0)) && !$this->_debug ) {
     127                    if( false !== $lastModifiedTimestamp && $lastModifiedTimestamp === absint(get_option(WP_PERSONIO_INTEGRATION_OPTION_IMPORT_TIMESTAMP . $key, 0)) && !$this->_debug ) {
    128128                        // timestamp did not change -> do nothing if we already have positions in the DB.
    129129                        if( $positions_count > 0 ) {
  • personio-integration-light/tags/2.6.1/classes/class-position.php

    r3003667 r3011233  
    272272
    273273            // add created at as post meta field.
    274             update_post_meta( $this->data['ID'], WP_PERSONIO_INTEGRATION_CPT_CREATEDAT, $this->data['createdAt']);
     274            update_post_meta( $this->data['ID'], WP_PERSONIO_INTEGRATION_CPT_CREATEDAT, strtotime($this->data['createdAt']));
    275275
    276276            // add all language-specific titles.
     
    527527        // if old template does not exist, use the one we configured.
    528528        if( ! Helper::has_template( $template_file ) ) {
     529            if( empty($template) ) {
     530                $template = 'default';
     531            }
    529532            $template_file = 'parts/jobdescription/'.$template.'.php';
    530533        }
  • personio-integration-light/tags/2.6.1/classes/class-positions.php

    r3003667 r3011233  
    9191            $query['order'] = $parameterToAdd['sort'];
    9292        }
    93         if( !empty($parameterToAdd['sortby']) && in_array($parameterToAdd['sortby'], ['title','date']) ) {
     93        if( !empty($parameterToAdd['sortby']) && 'title' === $parameterToAdd['sortby'] ) {
    9494            $query['orderby'] = $parameterToAdd['sortby'];
    95         }
     95            $query['personio_explicit_sort'] = 1;
     96        }
     97        if( !empty($parameterToAdd['sortby']) && 'date' === $parameterToAdd['sortby'] ) {
     98            $query['meta_key'] = WP_PERSONIO_INTEGRATION_CPT_CREATEDAT;
     99            $query['orderby'] = 'meta_value';
     100            $query['personio_explicit_sort'] = 1;
     101        }
    96102        if( !empty($parameterToAdd['personioid']) ) {
    97103            $query['meta_query'] = [
  • personio-integration-light/tags/2.6.1/inc/pagebuilder/gutenberg.php

    r3003667 r3011233  
    2727
    2828    // get block-classes
    29     $block_html_attributes = get_block_wrapper_attributes();
    30 
    31     // get styles
    32     $stylesArray = array();
    33     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    34     if( !empty($styles) ) {
    35         $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
    36     }
     29    $stylesArray = array();
     30    $block_html_attributes = '';
     31    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     32        $block_html_attributes = get_block_wrapper_attributes();
     33
     34        // get styles
     35        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     36        if (!empty($styles)) {
     37            $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
     38        }
     39    }
    3740
    3841    $attribute_defaults = array(
     
    7780
    7881    // get block-classes.
    79     $block_html_attributes = get_block_wrapper_attributes();
    80 
    81     // get styles.
    82     $stylesArray = array();
    83     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    84     if( !empty($styles) ) {
    85         $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
    86     }
    87     if (!empty($attributes['style']) && !empty($attributes['style']['spacing']) && !empty($attributes['style']['spacing']['blockGap'])) {
    88         $value = $attributes['style']['spacing']['blockGap'];
    89         // convert var-setting to var-style-entity
    90         if( false !== strpos($attributes['style']['spacing']['blockGap'], 'var:') ) {
    91             $value = str_replace('|', '--', $value);
    92             $value = str_replace('var:', '', $value);
    93             $value = 'var(--wp--' . $value . ')';
    94         }
    95         $stylesArray[] = 'body .' . $class . ' { margin-bottom: ' . $value . '; }';
    96     }
     82    $stylesArray = array();
     83    $block_html_attributes = '';
     84    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     85        $block_html_attributes = get_block_wrapper_attributes();
     86
     87        // get styles.
     88        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     89        if (!empty($styles)) {
     90            $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
     91        }
     92        if (!empty($attributes['style']) && !empty($attributes['style']['spacing']) && !empty($attributes['style']['spacing']['blockGap'])) {
     93            $value = $attributes['style']['spacing']['blockGap'];
     94            // convert var-setting to var-style-entity
     95            if (false !== strpos($attributes['style']['spacing']['blockGap'], 'var:')) {
     96                $value = str_replace('|', '--', $value);
     97                $value = str_replace('var:', '', $value);
     98                $value = 'var(--wp--' . $value . ')';
     99            }
     100            $stylesArray[] = 'body .' . $class . ' { margin-bottom: ' . $value . '; }';
     101        }
     102    }
    97103
    98104    // collect all settings for this block
     
    131137
    132138    // get block-classes
    133     $block_html_attributes = get_block_wrapper_attributes();
    134 
    135     // get styles
    136     $stylesArray = [];
    137     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    138     if( !empty($styles) ) {
    139         $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
    140     }
    141 
    142     $stylesArray = [];
    143     if( !empty($class) ) {
    144         if (!empty($attributes['hideResetLink'])) {
    145             $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-reset { display: none }';
    146         }
    147         if (!empty($attributes['hideFilterTitle'])) {
    148             $stylesArray[] = '.entry.' . $class . ' legend { display: none }';
    149         }
    150         if (!empty($attributes['space_between'])) {
    151             $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-linklist > div { margin-right: ' . $attributes['space_between'] . 'px }';
    152         }
    153     }
     139    $stylesArray = array();
     140    $block_html_attributes = '';
     141    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     142        $block_html_attributes = get_block_wrapper_attributes();
     143
     144        // get styles
     145        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     146        if (!empty($styles)) {
     147            $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
     148        }
     149
     150        if (!empty($class)) {
     151            if (!empty($attributes['hideResetLink'])) {
     152                $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-reset { display: none }';
     153            }
     154            if (!empty($attributes['hideFilterTitle'])) {
     155                $stylesArray[] = '.entry.' . $class . ' legend { display: none }';
     156            }
     157            if (!empty($attributes['space_between'])) {
     158                $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-linklist > div { margin-right: ' . $attributes['space_between'] . 'px }';
     159            }
     160        }
     161    }
    154162
    155163    // collect all settings for this block
     
    180188
    181189    // get block-classes
    182     $block_html_attributes = get_block_wrapper_attributes();
    183 
    184     // get styles
    185     $stylesArray = [];
    186     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    187     if( !empty($styles) ) {
    188         $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
    189     }
    190 
    191     $stylesArray = [];
    192     if( !empty($class) ) {
    193         if (!empty($attributes['hideResetLink'])) {
    194             $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-reset { display: none }';
    195         }
    196         if (!empty($attributes['hideSubmitButton'])) {
    197             $stylesArray[] = '.entry.' . $class . ' button { display: none }';
    198         }
    199         if (!empty($attributes['hideFilterTitle'])) {
    200             $stylesArray[] = '.entry.' . $class . ' legend { display: none }';
    201         }
    202     }
     190    $stylesArray = array();
     191    $block_html_attributes = '';
     192    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     193        $block_html_attributes = get_block_wrapper_attributes();
     194
     195        // get styles
     196        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     197        if (!empty($styles)) {
     198            $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
     199        }
     200
     201        if (!empty($class)) {
     202            if (!empty($attributes['hideResetLink'])) {
     203                $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-reset { display: none }';
     204            }
     205            if (!empty($attributes['hideSubmitButton'])) {
     206                $stylesArray[] = '.entry.' . $class . ' button { display: none }';
     207            }
     208            if (!empty($attributes['hideFilterTitle'])) {
     209                $stylesArray[] = '.entry.' . $class . ' legend { display: none }';
     210            }
     211        }
     212    }
    203213
    204214    // collect all settings for this block
    205     $attributes = [
     215    $attributes = array(
    206216        'templates' => '',
    207217        'filter' => implode(",", $attributes['filter']),
     
    210220        'styles' => implode(PHP_EOL, $stylesArray),
    211221        'classes' => $class.' '.helper::get_attribute_value_from_html('class', $block_html_attributes)
    212     ];
     222    );
    213223
    214224    // get the output
     
    263273
    264274    // get block-classes.
    265     $block_html_attributes = get_block_wrapper_attributes();
    266 
    267     // get styles.
    268     $stylesArray = array();
    269     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    270     if( !empty($styles) ) {
    271         $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
    272     }
     275    $stylesArray = array();
     276    $block_html_attributes = '';
     277    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     278        $block_html_attributes = get_block_wrapper_attributes();
     279
     280        // get styles.
     281        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     282        if (!empty($styles)) {
     283            $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
     284        }
     285    }
    273286
    274287    $attributes = array(
     
    556569
    557570        // register translations.
    558         wp_set_script_translations('wp-personio-integration-show-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    559         wp_set_script_translations('wp-personio-integration-list-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    560         wp_set_script_translations('wp-personio-integration-filter-list-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    561         wp_set_script_translations('wp-personio-integration-filter-select-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    562         wp_set_script_translations('wp-personio-integration-application-button-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    563         wp_set_script_translations('wp-personio-integration-details-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    564         wp_set_script_translations('wp-personio-integration-description-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     571        if( function_exists( 'wp_set_script_translations' ) ) {
     572            wp_set_script_translations('wp-personio-integration-show-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     573            wp_set_script_translations('wp-personio-integration-list-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     574            wp_set_script_translations('wp-personio-integration-filter-list-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     575            wp_set_script_translations('wp-personio-integration-filter-select-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     576            wp_set_script_translations('wp-personio-integration-application-button-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     577            wp_set_script_translations('wp-personio-integration-details-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     578            wp_set_script_translations('wp-personio-integration-description-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     579        }
    565580    }
    566581}
     
    699714
    700715    // get block-classes.
    701     $block_html_attributes = get_block_wrapper_attributes();
    702 
    703     // get styles.
    704     $stylesArray = array();
    705     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    706     if( !empty($styles) ) {
    707         $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
    708     }
     716    $stylesArray = array();
     717    $block_html_attributes = '';
     718    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     719        $block_html_attributes = get_block_wrapper_attributes();
     720
     721        // get styles.
     722        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     723        if (!empty($styles)) {
     724            $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
     725        }
     726    }
    709727
    710728    $attributes = array(
  • personio-integration-light/tags/2.6.1/personio-integration-light.php

    r3003667 r3011233  
    55 * Requires at least: 5.9
    66 * Requires PHP:      7.4
    7  * Version:           2.6.0
     7 * Version:           2.6.1
    88 * Author:            laOlaWeb
    99 * Author URI:        https://laolaweb.com
     
    1616
    1717// set version number
    18 const WP_PERSONIO_INTEGRATION_VERSION = '2.6.0';
     18const WP_PERSONIO_INTEGRATION_VERSION = '2.6.1';
    1919
    2020// save plugin-path
  • personio-integration-light/tags/2.6.1/readme.txt

    r3003667 r3011233  
    33Tags: personio, jobs, recruitment, employee
    44Requires at least: 5.9.3
    5 Tested up to: 6.4.1
     5Tested up to: 6.4.2
    66Requires PHP: 7.4
    77License: GPL-2.0-or-later
     
    340340* Fixed possible bug on archive page if job description is enabled there
    341341* Fixed visibility of text domain hint if Pro plugin is used
     342
     343= 2.6.1 =
     344* Added support for multilingual-plugin Weglot to detect the active language
     345* Added new hooks
     346* Changed import-format for createAt to UNIX-timestamp
     347* Sort by date now sort the positions by its createAt-value from Personio
     348* Better check for third party functions
     349* Compatibility with WordPress 6.4.2
     350* Fixed missing styles with some blocks in Block Editor
  • personio-integration-light/trunk/classes/class-helper.php

    r3003667 r3011233  
    88namespace personioIntegration;
    99
     10use Exception;
    1011use WP_Post;
    1112use WP_Post_Type;
     
    651652    }
    652653
    653     /**
    654      * Return the active Wordpress-language depending on our own support.
    655      * If language is unknown for our plugin, use english.
    656      *
    657      * @return string
    658      * @noinspection PhpUnused
    659      */
     654    /**
     655     * Return the active Wordpress-language depending on our own support.
     656     * If language is unknown for our plugin, use english.
     657     *
     658     * @return string
     659     * @noinspection PhpUnused
     660     * @throws Exception
     661     */
    660662    public static function get_wp_lang(): string
    661663    {
     
    676678        }
    677679
     680        /**
     681         * Get main language set in weglot for the web page.
     682         */
     683        if( self::is_plugin_active( 'weglot/weglot.php' ) && function_exists( 'weglot_get_service' ) ) {
     684            $language_object = weglot_get_service('Language_Service_Weglot')->get_original_language();
     685            if( $language_object ) {
     686                $wpLang = $language_object->getInternalCode();
     687            }
     688        }
     689
    678690        // if language not set, use default language.
    679691        if( empty($wpLang) ) {
     
    713725            $wpLang = apply_filters('wpml_current_language', NULL );
    714726        }
     727
     728        /**
     729         * Get current language set in weglot for the web page.
     730         */
     731        if( self::is_plugin_active( 'weglot/weglot.php' ) && function_exists( 'weglot_get_current_language' ) ) {
     732            $wpLang = weglot_get_current_language();
     733        }
    715734
    716735        // if language not set, use default language.
  • personio-integration-light/trunk/classes/class-import.php

    r3003667 r3011233  
    8686            foreach( $languages as $key => $enabled ) {
    8787                // define the url.
    88                 $url = helper::get_personio_xml_url(get_option('personioIntegrationUrl', '')).'?language=' . esc_attr($key);
     88                $url = apply_filters( 'personio_integration_import_url', helper::get_personio_xml_url(get_option('personioIntegrationUrl', '')).'?language=' . esc_attr($key), $key );
    8989
    9090                // define settings for first request to get the last-modified-date.
     
    122122
    123123                // check if response was with http-status 200, all others are errors.
    124                 if( 200 === $httpStatus ) {
     124                if( 200 === apply_filters( 'personio_integration_import_header_status', $httpStatus ) ) {
    125125
    126126                    // check if last modified timestamp has been changed.
    127                     if( $lastModifiedTimestamp === absint(get_option(WP_PERSONIO_INTEGRATION_OPTION_IMPORT_TIMESTAMP . $key, 0)) && !$this->_debug ) {
     127                    if( false !== $lastModifiedTimestamp && $lastModifiedTimestamp === absint(get_option(WP_PERSONIO_INTEGRATION_OPTION_IMPORT_TIMESTAMP . $key, 0)) && !$this->_debug ) {
    128128                        // timestamp did not change -> do nothing if we already have positions in the DB.
    129129                        if( $positions_count > 0 ) {
  • personio-integration-light/trunk/classes/class-position.php

    r3003667 r3011233  
    272272
    273273            // add created at as post meta field.
    274             update_post_meta( $this->data['ID'], WP_PERSONIO_INTEGRATION_CPT_CREATEDAT, $this->data['createdAt']);
     274            update_post_meta( $this->data['ID'], WP_PERSONIO_INTEGRATION_CPT_CREATEDAT, strtotime($this->data['createdAt']));
    275275
    276276            // add all language-specific titles.
     
    527527        // if old template does not exist, use the one we configured.
    528528        if( ! Helper::has_template( $template_file ) ) {
     529            if( empty($template) ) {
     530                $template = 'default';
     531            }
    529532            $template_file = 'parts/jobdescription/'.$template.'.php';
    530533        }
  • personio-integration-light/trunk/classes/class-positions.php

    r3003667 r3011233  
    9191            $query['order'] = $parameterToAdd['sort'];
    9292        }
    93         if( !empty($parameterToAdd['sortby']) && in_array($parameterToAdd['sortby'], ['title','date']) ) {
     93        if( !empty($parameterToAdd['sortby']) && 'title' === $parameterToAdd['sortby'] ) {
    9494            $query['orderby'] = $parameterToAdd['sortby'];
    95         }
     95            $query['personio_explicit_sort'] = 1;
     96        }
     97        if( !empty($parameterToAdd['sortby']) && 'date' === $parameterToAdd['sortby'] ) {
     98            $query['meta_key'] = WP_PERSONIO_INTEGRATION_CPT_CREATEDAT;
     99            $query['orderby'] = 'meta_value';
     100            $query['personio_explicit_sort'] = 1;
     101        }
    96102        if( !empty($parameterToAdd['personioid']) ) {
    97103            $query['meta_query'] = [
  • personio-integration-light/trunk/inc/pagebuilder/gutenberg.php

    r3003667 r3011233  
    2727
    2828    // get block-classes
    29     $block_html_attributes = get_block_wrapper_attributes();
    30 
    31     // get styles
    32     $stylesArray = array();
    33     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    34     if( !empty($styles) ) {
    35         $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
    36     }
     29    $stylesArray = array();
     30    $block_html_attributes = '';
     31    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     32        $block_html_attributes = get_block_wrapper_attributes();
     33
     34        // get styles
     35        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     36        if (!empty($styles)) {
     37            $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
     38        }
     39    }
    3740
    3841    $attribute_defaults = array(
     
    7780
    7881    // get block-classes.
    79     $block_html_attributes = get_block_wrapper_attributes();
    80 
    81     // get styles.
    82     $stylesArray = array();
    83     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    84     if( !empty($styles) ) {
    85         $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
    86     }
    87     if (!empty($attributes['style']) && !empty($attributes['style']['spacing']) && !empty($attributes['style']['spacing']['blockGap'])) {
    88         $value = $attributes['style']['spacing']['blockGap'];
    89         // convert var-setting to var-style-entity
    90         if( false !== strpos($attributes['style']['spacing']['blockGap'], 'var:') ) {
    91             $value = str_replace('|', '--', $value);
    92             $value = str_replace('var:', '', $value);
    93             $value = 'var(--wp--' . $value . ')';
    94         }
    95         $stylesArray[] = 'body .' . $class . ' { margin-bottom: ' . $value . '; }';
    96     }
     82    $stylesArray = array();
     83    $block_html_attributes = '';
     84    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     85        $block_html_attributes = get_block_wrapper_attributes();
     86
     87        // get styles.
     88        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     89        if (!empty($styles)) {
     90            $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
     91        }
     92        if (!empty($attributes['style']) && !empty($attributes['style']['spacing']) && !empty($attributes['style']['spacing']['blockGap'])) {
     93            $value = $attributes['style']['spacing']['blockGap'];
     94            // convert var-setting to var-style-entity
     95            if (false !== strpos($attributes['style']['spacing']['blockGap'], 'var:')) {
     96                $value = str_replace('|', '--', $value);
     97                $value = str_replace('var:', '', $value);
     98                $value = 'var(--wp--' . $value . ')';
     99            }
     100            $stylesArray[] = 'body .' . $class . ' { margin-bottom: ' . $value . '; }';
     101        }
     102    }
    97103
    98104    // collect all settings for this block
     
    131137
    132138    // get block-classes
    133     $block_html_attributes = get_block_wrapper_attributes();
    134 
    135     // get styles
    136     $stylesArray = [];
    137     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    138     if( !empty($styles) ) {
    139         $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
    140     }
    141 
    142     $stylesArray = [];
    143     if( !empty($class) ) {
    144         if (!empty($attributes['hideResetLink'])) {
    145             $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-reset { display: none }';
    146         }
    147         if (!empty($attributes['hideFilterTitle'])) {
    148             $stylesArray[] = '.entry.' . $class . ' legend { display: none }';
    149         }
    150         if (!empty($attributes['space_between'])) {
    151             $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-linklist > div { margin-right: ' . $attributes['space_between'] . 'px }';
    152         }
    153     }
     139    $stylesArray = array();
     140    $block_html_attributes = '';
     141    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     142        $block_html_attributes = get_block_wrapper_attributes();
     143
     144        // get styles
     145        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     146        if (!empty($styles)) {
     147            $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
     148        }
     149
     150        if (!empty($class)) {
     151            if (!empty($attributes['hideResetLink'])) {
     152                $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-reset { display: none }';
     153            }
     154            if (!empty($attributes['hideFilterTitle'])) {
     155                $stylesArray[] = '.entry.' . $class . ' legend { display: none }';
     156            }
     157            if (!empty($attributes['space_between'])) {
     158                $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-linklist > div { margin-right: ' . $attributes['space_between'] . 'px }';
     159            }
     160        }
     161    }
    154162
    155163    // collect all settings for this block
     
    180188
    181189    // get block-classes
    182     $block_html_attributes = get_block_wrapper_attributes();
    183 
    184     // get styles
    185     $stylesArray = [];
    186     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    187     if( !empty($styles) ) {
    188         $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
    189     }
    190 
    191     $stylesArray = [];
    192     if( !empty($class) ) {
    193         if (!empty($attributes['hideResetLink'])) {
    194             $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-reset { display: none }';
    195         }
    196         if (!empty($attributes['hideSubmitButton'])) {
    197             $stylesArray[] = '.entry.' . $class . ' button { display: none }';
    198         }
    199         if (!empty($attributes['hideFilterTitle'])) {
    200             $stylesArray[] = '.entry.' . $class . ' legend { display: none }';
    201         }
    202     }
     190    $stylesArray = array();
     191    $block_html_attributes = '';
     192    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     193        $block_html_attributes = get_block_wrapper_attributes();
     194
     195        // get styles
     196        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     197        if (!empty($styles)) {
     198            $stylesArray[] = '.' . $class . ' { ' . $styles . ' }';
     199        }
     200
     201        if (!empty($class)) {
     202            if (!empty($attributes['hideResetLink'])) {
     203                $stylesArray[] = '.entry.' . $class . ' .personio-position-filter-reset { display: none }';
     204            }
     205            if (!empty($attributes['hideSubmitButton'])) {
     206                $stylesArray[] = '.entry.' . $class . ' button { display: none }';
     207            }
     208            if (!empty($attributes['hideFilterTitle'])) {
     209                $stylesArray[] = '.entry.' . $class . ' legend { display: none }';
     210            }
     211        }
     212    }
    203213
    204214    // collect all settings for this block
    205     $attributes = [
     215    $attributes = array(
    206216        'templates' => '',
    207217        'filter' => implode(",", $attributes['filter']),
     
    210220        'styles' => implode(PHP_EOL, $stylesArray),
    211221        'classes' => $class.' '.helper::get_attribute_value_from_html('class', $block_html_attributes)
    212     ];
     222    );
    213223
    214224    // get the output
     
    263273
    264274    // get block-classes.
    265     $block_html_attributes = get_block_wrapper_attributes();
    266 
    267     // get styles.
    268     $stylesArray = array();
    269     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    270     if( !empty($styles) ) {
    271         $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
    272     }
     275    $stylesArray = array();
     276    $block_html_attributes = '';
     277    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     278        $block_html_attributes = get_block_wrapper_attributes();
     279
     280        // get styles.
     281        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     282        if (!empty($styles)) {
     283            $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
     284        }
     285    }
    273286
    274287    $attributes = array(
     
    556569
    557570        // register translations.
    558         wp_set_script_translations('wp-personio-integration-show-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    559         wp_set_script_translations('wp-personio-integration-list-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    560         wp_set_script_translations('wp-personio-integration-filter-list-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    561         wp_set_script_translations('wp-personio-integration-filter-select-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    562         wp_set_script_translations('wp-personio-integration-application-button-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    563         wp_set_script_translations('wp-personio-integration-details-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
    564         wp_set_script_translations('wp-personio-integration-description-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     571        if( function_exists( 'wp_set_script_translations' ) ) {
     572            wp_set_script_translations('wp-personio-integration-show-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     573            wp_set_script_translations('wp-personio-integration-list-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     574            wp_set_script_translations('wp-personio-integration-filter-list-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     575            wp_set_script_translations('wp-personio-integration-filter-select-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     576            wp_set_script_translations('wp-personio-integration-application-button-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     577            wp_set_script_translations('wp-personio-integration-details-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     578            wp_set_script_translations('wp-personio-integration-description-editor-script', 'personio-integration-light', trailingslashit(plugin_dir_path(WP_PERSONIO_INTEGRATION_PLUGIN)) . 'languages/');
     579        }
    565580    }
    566581}
     
    699714
    700715    // get block-classes.
    701     $block_html_attributes = get_block_wrapper_attributes();
    702 
    703     // get styles.
    704     $stylesArray = array();
    705     $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
    706     if( !empty($styles) ) {
    707         $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
    708     }
     716    $stylesArray = array();
     717    $block_html_attributes = '';
     718    if( function_exists( 'get_block_wrapper_attributes' ) ) {
     719        $block_html_attributes = get_block_wrapper_attributes();
     720
     721        // get styles.
     722        $styles = helper::get_attribute_value_from_html('style', $block_html_attributes);
     723        if (!empty($styles)) {
     724            $stylesArray[] = '.entry.' . $class . ' { ' . $styles . ' }';
     725        }
     726    }
    709727
    710728    $attributes = array(
  • personio-integration-light/trunk/personio-integration-light.php

    r3003667 r3011233  
    55 * Requires at least: 5.9
    66 * Requires PHP:      7.4
    7  * Version:           2.6.0
     7 * Version:           2.6.1
    88 * Author:            laOlaWeb
    99 * Author URI:        https://laolaweb.com
     
    1616
    1717// set version number
    18 const WP_PERSONIO_INTEGRATION_VERSION = '2.6.0';
     18const WP_PERSONIO_INTEGRATION_VERSION = '2.6.1';
    1919
    2020// save plugin-path
  • personio-integration-light/trunk/readme.txt

    r3003667 r3011233  
    33Tags: personio, jobs, recruitment, employee
    44Requires at least: 5.9.3
    5 Tested up to: 6.4.1
     5Tested up to: 6.4.2
    66Requires PHP: 7.4
    77License: GPL-2.0-or-later
     
    340340* Fixed possible bug on archive page if job description is enabled there
    341341* Fixed visibility of text domain hint if Pro plugin is used
     342
     343= 2.6.1 =
     344* Added support for multilingual-plugin Weglot to detect the active language
     345* Added new hooks
     346* Changed import-format for createAt to UNIX-timestamp
     347* Sort by date now sort the positions by its createAt-value from Personio
     348* Better check for third party functions
     349* Compatibility with WordPress 6.4.2
     350* Fixed missing styles with some blocks in Block Editor
Note: See TracChangeset for help on using the changeset viewer.