function testStartsWith() { $this->assertTrue(org_tubepress_impl_util_StringUtils::startsWith('something', 'some')); $this->assertTrue(org_tubepress_impl_util_StringUtils::startsWith('some', 'some')); $this->assertFalse(org_tubepress_impl_util_StringUtils::startsWith(array(), 'some')); $this->assertFalse(org_tubepress_impl_util_StringUtils::startsWith('some', array())); }
/** * Applied to a single option name/value pair before it is applied to TubePress's execution context * or persistence storage. This filter is invoked *before* the option name or value is validated! * * @param string $value The option value being set. * @param string $name The name of the option being set. * * @return unknown_type The (possibly modified) option value. May be null. * * function alter_preValidationOptionSet($value, $name); */ public function alter_preValidationOptionSet($value, $name) { /** We only care about playlistValue. */ if ($name !== org_tubepress_api_const_options_names_GallerySource::YOUTUBE_PLAYLIST_VALUE) { return $value; } if (org_tubepress_impl_util_StringUtils::startsWith($value, 'PL')) { org_tubepress_impl_log_Log::log(self::$_logPrefix, 'Removing \'PL\' prefix from playlist value of %s', $value); return org_tubepress_impl_util_StringUtils::replaceFirst('PL', '', $value); } org_tubepress_impl_log_Log::log(self::$_logPrefix, 'Playlist value %s does not beging with \'PL\'', $value); return $value; }