public function opengraph() { $tags = []; if (is_singular()) { $tags['og:title'] = get_the_title(); } elseif (is_archive()) { $tags['og:title'] = get_the_archive_title(); } if (is_singular()) { $tags['og:description'] = get_the_excerpt(); } if (is_singular()) { $tags['og:url'] = get_permalink(); } elseif (is_tax()) { $tags['og:url'] = get_term_link(get_queried_object(), get_queried_object()->taxonomy); } if (is_singular() && has_post_thumbnail()) { $tags['og:image'] = get_the_post_thumbnail_url('full'); } $tags = wp_parse_args($tags, ['og:type' => 'website', 'og:title' => get_bloginfo('name'), 'og:description' => get_bloginfo('description'), 'og:url' => home_url('/'), 'og:image' => get_site_icon_url()]); $tags = array_filter($tags); $tags = apply_filters('opengraph_tags', $tags); foreach ($tags as $property => $content) { printf(' <meta property="%s" content="%s">', esc_attr($property), esc_attr($content)); } }
/** * @return string Inline CSS * @since 0.0.1-dev */ private function get_css() { if (has_post_thumbnail() && !post_password_required()) { $thumb = esc_url(get_the_post_thumbnail_url(null, 'push7ssb-sbz-thumbnail')); } elseif (has_site_icon()) { $thumb = esc_url(get_site_icon_url()); } else { $thumb = ''; } return <<<EOI .push7-sb-sbz-with-thumb { \tbackground-image: url({$thumb}); } .push7-sb-sbz-with-thumb-subscribe { \tbackground-color: rgba(43,43,43, 0.7); \tcolor: #ffffff; } @media only screen and (min-width : 415px) { \t.push7-sb-sbz-with-thumb-thumbnail { \t\tbackground-image: url({$thumb}); \t} \t.push7-sb-sbz-with-thumb-subscribe { \t\tbackground-color: rgba(43,43,43, 1); \t} } EOI; }
private function prepare_item($blog) { $details = get_blog_details($blog); $id = $blog['blog_id']; switch_to_blog($id); $result = ['id' => $id, 'name' => $details->blogname, 'icon' => get_site_icon_url(), 'cover_image' => get_header_image(), 'color' => '#FFA000', 'path' => $blog['path'], 'description' => get_bloginfo($blog), 'live' => in_array($id, $this->included_site_ids)]; restore_current_blog(); return $result; }
private function prepare_item($blog) { $details = get_blog_details($blog); $id = $blog['blog_id']; switch_to_blog($id); $result = ['id' => $id, 'name' => $details->blogname, 'icon' => get_site_icon_url(), 'path' => $blog['path'], 'description' => get_bloginfo($blog), 'global' => in_array($id, $this->GLOBAL_SITE_IDS)]; restore_current_blog(); return $result; }
/** * If there is no current site icon create one. * * @since 2.0.0 * */ public static function ensure() { if (get_site_icon_url(64)) { return; } if (Prompt_Core::$options->get('site_icon')) { return; } self::refresh(); }
public function __construct($post_id) { $this->template_dir = AMP__DIR__ . '/templates'; $this->ID = $post_id; $this->post = get_post($post_id); $content_max_width = isset($GLOBALS['content_width']) ? absint($GLOBALS['content_width']) : 600; $content_max_width = apply_filters('amp_content_max_width', $content_max_width); $this->data = array('content_max_width' => $content_max_width, 'document_title' => function_exists('wp_get_document_title') ? wp_get_document_title() : wp_title('', false), 'canonical_url' => get_permalink($post_id), 'home_url' => home_url(), 'blog_name' => get_bloginfo('name'), 'site_icon_url' => get_site_icon_url(self::SITE_ICON_SIZE), 'placeholder_image_url' => amp_get_asset_url('images/placeholder-icon.png'), 'amp_runtime_script' => 'https://cdn.ampproject.org/v0.js', 'amp_component_scripts' => array()); $this->build_post_content(); $this->build_post_data(); $this->data = apply_filters('amp_post_template_data', $this->data, $this->post); }
function tokopress_wphead_favicon() { if (function_exists('get_site_icon_url') && get_site_icon_url()) { return; } $icon = of_get_option('tokopress_favicon') ? of_get_option('tokopress_favicon') : THEME_URI . '/img/favicon.png'; ?> <link rel="shortcut icon" type="image/x-icon" href="<?php echo esc_url($icon); ?> " /> <?php }
/** * Get thumbnail image url * * @param null|\WP_Post $_post Post data object. * * @return string */ public static function get_thumbnail($_post = null) { $thumb = apply_filters(VA_SOCIALBUZZ_PREFIX . 'default_thumbnail', 'none'); if (empty($_post)) { global $post; $_post = $post; } if (!empty($_post) && has_post_thumbnail($_post) && !post_password_required($_post)) { $thumb = get_the_post_thumbnail_url($_post, VA_SOCIALBUZZ_PREFIX . 'thumbnail'); } elseif ('none' === $thumb && has_header_image()) { $thumb = get_header_image(); } elseif ('none' === $thumb && has_site_icon()) { $thumb = get_site_icon_url(); } return $thumb; }
/** * @author automattic * @covers ::jetpack_og_get_image * @since 3.9.2 */ public function test_jetpack_og_get_site_icon_and_logo_url() { $test_icon_id = self::_create_upload_object(dirname(__FILE__) . '/jetpack-icon.jpg'); // Test Jetpack's Site Logo update_option('site_logo', array('id' => $test_icon_id, 'url' => wp_get_attachment_url($test_icon_id))); require_once JETPACK__PLUGIN_DIR . 'modules/theme-tools/site-logo/inc/functions.php'; require_once JETPACK__PLUGIN_DIR . 'modules/theme-tools/site-logo/inc/class-site-logo.php'; $image_url = jetpack_og_get_image(); $this->assertEquals($image_url['src'], jetpack_get_site_logo('url')); // Test core's Site Icon update_option('site_icon', $test_icon_id); $image_url = jetpack_og_get_image(); $this->assertEquals($image_url['src'], get_site_icon_url(512)); delete_option('site_icon'); wp_delete_attachment($test_icon_id); }
public function __construct($post_id) { $this->template_dir = apply_filters('amp_post_template_dir', AMP__DIR__ . '/templates'); $this->ID = $post_id; $this->post = get_post($post_id); $content_max_width = self::CONTENT_MAX_WIDTH; if (isset($GLOBALS['content_width']) && $GLOBALS['content_width'] > 0) { $content_max_width = $GLOBALS['content_width']; } $content_max_width = apply_filters('amp_content_max_width', $content_max_width); $this->data = array('content_max_width' => $content_max_width, 'document_title' => function_exists('wp_get_document_title') ? wp_get_document_title() : wp_title('', false), 'canonical_url' => get_permalink($post_id), 'home_url' => home_url(), 'blog_name' => get_bloginfo('name'), 'body_class' => '', 'site_icon_url' => apply_filters('amp_site_icon_url', function_exists('get_site_icon_url') ? get_site_icon_url(self::SITE_ICON_SIZE) : ''), 'placeholder_image_url' => amp_get_asset_url('images/placeholder-icon.png'), 'featured_image' => false, 'comments_link_url' => false, 'comments_link_text' => false, 'amp_runtime_script' => 'https://cdn.ampproject.org/v0.js', 'amp_component_scripts' => array(), 'customizer_settings' => array(), 'font_urls' => array('merriweather' => 'https://fonts.googleapis.com/css?family=Merriweather:400,400italic,700,700italic'), 'amp_analytics' => apply_filters('amp_post_template_analytics', array(), $this->post)); $this->build_post_content(); $this->build_post_data(); $this->build_customizer_settings(); $this->data = apply_filters('amp_post_template_data', $this->data, $this->post); }
/** * @author automattic * @covers ::jetpack_og_get_image * @since 3.9.2 */ public function test_jetpack_og_get_site_icon_and_logo_url() { $default_url = jetpack_og_get_image(); // Test Jetpack's Site Logo update_option('site_logo', array('id' => $this->icon_id, 'url' => wp_get_attachment_url($this->icon_id))); require_once JETPACK__PLUGIN_DIR . 'modules/theme-tools/site-logo/inc/functions.php'; require_once JETPACK__PLUGIN_DIR . 'modules/theme-tools/site-logo/inc/class-site-logo.php'; // Test Smaller/Invalid Jetpack's Site Logo $image_url = jetpack_og_get_image(512, 512); $this->assertNotEquals(jetpack_get_site_logo('url'), $image_url['src']); $this->assertEquals($default_url['src'], $image_url['src']); // Test Valid-sized Jetpack's Site Logo $image_url = jetpack_og_get_image(128, 128); $this->assertEquals(jetpack_get_site_logo('url'), $image_url['src']); delete_option('site_logo'); update_option('site_icon', $this->icon_id); // Test Valid-sized core's Site Icon $image_url = jetpack_og_get_image(128, 128); $this->assertEquals(get_site_icon_url(128), $image_url['src']); delete_option('site_icon'); }
public static function on_transition_post_status($new_status, $old_status, $post) { if (empty($post) || $new_status !== 'publish') { return; } $title_option = get_option('webpush_title'); $icon_option = get_option('webpush_icon'); update_option('webpush_payload', array('title' => $title_option === 'blog_title' ? get_bloginfo('name') : $title_option, 'body' => get_the_title($post->ID), 'icon' => $icon_option === 'blog_icon' ? get_site_icon_url() : $icon_option, 'url' => get_permalink($post->ID))); $notification_count = get_option('webpush_notification_count'); $gcmKey = get_option('webpush_gcm_key'); $subscriptions = WebPush_DB::get_subscriptions(); foreach ($subscriptions as $subscription) { if (!sendNotification($subscription->endpoint, $gcmKey)) { // If there's an error while sending the push notification, // the subscription is no longer valid, hence we remove it. WebPush_DB::remove_subscription($subscription->endpoint); } else { $notification_count++; } } update_option('webpush_notification_count', $notification_count); }
<footer class="w-section rodape"> <div class="w-container"> <img class="imagem-do-rodape" src="<?php echo get_site_icon_url(16); ?> "> <p class="copyright"><?php echo date('Y'); ?> <?php bloginfo('name'); ?> </p> </div> </footer> <div class="fundo-da-pagina"></div>
_e('Oops! That embed can’t be found.'); ?> </p> <div class="wp-embed-excerpt"> <p> <?php printf(__('It looks like nothing was found at this location. Maybe try visiting %s directly?'), '<strong><a href="' . esc_url(home_url()) . '">' . esc_html(get_bloginfo('name')) . '</a></strong>'); ?> </p> </div> <div class="wp-embed-footer"> <div class="wp-embed-site-title"> <?php printf('<a href="%s" target="_top"><img src="%s" srcset="%s 2x" width="32" height="32" alt="" class="wp-embed-site-icon"/><span>%s</span></a>', esc_url(home_url()), esc_url(get_site_icon_url(32, admin_url('images/w-logo-blue.png'))), esc_url(get_site_icon_url(64, admin_url('images/w-logo-blue.png'))), esc_html(get_bloginfo('name'))); ?> </div> </div> </div> <?php } /** * Print scripts or data before the closing body tag in the embed template. * * @since 4.4.0 */ do_action('embed_footer'); ?> </body> </html>
/** * Prints the necessary markup for the site title in an embed template. * * @since 4.5.0 */ function the_embed_site_title() { $site_title = sprintf('<a href="%s" target="_top"><img src="%s" srcset="%s 2x" width="32" height="32" alt="" class="wp-embed-site-icon"/><span>%s</span></a>', esc_url(home_url()), esc_url(get_site_icon_url(32, admin_url('images/w-logo-blue.png'))), esc_url(get_site_icon_url(64, admin_url('images/w-logo-blue.png'))), esc_html(get_bloginfo('name'))); $site_title = '<div class="wp-embed-site-title">' . $site_title . '</div>'; /** * Filters the site title HTML in the embed footer. * * @since 4.4.0 * * @param string $site_title The site title HTML. */ echo apply_filters('embed_site_title_html', $site_title); }
function jetpack_sync_core_icon() { if (function_exists('get_site_icon_url')) { $url = get_site_icon_url(); } else { return; } require_once JETPACK__PLUGIN_DIR . 'modules/site-icon/site-icon-functions.php'; // If there's a core icon, maybe update the option. If not, fall back to Jetpack's. if (!empty($url) && $url !== jetpack_site_icon_url()) { // This is the option that is synced with dotcom Jetpack_Options::update_option('site_icon_url', $url); } else { if (empty($url) && did_action('delete_option_site_icon')) { Jetpack_Options::delete_option('site_icon_url'); } } }
?> "> <?php echo esc_html($post->post_title); ?> </a> </p> <div class="wp-embed-excerpt"><?php the_excerpt(); ?> </div> <div class="wp-embed-meta"> <?php printf('<img src="%s" width="32" height="32" alt="" class="wp-embed-site-icon"/>', esc_url(get_site_icon_url(32, admin_url('images/w-logo-blue.png')))); ?> <div class="wp-embed-site-title"> <?php printf('<a href="%s" target="_top" title="%s">%s</a>', esc_url(home_url()), esc_attr(get_bloginfo('name')), get_bloginfo('name')); ?> </div> </div> <div class="wp-embed-social"> <?php if (get_comments_number($post->ID) || comments_open($post->ID)) { ?> <div class="wp-embed-comments"> <a href="<?php echo esc_url(get_comments_link($post->ID)); ?>
/** * Gets the content of the browserconfig.xml file. * * @since 0.1.0 * @return string the content as valid XML */ private function get_browserconfig() { $content = '<browserconfig>' . "\n"; $content .= '<msapplication>' . "\n"; $content .= '<tile>' . "\n"; if (has_site_icon()) { foreach ($this->sizes as $size) { $content .= sprintf('<square%1$slogo src="%2$s"/>', sprintf('%1$dx%1$d', $size), esc_url(get_site_icon_url($size))) . "\n"; } } $background_color = BackgroundHandler::instance()->get_background_color(); if ($background_color) { $content .= sprintf('<TileColor>%s</TileColor>', esc_html('#' . ltrim($background_color, '#'))) . "\n"; } $content .= '</tile>' . "\n"; $content .= '</msapplication>' . "\n"; $content .= '</browserconfig>' . "\n"; return $content; }
?> </p> <div class="wp-embed-excerpt"> <p><?php _e('Error 404! The requested content was not found.', 'oembed-api'); ?> </p> </div> <div class="wp-embed-meta"> <?php printf('<a href="%s" target="_top">', esc_url(home_url())); $site_icon_url = admin_url('images/w-logo-blue.png'); if (function_exists('get_site_icon_url')) { $site_icon_url = get_site_icon_url(32, $site_icon_url); } /** * Filters the site icon URL for use in the oEmbed template. * * @param string $site_icon_url The site icon URL. */ $site_icon_url = apply_filters('oembed_site_icon_url', $site_icon_url); printf('<img src="%s" width="32" height="32" alt="" class="wp-embed-site-icon"/>', esc_url($site_icon_url)); ?> <div class="wp-embed-site-title"> <?php echo get_bloginfo('name'); ?> </div> </a>
/** * Display site icon meta tags. * * @since 4.3.0 * * @link http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-icon HTML5 specification link icon. */ function wp_site_icon() { if (!has_site_icon() && !is_customize_preview()) { return; } $meta_tags = array(sprintf('<link rel="icon" href="%s" sizes="32x32" />', esc_url(get_site_icon_url(32))), sprintf('<link rel="icon" href="%s" sizes="192x192" />', esc_url(get_site_icon_url(192))), sprintf('<link rel="apple-touch-icon-precomposed" href="%s">', esc_url(get_site_icon_url(180))), sprintf('<meta name="msapplication-TileImage" content="%s">', esc_url(get_site_icon_url(270)))); /** * Filter the site icon meta tags, so Plugins can add their own. * * @since 4.3.0 * * @param array $meta_tags Site Icon meta elements. */ $meta_tags = apply_filters('site_icon_meta_tags', $meta_tags); $meta_tags = array_filter($meta_tags); foreach ($meta_tags as $meta_tag) { echo "{$meta_tag}\n"; } }
/** * Displays Site Icon in RSS2. * * @since 4.3.0 */ function rss2_site_icon() { $rss_title = get_wp_title_rss(); if (empty($rss_title)) { $rss_title = get_bloginfo_rss('name'); } $url = get_site_icon_url(32); if ($url) { echo ' <image> <url>' . convert_chars($url) . '</url> <title>' . $rss_title . '</title> <link>' . get_bloginfo_rss('url') . '</link> <width>32</width> <height>32</height> </image> ' . "\n"; } }
/** * Builds a URL to the Jetpack connection auth page * * @since 3.9.5 * * @param bool $raw If true, URL will not be escaped. * @param bool|string $redirect If true, will redirect back to Jetpack wp-admin landing page after connection. * If string, will be a custom redirect. * @param bool|string $from If not false, adds 'from=$from' param to the connect URL. * * @return string Connect URL */ function build_connect_url($raw = false, $redirect = false, $from = false) { if (!Jetpack_Options::get_option('blog_token') || !Jetpack_Options::get_option('id')) { $url = Jetpack::nonce_url_no_esc(Jetpack::admin_url('action=register'), 'jetpack-register'); if (is_network_admin()) { $url = add_query_arg('is_multisite', network_admin_url('admin.php?page=jetpack-settings'), $url); } } else { if (defined('JETPACK__GLOTPRESS_LOCALES_PATH') && (include_once JETPACK__GLOTPRESS_LOCALES_PATH)) { $gp_locale = GP_Locales::by_field('wp_locale', get_locale()); } $role = self::translate_current_user_to_role(); $signed_role = self::sign_role($role); $user = wp_get_current_user(); $jetpack_admin_page = esc_url_raw(admin_url('admin.php?page=jetpack')); $redirect = $redirect ? wp_validate_redirect(esc_url_raw($redirect), $jetpack_admin_page) : $jetpack_admin_page; if (isset($_REQUEST['is_multisite'])) { $redirect = Jetpack_Network::init()->get_url('network_admin_page'); } $secrets = Jetpack::init()->generate_secrets('authorize'); @(list($secret) = explode(':', $secrets)); $site_icon = function_exists('has_site_icon') && has_site_icon() ? get_site_icon_url() : false; /** * Filter the type of authorization. * 'calypso' completes authorization on wordpress.com/jetpack/connect * while 'jetpack' ( or any other value ) completes the authorization at jetpack.wordpress.com. * * @since 4.3.3 * * @param string $auth_type Defaults to 'calypso', can also be 'jetpack'. */ $auth_type = apply_filters('jetpack_auth_type', 'calypso'); $args = urlencode_deep(array('response_type' => 'code', 'client_id' => Jetpack_Options::get_option('id'), 'redirect_uri' => add_query_arg(array('action' => 'authorize', '_wpnonce' => wp_create_nonce("jetpack-authorize_{$role}_{$redirect}"), 'redirect' => urlencode($redirect)), esc_url(admin_url('admin.php?page=jetpack'))), 'state' => $user->ID, 'scope' => $signed_role, 'user_email' => $user->user_email, 'user_login' => $user->user_login, 'is_active' => Jetpack::is_active(), 'jp_version' => JETPACK__VERSION, 'auth_type' => $auth_type, 'secret' => $secret, 'locale' => isset($gp_locale) && isset($gp_locale->slug) ? $gp_locale->slug : '', 'blogname' => get_option('blogname'), 'site_url' => site_url(), 'home_url' => home_url(), 'site_icon' => $site_icon)); $url = add_query_arg($args, Jetpack::api_url('authorize')); } if ($from) { $url = add_query_arg('from', $from, $url); } if (isset($_GET['calypso_env'])) { $url = add_query_arg('calypso_env', sanitize_key($_GET['calypso_env']), $url); } return $raw ? $url : esc_url($url); }
$site_title = get_bloginfo('name'); ?> <a href="<?php echo esc_url(home_url('/')); ?> " rel="home"> <div class="screen-reader-text"> <?php printf(esc_html__('Go to the home page of %1$s', 'popperscores'), $site_title); ?> </div> <?php if (has_site_icon()) { ?> <?php $site_icon = esc_url(get_site_icon_url(270)); ?> <img class="site-icon" src="<?php echo $site_icon; ?> " alt="" > <?php } else { ?> <div class="site-firstletter" aria-hidden="true"> <?php echo substr($site_title, 0, 1); ?> </div> <?php }
public static function site_icon_url() { if (!function_exists('get_site_icon_url') || !has_site_icon()) { return get_option('jetpack_site_icon_url'); } return get_site_icon_url(); }
function meso_add_custom_schema($content) { global $post, $aioseop_options; if (is_single()) { $post_aioseo_title = get_post_meta($post->ID, '_aioseop_title', true); $author_id = get_the_author_meta('ID'); $author_email = get_the_author_meta('user_email'); $author_displayname = get_the_author_meta('display_name'); $author_nickname = get_the_author_meta('nickname'); $author_firstname = get_the_author_meta('first_name'); $author_lastname = get_the_author_meta('last_name'); $author_url = get_the_author_meta('user_url'); $author_status = get_the_author_meta('user_level'); $author_description = get_the_author_meta('user_description'); $author_role = meso_get_user_role($author_id); $getsiteicon = get_site_icon_url(); if ($getsiteicon) { $favicon = $getsiteicon; } else { $favicon = get_theme_mod('fav_icon'); } // get user google+ profile $author_googleplus_profile = get_the_author_meta('wp_user_googleplus'); $author_facebook_profile = get_the_author_meta('wp_user_facebook'); $author_twitter_profile = get_the_author_meta('wp_user_twitter'); // get post thumbnail $thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), "thumbnail"); $large_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), "large"); $schema = ''; $schema .= '<!-- start data:schema --><span class="post-schema"><meta content="article" itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="' . get_permalink() . '"/>'; $schema .= '<a itemprop="url" href="' . get_permalink() . '" rel="bookmark" title="' . the_title_attribute('echo=0') . ' ">' . get_permalink() . '</a>'; if ($post_aioseo_title) { $schema .= '<span itemprop="alternativeHeadline">' . $post_aioseo_title . '</span>'; } if ($large_src) { $schema .= '<span itemprop="image" itemscope itemtype="https://schema.org/ImageObject">' . $large_src[0] . '<meta itemprop="url" content="' . $large_src[0] . '"><meta itemprop="width" content="' . $large_src[1] . '"><meta itemprop="height" content="' . $large_src[2] . '"></span>'; } if ($thumbnail_src) { $schema .= '<span itemprop="thumbnailUrl">' . $thumbnail_src[0] . '</span>'; } $getmodtime = get_the_modified_time(); if ($getmodtime > get_the_time()) { $modtime = get_the_modified_time('c'); } else { $modtime = get_the_time('c'); } $schema .= '<time datetime="' . get_the_time('Y-m-d') . '" itemprop="datePublished"><span class="date updated">' . $modtime . '</span></time><meta itemprop="dateModified" content="' . $modtime . '"/><span class="vcard author"><span class="fn">' . get_the_author() . '</span></span>'; $categories = get_the_category(); $separator = ', '; $output = ''; if ($categories) { foreach ($categories as $category) { $schema .= '<span itemprop="articleSection">' . $category->cat_name . '</span>'; } } $posttags = get_the_tags(); $post_tags_list = ''; if ($posttags) { $schema .= '<span itemprop="keywords">'; foreach ($posttags as $tag) { $post_tags_list .= $tag->name . ','; } $schema .= substr($post_tags_list, 0, -1); $schema .= '</span>'; } $schema .= '<span itemprop="description">' . meso_out_custom_excerpt(get_the_content(), 50) . '</span>'; $schema .= '<span itemprop="author" itemscope="" itemtype="http://schema.org/Person">'; $schema .= '<span itemprop="name">' . $author_displayname . '</span><a href="' . $author_googleplus_profile . '?rel=author" itemprop="url">' . $author_googleplus_profile . '</a>'; $schema .= '<span itemprop="givenName">' . $author_firstname . '</span> <span itemprop="familyName">' . $author_lastname . '</span><span itemprop="email">' . $author_email . '</span><span itemprop="jobTitle">' . $author_role . '</span>'; if ($author_description) { $schema .= '<span itemprop="knows">' . stripcslashes($author_description) . '</span>'; } $schema .= '<span itemprop="brand">' . get_bloginfo('name') . '</span>'; $schema .= '</span>'; $schema .= '<span itemprop="publisher" itemscope itemtype="https://schema.org/Organization"><span itemprop="logo" itemscope itemtype="https://schema.org/ImageObject"><img alt="' . get_bloginfo('description') . '" src="' . $favicon . '"/><meta itemprop="url" content="' . $favicon . '"><meta itemprop="width" content="80"><meta itemprop="height" content="80"></span><meta itemprop="name" content="' . get_bloginfo('name') . '"></span>'; $schema .= '</span><!-- end data:schema -->'; return $content . $schema; } else { return $content; } }
function cultiv8_atom_feed_add_icon() { ?> <feed> <icon><?php echo get_site_icon_url(); ?> </icon> <logo><?php echo get_theme_mod('cultiv8_feed_logo', get_theme_mod('cultiv8_site_logo', '')); ?> </logo> </feed> <?php }
/** * Builds a URL to the Jetpack connection auth page * * @since 3.9.5 * * @param bool $raw If true, URL will not be escaped. * @param bool|string $redirect If true, will redirect back to Jetpack wp-admin landing page after connection. * If string, will be a custom redirect. * @param bool|string $from If not false, adds 'from=$from' param to the connect URL. * * @return string Connect URL */ function build_connect_url($raw = false, $redirect = false, $from = false) { if (!Jetpack_Options::get_option('blog_token') || !Jetpack_Options::get_option('id')) { $url = Jetpack::nonce_url_no_esc(Jetpack::admin_url('action=register'), 'jetpack-register'); if (is_network_admin()) { $url = add_query_arg('is_multisite', network_admin_url('admin.php?page=jetpack-settings'), $url); } } else { require_once JETPACK__GLOTPRESS_LOCALES_PATH; $role = $this->translate_current_user_to_role(); $signed_role = $this->sign_role($role); $user = wp_get_current_user(); $redirect = $redirect ? esc_url_raw($redirect) : esc_url_raw(menu_page_url('jetpack', false)); $gp_locale = GP_Locales::by_field('wp_locale', get_locale()); if (isset($_REQUEST['is_multisite'])) { $redirect = Jetpack_Network::init()->get_url('network_admin_page'); } $secrets = Jetpack::init()->generate_secrets('authorize'); @(list($secret) = explode(':', $secrets)); $site_icon = function_exists('has_site_icon') && has_site_icon() ? get_site_icon_url() : false; $args = urlencode_deep(array('response_type' => 'code', 'client_id' => Jetpack_Options::get_option('id'), 'redirect_uri' => add_query_arg(array('action' => 'authorize', '_wpnonce' => wp_create_nonce("jetpack-authorize_{$role}_{$redirect}"), 'redirect' => urlencode($redirect)), menu_page_url('jetpack', false)), 'state' => $user->ID, 'scope' => $signed_role, 'user_email' => $user->user_email, 'user_login' => $user->user_login, 'is_active' => Jetpack::is_active(), 'jp_version' => JETPACK__VERSION, 'auth_type' => 'calypso', 'secret' => $secret, 'locale' => isset($gp_locale->slug) ? $gp_locale->slug : '', 'blogname' => get_option('blogname'), 'site_url' => site_url(), 'home_url' => home_url(), 'site_icon' => $site_icon)); $url = add_query_arg($args, Jetpack::api_url('authorize')); } if ($from) { $url = add_query_arg('from', $from, $url); } if (isset($_GET['calypso_env'])) { $url = add_query_arg('calypso_env', $_GET['calypso_env'], $url); } return $raw ? $url : esc_url($url); }
/** * Update the registered client metadata. * * @since 1.0.0 * * @param array $args Metadata to update. * @return array */ public function update_client_metadata($args = array()) { if (!$this->is_registered()) { return new WP_Error('unregistered_client', esc_html__('Cannot update an unregistered client.', 'audiotheme-agent')); } $metadata = $this->get_registered_metadata(); if (empty($metadata['registration_access_token'])) { return new WP_Error('invalid_token', esc_html__('Cannot update client metadata without a registration access token.', 'audiotheme-agent')); } if (empty($metadata['registration_client_uri'])) { return new WP_Error('unknown_endpoint', 'Unknown client registration management URI.'); } $token = $metadata['registration_access_token']; $registration_uri = $metadata['registration_client_uri']; // Update dynamic values. These can be overridden in the $args. $metadata['redirect_uris'] = array($this->get_redirect_uri()); $metadata['client_name'] = esc_html($this->get_site_name()); $metadata['client_uri'] = esc_url_raw(home_url()); $metadata['logo_uri'] = esc_url_raw(get_site_icon_url()); $metadata = wp_parse_args($args, $metadata); // Remove metadata that shouldn't be sent. unset($metadata['client_id_issued_at'], $metadata['client_secret_expires_at'], $metadata['registration_access_token'], $metadata['registration_client_uri']); $response = $this->wp_remote_request(esc_url_raw($registration_uri), array('body' => wp_json_encode($metadata), 'headers' => array('Authorization' => sprintf('Bearer %s', sanitize_text_field($token)), 'Content-Type' => 'application/json'), 'method' => 'PUT')); $data = $this->parse_response($response); if (is_wp_error($data)) { return $data; } /* * Save the registration data. */ update_option(self::CLIENT_OPTION_NAME, (array) $data); $this->log('notice', 'Updated client metadata. Client ID: {client_id}.', array('client_id' => $this->get_client_id())); return $this; }
function jetpack_og_get_image($width = 200, $height = 200, $max_images = 4) { // Facebook requires thumbnails to be a minimum of 200x200 $image = ''; if (is_singular() && !is_home()) { global $post; $image = ''; // Grab obvious image if $post is an attachment page for an image if (is_attachment($post->ID) && 'image' == substr($post->post_mime_type, 0, 5)) { $image = wp_get_attachment_url($post->ID); } // Attempt to find something good for this post using our generalized PostImages code if (!$image && class_exists('Jetpack_PostImages')) { $post_images = Jetpack_PostImages::get_images($post->ID, array('width' => $width, 'height' => $height)); if ($post_images && !is_wp_error($post_images)) { $image = array(); foreach ((array) $post_images as $post_image) { $image['src'] = $post_image['src']; if (isset($post_image['src_width'], $post_image['src_height'])) { $image['width'] = $post_image['src_width']; $image['height'] = $post_image['src_height']; } } } } } else { if (is_author()) { $author = get_queried_object(); if (function_exists('get_avatar_url')) { // Prefer the core function get_avatar_url() if available, WP 4.2+ $image['src'] = get_avatar_url($author->user_email, array('size' => $width)); } else { $has_filter = has_filter('pre_option_show_avatars', '__return_true'); if (!$has_filter) { add_filter('pre_option_show_avatars', '__return_true'); } $avatar = get_avatar($author->user_email, $width); if (!$has_filter) { remove_filter('pre_option_show_avatars', '__return_true'); } if (!empty($avatar) && !is_wp_error($avatar)) { if (preg_match('/src=["\']([^"\']+)["\']/', $avatar, $matches)) { } $image['src'] = wp_specialchars_decode($matches[1], ENT_QUOTES); } } } } if (empty($image)) { $image = array(); } else { if (!is_array($image)) { $image = array('src' => $image); } } // First fall back, blavatar if (empty($image) && function_exists('blavatar_domain')) { $blavatar_domain = blavatar_domain(site_url()); if (blavatar_exists($blavatar_domain)) { $image['src'] = blavatar_url($blavatar_domain, 'img', $width, false, true); $image['width'] = $width; $image['height'] = $height; } } // Second fall back, Site Logo if (empty($image) && (function_exists('jetpack_has_site_logo') && jetpack_has_site_logo())) { $image['src'] = jetpack_get_site_logo('url'); $image_dimensions = jetpack_get_site_logo_dimensions(); if (!empty($image_dimensions)) { $image['width'] = $image_dimensions['width']; $image['height'] = $image_dimensions['height']; } } // Third fall back, Site Icon if (empty($image) && (function_exists('jetpack_has_site_icon') && jetpack_has_site_icon())) { $image['src'] = jetpack_site_icon_url(null, '512'); $image['width'] = '512'; $image['height'] = '512'; } // Fourth fall back, Core Site Icon. Added in WP 4.3. if (empty($image) && (function_exists('has_site_icon') && has_site_icon())) { $image['src'] = get_site_icon_url(null, '512'); } // Finally fall back, blank image if (empty($image)) { /** * Filter the default Open Graph Image tag, used when no Image can be found in a post. * * @since 3.0.0 * * @param string $str Default Image URL. */ $image['src'] = apply_filters('jetpack_open_graph_image_default', 'https://s0.wp.com/i/blank.jpg'); } return $image; }
<p class="wp-embed-heading"><?php _e('Page not found'); ?> </p> <div class="wp-embed-excerpt"> <p><?php _e('Error 404! The requested content was not found.'); ?> </p> </div> <div class="wp-embed-footer"> <div class="wp-embed-site-title"> <?php $site_icon_url = get_site_icon_url(32, admin_url('images/w-logo-blue.png')); /** * Filters the site icon URL for use in the embed template. * * @since 4.4.0 * * @param string $site_icon_url The site icon URL. */ $site_icon_url = apply_filters('embed_site_icon_url', $site_icon_url); printf('<a href="%s" target="_top"><img src="%s" width="32" height="32" alt="" class="wp-embed-site-icon"/><span>%s</span></a>', esc_url(home_url()), esc_url($site_icon_url), esc_html(get_bloginfo('name'))); ?> </div> </div> </div> <?php }