Alterskontrolle.de) von WondoCash.com.
Version: 1.5
Author: WondoCash.com
Author URI: http://www.wondocash.com/?wid=4820&sid=0&aktion=p4sub
*/
ini_set("display_errors", 1);
ini_set("track_errors", 1);
ini_set("html_errors", 1);
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
define('alterskontrolle_dePlugin_PATH', dirname(__FILE__) .'/');
/* functions */
include(alterskontrolle_dePlugin_PATH.'classes/inc.php');
include(alterskontrolle_dePlugin_PATH.'widget.php');
class alterskontrolle_dePlugin {
function __construct() {
if ($this->is_session() === false) { session_start(); }
register_activation_hook( __FILE__, array($this, 'activate') );
register_deactivation_hook( __FILE__, array($this, 'deactivate') );
/* Text Widget do Shortcode */
add_filter('widget_text', 'do_shortcode');
/* Nested Shortcodes */
add_filter('the_content', 'do_shortcode');
/* Add Adminpage */
add_action('admin_menu', array($this, 'add_menu'));
/* init post page question */
add_action('admin_init', array($this, 'ak_meta_init'));
/* Add Custom Style */
add_action('wp_head', array($this,'add_new_style'));
add_action( 'admin_enqueue_scripts', array($this,'add_new_admin_style'));
/* Add Shortcode Button */
add_filter( 'mce_external_plugins', array($this,'ak_sc_mce_external_plugins'));
add_filter( 'mce_buttons_2', array($this,'ak_sc_mce_buttons_2'));
/* Add Settings Link */
$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", array( $this, 'plugin_settings_link' ));
/* Shortcode and Tor init */
$akpf = new alterskontrolle_dePlugin_func();
/* User Data */
add_action( 'show_user_profile', array($this,'wh_uf_func') );
add_action( 'edit_user_profile', array($this,'wh_uf_func') );
add_action( 'wp_create_user', array($this,'wh_uf_func') );
add_action( 'user_register', array($this,'save_wh_uf_func') );
/* Save User-Fields */
add_action( 'personal_options_update', array($this,'save_wh_uf_func') );
add_action( 'edit_user_profile_update', array($this,'save_wh_uf_func') );
}
function activate() {
if(get_option('alterskontrolle_de_options') == '') {
$data = array('ak_wid'=>'', 'ak_apikey'=>'', 'ak_programm_type'=>'', 'ak_tor_message'=>'Nach dem erfolgreichen Login steht der versteckte Inhalt zu verfügung.', 'abo_id'=>'', 'abo_title'=>'', 'ak_torauswahl'=>'', 'ak_tpl_before'=>'', 'ak_tpl_after'=>'');
add_option('alterskontrolle_de_options', json_encode($data, JSON_UNESCAPED_UNICODE));
}
}
function deactivate() {
}
//user field function
function wh_uf_func($user) {
?>
Alterskontrolle.de Logindaten hinterlegen
agecheck($ak_userdata_userid,$ak_userdata_password) == 100) {
$akpf->ak_create_session();
}
}
function aktor_update_options() {
if(isset($_POST) && $_POST && isset($_POST['alterskontrolle_de_options']) && $_POST['alterskontrolle_de_options']) {
update_option('alterskontrolle_de_options',json_encode($_POST['akdata'], JSON_UNESCAPED_UNICODE));
}
}
function aktor_option_page() {
$this->aktor_update_options();
$options = json_decode(get_option('alterskontrolle_de_options'), false, 512, JSON_UNESCAPED_UNICODE);
?>
Einstellungen › Alterkontrolle.de
Willkommen auf der Alterskontrolle Plugin Konfigurationsseite.
ak_programm_type == 'aktor') {
$title = 'Alterskontrolle / Site-ID';
} else {
$title = 'Abo schützen';
}
foreach (array('post', 'page') as $type) {
add_meta_box('ak_all_meta', $title, array($this,'ak_meta_setup'), $type, 'normal', 'high');
}
add_action('save_post', array($this,'ak_meta_save'));
if(isset($_POST['alterskontrolle_de_options']) && $_POST['alterskontrolle_de_options']) {
header('Location: '.home_url('/wp-admin/options-general.php?page=alterskontrolle.de'));
}
}
function ak_meta_setup() {
global $post;
// using an underscore, prevents the meta variable
// from showing up in the custom fields section
$meta = get_post_meta($post->ID, '_ak_meta', TRUE);
// instead of writing HTML here, lets do an include
$this->ak_meta_box();
// create a custom nonce for submit verification later
echo '';
}
function ak_meta_save($post_id) {
// authentication checks
// make sure data came from our meta box
if (isset($_POST['ak_meta_noncename']) && !wp_verify_nonce($_POST['ak_meta_noncename'], __FILE__))
return $post_id;
// check user permissions
if (isset($_POST['post_type']) && $_POST['post_type'] == 'page') {
if (!current_user_can('edit_page', $post_id))
return $post_id;
} else {
if (!current_user_can('edit_post', $post_id))
return $post_id;
}
// authentication passed, save data
$current_data = get_post_meta($post_id, '_ak_meta', TRUE);
$new_data = (isset($_POST['_ak_meta'])) ? $_POST['_ak_meta'] : '';
if($new_data) {
$this->ak_meta_clean($new_data);
if ($current_data) {
if (is_null($new_data))
delete_post_meta($post_id, '_ak_meta');
else
update_post_meta($post_id, '_ak_meta', $new_data);
} elseif (!is_null($new_data)) {
add_post_meta($post_id, '_ak_meta', $new_data, TRUE);
}
}
return $post_id;
}
function ak_meta_clean(&$arr) {
if (is_array($arr)) {
foreach ($arr as $i=>$v) {
if (is_array($arr[$i])) {
ak_meta_clean($arr[$i]);
if (!count($arr[$i])) {
unset($arr[$i]);
}
} else {
if (trim($arr[$i]) == '') {
unset($arr[$i]);
}
}
}
if (!count($arr)) {
$arr = NULL;
}
}
}
function ak_meta_box() {
global $post;
$meta = get_post_meta($post->ID, '_ak_meta', TRUE);
$mc_check = (isset($meta['check']) && $meta['check']) ? $meta['check'] : 'no';
$mc_sid = (isset($meta['sid']) && $meta['sid']) ? $meta['sid'] : '';
$options = json_decode(get_option('alterskontrolle_de_options'), false, 512, JSON_UNESCAPED_UNICODE);
if($options->ak_programm_type == 'aktor') {
$show = true;
} else {
$show = false;
}
?>
'.__('Settings').'';
return $links;
}
/* Check if Session is already started */
function is_session()
{
if ( php_sapi_name() !== 'cli' ) {
if ( version_compare(phpversion(), '5.4.0', '>=') ) {
return session_status() === PHP_SESSION_ACTIVE ? true : false;
} else {
return session_id() === '' ? false : true;
}
}
return false;
}
}
$alterskontrolle_dePlugin = new alterskontrolle_dePlugin();