| Server IP : 89.39.208.18 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : User : ( ) PHP Version : 7.4.33 Disable Function : eval,./,ln,passthru,dl,system,exec,popen,shell_exec,posix_getpwuid,posix_uname,ftp_exec,posix_uname,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,get_current_user,getmyuid,getmygid,listen,chgrp,apache_note,apache_setenv,apache_child_terminate,closelog,debugger_off,debugge_on,ini_restore,netscript,escapeshellarg,cmd,backtick,virtual,show_sourc,show_source,pclose,pcntl_exec,datasec,old_offset,ctrl_dir,ini_alter,leak,listen,chgrp,apache_setenv,define_syslog_variables,root,diskfreespace,disk_free_space,disk_total_space,posix_kill,getmyuid,getmygid,apache_child_terminate,php_ini_scanned_files,ls,ps_aux,chown,getrusage,posixc,posame,chgrp,posix_setuid,posix_setsid,posix_setgid,apache_note,apache_setenv,x_getuid,e_ini_file,nfo,SQL,mysql_li,t_dbs,filegroup,highlight_file,ilegetcontents,get_dir,popen,popens,pfsockopen,dos_conv,apache_get_modules,crack_check,crack_closedict,rar_open,bzopen,bzread,bzwrite,shellcode,posix_isatty,posix_getservbyname,escapeshellarg,hypot,pg_host,pos,posix_access,inurl,posix_times,posix_mknod,pclose,ps_fill,symlink,id,escapeshellcmd,php_uname,phpinfo MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home3/./././mahyarcake/./www/wp-content/plugins/svg-support/admin/ |
Upload File : |
<?php
/**
* Admin init
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Add menu item to wp-admin
*/
function bodhi_svgs_admin_menu() {
$bodhi_svgs_options_page = add_options_page(
__('SVG Support Settings and Usage', 'svg-support'),
__('SVG Support', 'svg-support'),
'manage_options',
'svg-support',
'bodhi_svg_support_settings_page'
);
// load the help menu on the SVG Support settings page
add_action( 'load-' . $bodhi_svgs_options_page, 'bodhi_svgs_help_tab' );
require( BODHI_SVGS_PLUGIN_PATH . 'admin/svgs-settings-page-help.php' );
}
add_action( 'admin_menu', 'bodhi_svgs_admin_menu' );
/**
* Create settings page
*/
function bodhi_svg_support_settings_page() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( __('You can\'t play with this.', 'svg-support') );
}
// Swapped the global with this line to work with WordPress Bedrock on LEMP stack | https://wordpress.org/support/topic/settings-not-saving-24/
// global $bodhi_svgs_options;
$bodhi_svgs_options = get_option( 'bodhi_svgs_settings' );
require( BODHI_SVGS_PLUGIN_PATH . 'admin/svgs-settings-page.php' );
}
/**
* Sanitize class before saving
*/
function bodhi_sanitize_fields( $value ) {
global $bodhi_svgs_options;
$bodhi_plugin_version_stored = get_option( 'bodhi_svgs_plugin_version' );
if( !isset($value['sanitize_svg']) ) {
$value['sanitize_svg'] = "none";
}
if( !isset($value['sanitize_on_upload_roles']) ) {
$value['sanitize_on_upload_roles'] = array("none");
}
if( !isset($value['restrict']) ) {
$value['restrict'] = array("none");
}
$value['css_target'] = esc_attr( sanitize_text_field( $value['css_target'] ) );
if( $value['sanitize_svg_front_end'] !== 'on' ) {
$value['sanitize_svg_front_end'] = false;
}
return $value;
}
/**
* Register settings in the database
*/
function bodhi_svgs_register_settings() {
$args = array(
'sanitize_callback' => 'bodhi_sanitize_fields'
);
register_setting( 'bodhi_svgs_settings_group', 'bodhi_svgs_settings', $args );
}
add_action( 'admin_init', 'bodhi_svgs_register_settings' );
/**
* Advanced Mode Check
*
* Creates a usable function for conditionals around the plugin
*/
function bodhi_svgs_advanced_mode() {
global $bodhi_svgs_options;
if ( ! empty( $bodhi_svgs_options['advanced_mode'] ) ) {
return true;
} else {
return false;
}
}
add_action( 'admin_init', 'bodhi_svgs_advanced_mode' );
/**
* Screen check function
* Checks if current page is SVG Support settings page
*/
function bodhi_svgs_specific_pages_settings() {
// check current page
$screen = get_current_screen();
// check if we're on SVG Support settings page
if ( is_object( $screen ) && $screen->id == 'settings_page_svg-support' ) {
return true;
} else {
return false;
}
}
/**
* Screen check function
* Checks if the current page is the Media Library page
*/
function bodhi_svgs_specific_pages_media_library() {
// check current page
$screen = get_current_screen();
// check if we're on Media Library page
if ( is_object( $screen ) && $screen->id == 'upload' ) {
return true;
} else {
return false;
}
}
/**
* Screen check function
* Check if the current page is a post edit page
*/
function bodhi_svgs_is_edit_page( $new_edit = null ) {
global $pagenow;
if ( ! is_admin() ) return false;
if ( $new_edit == 'edit' ) {
return in_array( $pagenow, array( 'post.php', ) );
} elseif ( $new_edit == "new" ) { //check for new post page
return in_array( $pagenow, array( 'post-new.php' ) );
} else { //check for either new or edit
return in_array( $pagenow, array( 'post.php', 'post-new.php' ) );
}
}
/**
* Add rating text to footer on settings page
*/
function bodhi_svgs_admin_footer_text( $default ) {
if ( bodhi_svgs_specific_pages_settings() || bodhi_svgs_specific_pages_media_library() ) {
printf( __( 'If you like <strong>SVG Support</strong> please leave a %s★★★★★%s rating. A huge thanks in advance!', 'svg-support' ), '<a href="https://wordpress.org/support/view/plugin-reviews/svg-support?filter=5#postform" target="_blank" class="svgs-rating-link">', '</a>' );
} else {
return $default;
}
}
add_filter( 'admin_footer_text', 'bodhi_svgs_admin_footer_text' );