Plugin Directory

Changeset 3308314


Ignore:
Timestamp:
06/09/2025 07:48:45 AM (10 months ago)
Author:
vaksin
Message:

0.2.7

  • Fix data cleaned when edit the options page setup
  • add Polylang integration
Location:
radas
Files:
181 added
6 edited

Legend:

Unmodified
Added
Removed
  • radas/trunk/admin/option-page.php

    r3305515 r3308314  
    1111use Radas\Lib\Factories\Element_Factory;
    1212use Radas\Lib\Helper\Breakdance;
     13use Radas\Lib\Helper\Polylang;
    1314use Radas\Lib\Helper\Util;
    1415use Radas\Lib\Helper\WPML;
     
    9798        add_shortcode( $this->page['slug'], [$this, 'create_shortcode'] );
    9899
     100        /** get options value ana insert to fields */
     101        $this->get_option_values();
     102
    99103        if(Breakdance::is_active()) {
    100104            foreach($this->fields as $field){
     
    105109        if(WPML::is_active()) {
    106110            $this->wpml_setup_string();
     111        }
     112
     113        if(Polylang::is_active()) {
     114            $this->register_polylang_string();
    107115        }
    108116    }
     
    321329    }
    322330
     331    public function register_polylang_string(){       
     332
     333        /** @var Field $field */
     334        foreach($this->fields as $field){
     335            if(!in_array($field->type, $this->get_wpml_non_translated_field_type())) {
     336                $multiline = in_array($field->type, ['editor', 'textarea']);
     337                Polylang::register_string($field->label, $field->get_sanitized_value(), $this->page['title'] . ' Options', $multiline);               
     338            }
     339        }
     340    }
     341
     342
    323343    protected function get_wpml_package_kind(){
    324344        return [
     
    373393        }   
    374394
     395        if( Polylang::is_active() && !in_array( $field->type, $this->get_wpml_non_translated_field_type() ) ) {
     396            $translated_value = Polylang::get_translated_string($value);       
     397           
     398            // if($field->type == 'url' && ($translated_value == $value || $translated_value == 'auto') ){
     399            //  $translated_value = WPML::get_permalink($value);
     400            // }
     401           
     402            $value = $translated_value;           
     403        }
     404
    375405        if( array_key_exists('format', $args) && $args['format'] == 'raw' ){
    376406            return $value ;
  • radas/trunk/admin/rest/cpt/rest-option-page.php

    r3304643 r3308314  
    33
    44use Radas\Admin\Option_Page;
    5 use Radas\Lib\Helper\Instance;
    65use Radas\Lib\Helper\Option;
    76use Radas\Lib\Helper\Util;
  • radas/trunk/inc/plugin.php

    r3304101 r3308314  
    33use Radas\Admin\Assets\Admin_Scripts_Rds;
    44use Radas\Admin\Assets\Admin_Styles_Rds;
    5 use Radas\Admin\Option_Page;
    65use Radas\Admin\Option_Page_CPT;
    76use Radas\Admin\Rest\CPT\REST_Option_Page;
    8 use Radas\Lib\Helper\Instance;
    97use Radas\Lib\Helper\Option;
    108
     
    7674            $opt_page = Option::get_instance_by_id( get_post()->ID );
    7775            if(!is_null($opt_page)){
    78                 $opt_page->register();
     76                $opt_page->register();               
    7977            }
    8078        }
  • radas/trunk/lib/helper/option.php

    r3304643 r3308314  
    6969
    7070    public static function refresh_instance_by_id($post_id){
    71         self::delete_instance_by_id($post_id);
     71        $page = json_decode( get_post_meta( $post_id, 'op_json', true ), true );   
     72        if(array_key_exists('slug', $page)) {
     73            Instance::delete_with_param(Option_Page::class, $page['slug']);
     74        }       
    7275        self::get_instance_by_id($post_id);
    7376    }       
  • radas/trunk/radas.php

    r3305507 r3308314  
    44 * Plugin URI:        https://wpradas.com
    55 * Description:       The Lightweight WordPress Plugin for Effortless Options Page Creation
    6  * Version:           0.2.6
     6 * Version:           0.2.7
    77 * Requires at least: 6.5
    88 * Requires PHP:      8.0
  • radas/trunk/readme.txt

    r3305507 r3308314  
    55Requires at least: 6.5
    66Tested up to: 6.8.1
    7 Stable tag: 0.2.6
     7Stable tag: 0.2.7
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7171
    7272== Changelog ==
     73= 0.2.7 =
     74
     75* Fix data cleaned when edit the options page setup
     76* add Polylang integration
     77
    7378= 0.2.6 =
    7479
Note: See TracChangeset for help on using the changeset viewer.