本文整理汇总了PHP中URLSegmentFilter::default_allow_multibyte方法的典型用法代码示例。如果您正苦于以下问题:PHP URLSegmentFilter::default_allow_multibyte方法的具体用法?PHP URLSegmentFilter::default_allow_multibyte怎么用?PHP URLSegmentFilter::default_allow_multibyte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URLSegmentFilter
的用法示例。
在下文中一共展示了URLSegmentFilter::default_allow_multibyte方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRaw2URL
/**
* @todo test toASCII()
*/
public function testRaw2URL()
{
$orig = URLSegmentFilter::$default_allow_multibyte;
URLSegmentFilter::$default_allow_multibyte = false;
$this->assertEquals('foo', Convert::raw2url('foo'));
$this->assertEquals('foo-and-bar', Convert::raw2url('foo & bar'));
$this->assertEquals('foo-and-bar', Convert::raw2url('foo & bar!'));
$this->assertEquals('foos-bar-2', Convert::raw2url('foo\'s [bar] (2)'));
URLSegmentFilter::$default_allow_multibyte = $orig;
}
示例2: testURLSegmentMultiByte
public function testURLSegmentMultiByte()
{
$origAllow = URLSegmentFilter::$default_allow_multibyte;
URLSegmentFilter::$default_allow_multibyte = true;
$sitetree = new SiteTree();
$sitetree->write();
$sitetree->URLSegment = 'brötchen';
$sitetree->write();
$sitetree = DataObject::get_by_id('SiteTree', $sitetree->ID, false);
$this->assertEquals($sitetree->URLSegment, rawurlencode('brötchen'));
$sitetree->publish('Stage', 'Live');
$sitetree = DataObject::get_by_id('SiteTree', $sitetree->ID, false);
$this->assertEquals($sitetree->URLSegment, rawurlencode('brötchen'));
$sitetreeLive = Versioned::get_one_by_stage('SiteTree', 'Live', '"SiteTree"."ID" = ' . $sitetree->ID, false);
$this->assertEquals($sitetreeLive->URLSegment, rawurlencode('brötchen'));
URLSegmentFilter::$default_allow_multibyte = $origAllow;
}