array(), "type" => array(), "allowfullscreen" => array(), "allowscriptaccess" => array(), "height" => array(), "width" => array() ); $custom_allowedtags["script"] = array( "type" => array(), "async" => array(), "src" => array(), ); $allowedposttags["ins"] = array( "data-ad-client" => array(), "data-ad-slot" => array(), "class" => array(), "style" => array(), ); $custom_allowedtags = array_merge($custom_allowedtags, $allowedposttags); $output = wp_kses( $input, $custom_allowedtags); return $output; } add_action('admin_init','ac_change_santiziation', 100); /* ================================================ */ // AC - Create Toolbar Menus /* ================================================ */ function ac_render_toolbar_menu() { global $get_theme_basename; $disable_panel_elements = of_get_option( 'ac_disable_panel_elements' ); $admin_url = get_admin_url(); ac_create_toolbar_menu( 'ACOSMIN'); ac_create_toolbar_menu( 'Theme Options', admin_url( 'themes.php?page=options-framework' ), 'ACOSMIN' ); ac_create_toolbar_menu( 'Theme Customize', admin_url( 'customize.php' ), 'ACOSMIN' ); if ( !$disable_panel_elements['fw_update'] ) { ac_create_toolbar_menu( 'Update Framework', admin_url( 'themes.php?page=update-framework' ), 'ACOSMIN' ); } ac_create_toolbar_menu( 'WordPress Themes', 'http://www.acosmin.com/premium-wordpress-themes/', 'ACOSMIN' ); ac_create_toolbar_menu( 'Theme Documentation', 'http://www.acosmin.com/documentation/' . $get_theme_basename . '/', 'ACOSMIN' ); ac_create_toolbar_menu( '@Twitter', 'https://twitter.com/acosmin', 'ACOSMIN' ); ac_create_toolbar_menu( 'On Facebook', 'https://www.facebook.com/acosmincom', 'ACOSMIN' ); } function ac_create_toolbar_menu($name, $href = '', $parent = '', $custom_meta = array()) { global $wp_admin_bar; if (!is_super_admin() || !is_admin_bar_showing() || !is_object($wp_admin_bar) || !function_exists('is_admin_bar_showing')) { return; } $id = str_replace('.php', '', basename(__FILE__)) . '-' . $name; $id = preg_replace('#[^\w-]#si', '-', $id); $id = strtolower($id); $id = trim($id, '-'); $parent = trim($parent); if (!empty($parent)) { $parent = str_replace('.php', '', basename(__FILE__)) . '-' . $parent; $parent = preg_replace('#[^\w-]#si', '-', $parent); $parent = strtolower($parent); $parent = trim($parent, '-'); } $site_url = site_url(); $meta_default = array(); $meta_ext = array( 'target' => '_blank' ); $meta = (strpos($href, $site_url) !== false) ? $meta_default : $meta_ext; $meta = array_merge($meta, $custom_meta); $wp_admin_bar->add_node(array( 'parent' => $parent, 'id' => $id, 'title' => $name, 'href' => $href, 'meta' => $meta, )); } add_action('wp_before_admin_bar_render', 'ac_render_toolbar_menu', 100); /* ================================================ */ // AC - Useful Functions /* ================================================ */ function ac_set($name, $value) { global $prefix; update_option($prefix . $name, $value); $options[$name] = $value; return $value; } function ac_get($name, $echo = false) { global $prefix; $result = false; if (isset($options[$name])) { $result = $options[$name]; } if ($result === false) { $result = get_option($prefix . $name); } if ($result === false) { return; } if (!$echo) { return $result; } echo $result; } function ac_delete($name) { global $prefix; $args = func_get_args(); $num = count($args); if ($num == 1) { return (delete_option($prefix . $args[0]) ? true : false); } elseif ($num > 1) { foreach ($args as $option) { if (!delete_option($prefix . $option)) return false; } return true; } return false; } ?>