prefix."bruteforce_logger' LIMIT 1;"; $result = $wpdb->query($sql); // Table doesn't exist. Create it! if (!$result) { $sql = " CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."bruteforce_logger` ( `id` int(11) NOT NULL, `ip` char(15) NOT NULL, `username` varchar(30) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;"; $wpdb->query($sql); $sql = " ALTER TABLE `".$wpdb->prefix."bruteforce_logger` ADD PRIMARY KEY (`id`);"; $wpdb->query($sql); $sql = " ALTER TABLE `".$wpdb->prefix."bruteforce_logger` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;"; $wpdb->query($sql); } // Add failed attempt to logs $sql = " INSERT INTO `".$wpdb->prefix."bruteforce_logger` ( `ip`, `username`, `date` ) VALUES ( '".esc_sql($_SERVER['REMOTE_ADDR'])."', '".esc_sql($username)."', NOW() )"; $wpdb->query($sql); } add_action( 'wp_login_failed', 'catch_failed_logins' ); function protect_wordpress_login() { global $wpdb; // Get number of failed attempts from last 5 minutes $sql = "SELECT COUNT(*) AS `amount` FROM `".$wpdb->prefix."bruteforce_logger` WHERE `ip` = '".esc_sql($_SERVER['REMOTE_ADDR'])."' AND `date` > DATE_SUB(NOW(),INTERVAL 5 MINUTE)"; $result = $wpdb->get_results($sql); // There is a result! if ($result) { // Result exceeds 5. Block the user. if ($result[0]->amount > 5) { // Show message echo 'You are blocked for 5 minutes due to too many failed login attempts.'; exit; } } } add_action('login_init','protect_wordpress_login');Website ontwikkeld door Yellow Lemon Tree | Mede mogelijk gemaakt door WordPress'; } } __('References'), 'labels' => array( 'name' => __('Referenties'), 'singular_name' => __('Referentie'), 'add_new' => __('Referentie toevoegen'), 'add_new_item' => __('Nieuwe referentie'), 'edit_item' => __('Wijzig referentie'), 'new_item' => __('Nieuwe referentie'), 'all_items' => __('Alle referenties'), 'view_item' => __('Bekijk referentie'), 'search_items' => __('Zoek referentie'), 'not_found' => __('Er zijn geen referenties gevonden'), 'not_found_in_trash' => __('Geen referenties gevonden in de prullenbak') ), 'public' => false, 'can_export' => false, 'show_ui' => true, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'menu_icon' => 'dashicons-groups', 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array("slug" => 'referenties'), // Permalinks 'supports' => array( 'title', ), 'show_in_menu' => true, 'taxonomies' => array("references_taxo") ) ); register_taxonomy("references_taxo", array('references_posts'), array( "hierarchical" => true, "label" => "Categorieën", 'labels' => array( 'name' => __('Categorie'), 'singular_name' => __('Categorie'), 'search_items' => __('Categorieën zoeken'), 'popular_items' => __('Populaire categorieën'), 'all_items' => __('Alle categorieën'), 'parent_item' => __('Huidige categorie'), 'parent_item_colon' => __('Huidige categorie:'), 'edit_item' => __('Wijzig categorie'), 'update_item' => __('Wijzig categorie'), 'add_new_item' => __('Nieuwe categorie toevoegen'), 'new_item_name' => __('Nieuwe categorie')), 'public' => false, 'query_var' => true, 'rewrite' => array('slug' => 'accommodaties'), 'show_ui' => true, 'with_front' => false ) ); } $prefix, 'title' => "Product eigenschappen", 'object_types' => array( 'page'), 'show_on' => array( 'key' => 'page-template', 'value' => array('productpage.php')), 'show_names' => true, ) ); $cmb->add_field( array( 'name' => __( 'Materiaal', 'cmb2' ), 'id' => $prefix . 'material', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Gewicht', 'cmb2' ), 'id' => $prefix . 'weight', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Brandwerend', 'cmb2' ), 'id' => $prefix . 'fireproof', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Bedrukking', 'cmb2' ), 'id' => $prefix . 'printing', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Max. rolbreedte', 'cmb2' ), 'id' => $prefix . 'rollwidth', 'type' => 'text_small', ) ); $cmb->add_field( array( 'name' => __( 'Max. rollengte', 'cmb2' ), 'id' => $prefix . 'rolllength', 'type' => 'text_small', ) ); $cmb->add_field( array( 'name' => __( 'Textuur', 'cmb2' ), 'id' => $prefix . 'texture', 'type' => 'text_small', ) ); $cmb->add_field( array( 'name' => __( 'Afwerking', 'cmb2' ), 'id' => $prefix . 'finish', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Toepassingen', 'cmb2' ), 'id' => $prefix . 'uses', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Indoor / outdoor', 'cmb2' ), 'id' => $prefix . 'indoor', 'type' => 'text_medium', ) ); $cmb->add_field( array( 'name' => __( 'Waterafstotend', 'cmb2' ), 'id' => $prefix . 'waterproof', 'type' => 'text_small', ) ); $cmb->add_field( array( 'name' => __( 'Translucent', 'cmb2' ), 'id' => $prefix . 'translucent', 'type' => 'text_small', ) ); $cmb->add_field( array( 'name' => __( 'Detail afbeelding 1', 'cmb2' ), 'desc' => __( 'Afbeelding dient minimaal 190px breed bij 190px hoog te zijn', 'cmb2' ), 'id' => $prefix . 'detailimg_1', 'type' => 'file', ) ); $cmb->add_field( array( 'name' => __( 'Detail afbeelding 1 ALT tekst', 'cmb2' ), 'id' => $prefix . 'detailimg_1_alt', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Detail afbeelding 2', 'cmb2' ), 'desc' => __( 'Afbeelding dient minimaal 190px breed bij 190px hoog te zijn', 'cmb2' ), 'id' => $prefix . 'detailimg_2', 'type' => 'file', ) ); $cmb->add_field( array( 'name' => __( 'Detail afbeelding 2 ALT tekst', 'cmb2' ), 'id' => $prefix . 'detailimg_2_alt', 'type' => 'text', ) ); } function references_meta () { $prefix = '_reference_'; $cmb = new_cmb2_box( array( 'id' => $prefix, 'title' => "Referentie gegevens", 'object_types' => array( 'references_posts'), 'show_names' => true, ) ); $cmb->add_field( array( 'name' => __( 'Website URL', 'cmb2' ), 'id' => $prefix . 'url', 'type' => 'text_url', 'protocols' => array('http', 'https') ) ); $cmb->add_field( array( 'name' => __( 'Logo', 'cmb2' ), 'id' => $prefix . 'logo', 'type' => 'file', ) ); } function custombuttons_meta () { $prefix = '_custombutton'; $post_id = !empty($_GET['post']) ? $_GET['post'] : null; if($post_id == 89){ return false; } $cmb = new_cmb2_box( array( 'id' => $prefix, 'title' => "Custom knoppen", 'object_types' => array( 'page', ), // Post type 'show_names' => true, ) ); $group_field_id = $cmb->add_field( array( 'id' => $prefix . 'groupfield', 'type' => 'group', 'description' => __( 'Maak hier eigen knoppen aan welke u op de pagina kunt gebruiken. Gebruik een knop door b.v. [button id=1] in uw bericht te plaatsen.', 'cmb2' ), 'options' => array( 'group_title' => __( '[button id={#}]', 'cmb2' ), 'add_button' => __( 'Nieuwe knop toevoegen', 'cmb2' ), 'remove_button' => __( 'Verwijder knop', 'cmb2' ), 'sortable' => false, ), ) ); $cmb->add_group_field($group_field_id, array( 'name' => __( 'Knoplabel', 'cmb2' ), 'id' => 'buttontxt', 'type' => 'text_medium', ) ); $cmb->add_group_field($group_field_id, array( 'name' => __( 'Pagina', 'cmb2' ), 'desc' => __( 'Selecteer een pagina waarnaar de knop moet linken', 'cmb2' ), 'id' => 'page', 'type' => 'select', 'show_option_none' => true, 'options' => get_pageselect_options(), ) ); $cmb->add_group_field($group_field_id, array( 'name' => __( 'Knoptype', 'cmb2' ), 'id' => 'type', 'type' => 'select', 'show_option_none' => false, 'options' => array("full" => "Volledig kleur", "empty" => "Witte binnenkant"), ) ); } function homepage_headerslider_meta () { $prefix = '_hmp_headerslider'; $post_id = !empty($_GET['post']) ? $_GET['post'] : null; if(!empty($post_id) && $post_id != 89){ return false; } $cmb = new_cmb2_box( array( 'id' => $prefix, 'title' => "Hoofdafbeelding slider afbeeldingen", 'object_types' => array( 'page', ), // Post type 'show_names' => true, ) ); $group_field_id = $cmb->add_field( array( 'id' => $prefix . 'left_groupfield', 'type' => 'group', 'options' => array( 'group_title' => __( 'Slider links', 'cmb2' ), 'add_button' => __( 'Nieuwe afbeelding toevoegen', 'cmb2' ), 'remove_button' => __( 'Verwijder afbeelding', 'cmb2' ), 'sortable' => false, ), ) ); $cmb->add_group_field($group_field_id, array( 'name' => __( 'Afbeelding', 'cmb2' ), 'desc' => __( 'Afmeting afbeelding minimaal 250px breedte bij 250px hoog', 'cmb2' ), 'id' => $prefix . 'image', 'type' => 'file', ) ); $rgroup_field_id = $cmb->add_field( array( 'id' => $prefix . 'right_groupfield', 'type' => 'group', 'options' => array( 'group_title' => __( 'Slider rechts', 'cmb2' ), 'add_button' => __( 'Nieuwe afbeelding toevoegen', 'cmb2' ), 'remove_button' => __( 'Verwijder afbeelding', 'cmb2' ), 'sortable' => false, ), ) ); $cmb->add_group_field($rgroup_field_id, array( 'name' => __( 'Afbeelding', 'cmb2' ), 'desc' => __( 'Afmeting afbeelding minimaal 250px breedte bij 250px hoog', 'cmb2' ), 'id' => $prefix . 'image', 'type' => 'file', ) ); } function pagepreview_meta () { $prefix = '_pagepreview'; $cmb = new_cmb2_box( array( 'id' => $prefix, 'title' => "Pagina voorvertoning", 'object_types' => array( 'page'), // Post type 'show_names' => true, ) ); $cmb->add_field( array( 'name' => __( 'Omschrijving', 'cmb2' ), 'id' => $prefix . 'desc', 'type' => 'textarea_small', 'desc' => 'Omschrijf hier in het kort waar de pagina over gaat. Deze informatie wordt op de overzichtpagina\'s getoond', ) ); $cmb->add_field( array( 'name' => __( 'Afbeelding 1', 'cmb2' ), 'desc' => __( 'Afmeting afbeelding minimaal 500px breedte bij 300px hoog', 'cmb2' ), 'id' => $prefix . 'image1', 'type' => 'file', ) ); $cmb->add_field( array( 'name' => __( 'Afbeelding 2', 'cmb2' ), 'desc' => __( 'Afmeting afbeelding minimaal 500px breedte bij 300px hoog', 'cmb2' ), 'id' => $prefix . 'image2', 'type' => 'file', ) ); $cmb->add_field( array( 'name' => __( 'Afbeelding 3', 'cmb2' ), 'desc' => __( 'Afmeting afbeelding minimaal 500px breedte bij 300px hoog', 'cmb2' ), 'id' => $prefix . 'image3', 'type' => 'file', ) ); } function pagesettings_meta() { $prefix = '_pagesettings_'; $post_id = !empty($_GET['post']) ? $_GET['post'] : null; $cmb = new_cmb2_box( array( 'id' => $prefix . 'metabox', 'title' => __( 'Pagina instellingen', 'cmb2' ), 'object_types' => array( 'page'), // Post type 'show_on' => array( 'key' => 'page-template', 'value' => array('groupoverview.php', 'contactpage.php', 'homepage_20160526_1649_original-oktober2018.php') ), 'show_names' => true, ) ); $cmb->add_field( array( 'name' => __( 'Titel op afbeelding', 'cmb2' ), 'id' => $prefix . 'title', 'type' => 'text', ) ); if($post_id != 89){ $cmb->add_field( array( 'name' => __( 'Subtitel 1', 'cmb2' ), 'id' => $prefix . 'subtitle1', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Subtitel 2', 'cmb2' ), 'id' => $prefix . 'subtitle2', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Subtitel 3', 'cmb2' ), 'id' => $prefix . 'subtitle3', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Subtitel 4', 'cmb2' ), 'id' => $prefix . 'subtitle4', 'type' => 'text', ) ); } $cmb->add_field( array( 'name' => __( 'Hoofdafbeelding', 'cmb2' ), 'desc' => __( 'Afbeelding dient minimaal 1250px breed te zijn', 'cmb2' ), 'id' => $prefix . 'image', 'type' => 'file', ) ); $cmb->add_field( array( 'name' => __( 'Hoofdafbeelding ALT tekst', 'cmb2' ), 'desc' => __( 'SEO-vriendelijke tekst voor de hoofdafbeelding', 'cmb2' ), 'id' => $prefix . 'image_alt', 'type' => 'text', ) ); if($post_id != 89){ $cmb->add_field( array( 'name' => __( 'Kleurenschema', 'cmb2' ), 'id' => $prefix . 'color', 'type' => 'select', 'options' => array("lightblue" => "Licht blauw", "blue" => "Blauw", "purple" => "Paars", "grey" => "Grijs"), ) ); } } function pagesettings_default_meta() { $prefix = '_pagesettingsdefault_'; $post_id = !empty($_GET['post']) ? $_GET['post'] : null; $ancestor_id = end(get_ancestors( $post_id, 'page' )); $cmb = new_cmb2_box( array( 'id' => $prefix . 'metabox', 'title' => __( 'Pagina instellingen', 'cmb2' ), 'object_types' => array( 'page', ), // Post type 'show_on' => array( 'key' => 'page-template', 'value' => array('default', 'productpage.php', 'fullpage.php') ), 'show_names' => true, ) ); $cmb->add_field( array( 'name' => __( 'Titel op afbeelding', 'cmb2' ), 'id' => $prefix . 'title', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Hoofdafbeelding', 'cmb2' ), 'desc' => __( 'Afbeelding dient minimaal 1250px breed te zijn', 'cmb2' ), 'id' => $prefix . 'image', 'type' => 'file', ) ); $cmb->add_field( array( 'name' => __( 'Hoofdafbeelding ALT tekst', 'cmb2' ), 'desc' => __( 'SEO-vriendelijke ALT tekst voor de hoofdafbeelding', 'cmb2' ), 'id' => $prefix . 'image_alt_algemeen', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Kleurenschema', 'cmb2' ), 'id' => $prefix . 'color', 'type' => 'select', 'options' => array("lightblue" => "Licht blauw", "blue" => "Blauw", "purple" => "Paars", "grey" => "Grijs"), ) ); if (empty($post_id) || $ancestor_id == 8) { $cmb->add_field( array( 'name' => __( 'Referentiecategorie', 'cmb2' ), 'id' => $prefix . 'referencecat', 'type' => 'select', 'show_option_none' => true, 'options' => getReferenceCategories(), ) ); } } function pagesettings_default2_meta() { $prefix = '_pagesettingsdefault2_'; $post_id = !empty($_GET['post']) ? $_GET['post'] : null; $ancestor_id = end(get_ancestors( $post_id, 'page' )); $cmb = new_cmb2_box( array( 'id' => $prefix . 'metabox2', 'title' => __( 'Header afbeelding - SEO vriendelijke ALT tekst', 'cmb2' ), 'object_types' => array( 'page'), // Post type 'show_on' => array( 'key' => 'page-template', 'value' => array('contactpage_old_.php', 'contactpage_old_original.php', 'homepage_20160526_1649_original-oktober2018.php', 'pricelist.php', 'productpage.php', 'references.php') ), 'show_names' => true, ) ); $cmb->add_field( array( 'name' => __( 'SEO vriendelijke alt tekst', 'cmb2' ), 'desc' => __( 'SEO vriendelijke ALT tekst voor de header afbeelding op deze pagina', 'cmb2' ), 'id' => $prefix . 'image_alt_algemeen2', 'type' => 'text', ) ); } function homepage_infobox_meta() { $prefix = '_home_infobox_'; $cmb = new_cmb2_box( array( 'id' => $prefix . 'metabox', 'title' => __( 'Informatieblok', 'cmb2' ), 'object_types' => array( 'page', ), // Post type 'show_on' => array( 'key' => 'page-template', 'value' => 'homepage_20160526_1649_original-oktober2018.php' ), 'show_names' => true, ) ); $cmb->add_field( array( 'name' => __( 'Titel', 'cmb2' ), 'id' => $prefix . 'title', 'type' => 'text', ) ); $cmb->add_field( array( 'name' => __( 'Tekstveld', 'cmb2' ), 'id' => $prefix . 'description', 'type' => 'textarea_small', ) ); $cmb->add_field( array( 'name' => __( 'Knoplabel', 'cmb2' ), 'id' => $prefix . 'buttontxt', 'type' => 'text_medium', ) ); $cmb->add_field( array( 'name' => __( 'Pagina', 'cmb2' ), 'desc' => __( 'Selecteer een pagina waarnaar de knop moet linken', 'cmb2' ), 'id' => $prefix . 'page', 'type' => 'select', 'show_option_none' => true, 'options' => get_pageselect_options(), ) ); $cmb->add_field(array( 'name' => __( 'Afbeelding', 'cmb2' ), 'desc' => __( 'Afmeting afbeelding minimaal 500px breedte bij 300px hoog', 'cmb2' ), 'id' => $prefix . 'image', 'type' => 'file', ) ); } function homepage_partnerslider_metabox() { $prefix = '_referenceslider_'; $cmb = new_cmb2_box( array( 'id' => $prefix . 'metabox', 'title' => __( 'Referentie slider', 'cmb2' ), 'object_types' => array( 'page'), 'show_on' => array( 'key' => 'page-template', 'value' => 'homepage_20160526_1649_original-oktober2018.php' ), ) ); $cmb->add_field( array( 'name' => __( 'Referenties', 'cmb2' ), 'id' => $prefix . 'multicheckbox', 'type' => 'multicheck', 'options' => get_references() ) ); } function get_references () { $arr = array(); $query = new WP_Query(array('post_type' => 'references_posts','posts_per_page' => -1)); if(empty($query->posts)) { return array(); } foreach ($query->posts as $partner) { $arr[$partner->ID] = $partner->post_title; } wp_reset_query(); return $arr; } function get_pageselect_options() { $return = array(); $arr_pages = get_pages(array('orderby' => 'post_title','order' => 'ASC', 'post_status' => 'publish')); foreach ($arr_pages as $page) { if($page->ID != 89){ $return[$page->ID] = $page->post_title; } } return $return; } /** * Metabox for Children of Parent ID * @author Kenneth White (GitHub: sprclldr) * @link https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-show_on-filters * * @param bool $display * @param array $meta_box * @return bool display metabox */ function be_metabox_show_on_child_of( $display, $meta_box ) { if ( ! isset( $meta_box['show_on']['key'], $meta_box['show_on']['value'] ) ) { return $display; } if ( 'child_of' !== $meta_box['show_on']['key'] ) { return $display; } $post_id = 0; // If we're showing it based on ID, get the current ID if ( isset( $_GET['post'] ) ) { $post_id = $_GET['post']; } elseif ( isset( $_POST['post_ID'] ) ) { $post_id = $_POST['post_ID']; } if ( ! $post_id ) { return $display; } $pageids = array(); foreach( (array) $meta_box['show_on']['value'] as $parent_id ) { $pages = get_pages( array( 'child_of' => $parent_id, 'post_status' => 'publish,draft,pending', ) ); if ( $pages ) { foreach( $pages as $page ){ if ($page->post_parent == $parent_id) $pageids[] = $page->ID; } } } $pageids_unique = array_unique( $pageids ); return in_array( $post_id, $pageids_unique ); } add_filter( 'cmb2_show_on', 'be_metabox_show_on_child_of', 10, 2 ); /** * Get reference Categories * * @global object $wpdb * @return array $arr */ function getReferenceCategories() { global $wpdb; $arr = array(); $sql = "SELECT t.`term_id`, t.`name` FROM `wp_term_taxonomy` as ta LEFT JOIN `wp_terms` as t ON ta.`term_id` = t.`term_id` WHERE ta.`taxonomy` = 'references_taxo'"; $result = $wpdb->get_results($sql); if(!empty($result)) { foreach($result as $term) { $arr[$term->term_id] = $term->name; } } return $arr; } 'Introductie', 'block' => 'div', 'classes' => 'intro' ) ); $settings['style_formats'] = json_encode( $style_formats ); return $settings; } // Callback function to insert 'styleselect' into the $buttons array function register_tiny_mce_buttons( $buttons ) { array_unshift( $buttons, 'styleselect' ); return $buttons; } // Register our callback to the appropriate filter add_filter('mce_buttons_2', 'register_tiny_mce_buttons');