PK !\O%&*$ *$ settings-url.phpnu W+A 'url',
'title' => __( 'URL modifications', 'polylang' ),
'description' => __( 'Decide how your URLs will look like.', 'polylang' ),
'configure' => true,
) );
$this->links_model = &$polylang->links_model;
$this->page_on_front = &$polylang->static_pages->page_on_front;
}
/**
* Displays the fieldset to choose how the language is set
*
* @since 1.8
*/
protected function force_lang() {?>
%s',
$this->options['force_lang'] ? '' : 'checked="checked"',
esc_html__( 'The language is set from content', 'polylang' )
);
?>
%s',
1 == $this->options['force_lang'] ? 'checked="checked"' : '',
$this->links_model->using_permalinks ? esc_html__( 'The language is set from the directory name in pretty permalinks', 'polylang' ) : esc_html__( 'The language is set from the code in the URL', 'polylang' )
);
?>
' . esc_html( home_url( $this->links_model->using_permalinks ? 'en/my-post/' : '?lang=en&p=1' ) ) . ''; ?>
%s',
$this->links_model->using_permalinks ? '' : 'disabled="disabled"',
2 == $this->options['force_lang'] ? 'checked="checked"' : '',
esc_html__( 'The language is set from the subdomain name in pretty permalinks', 'polylang' )
);
?>
' . esc_html( str_replace( array( '://', 'www.' ), array( '://en.', '' ), home_url( 'my-post/' ) ) ) . ''; ?>
%s',
$this->links_model->using_permalinks ? '' : 'disabled="disabled"',
3 == $this->options['force_lang'] ? 'checked="checked"' : '',
esc_html__( 'The language is set from different domains', 'polylang' )
);
?>
%s',
$this->options['hide_default'] ? 'checked="checked"' : '',
esc_html__( 'Hide URL language information for default language', 'polylang' )
);
?>
%s',
$this->links_model->using_permalinks ? '' : 'disabled="disabled"',
$this->options['rewrite'] ? 'checked="checked"' : '',
esc_html__( 'Remove /language/ in pretty permalinks', 'polylang' )
);
?>
' . esc_html( home_url( 'en/' ) ) . ''; ?>
%s',
$this->links_model->using_permalinks ? '' : 'disabled="disabled"',
$this->options['rewrite'] ? '' : 'checked="checked"',
esc_html__( 'Keep /language/ in pretty permalinks', 'polylang' )
);
?>
' . esc_html( home_url( 'language/en/' ) ) . ''; ?>
%s',
$this->options['redirect_lang'] ? 'checked="checked"' : '',
esc_html__( 'The front page url contains the language code instead of the page name or page id', 'polylang' )
);
?>
model->post->get_language( $this->page_on_front );
$lang = $lang ? $lang : $this->model->get_language( $this->options['default_lang'] );
printf(
/* translators: %s are urls */
esc_html__( 'Example: %s instead of %s', 'polylang' ),
'' . esc_html( $this->links_model->home_url( $lang ) ) . '',
'' . esc_html( _get_page_link( $this->page_on_front ) ) . ''
);
?>
force_lang(); ?>
$this->options['force_lang'] ? '' : 'style="display: none;"'; ?>>
hide_default(); ?>
links_model->using_permalinks ) {
?>
$this->options['force_lang'] ? '' : 'style="display: none;"'; ?>>
rewrite(); ?>
page_on_front ) {
?>
$this->options['force_lang'] ? '' : 'style="display: none;"'; ?>>
redirect_lang(); ?>
$domain ) {
if ( empty( $domain ) ) {
$lang = $this->model->get_language( $key );
add_settings_error( 'general', 'pll_invalid_domain', esc_html( sprintf(
/* translators: %s is a native language name */
__( 'Please enter a valid URL for %s.', 'polylang' ), $lang->name
) ) );
}
else {
$newoptions['domains'][ $key ] = esc_url_raw( trim( $domain ) );
}
}
}
foreach ( array( 'hide_default', 'redirect_lang' ) as $key ) {
$newoptions[ $key ] = isset( $options[ $key ] ) ? 1 : 0;
}
if ( 3 == $options['force_lang'] ) {
if ( ! class_exists( 'PLL_Xdata_Domain', true ) ) {
$newoptions['browser'] = 0;
}
$newoptions['hide_default'] = 0;
}
// Check if domains exist
if ( $newoptions['force_lang'] > 1 ) {
$this->check_domains( $newoptions );
}
return $newoptions; // Take care to return only validated options
}
/**
* Check if subdomains or domains are accessible
*
* @since 1.8
*
* @param array $options new set of options to test
*/
protected function check_domains( $options ) {
$options = array_merge( $this->options, $options );
$model = new PLL_Model( $options );
$links_model = $model->get_links_model();
foreach ( $this->model->get_languages_list() as $lang ) {
$url = add_query_arg( 'deactivate-polylang', 1, $links_model->home_url( $lang ) );
// Don't redefine vip_safe_wp_remote_get() as it has not the same signature as wp_remote_get()
$response = function_exists( 'vip_safe_wp_remote_get' ) ? vip_safe_wp_remote_get( esc_url_raw( $url ) ) : wp_remote_get( esc_url_raw( $url ) );
$response_code = wp_remote_retrieve_response_code( $response );
if ( 200 != $response_code ) {
add_settings_error( 'general', 'pll_invalid_domain', esc_html( sprintf(
/* translators: %s is an url */
__( 'Polylang was unable to access the URL %s. Please check that the URL is valid.', 'polylang' ), $url
) ) );
}
}
}
}
PK !\Cp p settings-module.phpnu W+A options = &$polylang->options;
$this->model = &$polylang->model;
$this->links_model = &$polylang->links_model;
$args = wp_parse_args( $args, array(
'title' => '',
'description' => '',
'active_option' => false,
) );
foreach ( $args as $prop => $value ) {
$this->$prop = $value;
}
// All possible action links, even if not always a link ;-)
$this->action_links = array(
'configure' => sprintf(
'%s ',
esc_attr__( 'Configure this module', 'polylang' ),
'#',
esc_html__( 'Settings', 'polylang' )
),
'deactivate' => sprintf(
'%s ',
esc_attr__( 'Deactivate this module', 'polylang' ),
wp_nonce_url( '?page=mlang&tab=modules&pll_action=deactivate&noheader=true&module=' . $this->module, 'pll_deactivate' ),
esc_html__( 'Deactivate', 'polylang' )
),
'activate' => sprintf(
'%s ',
esc_attr__( 'Activate this module', 'polylang' ),
wp_nonce_url( '?page=mlang&tab=modules&pll_action=activate&noheader=true&module=' . $this->module, 'pll_activate' ),
esc_html__( 'Activate', 'polylang' )
),
'activated' => esc_html__( 'Activated', 'polylang' ),
'deactivated' => esc_html__( 'Deactivated', 'polylang' ),
);
$this->buttons = array(
'cancel' => sprintf( '%s ', esc_html__( 'Cancel' ) ),
'save' => sprintf( '%s ', esc_html__( 'Save Changes' ) ),
);
// Ajax action to save options
add_action( 'wp_ajax_pll_save_options', array( $this, 'save_options' ) );
}
/**
* Tells if the module is active
*
* @since 1.8
*
* @return bool
*/
public function is_active() {
return empty( $this->active_option ) || ! empty( $this->options[ $this->active_option ] );
}
/**
* Activates the module
*
* @since 1.8
*/
public function activate() {
if ( ! empty( $this->active_option ) ) {
$this->options[ $this->active_option ] = true;
update_option( 'polylang', $this->options );
}
}
/**
* Deactivates the module
*
* @since 1.8
*/
public function deactivate() {
if ( ! empty( $this->active_option ) ) {
$this->options[ $this->active_option ] = false;
update_option( 'polylang', $this->options );
}
}
/**
* Protected method to display a configuration form
*
* @since 1.8
*/
protected function form() {
// Child classes can provide a form
}
/**
* Public method returning the form if any
*
* @since 1.8
*
* @return string
*/
public function get_form() {
static $form = false;
// Read the form only once
if ( false === $form ) {
ob_start();
$this->form();
$form = ob_get_clean();
}
return $form;
}
/**
* Allows child classes to validate their options before saving
*
* @since 1.8
*
* @param array $options Raw options
* @return array Options
*/
protected function update( $options ) {
return array(); // It's responsibility of the child class to decide what is saved
}
/**
* Ajax method to save the options
*
* @since 1.8
*/
public function save_options() {
check_ajax_referer( 'pll_options', '_pll_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( -1 );
}
if ( $this->module == $_POST['module'] ) {
// It's up to the child class to decide which options are saved, whether there are errors or not
$post = array_diff_key( $_POST, array_flip( array( 'action', 'module', 'pll_ajax_backend', '_pll_nonce' ) ) );
$options = $this->update( $post );
$this->options = array_merge( $this->options, $options );
update_option( 'polylang', $this->options );
// Refresh language cache in case home urls have been modified
$this->model->clean_languages_cache();
// Refresh rewrite rules in case rewrite, hide_default, post types or taxonomies options have been modified
// Don't use flush_rewrite_rules as we don't have the right links model and permastruct
delete_option( 'rewrite_rules' );
ob_start();
if ( ! get_settings_errors() ) {
// Send update message
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
settings_errors();
$x = new WP_Ajax_Response( array( 'what' => 'success', 'data' => ob_get_clean() ) );
$x->send();
} else {
// Send error messages
settings_errors();
$x = new WP_Ajax_Response( array( 'what' => 'error', 'data' => ob_get_clean() ) );
$x->send();
}
}
}
/**
* Get the row actions
*
* @since 1.8
*
* @return array
*/
protected function get_actions() {
if ( $this->is_active() && $this->get_form() ) {
$actions[] = 'configure';
}
if ( $this->active_option ) {
$actions[] = $this->is_active() ? 'deactivate' : 'activate';
}
if ( empty( $actions ) ) {
$actions[] = $this->is_active() ? 'activated' : 'deactivated';
}
return $actions;
}
/**
* Get the actions links
*
* @since 1.8
*
* @return array
*/
public function get_action_links() {
return array_intersect_key( $this->action_links, array_flip( $this->get_actions() ) );
}
/**
* Default upgrade message ( to Pro version )
*
* @since 1.9
*
* @return string
*/
protected function default_upgrade_message() {
return sprintf(
'%s %s ',
__( 'You need Polylang Pro to enable this feature.', 'polylang' ),
'https://polylang.pro',
__( 'Upgrade now.', 'polylang' )
);
}
/**
* Allows child classes to display an upgrade message
*
* @since 1.9
*
* @return string
*/
public function get_upgrade_message() {
return '';
}
/**
* Get the buttons
*
* @since 1.9
*
* @return array
*/
public function get_buttons() {
return $this->buttons;
}
}
PK !\1- -
languages.phpnu W+A ISO 639-1 language code
* [1] => WordPress locale
* [2] => name
* [3] => text direction
* [4] => flag code
*/
$languages = array(
'af' => array( 'af', 'af', 'Afrikaans', 'ltr', 'za' ),
'ar' => array( 'ar', 'ar', 'العربية', 'rtl', 'arab' ),
'ary' => array( 'ar', 'ary', 'العربية المغربية', 'rtl', 'ma' ),
'as' => array( 'as', 'as', 'অসমীয়া', 'ltr', 'in' ),
'az' => array( 'az', 'az', 'Azərbaycan', 'ltr', 'az' ),
'azb' => array( 'az', 'azb', 'گؤنئی آذربایجان', 'rtl', 'az' ),
'bel' => array( 'be', 'bel', 'Беларуская мова', 'ltr', 'by' ),
'bg_BG' => array( 'bg', 'bg_BG', 'български', 'ltr', 'bg' ),
'bn_BD' => array( 'bn', 'bn_BD', 'বাংলা', 'ltr', 'bd' ),
'bo' => array( 'bo', 'bo', 'བོད་ཡིག', 'ltr', 'tibet' ),
'bs_BA' => array( 'bs', 'bs_BA', 'Bosanski', 'ltr', 'ba' ),
'ca' => array( 'ca', 'ca', 'Català', 'ltr', 'catalonia' ),
'ceb' => array( 'ceb', 'ceb', 'Cebuano', 'ltr', 'ph' ),
'cs_CZ' => array( 'cs', 'cs_CZ', 'Čeština', 'ltr', 'cz' ),
'cy' => array( 'cy', 'cy', 'Cymraeg', 'ltr', 'wales' ),
'da_DK' => array( 'da', 'da_DK', 'Dansk', 'ltr', 'dk' ),
'de_CH' => array( 'de', 'de_CH', 'Deutsch', 'ltr', 'ch' ),
'de_CH_informal' => array( 'de', 'de_CH_informal', 'Deutsch', 'ltr', 'ch' ),
'de_DE' => array( 'de', 'de_DE', 'Deutsch', 'ltr', 'de' ),
'de_DE_formal' => array( 'de', 'de_DE_formal', 'Deutsch', 'ltr', 'de' ),
'dzo' => array( 'dz', 'dzo', 'རྫོང་ཁ', 'ltr', 'bt' ),
'el' => array( 'el', 'el', 'Ελληνικά', 'ltr', 'gr' ),
'en_AU' => array( 'en', 'en_AU', 'English', 'ltr', 'au' ),
'en_CA' => array( 'en', 'en_CA', 'English', 'ltr', 'ca' ),
'en_GB' => array( 'en', 'en_GB', 'English', 'ltr', 'gb' ),
'en_NZ' => array( 'en', 'en_NZ', 'English', 'ltr', 'nz' ),
'en_US' => array( 'en', 'en_US', 'English', 'ltr', 'us' ),
'en_ZA' => array( 'en', 'en_ZA', 'English', 'ltr', 'za' ),
'eo' => array( 'eo', 'eo', 'Esperanto', 'ltr', 'esperanto' ),
'es_AR' => array( 'es', 'es_AR', 'Español', 'ltr', 'ar' ),
'es_CL' => array( 'es', 'es_CL', 'Español', 'ltr', 'cl' ),
'es_CO' => array( 'es', 'es_CO', 'Español', 'ltr', 'co' ),
'es_ES' => array( 'es', 'es_ES', 'Español', 'ltr', 'es' ),
'es_GT' => array( 'es', 'es_GT', 'Español', 'ltr', 'gt' ),
'es_MX' => array( 'es', 'es_MX', 'Español', 'ltr', 'mx' ),
'es_PE' => array( 'es', 'es_PE', 'Español', 'ltr', 'pe' ),
'es_VE' => array( 'es', 'es_VE', 'Español', 'ltr', 've' ),
'et' => array( 'et', 'et', 'Eesti', 'ltr', 'ee' ),
'eu' => array( 'eu', 'eu', 'Euskara', 'ltr', 'basque' ),
'fa_AF' => array( 'fa', 'fa_AF', 'فارسی', 'rtl', 'af' ),
'fa_IR' => array( 'fa', 'fa_IR', 'فارسی', 'rtl', 'ir' ),
'fi' => array( 'fi', 'fi', 'Suomi', 'ltr', 'fi' ),
'fo' => array( 'fo', 'fo', 'Føroyskt', 'ltr', 'fo' ),
'fr_BE' => array( 'fr', 'fr_BE', 'Français', 'ltr', 'be' ),
'fr_CA' => array( 'fr', 'fr_CA', 'Français', 'ltr', 'quebec' ),
'fr_FR' => array( 'fr', 'fr_FR', 'Français', 'ltr', 'fr' ),
'fy' => array( 'fy', 'fy', 'Frysk', 'ltr', 'nl' ),
'gd' => array( 'gd', 'gd', 'Gàidhlig', 'ltr', 'scotland' ),
'gl_ES' => array( 'gl', 'gl_ES', 'Galego', 'ltr', 'galicia' ),
'gu' => array( 'gu', 'gu', 'ગુજરાતી', 'ltr', 'in' ),
'haz' => array( 'haz', 'haz', 'هزاره گی', 'rtl', 'af' ),
'he_IL' => array( 'he', 'he_IL', 'עברית', 'rtl', 'il' ),
'hi_IN' => array( 'hi', 'hi_IN', 'हिन्दी', 'ltr', 'in' ),
'hr' => array( 'hr', 'hr', 'Hrvatski', 'ltr', 'hr' ),
'hu_HU' => array( 'hu', 'hu_HU', 'Magyar', 'ltr', 'hu' ),
'hy' => array( 'hy', 'hy', 'Հայերեն', 'ltr', 'am' ),
'id_ID' => array( 'id', 'id_ID', 'Bahasa Indonesia', 'ltr', 'id' ),
'is_IS' => array( 'is', 'is_IS', 'Íslenska', 'ltr', 'is' ),
'it_IT' => array( 'it', 'it_IT', 'Italiano', 'ltr', 'it' ),
'ja' => array( 'ja', 'ja', '日本語', 'ltr', 'jp' ),
'jv_ID' => array( 'jv', 'jv_ID', 'Basa Jawa', 'ltr', 'id' ),
'ka_GE' => array( 'ka', 'ka_GE', 'ქართული', 'ltr', 'ge' ),
'kab' => array( 'kab', 'kab', 'Taqbaylit', 'ltr', 'dz' ),
'kk' => array( 'kk', 'kk', 'Қазақ тілі', 'ltr', 'kz' ),
'km' => array( 'km', 'km', 'ភាសាខ្មែរ', 'ltr', 'kh' ),
'ko_KR' => array( 'ko', 'ko_KR', '한국어', 'ltr', 'kr' ),
'ckb' => array( 'ku', 'ckb', 'کوردی', 'rtl', 'kurdistan' ),
'lo' => array( 'lo', 'lo', 'ພາສາລາວ', 'ltr', 'la' ),
'lt_LT' => array( 'lt', 'lt_LT', 'Lietuviškai', 'ltr', 'lt' ),
'lv' => array( 'lv', 'lv', 'Latviešu valoda', 'ltr', 'lv' ),
'mk_MK' => array( 'mk', 'mk_MK', 'македонски јазик', 'ltr', 'mk' ),
'ml_IN' => array( 'ml', 'ml_IN', 'മലയാളം', 'ltr', 'in' ),
'mn' => array( 'mn', 'mn', 'Монгол хэл', 'ltr', 'mn' ),
'mr' => array( 'mr', 'mr', 'मराठी', 'ltr', 'in' ),
'ms_MY' => array( 'ms', 'ms_MY', 'Bahasa Melayu', 'ltr', 'my' ),
'my_MM' => array( 'my', 'my_MM', 'ဗမာစာ', 'ltr', 'mm' ),
'nb_NO' => array( 'nb', 'nb_NO', 'Norsk Bokmål', 'ltr', 'no' ),
'ne_NP' => array( 'ne', 'ne_NP', 'नेपाली', 'ltr', 'np' ),
'nl_BE' => array( 'nl', 'nl_BE', 'Nederlands', 'ltr', 'be' ),
'nl_NL' => array( 'nl', 'nl_NL', 'Nederlands', 'ltr', 'nl' ),
'nl_NL_formal' => array( 'nl', 'nl_NL_formal', 'Nederlands', 'ltr', 'nl' ),
'nn_NO' => array( 'nn', 'nn_NO', 'Norsk Nynorsk', 'ltr', 'no' ),
'oci' => array( 'oc', 'oci', 'Occitan', 'ltr', 'occitania' ),
'pa_IN' => array( 'pa', 'pa_IN', 'ਪੰਜਾਬੀ', 'ltr', 'in' ),
'pl_PL' => array( 'pl', 'pl_PL', 'Polski', 'ltr', 'pl' ),
'ps' => array( 'ps', 'ps', 'پښتو', 'rtl', 'af' ),
'pt_BR' => array( 'pt', 'pt_BR', 'Português', 'ltr', 'br' ),
'pt_PT' => array( 'pt', 'pt_PT', 'Português', 'ltr', 'pt' ),
'rhg' => array( 'rhg', 'rhg', 'Ruáinga', 'ltr', 'mm' ),
'ro_RO' => array( 'ro', 'ro_RO', 'Română', 'ltr', 'ro' ),
'ru_RU' => array( 'ru', 'ru_RU', 'Русский', 'ltr', 'ru' ),
'sah' => array( 'sah', 'sah', 'Сахалыы', 'ltr', 'ru' ),
'si_LK' => array( 'si', 'si_LK', 'සිංහල', 'ltr', 'lk' ),
'sk_SK' => array( 'sk', 'sk_SK', 'Slovenčina', 'ltr', 'sk' ),
'sl_SI' => array( 'sl', 'sl_SI', 'Slovenščina', 'ltr', 'si' ),
'so_SO' => array( 'so', 'so_SO', 'Af-Soomaali', 'ltr', 'so' ),
'sq' => array( 'sq', 'sq', 'Shqip', 'ltr', 'al' ),
'sr_RS' => array( 'sr', 'sr_RS', 'Српски језик', 'ltr', 'rs' ),
'su_ID' => array( 'su', 'su_ID', 'Basa Sunda', 'ltr', 'id' ),
'sv_SE' => array( 'sv', 'sv_SE', 'Svenska', 'ltr', 'se' ),
'szl' => array( 'szl', 'szl', 'Ślōnskŏ gŏdka', 'ltr', 'pl' ),
'ta_IN' => array( 'ta', 'ta_IN', 'தமிழ்', 'ltr', 'in' ),
'ta_LK' => array( 'ta', 'ta_LK', 'தமிழ்', 'ltr', 'lk' ),
'tah' => array( 'ty', 'tah', 'Reo Tahiti', 'ltr', 'pf' ),
'te' => array( 'te', 'te', 'తెలుగు', 'ltr', 'in' ),
'th' => array( 'th', 'th', 'ไทย', 'ltr', 'th' ),
'tl' => array( 'tl', 'tl', 'Tagalog', 'ltr', 'ph' ),
'tr_TR' => array( 'tr', 'tr_TR', 'Türkçe', 'ltr', 'tr' ),
'tt_RU' => array( 'tt', 'tt_RU', 'Татар теле', 'ltr', 'ru' ),
'ug_CN' => array( 'ug', 'ug_CN', 'Uyƣurqə', 'ltr', 'cn' ),
'uk' => array( 'uk', 'uk', 'Українська', 'ltr', 'ua' ),
'ur' => array( 'ur', 'ur', 'اردو', 'rtl', 'pk' ),
'uz_UZ' => array( 'uz', 'uz_UZ', 'Oʻzbek', 'ltr', 'uz' ),
'vec' => array( 'vec', 'vec', 'Vèneto', 'ltr', 'veneto' ),
'vi' => array( 'vi', 'vi', 'Tiếng Việt', 'ltr', 'vn' ),
'zh_CN' => array( 'zh', 'zh_CN', '中文 (中国)', 'ltr', 'cn' ),
'zh_HK' => array( 'zh', 'zh_HK', '中文 (香港)', 'ltr', 'hk' ),
'zh_TW' => array( 'zh', 'zh_TW', '中文 (台灣)', 'ltr', 'tw' ),
);
/**
* Filter the list of predefined languages
*
* @since 1.7.10
*
* @param array $languages
*/
$languages = apply_filters( 'pll_predefined_languages', $languages );
PK !\/ table-languages.phpnu W+A 'Languages', // Do not translate ( used for css class )
'ajax' => false,
) );
}
/**
* Generates content for a single row of the table
*
* @since 1.8
*
* @param object $item The current item
*/
public function single_row( $item ) {
/**
* Filter the list of classes assigned a row in the languages list table
*
* @since 1.8
*
* @param array $classes list of class names
* @param object $item the current item
*/
$classes = apply_filters( 'pll_languages_row_classes', array(), $item );
echo '' : ' class="' . esc_attr( implode( ' ', $classes ) ) . '">' );
$this->single_row_columns( $item );
echo ' ';
}
/**
* Displays the item information in a column ( default case )
*
* @since 0.1
*
* @param object $item
* @param string $column_name
* @return string
*/
function column_default( $item, $column_name ) {
switch ( $column_name ) {
case 'locale':
case 'slug':
return esc_html( $item->$column_name );
case 'term_group':
case 'count':
return (int) $item->$column_name;
default:
return $item->$column_name; // flag
}
}
/**
* Displays the item information in the column 'name'
* Displays the edit and delete action links
*
* @since 0.1
*
* @param object $item
* @return string
*/
function column_name( $item ) {
return sprintf(
'%s ',
esc_attr__( 'Edit this language', 'polylang' ),
esc_url( admin_url( 'admin.php?page=mlang&pll_action=edit&lang=' . $item->term_id ) ),
esc_html( $item->name )
);
}
/**
* Displays the item information in the default language
* Displays the 'make default' action link
*
* @since 1.8
*
* @param object $item
* @return string
*/
function column_default_lang( $item ) {
$options = get_option( 'polylang' );
if ( $options['default_lang'] != $item->slug ) {
$s = sprintf('
',
esc_attr__( 'Select as default language', 'polylang' ),
wp_nonce_url( '?page=mlang&pll_action=default-lang&noheader=true&lang=' . $item->term_id, 'default-lang' ),
/* translators: accessibility text, %s is a native language name */
esc_html( sprintf( __( 'Choose %s as default language', 'polylang' ), $item->name ) )
);
/**
* Filter the default language row action in the languages list table
*
* @since 1.8
*
* @param string $s html markup of the action
* @param object $item
*/
$s = apply_filters( 'pll_default_lang_row_action', $s, $item );
} else {
$s = sprintf(
'%1$s ',
/* translators: accessibility text */
esc_html__( 'Default language', 'polylang' )
);
$actions = array();
}
return $s;
}
/**
* Gets the list of columns
*
* @since 0.1
*
* @return array the list of column titles
*/
function get_columns() {
return array(
'name' => esc_html__( 'Full name', 'polylang' ),
'locale' => esc_html__( 'Locale', 'polylang' ),
'slug' => esc_html__( 'Code', 'polylang' ),
'default_lang' => sprintf( '%2$s ', esc_attr__( 'Default language', 'polylang' ), esc_html__( 'Default language', 'polylang' ) ),
'term_group' => esc_html__( 'Order', 'polylang' ),
'flag' => esc_html__( 'Flag', 'polylang' ),
'count' => esc_html__( 'Posts', 'polylang' ),
);
}
/**
* Gets the list of sortable columns
*
* @since 0.1
*
* @return array
*/
function get_sortable_columns() {
return array(
'name' => array( 'name', true ), // sorted by name by default
'locale' => array( 'locale', false ),
'slug' => array( 'slug', false ),
'term_group' => array( 'term_group', false ),
'count' => array( 'count', false ),
);
}
/**
* Gets the name of the default primary column.
*
* @since 2.1
*
* @return string Name of the default primary column, in this case, 'name'.
*/
protected function get_default_primary_column_name() {
return 'name';
}
/**
* Generates and display row actions links for the list table.
*
* @since 1.8
*
* @param object $item The item being acted upon.
* @param string $column_name Current column name.
* @param string $primary Primary column name.
* @return string The row actions output.
*/
protected function handle_row_actions( $item, $column_name, $primary ) {
if ( $primary !== $column_name ) {
return '';
}
$actions = array(
'edit' => sprintf(
'%s ',
esc_attr__( 'Edit this language', 'polylang' ),
esc_url( admin_url( 'admin.php?page=mlang&pll_action=edit&lang=' . $item->term_id ) ),
esc_html__( 'Edit','polylang' )
),
'delete' => sprintf(
'%s ',
esc_attr__( 'Delete this language and all its associated data', 'polylang' ),
wp_nonce_url( '?page=mlang&pll_action=delete&noheader=true&lang=' . $item->term_id, 'delete-lang' ),
esc_js( __( 'You are about to permanently delete this language. Are you sure?', 'polylang' ) ),
esc_html__( 'Delete','polylang' )
),
);
/**
* Filter the list of row actions in the languages list table
*
* @since 1.8
*
* @param array $actions list of html markup actions
* @param object $item
*/
$actions = apply_filters( 'pll_languages_row_actions', $actions, $item );
return $this->row_actions( $actions );
}
/**
* Sort items
*
* @since 0.1
*
* @param object $a The first object to compare
* @param object $b The second object to compare
* @return int -1 or 1 if $a is considered to be respectively less than or greater than $b.
*/
protected function usort_reorder( $a, $b ) {
$orderby = ! empty( $_GET['orderby'] ) ? $_GET['orderby'] : 'name';
// Determine sort order
if ( is_numeric( $a->$orderby ) ) {
$result = $a->$orderby > $b->$orderby ? 1 : -1;
} else {
$result = strcmp( $a->$orderby, $b->$orderby );
}
// Send final sort direction to usort
return ( empty( $_GET['order'] ) || 'asc' == $_GET['order'] ) ? $result : -$result;
}
/**
* Prepares the list of items for displaying
*
* @since 0.1
*
* @param array $data
*/
function prepare_items( $data = array() ) {
$per_page = $this->get_items_per_page( 'pll_lang_per_page' );
$this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() );
usort( $data, array( $this, 'usort_reorder' ) );
$total_items = count( $data );
$this->items = array_slice( $data, ( $this->get_pagenum() - 1 ) * $per_page, $per_page );
$this->set_pagination_args( array(
'total_items' => $total_items,
'per_page' => $per_page,
'total_pages' => ceil( $total_items / $per_page ),
) );
}
}
PK !\Ve view-about.phpnu W+A
',
''
);
if ( ! defined( 'POLYLANG_PRO' ) ) {
echo ' ';
printf(
/* translators: %s are html tags */
esc_html__( 'Support and extra features are available to %sPolylang Pro%s users.' ),
'',
' '
);
}
?>
',
''
);
?>
PK !\{ settings-media.phpnu W+A 'media',
'title' => __( 'Media' ),
'description' => __( 'Activate languages and translations for media', 'polylang' ),
'active_option' => 'media_support',
) );
}
}
PK !\#0 0 view-languages.phpnu W+A
active_tab ) {
case 'lang': // Languages tab
case 'strings': // String translations tab
case 'settings': // Settings tab
include PLL_SETTINGS_INC . '/view-tab-' . $this->active_tab . '.php';
break;
default:
/**
* Fires when loading the active Polylang settings tab
* Allows plugins to add their own tab
*
* @since 1.5.1
*/
do_action( 'pll_settings_active_tab_' . $this->active_tab );
break;
}
?>
PK !\ view-tab-lang.phpnu W+A
PK !\kύ settings-tools.phpnu W+A 'tools',
'title' => __( 'Tools', 'polylang' ),
'description' => __( 'Decide whether to remove all data when deleting Polylang.', 'polylang' ),
) );
}
/**
* displays the settings form
*
* @since 1.8
*/
protected function form() {
printf(
' %s ',
empty( $this->options['uninstall'] ) ? '' : 'checked="checked"',
esc_html__( 'Remove all Polylang data when using the "Delete" link on the plugins screen.', 'polylang' )
);
}
/**
* sanitizes the settings before saving
*
* @since 1.8
*
* @param array $options
*/
protected function update( $options ) {
$newoptions['uninstall'] = isset( $options['uninstall'] ) ? 1 : 0;
return $newoptions; // take care to return only validated options
}
}
PK !\ɫ view-tab-strings.phpnu W+A
PK !\Vo
o
settings-cpt.phpnu W+A 'cpt',
'title' => __( 'Custom post types and Taxonomies', 'polylang' ),
'description' => __( 'Activate the languages and translations management for the custom post types and taxonomies.', 'polylang' ),
) );
// FIXME should be OK when the modules will be loaded from the settings page
$post_types = get_post_types( array( 'public' => true, '_builtin' => false ) );
$post_types = array_diff( $post_types, get_post_types( array( '_pll' => true ) ) );
/** This filter is documented in include/model.php */
$this->post_types = array_unique( apply_filters( 'pll_get_post_types', $post_types, true ) );
$taxonomies = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
$taxonomies = array_diff( $taxonomies, get_taxonomies( array( '_pll' => true ) ) );
/** This filter is documented in include/model.php */
$this->taxonomies = array_unique( apply_filters( 'pll_get_taxonomies', $taxonomies , true ) );
}
/**
* Tells if the module is active
*
* @since 1.8
*
* @return bool
*/
public function is_active() {
return ! empty( $this->post_types ) || ! empty( $this->taxonomies );
}
/**
* Displays the settings form
*
* @since 1.8
*/
protected function form() {
if ( ! empty( $this->post_types ) ) {?>
taxonomies ) ) {
?>
'Strings translations', // Do not translate ( used for css class )
'ajax' => false,
) );
$this->languages = $languages;
$this->strings = PLL_Admin_Strings::get_strings();
$this->groups = array_unique( wp_list_pluck( $this->strings, 'context' ) );
$this->selected_group = empty( $_GET['group'] ) || ! in_array( $_GET['group'], $this->groups ) ? -1 : $_GET['group'];
add_action( 'mlang_action_string-translation', array( $this, 'save_translations' ) );
}
/**
* Displays the item information in a column ( default case )
*
* @since 0.6
*
* @param array $item
* @param string $column_name
* @return string
*/
function column_default( $item, $column_name ) {
return $item[ $column_name ];
}
/**
* Displays the checkbox in first column
*
* @since 1.1
*
* @param array $item
* @return string
*/
function column_cb( $item ) {
return sprintf(
'%2$s ',
esc_attr( $item['row'] ),
/* translators: accessibility text, %s is a string potentially in any language */
sprintf( __( 'Select %s' ), format_to_edit( $item['string'] ) ),
empty( $item['icl'] ) ? 'disabled' : '' // Only strings registered with WPML API can be removed
);
}
/**
* Displays the string to translate
*
* @since 1.0
*
* @param array $item
* @return string
*/
function column_string( $item ) {
return format_to_edit( $item['string'] ); // Don't interpret special chars for the string column
}
/**
* Displays the translations to edit
*
* @since 0.6
*
* @param array $item
* @return string
*/
function column_translations( $item ) {
$languages = array_combine( wp_list_pluck( $this->languages, 'slug' ), wp_list_pluck( $this->languages, 'name' ) );
$out = '';
foreach ( $item['translations'] as $key => $translation ) {
$input_type = $item['multiline'] ?
'' :
' ';
$out .= sprintf( '%3$s ' . $input_type . '
' . "\n",
esc_attr( $key ),
esc_attr( $item['row'] ),
esc_html( $languages[ $key ] ),
format_to_edit( $translation ) ); // Don't interpret special chars
}
return $out;
}
/**
* Gets the list of columns
*
* @since 0.6
*
* @return array the list of column titles
*/
function get_columns() {
return array(
'cb' => ' ', // Checkbox
'string' => esc_html__( 'String', 'polylang' ),
'name' => esc_html__( 'Name', 'polylang' ),
'context' => esc_html__( 'Group', 'polylang' ),
'translations' => esc_html__( 'Translations', 'polylang' ),
);
}
/**
* Gets the list of sortable columns
*
* @since 0.6
*
* @return array
*/
function get_sortable_columns() {
return array(
'string' => array( 'string', false ),
'name' => array( 'name', false ),
'context' => array( 'context', false ),
);
}
/**
* Gets the name of the default primary column.
*
* @since 2.1
*
* @return string Name of the default primary column, in this case, 'string'.
*/
protected function get_default_primary_column_name() {
return 'string';
}
/**
* Sort items
*
* @since 0.6
*
* @param object $a The first object to compare
* @param object $b The second object to compare
* @return int -1 or 1 if $a is considered to be respectively less than or greater than $b.
*/
protected function usort_reorder( $a, $b ) {
$result = strcmp( $a[ $_GET['orderby'] ], $b[ $_GET['orderby'] ] ); // determine sort order
return ( empty( $_GET['order'] ) || 'asc' === $_GET['order'] ) ? $result : -$result; // send final sort direction to usort
}
/**
* Prepares the list of items for displaying
*
* @since 0.6
*/
function prepare_items() {
$data = $this->strings;
// Filter for search string
$s = empty( $_GET['s'] ) ? '' : wp_unslash( $_GET['s'] );
foreach ( $data as $key => $row ) {
if ( ( -1 !== $this->selected_group && $row['context'] !== $this->selected_group ) || ( ! empty( $s ) && stripos( $row['name'], $s ) === false && stripos( $row['string'], $s ) === false ) ) {
unset( $data[ $key ] );
}
}
// Load translations
foreach ( $this->languages as $language ) {
// Filters by language if requested
if ( ( $lg = get_user_meta( get_current_user_id(), 'pll_filter_content', true ) ) && $language->slug !== $lg ) {
continue;
}
$mo = new PLL_MO();
$mo->import_from_db( $language );
foreach ( $data as $key => $row ) {
$data[ $key ]['translations'][ $language->slug ] = $mo->translate( $row['string'] );
$data[ $key ]['row'] = $key; // Store the row number for convenience
}
}
$per_page = $this->get_items_per_page( 'pll_strings_per_page' );
$this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns() );
if ( ! empty( $_GET['orderby'] ) ) { // No sort by default
usort( $data, array( $this, 'usort_reorder' ) );
}
$total_items = count( $data );
$this->items = array_slice( $data, ( $this->get_pagenum() - 1 ) * $per_page, $per_page );
$this->set_pagination_args( array(
'total_items' => $total_items,
'per_page' => $per_page,
'total_pages' => ceil( $total_items / $per_page ),
) );
}
/**
* Get the list of possible bulk actions
*
* @since 1.1
*
* @return array
*/
function get_bulk_actions() {
return array( 'delete' => __( 'Delete','polylang' ) );
}
/**
* Get the current action selected from the bulk actions dropdown.
* overrides parent function to avoid submit button to trigger bulk actions
*
* @since 1.8
*
* @return string|false The action name or False if no action was selected
*/
public function current_action() {
return empty( $_POST['submit'] ) ? parent::current_action() : false;
}
/**
* Displays the dropdown list to filter strings per group
*
* @since 1.1
*
* @param string $which only 'top' is supported
*/
function extra_tablenav( $which ) {
if ( 'top' !== $which ) {
return;
}
echo '';
printf(
'%s ',
/* translators: accessibility text */
esc_html__( 'Filter by group', 'polylang' )
);
echo '' . "\n";
printf(
'%s ' . "\n",
-1 === $this->group_selected ? ' selected="selected"' : '',
esc_html__( 'View all groups', 'polylang' )
);
foreach ( $this->groups as $group ) {
printf(
'%s ' . "\n",
esc_attr( urlencode( $group ) ),
$this->selected_group === $group ? ' selected="selected"' : '',
esc_html( $group )
);
}
echo ' ' . "\n";
submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
echo '
';
}
/**
* Saves the strings translations in DB
* Optionaly clean the DB
*
* @since 1.9
*/
public function save_translations() {
check_admin_referer( 'string-translation', '_wpnonce_string-translation' );
if ( ! empty( $_POST['submit'] ) ) {
foreach ( $this->languages as $language ) {
if ( empty( $_POST['translation'][ $language->slug ] ) ) { // In case the language filter is active ( thanks to John P. Bloch )
continue;
}
$mo = new PLL_MO();
$mo->import_from_db( $language );
foreach ( $_POST['translation'][ $language->slug ] as $key => $translation ) {
/**
* Filter the string translation before it is saved in DB
* Allows to sanitize strings registered with pll_register_string
*
* @since 1.6
*
* @param string $translation the string translation
* @param string $name the name as defined in pll_register_string
* @param string $context the context as defined in pll_register_string
*/
$translation = apply_filters( 'pll_sanitize_string_translation', $translation, $this->strings[ $key ]['name'], $this->strings[ $key ]['context'] );
$mo->add_entry( $mo->make_entry( $this->strings[ $key ]['string'], $translation ) );
}
// Clean database ( removes all strings which were registered some day but are no more )
if ( ! empty( $_POST['clean'] ) ) {
$new_mo = new PLL_MO();
foreach ( $this->strings as $string ) {
$new_mo->add_entry( $mo->make_entry( $string['string'], $mo->translate( $string['string'] ) ) );
}
}
isset( $new_mo ) ? $new_mo->export_to_db( $language ) : $mo->export_to_db( $language );
}
add_settings_error( 'general', 'pll_strings_translations_updated', __( 'Translations updated.', 'polylang' ), 'updated' );
/**
* Fires after the strings translations are saved in DB
*
* @since 1.2
*/
do_action( 'pll_save_strings_translations' );
}
// Unregisters strings registered through WPML API
if ( $this->current_action() === 'delete' && ! empty( $_POST['strings'] ) && function_exists( 'icl_unregister_string' ) ) {
foreach ( $_POST['strings'] as $key ) {
icl_unregister_string( $this->strings[ $key ]['context'], $this->strings[ $key ]['name'] );
}
}
// To refresh the page ( possible thanks to the $_GET['noheader']=true )
$args = array_intersect_key( $_REQUEST, array_flip( array( 's', 'paged', 'group' ) ) );
if ( ! empty( $_GET['paged'] ) && ! empty( $_POST['submit'] ) ) {
$args['paged'] = (int) $_GET['paged']; // Don't rely on $_REQUEST['paged'] or $_POST['paged']. See #14
}
if ( ! empty( $args['s'] ) ) {
$args['s'] = urlencode( $args['s'] ); // Searched string needs to be encoded as it comes from $_POST
}
PLL_Settings::redirect( $args );
}
}
PK !\fx` ` settings.phpnu W+A $item ) {
if ( 'elementor' === $item ) {
$elementor_menu_order[] = 'separator-elementor';
$elementor_menu_order[] = $item;
$elementor_menu_order[] = Source_Local::ADMIN_MENU_SLUG;
unset( $menu_order[ $elementor_separator ] );
unset( $menu_order[ $elementor_library ] );
} elseif ( ! in_array( $item, [ 'separator-elementor' ], true ) ) {
$elementor_menu_order[] = $item;
}
}
// Return order.
return $elementor_menu_order;
}
/**
* Register Elementor Pro sub-menu.
*
* Add new Elementor Pro sub-menu under the main Elementor menu.
*
* Fired by `admin_menu` action.
*
* @since 1.0.0
* @access public
*/
public function register_pro_menu() {
add_submenu_page(
self::PAGE_ID,
__( 'Custom Fonts', 'elementor' ),
__( 'Custom Fonts', 'elementor' ),
'manage_options',
'elementor_custom_fonts',
[ $this, 'elementor_custom_fonts' ]
);
add_submenu_page(
self::PAGE_ID,
__( 'Custom Icons', 'elementor' ),
__( 'Custom Icons', 'elementor' ),
'manage_options',
'elementor_custom_icons',
[ $this, 'elementor_custom_icons' ]
);
add_submenu_page(
self::PAGE_ID,
'',
' ' . __( 'Go Pro', 'elementor' ),
'manage_options',
'go_elementor_pro',
[ $this, 'handle_external_redirects' ]
);
add_submenu_page( Source_Local::ADMIN_MENU_SLUG, __( 'Theme Templates', 'elementor' ), __( 'Theme Builder', 'elementor' ), 'manage_options', 'theme_templates', [ $this, 'elementor_theme_templates' ] );
add_submenu_page( Source_Local::ADMIN_MENU_SLUG, __( 'Popups', 'elementor' ), __( 'Popups', 'elementor' ), 'manage_options', 'popup_templates', [ $this, 'elementor_popups' ] );
}
/**
* Register Elementor knowledge base sub-menu.
*
* Add new Elementor knowledge base sub-menu under the main Elementor menu.
*
* Fired by `admin_menu` action.
*
* @since 2.0.3
* @access public
*/
public function register_knowledge_base_menu() {
add_submenu_page(
self::PAGE_ID,
'',
__( 'Getting Started', 'elementor' ),
'manage_options',
'elementor-getting-started',
[ $this, 'elementor_getting_started' ]
);
add_submenu_page(
self::PAGE_ID,
'',
__( 'Get Help', 'elementor' ),
'manage_options',
'go_knowledge_base_site',
[ $this, 'handle_external_redirects' ]
);
}
/**
* Go Elementor Pro.
*
* Redirect the Elementor Pro page the clicking the Elementor Pro menu link.
*
* Fired by `admin_init` action.
*
* @since 2.0.3
* @access public
*/
public function handle_external_redirects() {
if ( empty( $_GET['page'] ) ) {
return;
}
if ( 'go_elementor_pro' === $_GET['page'] ) {
wp_redirect( Utils::get_pro_link( 'https://elementor.com/pro/?utm_source=wp-menu&utm_campaign=gopro&utm_medium=wp-dash' ) );
die;
}
if ( 'go_knowledge_base_site' === $_GET['page'] ) {
wp_redirect( 'https://go.elementor.com/docs-admin-menu/' );
die;
}
}
/**
* Display settings page.
*
* Output the content for the getting started page.
*
* @since 2.2.0
* @access public
*/
public function elementor_getting_started() {
if ( User::is_current_user_can_edit_post_type( 'page' ) ) {
$create_new_label = __( 'Create Your First Page', 'elementor' );
$create_new_cpt = 'page';
} elseif ( User::is_current_user_can_edit_post_type( 'post' ) ) {
$create_new_label = __( 'Create Your First Post', 'elementor' );
$create_new_cpt = 'post';
}
?>
handle_external_redirects();
// Save general settings in one list for a future usage
$this->handle_general_settings_update();
$this->maybe_remove_all_admin_notices();
}
/**
* Change "Settings" menu name.
*
* Update the name of the Settings admin menu from "Elementor" to "Settings".
*
* Fired by `admin_menu` action.
*
* @since 1.0.0
* @access public
*/
public function admin_menu_change_name() {
global $submenu;
if ( isset( $submenu['elementor'] ) ) {
// @codingStandardsIgnoreStart
$submenu['elementor'][0][0] = __( 'Settings', 'elementor' );
// @codingStandardsIgnoreEnd
}
}
/**
* Update CSS print method.
*
* Clear post CSS cache.
*
* Fired by `add_option_elementor_css_print_method` and
* `update_option_elementor_css_print_method` actions.
*
* @since 1.7.5
* @access public
*/
public function update_css_print_method() {
Plugin::$instance->files_manager->clear_cache();
}
/**
* Create tabs.
*
* Return the settings page tabs, sections and fields.
*
* @since 1.5.0
* @access protected
*
* @return array An array with the settings page tabs, sections and fields.
*/
protected function create_tabs() {
$validations_class_name = __NAMESPACE__ . '\Settings_Validations';
$default_breakpoints = Responsive::get_default_breakpoints();
return [
self::TAB_GENERAL => [
'label' => __( 'General', 'elementor' ),
'sections' => [
'general' => [
'fields' => [
self::UPDATE_TIME_FIELD => [
'full_field_id' => self::UPDATE_TIME_FIELD,
'field_args' => [
'type' => 'hidden',
],
'setting_args' => [ $validations_class_name, 'current_time' ],
],
'cpt_support' => [
'label' => __( 'Post Types', 'elementor' ),
'field_args' => [
'type' => 'checkbox_list_cpt',
'std' => [ 'page', 'post' ],
'exclude' => [ 'attachment', 'elementor_library' ],
],
'setting_args' => [ $validations_class_name, 'checkbox_list' ],
],
'disable_color_schemes' => [
'label' => __( 'Disable Default Colors', 'elementor' ),
'field_args' => [
'type' => 'checkbox',
'value' => 'yes',
'sub_desc' => __( 'Checking this box will disable Elementor\'s Default Colors, and make Elementor inherit the colors from your theme.', 'elementor' ),
],
],
'disable_typography_schemes' => [
'label' => __( 'Disable Default Fonts', 'elementor' ),
'field_args' => [
'type' => 'checkbox',
'value' => 'yes',
'sub_desc' => __( 'Checking this box will disable Elementor\'s Default Fonts, and make Elementor inherit the fonts from your theme.', 'elementor' ),
],
],
],
],
'usage' => [
'label' => __( 'Improve Elementor', 'elementor' ),
'fields' => [
'allow_tracking' => [
'label' => __( 'Usage Data Sharing', 'elementor' ),
'field_args' => [
'type' => 'checkbox',
'value' => 'yes',
'default' => '',
'sub_desc' => __( 'Become a super contributor by opting in to share non-sensitive plugin data and to get our updates.', 'elementor' ) . sprintf( ' %2$s ', 'https://go.elementor.com/usage-data-tracking/', __( 'Learn more.', 'elementor' ) ),
],
'setting_args' => [ __NAMESPACE__ . '\Tracker', 'check_for_settings_optin' ],
],
],
],
],
],
self::TAB_STYLE => [
'label' => __( 'Style', 'elementor' ),
'sections' => [
'style' => [
'fields' => [
'default_generic_fonts' => [
'label' => __( 'Default Generic Fonts', 'elementor' ),
'field_args' => [
'type' => 'text',
'std' => 'Sans-serif',
'class' => 'medium-text',
'desc' => __( 'The list of fonts used if the chosen font is not available.', 'elementor' ),
],
],
'container_width' => [
'label' => __( 'Content Width', 'elementor' ),
'field_args' => [
'type' => 'number',
'attributes' => [
'min' => 300,
'placeholder' => '1140',
'class' => 'medium-text',
],
'sub_desc' => 'px',
'desc' => __( 'Sets the default width of the content area (Default: 1140)', 'elementor' ),
],
],
'space_between_widgets' => [
'label' => __( 'Space Between Widgets', 'elementor' ),
'field_args' => [
'type' => 'number',
'attributes' => [
'placeholder' => '20',
'class' => 'medium-text',
],
'sub_desc' => 'px',
'desc' => __( 'Sets the default space between widgets (Default: 20)', 'elementor' ),
],
],
'stretched_section_container' => [
'label' => __( 'Stretched Section Fit To', 'elementor' ),
'field_args' => [
'type' => 'text',
'attributes' => [
'placeholder' => 'body',
'class' => 'medium-text',
],
'desc' => __( 'Enter parent element selector to which stretched sections will fit to (e.g. #primary / .wrapper / main etc). Leave blank to fit to page width.', 'elementor' ),
],
],
'page_title_selector' => [
'label' => __( 'Page Title Selector', 'elementor' ),
'field_args' => [
'type' => 'text',
'attributes' => [
'placeholder' => 'h1.entry-title',
'class' => 'medium-text',
],
'desc' => __( 'Elementor lets you hide the page title. This works for themes that have "h1.entry-title" selector. If your theme\'s selector is different, please enter it above.', 'elementor' ),
],
],
'viewport_lg' => [
'label' => __( 'Tablet Breakpoint', 'elementor' ),
'field_args' => [
'type' => 'number',
'attributes' => [
'placeholder' => $default_breakpoints['lg'],
'min' => $default_breakpoints['md'] + 1,
'max' => $default_breakpoints['xl'] - 1,
'class' => 'medium-text',
],
'sub_desc' => 'px',
/* translators: %d: Breakpoint value */
'desc' => sprintf( __( 'Sets the breakpoint between desktop and tablet devices. Below this breakpoint tablet layout will appear (Default: %dpx).', 'elementor' ), $default_breakpoints['lg'] ),
],
],
'viewport_md' => [
'label' => __( 'Mobile Breakpoint', 'elementor' ),
'field_args' => [
'type' => 'number',
'attributes' => [
'placeholder' => $default_breakpoints['md'],
'min' => $default_breakpoints['sm'] + 1,
'max' => $default_breakpoints['lg'] - 1,
'class' => 'medium-text',
],
'sub_desc' => 'px',
/* translators: %d: Breakpoint value */
'desc' => sprintf( __( 'Sets the breakpoint between tablet and mobile devices. Below this breakpoint mobile layout will appear (Default: %dpx).', 'elementor' ), $default_breakpoints['md'] ),
],
],
'global_image_lightbox' => [
'label' => __( 'Image Lightbox', 'elementor' ),
'field_args' => [
'type' => 'checkbox',
'value' => 'yes',
'std' => 'yes',
'sub_desc' => __( 'Open all image links in a lightbox popup window. The lightbox will automatically work on any link that leads to an image file.', 'elementor' ),
'desc' => __( 'You can customize the lightbox design by going to: Top-left hamburger icon > Global Settings > Lightbox.', 'elementor' ),
],
],
],
],
],
],
self::TAB_INTEGRATIONS => [
'label' => __( 'Integrations', 'elementor' ),
'sections' => [],
],
self::TAB_ADVANCED => [
'label' => __( 'Advanced', 'elementor' ),
'sections' => [
'advanced' => [
'fields' => [
'css_print_method' => [
'label' => __( 'CSS Print Method', 'elementor' ),
'field_args' => [
'class' => 'elementor_css_print_method',
'type' => 'select',
'options' => [
'external' => __( 'External File', 'elementor' ),
'internal' => __( 'Internal Embedding', 'elementor' ),
],
'desc' => '' . __( 'Use external CSS files for all generated stylesheets. Choose this setting for better performance (recommended).', 'elementor' ) . '
' . __( 'Use internal CSS that is embedded in the head of the page. For troubleshooting server configuration conflicts and managing development environments.', 'elementor' ) . '
',
],
],
'editor_break_lines' => [
'label' => __( 'Switch Editor Loader Method', 'elementor' ),
'field_args' => [
'type' => 'select',
'options' => [
'' => __( 'Disable', 'elementor' ),
1 => __( 'Enable', 'elementor' ),
],
'desc' => __( 'For troubleshooting server configuration conflicts.', 'elementor' ),
],
],
'allow_svg' => [
'label' => __( 'Enable SVG Uploads', 'elementor' ),
'field_args' => [
'type' => 'select',
'std' => '',
'options' => [
'' => __( 'Disable', 'elementor' ),
1 => __( 'Enable', 'elementor' ),
],
'desc' => __( 'Please note! Allowing uploads of any files (SVG included) is a potential security risk.', 'elementor' ) . ' ' . __( 'Elementor will try to sanitize the SVG files, removing potential malicious code and scripts.', 'elementor' ) . ' ' . __( 'We recommend you only enable this feature if you understand the security risks involved.', 'elementor' ),
],
],
],
],
],
],
];
}
/**
* Get settings page title.
*
* Retrieve the title for the settings page.
*
* @since 1.5.0
* @access protected
*
* @return string Settings page title.
*/
protected function get_page_title() {
return __( 'Elementor', 'elementor' );
}
/**
* Handle general settings update.
*
* Save general settings in one list for a future usage.
*
* @since 2.0.0
* @access private
*/
private function handle_general_settings_update() {
if ( ! empty( $_POST['option_page'] ) && self::PAGE_ID === $_POST['option_page'] && ! empty( $_POST['action'] ) && 'update' === $_POST['action'] ) {
check_admin_referer( 'elementor-options' );
$saved_general_settings = get_option( General_Settings_Manager::META_KEY );
if ( ! $saved_general_settings ) {
$saved_general_settings = [];
}
$general_settings = Manager::get_settings_managers( 'general' )->get_model()->get_settings();
foreach ( $general_settings as $setting_key => $setting ) {
if ( ! empty( $_POST[ $setting_key ] ) ) {
$pure_setting_key = str_replace( 'elementor_', '', $setting_key );
$saved_general_settings[ $pure_setting_key ] = $_POST[ $setting_key ];
}
}
update_option( General_Settings_Manager::META_KEY, $saved_general_settings );
}
}
/**
* @since 2.2.0
* @access private
*/
private function maybe_remove_all_admin_notices() {
$elementor_pages = [
'elementor-getting-started',
'elementor_custom_fonts',
'elementor_custom_icons',
'elementor-license',
'popup_templates',
'theme_templates',
];
if ( empty( $_GET['page'] ) || ! in_array( $_GET['page'], $elementor_pages, true ) ) {
return;
}
remove_all_actions( 'admin_notices' );
}
/**
* Settings page constructor.
*
* Initializing Elementor "Settings" page.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
parent::__construct();
add_action( 'admin_init', [ $this, 'on_admin_init' ] );
add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 20 );
add_action( 'admin_menu', [ $this, 'admin_menu_change_name' ], 200 );
add_action( 'admin_menu', [ $this, 'register_pro_menu' ], self::MENU_PRIORITY_GO_PRO );
add_action( 'admin_menu', [ $this, 'register_knowledge_base_menu' ], 501 );
// Clear CSS Meta after change print method.
add_action( 'add_option_elementor_css_print_method', [ $this, 'update_css_print_method' ] );
add_action( 'update_option_elementor_css_print_method', [ $this, 'update_css_print_method' ] );
add_filter( 'custom_menu_order', '__return_true' );
add_filter( 'menu_order', [ $this, 'menu_order' ] );
foreach ( Responsive::get_editable_breakpoints() as $breakpoint_key => $breakpoint ) {
foreach ( [ 'add', 'update' ] as $action ) {
add_action( "{$action}_option_elementor_viewport_{$breakpoint_key}", [ 'Elementor\Core\Responsive\Responsive', 'compile_stylesheet_templates' ] );
}
}
}
}
PK !\Ҝ: : table-settings.phpnu W+A 'Settings', // Do not translate ( used for css class )
'ajax' => false,
) );
}
/**
* Get the table classes for styling
*
* @since 1.8
*/
protected function get_table_classes() {
return array( 'wp-list-table', 'widefat', 'plugins', 'pll-settings' ); // get the style of the plugins list table + one specific class
}
/**
* Displays a single row
*
* @since 1.8
*
* @param object $item PLL_Settings_Module object
*/
public function single_row( $item ) {
// Classes to reuse css from the plugins list table
$classes = $item->is_active() ? 'active' : 'inactive';
if ( $message = $item->get_upgrade_message() ) {
$classes .= ' update';
}
// Display the columns
printf( '', esc_attr( $item->module ), esc_attr( $classes ) );
$this->single_row_columns( $item );
echo ' ';
// Display an upgrade message if there is any, reusing css from the plugins updates
if ( $message = $item->get_upgrade_message() ) {
printf( '
%s
',
sprintf(
version_compare( $GLOBALS['wp_version'], '4.6', '<' ) ?
'%s
' : // backward compatibility with WP < 4.6
'',
$message
)
);
}
// The settings if there are
// "inactive" class to reuse css from the plugins list table
if ( $form = $item->get_form() ) {
printf( '
%s
%s
%s
',
esc_attr( $item->module ), esc_html( $item->title ), $form, implode( $item->get_buttons() )
);
}
}
/**
* Generates the columns for a single row of the table
*
* @since 1.8
*
* @param object $item The current item
*/
protected function single_row_columns( $item ) {
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
foreach ( $columns as $column_name => $column_display_name ) {
$classes = "$column_name column-$column_name";
if ( $primary === $column_name ) {
$classes .= ' column-primary';
}
if ( in_array( $column_name, $hidden ) ) {
$classes .= ' hidden';
}
if ( 'cb' == $column_name ) {
echo '';
echo $this->column_cb( $item );
echo ' ';
}
else {
printf( '', esc_attr( $classes ) );
echo $this->column_default( $item, $column_name );
echo ' ';
}
}
}
/**
* Displays the item information in a column ( default case )
*
* @since 1.8
*
* @param object $item
* @param string $column_name
* @return string
*/
protected function column_default( $item, $column_name ) {
if ( 'plugin-title' == $column_name ) {
return sprintf( '%s ', esc_html( $item->title ) ) . $this->row_actions( $item->get_action_links(), true /*always visible*/ );
}
return $item->$column_name;
}
/**
* Gets the list of columns
*
* @since 1.8
*
* @return array the list of column titles
*/
public function get_columns() {
return array(
'cb' => '', // For the 4px border inherited from plugins when the module is activated
'plugin-title' => esc_html__( 'Module', 'polylang' ), // plugin-title for styling
'description' => esc_html__( 'Description', 'polylang' ),
);
}
/**
* Gets the name of the primary column.
*
* @since 1.8
*
* @return string The name of the primary column.
*/
protected function get_primary_column_name() {
return 'plugin-title';
}
/**
* Prepares the list of items for displaying
*
* @since 1.8
*
* @param array $items
*/
public function prepare_items( $items = array() ) {
$this->_column_headers = array( $this->get_columns(), array(), $this->get_sortable_columns(), $this->get_primary_column_name() );
$this->items = $items;
}
/**
* Avoids displaying an empty tablenav
*
* @since 2.1
*
* @param string $which 'top' or 'bottom'
*/
protected function display_tablenav( $which ) {}
}
PK !\ settings-browser.phpnu W+A 'browser',
'title' => __( 'Detect browser language', 'polylang' ),
'description' => __( 'When the front page is visited, set the language according to the browser preference', 'polylang' ),
'active_option' => $this->is_available() ? 'browser' : false,
) );
if ( ! class_exists( 'PLL_Xdata_Domain', true ) ) {
add_action( 'admin_print_footer_scripts', array( $this, 'print_js' ) );
}
}
/**
* Tells if the option is available
*
* @since 2.0
*
* @return bool
*/
protected function is_available() {
return ( 3 > $this->options['force_lang'] ) || class_exists( 'PLL_Xdata_Domain', true );
}
/**
* Tells if the module is active
*
* @since 1.8
*
* @return bool
*/
public function is_active() {
return $this->is_available() ? parent::is_active() : false;
}
/**
* Displays the javascript to handle dynamically the change in url modifications
* as the preferred browser language is not used when the language is set from different domains
*
* @since 1.8
*/
public function print_js() {
wp_enqueue_script( 'jquery' );
if ( parent::is_active() && 3 > $this->options['force_lang'] ) {
$func = 'removeClass( "inactive" ).addClass( "active" )';
$link = sprintf( '%s ', $this->action_links['deactivate'] );
}
else {
$func = 'removeClass( "active" ).addClass( "inactive" )';
$link = sprintf( '%s ', $this->action_links['activate'] );
}
$deactivated = sprintf( '%s ', $this->action_links['deactivated'] );
?>
__( 'Andorra', 'polylang' ),
'ae' => __( 'United Arab Emirates', 'polylang' ),
'af' => __( 'Afghanistan', 'polylang' ),
'ag' => __( 'Antigua and Barbuda', 'polylang' ),
'ai' => __( 'Anguilla', 'polylang' ),
'al' => __( 'Albania', 'polylang' ),
'am' => __( 'Armenia', 'polylang' ),
'an' => __( 'Netherlands Antilles', 'polylang' ),
'ao' => __( 'Angola', 'polylang' ),
'ar' => __( 'Argentina', 'polylang' ),
'arab' => __( 'Arab league', 'polylang' ),
'as' => __( 'American Samoa', 'polylang' ),
'at' => __( 'Austria', 'polylang' ),
'au' => __( 'Australia', 'polylang' ),
'aw' => __( 'Aruba', 'polylang' ),
'ax' => __( 'Åland Islands', 'polylang' ),
'az' => __( 'Azerbaijan', 'polylang' ),
'ba' => __( 'Bosnia and Herzegovina', 'polylang' ),
'basque' => __( 'Basque Country', 'polylang' ),
'bb' => __( 'Barbados', 'polylang' ),
'bd' => __( 'Bangladesh', 'polylang' ),
'be' => __( 'Belgium', 'polylang' ),
'bf' => __( 'Burkina Faso', 'polylang' ),
'bg' => __( 'Bulgaria', 'polylang' ),
'bh' => __( 'Bahrain', 'polylang' ),
'bi' => __( 'Burundi', 'polylang' ),
'bj' => __( 'Benin', 'polylang' ),
'bm' => __( 'Bermuda', 'polylang' ),
'bn' => __( 'Brunei', 'polylang' ),
'bo' => __( 'Bolivia', 'polylang' ),
'br' => __( 'Brazil', 'polylang' ),
'bs' => __( 'Bahamas', 'polylang' ),
'bt' => __( 'Bhutan', 'polylang' ),
'bw' => __( 'Botswana', 'polylang' ),
'by' => __( 'Belarus', 'polylang' ),
'bz' => __( 'Belize', 'polylang' ),
'ca' => __( 'Canada', 'polylang' ),
'catalonia' => __( 'Catalonia', 'polylang' ),
'cc' => __( 'Cocos', 'polylang' ),
'cd' => __( 'Democratic Republic of the Congo', 'polylang' ),
'cf' => __( 'Central African Republic', 'polylang' ),
'cg' => __( 'Congo', 'polylang' ),
'ch' => __( 'Switzerland', 'polylang' ),
'ci' => __( 'Ivory Coast', 'polylang' ),
'ck' => __( 'Cook Islands', 'polylang' ),
'cl' => __( 'Chile', 'polylang' ),
'cm' => __( 'Cameroon', 'polylang' ),
'cn' => __( 'China', 'polylang' ),
'co' => __( 'Colombia', 'polylang' ),
'cr' => __( 'Costa Rica', 'polylang' ),
'cu' => __( 'Cuba', 'polylang' ),
'cv' => __( 'Cape Verde', 'polylang' ),
'cx' => __( 'Christmas Island', 'polylang' ),
'cy' => __( 'Cyprus', 'polylang' ),
'cz' => __( 'Czech Republic', 'polylang' ),
'de' => __( 'Germany', 'polylang' ),
'dj' => __( 'Djibouti', 'polylang' ),
'dk' => __( 'Denmark', 'polylang' ),
'dm' => __( 'Dominica', 'polylang' ),
'do' => __( 'Dominican Republic', 'polylang' ),
'dz' => __( 'Algeria', 'polylang' ),
'ec' => __( 'Ecuador', 'polylang' ),
'ee' => __( 'Estonia', 'polylang' ),
'eg' => __( 'Egypt', 'polylang' ),
'eh' => __( 'Western Sahara', 'polylang' ),
'england' => __( 'England', 'polylang' ),
'er' => __( 'Eritrea', 'polylang' ),
'es' => __( 'Spain', 'polylang' ),
'esperanto' => __( 'Esperanto', 'polylang' ),
'et' => __( 'Ethiopia', 'polylang' ),
'fi' => __( 'Finland', 'polylang' ),
'fj' => __( 'Fiji', 'polylang' ),
'fk' => __( 'Falkland Islands', 'polylang' ),
'fm' => __( 'Micronesia', 'polylang' ),
'fo' => __( 'Faroe Islands', 'polylang' ),
'fr' => __( 'France', 'polylang' ),
'ga' => __( 'Gabon', 'polylang' ),
'galicia' => __( 'Galicia', 'polylang' ),
'gb' => __( 'United Kingdom', 'polylang' ),
'gd' => __( 'Grenada', 'polylang' ),
'ge' => __( 'Georgia', 'polylang' ),
'gh' => __( 'Ghana', 'polylang' ),
'gi' => __( 'Gibraltar', 'polylang' ),
'gl' => __( 'Greenland', 'polylang' ),
'gm' => __( 'Gambia', 'polylang' ),
'gn' => __( 'Guinea', 'polylang' ),
'gp' => __( 'Guadeloupe', 'polylang' ),
'gq' => __( 'Equatorial Guinea', 'polylang' ),
'gr' => __( 'Greece', 'polylang' ),
'gs' => __( 'South Georgia and the South Sandwich Islands', 'polylang' ),
'gt' => __( 'Guatemala', 'polylang' ),
'gu' => __( 'Guam', 'polylang' ),
'gw' => __( 'Guinea-Bissau', 'polylang' ),
'gy' => __( 'Guyana', 'polylang' ),
'hk' => __( 'Hong Kong', 'polylang' ),
'hm' => __( 'Heard Island and McDonald Islands', 'polylang' ),
'hn' => __( 'Honduras', 'polylang' ),
'hr' => __( 'Croatia', 'polylang' ),
'ht' => __( 'Haiti', 'polylang' ),
'hu' => __( 'Hungary', 'polylang' ),
'id' => __( 'Indonesia', 'polylang' ),
'ie' => __( 'Republic of Ireland', 'polylang' ),
'il' => __( 'Israel', 'polylang' ),
'in' => __( 'India', 'polylang' ),
'io' => __( 'British Indian Ocean Territory', 'polylang' ),
'iq' => __( 'Iraq', 'polylang' ),
'ir' => __( 'Iran', 'polylang' ),
'is' => __( 'Iceland', 'polylang' ),
'it' => __( 'Italy', 'polylang' ),
'jm' => __( 'Jamaica', 'polylang' ),
'jo' => __( 'Jordan', 'polylang' ),
'jp' => __( 'Japan', 'polylang' ),
'ke' => __( 'Kenya', 'polylang' ),
'kg' => __( 'Kyrgyzstan', 'polylang' ),
'kh' => __( 'Cambodia', 'polylang' ),
'ki' => __( 'Kiribati', 'polylang' ),
'km' => __( 'Comoros', 'polylang' ),
'kn' => __( 'Saint Kitts and Nevis', 'polylang' ),
'kp' => __( 'North Korea', 'polylang' ),
'kr' => __( 'South Korea', 'polylang' ),
'kurdistan' => __( 'Kurdistan', 'polylang' ),
'kw' => __( 'Kuwait', 'polylang' ),
'ky' => __( 'Cayman Islands', 'polylang' ),
'kz' => __( 'Kazakhstan', 'polylang' ),
'la' => __( 'Laos', 'polylang' ),
'lb' => __( 'Lebanon', 'polylang' ),
'lc' => __( 'Saint Lucia', 'polylang' ),
'li' => __( 'Liechtenstein', 'polylang' ),
'lk' => __( 'Sri Lanka', 'polylang' ),
'lr' => __( 'Liberia', 'polylang' ),
'ls' => __( 'Lesotho', 'polylang' ),
'lt' => __( 'Lithuania', 'polylang' ),
'lu' => __( 'Luxembourg', 'polylang' ),
'lv' => __( 'Latvia', 'polylang' ),
'ly' => __( 'Libya', 'polylang' ),
'ma' => __( 'Morocco', 'polylang' ),
'mc' => __( 'Monaco', 'polylang' ),
'md' => __( 'Moldova', 'polylang' ),
'me' => __( 'Montenegro', 'polylang' ),
'mg' => __( 'Madagascar', 'polylang' ),
'mh' => __( 'Marshall Islands', 'polylang' ),
'mk' => __( 'Macedonia', 'polylang' ),
'ml' => __( 'Mali', 'polylang' ),
'mm' => __( 'Myanmar', 'polylang' ),
'mn' => __( 'Mongolia', 'polylang' ),
'mo' => __( 'Macao', 'polylang' ),
'mp' => __( 'Northern Mariana Islands', 'polylang' ),
'mq' => __( 'Martinique', 'polylang' ),
'mr' => __( 'Mauritania', 'polylang' ),
'ms' => __( 'Montserrat', 'polylang' ),
'mt' => __( 'Malta', 'polylang' ),
'mu' => __( 'Mauritius', 'polylang' ),
'mv' => __( 'Maldives', 'polylang' ),
'mw' => __( 'Malawi', 'polylang' ),
'mx' => __( 'Mexico', 'polylang' ),
'my' => __( 'Malaysia', 'polylang' ),
'mz' => __( 'Mozambique', 'polylang' ),
'na' => __( 'Namibia', 'polylang' ),
'nc' => __( 'New Caledonia', 'polylang' ),
'ne' => __( 'Niger', 'polylang' ),
'nf' => __( 'Norfolk Island', 'polylang' ),
'ng' => __( 'Nigeria', 'polylang' ),
'ni' => __( 'Nicaragua', 'polylang' ),
'nl' => __( 'Netherlands', 'polylang' ),
'no' => __( 'Norway', 'polylang' ),
'np' => __( 'Nepal', 'polylang' ),
'nr' => __( 'Nauru', 'polylang' ),
'nu' => __( 'Niue', 'polylang' ),
'nz' => __( 'New Zealand', 'polylang' ),
'occitania' => __( 'Occitania', 'polylang' ),
'om' => __( 'Oman', 'polylang' ),
'pa' => __( 'Panama', 'polylang' ),
'pe' => __( 'Peru', 'polylang' ),
'pf' => __( 'French Polynesia', 'polylang' ),
'pg' => __( 'Papua New Guinea', 'polylang' ),
'ph' => __( 'Philippines', 'polylang' ),
'pk' => __( 'Pakistan', 'polylang' ),
'pl' => __( 'Poland', 'polylang' ),
'pm' => __( 'Saint Pierre and Miquelon', 'polylang' ),
'pn' => __( 'Pitcairn', 'polylang' ),
'pr' => __( 'Puerto Rico', 'polylang' ),
'ps' => __( 'Palestinian Territory', 'polylang' ),
'pt' => __( 'Portugal', 'polylang' ),
'pw' => __( 'Belau', 'polylang' ),
'py' => __( 'Paraguay', 'polylang' ),
'qa' => __( 'Qatar', 'polylang' ),
'quebec' => __( 'Quebec', 'polylang' ),
'ro' => __( 'Romania', 'polylang' ),
'rs' => __( 'Serbia', 'polylang' ),
'ru' => __( 'Russia', 'polylang' ),
'rw' => __( 'Rwanda', 'polylang' ),
'sa' => __( 'Saudi Arabia', 'polylang' ),
'sb' => __( 'Solomon Islands', 'polylang' ),
'sc' => __( 'Seychelles', 'polylang' ),
'scotland' => __( 'Scotland', 'polylang' ),
'sd' => __( 'Sudan', 'polylang' ),
'se' => __( 'Sweden', 'polylang' ),
'sg' => __( 'Singapore', 'polylang' ),
'sh' => __( 'Saint Helena', 'polylang' ),
'si' => __( 'Slovenia', 'polylang' ),
'sk' => __( 'Slovakia', 'polylang' ),
'sl' => __( 'Sierra Leone', 'polylang' ),
'sm' => __( 'San Marino', 'polylang' ),
'sn' => __( 'Senegal', 'polylang' ),
'so' => __( 'Somalia', 'polylang' ),
'sr' => __( 'Suriname', 'polylang' ),
'ss' => __( 'South Sudan', 'polylang' ),
'st' => __( 'São Tomé and Príncipe', 'polylang' ),
'sv' => __( 'El Salvador', 'polylang' ),
'sy' => __( 'Syria', 'polylang' ),
'sz' => __( 'Swaziland', 'polylang' ),
'tc' => __( 'Turks and Caicos Islands', 'polylang' ),
'td' => __( 'Chad', 'polylang' ),
'tf' => __( 'French Southern Territories', 'polylang' ),
'tg' => __( 'Togo', 'polylang' ),
'th' => __( 'Thailand', 'polylang' ),
'tibet' => __( 'Tibet', 'polylang' ),
'tj' => __( 'Tajikistan', 'polylang' ),
'tk' => __( 'Tokelau', 'polylang' ),
'tl' => __( 'Timor-Leste', 'polylang' ),
'tm' => __( 'Turkmenistan', 'polylang' ),
'tn' => __( 'Tunisia', 'polylang' ),
'to' => __( 'Tonga', 'polylang' ),
'tr' => __( 'Turkey', 'polylang' ),
'tt' => __( 'Trinidad and Tobago', 'polylang' ),
'tv' => __( 'Tuvalu', 'polylang' ),
'tw' => __( 'Taiwan', 'polylang' ),
'tz' => __( 'Tanzania', 'polylang' ),
'ua' => __( 'Ukraine', 'polylang' ),
'ug' => __( 'Uganda', 'polylang' ),
'us' => __( 'United States', 'polylang' ),
'uy' => __( 'Uruguay', 'polylang' ),
'uz' => __( 'Uzbekistan', 'polylang' ),
'va' => __( 'Vatican', 'polylang' ),
'vc' => __( 'Saint Vincent and the Grenadines', 'polylang' ),
've' => __( 'Venezuela', 'polylang' ),
'veneto' => __( 'Veneto', 'polylang' ),
'vg' => __( 'British Virgin Islands', 'polylang' ),
'vi' => __( 'United States Virgin Islands', 'polylang' ),
'vn' => __( 'Vietnam', 'polylang' ),
'vu' => __( 'Vanuatu', 'polylang' ),
'wales' => __( 'Wales', 'polylang' ),
'wf' => __( 'Wallis and Futuna', 'polylang' ),
'ws' => __( 'Western Samoa', 'polylang' ),
'ye' => __( 'Yemen', 'polylang' ),
'yt' => __( 'Mayotte', 'polylang' ),
'za' => __( 'South Africa', 'polylang' ),
'zm' => __( 'Zambia', 'polylang' ),
'zw' => __( 'Zimbabwe', 'polylang' ),
);
/**
* Filter the list of predefined flags
*
* @since 1.8
*
* @param array $flags
*/
$flags = apply_filters( 'pll_predefined_flags', $flags );
PK !\YO O settings-licenses.phpnu W+A 'licenses',
'title' => __( 'License keys', 'polylang' ),
'description' => __( 'Manage licenses for Polylang Pro or addons.', 'polylang' ),
) );
$this->buttons['cancel'] = sprintf( '%s ', __( 'Close' ) );
$this->items = apply_filters( 'pll_settings_licenses', array() );
add_action( 'wp_ajax_pll_deactivate_license', array( $this, 'deactivate_license' ) );
}
/**
* Tells if the module is active
*
* @since 1.9
*
* @return bool
*/
public function is_active() {
return ! empty( $this->items );
}
/**
* Displays the settings form
*
* @since 1.9
*/
protected function form() {
if ( ! empty( $this->items ) ) { ?>
license_data ) ) {
$license = $item->license_data;
}
$class = 'license-null';
$out = sprintf(
'%2$s ' .
' ',
esc_attr( $item->id ), esc_attr( $item->name ), esc_html( $item->license_key )
);
if ( ! empty( $license ) && is_object( $license ) ) {
$now = current_time( 'timestamp' );
$expiration = strtotime( $license->expires, $now );
// Special case: the license expired after the last check
if ( $license->success && $expiration < $now ) {
$license->success = false;
$license->error = 'expired';
}
if ( false === $license->success ) {
$class = 'notice-error notice-alt';
switch ( $license->error ) {
case 'expired':
$message = sprintf(
/* translators: %1$s is a date, %2$s and %3$s are html tags */
__( 'Your license key expired on %1$s. Please %2$srenew your license key%3$s.', 'polylang' ),
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ),
sprintf( '', 'https://polylang.pro/checkout/?edd_license_key=' . $item->license_key ),
' '
);
break;
case 'missing':
$message = sprintf(
/* translators: %s are html tags */
__( 'Invalid license. Please %svisit your account page%s and verify it.', 'polylang' ),
sprintf( '', 'https://polylang.pro/account' ),
' '
);
break;
case 'invalid':
case 'site_inactive':
$message = sprintf(
/* translators: %1$s is a product name, %2$s and %3$s are html tags */
__( 'Your %1$s license key is not active for this URL. Please %2$svisit your account page%3$s to manage your license key URLs.', 'polylang' ),
$item->name,
sprintf( '', 'https://polylang.pro/account' ),
' '
);
break;
case 'item_name_mismatch':
/* translators: %s is a product name */
$message = sprintf( __( 'This is not a %s license key.', 'polylang' ), $item->name );
break;
case 'no_activations_left':
$message = sprintf(
/* translators: %s are html tags */
__( 'Your license key has reached its activation limit. %sView possible upgrades%s now.', 'polylang' ),
sprintf( '', 'https://polylang.pro/account' ),
' '
);
break;
}
} else {
$class = 'license-valid';
$out .= sprintf( '%s ', $item->id, __( 'Deactivate', 'polylang' ) );
if ( 'lifetime' === $license->expires ) {
$message = __( 'The license key never expires.', 'polylang' );
} elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
$class = 'notice-warning notice-alt';
$message = sprintf(
/* translators: %1$s is a date, %2$s and %3$s are html tags */
__( 'Your license key expires soon! It expires on %1$s. %2$sRenew your license key%3$s.', 'polylang' ),
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, $now ) ),
sprintf( '', 'https://polylang.pro/checkout/?edd_license_key=' . $item->license_key ),
' '
);
} else {
$message = sprintf(
/* translators: %s is a date */
__( 'Your license key expires on %s.', 'polylang' ),
date_i18n( get_option( 'date_format' ), strtotime( $license->expires, $now ) )
);
}
}
}
if ( ! empty( $message ) ) {
$out .= '' . $message . '
';
}
return sprintf( '%s ', $item->id, $class, $out );
}
/**
* Ajax method to save the license keys and activate the licenses at the same time
* Overrides parent's method
*
* @since 1.9
*/
public function save_options() {
check_ajax_referer( 'pll_options', '_pll_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( -1 );
}
if ( $this->module === $_POST['module'] && ! empty( $_POST['licenses'] ) ) {
$x = new WP_Ajax_Response();
foreach ( $this->items as $item ) {
$updated_item = $item->activate_license( sanitize_text_field( $_POST['licenses'][ $item->id ] ) );
$x->Add( array( 'what' => 'license-update', 'data' => $item->id, 'supplemental' => array( 'html' => $this->get_row( $updated_item ) ) ) );
}
// Updated message
add_settings_error( 'general', 'settings_updated', __( 'Settings saved.' ), 'updated' );
ob_start();
settings_errors();
$x->Add( array( 'what' => 'success', 'data' => ob_get_clean() ) );
$x->send();
}
}
/**
* Ajax method to deactivate a license
*
* @since 1.9
*/
public function deactivate_license() {
check_ajax_referer( 'pll_options', '_pll_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( -1 );
}
$id = sanitize_text_field( substr( $_POST['id'], 11 ) );
wp_send_json( array(
'id' => $id,
'html' => $this->get_row( $this->items[ $id ]->deactivate_license() ),
) );
}
}
PK !\S S view-tab-settings.phpnu W+A
prepare_items( $this->modules );
$list_table->display();
?>
PK g"\ validations.phpnu W+A files_manager->clear_cache();
return $input;
}
}
PK g"\RGI controls.phpnu W+A '',
'attributes' => [],
'std' => '',
'desc' => '',
];
$field = array_merge( $defaults, $field );
$method_name = $field['type'];
if ( ! method_exists( __CLASS__, $method_name ) ) {
$method_name = 'text';
}
self::$method_name( $field );
}
/**
* Render text control.
*
* Generates the final HTML for text controls.
*
* @since 2.0.0
* @access private
* @static
*
* @param array $field Field data.
*/
private static function text( array $field ) {
if ( empty( $field['attributes']['class'] ) ) {
$field['attributes']['class'] = 'regular-text';
}
$attributes = Utils::render_html_attributes( $field['attributes'] );
?>
/>
/>
$option_value ) :
?>
/>
— —
$label ) : ?>
>
[],
];
$field = array_merge( $defaults, $field );
$post_types_objects = get_post_types(
[
'public' => true,
], 'objects'
);
/**
* Filters the list of post type objects used by Elementor.
*
* @since 2.8.0
*
* @param array $post_types_objects List of post type objects used by Elementor.
*/
$post_types_objects = apply_filters( 'elementor/settings/controls/checkbox_list_cpt/post_type_objects', $post_types_objects );
$field['options'] = [];
foreach ( $post_types_objects as $cpt_slug => $post_type ) {
if ( in_array( $cpt_slug, $field['exclude'], true ) ) {
continue;
}
$field['options'][ $cpt_slug ] = $post_type->labels->name;
}
self::checkbox_list( $field );
}
/**
* Render checkbox list control for user roles.
*
* Generates the final HTML for checkbox list controls populated with user roles.
*
* @since 2.0.0
* @access private
* @static
*
* @param array $field Field data.
*/
private static function checkbox_list_roles( array $field ) {
$defaults = [
'exclude' => [],
];
$field = array_merge( $defaults, $field );
$field['options'] = [];
$roles = get_editable_roles();
if ( is_multisite() ) {
$roles = [
'super_admin' => [
'name' => __( 'Super Admin', 'elementor' ),
],
] + $roles;
}
foreach ( $roles as $role_slug => $role_data ) {
if ( in_array( $role_slug, $field['exclude'] ) ) {
continue;
}
$field['options'][ $role_slug ] = $role_data['name'];
}
self::checkbox_list( $field );
}
/**
* Render raw HTML control.
*
* Generates the final HTML for raw HTML controls.
*
* @since 2.0.0
* @access private
* @static
*
* @param array $field Field data.
*/
private static function raw_html( array $field ) {
if ( empty( $field['html'] ) ) {
return;
}
?>
ensure_tabs();
return $this->tabs;
}
/**
* Add tab.
*
* Register a new tab to a settings page.
*
* @since 1.5.0
* @access public
*
* @param string $tab_id Tab ID.
* @param array $tab_args Optional. Tab arguments. Default is an empty array.
*/
final public function add_tab( $tab_id, array $tab_args = [] ) {
$this->ensure_tabs();
if ( isset( $this->tabs[ $tab_id ] ) ) {
// Don't override an existing tab
return;
}
if ( ! isset( $tab_args['sections'] ) ) {
$tab_args['sections'] = [];
}
$this->tabs[ $tab_id ] = $tab_args;
}
/**
* Add section.
*
* Register a new section to a tab.
*
* @since 1.5.0
* @access public
*
* @param string $tab_id Tab ID.
* @param string $section_id Section ID.
* @param array $section_args Optional. Section arguments. Default is an
* empty array.
*/
final public function add_section( $tab_id, $section_id, array $section_args = [] ) {
$this->ensure_tabs();
if ( ! isset( $this->tabs[ $tab_id ] ) ) {
// If the requested tab doesn't exists, use the first tab
$tab_id = key( $this->tabs );
}
if ( isset( $this->tabs[ $tab_id ]['sections'][ $section_id ] ) ) {
// Don't override an existing section
return;
}
if ( ! isset( $section_args['fields'] ) ) {
$section_args['fields'] = [];
}
$this->tabs[ $tab_id ]['sections'][ $section_id ] = $section_args;
}
/**
* Add field.
*
* Register a new field to a section.
*
* @since 1.5.0
* @access public
*
* @param string $tab_id Tab ID.
* @param string $section_id Section ID.
* @param string $field_id Field ID.
* @param array $field_args Field arguments.
*/
final public function add_field( $tab_id, $section_id, $field_id, array $field_args ) {
$this->ensure_tabs();
if ( ! isset( $this->tabs[ $tab_id ] ) ) {
// If the requested tab doesn't exists, use the first tab
$tab_id = key( $this->tabs );
}
if ( ! isset( $this->tabs[ $tab_id ]['sections'][ $section_id ] ) ) {
// If the requested section doesn't exists, use the first section
$section_id = key( $this->tabs[ $tab_id ]['sections'] );
}
if ( isset( $this->tabs[ $tab_id ]['sections'][ $section_id ]['fields'][ $field_id ] ) ) {
// Don't override an existing field
return;
}
$this->tabs[ $tab_id ]['sections'][ $section_id ]['fields'][ $field_id ] = $field_args;
}
/**
* Add fields.
*
* Register multiple fields to a section.
*
* @since 1.5.0
* @access public
*
* @param string $tab_id Tab ID.
* @param string $section_id Section ID.
* @param array $fields {
* An array of fields.
*
* @type string $field_id Field ID.
* @type array $field_args Field arguments.
* }
*/
final public function add_fields( $tab_id, $section_id, array $fields ) {
foreach ( $fields as $field_id => $field_args ) {
$this->add_field( $tab_id, $section_id, $field_id, $field_args );
}
}
/**
* Register settings fields.
*
* In each tab register his inner sections, and in each section register his
* inner fields.
*
* @since 1.5.0
* @access public
*/
final public function register_settings_fields() {
$controls_class_name = __NAMESPACE__ . '\Settings_Controls';
$tabs = $this->get_tabs();
foreach ( $tabs as $tab_id => $tab ) {
foreach ( $tab['sections'] as $section_id => $section ) {
$full_section_id = 'elementor_' . $section_id . '_section';
$label = isset( $section['label'] ) ? $section['label'] : '';
$section_callback = isset( $section['callback'] ) ? $section['callback'] : '__return_empty_string';
add_settings_section( $full_section_id, $label, $section_callback, static::PAGE_ID );
foreach ( $section['fields'] as $field_id => $field ) {
$full_field_id = ! empty( $field['full_field_id'] ) ? $field['full_field_id'] : 'elementor_' . $field_id;
$field['field_args']['id'] = $full_field_id;
$field_classes = [ $full_field_id ];
if ( ! empty( $field['class'] ) ) {
$field_classes[] = $field['field_args']['class'];
}
$field['field_args']['class'] = implode( ' ', $field_classes );
add_settings_field(
$full_field_id,
isset( $field['label'] ) ? $field['label'] : '',
[ $controls_class_name, 'render' ],
static::PAGE_ID,
$full_section_id,
$field['field_args']
);
$setting_args = [];
if ( ! empty( $field['setting_args'] ) ) {
$setting_args = $field['setting_args'];
}
register_setting( static::PAGE_ID, $full_field_id, $setting_args );
}
}
}
}
/**
* Display settings page.
*
* Output the content for the settings page.
*
* @since 1.5.0
* @access public
*/
public function display_settings_page() {
$this->register_settings_fields();
$tabs = $this->get_tabs();
?>
get_page_title(); ?>
$tab ) {
if ( empty( $tab['sections'] ) ) {
continue;
}
$active_class = '';
if ( 'general' === $tab_id ) {
$active_class = ' nav-tab-active';
}
echo "
{$tab['label']} ";
}
?>
tabs ) {
$this->tabs = $this->create_tabs();
$page_id = static::PAGE_ID;
/**
* After create settings.
*
* Fires after the settings are created in Elementor admin page.
*
* The dynamic portion of the hook name, `$page_id`, refers to the current page ID.
*
* @since 1.0.0
*
* @param Settings_Page $this The settings page.
*/
do_action( "elementor/admin/after_create_settings/{$page_id}", $this );
}
}
}
PK g"\ɹ( ( tools.phpnu W+A files_manager->clear_cache();
wp_send_json_success();
}
/**
* Replace URLs.
*
* Sends an ajax request to replace old URLs to new URLs. This method also
* updates all the Elementor data.
*
* Fired by `wp_ajax_elementor_replace_url` action.
*
* @since 1.1.0
* @access public
*/
public function ajax_elementor_replace_url() {
check_ajax_referer( 'elementor_replace_url', '_nonce' );
$from = ! empty( $_POST['from'] ) ? $_POST['from'] : '';
$to = ! empty( $_POST['to'] ) ? $_POST['to'] : '';
try {
$results = Utils::replace_urls( $from, $to );
wp_send_json_success( $results );
} catch ( \Exception $e ) {
wp_send_json_error( $e->getMessage() );
}
}
/**
* Elementor version rollback.
*
* Rollback to previous Elementor version.
*
* Fired by `admin_post_elementor_rollback` action.
*
* @since 1.5.0
* @access public
*/
public function post_elementor_rollback() {
check_admin_referer( 'elementor_rollback' );
$rollback_versions = $this->get_rollback_versions();
if ( empty( $_GET['version'] ) || ! in_array( $_GET['version'], $rollback_versions ) ) {
wp_die( __( 'Error occurred, The version selected is invalid. Try selecting different version.', 'elementor' ) );
}
$plugin_slug = basename( ELEMENTOR__FILE__, '.php' );
$rollback = new Rollback(
[
'version' => $_GET['version'],
'plugin_name' => ELEMENTOR_PLUGIN_BASE,
'plugin_slug' => $plugin_slug,
'package_url' => sprintf( 'https://downloads.wordpress.org/plugin/%s.%s.zip', $plugin_slug, $_GET['version'] ),
]
);
$rollback->run();
wp_die(
'', __( 'Rollback to Previous Version', 'elementor' ), [
'response' => 200,
]
);
}
/**
* Tools page constructor.
*
* Initializing Elementor "Tools" page.
*
* @since 1.0.0
* @access public
*/
public function __construct() {
parent::__construct();
add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 205 );
if ( ! empty( $_POST ) ) {
add_action( 'wp_ajax_elementor_clear_cache', [ $this, 'ajax_elementor_clear_cache' ] );
add_action( 'wp_ajax_elementor_replace_url', [ $this, 'ajax_elementor_replace_url' ] );
}
add_action( 'admin_post_elementor_rollback', [ $this, 'post_elementor_rollback' ] );
}
private function get_rollback_versions() {
$rollback_versions = get_transient( 'elementor_rollback_versions_' . ELEMENTOR_VERSION );
if ( false === $rollback_versions ) {
$max_versions = 30;
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$plugin_information = plugins_api(
'plugin_information', [
'slug' => 'elementor',
]
);
if ( empty( $plugin_information->versions ) || ! is_array( $plugin_information->versions ) ) {
return [];
}
krsort( $plugin_information->versions );
$rollback_versions = [];
$current_index = 0;
foreach ( $plugin_information->versions as $version => $download_link ) {
if ( $max_versions <= $current_index ) {
break;
}
if ( preg_match( '/(trunk|beta|rc)/i', strtolower( $version ) ) ) {
continue;
}
if ( version_compare( $version, ELEMENTOR_VERSION, '>=' ) ) {
continue;
}
$current_index++;
$rollback_versions[] = $version;
}
set_transient( 'elementor_rollback_versions_' . ELEMENTOR_VERSION, $rollback_versions, WEEK_IN_SECONDS );
}
return $rollback_versions;
}
/**
* Create tabs.
*
* Return the tools page tabs, sections and fields.
*
* @since 1.5.0
* @access protected
*
* @return array An array with the page tabs, sections and fields.
*/
protected function create_tabs() {
$rollback_html = '';
foreach ( $this->get_rollback_versions() as $version ) {
$rollback_html .= "$version ";
}
$rollback_html .= ' ';
return [
'general' => [
'label' => __( 'General', 'elementor' ),
'sections' => [
'tools' => [
'fields' => [
'clear_cache' => [
'label' => __( 'Regenerate CSS', 'elementor' ),
'field_args' => [
'type' => 'raw_html',
'html' => sprintf( '%s ', wp_create_nonce( 'elementor_clear_cache' ), __( 'Regenerate Files', 'elementor' ) ),
'desc' => __( 'Styles set in Elementor are saved in CSS files in the uploads folder. Recreate those files, according to the most recent settings.', 'elementor' ),
],
],
'reset_api_data' => [
'label' => __( 'Sync Library', 'elementor' ),
'field_args' => [
'type' => 'raw_html',
'html' => sprintf( '%s ', wp_create_nonce( 'elementor_reset_library' ), __( 'Sync Library', 'elementor' ) ),
'desc' => __( 'Elementor Library automatically updates on a daily basis. You can also manually update it by clicking on the sync button.', 'elementor' ),
],
],
],
],
],
],
'replace_url' => [
'label' => __( 'Replace URL', 'elementor' ),
'sections' => [
'replace_url' => [
'callback' => function() {
$intro_text = sprintf(
/* translators: %s: Codex URL */
__( 'Important: It is strongly recommended that you backup your database before using Replace URL.', 'elementor' ),
'https://codex.wordpress.org/WordPress_Backups'
);
$intro_text = '' . $intro_text . '
';
echo '' . esc_html__( 'Replace URL', 'elementor' ) . ' ';
echo $intro_text;
},
'fields' => [
'replace_url' => [
'label' => __( 'Update Site Address (URL)', 'elementor' ),
'field_args' => [
'type' => 'raw_html',
'html' => sprintf( '%s ', wp_create_nonce( 'elementor_replace_url' ), __( 'Replace URL', 'elementor' ) ),
'desc' => __( 'Enter your old and new URLs for your WordPress installation, to update all Elementor data (Relevant for domain transfers or move to \'HTTPS\').', 'elementor' ),
],
],
],
],
],
],
'versions' => [
'label' => __( 'Version Control', 'elementor' ),
'sections' => [
'rollback' => [
'label' => __( 'Rollback to Previous Version', 'elementor' ),
'callback' => function() {
$intro_text = sprintf(
/* translators: %s: Elementor version */
__( 'Experiencing an issue with Elementor version %s? Rollback to a previous version before the issue appeared.', 'elementor' ),
ELEMENTOR_VERSION
);
$intro_text = '' . $intro_text . '
';
echo $intro_text;
},
'fields' => [
'rollback' => [
'label' => __( 'Rollback Version', 'elementor' ),
'field_args' => [
'type' => 'raw_html',
'html' => sprintf(
$rollback_html . '%s ',
wp_nonce_url( admin_url( 'admin-post.php?action=elementor_rollback&version=VERSION' ), 'elementor_rollback' ),
__( 'Reinstall', 'elementor' )
),
'desc' => '' . __( 'Warning: Please backup your database before making the rollback.', 'elementor' ) . ' ',
],
],
],
],
'beta' => [
'label' => __( 'Become a Beta Tester', 'elementor' ),
'callback' => function() {
$intro_text = __( 'Turn-on Beta Tester, to get notified when a new beta version of Elementor or Elementor Pro is available. The Beta version will not install automatically. You always have the option to ignore it.', 'elementor' );
$intro_text = '' . $intro_text . '
';
$newsletter_opt_in_text = sprintf( __( 'Click here to join our first-to-know email updates.', 'elementor' ), '#' );
echo $intro_text;
echo $newsletter_opt_in_text;
},
'fields' => [
'beta' => [
'label' => __( 'Beta Tester', 'elementor' ),
'field_args' => [
'type' => 'select',
'default' => 'no',
'options' => [
'no' => __( 'Disable', 'elementor' ),
'yes' => __( 'Enable', 'elementor' ),
],
'desc' => '' . __( 'Please Note: We do not recommend updating to a beta version on production sites.', 'elementor' ) . ' ',
],
],
],
],
],
],
];
}
/**
* Get tools page title.
*
* Retrieve the title for the tools page.
*
* @since 1.5.0
* @access protected
*
* @return string Tools page title.
*/
protected function get_page_title() {
return __( 'Tools', 'elementor' );
}
}
PK 4\OM M manager.phpnu W+A get_name() ] = $manager;
}
/**
* Get settings managers.
*
* Retrieve registered settings manager(s).
*
* If no parameter passed, it will retrieve all the settings managers. For
* any given parameter it will retrieve a single settings manager if one
* exist, or `null` otherwise.
*
* @since 1.6.0
* @access public
* @static
*
* @param string $manager_name Optional. Settings manager name. Default is
* null.
*
* @return Base\Manager|Base\Manager[] Single settings manager, if it exists,
* null if it doesn't exists, or the all
* the settings managers if no parameter
* defined.
*/
public static function get_settings_managers( $manager_name = null ) {
if ( $manager_name ) {
if ( isset( self::$settings_managers[ $manager_name ] ) ) {
return self::$settings_managers[ $manager_name ];
}
return null;
}
return self::$settings_managers;
}
/**
* Register default settings managers.
*
* Register builtin Elementor settings managers.
*
* @since 1.6.0
* @access private
* @static
*/
private static function register_default_settings_managers() {
foreach ( self::$builtin_settings_managers_names as $manager_name ) {
$manager_class = __NAMESPACE__ . '\\' . ucfirst( $manager_name ) . '\Manager';
self::add_settings_manager( new $manager_class() );
}
}
/**
* Get settings managers config.
*
* Retrieve the settings managers configuration.
*
* @since 1.6.0
* @access public
* @static
*
* @return array The settings managers configuration.
*/
public static function get_settings_managers_config() {
$config = [];
$user_can = Plugin::instance()->role_manager->user_can( 'design' );
foreach ( self::$settings_managers as $name => $manager ) {
$settings_model = $manager->get_model_for_config();
$tabs = $settings_model->get_tabs_controls();
if ( ! $user_can ) {
unset( $tabs['style'] );
}
$config[ $name ] = [
'name' => $manager->get_name(),
'panelPage' => $settings_model->get_panel_page_settings(),
'controls' => $settings_model->get_controls(),
'tabs' => $tabs,
'settings' => $settings_model->get_settings(),
];
if ( $settings_model instanceof CSS_Model ) {
$config[ $name ]['cssWrapperSelector'] = $settings_model->get_css_wrapper_selector();
}
}
return $config;
}
/**
* Get settings frontend config.
*
* Retrieve the settings managers frontend configuration.
*
* @since 1.6.0
* @access public
* @static
*
* @return array The settings managers frontend configuration.
*/
public static function get_settings_frontend_config() {
$config = [];
foreach ( self::$settings_managers as $name => $manager ) {
$settings_model = $manager->get_model_for_config();
if ( $settings_model ) {
$config[ $name ] = $settings_model->get_frontend_settings();
}
}
return $config;
}
/**
* Run settings managers.
*
* Register builtin Elementor settings managers.
*
* @since 1.6.0
* @access public
* @static
*/
public static function run() {
self::register_default_settings_managers();
}
}
PK 4\cH H base/css-manager.phpnu W+A get_css_file_name();
add_action( "elementor/css-file/{$name}/parse", [ $this, 'add_settings_css_rules' ] );
}
/**
* Save settings.
*
* Save settings to the database and update the CSS file.
*
* @since 2.8.0
* @access public
*
* @param array $settings Settings.
* @param int $id Optional. Post ID. Default is `0`.
*/
public function save_settings( array $settings, $id = 0 ) {
parent::save_settings( $settings, $id );
$css_file = $this->get_css_file_for_update( $id );
if ( $css_file ) {
$css_file->update();
}
}
/**
* Add settings CSS rules.
*
* Add new CSS rules to the settings manager.
*
* Fired by `elementor/css-file/{$name}/parse` action.
*
* @since 2.8.0
* @access public
*
* @param CSS_File $css_file The requested CSS file.
*
*/
public function add_settings_css_rules( CSS_File $css_file ) {
$model = $this->get_model_for_css_file( $css_file );
$css_file->add_controls_stack_style_rules(
$model,
$model->get_style_controls(),
$model->get_settings(),
[ '{{WRAPPER}}' ],
[ $model->get_css_wrapper_selector() ]
);
}
}
PK 4\] ] base/model.phpnu W+A get_name();
$ajax_manager->register_ajax_action( "save_{$name}_settings", [ $this, 'ajax_save_settings' ] );
}
/**
* Get model for config.
*
* Retrieve the model for settings configuration.
*
* @since 1.6.0
* @access public
* @abstract
*
* @return Model The model object.
*/
abstract public function get_model_for_config();
/**
* Get manager name.
*
* Retrieve settings manager name.
*
* @since 1.6.0
* @access public
* @abstract
*/
abstract public function get_name();
/**
* Get model.
*
* Retrieve the model for any given model ID.
*
* @since 1.6.0
* @access public
*
* @param int $id Optional. Model ID. Default is `0`.
*
* @return Model The model.
*/
final public function get_model( $id = 0 ) {
if ( ! isset( $this->models_cache[ $id ] ) ) {
$this->create_model( $id );
}
return $this->models_cache[ $id ];
}
/**
* Ajax request to save settings.
*
* Save settings using an ajax request.
*
* @since 1.6.0
* @access public
*
* @param array $request Ajax request.
*
* @return array Ajax response data.
*/
final public function ajax_save_settings( $request ) {
$data = $request['data'];
$id = 0;
if ( ! empty( $request['id'] ) ) {
$id = $request['id'];
}
$this->ajax_before_save_settings( $data, $id );
$this->save_settings( $data, $id );
$settings_name = $this->get_name();
$success_response_data = [];
/**
* Settings success response data.
*
* Filters the success response data when saving settings using ajax.
*
* The dynamic portion of the hook name, `$settings_name`, refers to the settings name.
*
* @since 1.6.0
* @deprecated 2.0.0 Use `elementor/settings/{$settings_name}/success_response_data` filter.
*
* @param array $success_response_data Success response data.
* @param int $id Settings ID.
* @param array $data Settings data.
*/
$success_response_data = apply_filters_deprecated( "elementor/{$settings_name}/settings/success_response_data", [ $success_response_data, $id, $data ], '2.0.0', "elementor/settings/{$settings_name}/success_response_data" );
/**
* Settings success response data.
*
* Filters the success response data when saving settings using ajax.
*
* The dynamic portion of the hook name, `$settings_name`, refers to the settings name.
*
* @since 2.0.0
*
* @param array $success_response_data Success response data.
* @param int $id Settings ID.
* @param array $data Settings data.
*/
$success_response_data = apply_filters( "elementor/settings/{$settings_name}/success_response_data", $success_response_data, $id, $data );
return $success_response_data;
}
/**
* Save settings.
*
* Save settings to the database.
*
* @since 1.6.0
* @access public
*
* @param array $settings Settings.
* @param int $id Optional. Post ID. Default is `0`.
*/
public function save_settings( array $settings, $id = 0 ) {
$special_settings = $this->get_special_settings_names();
$settings_to_save = $settings;
foreach ( $special_settings as $special_setting ) {
if ( isset( $settings_to_save[ $special_setting ] ) ) {
unset( $settings_to_save[ $special_setting ] );
}
}
$this->save_settings_to_db( $settings_to_save, $id );
// Clear cache after save.
if ( isset( $this->models_cache[ $id ] ) ) {
unset( $this->models_cache[ $id ] );
}
}
/**
* On Elementor init.
*
* Add editor template for the settings
*
* Fired by `elementor/init` action.
*
* @since 2.3.0
* @access public
*/
public function on_elementor_editor_init() {
Plugin::$instance->common->add_template( $this->get_editor_template(), 'text' );
}
/**
* Get saved settings.
*
* Retrieve the saved settings from the database.
*
* @since 1.6.0
* @access protected
* @abstract
*
* @param int $id Post ID.
*/
abstract protected function get_saved_settings( $id );
/**
* Save settings to DB.
*
* Save settings to the database.
*
* @since 1.6.0
* @access protected
* @abstract
*
* @param array $settings Settings.
* @param int $id Post ID.
*/
abstract protected function save_settings_to_db( array $settings, $id );
/**
* Get special settings names.
*
* Retrieve the names of the special settings that are not saved as regular
* settings. Those settings have a separate saving process.
*
* @since 1.6.0
* @access protected
*
* @return array Special settings names.
*/
protected function get_special_settings_names() {
return [];
}
/**
* Ajax before saving settings.
*
* Validate the data before saving it and updating the data in the database.
*
* @since 1.6.0
* @access public
*
* @param array $data Post data.
* @param int $id Post ID.
*/
public function ajax_before_save_settings( array $data, $id ) {}
/**
* Print the setting template content in the editor.
*
* Used to generate the control HTML in the editor using Underscore JS
* template. The variables for the class are available using `data` JS
* object.
*
* @since 1.6.0
* @access protected
*
* @param string $name Settings panel name.
*/
protected function print_editor_template_content( $name ) {
?>
<#
const tabs = elementor.config.settings..tabs;
if ( Object.values( tabs ).length > 1 ) { #>
<# _.each( tabs, function( tabTitle, tabSlug ) {
$e.bc.ensureTab( 'panel/-settings', tabSlug ); #>
<# } ); #>
<# } #>
models_cache[ $id ] = new $class_name( [
'id' => $id,
'settings' => $this->get_saved_settings( $id ),
] );
}
/**
* Get editor template.
*
* Retrieve the final HTML for the editor.
*
* @since 1.6.0
* @access private
*
* @return string Settings editor template.
*/
private function get_editor_template() {
$name = $this->get_name();
ob_start();
?>
__( 'Global Settings', 'elementor' ),
];
}
/**
* Get controls list.
*
* Retrieve the global settings model controls list.
*
* @since 1.6.0
* @access public
* @static
*
* @return array Controls list.
*/
public static function get_controls_list() {
return [
Controls_Manager::TAB_STYLE => [
'style' => [
'label' => __( 'Style', 'elementor' ),
'controls' => [
'elementor_default_generic_fonts' => [
'label' => __( 'Default Generic Fonts', 'elementor' ),
'type' => Controls_Manager::TEXT,
'default' => 'Sans-serif',
'description' => __( 'The list of fonts used if the chosen font is not available.', 'elementor' ),
'label_block' => true,
],
'elementor_container_width' => [
'label' => __( 'Content Width', 'elementor' ) . ' (px)',
'type' => Controls_Manager::NUMBER,
'min' => 300,
'description' => __( 'Sets the default width of the content area (Default: 1140)', 'elementor' ),
'selectors' => [
'.elementor-section.elementor-section-boxed > .elementor-container' => 'max-width: {{VALUE}}px',
],
],
'elementor_space_between_widgets' => [
'label' => __( 'Widgets Space', 'elementor' ) . ' (px)',
'type' => Controls_Manager::NUMBER,
'min' => 0,
'placeholder' => '20',
'description' => __( 'Sets the default space between widgets (Default: 20)', 'elementor' ),
'selectors' => [
'.elementor-widget:not(:last-child)' => 'margin-bottom: {{VALUE}}px',
],
],
'elementor_stretched_section_container' => [
'label' => __( 'Stretched Section Fit To', 'elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => 'body',
'description' => __( 'Enter parent element selector to which stretched sections will fit to (e.g. #primary / .wrapper / main etc). Leave blank to fit to page width.', 'elementor' ),
'label_block' => true,
'frontend_available' => true,
],
'elementor_page_title_selector' => [
'label' => __( 'Page Title Selector', 'elementor' ),
'type' => Controls_Manager::TEXT,
'placeholder' => 'h1.entry-title',
'description' => __( 'Elementor lets you hide the page title. This works for themes that have "h1.entry-title" selector. If your theme\'s selector is different, please enter it above.', 'elementor' ),
'label_block' => true,
],
],
],
],
Manager::PANEL_TAB_LIGHTBOX => [
'lightbox' => [
'label' => __( 'Lightbox', 'elementor' ),
'controls' => [
'elementor_global_image_lightbox' => [
'label' => __( 'Image Lightbox', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'description' => __( 'Open all image links in a lightbox popup window. The lightbox will automatically work on any link that leads to an image file.', 'elementor' ),
'frontend_available' => true,
],
'elementor_lightbox_enable_counter' => [
'label' => __( 'Counter', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'frontend_available' => true,
],
'elementor_lightbox_enable_fullscreen' => [
'label' => __( 'Fullscreen', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'frontend_available' => true,
],
'elementor_lightbox_enable_zoom' => [
'label' => __( 'Zoom', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'frontend_available' => true,
],
'elementor_lightbox_enable_share' => [
'label' => __( 'Share', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
'frontend_available' => true,
],
'elementor_lightbox_title_src' => [
'label' => __( 'Title', 'elementor' ),
'type' => Controls_Manager::SELECT,
'options' => [
'' => __( 'None', 'elementor' ),
'title' => __( 'Title', 'elementor' ),
'caption' => __( 'Caption', 'elementor' ),
'alt' => __( 'Alt', 'elementor' ),
'description' => __( 'Description', 'elementor' ),
],
'default' => 'title',
'frontend_available' => true,
],
'elementor_lightbox_description_src' => [
'label' => __( 'Description', 'elementor' ),
'type' => Controls_Manager::SELECT,
'options' => [
'' => __( 'None', 'elementor' ),
'title' => __( 'Title', 'elementor' ),
'caption' => __( 'Caption', 'elementor' ),
'alt' => __( 'Alt', 'elementor' ),
'description' => __( 'Description', 'elementor' ),
],
'default' => 'description',
'frontend_available' => true,
],
'elementor_lightbox_color' => [
'label' => __( 'Background Color', 'elementor' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.elementor-lightbox' => 'background-color: {{VALUE}}',
],
],
'elementor_lightbox_ui_color' => [
'label' => __( 'UI Color', 'elementor' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.elementor-lightbox' => '--lightbox-ui-color: {{VALUE}}',
],
],
'elementor_lightbox_ui_color_hover' => [
'label' => __( 'UI Hover Color', 'elementor' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.elementor-lightbox' => '--lightbox-ui-color-hover: {{VALUE}}',
],
],
'elementor_lightbox_text_color' => [
'label' => __( 'Text Color', 'elementor' ),
'type' => Controls_Manager::COLOR,
'selectors' => [
'.elementor-lightbox' => '--lightbox-text-color: {{VALUE}}',
],
],
'lightbox_icons_size' => [
'label' => __( 'Toolbar Icons Size', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'selectors' => [
'.elementor-lightbox' => '--lightbox-header-icons-size: {{SIZE}}{{UNIT}}',
],
'separator' => 'before',
],
'lightbox_slider_icons_size' => [
'label' => __( 'Navigation Icons Size', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'selectors' => [
'.elementor-lightbox' => '--lightbox-navigation-icons-size: {{SIZE}}{{UNIT}}',
],
'separator' => 'before',
],
],
],
],
];
}
/**
* Register model controls.
*
* Used to add new controls to the global settings model.
*
* @since 1.6.0
* @access protected
*/
protected function _register_controls() {
$controls_list = self::get_controls_list();
foreach ( $controls_list as $tab_name => $sections ) {
foreach ( $sections as $section_name => $section_data ) {
$this->start_controls_section(
$section_name, [
'label' => $section_data['label'],
'tab' => $tab_name,
]
);
foreach ( $section_data['controls'] as $control_name => $control_data ) {
$this->add_control( $control_name, $control_data );
}
$this->end_controls_section();
}
}
}
}
PK 4\$` ` general/manager.phpnu W+A add_panel_tabs();
}
/**
* Get manager name.
*
* Retrieve general settings manager name.
*
* @since 1.6.0
* @access public
*
* @return string Manager name.
*/
public function get_name() {
return 'general';
}
/**
* Get model for config.
*
* Retrieve the model for settings configuration.
*
* @since 1.6.0
* @access public
*
* @return BaseModel The model object.
*/
public function get_model_for_config() {
return $this->get_model();
}
/**
* Get saved settings.
*
* Retrieve the saved settings from the site options.
*
* @since 1.6.0
* @access protected
*
* @param int $id Post ID.
*
* @return array Saved settings.
*/
protected function get_saved_settings( $id ) {
$model_controls = Model::get_controls_list();
$settings = [];
foreach ( $model_controls as $tab_name => $sections ) {
foreach ( $sections as $section_name => $section_data ) {
foreach ( $section_data['controls'] as $control_name => $control_data ) {
$saved_setting = get_option( $control_name, null );
if ( null !== $saved_setting ) {
$settings[ $control_name ] = $saved_setting;
}
}
}
}
return $settings;
}
/**
* Get CSS file name.
*
* Retrieve CSS file name for the general settings manager.
*
* @since 1.6.0
* @access protected
* @return string
*
* @return string CSS file name.
*/
protected function get_css_file_name() {
return 'global';
}
/**
* Save settings to DB.
*
* Save general settings to the database, as site options.
*
* @since 1.6.0
* @access protected
*
* @param array $settings Settings.
* @param int $id Post ID.
*/
protected function save_settings_to_db( array $settings, $id ) {
$model_controls = Model::get_controls_list();
$one_list_settings = [];
foreach ( $model_controls as $tab_name => $sections ) {
foreach ( $sections as $section_name => $section_data ) {
foreach ( $section_data['controls'] as $control_name => $control_data ) {
if ( isset( $settings[ $control_name ] ) ) {
$one_list_control_name = str_replace( 'elementor_', '', $control_name );
$one_list_settings[ $one_list_control_name ] = $settings[ $control_name ];
update_option( $control_name, $settings[ $control_name ] );
} else {
delete_option( $control_name );
}
}
}
}
// Save all settings in one list for a future usage
if ( ! empty( $one_list_settings ) ) {
update_option( self::META_KEY, $one_list_settings );
} else {
delete_option( self::META_KEY );
}
}
/**
* Get model for CSS file.
*
* Retrieve the model for the CSS file.
*
* @since 1.6.0
* @access protected
*
* @param Base $css_file The requested CSS file.
*
* @return BaseModel The model object.
*/
protected function get_model_for_css_file( Base $css_file ) {
return $this->get_model();
}
/**
* Get CSS file for update.
*
* Retrieve the CSS file before updating the it.
*
* @since 1.6.0
* @access protected
*
* @param int $id Post ID.
*
* @return Global_CSS The global CSS file object.
*/
protected function get_css_file_for_update( $id ) {
return Global_CSS::create( 'global.css' );
}
/**
* Add panel tabs.
*
* Register new panel tab for the lightbox settings.
*
* @since 1.6.0
* @access private
*/
private function add_panel_tabs() {
Controls_Manager::add_tab( self::PANEL_TAB_LIGHTBOX, __( 'Lightbox', 'elementor' ) );
}
}
PK 4\jcS|j j page/model.phpnu W+A post = get_post( $data['id'] );
if ( ! $this->post ) {
$this->post = new \WP_Post( (object) [] );
}
if ( wp_is_post_revision( $this->post->ID ) ) {
$this->post_parent = get_post( $this->post->post_parent );
} else {
$this->post_parent = $this->post;
}
parent::__construct( $data );
}
/**
* Get model name.
*
* Retrieve page settings model name.
*
* @since 1.6.0
* @access public
*
* @return string Model name.
*/
public function get_name() {
return 'page-settings';
}
/**
* Get model unique name.
*
* Retrieve page settings model unique name.
*
* @since 1.6.0
* @access public
*
* @return string Model unique name.
*/
public function get_unique_name() {
return $this->get_name() . '-' . $this->post->ID;
}
/**
* Get CSS wrapper selector.
*
* Retrieve the wrapper selector for the page settings model.
*
* @since 1.6.0
* @access public
*
* @return string CSS wrapper selector.
*/
public function get_css_wrapper_selector() {
$document = Plugin::$instance->documents->get( $this->post_parent->ID );
return $document->get_css_wrapper_selector();
}
/**
* Get panel page settings.
*
* Retrieve the panel setting for the page settings model.
*
* @since 1.6.0
* @access public
*
* @return array {
* Panel settings.
*
* @type string $title The panel title.
* }
*/
public function get_panel_page_settings() {
$document = Plugin::$instance->documents->get( $this->post->ID );
return [
/* translators: %s: Document title */
'title' => sprintf( __( '%s Settings', 'elementor' ), $document::get_title() ),
];
}
/**
* On export post meta.
*
* When exporting data, check if the post is not using page template and
* exclude it from the exported Elementor data.
*
* @since 1.6.0
* @access public
*
* @param array $element_data Element data.
*
* @return array Element data to be exported.
*/
public function on_export( $element_data ) {
if ( ! empty( $element_data['settings']['template'] ) ) {
/**
* @var \Elementor\Modules\PageTemplates\Module $page_templates_module
*/
$page_templates_module = Plugin::$instance->modules_manager->get_modules( 'page-templates' );
$is_elementor_template = ! ! $page_templates_module->get_template_path( $element_data['settings']['template'] );
if ( ! $is_elementor_template ) {
unset( $element_data['settings']['template'] );
}
}
return $element_data;
}
/**
* Register model controls.
*
* Used to add new controls to the page settings model.
*
* @since 1.6.0
* @access protected
*/
protected function _register_controls() {
// Check if it's a real model, or abstract (for example - on import )
if ( $this->post->ID ) {
$document = Plugin::$instance->documents->get_doc_or_auto_save( $this->post->ID );
if ( $document ) {
$controls = $document->get_controls();
foreach ( $controls as $control_id => $args ) {
$this->add_control( $control_id, $args );
}
}
}
}
}
PK 4\p>! ! page/manager.phpnu W+A editor->is_edit_mode() ) {
return null;
}
if ( Plugin::$instance->editor->is_edit_mode() ) {
$post_id = Plugin::$instance->editor->get_post_id();
$document = Plugin::$instance->documents->get_doc_or_auto_save( $post_id );
} else {
$post_id = get_the_ID();
$document = Plugin::$instance->documents->get_doc_for_frontend( $post_id );
}
if ( ! $document ) {
return null;
}
$model = $this->get_model( $document->get_post()->ID );
if ( $document->is_autosave() ) {
$model->set_settings( 'post_status', $document->get_main_post()->post_status );
}
return $model;
}
/**
* Ajax before saving settings.
*
* Validate the data before saving it and updating the data in the database.
*
* @since 1.6.0
* @access public
*
* @param array $data Post data.
* @param int $id Post ID.
*
* @throws \Exception If invalid post returned using the `$id`.
* @throws \Exception If current user don't have permissions to edit the post.
*/
public function ajax_before_save_settings( array $data, $id ) {
$post = get_post( $id );
if ( empty( $post ) ) {
throw new \Exception( 'Invalid post.', Exceptions::NOT_FOUND );
}
if ( ! current_user_can( 'edit_post', $id ) ) {
throw new \Exception( 'Access denied.', Exceptions::FORBIDDEN );
}
// Avoid save empty post title.
if ( ! empty( $data['post_title'] ) ) {
$post->post_title = $data['post_title'];
}
if ( isset( $data['post_excerpt'] ) && post_type_supports( $post->post_type, 'excerpt' ) ) {
$post->post_excerpt = $data['post_excerpt'];
}
if ( isset( $data['post_status'] ) ) {
$this->save_post_status( $id, $data['post_status'] );
unset( $post->post_status );
}
wp_update_post( $post );
// Check updated status
if ( DB::STATUS_PUBLISH === get_post_status( $id ) ) {
$autosave = wp_get_post_autosave( $post->ID );
if ( $autosave ) {
wp_delete_post_revision( $autosave->ID );
}
}
if ( isset( $data['post_featured_image'] ) && post_type_supports( $post->post_type, 'thumbnail' ) ) {
if ( empty( $data['post_featured_image']['id'] ) ) {
delete_post_thumbnail( $post->ID );
} else {
set_post_thumbnail( $post->ID, $data['post_featured_image']['id'] );
}
}
if ( Utils::is_cpt_custom_templates_supported() ) {
$template = get_metadata( 'post', $post->ID, '_wp_page_template', true );
if ( isset( $data['template'] ) ) {
$template = $data['template'];
}
if ( empty( $template ) ) {
$template = 'default';
}
// Use `update_metadata` in order to save also for revisions.
update_metadata( 'post', $post->ID, '_wp_page_template', $template );
}
}
/**
* @inheritDoc
*
* Override parent because the page setting moved to document.settings.
*/
protected function print_editor_template_content( $name ) {
?>
<#
const tabs = elementor.config.document.settings.tabs;
if ( Object.values( tabs ).length > 1 ) { #>
<# _.each( tabs, function( tabTitle, tabSlug ) { #>
<# } ); #>
<# } #>
get_post_id();
if ( $css_file instanceof Post_Preview ) {
$autosave = Utils::get_post_autosave( $post_id );
if ( $autosave ) {
$post_id = $autosave->ID;
}
}
return $this->get_model( $post_id );
}
/**
* Get special settings names.
*
* Retrieve the names of the special settings that are not saved as regular
* settings. Those settings have a separate saving process.
*
* @since 1.6.0
* @access protected
*
* @return array Special settings names.
*/
protected function get_special_settings_names() {
return [
'id',
'post_title',
'post_status',
'template',
'post_excerpt',
'post_featured_image',
];
}
/**
* @since 2.0.0
* @access public
*
* @param $post_id
* @param $status
*/
public function save_post_status( $post_id, $status ) {
$parent_id = wp_is_post_revision( $post_id );
if ( $parent_id ) {
// Don't update revisions post-status
return;
}
$parent_id = $post_id;
$post = get_post( $parent_id );
$allowed_post_statuses = get_post_statuses();
if ( isset( $allowed_post_statuses[ $status ] ) ) {
$post_type_object = get_post_type_object( $post->post_type );
if ( 'publish' !== $status || current_user_can( $post_type_object->cap->publish_posts ) ) {
$post->post_status = $status;
}
}
wp_update_post( $post );
}
}
PK 4\a ` ` editor-preferences/model.phpnu W+A __( 'Editor Preferences', 'elementor' ),
];
}
/**
* @since 2.8.0
* @access protected
*/
protected function _register_controls() {
$this->start_controls_section( 'preferences', [
'tab' => Controls_Manager::TAB_SETTINGS,
'label' => __( 'Preferences', 'elementor' ),
] );
$this->add_control(
'ui_theme',
[
'label' => __( 'UI Theme', 'elementor' ),
'type' => Controls_Manager::SELECT,
'description' => __( 'Set light or dark mode, or use Auto Detect to sync it with your OS setting.', 'elementor' ),
'default' => 'auto',
'options' => [
'auto' => __( 'Auto Detect', 'elementor' ),
'light' => __( 'Light', 'elementor' ),
'dark' => __( 'Dark', 'elementor' ),
],
]
);
$this->add_control(
'edit_buttons',
[
'label' => __( 'Editing Handles', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'description' => __( 'Show editing handles when hovering over the element edit button.', 'elementor' ),
]
);
$this->add_control(
'lightbox_in_editor',
[
'label' => __( 'Enable Lightbox In Editor', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'default' => 'yes',
]
);
$this->end_controls_section();
}
}
PK 4\SԲ editor-preferences/manager.phpnu W+A get_model();
}
/**
* Get manager name.
*
* Retrieve settings manager name.
*
* @since 2.8.0
* @access public
*/
public function get_name() {
return 'editorPreferences';
}
/**
* Get saved settings.
*
* Retrieve the saved settings from the database.
*
* @since 2.8.0
* @access protected
*
* @param int $id.
* @return array
*
*/
protected function get_saved_settings( $id ) {
$settings = get_user_meta( get_current_user_id(), self::META_KEY, true );
if ( ! $settings ) {
$settings = [];
}
return $settings;
}
/**
* Save settings to DB.
*
* Save settings to the database.
*
* @param array $settings Settings.
* @param int $id Post ID.
* @since 2.8.0
* @access protected
*
*/
protected function save_settings_to_db( array $settings, $id ) {
update_user_meta( get_current_user_id(), self::META_KEY, $settings );
}
}
PK ^\|MXB XB class-ld-settings-pages.phpnu W+A string
*
* @var string $settings_page_title
*/
protected $settings_page_title = '';
/**
* Title for tab string
*
* @var string $settings_tab_title
*/
protected $settings_tab_title = '';
/**
* Priority for tab
*
* @var integer $settings_tab_priority
*/
protected $settings_tab_priority = 30;
/**
* The number of columns to show. Most admin screens will be 2. But we set to 1 for the initial.
*
* @var integer $settings_columns
*/
protected $settings_columns = 2;
/**
* Wether to show the Submit metabox.
*
* @var boolean $show_submit_meta
*/
protected $show_submit_meta = true;
/**
* Wether to show the Quick Links metabox.
*
* @var boolean $show_quick_links_meta
*/
protected $show_quick_links_meta = true;
/**
* Wether to show wrap all settings in a .
*
* @var boolean $settings_form_wrap
*/
protected $settings_form_wrap = true;
/**
* Public constructor for class
*/
public function __construct() {
global $learndash_pages;
add_action( 'admin_init', array( $this, 'admin_init' ) );
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
add_action( 'learndash_admin_tabs_set', array( $this, 'admin_tabs' ), 10 );
if ( empty( $this->settings_tab_title ) ) {
$this->settings_tab_title = $this->settings_page_title;
}
if ( ( ! empty( $this->settings_page_id ) ) && ( ! isset( $learndash_pages[ $this->settings_page_id ] ) ) ) {
$learndash_pages[] = $this->settings_page_id;
}
}
/**
* Function to get a specific setting page instance.
*
* @since 2.4.0
*
* @param string $page_key Page key to get instance of.
*
* @return object page instance
*/
final public static function get_page_instance( $page_key = '' ) {
if ( ! empty( $page_key ) ) {
if ( isset( self::$_instances[ $page_key ] ) ) {
return self::$_instances[ $page_key ];
}
}
}
/**
* Function to set/add setting page to instances array.
*
* @since 2.4.0
*/
final public static function add_page_instance() {
$section_class = get_called_class();
if ( ! isset( self::$_instances[ $section_class ] ) ) {
self::$_instances[ $section_class ] = new $section_class();
}
}
/**
* Action hook to handle admin_init processing from WP.
*/
public function admin_init() {
do_action( 'learndash_settings_page_init', $this->settings_page_id );
if ( true === $this->show_submit_meta ) {
$submit_obj = new LearnDash_Settings_Section_Side_Submit(
array(
'settings_screen_id' => $this->settings_screen_id,
'settings_page_id' => $this->settings_page_id,
)
);
}
if ( true === $this->show_quick_links_meta ) {
$ql_obj = new LearnDash_Settings_Section_Side_Quick_Links(
array(
'settings_screen_id' => $this->settings_screen_id,
'settings_page_id' => $this->settings_page_id,
)
);
}
}
/**
* Action hook to handle admin_menu processing from WP.
*/
public function admin_menu() {
if ( ! $this->settings_screen_id ) {
$this->settings_screen_id = add_submenu_page(
$this->parent_menu_page_url,
$this->settings_page_title,
$this->settings_page_title,
$this->menu_page_capability,
$this->settings_page_id,
array( $this, 'show_settings_page' )
);
}
add_action( 'load-' . $this->settings_screen_id, array( $this, 'load_settings_page' ) );
}
/**
* Action hook to handle admin_tabs processing from LearnDash.
*
* @param string $admin_menu_section Current admin menu section.
*/
public function admin_tabs( $admin_menu_section ) {
if ( $admin_menu_section === $this->parent_menu_page_url ) {
learndash_add_admin_tab_item(
$this->parent_menu_page_url,
array(
'id' => $this->settings_screen_id,
'link' => add_query_arg( array( 'page' => $this->settings_page_id ), 'admin.php' ),
'cap' => $this->menu_page_capability,
'name' => ! empty( $this->settings_tab_title ) ? $this->settings_tab_title : $this->settings_page_title,
),
$this->settings_tab_priority
);
}
}
/**
* Action hook to handle current settings page load.
*/
public function load_settings_page() {
global $learndash_assets_loaded;
if ( defined( 'LEARNDASH_SETTINGS_SECTION_TYPE' ) && ( 'metabox' === LEARNDASH_SETTINGS_SECTION_TYPE ) ) {
wp_enqueue_script( 'common' );
wp_enqueue_script( 'wp-lists' );
wp_enqueue_script( 'postbox' );
do_action( 'learndash_add_meta_boxes', $this->settings_screen_id );
add_action( 'admin_footer-' . $this->settings_screen_id, array( $this, 'load_footer_scripts' ) );
add_filter( 'screen_layout_columns', array( $this, 'screen_layout_column' ), 10, 2 );
}
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_media();
wp_enqueue_style(
'learndash_style',
LEARNDASH_LMS_PLUGIN_URL . 'assets/css/style' . leardash_min_asset() . '.css',
array(),
LEARNDASH_SCRIPT_VERSION_TOKEN
);
wp_style_add_data( 'learndash_style', 'rtl', 'replace' );
$learndash_assets_loaded['styles']['learndash_style'] = __FUNCTION__;
wp_enqueue_style(
'sfwd-module-style',
LEARNDASH_LMS_PLUGIN_URL . 'assets/css/sfwd_module' . leardash_min_asset() . '.css',
array(),
LEARNDASH_SCRIPT_VERSION_TOKEN
);
wp_style_add_data( 'sfwd-module-style', 'rtl', 'replace' );
$learndash_assets_loaded['styles']['sfwd-module-style'] = __FUNCTION__;
wp_enqueue_script(
'sfwd-module-script',
LEARNDASH_LMS_PLUGIN_URL . 'assets/js/sfwd_module' . leardash_min_asset() . '.js',
array( 'jquery' ),
LEARNDASH_SCRIPT_VERSION_TOKEN,
true
);
$learndash_assets_loaded['scripts']['sfwd-module-script'] = __FUNCTION__;
wp_localize_script( 'sfwd-module-script', 'sfwd_data', array() );
learndash_admin_settings_page_assets();
if ( isset( $_GET['ld_reset_metaboxes'] ) ) {
delete_user_meta( get_current_user_id(), 'closedpostboxes_' . $this->settings_screen_id );
delete_user_meta( get_current_user_id(), 'metaboxhidden_' . $this->settings_screen_id );
delete_user_meta( get_current_user_id(), 'meta-box-order_' . $this->settings_screen_id );
}
do_action( 'learndash-settings-page-load', $this->settings_screen_id, $this->settings_page_id );
}
/**
* Action hook to handle current settings page layout columns.
*
* @param integer $columns Number of columns to show.
* @param Object $screen Current screen object.
*
* @return integer $columns
*/
public function screen_layout_column( $columns = false, $screen_id = '' ) {
if ( $screen_id == $this->settings_screen_id ) {
$columns[ $screen_id ] = $this->settings_columns;
}
/**
* Add this filter to override the get user option logic. This is to force
* the screen layout option for user who don't have this defined.
*
* @since 2.6.0
*/
add_filter(
"get_user_option_screen_layout_{$screen_id}",
function( $option_value = '', $option_key = '' ) {
if ( "screen_layout_{$this->settings_screen_id}" === $option_key ) {
$option_value = $this->settings_columns;
}
return $option_value;
},
1,
2
);
return $columns;
}
/**
* Action hook to handle footer JS/CSS added footer
*/
public function load_footer_scripts() {
?>
settings_screen_id, $this->settings_page_id );
}
/**
* Fucntion to handle showing of Settings page. This is the main function for all visible
* output. Extending classes can implement its own function.
*/
public function show_settings_page() {
if ( defined( 'LEARNDASH_SETTINGS_SECTION_TYPE' ) && ( 'metabox' === LEARNDASH_SETTINGS_SECTION_TYPE ) ) {
?>
settings_screen_id, $this->settings_page_id ); ?>
get_admin_page_title(); ?>
settings_screen_id, $this->settings_page_id ); ?>
settings_screen_id, $this->settings_page_id ); ?>
get_admin_page_form( true ); ?>
settings_screen_id, $this->settings_page_id ); ?>
settings_page_id ); ?>
settings_screen_id, 'side', null ); ?>
settings_screen_id, $this->settings_page_id ); ?>
settings_screen_id, 'normal', null ); ?>
settings_screen_id, 'advanced', null ); ?>
settings_screen_id, $this->settings_page_id ); ?>
settings_screen_id, $this->settings_page_id ); ?>
get_admin_page_form( false ); ?>
settings_screen_id, $this->settings_page_id ); ?>
get_admin_page_title(); ?>
get_admin_page_form( true ); ?>
settings_page_id );
do_settings_sections( $this->settings_page_id );
?>
get_admin_page_form( false ); ?>
' . esc_html( get_admin_page_title() ) . '' );
} else {
return ' ';
}
}
/**
* Class utility function to return the form wrapper. Supports
* the beginning .
*
* @param boolean $start Flag to indicate if showing start or end of form.
*
* @return string form HTML.
*/
public function get_admin_page_form( $start = true ) {
if ( true === $this->settings_form_wrap ) {
if ( true === $start ) {
return apply_filters( 'learndash_admin_page_form', '', $start );
}
}
}
// End of functions.
}
}
function learndash_admin_settings_page_assets() {
global $learndash_assets_loaded;
if ( ( defined( 'LEARNDASH_SELECT2_LIB' ) ) && ( true === apply_filters( 'learndash_select2_lib', LEARNDASH_SELECT2_LIB ) ) ) {
if ( ! isset( $learndash_assets_loaded['styles']['learndash-select2-jquery-style'] ) ) {
wp_enqueue_style(
'learndash-select2-jquery-style',
LEARNDASH_LMS_PLUGIN_URL . 'assets/vendor/select2-jquery/css/select2.min.css',
array(),
LEARNDASH_SCRIPT_VERSION_TOKEN
);
//wp_style_add_data( 'learndash-select2-jquery-style', 'rtl', 'replace' );
$learndash_assets_loaded['styles']['learndash-select2-jquery-style'] = __FUNCTION__;
}
if ( ! isset( $learndash_assets_loaded['scripts']['learndash-select2-jquery-script'] ) ) {
wp_enqueue_script(
'learndash-select2-jquery-script',
LEARNDASH_LMS_PLUGIN_URL . 'assets/vendor/select2-jquery/js/select2.min.js',
array( 'jquery' ),
LEARNDASH_SCRIPT_VERSION_TOKEN,
true
);
$learndash_assets_loaded['scripts']['learndash-select2-jquery-script'] = __FUNCTION__;
}
}
if ( ! isset( $learndash_assets_loaded['styles']['learndash-admin-settings-page'] ) ) {
wp_enqueue_style(
'learndash-admin-settings-page',
LEARNDASH_LMS_PLUGIN_URL . 'assets/css/learndash-admin-settings-page' . leardash_min_asset() . '.css',
array(),
LEARNDASH_SCRIPT_VERSION_TOKEN
);
wp_style_add_data( 'learndash-admin-settings-page', 'rtl', 'replace' );
$learndash_assets_loaded['styles']['learndash-admin-settings-page'] = __FUNCTION__;
}
if ( ! isset( $learndash_assets_loaded['scripts']['learndash-admin-settings-page'] ) ) {
wp_enqueue_script(
'learndash-admin-settings-page',
LEARNDASH_LMS_PLUGIN_URL . 'assets/js/learndash-admin-settings-page' . leardash_min_asset() . '.js',
array( 'jquery', 'wp-color-picker' ),
LEARNDASH_SCRIPT_VERSION_TOKEN,
true
);
$learndash_assets_loaded['scripts']['learndash-admin-settings-page'] = __FUNCTION__;
$script_data = array();
$script_data = apply_filters( 'learndash_admin_settings_data', $script_data );
if ( ( empty( $script_data ) ) || ( ! is_array( $script_data ) ) ) {
$script_data = array();
}
if ( ! isset( $script_data['ajaxurl'] ) ) {
$script_data['ajaxurl'] = admin_url( 'admin-ajax.php' );
}
if ( ! isset( $script_data['admin_notice_settings_fields_errors'] ) ) {
$script_data['admin_notice_settings_fields_errors_container'] = '';
}
$script_data = array( 'json' => json_encode( $script_data ) );
wp_localize_script( 'learndash-admin-settings-page', 'learndash_admin_settings_data', $script_data );
}
}PK ^\>+6 6 class-ld-shortcodes-sections.phpnu W+A init_shortcodes_section_fields();
}
/**
* Initialize the Shortcodes Fields.
*/
public function init_shortcodes_section_fields() {
foreach ( $this->shortcodes_option_fields as $field_id => $setting_option_field ) {
if ( ! isset( $setting_option_field['label_for'] ) ) {
$setting_option_field['label_for'] = $setting_option_field['id'];
}
if ( ! isset( $setting_option_field['label_for'] ) ) {
$setting_option_field['label_for'] = $setting_option_field['id'];
}
$setting_option_field['setting_option_key'] = $setting_option_field['id'];
if ( ! isset( $setting_option_field['display_callback'] ) ) {
$display_ref = LearnDash_Settings_Fields::get_field_instance( $setting_option_field['type'] );
if ( ! $display_ref ) {
$setting_option_field['display_callback'] = array( $this, 'field_element_create' );
} else {
$setting_option_field['display_callback'] = array( $display_ref, 'create_section_field' );
}
}
$this->shortcodes_settings_fields[ $field_id ] = array(
'id' => $setting_option_field['id'],
'title' => $setting_option_field['label'],
'callback' => $setting_option_field['display_callback'],
'args' => $setting_option_field,
);
}
}
/**
* Section Fields Create.
*
* @param array $fields_args Field Args.
*/
public function field_element_create( $field_args = array() ) {
$field_html = '';
if ( ( isset( $field_args['display_func'] ) ) && ( ! empty( $field_args['display_func'] ) ) && ( is_callable( $field_args['display_func'] ) ) ) {
call_user_func(
$field_args['display_func'],
$field_args,
$this->setting_field_prefix
);
}
}
/**
* Show Section Fields.
*/
public function show_section_fields() {
$this->show_shortcodes_section_header();
echo LearnDash_Settings_Fields::show_section_fields( $this->shortcodes_settings_fields );
$this->show_shortcodes_section_footer();
}
/**
* Show Section Header.
*/
public function show_shortcodes_section_header() {
?>
to allow adding JS/CSS
}
/**
* Get Section Key.
*/
public function get_shortcodes_section_key() {
return $this->shortcodes_section_key;
}
/**
* Get Section Title.
*/
public function get_shortcodes_section_title() {
return $this->shortcodes_section_title;
}
/**
* Show Section Key.
*/
public function show_shortcodes_section_title() {
if ( ! empty( $this->shortcodes_section_title ) ) {
?>
shortcodes_section_title; ?> [shortcodes_section_key; ?>]
shortcodes_section_description;
}
/**
* Show Section Description.
*/
public function show_shortcodes_section_description() {
if ( ! empty( $this->shortcodes_section_description ) ) {
echo wpautop( $this->shortcodes_section_description );
}
}
/**
* Get Shortcode field by key;
*/
public function get_shortcodes_section_field( $field_key = '' ) {
if ( ( ! empty( $field_key ) ) && ( isset( $this->shortcodes_option_fields[ $field_key ] ) ) ) {
return $this->shortcodes_option_fields[ $field_key ];
}
}
}
}
PK ^\s 7 settings-pages/class-ld-settings-page-data-upgrades.phpnu W+A parent_menu_page_url = 'admin.php?page=learndash_lms_settings';
$this->menu_page_capability = LEARNDASH_ADMIN_CAPABILITY_CHECK;
$this->settings_page_id = 'learndash_data_upgrades';
$this->settings_page_title = esc_html__( 'Data Upgrades', 'learndash' );
$this->settings_tab_title = $this->settings_page_title;
$this->settings_tab_priority = 30;
$this->settings_columns = 1;
$this->show_submit_meta = false;
$this->show_quick_links_meta = false;
parent::__construct();
}
/**
* Action function called when Add-ons page is loaded.
*
* @since 2.5.5
*/
public function load_settings_page() {
global $learndash_assets_loaded;
parent::load_settings_page();
wp_enqueue_style(
'learndash-admin-style',
LEARNDASH_LMS_PLUGIN_URL . 'assets/css/learndash-admin-style' . leardash_min_asset() . '.css',
array(),
LEARNDASH_SCRIPT_VERSION_TOKEN
);
wp_style_add_data( 'learndash-admin-style', 'rtl', 'replace' );
$learndash_assets_loaded['styles']['learndash-admin-style'] = __FUNCTION__;
wp_enqueue_script(
'learndash-admin-settings-data-upgrades-script',
LEARNDASH_LMS_PLUGIN_URL . 'assets/js/learndash-admin-settings-data-upgrades' . leardash_min_asset() . '.js',
array( 'jquery' ),
LEARNDASH_SCRIPT_VERSION_TOKEN,
true
);
$learndash_assets_loaded['scripts']['learndash-admin-settings-data-upgrades-script'] = __FUNCTION__;
}
}
}
add_action(
'learndash_settings_pages_init',
function() {
LearnDash_Settings_Page_Data_Upgrades::add_page_instance();
}
);
PK ^\Aź 9 settings-pages/class-ld-settings-page-quizzes-options.phpnu W+A parent_menu_page_url = 'edit.php?post_type=sfwd-quiz';
$this->menu_page_capability = LEARNDASH_ADMIN_CAPABILITY_CHECK;
$this->settings_page_id = 'quizzes-options';
$this->settings_tab_priority = 10;
$this->settings_page_title = esc_html_x( 'Settings', 'Quiz Settings', 'learndash' );
$this->show_submit_meta = true;
$this->show_quick_links_meta = true;
parent::__construct();
}
/**
* Action hook to handle admin_tabs processing from LearnDash.
*
* @param string $admin_menu_section Current admin menu section.
*/
public function admin_tabs( $admin_menu_section ) {
if ( ( $admin_menu_section === $this->parent_menu_page_url ) || ( 'edit.php?post_type=sfwd-essays' ) ) {
learndash_add_admin_tab_item(
$this->parent_menu_page_url,
array(
'id' => $this->settings_screen_id,
'link' => add_query_arg( array( 'page' => $this->settings_page_id ), 'admin.php' ),
'name' => ! empty( $this->settings_tab_title ) ? $this->settings_tab_title : $this->settings_page_title,
),
$this->settings_tab_priority
);
}
}
// End of functions.
}
}
add_action(
'learndash_settings_pages_init',
function() {
LearnDash_Settings_Page_Quizzes_Options::add_page_instance();
}
);
PK ^\ir3| | @ settings-pages/class-ld-settings-page-quizzes-builder-single.phpnu W+A parent_menu_page_url = 'edit.php?post_type=sfwd-quiz';
$this->menu_page_capability = LEARNDASH_ADMIN_CAPABILITY_CHECK;
$this->settings_page_id = 'quizzes-builder';
$this->settings_page_title = sprintf(
// translators: placeholder: Quiz.
esc_html_x( '%s Builder', 'placeholder: Quiz', 'learndash' ),
LearnDash_Custom_Label::get_label( 'quiz' )
);
$this->settings_tab_title = $this->settings_page_title;
add_action( 'load-sfwd-quiz_page_quizzes-builder', array( $this, 'on_load' ) );
add_filter( 'post_row_actions', array( $this, 'learndash_quiz_row_actions' ), 20, 2 );
add_filter( 'learndash_admin_tab_sets', array( $this, 'admin_tab_sets' ), 15, 2 );
add_action( 'admin_notices', array( $this, 'admin_notice' ) );
parent::__construct();
}
/**
* Action function called after title is displayed.
*
* @since 2.4.0
*
* @param string $settings_screen_id Current screen ID.
*/
public function settings_page_after_title( $settings_screen_id = '' ) {
if ( $this->settings_screen_id == $settings_screen_id ) {
if ( ( isset( $_GET['quiz_id'] ) ) && ( ! empty( $_GET['quiz_id'] ) ) ) {
$quiz_id = intval( $_GET['quiz_id'] );
$quiz_post = get_post( $quiz_id );
if ( ( $quiz_post ) && ( is_a( $quiz_post, 'WP_Post' ) ) && ( learndash_get_post_type_slug( 'quiz' ) === $quiz_post->post_type ) ) {
?>
', $start );
} else {
return apply_filters( 'learndash_admin_page_form', '', $start );
}
}
/**
* Action hook when settings screen is being shown.
*/
public function on_load() {
if ( is_admin() ) {
// If the Course Builder screen is being shown...
$current_screen = get_current_screen();
if ( 'sfwd-quiz_page_quizzes-builder' === $current_screen->id ) {
// ...but the 'course_id' query parameters is not found...
if ( ( ! isset( $_GET['quiz_id'] ) ) || ( empty( $_GET['quiz_id'] ) ) ) {
// ...then redirect back to the courses listin screen.
$quizzes_list_url = add_query_arg( 'post_type', 'sfwd-quiz', admin_url( 'edit.php' ) );
wp_safe_redirect( $quizzes_list_url );
} else {
$this->cb = Learndash_Admin_Metabox_Quiz_Builder::add_instance( 'Learndash_Admin_Metabox_Quiz_Builder' );
$this->save_cb_metabox();
$this->cb->builder_on_load();
}
}
}
}
/**
* Called when metabox is being saved.
*/
public function save_cb_metabox() {
if ( ( isset( $_GET['quiz_id'] ) ) && ( ! empty( $_GET['quiz_id'] ) ) ) {
$quiz_id = intval( $_GET['quiz_id'] );
$quiz_post = get_post( $quiz_id );
if ( ( $quiz_post ) && ( is_a( $quiz_post, 'WP_Post' ) ) && ( learndash_get_post_type_slug( 'quiz' ) === $quiz_post->post_type ) ) {
$this->update_success = $this->cb->save_course_builder( $quiz_id, $quiz_post, true );
}
}
}
/**
* Function to show admin notices on settings page.
*/
public function admin_notice() {
if ( true === $this->update_success ) {
?>
%s',
add_query_arg(
array(
'currentTab' => 'learndash_quiz_builder',
),
get_edit_post_link( $quiz_post->ID )
),
esc_attr( $quiz_label ),
esc_html__( 'Builder', 'learndash' )
);
}
}
}
return $row_actions;
}
/**
* Filter the LearnDash admin menu (tabs). We remove the 'Course Builder' tab until needed.
*
* @since 2.5.0
*
* @param array $admin_menu_set Current Menu set array.
* @param string $admin_menu_key Current menu key.
*
* @return array $admin_menu_set
*/
public function admin_tab_sets( $admin_menu_set = array(), $admin_menu_key = '' ) {
if ( 'edit.php?post_type=' . learndash_get_post_type_slug( 'quiz' ) === $admin_menu_key ) {
if ( ( ! isset( $_GET['quiz_id'] ) ) || ( empty( $_GET['quiz_id'] ) ) ) {
// If we don't have the 'course_id' URL parameter then we remove the tab.
foreach ( $admin_menu_set as $menu_idx => $menu_item ) {
if ( 'sfwd-quiz_page_quizzes-builder' === $menu_item['id'] ) {
unset( $admin_menu_set[ $menu_idx ] );
break;
}
}
} else {
// Else of we do have the 'quiz_id' URL parameter we include this in the tab URL.
foreach ( $admin_menu_set as $menu_idx => &$menu_item ) {
if ( 'sfwd-quiz_page_quizzes-builder' === $menu_item['id'] ) {
$menu_item['link'] = add_query_arg( 'quiz_id', intval( $_GET['quiz_id'] ), $menu_item['link'] );
break;
}
}
}
}
return $admin_menu_set;
}
}
}
add_action(
'learndash_settings_pages_init',
function() {
LearnDash_Settings_Page_Quiz_Builder_Single::add_page_instance();
}
);
PK ^\Fh 7 settings-pages/class-ld-settings-page-custom-labels.phpnu W+A parent_menu_page_url = 'admin.php?page=learndash_lms_settings';
$this->menu_page_capability = LEARNDASH_ADMIN_CAPABILITY_CHECK;
$this->settings_page_id = 'learndash_lms_settings_custom_labels';
$this->settings_page_title = esc_html__( 'Custom Labels', 'learndash' );
$this->settings_tab_title = $this->settings_page_title;
$this->settings_tab_priority = 20;
$this->show_quick_links_meta = false;
parent::__construct();
}
}
}
add_action(
'learndash_settings_pages_init',
function() {
LearnDash_Settings_Page_Custom_Labels::add_page_instance();
}
);
PK ^\