Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/embedpre.../EmbedPre.../Ends/Back/Settings
File: EmbedpressSettings.php
<?php
[0] Fix | Delete
namespace EmbedPress\Ends\Back\Settings;
[1] Fix | Delete
[2] Fix | Delete
use EmbedPress\Includes\Classes\Helper;
[3] Fix | Delete
[4] Fix | Delete
class EmbedpressSettings {
[5] Fix | Delete
var $page_slug = '';
[6] Fix | Delete
/**
[7] Fix | Delete
* @var int|string
[8] Fix | Delete
*/
[9] Fix | Delete
protected $file_version;
[10] Fix | Delete
[11] Fix | Delete
public function __construct($page_slug = 'embedpress') {
[12] Fix | Delete
$this->page_slug = $page_slug;
[13] Fix | Delete
$this->file_version = defined( 'WP_DEBUG') && WP_DEBUG ? time() : EMBEDPRESS_VERSION;
[14] Fix | Delete
add_action('admin_enqueue_scripts', [$this, 'handle_scripts_and_styles']);
[15] Fix | Delete
add_action('admin_menu', [$this, 'register_menu']);
[16] Fix | Delete
add_action( 'init', [$this, 'save_settings']);
[17] Fix | Delete
[18] Fix | Delete
// ajax
[19] Fix | Delete
add_action( 'wp_ajax_embedpress_elements_action', [$this, 'update_elements_list']);
[20] Fix | Delete
add_action( 'wp_ajax_embedpress_settings_action', [$this, 'save_settings']);
[21] Fix | Delete
[22] Fix | Delete
[23] Fix | Delete
// Migration
[24] Fix | Delete
$option = 'embedpress_elements_updated'; // to update initially for backward compatibility
[25] Fix | Delete
if ( !get_option( $option, false) ) {
[26] Fix | Delete
$elements_initial_states = [
[27] Fix | Delete
'gutenberg' => [
[28] Fix | Delete
'google-docs-block' => 'google-docs-block',
[29] Fix | Delete
'document' => 'document',
[30] Fix | Delete
'embedpress' => 'embedpress',
[31] Fix | Delete
'embedpress-pdf' => 'embedpress-pdf',
[32] Fix | Delete
'google-sheets-block' => 'google-sheets-block',
[33] Fix | Delete
'google-slides-block' => 'google-slides-block',
[34] Fix | Delete
'youtube-block' => 'youtube-block',
[35] Fix | Delete
'google-forms-block' => 'google-forms-block',
[36] Fix | Delete
'google-drawings-block' => 'google-drawings-block',
[37] Fix | Delete
'google-maps-block' => 'google-maps-block',
[38] Fix | Delete
'twitch-block' => 'twitch-block',
[39] Fix | Delete
'wistia-block' => 'wistia-block',
[40] Fix | Delete
'vimeo-block' => 'vimeo-block',
[41] Fix | Delete
],
[42] Fix | Delete
'elementor' => [
[43] Fix | Delete
'embedpress-document' => 'embedpress-document',
[44] Fix | Delete
'embedpress' => 'embedpress',
[45] Fix | Delete
'embedpress-pdf' => 'embedpress-pdf',
[46] Fix | Delete
]
[47] Fix | Delete
];
[48] Fix | Delete
[49] Fix | Delete
$settings = get_option( EMBEDPRESS_PLG_NAME, [] );
[50] Fix | Delete
$yt = get_option( EMBEDPRESS_PLG_NAME.':youtube' );
[51] Fix | Delete
if ( empty( $settings) && empty( $yt) ) {
[52] Fix | Delete
$settings['need_first_time_redirect'] = true;
[53] Fix | Delete
}
[54] Fix | Delete
if ( !isset( $settings['enablePluginInAdmin']) ) {
[55] Fix | Delete
$settings['enablePluginInAdmin'] = 1;
[56] Fix | Delete
}
[57] Fix | Delete
if ( !isset( $settings['enablePluginInFront']) ) {
[58] Fix | Delete
$settings['enablePluginInFront'] = 1;
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
update_option( EMBEDPRESS_PLG_NAME.":elements", $elements_initial_states);
[62] Fix | Delete
update_option( EMBEDPRESS_PLG_NAME, $settings);
[63] Fix | Delete
update_option( $option, true);
[64] Fix | Delete
}
[65] Fix | Delete
$migration_v_320 = 'embedpress_v_320_migration';
[66] Fix | Delete
if ( !get_option( $migration_v_320, false) ) {
[67] Fix | Delete
$elements = (array) get_option( EMBEDPRESS_PLG_NAME.":elements", []);
[68] Fix | Delete
$elements['gutenberg']['embedpress-pdf'] = 'embedpress-pdf';
[69] Fix | Delete
$elements['elementor']['embedpress-pdf'] = 'embedpress-pdf';
[70] Fix | Delete
update_option( EMBEDPRESS_PLG_NAME.":elements", $elements);
[71] Fix | Delete
update_option( $migration_v_320, true);
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
$migration_v_330 = 'embedpress_v_330_migration';
[75] Fix | Delete
if ( !get_option( $migration_v_330, false) ) {
[76] Fix | Delete
$elements = (array) get_option( EMBEDPRESS_PLG_NAME.":elements", []);
[77] Fix | Delete
$elements['gutenberg']['embedpress-calendar'] = 'embedpress-calendar';
[78] Fix | Delete
$elements['elementor']['embedpress-calendar'] = 'embedpress-calendar';
[79] Fix | Delete
update_option( EMBEDPRESS_PLG_NAME.":elements", $elements);
[80] Fix | Delete
update_option( $migration_v_330, true);
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
add_action( 'admin_init', [$this, 'embedpress_maybe_redirect_to_settings'] );
[84] Fix | Delete
[85] Fix | Delete
[86] Fix | Delete
[87] Fix | Delete
[88] Fix | Delete
}
[89] Fix | Delete
function embedpress_maybe_redirect_to_settings() {
[90] Fix | Delete
$settings = get_option( EMBEDPRESS_PLG_NAME, [] );
[91] Fix | Delete
if ( isset( $settings['need_first_time_redirect']) && $settings['need_first_time_redirect'] ) {
[92] Fix | Delete
if ( get_option( 'embedpress_activation_redirect_done' ) || wp_doing_ajax() ) {
[93] Fix | Delete
return;
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
[97] Fix | Delete
update_option( 'embedpress_activation_redirect_done', true );
[98] Fix | Delete
$settings['need_first_time_redirect'] = false;
[99] Fix | Delete
update_option( EMBEDPRESS_PLG_NAME, $settings);
[100] Fix | Delete
[101] Fix | Delete
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
[102] Fix | Delete
return;
[103] Fix | Delete
}
[104] Fix | Delete
[105] Fix | Delete
wp_safe_redirect( admin_url('admin.php?page='.$this->page_slug) );
[106] Fix | Delete
exit;
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
}
[110] Fix | Delete
public function update_elements_list() {
[111] Fix | Delete
[112] Fix | Delete
if (!current_user_can('manage_options')) {
[113] Fix | Delete
wp_send_json_error(array('message' => 'You do not have sufficient permissions to access this functionality.'));
[114] Fix | Delete
return;
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
if ( !empty($_POST['_wpnonce'] && wp_verify_nonce( $_POST['_wpnonce'], 'embedpress_elements_action')) ) {
[118] Fix | Delete
$option = EMBEDPRESS_PLG_NAME.":elements";
[119] Fix | Delete
$elements = (array) get_option( $option, []);
[120] Fix | Delete
$settings = (array) get_option( EMBEDPRESS_PLG_NAME, []);
[121] Fix | Delete
[122] Fix | Delete
$type = !empty( $_POST['element_type']) ? sanitize_text_field( $_POST['element_type']) : '';
[123] Fix | Delete
$name = !empty( $_POST['element_name']) ? sanitize_text_field( $_POST['element_name']) : '';
[124] Fix | Delete
$checked = !empty( $_POST['checked']) ? $_POST['checked'] : false;
[125] Fix | Delete
if ( 'false' != $checked ) {
[126] Fix | Delete
$elements[$type][$name] = $name;
[127] Fix | Delete
if ( $type === 'classic' ) {
[128] Fix | Delete
$settings[$name] = 1;
[129] Fix | Delete
}
[130] Fix | Delete
}else{
[131] Fix | Delete
if( isset( $elements[$type]) && isset( $elements[$type][$name])){
[132] Fix | Delete
unset( $elements[$type][$name]);
[133] Fix | Delete
}
[134] Fix | Delete
if ( $type === 'classic' ) {
[135] Fix | Delete
$settings[$name] = 0;
[136] Fix | Delete
}
[137] Fix | Delete
}
[138] Fix | Delete
update_option( EMBEDPRESS_PLG_NAME, $settings);
[139] Fix | Delete
update_option( $option, $elements);
[140] Fix | Delete
wp_send_json_success();
[141] Fix | Delete
}
[142] Fix | Delete
wp_send_json_error();
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
public function register_menu() {
[146] Fix | Delete
add_menu_page( __('EmbedPress Settings', 'embedpress'), 'EmbedPress', 'manage_options', $this->page_slug,
[147] Fix | Delete
[ $this, 'render_settings_page' ], EMBEDPRESS_URL_ASSETS.'images/menu-icon.svg', 64 );
[148] Fix | Delete
[149] Fix | Delete
}
[150] Fix | Delete
[151] Fix | Delete
public function handle_scripts_and_styles() {
[152] Fix | Delete
if ( !empty( $_REQUEST['page']) && $this->page_slug === $_REQUEST['page'] ) {
[153] Fix | Delete
$this->enqueue_styles();
[154] Fix | Delete
$this->enqueue_scripts();
[155] Fix | Delete
}
[156] Fix | Delete
}
[157] Fix | Delete
[158] Fix | Delete
public function enqueue_scripts() {
[159] Fix | Delete
if ( !did_action( 'wp_enqueue_media') ) {
[160] Fix | Delete
wp_enqueue_media();
[161] Fix | Delete
}
[162] Fix | Delete
wp_register_script( 'ep-settings-script', EMBEDPRESS_SETTINGS_ASSETS_URL.'js/settings.js', ['jquery', 'wp-color-picker' ], $this->file_version, true );
[163] Fix | Delete
wp_enqueue_script( 'ep-settings', EMBEDPRESS_URL_ASSETS . 'js/settings.js', ['jquery', 'wp-color-picker' ], $this->file_version, true );
[164] Fix | Delete
wp_localize_script( 'ep-settings-script', 'embedpressObj', array(
[165] Fix | Delete
'nonce' => wp_create_nonce('embedpress_elements_action'),
[166] Fix | Delete
) );
[167] Fix | Delete
[168] Fix | Delete
wp_enqueue_script( 'ep-settings-script');
[169] Fix | Delete
}
[170] Fix | Delete
[171] Fix | Delete
public function enqueue_styles() {
[172] Fix | Delete
wp_enqueue_style( 'ep-settings-style', EMBEDPRESS_SETTINGS_ASSETS_URL.'css/style.css', null, $this->file_version );
[173] Fix | Delete
wp_enqueue_style( 'ep-settings-icon-style', EMBEDPRESS_SETTINGS_ASSETS_URL.'css/icon/style.css', null, $this->file_version );
[174] Fix | Delete
wp_enqueue_style( 'wp-color-picker' );
[175] Fix | Delete
[176] Fix | Delete
}
[177] Fix | Delete
[178] Fix | Delete
public function render_settings_page( ) {
[179] Fix | Delete
global $template, $page_slug, $nonce_field, $ep_page, $gen_menu_template_names, $brand_menu_template_names, $pro_active, $coming_soon, $success_message, $error_message, $platform_menu_template_names;
[180] Fix | Delete
[181] Fix | Delete
$page_slug = $this->page_slug; // make this available for included template
[182] Fix | Delete
$template = !empty( $_GET['page_type'] ) ? sanitize_text_field( $_GET['page_type']) : 'general';
[183] Fix | Delete
$nonce_field = wp_nonce_field('ep_settings_nonce', 'ep_settings_nonce', true, false);
[184] Fix | Delete
$ep_page = admin_url('admin.php?page='.$this->page_slug);
[185] Fix | Delete
$gen_menu_template_names = apply_filters('ep_general_menu_tmpl_names', ['general', 'shortcode',]);
[186] Fix | Delete
$platform_menu_template_names = apply_filters('ep_platform_menu_tmpl_names', [ 'youtube', 'vimeo', 'wistia', 'twitch','dailymotion', 'soundcloud' ,'spotify','google-calendar','opensea']);
[187] Fix | Delete
$brand_menu_template_names = apply_filters('ep_brand_menu_templates', ['custom-logo', 'branding',]);
[188] Fix | Delete
$pro_active = is_embedpress_pro_active();
[189] Fix | Delete
$coming_soon = "<span class='ep-coming-soon'>". esc_html__( '(Coming soon)', 'embedpress'). "</span>";
[190] Fix | Delete
$success_message = esc_html__( "Settings Updated", "embedpress" );
[191] Fix | Delete
$error_message = esc_html__( "Ops! Something went wrong.", "embedpress" );
[192] Fix | Delete
include_once EMBEDPRESS_SETTINGS_PATH . 'templates/main-template.php';
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
public function save_settings() {
[196] Fix | Delete
// needs to check for ajax and return response accordingly.
[197] Fix | Delete
if ( !empty( $_POST['ep_settings_nonce']) && wp_verify_nonce( $_POST['ep_settings_nonce'], 'ep_settings_nonce') ) {
[198] Fix | Delete
$submit_type = !empty( $_POST['submit'] ) ? $_POST['submit'] : '';
[199] Fix | Delete
$save_handler_method = "save_{$submit_type}_settings";
[200] Fix | Delete
do_action( "before_{$save_handler_method}");
[201] Fix | Delete
do_action( "before_embedpress_settings_save");
[202] Fix | Delete
if ( method_exists( $this, $save_handler_method ) ) {
[203] Fix | Delete
$this->$save_handler_method();
[204] Fix | Delete
}
[205] Fix | Delete
do_action( "after_embedpress_settings_save");
[206] Fix | Delete
$return_url = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : admin_url();
[207] Fix | Delete
$return_url = add_query_arg( 'success', 1, $return_url );
[208] Fix | Delete
if ( wp_doing_ajax() ) {
[209] Fix | Delete
wp_send_json_success();
[210] Fix | Delete
}
[211] Fix | Delete
wp_safe_redirect( $return_url);
[212] Fix | Delete
exit();
[213] Fix | Delete
}
[214] Fix | Delete
}
[215] Fix | Delete
[216] Fix | Delete
public function save_general_settings() {
[217] Fix | Delete
$settings = (array) get_option( EMBEDPRESS_PLG_NAME, []);
[218] Fix | Delete
$settings ['enableEmbedResizeWidth'] = isset( $_POST['enableEmbedResizeWidth']) ? intval( $_POST['enableEmbedResizeWidth']) : 600;
[219] Fix | Delete
$settings ['enableEmbedResizeHeight'] = isset( $_POST['enableEmbedResizeHeight']) ? intval( $_POST['enableEmbedResizeHeight']) : 550;
[220] Fix | Delete
$settings ['pdf_custom_color_settings'] = isset( $_POST['pdf_custom_color_settings']) ? intval( $_POST['pdf_custom_color_settings']) : 0;
[221] Fix | Delete
[222] Fix | Delete
$settings ['custom_color'] = isset( $_POST['custom_color']) ? $_POST['custom_color'] : '#333333';
[223] Fix | Delete
[224] Fix | Delete
// Pro will handle g_loading_animation settings and other
[225] Fix | Delete
$settings = apply_filters( 'ep_general_settings_before_save', $settings, $_POST);
[226] Fix | Delete
[227] Fix | Delete
update_option( EMBEDPRESS_PLG_NAME, $settings);
[228] Fix | Delete
do_action( 'ep_general_settings_after_save', $settings, $_POST);
[229] Fix | Delete
}
[230] Fix | Delete
[231] Fix | Delete
public function save_youtube_settings() {
[232] Fix | Delete
$option_name = EMBEDPRESS_PLG_NAME.':youtube';
[233] Fix | Delete
$settings = get_option( $option_name, []);
[234] Fix | Delete
$settings['api_key'] = isset( $_POST['api_key']) ? sanitize_text_field( $_POST['api_key']) : 0;
[235] Fix | Delete
$settings['pagesize'] = isset( $_POST['pagesize']) ? sanitize_text_field( $_POST['pagesize']) : 0;
[236] Fix | Delete
$settings['start_time'] = isset( $_POST['start_time']) ? sanitize_text_field( $_POST['start_time']) : 0;
[237] Fix | Delete
$settings['end_time'] = isset( $_POST['end_time']) ? sanitize_text_field( $_POST['end_time']) : 0;
[238] Fix | Delete
$settings['autoplay'] = isset( $_POST['autoplay']) ? sanitize_text_field( $_POST['autoplay']) : '';
[239] Fix | Delete
$settings['controls'] = isset( $_POST['controls']) ? sanitize_text_field( $_POST['controls']) : '';
[240] Fix | Delete
$settings['fs'] = isset( $_POST['fs']) ? sanitize_text_field( $_POST['fs']) : '';
[241] Fix | Delete
$settings['iv_load_policy'] = isset( $_POST['iv_load_policy']) ? sanitize_text_field( $_POST['iv_load_policy']) : 1;
[242] Fix | Delete
$settings['color'] = isset( $_POST['color']) ? sanitize_text_field( $_POST['color']) : 'red';
[243] Fix | Delete
$settings['rel'] = isset( $_POST['rel']) ? sanitize_text_field( $_POST['rel']) : 1;
[244] Fix | Delete
$settings['license_key'] = 1; // backward compatibility
[245] Fix | Delete
[246] Fix | Delete
// Pro will handle g_loading_animation settings and other
[247] Fix | Delete
$settings = apply_filters( 'ep_youtube_settings_before_save', $settings);
[248] Fix | Delete
update_option( $option_name, $settings);
[249] Fix | Delete
do_action( 'ep_youtube_settings_after_save', $settings);
[250] Fix | Delete
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
public function save_wistia_settings() {
[254] Fix | Delete
$option_name = EMBEDPRESS_PLG_NAME.':wistia';
[255] Fix | Delete
$settings = get_option( $option_name, []);
[256] Fix | Delete
$settings['start_time'] = isset( $_POST['start_time']) ? sanitize_text_field( $_POST['start_time']) : 0;
[257] Fix | Delete
$settings['autoplay'] = isset( $_POST['autoplay']) ? sanitize_text_field( $_POST['autoplay']) : '';
[258] Fix | Delete
$settings['display_fullscreen_button'] = isset( $_POST['display_fullscreen_button']) ? sanitize_text_field( $_POST['display_fullscreen_button']) : '';
[259] Fix | Delete
$settings['small_play_button'] = isset( $_POST['small_play_button']) ? sanitize_text_field( $_POST['small_play_button']) : '';
[260] Fix | Delete
$settings['player_color'] = isset( $_POST['player_color']) ? sanitize_text_field( $_POST['player_color']) : '';
[261] Fix | Delete
$settings['plugin_resumable'] = isset( $_POST['plugin_resumable']) ? sanitize_text_field( $_POST['plugin_resumable']) : '';
[262] Fix | Delete
$settings['plugin_focus'] = isset( $_POST['plugin_focus']) ? sanitize_text_field( $_POST['plugin_focus']) : '';
[263] Fix | Delete
$settings['plugin_rewind'] = isset( $_POST['plugin_rewind']) ? sanitize_text_field( $_POST['plugin_rewind']) : '';
[264] Fix | Delete
$settings['display_playbar'] = isset( $_POST['display_playbar']) ? sanitize_text_field( $_POST['display_playbar']) : 1;
[265] Fix | Delete
$settings['plugin_rewind_time'] = isset( $_POST['plugin_rewind_time']) ? sanitize_text_field( $_POST['plugin_rewind_time']) : 10;
[266] Fix | Delete
$settings['license_key'] = 1; // backward compatibility
[267] Fix | Delete
// Pro will handle g_loading_animation settings and other
[268] Fix | Delete
$settings = apply_filters( 'ep_wistia_settings_before_save', $settings);
[269] Fix | Delete
update_option( $option_name, $settings);
[270] Fix | Delete
do_action( 'ep_wistia_settings_after_save', $settings);
[271] Fix | Delete
}
[272] Fix | Delete
[273] Fix | Delete
public function save_vimeo_settings() {
[274] Fix | Delete
$option_name = EMBEDPRESS_PLG_NAME.':vimeo';
[275] Fix | Delete
$settings = get_option( $option_name, []);
[276] Fix | Delete
$settings['start_time'] = isset( $_POST['start_time']) ? sanitize_text_field( $_POST['start_time']) : 0;
[277] Fix | Delete
$settings['autoplay'] = isset( $_POST['autoplay']) ? sanitize_text_field( $_POST['autoplay']) : '';
[278] Fix | Delete
$settings['color'] = isset( $_POST['color']) ? sanitize_text_field( $_POST['color']) : '#00adef';
[279] Fix | Delete
$settings['display_title'] = isset( $_POST['display_title']) ? sanitize_text_field( $_POST['display_title']) : 1;
[280] Fix | Delete
$settings['display_author'] = isset( $_POST['display_author']) ? sanitize_text_field( $_POST['display_author']) : 1;
[281] Fix | Delete
$settings['display_avatar'] = isset( $_POST['display_avatar']) ? sanitize_text_field( $_POST['display_avatar']) : 1;
[282] Fix | Delete
$settings['license_key'] = 1; // backward compatibility
[283] Fix | Delete
// Pro will handle g_loading_animation settings and other
[284] Fix | Delete
$settings = apply_filters( 'ep_vimeo_settings_before_save', $settings);
[285] Fix | Delete
update_option( $option_name, $settings);
[286] Fix | Delete
do_action( 'ep_vimeo_settings_after_save', $settings);
[287] Fix | Delete
}
[288] Fix | Delete
[289] Fix | Delete
public function save_twitch_settings() {
[290] Fix | Delete
$option_name = EMBEDPRESS_PLG_NAME.':twitch';
[291] Fix | Delete
$settings = get_option( $option_name, []);
[292] Fix | Delete
$settings['embedpress_pro_twitch_autoplay'] = isset( $_POST['autoplay']) ? sanitize_text_field( $_POST['autoplay']) : 'no';
[293] Fix | Delete
$settings['embedpress_pro_fs'] = isset( $_POST['fs']) ? sanitize_text_field( $_POST['fs']) : 'yes';
[294] Fix | Delete
$settings['start_time'] = isset( $_POST['start_time']) ? sanitize_text_field( $_POST['start_time']) : 0;
[295] Fix | Delete
$settings['embedpress_pro_twitch_theme'] = isset( $_POST['theme']) ? sanitize_text_field( $_POST['theme']) : 'dark';
[296] Fix | Delete
$settings['embedpress_pro_twitch_mute'] = isset( $_POST['mute']) ? sanitize_text_field( $_POST['mute']) : 'yes';
[297] Fix | Delete
$settings['license_key'] = 1; // backward compatibility
[298] Fix | Delete
// Pro will handle g_loading_animation settings and other
[299] Fix | Delete
$settings = apply_filters( 'ep_twitch_settings_before_save', $settings);
[300] Fix | Delete
update_option( $option_name, $settings);
[301] Fix | Delete
do_action( 'ep_twitch_settings_after_save', $settings);
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
public function save_spotify_settings() {
[305] Fix | Delete
$option_name = EMBEDPRESS_PLG_NAME.':spotify';
[306] Fix | Delete
$settings = get_option( $option_name, []);
[307] Fix | Delete
$settings['theme'] = isset( $_POST['spotify_theme']) ? sanitize_text_field( $_POST['spotify_theme']) : '1';
[308] Fix | Delete
$settings['license_key'] = 1; // backward compatibility
[309] Fix | Delete
[310] Fix | Delete
$settings = apply_filters( 'ep_spotify_settings_before_save', $settings);
[311] Fix | Delete
update_option( $option_name, $settings);
[312] Fix | Delete
do_action( 'ep_spotify_settings_after_save', $settings);
[313] Fix | Delete
return $settings;
[314] Fix | Delete
}
[315] Fix | Delete
[316] Fix | Delete
public function save_custom_logo_settings() {
[317] Fix | Delete
do_action( 'before_embedpress_branding_save');
[318] Fix | Delete
$settings = (array) get_option( EMBEDPRESS_PLG_NAME, []);
[319] Fix | Delete
$settings['embedpress_document_powered_by'] = isset( $_POST['embedpress_document_powered_by']) ? sanitize_text_field( $_POST['embedpress_document_powered_by']) : 'no';
[320] Fix | Delete
update_option( EMBEDPRESS_PLG_NAME, $settings);
[321] Fix | Delete
do_action( 'after_embedpress_branding_save');
[322] Fix | Delete
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
public function save_dailymotion_settings() {
[326] Fix | Delete
$option_name = EMBEDPRESS_PLG_NAME.':dailymotion';
[327] Fix | Delete
$settings = get_option( $option_name, []);
[328] Fix | Delete
$settings['start_time'] = isset( $_POST['start_time']) ? sanitize_text_field( $_POST['start_time']) : 0;
[329] Fix | Delete
$settings['visual'] = isset( $_POST['visual']) ? sanitize_text_field( $_POST['visual']) : '';
[330] Fix | Delete
$settings['autoplay'] = isset( $_POST['autoplay']) ? sanitize_text_field( $_POST['autoplay']) : '';
[331] Fix | Delete
$settings['play_on_mobile'] = isset( $_POST['play_on_mobile']) ? sanitize_text_field( $_POST['play_on_mobile']) : '';
[332] Fix | Delete
$settings['color'] = isset( $_POST['color']) ? sanitize_text_field( $_POST['color']) : '#dd3333';
[333] Fix | Delete
$settings['controls'] = isset( $_POST['controls']) ? sanitize_text_field( $_POST['controls']) : '';
[334] Fix | Delete
$settings['video_info'] = isset( $_POST['video_info']) ? sanitize_text_field( $_POST['video_info']) : '';
[335] Fix | Delete
$settings['mute'] = isset( $_POST['mute']) ? sanitize_text_field( $_POST['mute']) : '';
[336] Fix | Delete
// Pro will handle g_loading_animation settings and other
[337] Fix | Delete
$settings = apply_filters( 'ep_dailymotion_settings_before_save', $settings);
[338] Fix | Delete
update_option( $option_name, $settings);
[339] Fix | Delete
do_action( 'ep_dailymotion_settings_after_save', $settings);
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
public function save_soundcloud_settings() {
[343] Fix | Delete
$option_name = EMBEDPRESS_PLG_NAME.':soundcloud';
[344] Fix | Delete
$settings = get_option( $option_name, []);
[345] Fix | Delete
$settings['visual'] = isset( $_POST['visual']) ? sanitize_text_field( $_POST['visual']) : '';
[346] Fix | Delete
$settings['autoplay'] = isset( $_POST['autoplay']) ? sanitize_text_field( $_POST['autoplay']) : '';
[347] Fix | Delete
$settings['play_on_mobile'] = isset( $_POST['play_on_mobile']) ? sanitize_text_field( $_POST['play_on_mobile']) : '';
[348] Fix | Delete
$settings['share_button'] = isset( $_POST['share_button']) ? sanitize_text_field( $_POST['share_button']) : '';
[349] Fix | Delete
$settings['comments'] = isset( $_POST['comments']) ? sanitize_text_field( $_POST['comments']) : '';
[350] Fix | Delete
$settings['color'] = isset( $_POST['color']) ? sanitize_text_field( $_POST['color']) : '';
[351] Fix | Delete
$settings['artwork'] = isset( $_POST['artwork']) ? sanitize_text_field( $_POST['artwork']) : '';
[352] Fix | Delete
$settings['play_count'] = isset( $_POST['play_count']) ? sanitize_text_field( $_POST['play_count']) : '';
[353] Fix | Delete
$settings['username'] = isset( $_POST['username']) ? sanitize_text_field( $_POST['username']) : '';
[354] Fix | Delete
[355] Fix | Delete
$settings['license_key'] = 1; // backward compatibility
[356] Fix | Delete
// Pro will handle g_loading_animation settings and other
[357] Fix | Delete
$settings = apply_filters( 'ep_soundcloud_settings_before_save', $settings);
[358] Fix | Delete
update_option( $option_name, $settings);
[359] Fix | Delete
do_action( 'ep_soundcloud_settings_after_save', $settings);
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
public function save_gcalendar_settings() {
[363] Fix | Delete
$client_secret = !empty( $_POST['epgc_client_secret']) ? json_decode( wp_unslash( trim( $_POST['epgc_client_secret'])), true) : [];
[364] Fix | Delete
$epgc_cache_time = !empty( $_POST['epgc_cache_time'] ) ? absint( $_POST['epgc_cache_time']) : 0;
[365] Fix | Delete
$epgc_selected_calendar_ids = !empty( $_POST['epgc_selected_calendar_ids'] ) ? array_map( 'sanitize_text_field', $_POST['epgc_selected_calendar_ids']) : [];
[366] Fix | Delete
[367] Fix | Delete
[368] Fix | Delete
$pretty_client_secret = '';
[369] Fix | Delete
if ( !empty( $client_secret) ) {
[370] Fix | Delete
$pretty_client_secret = $this->get_pretty_json_string( $client_secret);
[371] Fix | Delete
}
[372] Fix | Delete
[373] Fix | Delete
update_option( 'epgc_client_secret', $pretty_client_secret);
[374] Fix | Delete
update_option( 'epgc_cache_time', $epgc_cache_time);
[375] Fix | Delete
update_option( 'epgc_selected_calendar_ids', $epgc_selected_calendar_ids);
[376] Fix | Delete
[377] Fix | Delete
}
[378] Fix | Delete
[379] Fix | Delete
public function save_opensea_settings() {
[380] Fix | Delete
$option_name = EMBEDPRESS_PLG_NAME.':opensea';
[381] Fix | Delete
$settings = get_option( $option_name, []);
[382] Fix | Delete
$settings['api_key'] = isset( $_POST['api_key']) ? sanitize_text_field( $_POST['api_key']) : 0;
[383] Fix | Delete
$settings['limit'] = isset( $_POST['limit']) ? sanitize_text_field( $_POST['limit']) : 0;
[384] Fix | Delete
$settings['orderby'] = isset( $_POST['orderby']) ? sanitize_text_field( $_POST['orderby']) : 0;
[385] Fix | Delete
[386] Fix | Delete
$settings['license_key'] = 1; // backward compatibility
[387] Fix | Delete
[388] Fix | Delete
// Pro will handle g_loading_animation settings and other
[389] Fix | Delete
$settings = apply_filters( 'ep_opensea_settings_before_save', $settings);
[390] Fix | Delete
update_option( $option_name, $settings);
[391] Fix | Delete
do_action( 'ep_opensea_settings_after_save', $settings);
[392] Fix | Delete
}
[393] Fix | Delete
[394] Fix | Delete
[395] Fix | Delete
function get_pretty_json_string($array) {
[396] Fix | Delete
return str_replace(" ", " ", json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
[397] Fix | Delete
}
[398] Fix | Delete
}
[399] Fix | Delete
[400] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function