prefix . 'options';
$options = $wpdb->get_results(
$wpdb->prepare(
"SELECT option_name FROM $options_table WHERE option_name LIKE %s OR option_name LIKE %s",
'ACSC%',
'acsc\_%'
)
);
foreach ($options as $option) {
delete_option($option->option_name);
}
}
if ( isset($_GET['acsc']) && $_GET['acsc'] == 'reset' ) {
ACSC_RESET_basic();
die;
}
*/
// INITIALIZE & set DATA
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
function acsc_INIT() {
global $ACSC, $post;
require_once ACSC_DIR . 'includes/acsc-options.php';
include_once ACSC_DIR . 'includes/acsc-init-data.php';
if ( is_admin() || wp_doing_ajax() || wp_doing_cron() ) {
include_once ACSC_DIR . '/includes/acsc-admin-ajax.php';
}
// load hooks functions
include_once ACSC_DIR . 'includes/acsc-hooks.php';
if ( is_admin() || wp_doing_cron() ) {
// ADMIN or CRON
// ━━━━━━━━━━━━━━━━━━━━━━━
// Check User Role
if ( acsc_role_check() ) {
// ADMIN (ajax & dependencies)
// ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
require_once ACSC_DIR . '/includes/acsc-admin.php';
}
} else {
// FRONT END
// ━━━━━━━━━━━━━━━━━━━━━━━
include_once ACSC_DIR . '/includes/acsc-FE.php';
}
}
// Load language files
// ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
function acsc_internationalization() {
load_plugin_textdomain( ACSC_DOM, false,
ACSC_NAME . '/languages' );
}
// Hide admin notices
// ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
function acsc_hide_notices(){
$screen = get_current_screen()->id;
if ( $screen != 'actus_page_actus-deep-schema' )
return;
remove_all_actions( 'admin_notices' );
}
// Add settings link
// ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
$plugin = plugin_basename(__FILE__);
add_filter( "plugin_action_links_$plugin", 'acsc_settings_link' );
function acsc_settings_link( $links ) {
$settings_link = 'Actus Deep Schema';
array_unshift( $links, $settings_link );
return $links;
}
// User Role Check
// ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
function acsc_role_check(){
$options = get_option('ACSC-options');
if ( ! $options ) return false;
$roles = array('administrator');
if ( $options['user_roles'] )
$roles = $options['user_roles'];
$user = wp_get_current_user();
foreach ( $roles as $role ) {
if ( current_user_can( $role ) ) {
return true;
}
}
return false;
}
// ≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣≣
function acsc_cof( $val, $schema, $echo = false, $console = true ){
//if ( ! $val ) return;
$dir = get_stylesheet_directory();
$backtrace = debug_backtrace();
$file = '';
if ( $backtrace[2] ) {
$tmp = explode('/', $backtrace[2]['file']);
if ( $tmp[sizeof($tmp) - 1] !=
'template-loader.php' &&
$tmp[sizeof($tmp) - 1] !=
'wp-blog-header.php' ) {
$file = $file . $tmp[ sizeof($tmp) - 1 ] .
':'.$backtrace[2]['line'].
' (' . $backtrace[2]['function'] . ') >>> ';
}
}
if ( $backtrace[1] ) {
$tmp = explode('/', $backtrace[1]['file']);
if ( $tmp[sizeof($tmp) - 1] !=
'template-loader.php' &&
$tmp[sizeof($tmp) - 1] !=
'wp-blog-header.php' )
$file = $file . $tmp[ sizeof($tmp) - 1 ] .
':'.$backtrace[1]['line'].
' (' . $backtrace[1]['function'] . ') >>> ';
}
$tmp = explode('/', $backtrace[0]['file']);
$file = $file . $tmp[ sizeof($tmp) - 1 ] .
':' . $backtrace[0]['line'];
$file = str_replace('.php', '', $file);
/*
if ( $echo !== false ) {
echo "
------------------------------
";
echo "
" . $file;
echo "
------------------------------
";
echo "
"; print_r( $val ); echo ""; } */ if ( $console !== false ) { //if ( ! is_array( $val ) ) //$val = array( $val ); ?>