public static function &get_instance() { if (self::$instance === null) { self::$instance = new self(); } return self::$instance; }
function wpsso_get_short_url($use_post = false, $add_page = true, $source_id = false) { $wpsso =& Wpsso::get_instance(); return apply_filters('wpsso_shorten_url', $wpsso->util->get_sharing_url($post_id, $add_page, $source_id), $wpsso->options['plugin_shortener']); }
function wpsso_schema_attributes($attr = '') { $wpsso =& Wpsso::get_instance(); echo $wpsso->schema->add_head_attributes($attr); }
public static function get_pref($idx = false, $user_id = false) { $user_id = $user_id === false ? get_current_user_id() : $user_id; if (!isset(self::$pref[$user_id]['options_filtered']) || self::$pref[$user_id]['options_filtered'] !== true) { self::$pref[$user_id] = get_user_meta($user_id, WPSSO_PREF_NAME, true); if (!is_array(self::$pref[$user_id])) { self::$pref[$user_id] = array(); } $wpsso = Wpsso::get_instance(); if (!isset(self::$pref[$user_id]['show_opts'])) { self::$pref[$user_id]['show_opts'] = $wpsso->options['plugin_show_opts']; } self::$pref[$user_id]['options_filtered'] = true; } if ($idx !== false) { if (isset(self::$pref[$user_id][$idx])) { return self::$pref[$user_id][$idx]; } else { return false; } } else { return self::$pref[$user_id]; } }
public static function add_single_video_data(&$json_data, $opts, $prefix = 'og:video', $list_element = true) { $wpsso =& Wpsso::get_instance(); if (empty($opts) || !is_array($opts)) { if ($wpsso->debug->enabled) { $wpsso->debug->log('exiting early: options array is empty or not an array'); } return 0; // return count of videos added } $media_url = SucomUtil::get_mt_media_url($opts, $prefix); if (empty($media_url)) { if ($ngfb->debug->enabled) { $ngfb->debug->log('exiting early: ' . $prefix . ' URL values are empty'); } return 0; // return count of videos added } $ret = array('@context' => 'https://schema.org', '@type' => 'VideoObject', 'url' => esc_url($media_url)); WpssoSchema::add_data_itemprop_from_assoc($ret, $opts, array('name' => $prefix . ':title', 'description' => $prefix . ':description', 'fileFormat' => $prefix . ':type', 'width' => $prefix . ':width', 'height' => $prefix . ':height', 'duration' => $prefix . ':duration', 'uploadDate' => $prefix . ':upload_date', 'thumbnailUrl' => $prefix . ':thumbnail_url', 'embedUrl' => $prefix . ':embed_url')); if (!empty($opts[$prefix . ':has_image'])) { if (!WpssoSchema::add_single_image_data($ret['thumbnail'], $opts, 'og:image', false)) { // list_element = false unset($ret['thumbnail']); } } if (empty($list_element)) { $json_data = $ret; } else { $json_data[] = $ret; } // add an item to the list return 1; // return count of videos added }
public function wpsso_init_options() { if (method_exists('Wpsso', 'get_instance')) { $this->p =& Wpsso::get_instance(); } else { $this->p =& $GLOBALS['wpsso']; } if ($this->p->debug->enabled) { $this->p->debug->mark(); } if (self::$have_min === false) { return; } // stop here $this->p->is_avail['json'] = true; foreach (array('gpl', 'pro') as $lib) { foreach (array('head', 'prop') as $sub) { if (!isset(WpssoJsonConfig::$cf['plugin']['wpssojson']['lib'][$lib][$sub]) || !is_array(WpssoJsonConfig::$cf['plugin']['wpssojson']['lib'][$lib][$sub])) { continue; } foreach (WpssoJsonConfig::$cf['plugin']['wpssojson']['lib'][$lib][$sub] as $id_key => $label) { list($id, $stub, $action) = SucomUtil::get_lib_stub_action($id_key); $this->p->is_avail[$sub][$id] = true; } } } }