本文整理汇总了PHP中SucomUtil::a2aa方法的典型用法代码示例。如果您正苦于以下问题:PHP SucomUtil::a2aa方法的具体用法?PHP SucomUtil::a2aa怎么用?PHP SucomUtil::a2aa使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SucomUtil
的用法示例。
在下文中一共展示了SucomUtil::a2aa方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_json_array
public function get_json_array($use_post, &$obj, &$mt_og, $post_id, $author_id)
{
if ($this->p->debug->enabled) {
$this->p->debug->mark();
}
$ret = array();
foreach (array_unique(array('http://schema.org/WebSite', 'http://schema.org/Person', 'http://schema.org/Organization', $this->get_head_item_type($use_post, $obj))) as $type) {
$filter_name = $this->p->cf['lca'] . '_json_' . SucomUtil::sanitize_hookname($type);
if (($json = apply_filters($filter_name, false, $use_post, $obj, $mt_og, $post_id, $author_id)) !== false) {
$ret[] = "<script type=\"application/ld+json\">\n" . $json . "</script>\n";
}
}
$ret = SucomUtil::a2aa($ret);
// convert to array or arrays
if ($this->p->debug->enabled) {
$this->p->debug->log($ret);
}
return $ret;
}
示例2: get_header_array
//.........这里部分代码省略.........
}
$header_array = array();
if ($this->p->is_avail['cache']['transient']) {
$cache_salt = __METHOD__ . '(' . apply_filters($lca . '_head_cache_salt', 'lang:' . SucomUtil::get_locale() . '_post:' . $post_id . '_url:' . $sharing_url, $use_post) . ')';
$cache_id = $lca . '_' . md5($cache_salt);
$cache_type = 'object cache';
if ($this->p->debug->enabled) {
$this->p->debug->log($cache_type . ': transient salt ' . $cache_salt);
}
if (apply_filters($lca . '_header_read_cache', $read_cache)) {
$header_array = get_transient($cache_id);
if ($header_array !== false) {
if ($this->p->debug->enabled) {
$this->p->debug->log($cache_type . ': header array retrieved from transient ' . $cache_id);
}
return $header_array;
}
}
}
/**
* Define an author_id, if one is available
*/
if (is_singular() || $use_post !== false) {
if (!empty($obj->post_author)) {
$author_id = $obj->post_author;
} elseif (!empty($this->p->options['seo_def_author_id'])) {
$author_id = $this->p->options['seo_def_author_id'];
}
} elseif (SucomUtil::is_author_page()) {
$author_id = $this->p->util->get_author_object('id');
} elseif ($this->p->util->force_default_author($use_post, 'seo')) {
$author_id = $this->p->options['seo_def_author_id'];
}
if ($this->p->debug->enabled && $author_id !== false) {
$this->p->debug->log('author_id: ' . $author_id);
}
/**
* Open Graph, Twitter Card
*
* The Twitter Card meta tags are added by the
* NgfbHeadTwittercard class using an 'ngfb_og' filter hook.
*/
$meta_og = $this->p->og->get_array($meta_og, $use_post, $obj);
/**
* Name / SEO meta tags
*/
$meta_name = array();
if (!empty($this->p->options['add_meta_name_author'])) {
if (isset($this->p->options['seo_author_name']) && $this->p->options['seo_author_name'] !== 'none') {
$meta_name['author'] = $this->p->mods['util']['user']->get_author_name($author_id, $this->p->options['seo_author_name']);
}
}
if (!empty($this->p->options['add_meta_name_canonical'])) {
$meta_name['canonical'] = $sharing_url;
}
if (!empty($this->p->options['add_meta_name_description'])) {
$meta_name['description'] = $this->p->webpage->get_description($this->p->options['seo_desc_len'], '...', $use_post, true, false, true, 'seo_desc');
}
// add_hashtags = false
if (!empty($this->p->options['add_meta_name_p:domain_verify'])) {
if (!empty($this->p->options['rp_dom_verify'])) {
$meta_name['p:domain_verify'] = $this->p->options['rp_dom_verify'];
}
}
$meta_name = apply_filters($lca . '_meta_name', $meta_name, $use_post, $obj);
/**
* Link relation tags
*/
$link_rel = array();
if (!empty($this->p->options['add_link_rel_author'])) {
if (!empty($author_id)) {
$link_rel['author'] = $this->p->mods['util']['user']->get_author_website_url($author_id, $this->p->options['seo_author_field']);
}
}
if (!empty($this->p->options['add_link_rel_publisher'])) {
if (!empty($this->p->options['seo_publisher_url'])) {
$link_rel['publisher'] = $this->p->options['seo_publisher_url'];
}
}
$link_rel = apply_filters($lca . '_link_rel', $link_rel, $use_post, $obj);
/**
* Schema meta tags
*/
$meta_schema = $this->p->schema->get_meta_array($use_post, $obj, $meta_og);
/**
* Combine and return all meta tags
*/
$comment = $this->p->cf['lca'] . ' meta tags';
$header_array = array_merge($this->get_single_tag('meta', 'name', 'generator', $short_aop . ' ' . $this->p->cf['plugin'][$lca]['version'] . ($this->p->check->aop() ? 'L' : ($this->p->is_avail['aop'] ? 'U' : 'G')) . ($this->p->is_avail['util']['um'] ? ' +' : ' -') . 'UM', '', $use_post), $this->get_tag_array('link', 'rel', $link_rel, $use_post), $this->get_tag_array('meta', 'property', $meta_og, $use_post), $this->get_tag_array('meta', 'itemprop', $meta_schema, $use_post), $this->get_tag_array('meta', 'name', $meta_name, $use_post), SucomUtil::a2aa($this->p->schema->get_json_array($post_id, $author_id, $this->p->cf['lca'] . '-schema')));
/**
* Save the header array to the WordPress transient cache
*/
if (apply_filters($lca . '_header_set_cache', $this->p->is_avail['cache']['transient'])) {
set_transient($cache_id, $header_array, $this->p->options['plugin_object_cache_exp']);
if ($this->p->debug->enabled) {
$this->p->debug->log($cache_type . ': header array saved to transient ' . $cache_id . ' (' . $this->p->options['plugin_object_cache_exp'] . ' seconds)');
}
}
return $header_array;
}
示例3: get_json_array
public function get_json_array($post_id = false, $author_id = false, $size_name = 'thumbnail')
{
if ($this->p->debug->enabled) {
$this->p->debug->mark();
}
$ret = array();
if (!empty($this->p->options['schema_website_json']) && ($json_script = $this->get_website_json_script($post_id)) !== false) {
$ret[] = $json_script;
}
if (!empty($this->p->options['schema_author_json']) && !empty($author_id) && ($json_script = $this->p->mods['util']['user']->get_person_json_script($author_id, $size_name)) !== false) {
$ret[] = $json_script;
}
if (!empty($this->p->options['schema_publisher_json']) && ($json_script = $this->get_organization_json_script($size_name)) !== false) {
$ret[] = $json_script;
}
$ret = SucomUtil::a2aa($ret);
// convert to array or arrays
if ($this->p->debug->enabled) {
$this->p->debug->log($ret);
}
return $ret;
}