コード例 #1
0
ファイル: test-str.php プロジェクト: iCaspar/WPDC_Core
 public function test_slug()
 {
     $this->assertEquals('hello-world', Str::slug('hello world'));
     $this->assertEquals('hello-world', wpdevsclub_slug('Hello World'));
     $this->assertEquals('hello-world', Str::slug('hello-world'));
     $this->assertEquals('hello-world', wpdevsclub_slug('hello_world'));
     $this->assertEquals('hello_world', Str::slug('hello_world', '_'));
 }
コード例 #2
0
ファイル: str-helpers.php プロジェクト: iCaspar/WPDC_Core
 /**
  * Generate a URL friendly "slug" from a given string.
  *
  * @param  string  $title
  * @param  string  $separator
  * @return string
  */
 function wpdevsclub_slug($title, $separator = '-')
 {
     return Str::slug($title, $separator);
 }