Sharing_Service::get_global_options PHP Method

get_global_options() public method

public get_global_options ( )
    public function get_global_options()
    {
        if ($this->global === false) {
            $options = get_option('sharing-options');
            if (is_array($options) && isset($options['global'])) {
                $this->global = $options['global'];
            } else {
                $this->global = $this->set_global_options($options['global']);
            }
        }
        if (!isset($this->global['show'])) {
            $this->global['show'] = array('post', 'page');
        } elseif (is_scalar($this->global['show'])) {
            switch ($this->global['show']) {
                case 'posts':
                    $this->global['show'] = array('post', 'page');
                    break;
                case 'index':
                    $this->global['show'] = array('index');
                    break;
                case 'posts-index':
                    $this->global['show'] = array('post', 'page', 'index');
                    break;
            }
        }
        if (false === $this->global['sharing_label']) {
            $this->global['sharing_label'] = $this->default_sharing_label;
        }
        return $this->global;
    }

Usage Example

    public function output()
    {
        global $post;
        if (!function_exists('sharing_display')) {
            return;
        }
        $buttons = sharing_display('');
        if ('' == $buttons) {
            return;
        }
        $sharer = new Sharing_Service();
        $global = $sharer->get_global_options();
        $sharing = '';
        $sharing .= sprintf('<a href="#share-%d" class="popup-trigger"><i class="ion-share"></i> %s</a>', $post->ID, __('Share', 'listify'));
        $sharing .= sprintf('<div class="popup share-popup" id="share-%1$d">
				<h3 class="popup-title">%2$s</h3>
				%3$s
			</div>', $post->ID, $global['sharing_label'], $buttons);
        echo $sharing;
    }
All Usage Examples Of Sharing_Service::get_global_options