Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #64 Added plugin textdomain to inti hook #66

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions includes/admin/class-wc-call-for-price-settings-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,20 @@ class Alg_WC_Call_For_Price_Settings_General {
*/
public function __construct() {

$this->id = '';
$this->desc = __( 'General', 'woocommerce-call-for-price' );
$this->id = '';
add_action( 'init', array( &$this, 'add_cfp_desc_general' ) );

add_filter( 'woocommerce_get_sections_alg_call_for_price', array( $this, 'settings_section' ) );
add_filter( 'woocommerce_get_settings_alg_call_for_price_' . $this->id, array( $this, 'get_settings' ), PHP_INT_MAX );
}

/**
* Add desc to setting page.
*/
public function add_cfp_desc_general() {
$this->desc = __( 'General', 'woocommerce-call-for-price' );
}

/**
* Wettings_section.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ class Alg_WC_Call_For_Price_Settings_Product_Types {
*/
public function __construct() {
add_filter( 'woocommerce_get_sections_alg_call_for_price', array( $this, 'settings_section' ) );
add_action( 'init', array( &$this, 'add_cfp_desc_product_types' ) );
add_action( 'woocommerce_admin_field_alg_wc_call_for_price_textarea', array( $this, 'output_custom_textarea' ) );
add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'unclean_custom_textarea' ), PHP_INT_MAX, 3 );
}
/**
* Add desc to setting page.
*/
public function add_cfp_desc_product_types() {
$this->product_types = array(
'simple' => __( 'Simple Products', 'woocommerce-call-for-price' ),
'variable' => __( 'Variable Products', 'woocommerce-call-for-price' ),
Expand All @@ -46,8 +54,6 @@ public function __construct() {
foreach ( $this->product_types as $product_type_id => $product_type_desc ) {
add_filter( 'woocommerce_get_settings_alg_call_for_price_' . $product_type_id, array( $this, 'get_settings' ), PHP_INT_MAX );
}
add_action( 'woocommerce_admin_field_alg_wc_call_for_price_textarea', array( $this, 'output_custom_textarea' ) );
add_filter( 'woocommerce_admin_settings_sanitize_option', array( $this, 'unclean_custom_textarea' ), PHP_INT_MAX, 3 );
}

/**
Expand Down
9 changes: 8 additions & 1 deletion woocommerce-call-for-price.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static function instance() {
public function __construct() {

// Set up localisation.
load_plugin_textdomain( 'woocommerce-call-for-price', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
add_action( 'init', array( $this, 'cfp_load_text_domain' ) );

// Include required files.
$this->includes();
Expand All @@ -116,6 +116,13 @@ public function __construct() {
}
}

/**
* Added plugin text domain.
*/
public function cfp_load_text_domain() {
load_plugin_textdomain( 'woocommerce-call-for-price', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
}

/**
* Show action links on the plugin screen
*
Expand Down
Loading