/** * Header data for header section * * @return array */ public static function header_data() { $header_image = get_header_image(); $page_layout_class = ' .page-layout-' . Model_Page_Layout_Settings::get_layout() . ' .page-layout-width-' . Model_Page_Layout_Settings::get_width() . ' .page-layout-sidebar-width-' . Model_Page_Layout_Settings::get_sidebar_width(); $header = array('allowedtags' => $GLOBALS['allowedtags'], 'language_attributes' => get_language_attributes(), 'body_class' => implode(' ', get_body_class()) . $page_layout_class, 'charset' => get_bloginfo('charset'), 'ping_back_url' => get_bloginfo('pingback_url'), 'name' => get_bloginfo('name'), 'home_url' => esc_url(home_url('/')), 'description' => get_bloginfo('description'), 'favicon' => General_Site_Settings_Model::get_favicon(), 'touch_icon' => General_Site_Settings_Model::get_touch_icon(), 'custom_styles' => '', 'is_enabled_preloader' => Model_Logo_And_Favicon::is_enable_page_preloader(), 'logo' => General_Site_Settings_Model::get_logo(), 'socials' => View::make('blocks/socials', array('socials' => Social_Settings_Model::get_all_socials(), 'where' => 'header')), 'socials_show_header' => Social_Settings_Model::is_show_header(), 'disclimer' => Header_Settings_Model::get_disclimer(), 'search_box' => Header_Settings_Model::get_search_box(), 'header_style_layout' => Header_Settings_Model::get_header_style(), 'header_layout_view' => sprintf('header-%s', Header_Settings_Model::get_header_style()), 'header_image' => $header_image, 'header_slogan' => get_option('photolab_header_slogan'), 'header_class' => Header_Settings_Model::get_header_class(), 'static_class' => empty($header_image) ? 'static' : 'absolute', 'term_description' => term_description(), 'welcome_message' => get_option('photolab'), 'main_menu' => wp_nav_menu(array('theme_location' => 'main', 'container' => 'nav', 'container_class' => 'main-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-menu', 'walker' => new Photolab_Walker(), 'echo' => false)), 'top_menu' => wp_nav_menu(array('theme_location' => 'top', 'container' => 'nav', 'container_class' => 'top-navigation', 'container_id' => 'site-navigation', 'menu_class' => 'sf-top-menu', 'walker' => new Photolab_Walker(), 'echo' => false))); $header['alt_mess'] = Utils::array_get($header['welcome_message'], 'welcome_title', get_bloginfo('name')); return $header; }
/** * Displays the language attributes for the html tag. * * Builds up a set of html attributes containing the text direction and language * information for the page. * * @since 2.1.0 * @since 4.3.0 Converted into a wrapper for get_language_attributes(). * * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'. */ function language_attributes($doctype = 'html') { echo get_language_attributes($doctype); }
/** * Returns a list of functions to add to the existing list. * * @return Twig_SimpleFunction[] */ public function getFunctions() { $html_safe = ['is_safe' => array('html')]; $funcs = []; // home_url $funcs[] = new Twig_SimpleFunction('home_url', function ($blog_id = null, $path = '', $scheme = null) { return get_home_url($blog_id, $path, $scheme); }, $html_safe); // blog_info $funcs[] = new Twig_SimpleFunction('blog_info', function ($show, $filter = 'raw') { return get_bloginfo($show, $filter); }, $html_safe); // wp_title $funcs[] = new Twig_SimpleFunction('wp_title', function ($sep = '»', $dir = '') { return wp_title($sep, false, $dir); }, $html_safe); // the_archive_title() $funcs[] = new Twig_SimpleFunction('the_archive_title', function () { global $wp_locale; if (is_category()) { $title = sprintf(__('Category: %s'), single_cat_title('', false)); } elseif (is_tag()) { $title = sprintf(__('Tag: %s'), single_tag_title('', false)); } elseif (is_author()) { $title = sprintf(__('Author: %s'), '<span class="vcard">' . get_the_author() . '</span>'); } elseif (is_year()) { $title = sprintf(__('Year: %s'), get_the_date(_x('Y', 'yearly archives date format'))); } elseif (is_month()) { $title = sprintf(__('Month: %s'), $wp_locale->get_month(get_query_var('monthnum'))); } elseif (is_day()) { $title = sprintf(__('Day: %s'), get_the_date(_x('F j, Y', 'daily archives date format'))); } elseif (is_tax('post_format')) { if (is_tax('post_format', 'post-format-aside')) { $title = _x('Asides', 'post format archive title'); } elseif (is_tax('post_format', 'post-format-gallery')) { $title = _x('Galleries', 'post format archive title'); } elseif (is_tax('post_format', 'post-format-image')) { $title = _x('Images', 'post format archive title'); } elseif (is_tax('post_format', 'post-format-video')) { $title = _x('Videos', 'post format archive title'); } elseif (is_tax('post_format', 'post-format-quote')) { $title = _x('Quotes', 'post format archive title'); } elseif (is_tax('post_format', 'post-format-link')) { $title = _x('Links', 'post format archive title'); } elseif (is_tax('post_format', 'post-format-status')) { $title = _x('Statuses', 'post format archive title'); } elseif (is_tax('post_format', 'post-format-audio')) { $title = _x('Audio', 'post format archive title'); } elseif (is_tax('post_format', 'post-format-chat')) { $title = _x('Chats', 'post format archive title'); } } elseif (is_post_type_archive()) { $title = sprintf(__('Archives: %s'), post_type_archive_title('', false)); } elseif (is_tax()) { $tax = get_taxonomy(get_queried_object()->taxonomy); /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */ $title = sprintf(__('%1$s: %2$s'), $tax->labels->singular_name, single_term_title('', false)); } else { $title = __('Archives'); } return apply_filters('get_the_archive_title', $title); }, $html_safe); // wp_head $funcs[] = new Twig_SimpleFunction('wp_head', function () { ob_start(); wp_head(); $content = ob_get_clean(); return $content; }, $html_safe); // wp_footer $funcs[] = new Twig_SimpleFunction('wp_footer', function () { ob_start(); wp_footer(); $content = ob_get_clean(); return $content; }, $html_safe); // language_attributes $funcs[] = new Twig_SimpleFunction('language_attributes', function ($doctype = 'html') { return get_language_attributes($doctype); }, $html_safe); // get_option $funcs[] = new Twig_SimpleFunction('get_option', function ($option, $default = '') { return get_option($option, $default); }, $html_safe); // body_class $funcs[] = new Twig_SimpleFunction('body_class', function ($class = '') { return 'class="' . join(' ', get_body_class($class)) . '"'; }, $html_safe); // post_class $funcs[] = new Twig_SimpleFunction('post_class', function ($class = '') { return 'class="' . join(' ', get_post_class($class)) . '"'; }, $html_safe); // header_image $funcs[] = new Twig_SimpleFunction('header_image', function () { return get_header_image(); }, $html_safe); // wp_list_categories $funcs[] = new Twig_SimpleFunction('wp_list_categories', function ($args = []) { $args['echo'] = false; return wp_list_categories($args); }, $html_safe); // wp_nav_menu $funcs[] = new Twig_SimpleFunction('wp_nav_menu', function ($args = []) { $args['echo'] = false; return wp_nav_menu($args); }, $html_safe); // the_id $funcs[] = new Twig_SimpleFunction('the_id', function ($args = []) { return get_the_ID(); }, $html_safe); // the_date $funcs[] = new Twig_SimpleFunction('the_date', function ($id = null) { return get_the_date('', $id); }, $html_safe); // the_permalink $funcs[] = new Twig_SimpleFunction('the_permalink', function () { ob_start(); the_permalink(); return ob_get_clean(); }, $html_safe); // the_post_thumbnail $funcs[] = new Twig_SimpleFunction('the_post_thumbnail', function ($id = null, $size = 'post-thumbnail', $attr = '') { return get_the_post_thumbnail($id, $size, $attr); }, $html_safe); // post_password_required $funcs[] = new Twig_SimpleFunction('post_password_required', function () { return post_password_required(); }, $html_safe); // the_title $funcs[] = new Twig_SimpleFunction('the_title', function () { return get_the_title(); }, $html_safe); // the_content $funcs[] = new Twig_SimpleFunction('the_content', function () { return get_the_content(); }, $html_safe); // get_pagenum_link $funcs[] = new Twig_SimpleFunction('pagenum_link', function ($page = 1, $escape = true) { return get_pagenum_link($page, $escape); }, $html_safe); // paged_page $funcs[] = new Twig_SimpleFunction('paged_page', function () { return get_query_var('paged') ?: 1; }, $html_safe); // paged_pages $funcs[] = new Twig_SimpleFunction('paged_pages', function () { global $wp_query; return $wp_query->max_num_pages; }, $html_safe); // wp_link_pages $funcs[] = new Twig_SimpleFunction('wp_link_pages', function ($args) { $args['echo'] = false; return wp_link_pages($args); }, $html_safe); // edit_post_link $funcs[] = new Twig_SimpleFunction('edit_post_link', function ($text, $before, $after, $class) { ob_start(); edit_post_link($text, $before, $after, 0, $class); return ob_get_clean(); }, $html_safe); // the_field $funcs[] = new Twig_SimpleFunction('the_field', function ($field, $id = false) { return get_field($field, $id); }, $html_safe); // the_author_avatar $funcs[] = new Twig_SimpleFunction('the_author_avatar', function ($size = null, $id = null) { return get_avatar($id ?: get_the_author_meta('ID'), $size); }, $html_safe); // the_author $funcs[] = new Twig_SimpleFunction('the_author', function ($size = null) { return get_the_author(); }, $html_safe); // the_author_link $funcs[] = new Twig_SimpleFunction('the_author_link', function ($size = null) { return get_the_author_link(); }, $html_safe); // the_author_ID $funcs[] = new Twig_SimpleFunction('the_author_ID', function () { return get_the_author_meta('ID'); }, $html_safe); // get_author_posts_url $funcs[] = new Twig_SimpleFunction('the_author_posts_url', function ($author_id = null, $author_nicename = '') { return get_author_posts_url($author_id, $author_nicename); }, $html_safe); // do_shortcode $funcs[] = new Twig_SimpleFunction('do_shortcode', function ($content) { return do_shortcode($content); }, $html_safe); // the_post_thumbnail $funcs[] = new Twig_SimpleFunction('the_post_thumbnail', function ($size = 'post-thumbnail', $attr = []) { ob_start(); the_post_thumbnail($size, $attr); return ob_get_clean(); }, $html_safe); // get_the_category $funcs[] = new Twig_SimpleFunction('the_category', function ($id = false) { return get_the_category($id); }, $html_safe); // get_category_link $funcs[] = new Twig_SimpleFunction('category_link', function ($id) { return get_category_link($id); }, $html_safe); // comments_number $funcs[] = new Twig_SimpleFunction('comments_number', function ($zero = '', $single = '', $many = '') { ob_start(); comments_number($zero, $single, $many); return ob_get_clean(); }, $html_safe); // comments_template $funcs[] = new Twig_SimpleFunction('comments_template', function ($file = '/comments.php', $seperate = false) { ob_start(); comments_template($file, $seperate); return ob_get_clean(); }, $html_safe); // get_comment_meta $funcs[] = new Twig_SimpleFunction('comment_meta', function ($id, $string = '', $single = false) { return get_comment_meta($id, $string, $single); }, $html_safe); // posts_pagination $funcs[] = new Twig_SimpleFunction('posts_pagination', function ($args = []) { return get_the_posts_pagination(); }, $html_safe); return $funcs; }
$banned_hosts_display = trim($banned_hosts_display); $banned_referers_display = trim($banned_referers_display); $banned_user_agents_display = trim($banned_user_agents_display); $banned_exclude_ips_display = trim($banned_exclude_ips_display); $banned_stats = get_option('banned_stats'); $banned_options = get_option('banned_options'); ?> <script type="text/javascript"> /* <![CDATA[*/ var checked = 0; function banned_default_templates(template) { var default_template; switch(template) { case "message": default_template = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" <?php echo str_replace('"', '\\"', get_language_attributes()); ?> >\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=<?php echo get_option('blog_charset'); ?> \" />\n<title>%SITE_NAME% - %SITE_URL%</title>\n</head>\n<body>\n<div id=\"wp-ban-container\">\n<p style=\"text-align: center; font-weight: bold;\"><?php _e('You Are Banned.', 'wp-ban'); ?> </p>\n</div>\n</body>\n</html>"; break; } jQuery("#banned_template_" + template).val(default_template); } function toggle_checkbox() { for(i = 0; i < <?php echo sizeof($banned_stats['users']);
function ban_activate() { add_option('banned_ips', array()); add_option('banned_hosts', array()); add_option('banned_stats', array('users' => array(), 'count' => 0)); add_option('banned_message', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n" . '<html xmlns="http://www.w3.org/1999/xhtml" ' . get_language_attributes() . '>' . "\n" . '<head>' . "\n" . '<meta http-equiv="Content-Type" content="text/html; charset=' . get_option('blog_charset') . '" />' . "\n" . '<title>%SITE_NAME% - %SITE_URL%</title>' . "\n" . '</head>' . "\n" . '<body>' . "\n" . '<div id="wp-ban-container">' . "\n" . '<p style="text-align: center; font-weight: bold;">' . __('You Are Banned.', 'wp-ban') . '</p>' . "\n" . '</div>' . "\n" . '</body>' . "\n" . '</html>', 'Banned Message'); // Database Upgrade For WP-Ban 1.11 add_option('banned_referers', array()); add_option('banned_exclude_ips', array()); add_option('banned_ips_range', array()); // Database Upgrade For WP-Ban 1.30 add_option('banned_user_agents', array()); // Database Upgrade For WP-Ban 1.64 add_option('banned_options', array('reverse_proxy' => 0)); }
/** * @param Pimple\Container $app * @return void */ public function register(Container $app) { $app['view'] = function (Container $app) { // Basic configuration information $loader = new Twig_Loader_Filesystem($this->config['view_path']); $twig = new Twig_Environment($loader, ['cache' => $this->config['cache_path'] . '/views', 'auto_reload' => true, 'debug' => env('APP_DEBUG'), 'strict_variables' => true]); // Additional template functions $post = new Twig_SimpleFunction('post', function ($ids, $withCustomFields = true, $type = 'post') { $collection = Post::make(); if ($withCustomFields) { $collection->withCustomFields(); } return $collection->in($ids)->type($type)->first(); }); $posts = new Twig_SimpleFunction('posts', function ($ids, $withCustomFields = true, $type = 'post') { $collection = Post::make(); if ($withCustomFields) { $collection->withCustomFields(); } return $collection->in($ids)->type($type)->get(); }); $user = new Twig_SimpleFunction('user', function ($ids, $withCustomFields = true) { $collection = User::make(); if ($withCustomFields) { $collection->withCustomFields(); } return $collection->in($ids)->first(); }); $users = new Twig_SimpleFunction('users', function ($ids, $withCustomFields = true) { $collection = User::make(); if ($withCustomFields) { $collection->withCustomFields(); } return $collection->in($ids)->get(); }); $images = new Twig_SimpleFunction('images', function ($ids, $size = null) { return Image::make()->in($ids)->size($size)->get(); }); $image = new Twig_SimpleFunction('image', function ($ids, $size = null) { return Image::make()->in($ids)->size($size)->first(); }); $dump = new Twig_SimpleFunction('dump', function ($value) { return var_dump($value); }); $dd = new Twig_SimpleFunction('dd', function ($value) { return dd($value); }); $pagination = new Twig_SimpleFunction('pagination', function ($value = 3) { return Pagination::get($value); }); $wp_footer = new Twig_SimpleFunction('wp_footer', function () { return wp_footer(); }); $wp_head = new Twig_SimpleFunction('wp_head', function () { return wp_head(); }); $wp_title = new Twig_SimpleFunction('wp_title', function () { return wp_title(); }); // Global variables $twig->addGlobal('languages', get_language_attributes()); // Register all of the custom functions $twig->addFunction($post); $twig->addFunction($posts); $twig->addFunction($user); $twig->addFunction($users); $twig->addFunction($images); $twig->addFunction($image); $twig->addFunction($dump); $twig->addFunction($dd); $twig->addFunction($pagination); $twig->addFunction($wp_footer); $twig->addFunction($wp_head); $twig->addFunction($wp_title); return $twig; }; }