public static function get_config($idx = '', $filter = false) { if (!isset(self::$cf['config_filtered']) || self::$cf['config_filtered'] !== true) { // remove the sharing libs if social sharing features are disabled if (defined('NGFB_SOCIAL_SHARING_DISABLE') && NGFB_SOCIAL_SHARING_DISABLE) { foreach (self::$cf['plugin'] as $lca => $info) { unset($info['lib']['website'], $info['lib']['submenu']['sharing'], $info['lib']['submenu']['style'], $info['lib']['shortcode']['sharing'], $info['lib']['widget']['sharing'], $info['lib']['gpl']['admin']['sharing'], $info['lib']['gpl']['admin']['style'], $info['lib']['gpl']['admin']['apikeys'], $info['lib']['pro']['admin']['sharing'], $info['lib']['pro']['admin']['style'], $info['lib']['pro']['admin']['apikeys'], $info['lib']['pro']['util']['shorten']); self::$cf['plugin'][$lca] = $info; } } if ($filter === true) { self::$cf = apply_filters(self::$cf['lca'] . '_get_config', self::$cf); self::$cf['config_filtered'] = true; self::$cf['*'] = array('lib' => array(), 'version' => ''); foreach (self::$cf['plugin'] as $lca => $info) { if (isset($info['lib']) && is_array($info['lib'])) { self::$cf['*']['lib'] = SucomUtil::array_merge_recursive_distinct(self::$cf['*']['lib'], $info['lib']); } if (isset($info['version'])) { self::$cf['*']['version'] .= '-' . $lca . $info['version']; } } self::$cf['*']['version'] = trim(self::$cf['*']['version'], '-'); } } if (!empty($idx)) { if (array_key_exists($idx, self::$cf)) { return self::$cf[$idx]; } else { return false; } } else { return self::$cf; } }
public static function get_config($idx = '', $filter = false) { if (!isset(self::$cf['config_filtered']) || self::$cf['config_filtered'] !== true) { if ($filter === true) { self::$cf = apply_filters(self::$cf['lca'] . '_get_config', self::$cf); self::$cf['config_filtered'] = true; self::$cf['*'] = array('lib' => array(), 'version' => ''); foreach (self::$cf['plugin'] as $lca => $info) { if (isset($info['lib']) && is_array($info['lib'])) { self::$cf['*']['lib'] = SucomUtil::array_merge_recursive_distinct(self::$cf['*']['lib'], $info['lib']); } if (isset($info['version'])) { self::$cf['*']['version'] .= '-' . $lca . $info['version']; } } self::$cf['*']['version'] = trim(self::$cf['*']['version'], '-'); } } if (!empty($idx)) { if (array_key_exists($idx, self::$cf)) { return self::$cf[$idx]; } else { return false; } } else { return self::$cf; } }
public static function get_config($idx = false, $filter = false) { if (!isset(self::$cf['config_filtered']) || self::$cf['config_filtered'] !== true) { // remove the sharing libs if social sharing features are disabled if (defined('NGFB_SOCIAL_SHARING_DISABLE') && NGFB_SOCIAL_SHARING_DISABLE) { foreach (array_keys(self::$cf['plugin']) as $lca) { unset(self::$cf['plugin'][$lca]['lib']['website'], self::$cf['plugin'][$lca]['lib']['submenu']['sharing'], self::$cf['plugin'][$lca]['lib']['submenu']['style'], self::$cf['plugin'][$lca]['lib']['shortcode']['sharing'], self::$cf['plugin'][$lca]['lib']['widget']['sharing'], self::$cf['plugin'][$lca]['lib']['gpl']['admin']['sharing'], self::$cf['plugin'][$lca]['lib']['gpl']['admin']['style'], self::$cf['plugin'][$lca]['lib']['pro']['admin']['sharing'], self::$cf['plugin'][$lca]['lib']['pro']['admin']['style']); } } if ($filter === true) { self::$cf = apply_filters(self::$cf['lca'] . '_get_config', self::$cf); self::$cf['config_filtered'] = true; self::$cf['*'] = array('lib' => array(), 'version' => ''); foreach (self::$cf['plugin'] as $lca => $info) { if (isset($info['lib']) && is_array($info['lib'])) { self::$cf['*']['lib'] = SucomUtil::array_merge_recursive_distinct(self::$cf['*']['lib'], $info['lib']); } if (isset($info['version'])) { self::$cf['*']['version'] .= '-' . $lca . $info['version']; } } self::$cf['*']['version'] = trim(self::$cf['*']['version'], '-'); } // complete relative paths in the image array foreach (self::$cf['plugin'] as $lca => $info) { if (isset($info['base'])) { $base = self::$cf['plugin'][$lca]['base']; // nextgen-facebook/nextgen-facebook.php foreach (array('img') as $sub) { if (isset($info[$sub]) && is_array($info[$sub])) { foreach ($info[$sub] as $id => $url) { if (!empty($url) && strpos($url, '//') === false) { self::$cf['plugin'][$lca][$sub][$id] = trailingslashit(plugins_url('', $base)) . $url; } } } } } } } if ($idx !== false) { if (array_key_exists($idx, self::$cf)) { return self::$cf[$idx]; } else { return false; } } else { return self::$cf; } }
public static function get_config($idx = false, $filter = false) { if (!isset(self::$cf['config_filtered']) || self::$cf['config_filtered'] !== true) { if ($filter === true) { self::$cf['opt']['version'] .= is_dir(trailingslashit(dirname(__FILE__)) . 'pro/') ? 'pro' : 'gpl'; self::$cf = apply_filters(self::$cf['lca'] . '_get_config', self::$cf); self::$cf['config_filtered'] = true; self::$cf['*'] = array('lib' => array(), 'version' => ''); foreach (self::$cf['plugin'] as $lca => $info) { if (isset($info['lib']) && is_array($info['lib'])) { self::$cf['*']['lib'] = SucomUtil::array_merge_recursive_distinct(self::$cf['*']['lib'], $info['lib']); } if (isset($info['version'])) { self::$cf['*']['version'] .= '-' . $lca . $info['version']; } } self::$cf['*']['version'] = trim(self::$cf['*']['version'], '-'); } // complete relative paths in the image array foreach (self::$cf['plugin'] as $lca => $info) { if (isset($info['base'])) { $base = self::$cf['plugin'][$lca]['base']; // wpsso/wpsso.php foreach (array('img') as $sub) { if (isset($info[$sub]) && is_array($info[$sub])) { foreach ($info[$sub] as $id => $url) { if (!empty($url) && strpos($url, '//') === false) { self::$cf['plugin'][$lca][$sub][$id] = trailingslashit(plugins_url('', $base)) . $url; } } } } } } } if (!empty($idx)) { if (array_key_exists($idx, self::$cf)) { return self::$cf[$idx]; } else { return false; } } else { return self::$cf; } }
public function get_avail() { $ret = array(); $ret['curl'] = function_exists('curl_init') ? true : false; $ret['mbdecnum'] = function_exists('mb_decode_numericentity') ? true : false; $ret['postthumb'] = function_exists('has_post_thumbnail') ? true : false; $ret['metatags'] = (!defined('NGFB_META_TAGS_DISABLE') || defined('NGFB_META_TAGS_DISABLE') && !NGFB_META_TAGS_DISABLE) && empty($_SERVER['NGFB_META_TAGS_DISABLE']) ? true : false; $ret['opengraph'] = (!defined('NGFB_OPEN_GRAPH_DISABLE') || defined('NGFB_OPEN_GRAPH_DISABLE') && !NGFB_OPEN_GRAPH_DISABLE) && empty($_SERVER['NGFB_OPEN_GRAPH_DISABLE']) && file_exists(NGFB_PLUGINDIR . 'lib/opengraph.php') && class_exists($this->p->cf['lca'] . 'opengraph') ? true : false; $ret['aop'] = (!defined('NGFB_PRO_ADDON_DISABLE') || defined('NGFB_PRO_ADDON_DISABLE') && !NGFB_PRO_ADDON_DISABLE) && file_exists(NGFB_PLUGINDIR . 'lib/pro/head/twittercard.php') ? true : false; $ret['ssb'] = (!defined('NGFB_SOCIAL_SHARING_DISABLE') || defined('NGFB_SOCIAL_SHARING_DISABLE') && !NGFB_SOCIAL_SHARING_DISABLE) && empty($_SERVER['NGFB_SOCIAL_SHARING_DISABLE']) && file_exists(NGFB_PLUGINDIR . 'lib/sharing.php') && class_exists($this->p->cf['lca'] . 'sharing') ? true : false; foreach ($this->p->cf['cache'] as $name => $val) { $constant_name = 'NGFB_' . strtoupper($name) . '_CACHE_DISABLE'; $ret['cache'][$name] = defined($constant_name) && constant($constant_name) ? false : true; } foreach (SucomUtil::array_merge_recursive_distinct($this->p->cf['*']['lib']['pro'], self::$mac) as $sub => $lib) { $ret[$sub] = array(); $ret[$sub]['*'] = false; foreach ($lib as $id => $name) { $chk = array(); $ret[$sub][$id] = false; // default value switch ($sub . '-' . $id) { /* * 3rd Party Plugins */ case 'ecom-edd': $chk['class'] = 'Easy_Digital_Downloads'; $chk['plugin'] = 'easy-digital-downloads/easy-digital-downloads.php'; break; case 'ecom-marketpress': $chk['class'] = 'MarketPress'; $chk['plugin'] = 'wordpress-ecommerce/marketpress.php'; break; case 'ecom-woocommerce': $chk['class'] = 'Woocommerce'; $chk['plugin'] = 'woocommerce/woocommerce.php'; break; case 'ecom-wpecommerce': $chk['class'] = 'WP_eCommerce'; $chk['plugin'] = 'wp-e-commerce/wp-shopping-cart.php'; break; case 'forum-bbpress': $chk['class'] = 'bbPress'; $chk['plugin'] = 'bbpress/bbpress.php'; break; case 'lang-polylang': $chk['class'] = 'Polylang'; $chk['plugin'] = 'polylang/polylang.php'; break; case 'media-ngg': $chk['class'] = 'nggdb'; // C_NextGEN_Bootstrap $chk['plugin'] = 'nextgen-gallery/nggallery.php'; break; case 'media-photon': if (class_exists('Jetpack') && method_exists('Jetpack', 'get_active_modules') && in_array('photon', Jetpack::get_active_modules())) { $ret[$sub]['*'] = $ret[$sub][$id] = true; } break; case 'seo-aioseop': $chk['class'] = 'All_in_One_SEO_Pack'; $chk['plugin'] = 'all-in-one-seo-pack/all-in-one-seo-pack.php'; break; case 'seo-headspace2': $chk['class'] = 'HeadSpace_Plugin'; $chk['plugin'] = 'headspace2/headspace.php'; break; case 'seo-seou': $chk['class'] = 'SEO_Ultimate'; $chk['plugin'] = 'seo-ultimate/seo-ultimate.php'; break; case 'seo-wpseo': $chk['function'] = 'wpseo_init'; $chk['plugin'] = 'wordpress-seo/wp-seo.php'; break; case 'social-buddypress': $chk['class'] = 'BuddyPress'; $chk['plugin'] = 'buddypress/bp-loader.php'; break; /* * Pro Version Features / Options */ /* * Pro Version Features / Options */ case 'head-twittercard': $chk['optval'] = 'tc_enable'; break; case 'media-gravatar': $chk['optval'] = 'plugin_gravatar_api'; break; case 'media-slideshare': $chk['optval'] = 'plugin_slideshare_api'; break; case 'media-vimeo': $chk['optval'] = 'plugin_vimeo_api'; break; case 'media-wistia': $chk['optval'] = 'plugin_wistia_api'; break; case 'media-youtube': $chk['optval'] = 'plugin_youtube_api'; break; case 'admin-apikeys': case 'admin-sharing': case 'admin-style': if ($ret['ssb'] === true) { $ret[$sub]['*'] = $ret[$sub][$id] = true; } break; case 'admin-general': case 'admin-advanced': case 'admin-postmeta': case 'admin-user': case 'util-postmeta': case 'util-user': $ret[$sub]['*'] = $ret[$sub][$id] = true; break; case 'util-language': $chk['optval'] = 'plugin_filter_lang'; break; case 'util-shorten': $chk['optval'] = 'twitter_shortener'; break; } if (!empty($chk['function']) && function_exists($chk['function']) || !empty($chk['class']) && class_exists($chk['class']) || !empty($chk['plugin']) && in_array($chk['plugin'], $this->active_plugins) || !empty($chk['optval']) && !empty($this->p->options[$chk['optval']]) && $this->p->options[$chk['optval']] !== 'none') { $ret[$sub]['*'] = $ret[$sub][$id] = true; } } } return $ret; }
public function get_avail() { $ret = array(); $is_admin = is_admin(); $ret['curl'] = function_exists('curl_init') ? true : false; $ret['postthumb'] = function_exists('has_post_thumbnail') ? true : false; $ret['mbstring'] = extension_loaded('mbstring') ? true : false; foreach (array('aop', 'mt') as $key) { $ret[$key] = $this->get_avail_check($key); } foreach ($this->p->cf['cache'] as $name => $val) { $constant_name = 'WPSSO_' . strtoupper($name) . '_CACHE_DISABLE'; $ret['cache'][$name] = defined($constant_name) && constant($constant_name) ? false : true; } foreach (SucomUtil::array_merge_recursive_distinct($this->p->cf['*']['lib']['pro'], self::$extend_checks) as $sub => $lib) { $ret[$sub] = array(); $ret[$sub]['*'] = false; foreach ($lib as $id => $name) { $chk = array(); $ret[$sub][$id] = false; // default value switch ($sub . '-' . $id) { /* * 3rd Party Plugins */ case 'ecom-edd': $chk['class'] = 'Easy_Digital_Downloads'; $chk['plugin'] = 'easy-digital-downloads/easy-digital-downloads.php'; break; case 'ecom-marketpress': $chk['class'] = 'MarketPress'; $chk['plugin'] = 'wordpress-ecommerce/marketpress.php'; break; case 'ecom-woocommerce': $chk['class'] = 'Woocommerce'; $chk['plugin'] = 'woocommerce/woocommerce.php'; break; case 'ecom-wpecommerce': $chk['class'] = 'WP_eCommerce'; $chk['plugin'] = 'wp-e-commerce/wp-shopping-cart.php'; break; case 'ecom-yotpowc': // yotpo-social-reviews-for-woocommerce $chk['function'] = 'wc_yotpo_init'; break; case 'forum-bbpress': $chk['class'] = 'bbPress'; $chk['plugin'] = 'bbpress/bbpress.php'; break; case 'lang-polylang': $chk['class'] = 'Polylang'; $chk['plugin'] = 'polylang/polylang.php'; break; case 'media-ngg': $chk['class'] = 'nggdb'; // C_NextGEN_Bootstrap $chk['plugin'] = 'nextgen-gallery/nggallery.php'; break; case 'media-photon': if (class_exists('Jetpack') && method_exists('Jetpack', 'get_active_modules') && in_array('photon', Jetpack::get_active_modules())) { $ret[$sub]['*'] = $ret[$sub][$id] = true; } break; case 'seo-aioseop': $chk['class'] = 'All_in_One_SEO_Pack'; break; case 'seo-headspace2': $chk['class'] = 'HeadSpace_Plugin'; $chk['plugin'] = 'headspace2/headspace.php'; break; case 'seo-seou': $chk['class'] = 'SEO_Ultimate'; $chk['plugin'] = 'seo-ultimate/seo-ultimate.php'; break; case 'seo-wpseo': $chk['function'] = 'wpseo_init'; $chk['plugin'] = 'wordpress-seo/wp-seo.php'; break; case 'social-buddypress': $chk['class'] = 'BuddyPress'; $chk['plugin'] = 'buddypress/bp-loader.php'; break; /* * Pro Version Features / Options */ /* * Pro Version Features / Options */ case 'media-gravatar': $chk['optval'] = 'plugin_gravatar_api'; break; case 'media-slideshare': $chk['optval'] = 'plugin_slideshare_api'; break; case 'media-vimeo': $chk['optval'] = 'plugin_vimeo_api'; break; case 'media-wistia': $chk['optval'] = 'plugin_wistia_api'; break; case 'media-youtube': $chk['optval'] = 'plugin_youtube_api'; break; case 'admin-general': case 'admin-advanced': // only load on the settings pages if ($is_admin) { $page = basename($_SERVER['PHP_SELF']); if ($page === 'admin.php' || $page === 'options-general.php') { $ret[$sub]['*'] = $ret[$sub][$id] = true; } } break; case 'admin-post': case 'admin-taxonomy': case 'admin-user': if ($is_admin) { $ret[$sub]['*'] = $ret[$sub][$id] = true; } break; case 'util-post': case 'util-taxonomy': case 'util-user': $ret[$sub]['*'] = $ret[$sub][$id] = true; break; case 'util-language': $chk['optval'] = 'plugin_filter_lang'; break; case 'util-restapi': $chk['plugin'] = 'rest-api/plugin.php'; break; case 'util-shorten': $chk['optval'] = 'plugin_shortener'; break; case 'util-um': $chk['class'] = 'WpssoUm'; $chk['plugin'] = 'wpsso-um/wpsso-um.php'; break; } if (!empty($chk)) { if (isset($chk['plugin']) || isset($chk['class']) || isset($chk['function'])) { if (!empty($chk['plugin']) && isset($this->active_plugins[$chk['plugin']]) || !empty($chk['class']) && class_exists($chk['class']) || !empty($chk['function']) && function_exists($chk['function'])) { // check if an option value is also required if (isset($chk['optval'])) { if ($this->has_optval($chk['optval'])) { $ret[$sub]['*'] = $ret[$sub][$id] = true; } } else { $ret[$sub]['*'] = $ret[$sub][$id] = true; } } } if (isset($chk['optval'])) { if ($this->has_optval($chk['optval'])) { $ret[$sub]['*'] = $ret[$sub][$id] = true; } } } } } return apply_filters($this->p->cf['lca'] . '_get_avail', $ret); }
public function wpsso_get_config($cf, $plugin_version = 0) { $info = WpssoJsonConfig::$cf['plugin']['wpssojson']; if (version_compare($plugin_version, $info['req']['min_version'], '<')) { self::$have_min = false; return $cf; } return SucomUtil::array_merge_recursive_distinct($cf, WpssoJsonConfig::$cf); }