Esempio n. 1
0
 public function __construct(&$plugin)
 {
     $this->p =& $plugin;
     if (is_object($this->p->debug) && method_exists($this->p->debug, 'mark')) {
         $this->p->debug->mark();
     }
     $this->active_plugins = NgfbUtil::active_plugins();
     if (!is_admin()) {
         // disable jetPack open graph meta tags
         if (class_exists('JetPack') || isset($this->active_plugins['jetpack/jetpack.php'])) {
             add_filter('jetpack_enable_opengraph', '__return_false', 99);
             add_filter('jetpack_enable_open_graph', '__return_false', 99);
             add_filter('jetpack_disable_twitter_cards', '__return_true', 99);
         }
         // disable WordPress SEO opengraph, twitter, publisher, and author meta tags
         if (function_exists('wpseo_init') || isset($this->active_plugins['wordpress-seo/wp-seo.php'])) {
             global $wpseo_og;
             if (is_object($wpseo_og) && ($prio = has_action('wpseo_head', array($wpseo_og, 'opengraph')))) {
                 $ret = remove_action('wpseo_head', array($wpseo_og, 'opengraph'), $prio);
             }
             if (!empty($this->p->options['tc_enable']) && $this->aop()) {
                 global $wpseo_twitter;
                 if (is_object($wpseo_twitter) && ($prio = has_action('wpseo_head', array($wpseo_twitter, 'twitter')))) {
                     $ret = remove_action('wpseo_head', array($wpseo_twitter, 'twitter'), $prio);
                 }
             }
             if (!empty($this->p->options['seo_publisher_url'])) {
                 global $wpseo_front;
                 if (is_object($wpseo_front) && ($prio = has_action('wpseo_head', array($wpseo_front, 'publisher')))) {
                     $ret = remove_action('wpseo_head', array($wpseo_front, 'publisher'), $prio);
                 }
             }
             if (!empty($this->p->options['seo_def_author_id']) && !empty($this->p->options['seo_def_author_on_index'])) {
                 global $wpseo_front;
                 if (is_object($wpseo_front) && ($prio = has_action('wpseo_head', array($wpseo_front, 'author')))) {
                     $ret = remove_action('wpseo_head', array($wpseo_front, 'author'), $prio);
                 }
             }
             if (!empty($this->p->options['schema_website_json'])) {
                 add_filter('wpseo_json_ld_output', '__return_empty_array', 99);
             }
         }
     }
     do_action($this->p->cf['lca'] . '_init_check', $this->active_plugins);
 }
Esempio n. 2
0
 public function add_header()
 {
     $lca = $this->p->cf['lca'];
     if ($this->p->debug->enabled) {
         $this->p->util->log_is_functions();
     }
     if ($this->p->is_avail['metatags']) {
         echo $this->get_header_html(apply_filters($lca . '_header_use_post', false));
     } else {
         echo "\n<!-- " . $lca . " meta tags disabled -->\n";
     }
     // include additional information when debug mode is on
     if ($this->p->debug->enabled) {
         // show debug log
         $this->p->debug->show_html(null, 'debug log');
         // show constants
         $defined_constants = get_defined_constants(true);
         $defined_constants['user']['NGFB_NONCE'] = '********';
         if (is_multisite()) {
             $this->p->debug->show_html(SucomUtil::preg_grep_keys('/^(MULTISITE|^SUBDOMAIN_INSTALL|.*_SITE)$/', $defined_constants['user']), 'multisite constants');
         }
         $this->p->debug->show_html(SucomUtil::preg_grep_keys('/^NGFB_/', $defined_constants['user']), 'ngfb constants');
         // show active plugins
         $this->p->debug->show_html(print_r(NgfbUtil::active_plugins(), true), 'active plugins');
         // show available modules
         $this->p->debug->show_html(print_r($this->p->is_avail, true), 'available features');
         // show all plugin options
         $opts = $this->p->options;
         foreach ($opts as $key => $val) {
             switch (true) {
                 case strpos($key, '_html') !== false:
                 case strpos($key, '_css_') !== false:
                 case strpos($key, '_js_') !== false:
                 case preg_match('/_(key|tid)$/', $key):
                     $opts[$key] = '********';
             }
         }
         $this->p->debug->show_html($opts, 'ngfb settings');
     }
     // end of debug information
 }
Esempio n. 3
0
 public function __construct(&$plugin)
 {
     $this->p =& $plugin;
     if (is_object($this->p->debug) && method_exists($this->p->debug, 'mark')) {
         $this->p->debug->mark();
     }
     $this->active_plugins = NgfbUtil::active_plugins();
     if (!is_admin()) {
         // disable jetPack open graph meta tags
         if (class_exists('JetPack') || isset($this->active_plugins['jetpack/jetpack.php'])) {
             add_filter('jetpack_enable_opengraph', '__return_false', 99);
             add_filter('jetpack_enable_open_graph', '__return_false', 99);
             add_filter('jetpack_disable_twitter_cards', '__return_true', 99);
         }
         // disable Yoast SEO social meta tags
         if (function_exists('wpseo_init') || isset($this->active_plugins['wordpress-seo/wp-seo.php'])) {
             add_action('template_redirect', array($this, 'cleanup_wpseo_filters'), 9999);
         }
     }
     do_action($this->p->cf['lca'] . '_init_check', $this->active_plugins);
 }
Esempio n. 4
0
        public function show_form_page()
        {
            $short_aop = $this->p->cf['plugin'][$this->p->cf['lca']]['short'] . ($this->p->check->aop($this->p->cf['lca']) ? ' Pro' : ' Free');
            if (!$this->is_setting($this->menu_id)) {
                // the "setting" pages display their own error messages
                settings_errors(NGFB_OPTIONS_NAME);
            }
            // display "error" and "updated" messages
            $this->set_form();
            // define form for side boxes and show_form_content()
            if ($this->p->debug->enabled) {
                $this->p->debug->show_html(print_r($this->p->is_avail, true), 'available features');
                $this->p->debug->show_html(print_r(NgfbUtil::active_plugins(), true), 'active plugins');
                $this->p->debug->show_html(null, 'debug log');
            }
            ?>

			<div class="wrap" id="<?php 
            echo $this->pagehook;
            ?>
">
				<h2><?php 
            $this->show_follow_icons();
            echo $short_aop . ' &ndash; ' . $this->menu_name;
            ?>
</h2>
				<div id="poststuff" class="metabox-holder has-right-sidebar">
					<div id="side-info-column" class="inner-sidebar">
						<?php 
            do_meta_boxes($this->pagehook, 'side', null);
            ?>
					</div><!-- .inner-sidebar -->
					<div id="post-body" class="has-sidebar">
						<div id="post-body-content" class="has-sidebar-content">
							<?php 
            $this->show_form_content();
            ?>
						</div><!-- .post-body-content -->
					</div><!-- .post-body -->
				</div><!-- .metabox-holder -->
			</div><!-- .wrap -->
			<script type="text/javascript">
				//<![CDATA[
				jQuery(document).ready( 
					function($) {
						// close postboxes that should be closed
						$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
						// postboxes setup
						postboxes.add_postbox_toggles('<?php 
            echo $this->pagehook;
            ?>
');
					}
				);
				//]]>
			</script>
			<?php 
        }
Esempio n. 5
0
        public function show_setting_page($sidebar = true)
        {
            if (!$this->is_setting()) {
                settings_errors(NGFB_OPTIONS_NAME);
            }
            $this->set_form_property();
            // set form for side boxes and show_form_content()
            if ($this->p->debug->enabled) {
                $this->p->debug->show_html(print_r($this->p->is_avail, true), 'available features');
                $this->p->debug->show_html(print_r(NgfbUtil::active_plugins(), true), 'active plugins');
                $this->p->debug->show_html(null, 'debug log');
            }
            echo '<div class="wrap" id="' . $this->pagehook . '">' . "\n";
            echo '<h1>' . $this->p->cf['plugin'][$this->p->cf['lca']]['short'] . self::$is_suffix . ' &ndash; ' . $this->menu_name . '</h1>' . "\n";
            if ($sidebar === false) {
                echo '<div id="poststuff" class="metabox-holder">' . "\n";
                echo '<div id="post-body">' . "\n";
                echo '<div id="post-body-content">' . "\n";
            } else {
                echo '<div id="poststuff" class="metabox-holder has-right-sidebar">' . "\n";
                echo '<div id="side-info-column" class="inner-sidebar">' . "\n";
                do_meta_boxes($this->pagehook, 'side', null);
                echo '</div><!-- .inner-sidebar -->' . "\n";
                echo '<div id="post-body" class="has-sidebar">' . "\n";
                echo '<div id="post-body-content" class="has-sidebar-content">' . "\n";
            }
            $this->show_form_content();
            ?>
						</div><!-- .post-body-content -->
					</div><!-- .post-body -->
				</div><!-- .metabox-holder -->
			</div><!-- .wrap -->
			<script type="text/javascript">
				//<![CDATA[
				jQuery(document).ready( 
					function($) {
						// close postboxes that should be closed
						$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
						// postboxes setup
						postboxes.add_postbox_toggles('<?php 
            echo $this->pagehook;
            ?>
');
					}
				);
				//]]>
			</script>
			<?php 
        }