Example #1
0
 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;
     }
 }
Example #2
0
 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;
     }
 }