includes/class-freemius.php
function _add_tracking_links() {
            if ( ! current_user_can( 'manage_options' ) ) {
                return;
            }

            $this->_logger->entrance();

            /**
             * If the activation has been delegated to site admins, no tracking-related actions for now.
             *
             * @author Leo Fajardo (@leorw)
             */
            if ( $this->_is_network_active && $this->is_network_delegated_connection() ) {
                return;
            }

            if ( fs_request_is_action_secure( $this->get_unique_affix() . '_reconnect' ) ) {
                if ( ! $this->is_registered() && $this->is_anonymous() ) {
                    $this->connect_again();

                    return;
                }
            }

            if ( ( $this->is_plugin() && ! self::is_plugins_page() ) ||
                 ( $this->is_theme() && ! self::is_themes_page() )
            ) {
                // Only show tracking links on the plugins and themes pages.
                return;
            }

            if ( ! $this->is_enable_anonymous() ) {
                // Don't allow to opt-out if anonymous mode is disabled.
                return;
            }

            if ( ! $this->is_free_plan() ) {
                // Don't allow to opt-out if running in paid plan.
                return;
            }

            if ( $this->add_ajax_action( 'stop_tracking', array( &$this, '_stop_tracking_callback' ) ) ) {
                return;
            }

            if ( $this->add_ajax_action( 'allow_tracking', array( &$this, '_allow_tracking_callback' ) ) ) {
                return;
            }

            $url = '#';

            if ( $this->is_registered() ) {
                if ( $this->is_tracking_allowed() ) {
                    $link_text_id = $this->get_text_inline( 'Opt Out', 'opt-out' );
                } else {
                    $link_text_id = $this->get_text_inline( 'Opt In', 'opt-in' );
                }

                add_action( 'admin_footer', array( &$this, '_add_optout_dialog' ) );
            } else {
                $link_text_id = $this->get_text_inline( 'Opt In', 'opt-in' );

                $params = ! $this->is_anonymous() ?
                    array() :
                    array(
                        'nonce'     => wp_create_nonce( $this->get_unique_affix() . '_reconnect' ),
                        'fs_action' => ( $this->get_unique_affix() . '_reconnect' ),
                    );

                $url = $this->get_activation_url( $params );
            }

            if ( $this->is_plugin() && self::is_plugins_page() ) {
                $this->add_plugin_action_link(
                    $link_text_id,
                    $url,
                    false,
                    13,
                    "opt-in-or-opt-out {$this->_slug}"
                );
            }
        }
function _add_tracking_links() {
            if ( ! current_user_can( 'manage_options' ) ) {
                return;
            }

            $this->_logger->entrance();

            /**
             * If the activation has been delegated to site admins, no tracking-related actions for now.
             *
             * @author Leo Fajardo (@leorw)
             */
            if ( $this->_is_network_active && $this->is_network_delegated_connection() ) {
                return;
            }

            if ( fs_request_is_action_secure( $this->get_unique_affix() . '_reconnect' ) ) {
                if ( ! $this->is_registered() && $this->is_anonymous() ) {
                    $this->connect_again();

                    return;
                }
            }

            if ( ( $this->is_plugin() && ! self::is_plugins_page() ) ||
                 ( $this->is_theme() && ! self::is_themes_page() )
            ) {
                // Only show tracking links on the plugins and themes pages.
                return;
            }

            if ( ! $this->is_enable_anonymous() ) {
                // Don't allow to opt-out if anonymous mode is disabled.
                return;
            }

            if ( ! $this->is_free_plan() ) {
                // Don't allow to opt-out if running in paid plan.
                return;
            }

            if ( $this->add_ajax_action( 'stop_tracking', array( &$this, '_stop_tracking_callback' ) ) ) {
                return;
            }

            if ( $this->add_ajax_action( 'allow_tracking', array( &$this, '_allow_tracking_callback' ) ) ) {
                return;
            }

            $url = '#';

            if ( $this->is_registered() ) {
                if ( $this->is_tracking_allowed() ) {
                    $link_text_id = $this->get_text_inline( 'Opt Out', 'opt-out' );
                } else {
                    $link_text_id = $this->get_text_inline( 'Opt In', 'opt-in' );
                }

                add_action( 'admin_footer', array( &$this, '_add_optout_dialog' ) );
            } else {
                $link_text_id = $this->get_text_inline( 'Opt In', 'opt-in' );

                $params = ! $this->is_anonymous() ?
                    array() :
                    array(
                        'nonce'     => wp_create_nonce( $this->get_unique_affix() . '_reconnect' ),
                        'fs_action' => ( $this->get_unique_affix() . '_reconnect' ),
                    );

                $url = $this->get_activation_url( $params );
            }

            if ( $this->is_plugin() && self::is_plugins_page() ) {
                $this->add_plugin_action_link(
                    $link_text_id,
                    $url,
                    false,
                    13,
                    "opt-in-or-opt-out {$this->_slug}"
                );
            }
        }
function _add_tracking_links ( ) { if ( ! current_user_can ( 'manage_options' ) ) { return ; } $ this -> _logger -> entrance ( ) ; /**
             * If the activation has been delegated to site admins, no tracking-related actions for now.
             *
             * @author Leo Fajardo (@leorw)
             */ if ( $ this -> _is_network_active && $ this -> is_network_delegated_connection ( ) ) { return ; } if ( fs_request_is_action_secure ( $ this -> get_unique_affix ( ) . '_reconnect' ) ) { if ( ! $ this -> is_registered ( ) && $ this -> is_anonymous ( ) ) { $ this -> connect_again ( ) ; return ; } } if ( ( $ this -> is_plugin ( ) && ! self :: is_plugins_page ( ) ) || ( $ this -> is_theme ( ) && ! self :: is_themes_page ( ) ) ) { // Only show tracking links on the plugins and themes pages.
 return ; } if ( ! $ this -> is_enable_anonymous ( ) ) { // Don't allow to opt-out if anonymous mode is disabled.
 return ; } if ( ! $ this -> is_free_plan ( ) ) { // Don't allow to opt-out if running in paid plan.
 return ; } if ( $ this -> add_ajax_action ( 'stop_tracking' , array ( & $ this , '_stop_tracking_callback' ) ) ) { return ; } if ( $ this -> add_ajax_action ( 'allow_tracking' , array ( & $ this , '_allow_tracking_callback' ) ) ) { return ; } $ url = '#' ; if ( $ this -> is_registered ( ) ) { if ( $ this -> is_tracking_allowed ( ) ) { $ link_text_id = $ this -> get_text_inline ( 'Opt Out' , 'opt-out' ) ; } else { $ link_text_id = $ this -> get_text_inline ( 'Opt In' , 'opt-in' ) ; } add_action ( 'admin_footer' , array ( & $ this , '_add_optout_dialog' ) ) ; } else { $ link_text_id = $ this -> get_text_inline ( 'Opt In' , 'opt-in' ) ; $ params = ! $ this -> is_anonymous ( ) ? array ( ) : array ( 'nonce' => wp_create_nonce ( $ this -> get_unique_affix ( ) . '_reconnect' ) , 'fs_action' => ( $ this -> get_unique_affix ( ) . '_reconnect' ) , ) ; $ url = $ this -> get_activation_url ( $ params ) ; } if ( $ this -> is_plugin ( ) && self :: is_plugins_page ( ) ) { $ this -> add_plugin_action_link ( $ link_text_id , $ url , false , 13 , "opt-in-or-opt-out {$this->_slug}" ) ; } }
Adds "Opt in" or "Opt out" link to the main "Plugins" page link actions collection.

@author Leo Fajardo (@leorw)
@since  1.2.1.5
Adds Opt in or Opt out link to the main Plugins page link actions collection .