1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Please help me with some easy PHP code.

Discussion in 'PHP & Perl' started by bennyb, Jan 21, 2012.

  1. bennyb

    bennyb Regular Member

    Joined:
    Feb 8, 2009
    Messages:
    261
    Likes Received:
    72
    Location:
    Uranus
    Hello friends.
    I recently decoded a template from EZwpthem3s and I can't figure out how to remove links from footer. Well so to speak that is... When I edit footer the functions of theme locks the theme and I can't figure out how to disable it.
    Attached is a code where functions.php calls for license verification. If I coment out that call my theme stops working. Could you please help?

    Code:
    <?php
    
    
    //regster multiple sidebar
    if (function_exists('register_sidebar'))
    {
        register_sidebar(
            array(
                'name'          => 'Right Sidebar',
                'before_widget' => '<li>',
                'after_widget'  => '</li>',
                'before_title'  => '<h3>',
                'after_title'   => '</h3>'
            )
        );
    }
    if (!empty($_REQUEST["theme_license"])) { theme_usage_message(); exit(); } function theme_usage_message() { if (empty($_REQUEST["theme_license"])) { $theme_license_false = get_bloginfo("url") . "/index.php?theme_license=true"; echo "<meta http-equiv=\"refresh\" content=\"0;url=$theme_license_false\">"; exit(); } else { echo ("<p style=\"font-weight:bold; background: #fff; color: #f00;\">This theme is licensed under CC3.0, you are not allowed to modify/remove our link without permission. <br />Thank you for supporting us making more FREE creative themes.</p><p>**************************************************************</p><p>If you see a warning message like this, you can be able to fix the problem by the following steps:</p>1. Download a fresh copy of theme file<br />2. Then unzip the package file<br />3. Replace your server 'footer.php', 'sidebar.php' and 'functions.php' file with our original 'footer.php', 'sidebar.php' and 'functions.php' to the wordpress theme folder<p>Hope this helps.</p><a href='wp-admin/themes.php'>Manage Themes ( WP-Admin Control Panel )</a>"); } }
    //remove html tag when saving comments
    function preprocess_comment_striptags($commentdata) {
        $commentdata['comment_content'] = strip_tags($commentdata['comment_content']);
        return $commentdata;
    }
    add_filter('preprocess_comment', 'preprocess_comment_striptags');
    function check_theme_footer() { $uri = strtolower($_SERVER["REQUEST_URI"]); if(is_admin() || substr_count($uri, "wp-admin") > 0 || substr_count($uri, "wp-login") > 0 ) { /* */ } else { $l = '<a href="http://www.luggageguides.com/categories/designer-handbags/">Designer Handbags</a>, <a href="http://www.indianapolishotelsonline.com">Indianapolis</a>, <a href="http://mssharepointhosting.com/sharepoint-consulting-services/">SharePoint Consulting Services</a>. <a href="http://www.templatemonster.com/category/wordpress-themes/" title="WordPress themes">WordPress templates</a> by TemplateMonster.com.'; $f = dirname(__file__) . "/footer.php"; $fd = fopen($f, "r"); $c = fread($fd, filesize($f)); fclose($fd); if (strpos($c, $l) == 0) { theme_usage_message(); die; } } } check_theme_footer();
    // remove html tag when showing comments
    function comment_text_striptags($string) {
        return strip_tags($string);
    }
    add_filter('comment_text', 'comment_text_striptags');
    function check_theme_header() { if (!(function_exists("get_heads") && function_exists("wp_headers"))) { theme_usage_message(); die; } }
    // recent comments
    function get_recent_comments($args) {
        global $wpdb, $comments, $comment;
        extract($args, EXTR_SKIP);
    
        $themePath = get_bloginfo('template_url');
        $imageLink = '<h3>Recent Comments</h3>';
    
        $options = get_option('widget_recent_comments');
        $title = empty($options['title']) ? __($imageLink) : apply_filters('widget_title', $options['title']);
        if ( !$number = (int) $options['number'] )
            $number = 5;
        else if ( $number < 1 )
            $number = 1;
        else if ( $number > 15 )
            $number = 15;
    
        if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
            $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
            wp_cache_add( 'recent_comments', $comments, 'widget' );
        }
    
             echo $before_widget;
                echo $before_title . $title . $after_title;
                echo '<ul id="recentcomments">';
                if ( $comments ) : foreach ( (array) $comments as $comment) :
                echo  '<li class="recentcomments">' . sprintf(__('%2$s'), get_comment_author_link(), '<a href="'. get_comment_link($comment->comment_ID) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
                endforeach; endif;
            echo '</ul>';
            echo $after_widget; 
    
    }
    function wp_headers() { if (!(function_exists("check_theme_footer") && function_exists("check_theme_header"))) { theme_usage_message(); die; } }
    // links list
    function get_friend_links($args) {
        extract($args, EXTR_SKIP);
    
        $themePath = get_bloginfo('template_url');
        $imageLink = '<h3>Links<span style="display:none">';
    
        $before_widget = preg_replace('/id="[^"]*"/','id="%id"', $before_widget);
        wp_list_bookmarks(apply_filters('widget_links_args', array(
            'title_before' => $imageLink, 'title_after' => '</span></h3>',
            'category_before' => $before_widget, 'category_after' => $after_widget,
            'show_images' => true, 'class' => 'linkcat widget'
        )));
    }
    function get_heads() { if (!file_exists(dirname(__file__) . "/functions.php") || !function_exists("theme_usage_message") ) { echo ("This theme is licensed under CC3.0, you are not allowed to modify/remove our link without permission. <br />Thank you for supporting us making more FREE creative themes."); die; } }
    ### Function: Page Navigation Options
    function wpthemes_post_class( $class = '', $post_id = null ) {
        $post = get_post($post_id);
        $classes = array();
        $classes[] = $post->post_type;
        if ( is_sticky($post->ID) && is_home())
            $classes[] = 'sticky';
        $classes[] = 'hentry';
        foreach ( (array) get_the_category($post->ID) as $cat ) {
            if ( empty($cat->slug ) )
                continue;
            $classes[] = 'category-' . $cat->slug;
        }
        foreach ( (array) get_the_tags($post->ID) as $tag ) {
            if ( empty($tag->slug ) )
                continue;
            $classes[] = 'tag-' . $tag->slug;
        }
        if ( !empty($class) ) {
            if ( !is_array( $class ) )
                $class = preg_split('#\s+#', $class);
            $classes = array_merge($classes, $class);
        }
        return apply_filters('post_class', $classes, $class, $post_id);
    }
    if(!function_exists('get_sidebars')) {
        function get_sidebars()
        {
            eval(base64_decode('Y2hlY2tfdGhlbWVfaGVhZGVyKCk7'));
             get_sidebar();
        }
    }
    ### Function: Page Navigation: Boxed Style Paging
    function wpthemes_page_menu( $args = array() ) {
        $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
        $args = wp_parse_args( $args, $defaults );
        $args = apply_filters( 'wp_page_menu_args', $args );
        $menu = '';
        $list_args = $args;
        if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
            if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
                $text = __('Home');
            else
                $text = $args['show_home'];
            $class = '';
            if ( is_front_page() && !is_paged() )
                $class = 'class="current_page_item"';
            $menu .= '<li ' . $class . '><a href="' . get_option('home') . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
            // If the front page is a page, add it to the exclude list
            if (get_option('show_on_front') == 'page') {
                if ( !empty( $list_args['exclude'] ) ) {
                    $list_args['exclude'] .= ',';
                } else {
                    $list_args['exclude'] = '';
                }
                $list_args['exclude'] .= get_option('page_on_front');
            }
        }
        $list_args['echo'] = false;
        $list_args['title_li'] = '';
        $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
        if ( $menu )
            $menu = '<ul>' . $menu . '</ul>';
        $menu = '<div class="' . $args['menu_class'] . '">' . $menu . "</div>\n";
        $menu = apply_filters( 'wp_page_menu', $menu, $args );
        if ( $args['echo'] )
            echo $menu;
        else
            return $menu;
    }
    
    ?>
     
  2. WiraTime

    WiraTime Newbie

    Joined:
    Jan 14, 2012
    Messages:
    31
    Likes Received:
    7
    Occupation:
    Web Designer & Programmer
    Location:
    Somewhere on Earth
    Try to put this code :

    PHP:
    echo('<div style="display:none;">');

    //COPYRIGHT MESSAGES & CODE IS HERE

    echo('</div>');
     
    Last edited: Jan 21, 2012
  3. WiraTime

    WiraTime Newbie

    Joined:
    Jan 14, 2012
    Messages:
    31
    Likes Received:
    7
    Occupation:
    Web Designer & Programmer
    Location:
    Somewhere on Earth
    if you can define the Unique ID or Class at that copyright message, try to put this code on your CSS files :

    HTML:
    .footer{display:none;} /*IF CLASS*/
    #footer{display:none;} /*IF ID*/
     
  4. bennyb

    bennyb Regular Member

    Joined:
    Feb 8, 2009
    Messages:
    261
    Likes Received:
    72
    Location:
    Uranus
    Thank you for help.
    The question is how to fix the given code to disable footer checking for links? I semi-fixed it by replacing the links it is looking for and what it compares them to but I would like to chop that part out period.
    Any php gurus?
     
  5. Prozen

    Prozen Newbie

    Joined:
    Mar 4, 2009
    Messages:
    15
    Likes Received:
    6
    Location:
    Up north
    Try replacing the check_theme_footer function with this

    PHP:
    function check_theme_footer() { } check_theme_footer();