Skip to content

Instantly share code, notes, and snippets.

📦
Delivering

Kevin Pliester pixelbart

📦
Delivering
Block or report user

Report or block pixelbart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pixelbart
pixelbart / generatePassword.php
Last active Feb 18, 2020 — forked from zyphlar/generatePassword.php
Generating secure passwords in PHP
View generatePassword.php
<?php
/**
* Generates random, secure bytes that will be used for the password.
*
* @param int $nbBytes
* @param bool $strong
*
* @return string
*/
function get_random_bytes( $nbBytes = 32, $strong = true ) {
@pixelbart
pixelbart / usage.php
Created Feb 4, 2020
PHP regex for street numbers
View usage.php
<?php
/**
* Get street number from street
*
* @param string $street
*
* @return string
*/
function get_street_number( $street ) {
$regex = '/\d.?[^\s]*?[a-zA-Z]?.[?ABC]/i';
@pixelbart
pixelbart / PixelbartFinder.class.php
Created Jan 19, 2020
A class for searching files and folders, also recursively.
View PixelbartFinder.class.php
<?php
/**
* A class for searching files and folders, also recursively.
*
* @package Pixelbart Gists
* @author Pixelbart
*/
class PixelbartFinder {
/**
@pixelbart
pixelbart / functions.php
Created Dec 21, 2019
Helpful: Get all pro posts order by pro count
View functions.php
<?php
/**
* Shortcode for displaying all posts with pro, order by pro count
*/
function helpful_pro_shortcode() {
global $wpdb;
$table_name = $wpdb->prefix . 'helpful';
@pixelbart
pixelbart / is_ie.php
Created Dec 3, 2019
Prüft ob der aktuelle Browser der Internet Explorer ist.
View is_ie.php
/**
* Prüft ob der aktuelle Browser der Internet Explorer ist.
*
* @return boolean
*/
function is_ie() {
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
$ua = htmlentities( $_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8' );
if ( preg_match( '~MSIE|Internet Explorer~i', $ua ) || ( strpos( $ua, 'Trident/7.0' ) !== false && strpos( $ua, 'rv:11.0' ) !== false ) ) {
return true;
@pixelbart
pixelbart / helpful-example.css
Created Nov 18, 2019
WordPress Plugin Helpful Example CSS
View helpful-example.css
/* Helpful */
.helpful {}
/* Helpful: Users has already voted */
.helpful.helpful-exists {}
/**
* Headline
*/
@pixelbart
pixelbart / helpful-faq-example.php
Last active Nov 15, 2019
In this example you will learn how to add Helpful to an existing Post Type (here FAQ), including its own heading.
View helpful-faq-example.php
<?php
/**
* In this example you will learn how to add Helpful to an
* existing Post Type (here FAQ), including its own heading.
*
* @package Helpful Example
* @author Pixelbart
*/
$args = array(
@pixelbart
pixelbart / functions.php
Created Aug 30, 2019
Change the title tag of WordPress
View functions.php
<?php
/**
* Custom title tag in WordPress
*
* @author Kevin Pliester
*/
/**
* Set custom title
*
@pixelbart
pixelbart / contact-form.php
Last active Jul 17, 2019
Einfaches WordPress Kontaktformular
View contact-form.php
<?php
/**
* @author Kevin Pliester <me@pixelbart.de>
*/
/**
* Der E-Mail-Empfänger.
*/
$email_receivers = [ 'meine@email.de' ];
@pixelbart
pixelbart / functions.php
Last active Jul 15, 2019
Related posts at the last position in the content.
View functions.php
<?php
/**
* Add related posts at the last position in the content.
* URL to Plugin: https://de.wordpress.org/plugins/wordpress-23-related-posts-plugin/
*
* @param string $content post content.
*
* @return string
*/
function my_related_posts( $content ) {
You can’t perform that action at this time.