This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Function to return ip address | |
* | |
* @return string IP Address. | |
*/ | |
function get_ip_address() { | |
$ipaddress = ''; | |
if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get custom settings. This works for group type field only. | |
* | |
* @param string $tab | |
* @param string $field | |
* | |
* @return void | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Http auth start. | |
$valid_passwords = array( 'bunty' => 'Bunty@123' ); // Key is username and value is password. | |
$valid_users = array_keys( $valid_passwords ); // Get all usernames from $valid_passwords array. | |
$user = $_SERVER['PHP_AUTH_USER']; | |
$pass = $_SERVER['PHP_AUTH_PW']; | |
// Check if user is valid. | |
$validated = ( in_array( $user, $valid_users ) ) && ( $pass == $valid_passwords[ $user ] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class acf_field_timezone extends acf_field { | |
/* | |
* __construct | |
* | |
* This function will setup the field type data | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Set user roles as an option. | |
* | |
* @param array $field | |
* @return array | |
*/ | |
function load_roles( $field ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add Setting page for ACF | |
* | |
* @return void | |
*/ | |
function buntywp_acf_setting_pages() { | |
// Bail, if anything goes wrong. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change the REST response | |
* | |
* @param object $rest_ensure_response | |
* @param object $instance | |
* @param object $request | |
* @return object | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wp_custom_body_class( $classes ) { | |
if ( is_single() ) { | |
$classes[] = 'buntywp'; | |
} | |
return $classes; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Fix the URLs from the content. | |
* | |
* This function will add protocol to URLs which has no protocol added. | |
* | |
* For example, | |
* | |
* google.com --> http://google.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change label to Followed for Suscriptions. | |
* | |
* @return void | |
*/ | |
function bb_forum_profile_menu_tabs() { | |
// Handle fatal error in case of plugin not available |