Skip to content

Instantly share code, notes, and snippets.

View EugeneKwasny's full-sized avatar
🌴
Working remotely

Eugene K EugeneKwasny

🌴
Working remotely
View GitHub Profile
<?php
class Singleton {
private static $instance;
private function __construct() {
// Private constructor to prevent instantiation.
}
public static function getInstance() {
@EugeneKwasny
EugeneKwasny / ObjectFactory.txt
Last active November 26, 2023 15:50
Object Factory
class Car {
private string $model;
public static function createSportsCar() {
$car = new Car();
$car->setModel('Sports Car');
return $car;
}
private function setModel(string $model)
<?php
// The Query.
$the_query = new WP_Query([
'category_name' => 'news',
'posts_per_page' => 5,
'ignore_sticky_posts' => true
]);
// The Loop.
if ( $the_query->have_posts() ) {
@EugeneKwasny
EugeneKwasny / r-debug.php
Created December 10, 2021 12:23 — forked from Rarst/r-debug.php
R Debug (set of dump helpers for debug)
<?php
/*
Plugin Name: R Debug
Description: Set of dump helpers for debug.
Author: Andrey "Rarst" Savchenko
Author URI: https://www.rarst.net/
License: MIT
*/
@EugeneKwasny
EugeneKwasny / pagenavi html
Created January 15, 2018 17:02 — forked from dmassiani/pagenavi html
Change html for wp pagenavi
######################
# Change html pagenavi for transform like bootstrap
######################
//attach our function to the wp_pagenavi filter
add_filter( 'wp_pagenavi', 'wd_pagination', 10, 2 );
//customize the PageNavi HTML before it is output
function wd_pagination($html) {
$out = '';
<?php
/**
* Created by PhpStorm.
* User: e.kvasnyi
* Date: 26.05.17
* Time: 19:02
*/
class ZohoCrm {
public $authtoken = 'e62981dc61f27a44b89a5a4a910833ea';
<?php if ( ! defined( 'ABSPATH' ) ) { die( 'Tranquility - the highest manifestation of power!' ); }
class Widget_Online_Support extends WP_Widget {
/**
* Widget constructor.
*/
private $options;
private $prefix;
function __construct() {
if ( ! function_exists( 'theme_slug_get_post_option' ) ) :
function theme_slug_get_post_option($post_id, $name, $default = false ) {
if (defined('FW')) {
$options = fw_get_db_post_option($post_id, $name );
if ( isset( $options ) ) {
return $options;
}else{
return $default;
}
} else {
@EugeneKwasny
EugeneKwasny / gist:101d851e878901b637f47d59fa35901d
Created March 8, 2017 13:31
fw_get_db_settings_option_cover
if ( ! function_exists( 'theme_prefix_get_option' ) ) :
function theme_prefix_get_option( $name, $default = false ) {
if (defined('FW')) {
$options = fw_get_db_settings_option( $name );
if ( isset( $options ) ) {
return $options;
}else{
return $default;
}
} else {
<?php
/**
* Create Permalink Setting.
*
* @package at_helpdesk
* @copyright Copyright (c) 2015, Cvasnii Evghenii
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.0.0
*/