예제 #1
0
 /**
  * Checks if an asset is registered
  *
  * @since 1.0.0
  *
  * @param string $handle Specify either the full dot notation path to the asset handle (i.e. with the config)
  *                          or just the handle itself.  If only the handle, then we use $is_js to find the
  *                          the asset handle's full path.
  * @param bool|true $is_js
  * @return bool
  */
 public function is_registered($handle, $is_js = true)
 {
     if (!wpdevsclub_str_contains($handle, '.')) {
         $handle = $is_js ? 'wp_enqueue_scripts.wp_enqueue_script.' . $handle : 'wp_enqueue_scripts.wp_enqueue_style.' . $handle;
     }
     return $this->registered_assets_config->has($handle);
 }
예제 #2
0
 function test_str_contains()
 {
     $this->assertTrue(Str::contains('tonya', 'on'));
     $this->assertTrue(wpdevsclub_str_contains('tonya', array('ny')));
     $this->assertFalse(Str::contains('tonya', 'xxx'));
     $this->assertFalse(wpdevsclub_str_contains('tonya', array('xxx')));
     $this->assertFalse(Str::contains('tonya', ''));
 }