Skip to content

Instantly share code, notes, and snippets.

View gdarko's full-sized avatar
Crunching code, one line at a time.

Darko Gjorgjijoski gdarko

Crunching code, one line at a time.
  • Self-employed
  • The Internet
  • 18:15 (UTC +02:00)
View GitHub Profile
@gdarko
gdarko / class-zcloudflare.php
Last active May 11, 2021 18:03
IP Location Block API class library for CloudFlare
<?php
if ( class_exists( 'IP_Location_Block_API', false ) ) :
/**
* Class for CloudFlare
*
* @see https://support.cloudflare.com/hc/en-us/articles/200170986-How-does-CloudFlare-handle-HTTP-Request-headers-
* @see https://support.cloudflare.com/hc/en-us/articles/200170856-How-do-I-restore-original-visitor-IP-with-vBulletin-
* @see https://support.cloudflare.com/hc/en-us/articles/200168236-What-does-CloudFlare-IP-Geolocation-do-
@gdarko
gdarko / functions.php
Last active June 23, 2022 21:02
Using WP Vimeo Videos PRO upload modal in your applications
<?php
/**
* Enqueue upload modal
*/
function dgv_823828_enqueue_scripts() {
if(is_page(1111)) { // check by page or perhaps other condition to avoid enqueuing the script globally.
wp_enqueue_style('dgv-upload-modal');
wp_enqueue_script('dgv-upload-modal');
wp_enqueue_script('your-custom-script', 'https://url-to-script/script.js', array('jquery', 'dgv-upload-modal'), null, true);
@gdarko
gdarko / functions.php
Last active March 9, 2021 21:08
Filter the output of [dgv_vimeo_video] shortcode and print a Vimeo link only instead of embed code
<?php
/**
* Print vimeo.com link instead of embed link using the [dgv_vimeo_video] shortcode
* @param string $content
* @param string $vimeo_id
* @return string
*/
function dgv_shortcode_output_891281($content, $vimeo_id) {
return sprintf('https://vimeo.com/%s', $vimeo_id);
@gdarko
gdarko / functions.php
Last active March 5, 2021 13:11
Modify the allowed Video extensions on WP Vimeo Videos. Add this code to your theme's functions.php.
<?php
/**
* Modify the allowed extensions on WP Vimeo Videos
* @return string[]
*/
function filter_dgv_allowed_extensions() {
return array( 'mp4', 'mov', 'flv' );
}
add_filter('dgv_allowed_extensions', 'filter_dgv_allowed_extensions');
@gdarko
gdarko / trivia.tcl
Created December 24, 2020 15:02
Trivia TCL for Eggdrop by Souperman
######################################################################
#PLEASE customise the settings before rehashing your bot! #
######################################################################
# The full path to the file containing the questions and answers.
# The account the bot runs on must have read access to this file.
set tgqdb "/home/kaka/lidy/eggdrop/scripts/triv.questions.txt"
# The character that seperates the question and the answer in the
# question/answer file.
@gdarko
gdarko / wp-vimeo-videos-examples.php
Last active December 22, 2020 00:08
How to use the Vimeo videos API
<?php
# Example 1 - Upload local video
$api = new WP_DGV_Api_Helper();
$path = '/home/user/video.mp4';
$params = array(
'name' => 'Cool Video',
'description' => 'Some description',
);
@gdarko
gdarko / prices.html
Created July 9, 2020 21:36
Metal Prices Widget
<div class="gs-stats silverprice">
<img src="http://www.kitconet.com/images/sp_en_6.gif">
</div>  
@gdarko
gdarko / hide-embed-privacy.php
Created June 19, 2020 10:22
Hide embed privacy in WP Vimeo Videos
<?php
/**
* Hide embed privacy in WP Vimeo Videos
* @return void
*/
function wvv_edit_hide_embed_privacy() {
if(isset($_GET['page']) && $_GET['page'] === 'dgv-library') {
echo '<style>#dgv-video-save-embed-privacy {display:none !important;}</style>';
}
@gdarko
gdarko / hide-search-option.php
Created June 19, 2020 10:09
Hide search option in Wp Vimeo Videos upload block
<?php
/**
* Hide search option in WP Vimeo Videos
* @return void
*/
function wvv_disable_upload_options() {
echo '<style>.dgv-vimeo-upload-form > .dgv-vimeo-form-row > label:last-child { display: none !important;}</style>';
}
add_action('admin_head', 'wvv_disable_search_option');
@gdarko
gdarko / hide-upload-options.php
Created June 5, 2020 22:01
Hide upload options on WP Vimeo Videos
<?php
/**
* Hide Upload options on WP Vimeo Videos
* @return void
*/
function wvv_disable_upload_options() {
echo '<style>.dgv-vimeo-form-row label {display:none !important;}</style>';
}
add_action('admin_head', 'wvv_disable_upload_options');