How to use logo class

Best Atoum code snippet using logo

site-logo.php

Source: site-logo.php Github

copy

Full Screen

1<?php2/​**3 * Server-side rendering of the `core/​site-logo` block.4 *5 * @package WordPress6 */​7/​**8 * Renders the `core/​site-logo` block on the server.9 *10 * @param array $attributes The block attributes.11 *12 * @return string The render.13 */​14function render_block_core_site_logo( $attributes ) {15 $adjust_width_height_filter = function ( $image ) use ( $attributes ) {16 if ( empty( $attributes['width'] ) || empty( $image ) || ! $image[1] || ! $image[2] ) {17 return $image;18 }19 $height = (float) $attributes['width'] /​ ( (float) $image[1] /​ (float) $image[2] );20 return array( $image[0], (int) $attributes['width'], (int) $height );21 };22 add_filter( 'wp_get_attachment_image_src', $adjust_width_height_filter );23 $custom_logo = get_custom_logo();24 remove_filter( 'wp_get_attachment_image_src', $adjust_width_height_filter );25 if ( empty( $custom_logo ) ) {26 return ''; /​/​ Return early if no custom logo is set, avoiding extraneous wrapper div.27 }28 if ( ! $attributes['isLink'] ) {29 /​/​ Remove the link.30 $custom_logo = preg_replace( '#<a.*?>(.*?)</​a>#i', '\1', $custom_logo );31 }32 if ( $attributes['isLink'] && '_blank' === $attributes['linkTarget'] ) {33 /​/​ Add the link target after the rel="home".34 /​/​ Add an aria-label for informing that the page opens in a new tab.35 $aria_label = 'aria-label="' . esc_attr__( '(Home link, opens in a new tab)' ) . '"';36 $custom_logo = str_replace( 'rel="home"', 'rel="home" target="' . esc_attr( $attributes['linkTarget'] ) . '"' . $aria_label, $custom_logo );37 }38 $classnames = array();39 if ( empty( $attributes['width'] ) ) {40 $classnames[] = 'is-default-size';41 }42 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classnames ) ) );43 $html = sprintf( '<div %s>%s</​div>', $wrapper_attributes, $custom_logo );44 return $html;45}46/​**47 * Register a core site setting for a site logo48 */​49function register_block_core_site_logo_setting() {50 register_setting(51 'general',52 'site_logo',53 array(54 'show_in_rest' => array(55 'name' => 'site_logo',56 ),57 'type' => 'integer',58 'description' => __( 'Site logo.' ),59 )60 );61}62add_action( 'rest_api_init', 'register_block_core_site_logo_setting', 10 );63/​**64 * Register a core site setting for a site icon65 */​66function register_block_core_site_icon_setting() {67 register_setting(68 'general',69 'site_icon',70 array(71 'show_in_rest' => true,72 'type' => 'integer',73 'description' => __( 'Site icon.' ),74 )75 );76}77add_action( 'rest_api_init', 'register_block_core_site_icon_setting', 10 );78/​**79 * Registers the `core/​site-logo` block on the server.80 */​81function register_block_core_site_logo() {82 register_block_type_from_metadata(83 __DIR__ . '/​site-logo',84 array(85 'render_callback' => 'render_block_core_site_logo',86 )87 );88}89add_action( 'init', 'register_block_core_site_logo' );90/​**91 * Overrides the custom logo with a site logo, if the option is set.92 *93 * @param string $custom_logo The custom logo set by a theme.94 *95 * @return string The site logo if set.96 */​97function _override_custom_logo_theme_mod( $custom_logo ) {98 $site_logo = get_option( 'site_logo' );99 return false === $site_logo ? $custom_logo : $site_logo;100}101add_filter( 'theme_mod_custom_logo', '_override_custom_logo_theme_mod' );102/​**103 * Updates the site_logo option when the custom_logo theme-mod gets updated.104 *105 * @param mixed $value Attachment ID of the custom logo or an empty value.106 * @return mixed107 */​108function _sync_custom_logo_to_site_logo( $value ) {109 if ( empty( $value ) ) {110 delete_option( 'site_logo' );111 } else {112 update_option( 'site_logo', $value );113 }114 return $value;115}116add_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );117/​**118 * Deletes the site_logo when the custom_logo theme mod is removed.119 *120 * @param array $old_value Previous theme mod settings.121 * @param array $value Updated theme mod settings.122 */​123function _delete_site_logo_on_remove_custom_logo( $old_value, $value ) {124 global $_ignore_site_logo_changes;125 if ( $_ignore_site_logo_changes ) {126 return;127 }128 /​/​ If the custom_logo is being unset, it's being removed from theme mods.129 if ( isset( $old_value['custom_logo'] ) && ! isset( $value['custom_logo'] ) ) {130 delete_option( 'site_logo' );131 }132}133/​**134 * Deletes the site logo when all theme mods are being removed.135 */​136function _delete_site_logo_on_remove_theme_mods() {137 global $_ignore_site_logo_changes;138 if ( $_ignore_site_logo_changes ) {139 return;140 }141 if ( false !== get_theme_support( 'custom-logo' ) ) {142 delete_option( 'site_logo' );143 }144}145/​**146 * Hooks `_delete_site_logo_on_remove_custom_logo` in `update_option_theme_mods_$theme`.147 * Hooks `_delete_site_logo_on_remove_theme_mods` in `delete_option_theme_mods_$theme`.148 *149 * Runs on `setup_theme` to account for dynamically-switched themes in the Customizer.150 */​151function _delete_site_logo_on_remove_custom_logo_on_setup_theme() {152 $theme = get_option( 'stylesheet' );153 add_action( "update_option_theme_mods_$theme", '_delete_site_logo_on_remove_custom_logo', 10, 2 );154 add_action( "delete_option_theme_mods_$theme", '_delete_site_logo_on_remove_theme_mods' );155}156add_action( 'setup_theme', '_delete_site_logo_on_remove_custom_logo_on_setup_theme', 11 );157/​**158 * Removes the custom_logo theme-mod when the site_logo option gets deleted.159 */​160function _delete_custom_logo_on_remove_site_logo() {161 global $_ignore_site_logo_changes;162 /​/​ Prevent _delete_site_logo_on_remove_custom_logo and163 /​/​ _delete_site_logo_on_remove_theme_mods from firing and causing an164 /​/​ infinite loop.165 $_ignore_site_logo_changes = true;166 /​/​ Remove the custom logo.167 remove_theme_mod( 'custom_logo' );168 $_ignore_site_logo_changes = false;169}170add_action( 'delete_option_site_logo', '_delete_custom_logo_on_remove_site_logo' );...

Full Screen

Full Screen

logo

Using AI Code Generation

copy

Full Screen

1use \mageekguy\atoum\reports\coverage;2use \mageekguy\atoum\reports\coverage\html;3use \mageekguy\atoum\reports\coverage\html\logo;4use \mageekguy\atoum\reports\coverage\html\finder;5use \mageekguy\atoum\reports\coverage\html\template;6use \mageekguy\atoum\writers\std;7use \mageekguy\atoum\locale;8use \mageekguy\atoum\php;9use \mageekguy\atoum\adapter;10use \mageekguy\atoum\test;11use \mageekguy\atoum\mock\streams\fs;12use \mageekguy\atoum\mock\streams\fs\file;13use \mageekguy\atoum\mock\streams\fs\directory;14use \mageekguy\atoum\mock\streams\fs\path;15use \mageekguy\atoum\mock\streams\fs\path\file;16use \mageekguy\atoum\mock\streams\fs\path\directory;17use \mageekguy\atoum\mock\streams\fs\path\file\controller;

Full Screen

Full Screen

logo

Using AI Code Generation

copy

Full Screen

1use Atoum\Logo;2$logo = new Logo();3$logo->display();4use Atoum\Logo;5$logo = new Logo();6$logo->display();7use Atoum\Logo;8$logo = new Logo();9$logo->display();10use Atoum\Logo;11$logo = new Logo();12$logo->display();13use Atoum\Logo;14$logo = new Logo();15$logo->display();16use Atoum\Logo;17$logo = new Logo();18$logo->display();

Full Screen

Full Screen

logo

Using AI Code Generation

copy

Full Screen

1use atoum\atoum;2$score = new atoum\score();3$score->addWriter(new atoum\writers\std\out());4$runner = new atoum\runner();5$runner->setScore($score);6$runner->addTestsFromDirectory(__DIR__ . '/​tests/​units');7exit($runner->run() ? 0 : 1);8namespace tests\units;9use atoum;10{11 public function testMyClass()12 {13 $this->score->addWriter(new atoum\writers\std\out());14 ->given($myClass = new \MyClass())15 ->object($myClass)16 ->isInstanceOf('MyClass')17 ;18 }19}

Full Screen

Full Screen

logo

Using AI Code Generation

copy

Full Screen

1$logo = new \atoum\atoum\logo();2$report = new \atoum\atoum\reports\realtime\cli();3$runner = new \atoum\atoum\runner();4$test = new \atoum\atoum\test();5$test->setRunner($runner);6$test->setReport($report);7$test->setLogo($logo);8$test->run();9$logo = new \atoum\atoum\logo();10$report = new \atoum\atoum\reports\realtime\cli();11$runner = new \atoum\atoum\runner();12$test = new \atoum\atoum\test();13$test->setRunner($runner);14$test->setReport($report);15$test->setLogo($logo);16$test->run();17$logo = new \atoum\atoum\logo();18$report = new \atoum\atoum\reports\realtime\cli();19$runner = new \atoum\atoum\runner();20$test = new \atoum\atoum\test();21$test->setRunner($runner);

Full Screen

Full Screen

logo

Using AI Code Generation

copy

Full Screen

1$test->assert($logo->isInstanceOf('Logo'));2$test->assert($logo->isInstanceOf('Logo'));3$test->assert($logo->isInstanceOf('Logo'));4$test->assert($logo->isInstanceOf('Logo'));5$test->assert($logo->isInstanceOf('Logo'));6$test->assert($logo->isInstanceOf('Logo'));7$test->assert($logo->isInstanceOf('Logo'));8$test->assert($logo->isInstanceOf('Logo'));9$test->assert($logo->isInstanceOf('Logo'));10$test->assert($logo->isInstanceOf('Logo'));11$test->assert($logo->isInstanceOf('Logo'));12$test->assert($logo->isInstanceOf('Logo'));13$test->assert($logo->isInstanceOf('Logo'));14$test->assert($logo->isInstanceOf('Logo'));15$test->assert($logo->isInstanceOf('Logo'));16$test->assert($logo->isInstanceOf('Logo'));17$test->assert($logo->isInstanceOf('Logo'));

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

June ‘21 Updates: Live With Cypress Testing, LT Browser Made Free Forever, YouTrack Integration &#038; More!

Howdy testers! June has ended, and it’s time to give you a refresher on everything that happened at LambdaTest over the last month. We are thrilled to share that we are live with Cypress testing and that our very own LT Browser is free for all LambdaTest users. That’s not all, folks! We have also added a whole new range of browsers, devices & features to make testing more effortless than ever.

[LambdaTest Spartans Panel Discussion]: What Changed For Testing &#038; QA Community And What Lies Ahead

The rapid shift in the use of technology has impacted testing and quality assurance significantly, especially around the cloud adoption of agile development methodologies. With this, the increasing importance of quality and automation testing has risen enough to deliver quality work.

QA&#8217;s and Unit Testing &#8211; Can QA Create Effective Unit Tests

Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.

11 Best Automated UI Testing Tools In 2022

The web development industry is growing, and many Best Automated UI Testing Tools are available to test your web-based project to ensure it is bug-free and easily accessible for every user. These tools help you test your web project and make it fully compatible with user-end requirements and needs.

Testing in Production: A Detailed Guide

When most firms employed a waterfall development model, it was widely joked about in the industry that Google kept its products in beta forever. Google has been a pioneer in making the case for in-production testing. Traditionally, before a build could go live, a tester was responsible for testing all scenarios, both defined and extempore, in a testing environment. However, this concept is evolving on multiple fronts today. For example, the tester is no longer testing alone. Developers, designers, build engineers, other stakeholders, and end users, both inside and outside the product team, are testing the product and providing feedback.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful