roles;
$options = get_option( 'fca_ga', true );
$id = empty ( $options['id'] ) ? '' : $options['id'];
$exclude = empty ( $options['exclude'] ) ? array() : $options['exclude'];
$do_script = count( array_intersect( array_map( 'strtolower', $roles), array_map( 'strtolower', $exclude ) ) ) == 0;
if ( !empty( $options['id'] ) && $do_script ) {
ob_start(); ?>
";
switch ( $type ) {
case 'checkbox':
$checked = !empty( $value ) ? "checked='checked'" : '';
$html .= "
";
$html .= "";
$html .= "";
$html .= "
";
break;
case 'textarea':
$html .= "";
break;
case 'image':
$html .= "";
$html .= "";
$html .= "
";
$html .= "";
$html .= "";
$html .= "";
$html .= '
';
break;
case 'color':
$html .= "";
break;
case 'editor':
ob_start();
wp_editor( $value, $name, array() );
$html .= ob_get_clean();
break;
case 'datepicker':
$html .= "";
break;
case 'roles':
$roles = get_editable_roles();
forEach ( $roles as $role ) {
$options[] = $role['name'];
}
$html = "";
break;
default:
$html .= "";
}
$html .= '';
return $html;
}
function fca_ga_tooltip( $text = 'Tooltip', $icon = 'dashicons dashicons-editor-help' ) {
return "";
}
function fca_ga_convert_entities ( $array ) {
$array = is_array($array) ? array_map('fca_ga_convert_entities', $array) : html_entity_decode( $array, ENT_QUOTES );
return $array;
}
function fca_ga_escape_input ($data) {
if ( is_array ( $data ) ) {
forEach ( $data as $k => $v ) {
$data[$k] = fca_ga_escape_input($v);
}
return $data;
}
$data = wp_kses_post( $data );
return $data;
}
function fca_ga_add_plugin_action_links( $links ) {
$url = admin_url('options-general.php?page=fca_ga_settings_page');
$new_links = array(
'configure' => "" . __('Configure Google Analytics', 'fca-ga' ) . ''
);
$links = array_merge( $new_links, $links );
return $links;
}
add_filter( 'plugin_action_links_' . FCA_GA_PLUGINS_BASENAME, 'fca_ga_add_plugin_action_links' );
//ADD NAG IF NO GA TRACKING CODE IS SET
function fca_ga_admin_notice() {
$options = get_option( 'fca_ga', true );
if ( empty( $options['id'] ) ) {
$url = admin_url( 'options-general.php?page=fca_ga_settings_page' );
echo '';
}
}
add_action( 'admin_notices', 'fca_ga_admin_notice' );
//DEACTIVATION SURVEY
function fca_ga_admin_deactivation_survey( $hook ) {
if ( $hook === 'plugins.php' ) {
ob_start(); ?>
$html,
'nonce' => wp_create_nonce( 'fca_ga_uninstall_nonce' ),
'ajaxurl' => admin_url( 'admin-ajax.php' ),
);
wp_enqueue_script('fca_ga_deactivation_js', FCA_GA_PLUGINS_URL . '/includes/deactivation.min.js', false, FCA_GA_PLUGIN_VER, true );
wp_localize_script( 'fca_ga_deactivation_js', "fca_ga", $data );
}
}
add_action( 'admin_enqueue_scripts', 'fca_ga_admin_deactivation_survey' );
}