警告:session_start():无法发送会话缓存限制器

时间:2015-12-07 00:19:50

标签: wordpress

这是我在尝试处理付款页面时遇到的错误我不知道该怎么办我找到了这段代码

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/bargainhivee/public_html/wp-includes/wp-db.php:1482) in /home/bargainhivee/public_html/wp-content/plugins/Tevolution/tmplconnector/templatic-connector.php on line 5

这是第5行

 if (!isset($_SESSION)) { session_start(); }

这是php文件templatic-connector.php

<?php
    /*
    * includes the main files of tevolution default ad-on such as claim ownership,custom taxonomy,csutom fields,etc. and common functions.
    */
    if (!isset($_SESSION)) { session_start(); }

    require_once(TEMPL_MONETIZE_FOLDER_PATH."/templatic-claim_ownership/install.php" ); 
    require_once(TEMPL_MONETIZE_FOLDER_PATH."/templatic-custom_taxonomy/install.php" );
    require_once(TEMPL_MONETIZE_FOLDER_PATH."/templatic-custom_fields/install.php" );
    require_once(TEMPL_MONETIZE_FOLDER_PATH."/templatic-monetization/install.php" );
    require_once(TEMPL_MONETIZE_FOLDER_PATH."/templatic-ratings/install.php" );
    require_once(TEMPL_MONETIZE_FOLDER_PATH."/templatic-registration/install.php" );
    require_once (TEMPL_MONETIZE_FOLDER_PATH . "/templatic-widgets/templatic_browse_by_categories_widget.php");         
    require_once (TEMPL_MONETIZE_FOLDER_PATH . "/templatic-widgets/templatic_advanced_search_widget.php");          
    require_once (TEMPL_MONETIZE_FOLDER_PATH . "/templatic-widgets/templatic_people_list_widget.php");          
    require_once (TEMPL_MONETIZE_FOLDER_PATH . "/templatic-widgets/templatic_metakey_search_widget.php");           

    require_once(TEMPL_MONETIZE_FOLDER_PATH."templatic-generalization/general_functions.php" );

    /* Add to favourites for tevolution*/
    if(file_exists(TEMPL_MONETIZE_FOLDER_PATH."templatic-generalization/add_to_favourites.php") && (!strstr($_SERVER['REQUEST_URI'],'/wp-admin/') || strstr

    ($_SERVER['REQUEST_URI'],'/admin-ajax.php') )){
        require_once(TEMPL_MONETIZE_FOLDER_PATH."templatic-generalization/add_to_favourites.php" );
    }

    /*
     do action for admin menu
    */
    add_action('admin_menu', 'templ_add_admin_menu_'); /* create templatic admin menu */
    function templ_add_admin_menu_()
    {
        do_action('templ_add_admin_menu_');
    }


    add_action('templ_add_admin_menu_', 'templ_add_mainadmin_menu_', 0);
    add_action('templ_add_admin_menu_', 'templ_remove_mainadmin_sub_menu_');
    if(!function_exists('templ_remove_mainadmin_sub_menu_')){
        function templ_remove_mainadmin_sub_menu_(){
            remove_submenu_page('templatic_system_menu', 'templatic_system_menu'); 
            add_submenu_page( 'templatic_system_menu', __('Overview','templatic-admin'), __('Overview','templatic-admin'), 'administrator', 

    'templatic_system_menu', 'templatic_connector_class' );
        }
    }
    /*
     include the main.connector.class.php file
    */
    function templatic_connector_class()
    {
         require_once(TEVOLUTION_PAGE_TEMPLATES_DIR.'classes/main.connector.class.php' );   
    }
    /*
        Return the main menu at admin sidebar
    */
    function templ_add_mainadmin_menu_()
    {
        $menu_title = __('Tevolution', 'templatic');
        if (function_exists('add_object_page'))
        {
            if(isset($_REQUEST['page']) && $_REQUEST['page'] == 'templatic_system_menu'){
                $icon = TEMPL_PLUGIN_URL.'favicon-active.png';
            }else{
                $icon = TEMPL_PLUGIN_URL.'favicon-active.png';
            }
            $hook = add_menu_page("Admin Menu", $menu_title, 'administrator', 'templatic_system_menu', 'dashboard_bundles', '',3); /* title of new 

    sidebar*/
        }else{
            add_menu_page("Admin Menu", $menu_title, 'administrator',  'templatic_wp_admin_menu', 'design','');     
        } 
    }
    /*
     return the connection with dashboard wizards(bundle box)
    */
    function dashboard_bundles()
    {
        $Templatic_connector = New Templatic_connector;
        require_once(TEVOLUTION_PAGE_TEMPLATES_DIR.'classes/main.connector.class.php' );    
        if(isset($_REQUEST['tab']) && $_REQUEST['tab'] =='extend') {    
            $Templatic_connector->templ_extend();
        }else if(isset($_REQUEST['tab']) && $_REQUEST['tab'] =='payment-gateways') {    
            $Templatic_connector->templ_payment_gateway();
        }else if((!isset($_REQUEST['tab'])&& @$_REQUEST['tab']=='') || isset($_REQUEST['tab']) && $_REQUEST['tab'] =='overview') {  
            $Templatic_connector->templ_overview();
            $Templatic_connector->templ_dashboard_extends();
        }

    }

    /*
     return main CSS of Plugin
    */
    add_action('admin_head', 'templ_add_my_stylesheet'); /* include style sheet */
    add_action('wp_head', 'templ_add_my_stylesheet',0); /* include style sheet */   

    function templ_add_my_stylesheet()
    {

      /* Respects SSL, Style.css is relative to the current file */
        wp_enqueue_script('jquery');

        $tmpl_is_allow_url_fopen = tmpl_is_allow_url_fopen();

        /* Tevolution Plug-in Style Sheet File In Desktop view only  */ 
        if (function_exists('tmpl_wp_is_mobile') && !tmpl_wp_is_mobile()) {

            /* if "allow_url_fopen" is enabled then apply minifiled css otherwise includse seperately */
            if(!$tmpl_is_allow_url_fopen){
                wp_enqueue_style('tevolution_style',TEMPL_PLUGIN_URL.'style.css','',false);
            }else{
                wp_enqueue_style('tevolution_style',TEMPL_PLUGIN_URL.'css.minifier.php','',false);
            }
        }
        if(function_exists('theme_get_settings')){
            if(theme_get_settings('supreme_archive_display_excerpt')){
                if(function_exists('tevolution_excerpt_length')){
                    add_filter('excerpt_length', 'tevolution_excerpt_length');
                }
                if(function_exists('new_excerpt_more')){
                    add_filter('excerpt_more', 'new_excerpt_more');
                }
            }
        }
    }

    /* check if "allow_url_fopen" is enabled or not */
    function tmpl_is_allow_url_fopen(){
        if( ini_get('allow_url_fopen') ) {
            return true;
        }else{
            return false;
        }
    }   

    /*
    return each add-ons is activated or not
    */
    function is_active_addons($key)
    {
      $act_key = get_option($key);
      if ($act_key != '')
      {
        return true;
      }
    }
    /*
     Function will remove the admin dashboard widget
    */
    function templ_remove_dashboard_widgets()
    {
      /* Globalize the metaboxes array, this holds all the widgets for wp-admin*/
      global $wp_meta_boxes;
      /* Remove the Dashboard quickpress widget*/
      unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
      /* Remove the Dashboard  incoming links widget*/
      unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
      /* Remove the Dashboard secondary widget*/
      unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
    }
    add_action('wp_dashboard_setup', 'templ_remove_dashboard_widgets');

    /* -- coding to add submenu under main menu-- */
    add_action('templ_add_admin_menu_', 'templ_add_page_menu');
    function templ_add_page_menu()
    {

        /*tevolution_menu_before_general_settings hook for add additional menu before general settings */
        do_action('tevolution_menu_before_general_settings');

        $menu_title2 = __('Settings', 'templatic-admin');
        add_submenu_page('templatic_system_menu', $menu_title2, $menu_title2,'administrator', 'templatic_settings', 'my_page_templates_function');

        /*tevolution_menu_after_general_settings hook for add additional menu after general settings */
        do_action('tevolution_menu_after_general_settings');        
    }

    /*
        Email, security , and set up steps menu selected
     */
    add_action('admin_footer','tevolution_menu_script');
    function tevolution_menu_script()
    {
        ?>
        <script  data-cfasync="false" type="text/javascript" async >
         jQuery(document).ready(function(){ 
              if(jQuery('#adminmenu ul.wp-submenu li').hasClass('current'))
              {
                   <?php if(isset($_REQUEST['page']) && $_REQUEST['page']=='templatic_system_menu' && isset($_REQUEST['tab']) && $_REQUEST['tab']=='setup-steps' 

    ):?>
                   jQuery('#adminmenu ul.wp-submenu li').removeClass('current');
                   jQuery('#adminmenu ul.wp-submenu li a').removeClass('current');                              
                   jQuery('#adminmenu ul.wp-submenu li a[href*="page=templatic_system_menu&tab=setup-steps"]').attr('href', function() {                


                            jQuery('#adminmenu ul.wp-submenu li a[href*="page=templatic_system_menu&tab=setup-steps"]').addClass('current');
                            jQuery('#adminmenu ul.wp-submenu li a[href*="page=templatic_system_menu&tab=setup-steps"]').parent().addClass('current');
                   });
                   <?php endif;?>

              }
              jQuery('.reset_custom_fields').click( function() {
                   if(confirm("<?php echo __('All your modifications done with this, will be deleted forever! Still you want to proceed?','templatic-admin');?

    >")){
                        return true;
                   }else{
                        return false;
                   }    
              });
         });
         </script>
         <?php
    }

    /* include general_settings.php file */
    function my_page_templates_function()
    {   
        include(TEMPL_MONETIZE_FOLDER_PATH.'templatic-generalization/general_settings.php');

    }

    /*
        Redirect on plugin dashboard after activating plugin
    */
    add_action('admin_init', 'my_plugin_redirect');
    function my_plugin_redirect()
    {  
        global $pagenow;    
        if (get_option('myplugin_redirect_on_first_activation') == 'true' && $pagenow=='plugins.php' ){
            update_option('myplugin_redirect_on_first_activation', 'false');
            wp_redirect(MY_PLUGIN_SETTINGS_URL);
        }
        if (get_option('myplugin_redirect_on_first_activation') == 'true' && $pagenow=='themes.php' ){
            update_option('myplugin_redirect_on_first_activation', 'false');
            wp_redirect(site_url().'/wp-admin/themes.php');
        }
    }

    /*
     * View counter for detail page
     */
    function view_counter_single_post($pid){    
        if($_SERVER['HTTP_REFERER'] == '' || !strstr($_SERVER['HTTP_REFERER'],$_SERVER['REQUEST_URI']))
        {
            $viewed_count = get_post_meta($pid,'viewed_count',true);
            $viewed_count_daily = get_post_meta($pid,'viewed_count_daily',true);
            $daily_date = get_post_meta($pid,'daily_date',true);

            update_post_meta($pid,'viewed_count',$viewed_count+1);
        if(get_post_meta($pid,'daily_date',true) == date('Y-m-d')){
                update_post_meta($pid,'viewed_count_daily',$viewed_count_daily+1);
            } else {
                update_post_meta($pid,'viewed_count_daily','1');
            }
            update_post_meta($pid,'daily_date',date('Y-m-d'));
        }
    }

    /*
     * return the count of post view 
     */
    if(!function_exists('user_single_post_visit_count')){
    function user_single_post_visit_count($pid)
    {
        if(get_post_meta($pid,'viewed_count',true))
        {
            return get_post_meta($pid,'viewed_count',true);
        }else
        {
            return '0'; 
        }
    }
    }
    /*
     * Function Name:user_single_post_visit_count_daily
     * Argument: Post id
     */
    if(!function_exists('user_single_post_visit_count_daily')){
    function user_single_post_visit_count_daily($pid)
    {
        if(get_post_meta($pid,'viewed_count_daily',true))
        {
            return get_post_meta($pid,'viewed_count_daily',true);
        }else
        {
            return '0'; 
        }
    }
    }
    /*
     * add view count display after the content
     */
    if( !function_exists('view_count')){
    function view_count( $content ) {   

        if ( is_single()) 
        {
            global $post;
            $sep =" , ";
            $custom_content='';
            $custom_content.="<p>".__('Visited','templatic')." ".user_single_post_visit_count($post->ID)." ".__('times','templatic');
            $custom_content.= $sep.user_single_post_visit_count_daily($post->ID).__(" Visits today",'templatic')."</p>";
            $custom_content .= $content;
            echo $custom_content;
        } 
    }
    }
    /*
     * show counter and share button after custom fields.
     */
    function teamplatic_view_counter()
    {
       $settings = get_option( "templatic_settings" );      
       if(isset($settings['templatic_view_counter']) && $settings['templatic_view_counter']=='Yes')
       {    
            global $post;
            view_counter_single_post($post->ID);
            view_count('');
       }  
       //view_sharing_buttons('');
       tevolution_socialmedia_sharelink();

    }

    /*Remove the  the_content filter to add view counter everywhere in single page and add action tmpl_detail_page_custom_fields_collection before the custom 

    field display*/

    add_action('tmpl_detail_page_custom_fields_collection','teamplatic_view_counter',5);
    function view_sharing_buttons($content)
    {
        global $post;   
        if (is_single() && ($post->post_type!='post' && $post->post_type!='page'  && $post->post_type!='product'   && $post->post_type!='product_variation' 

    )) 
        {
            $post_img = bdw_get_images_plugin($post->ID,'thumb');
            $post_images = $post_img[0];
            $title=urlencode($post->post_title);
            $url=urlencode(get_permalink($post->ID));
            $summary=urlencode(htmlspecialchars($post->post_content));
            $image=$post_images;
            $settings = get_option( "templatic_settings" );

            if($settings['facebook_share_detail_page'] =='yes' || $settings['google_share_detail_page'] == 'yes' || $settings

    ['twitter_share_detail_page'] == 'yes' || $settings['pintrest_detail_page']=='yes'){
            echo '<div class="share_link">';
                if($settings['facebook_share_detail_page'] == 'yes')
                  {
                    ?>
                    <a onClick="window.open('//www.facebook.com/sharer.php?s=100&amp;p[title]=<?php echo $title;?>&amp;p[summary]=<?php echo 

    $summary;?>&amp;p[url]=<?php echo $url; ?>&amp;&amp;p[images][0]=<?php echo $image;?>','sharer','toolbar=0,status=0,width=548,height=325');" 

    href="javascript: void(0)" id="facebook_share_button"><?php _e('Facebook Share.',T_DOMAIN); ?></a>
                    <?php
                  }
                if($settings['google_share_detail_page'] == 'yes'): ?>
                    <script data-cfasync="false" type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
                    <div class="g-plus" data-action="share" data-annotation="bubble"></div> 
                <?php endif;

                if($settings['twitter_share_detail_page'] == 'yes'): ?>
                        <a href="https://twitter.com/share" class="twitter-share-button" data-lang="en" data-text='<?php echo htmlentities

    ($post->post_content);?>' data-url="<?php echo get_permalink($post->ID); ?>" data-counturl="<?php echo get_permalink($post->ID); ?>"><?php _e

    ('Tweet',T_DOMAIN); ?></a>
                        <script data-cfasync="false">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id))

    {js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-

    wjs");</script>
                <?php endif;

                if(@$settings['pintrest_detail_page']=='yes'):?>
                   <!-- Pinterest -->
                   <div class="pinterest"> 
                        <a href="//pinterest.com/pin/create/button/?url=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;media=<?php echo $image; ?

    >&amp;description=<?php the_title(); ?>" ><?php _e('Pin It','templatic');?></a>
                        <script data-cfasync="false" type="text/javascript" src="http://assets.pinterest.com/js/pinit.js"></script>                    
                   </div>
                   <?php endif; 
            echo '</div>';
            }
        }
        return $content;
    }

    /*
        return the currency code 
    */
    function templatic_get_currency_type()
    {
        global $wpdb;
        $option_value = get_option('currency_code');
        if($option_value)
        {
            return stripslashes($option_value);
        }else
        {
            return 'USD';
        }

    }
    /* 
        this function returns the currency with position selected in currency settings 
    */
    function fetch_currency_with_position($amount,$currency = '')
    {
        $amt_display = '';
        if($amount==''){ $amount =0; }
        $decimals=get_option('tmpl_price_num_decimals');
        $decimals=($decimals!='')?$decimals:2;
        if($amount >=0 )
        {
            if(@$amount !='')
                $amount = number_format( (float)($amount),$decimals,'.','');
                $currency = get_option('currency_symbol');
                $position = get_option('currency_pos');
            if($position == '1')
            {
                $amt_display = $currency.$amount;
            }
            else if($position == '2')
            {
                $amt_display = $currency.' '.$amount;
            }
            else if($position == '3')
            {
                $amt_display = $amount.$currency;
            }
            else
            {
                $amt_display = $amount.' '.$currency;
            }
            return apply_filters('tmpl_price_format',$amt_display,$amount,$currency);
        }
    }

    /* 
        this function returns the currency with position selected in currency settings 
    */
    function fetch_currency_with_symbol($amount,$currency = '')
    {
        $amt_display = '';
        if($amount==''){ $amount =0; }
        $decimals=get_option('tmpl_price_num_decimals');
        $decimals=($decimals!='')?$decimals:2;
        if($amount >=0 )
        {
            if(@$amount !='')
                $amount = $amount;
                $currency = get_option('currency_symbol');
                $position = get_option('currency_pos');
            if($position == '1')
            {
                $amt_display = $currency.$amount;
            }
            else if($position == '2')
            {
                $amt_display = $currency.' '.$amount;
            }
            else if($position == '3')
            {
                $amt_display = $amount.$currency;
            }
            else
            {
                $amt_display = $amount.' '.$currency;
            }
            return apply_filters('tmpl_price_format',$amt_display,$amount,$currency);
        }
    }

    /* eof - display currency with position */

    /*  this function will display the legends descr

0 个答案:

没有答案