What does this code mean? In theme-functions.php

This topic has 3 replies, 2 voices, and was last updated 9 years, 11 months ago ago by Robert Hall

  • Avatar: norfauji
    norfauji
    Participant
    November 30, 2014 at 10:16

    Hi.

    I found following code in the theme-functions.php file inside /royal/framework/theme-functions.php.

    I understand that the first code is that you log which domain install the theme. But what is the rest of the code?

    If I remove this whole code then I was not able to access Theme Options.

    add_action( 'after_setup_theme', 'et_promo_remove', 11 );
    if(!function_exists('et_promo_remove')) {
    	function et_promo_remove() {		
    		if(!get_option('et_domain_tracked')) {
    			$panel_url = 'https://www.8theme.com/panel/add_domain.php';
    			$url = urlencode(get_bloginfo('url'));
    			$theme = wp_get_theme();
    			$theme_name = $theme->get( 'Name' );
    			$request = $panel_url.'?domain='.$url.'&theme='.$theme_name;
    			file_get_contents($request);
    			update_option('et_domain_tracked', 'yes');
    		}
    	}
    }
    
    if(!function_exists('et_show_promo_text')) {
    	function et_show_promo_text() {
    		$versionsUrl = 'https://www.8theme.com/import/';
    		$ver = 'promo';
    		$folder = $versionsUrl.''.$ver;
    		
    		$txtFile = $folder.'/royal.txt';
    		$file_headers = @get_headers($txtFile);
    		
    		$etag = $file_headers[4];
    		
    		$cached = false;
    		$promo_text = false;
    		
    		$storedEtag = get_option('et_last_promo_etag');
    		$closedEtag = get_option('et_close_promo_etag');
    		
    		if($etag == $storedEtag && $closedEtag != $etag) {
    			$storedEtag = get_option('et_last_promo_etag');
    			$promo_text = get_option('et_promo_text');
    		} else if($closedEtag == $etag) {
    			return;
    		} else {
    			$fileContent = file_get_contents($txtFile);
    			update_option('et_last_promo_etag', $etag);
    			update_option('et_promo_text', $fileContent);
    		}
    		
    		if($file_headers[0] == 'HTTP/1.1 200 OK') {
    			echo '<div class="promo-text-wrapper">';
    				if(!$promo_text && isset($fileContent)) {
    					echo $fileContent;
    				} else {
    					echo $promo_text;
    				}	
    				echo '<div class="close-btn">x</div>';	
    			echo '</div>';	
    		}
    	}
    }
    
    add_action("wp_ajax_et_close_promo", "et_close_promo");
    add_action("wp_ajax_nopriv_et_close_promo", "et_close_promo");
    if(!function_exists('et_close_promo')) {
    	function et_close_promo() {
    		$versionsUrl = 'https://www.8theme.com/import/';
    		$ver = 'promo';
    		$folder = $versionsUrl.''.$ver;
    		
    		$txtFile = $folder.'/royal.txt';
    		$file_headers = @get_headers($txtFile);
    		
    		$etag = $file_headers[4];
    		update_option('et_close_promo_etag', $etag);
    		die();
    	}
    }
    2 Answers
    Avatar: norfauji
    norfauji
    Participant
    December 1, 2014 at 12:34

    Can you reply?

    Avatar: Robert Hall
    Robert Hall
    Support staff
    December 1, 2014 at 15:22

    Hello,

    This is the code required for full functionality of the theme.
    Could you please clarify with more details what exactly you want to do and show us screenshots?

    Regards,
    Robert Hall.

  • Viewing 3 results - 1 through 3 (of 3 total)

The issue related to '‘What does this code mean? In theme-functions.php’' has been successfully resolved, and the topic is now closed for further responses

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.