NEWS POSTS
/**
* WooCommerce Coupons Functions
*
* Functions for coupon specific things.
*
* @package WooCommerce/Functions
* @version 3.0.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Get coupon types.
*
* @return array
*/
function wc_get_coupon_types() {
return (array) apply_filters(
'woocommerce_coupon_discount_types',
array(
'percent' => __( 'Percentage discount', 'woocommerce' ),
'fixed_cart' => __( 'Fixed cart discount', 'woocommerce' ),
'fixed_product' => __( 'Fixed product discount', 'woocommerce' ),
)
);
}
/**
* Get a coupon type's name.
*
* @param string $type Coupon type.
* @return string
*/
function wc_get_coupon_type( $type = '' ) {
$types = wc_get_coupon_types();
return isset( $types[ $type ] ) ? $types[ $type ] : '';
}
/**
* Coupon types that apply to individual products. Controls which validation rules will apply.
*
* @since 2.5.0
* @return array
*/
function wc_get_product_coupon_types() {
return (array) apply_filters( 'woocommerce_product_coupon_types', array( 'fixed_product', 'percent' ) );
}
/**
* Coupon types that apply to the cart as a whole. Controls which validation rules will apply.
*
* @since 2.5.0
* @return array
*/
function wc_get_cart_coupon_types() {
return (array) apply_filters( 'woocommerce_cart_coupon_types', array( 'fixed_cart' ) );
}
/**
* Check if coupons are enabled.
* Filterable.
*
* @since 2.5.0
*
* @return bool
*/
function wc_coupons_enabled() {
return apply_filters( 'woocommerce_coupons_enabled', 'yes' === get_option( 'woocommerce_enable_coupons' ) );
}
/**
* Get coupon code by ID.
*
* @since 3.0.0
* @param int $id Coupon ID.
* @return string
*/
function wc_get_coupon_code_by_id( $id ) {
$data_store = WC_Data_Store::load( 'coupon' );
return empty( $id ) ? '' : (string) $data_store->get_code_by_id( $id );
}
/**
* Get coupon code by ID.
*
* @since 3.0.0
* @param string $code Coupon code.
* @param int $exclude Used to exclude an ID from the check if you're checking existence.
* @return int
*/
function wc_get_coupon_id_by_code( $code, $exclude = 0 ) {
if ( empty( $code ) ) {
return 0;
}
$data_store = WC_Data_Store::load( 'coupon' );
$ids = wp_cache_get( WC_Cache_Helper::get_cache_prefix( 'coupons' ) . 'coupon_id_from_code_' . $code, 'coupons' );
if ( false === $ids ) {
$ids = $data_store->get_ids_by_code( $code );
if ( $ids ) {
wp_cache_set( WC_Cache_Helper::get_cache_prefix( 'coupons' ) . 'coupon_id_from_code_' . $code, $ids, 'coupons' );
}
}
$ids = array_diff( array_filter( array_map( 'absint', (array) $ids ) ), array( $exclude ) );
return apply_filters( 'woocommerce_get_coupon_id_from_code', absint( current( $ids ) ), $code, $exclude );
}
/**
* WooCommerce REST Functions
*
* Functions for REST specific things.
*
* @package WooCommerce/Functions
* @version 2.6.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Parses and formats a date for ISO8601/RFC3339.
*
* Required WP 4.4 or later.
* See https://developer.wordpress.org/reference/functions/mysql_to_rfc3339/
*
* @since 2.6.0
* @param string|null|WC_DateTime $date Date.
* @param bool $utc Send false to get local/offset time.
* @return string|null ISO8601/RFC3339 formatted datetime.
*/
function wc_rest_prepare_date_response( $date, $utc = true ) {
if ( is_numeric( $date ) ) {
$date = new WC_DateTime( "@$date", new DateTimeZone( 'UTC' ) );
$date->setTimezone( new DateTimeZone( wc_timezone_string() ) );
} elseif ( is_string( $date ) ) {
$date = new WC_DateTime( $date, new DateTimeZone( 'UTC' ) );
$date->setTimezone( new DateTimeZone( wc_timezone_string() ) );
}
if ( ! is_a( $date, 'WC_DateTime' ) ) {
return null;
}
// Get timestamp before changing timezone to UTC.
return gmdate( 'Y-m-d\TH:i:s', $utc ? $date->getTimestamp() : $date->getOffsetTimestamp() );
}
/**
* Returns image mime types users are allowed to upload via the API.
*
* @since 2.6.4
* @return array
*/
function wc_rest_allowed_image_mime_types() {
return apply_filters(
'woocommerce_rest_allowed_image_mime_types',
array(
'jpg|jpeg|jpe' => 'image/jpeg',
'gif' => 'image/gif',
'png' => 'image/png',
'bmp' => 'image/bmp',
'tiff|tif' => 'image/tiff',
'ico' => 'image/x-icon',
)
);
}
/**
* Upload image from URL.
*
* @since 2.6.0
* @param string $image_url Image URL.
* @return array|WP_Error Attachment data or error message.
*/
function wc_rest_upload_image_from_url( $image_url ) {
$parsed_url = wp_parse_url( $image_url );
// Check parsed URL.
if ( ! $parsed_url || ! is_array( $parsed_url ) ) {
/* translators: %s: image URL */
return new WP_Error( 'woocommerce_rest_invalid_image_url', sprintf( __( 'Invalid URL %s.', 'woocommerce' ), $image_url ), array( 'status' => 400 ) );
}
// Ensure url is valid.
$image_url = esc_url_raw( $image_url );
// download_url function is part of wp-admin.
if ( ! function_exists( 'download_url' ) ) {
include_once ABSPATH . 'wp-admin/includes/file.php';
}
$file_array = array();
$file_array['name'] = basename( current( explode( '?', $image_url ) ) );
// Download file to temp location.
$file_array['tmp_name'] = download_url( $image_url );
// If error storing temporarily, return the error.
if ( is_wp_error( $file_array['tmp_name'] ) ) {
return new WP_Error(
'woocommerce_rest_invalid_remote_image_url',
/* translators: %s: image URL */
sprintf( __( 'Error getting remote image %s.', 'woocommerce' ), $image_url ) . ' '
/* translators: %s: error message */
. sprintf( __( 'Error: %s', 'woocommerce' ), $file_array['tmp_name']->get_error_message() ),
array( 'status' => 400 )
);
}
// Do the validation and storage stuff.
$file = wp_handle_sideload(
$file_array,
array(
'test_form' => false,
'mimes' => wc_rest_allowed_image_mime_types(),
),
current_time( 'Y/m' )
);
if ( isset( $file['error'] ) ) {
@unlink( $file_array['tmp_name'] ); // @codingStandardsIgnoreLine.
/* translators: %s: error message */
return new WP_Error( 'woocommerce_rest_invalid_image', sprintf( __( 'Invalid image: %s', 'woocommerce' ), $file['error'] ), array( 'status' => 400 ) );
}
do_action( 'woocommerce_rest_api_uploaded_image_from_url', $file, $image_url );
return $file;
}
/**
* Set uploaded image as attachment.
*
* @since 2.6.0
* @param array $upload Upload information from wp_upload_bits.
* @param int $id Post ID. Default to 0.
* @return int Attachment ID
*/
function wc_rest_set_uploaded_image_as_attachment( $upload, $id = 0 ) {
$info = wp_check_filetype( $upload['file'] );
$title = '';
$content = '';
if ( ! function_exists( 'wp_generate_attachment_metadata' ) ) {
include_once ABSPATH . 'wp-admin/includes/image.php';
}
$image_meta = wp_read_image_metadata( $upload['file'] );
if ( $image_meta ) {
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
$title = wc_clean( $image_meta['title'] );
}
if ( trim( $image_meta['caption'] ) ) {
$content = wc_clean( $image_meta['caption'] );
}
}
$attachment = array(
'post_mime_type' => $info['type'],
'guid' => $upload['url'],
'post_parent' => $id,
'post_title' => $title ? $title : basename( $upload['file'] ),
'post_content' => $content,
);
$attachment_id = wp_insert_attachment( $attachment, $upload['file'], $id );
if ( ! is_wp_error( $attachment_id ) ) {
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $upload['file'] ) );
}
return $attachment_id;
}
/**
* Validate reports request arguments.
*
* @since 2.6.0
* @param mixed $value Value to valdate.
* @param WP_REST_Request $request Request instance.
* @param string $param Param to validate.
* @return WP_Error|boolean
*/
function wc_rest_validate_reports_request_arg( $value, $request, $param ) {
$attributes = $request->get_attributes();
if ( ! isset( $attributes['args'][ $param ] ) || ! is_array( $attributes['args'][ $param ] ) ) {
return true;
}
$args = $attributes['args'][ $param ];
if ( 'string' === $args['type'] && ! is_string( $value ) ) {
/* translators: 1: param 2: type */
return new WP_Error( 'woocommerce_rest_invalid_param', sprintf( __( '%1$s is not of type %2$s', 'woocommerce' ), $param, 'string' ) );
}
if ( 'date' === $args['format'] ) {
$regex = '#^\d{4}-\d{2}-\d{2}$#';
if ( ! preg_match( $regex, $value, $matches ) ) {
return new WP_Error( 'woocommerce_rest_invalid_date', __( 'The date you provided is invalid.', 'woocommerce' ) );
}
}
return true;
}
/**
* Encodes a value according to RFC 3986.
* Supports multidimensional arrays.
*
* @since 2.6.0
* @param string|array $value The value to encode.
* @return string|array Encoded values.
*/
function wc_rest_urlencode_rfc3986( $value ) {
if ( is_array( $value ) ) {
return array_map( 'wc_rest_urlencode_rfc3986', $value );
}
return str_replace( array( '+', '%7E' ), array( ' ', '~' ), rawurlencode( $value ) );
}
/**
* Check permissions of posts on REST API.
*
* @since 2.6.0
* @param string $post_type Post type.
* @param string $context Request context.
* @param int $object_id Post ID.
* @return bool
*/
function wc_rest_check_post_permissions( $post_type, $context = 'read', $object_id = 0 ) {
$contexts = array(
'read' => 'read_private_posts',
'create' => 'publish_posts',
'edit' => 'edit_post',
'delete' => 'delete_post',
'batch' => 'edit_others_posts',
);
if ( 'revision' === $post_type ) {
$permission = false;
} else {
$cap = $contexts[ $context ];
$post_type_object = get_post_type_object( $post_type );
$permission = current_user_can( $post_type_object->cap->$cap, $object_id );
}
return apply_filters( 'woocommerce_rest_check_permissions', $permission, $context, $object_id, $post_type );
}
/**
* Check permissions of users on REST API.
*
* @since 2.6.0
* @param string $context Request context.
* @param int $object_id Post ID.
* @return bool
*/
function wc_rest_check_user_permissions( $context = 'read', $object_id = 0 ) {
$contexts = array(
'read' => 'list_users',
'create' => 'promote_users', // Check if current user can create users, shop managers are not allowed to create users.
'edit' => 'edit_users',
'delete' => 'delete_users',
'batch' => 'promote_users',
);
// Check to allow shop_managers to manage only customers.
if ( in_array( $context, array( 'edit', 'delete' ), true ) && wc_current_user_has_role( 'shop_manager' ) ) {
$permission = false;
$user_data = get_userdata( $object_id );
$shop_manager_editable_roles = apply_filters( 'woocommerce_shop_manager_editable_roles', array( 'customer' ) );
if ( isset( $user_data->roles ) ) {
$can_manage_users = array_intersect( $user_data->roles, array_unique( $shop_manager_editable_roles ) );
// Check if Shop Manager can edit customer or with the is same shop manager.
if ( 0 < count( $can_manage_users ) || intval( $object_id ) === intval( get_current_user_id() ) ) {
$permission = current_user_can( $contexts[ $context ], $object_id );
}
}
} else {
$permission = current_user_can( $contexts[ $context ], $object_id );
}
return apply_filters( 'woocommerce_rest_check_permissions', $permission, $context, $object_id, 'user' );
}
/**
* Check permissions of product terms on REST API.
*
* @since 2.6.0
* @param string $taxonomy Taxonomy.
* @param string $context Request context.
* @param int $object_id Post ID.
* @return bool
*/
function wc_rest_check_product_term_permissions( $taxonomy, $context = 'read', $object_id = 0 ) {
$contexts = array(
'read' => 'manage_terms',
'create' => 'edit_terms',
'edit' => 'edit_terms',
'delete' => 'delete_terms',
'batch' => 'edit_terms',
);
$cap = $contexts[ $context ];
$taxonomy_object = get_taxonomy( $taxonomy );
$permission = current_user_can( $taxonomy_object->cap->$cap, $object_id );
return apply_filters( 'woocommerce_rest_check_permissions', $permission, $context, $object_id, $taxonomy );
}
/**
* Check manager permissions on REST API.
*
* @since 2.6.0
* @param string $object Object.
* @param string $context Request context.
* @return bool
*/
function wc_rest_check_manager_permissions( $object, $context = 'read' ) {
$objects = array(
'reports' => 'view_woocommerce_reports',
'settings' => 'manage_woocommerce',
'system_status' => 'manage_woocommerce',
'attributes' => 'manage_product_terms',
'shipping_methods' => 'manage_woocommerce',
'payment_gateways' => 'manage_woocommerce',
'webhooks' => 'manage_woocommerce',
);
$permission = current_user_can( $objects[ $object ] );
return apply_filters( 'woocommerce_rest_check_permissions', $permission, $context, 0, $object );
}
/**
* Check product reviews permissions on REST API.
*
* @since 3.5.0
* @param string $context Request context.
* @param string $object_id Object ID.
* @return bool
*/
function wc_rest_check_product_reviews_permissions( $context = 'read', $object_id = 0 ) {
$permission = false;
$contexts = array(
'read' => 'moderate_comments',
'create' => 'moderate_comments',
'edit' => 'moderate_comments',
'delete' => 'moderate_comments',
'batch' => 'moderate_comments',
);
if ( isset( $contexts[ $context ] ) ) {
$permission = current_user_can( $contexts[ $context ] );
}
return apply_filters( 'woocommerce_rest_check_permissions', $permission, $context, $object_id, 'product_review' );
}
/**
* WooCommerce Widget Functions
*
* Widget related functions and widget registration.
*
* @package WooCommerce/Functions
* @version 2.3.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Include widget classes.
require_once dirname( __FILE__ ) . '/abstracts/abstract-wc-widget.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-cart.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-layered-nav-filters.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-layered-nav.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-price-filter.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-product-categories.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-product-search.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-product-tag-cloud.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-products.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-rating-filter.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-recent-reviews.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-recently-viewed.php';
require_once dirname( __FILE__ ) . '/widgets/class-wc-widget-top-rated-products.php';
/**
* Register Widgets.
*
* @since 2.3.0
*/
function wc_register_widgets() {
register_widget( 'WC_Widget_Cart' );
register_widget( 'WC_Widget_Layered_Nav_Filters' );
register_widget( 'WC_Widget_Layered_Nav' );
register_widget( 'WC_Widget_Price_Filter' );
register_widget( 'WC_Widget_Product_Categories' );
register_widget( 'WC_Widget_Product_Search' );
register_widget( 'WC_Widget_Product_Tag_Cloud' );
register_widget( 'WC_Widget_Products' );
register_widget( 'WC_Widget_Recently_Viewed' );
if ( 'yes' === get_option( 'woocommerce_enable_reviews', 'yes' ) ) {
register_widget( 'WC_Widget_Top_Rated_Products' );
register_widget( 'WC_Widget_Recent_Reviews' );
register_widget( 'WC_Widget_Rating_Filter' );
}
}
add_action( 'widgets_init', 'wc_register_widgets' );
/**
* Deprecated API functions for scheduling actions
*
* Functions with the wc prefix were deprecated to avoid confusion with
* Action Scheduler being included in WooCommerce core, and it providing
* a different set of APIs for working with the action queue.
*/
/**
* Schedule an action to run one time
*
* @param int $timestamp When the job will run
* @param string $hook The hook to trigger
* @param array $args Arguments to pass when the hook triggers
* @param string $group The group to assign this job to
*
* @return string The job ID
*/
function wc_schedule_single_action( $timestamp, $hook, $args = array(), $group = '' ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_single_action()' );
return as_schedule_single_action( $timestamp, $hook, $args, $group );
}
/**
* Schedule a recurring action
*
* @param int $timestamp When the first instance of the job will run
* @param int $interval_in_seconds How long to wait between runs
* @param string $hook The hook to trigger
* @param array $args Arguments to pass when the hook triggers
* @param string $group The group to assign this job to
*
* @deprecated 2.1.0
*
* @return string The job ID
*/
function wc_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args = array(), $group = '' ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_recurring_action()' );
return as_schedule_recurring_action( $timestamp, $interval_in_seconds, $hook, $args, $group );
}
/**
* Schedule an action that recurs on a cron-like schedule.
*
* @param int $timestamp The schedule will start on or after this time
* @param string $schedule A cron-link schedule string
* @see http://en.wikipedia.org/wiki/Cron
* * * * * * *
* ┬ ┬ ┬ ┬ ┬ ┬
* | | | | | |
* | | | | | + year [optional]
* | | | | +----- day of week (0 - 7) (Sunday=0 or 7)
* | | | +---------- month (1 - 12)
* | | +--------------- day of month (1 - 31)
* | +-------------------- hour (0 - 23)
* +------------------------- min (0 - 59)
* @param string $hook The hook to trigger
* @param array $args Arguments to pass when the hook triggers
* @param string $group The group to assign this job to
*
* @deprecated 2.1.0
*
* @return string The job ID
*/
function wc_schedule_cron_action( $timestamp, $schedule, $hook, $args = array(), $group = '' ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'as_schedule_cron_action()' );
return as_schedule_cron_action( $timestamp, $schedule, $hook, $args, $group );
}
/**
* Cancel the next occurrence of a job.
*
* @param string $hook The hook that the job will trigger
* @param array $args Args that would have been passed to the job
* @param string $group
*
* @deprecated 2.1.0
*/
function wc_unschedule_action( $hook, $args = array(), $group = '' ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'as_unschedule_action()' );
as_unschedule_action( $hook, $args, $group );
}
/**
* @param string $hook
* @param array $args
* @param string $group
*
* @deprecated 2.1.0
*
* @return int|bool The timestamp for the next occurrence, or false if nothing was found
*/
function wc_next_scheduled_action( $hook, $args = NULL, $group = '' ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'as_next_scheduled_action()' );
return as_next_scheduled_action( $hook, $args, $group );
}
/**
* Find scheduled actions
*
* @param array $args Possible arguments, with their default values:
* 'hook' => '' - the name of the action that will be triggered
* 'args' => NULL - the args array that will be passed with the action
* 'date' => NULL - the scheduled date of the action. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone.
* 'date_compare' => '<=' - operator for testing "date". accepted values are '!=', '>', '>=', '<', '<=', '='
* 'modified' => NULL - the date the action was last updated. Expects a DateTime object, a unix timestamp, or a string that can parsed with strtotime(). Used in UTC timezone.
* 'modified_compare' => '<=' - operator for testing "modified". accepted values are '!=', '>', '>=', '<', '<=', '='
* 'group' => '' - the group the action belongs to
* 'status' => '' - ActionScheduler_Store::STATUS_COMPLETE or ActionScheduler_Store::STATUS_PENDING
* 'claimed' => NULL - TRUE to find claimed actions, FALSE to find unclaimed actions, a string to find a specific claim ID
* 'per_page' => 5 - Number of results to return
* 'offset' => 0
* 'orderby' => 'date' - accepted values are 'hook', 'group', 'modified', or 'date'
* 'order' => 'ASC'
* @param string $return_format OBJECT, ARRAY_A, or ids
*
* @deprecated 2.1.0
*
* @return array
*/
function wc_get_scheduled_actions( $args = array(), $return_format = OBJECT ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'as_get_scheduled_actions()' );
return as_get_scheduled_actions( $args, $return_format );
}
Warning: Undefined array key "action" in /home/askadenya/public_html/wp-content/themes/gloreya-child/functions.php on line 2
namespace Elementor;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Elementor skin base.
*
* An abstract class to register new skins for Elementor widgets. Skins allows
* you to add new templates, set custom controls and more.
*
* To register new skins for your widget use the `add_skin()` method inside the
* widget's `_register_skins()` method.
*
* @since 1.0.0
* @abstract
*/
abstract class Skin_Base {
/**
* Parent widget.
*
* Holds the parent widget of the skin. Default value is null, no parent widget.
*
* @access protected
*
* @var Widget_Base|null
*/
protected $parent = null;
/**
* Skin base constructor.
*
* Initializing the skin base class by setting parent widget and registering
* controls actions.
*
* @since 1.0.0
* @access public
* @param Widget_Base $parent
*/
public function __construct( Widget_Base $parent ) {
$this->parent = $parent;
$this->_register_controls_actions();
}
/**
* Get skin ID.
*
* Retrieve the skin ID.
*
* @since 1.0.0
* @access public
* @abstract
*/
abstract public function get_id();
/**
* Get skin title.
*
* Retrieve the skin title.
*
* @since 1.0.0
* @access public
* @abstract
*/
abstract public function get_title();
/**
* Render skin.
*
* Generates the final HTML on the frontend.
*
* @since 1.0.0
* @access public
* @abstract
*/
abstract public function render();
/**
* Render skin output in the editor.
*
* Written as a Backbone JavaScript template and used to generate the live preview.
*
* @since 1.0.0
* @deprecated 1.7.6
* @access public
*/
public function _content_template() {
_deprecated_function( __METHOD__, '1.7.6' );
}
/**
* Register skin controls actions.
*
* Run on init and used to register new skins to be injected to the widget.
* This method is used to register new actions that specify the location of
* the skin in the widget.
*
* Example usage:
* `add_action( 'elementor/element/{widget_id}/{section_id}/before_section_end', [ $this, 'register_controls' ] );`
*
* @since 1.0.0
* @access protected
*/
protected function _register_controls_actions() {}
/**
* Get skin control ID.
*
* Retrieve the skin control ID. Note that skin controls have special prefix
* to distinguish them from regular controls, and from controls in other
* skins.
*
* @since 1.0.0
* @access protected
*
* @param string $control_base_id Control base ID.
*
* @return string Control ID.
*/
protected function get_control_id( $control_base_id ) {
$skin_id = str_replace( '-', '_', $this->get_id() );
return $skin_id . '_' . $control_base_id;
}
/**
* Get skin settings.
*
* Retrieve all the skin settings or, when requested, a specific setting.
*
* @since 1.0.0
* @TODO: rename to get_setting() and create backward compatibility.
*
* @access public
*
* @param string $control_base_id Control base ID.
*
* @return Widget_Base Widget instance.
*/
public function get_instance_value( $control_base_id ) {
$control_id = $this->get_control_id( $control_base_id );
return $this->parent->get_settings( $control_id );
}
/**
* Start skin controls section.
*
* Used to add a new section of controls to the skin.
*
* @since 1.3.0
* @access public
*
* @param string $id Section ID.
* @param array $args Section arguments.
*/
public function start_controls_section( $id, $args ) {
$args['condition']['_skin'] = $this->get_id();
$this->parent->start_controls_section( $this->get_control_id( $id ), $args );
}
/**
* End skin controls section.
*
* Used to close an existing open skin controls section.
*
* @since 1.3.0
* @access public
*/
public function end_controls_section() {
$this->parent->end_controls_section();
}
/**
* Add new skin control.
*
* Register a single control to the allow the user to set/update skin data.
*
* @since 1.0.0
* @access public
*
* @param string $id Control ID.
* @param array $args Control arguments.
*
* @return bool True if skin added, False otherwise.
*/
public function add_control( $id, $args ) {
$args['condition']['_skin'] = $this->get_id();
return $this->parent->add_control( $this->get_control_id( $id ), $args );
}
/**
* Update skin control.
*
* Change the value of an existing skin control.
*
* @since 1.3.0
* @since 1.8.1 New `$options` parameter added.
*
* @access public
*
* @param string $id Control ID.
* @param array $args Control arguments. Only the new fields you want to update.
* @param array $options Optional. Some additional options.
*/
public function update_control( $id, $args, array $options = [] ) {
$args['condition']['_skin'] = $this->get_id();
$this->parent->update_control( $this->get_control_id( $id ), $args, $options );
}
/**
* Remove skin control.
*
* Unregister an existing skin control.
*
* @since 1.3.0
* @access public
*
* @param string $id Control ID.
*/
public function remove_control( $id ) {
$this->parent->remove_control( $this->get_control_id( $id ) );
}
/**
* Add new responsive skin control.
*
* Register a set of controls to allow editing based on user screen size.
*
* @since 1.0.5
* @access public
*
* @param string $id Responsive control ID.
* @param array $args Responsive control arguments.
*/
public function add_responsive_control( $id, $args ) {
$args['condition']['_skin'] = $this->get_id();
$this->parent->add_responsive_control( $this->get_control_id( $id ), $args );
}
/**
* Update responsive skin control.
*
* Change the value of an existing responsive skin control.
*
* @since 1.3.5
* @access public
*
* @param string $id Responsive control ID.
* @param array $args Responsive control arguments.
*/
public function update_responsive_control( $id, $args ) {
$this->parent->update_responsive_control( $this->get_control_id( $id ), $args );
}
/**
* Remove responsive skin control.
*
* Unregister an existing skin responsive control.
*
* @since 1.3.5
* @access public
*
* @param string $id Responsive control ID.
*/
public function remove_responsive_control( $id ) {
$this->parent->remove_responsive_control( $this->get_control_id( $id ) );
}
/**
* Start skin controls tab.
*
* Used to add a new tab inside a group of tabs.
*
* @since 1.5.0
* @access public
*
* @param string $id Control ID.
* @param array $args Control arguments.
*/
public function start_controls_tab( $id, $args ) {
$args['condition']['_skin'] = $this->get_id();
$this->parent->start_controls_tab( $this->get_control_id( $id ), $args );
}
/**
* End skin controls tab.
*
* Used to close an existing open controls tab.
*
* @since 1.5.0
* @access public
*/
public function end_controls_tab() {
$this->parent->end_controls_tab();
}
/**
* Start skin controls tabs.
*
* Used to add a new set of tabs inside a section.
*
* @since 1.5.0
* @access public
*
* @param string $id Control ID.
*/
public function start_controls_tabs( $id ) {
$args['condition']['_skin'] = $this->get_id();
$this->parent->start_controls_tabs( $this->get_control_id( $id ) );
}
/**
* End skin controls tabs.
*
* Used to close an existing open controls tabs.
*
* @since 1.5.0
* @access public
*/
public function end_controls_tabs() {
$this->parent->end_controls_tabs();
}
/**
* Add new group control.
*
* Register a set of related controls grouped together as a single unified
* control.
*
* @since 1.0.0
* @access public
*
* @param string $group_name Group control name.
* @param array $args Group control arguments. Default is an empty array.
*/
final public function add_group_control( $group_name, $args = [] ) {
$args['name'] = $this->get_control_id( $args['name'] );
$args['condition']['_skin'] = $this->get_id();
$this->parent->add_group_control( $group_name, $args );
}
/**
* Set parent widget.
*
* Used to define the parent widget of the skin.
*
* @since 1.0.0
* @access public
*
* @param Widget_Base $parent Parent widget.
*/
public function set_parent( $parent ) {
$this->parent = $parent;
}
}