/**
* Add a nowiki strip item
+ * @param $marker
+ * @param $value
*/
function addNoWiki( $marker, $value ) {
$this->addItem( 'nowiki', $marker, $value );
}
+ /**
+ * @param $marker
+ * @param $value
+ */
function addGeneral( $marker, $value ) {
$this->addItem( 'general', $marker, $value );
}
+ /**
+ * @throws MWException
+ * @param $type
+ * @param $marker
+ * @param $value
+ */
protected function addItem( $type, $marker, $value ) {
if ( !preg_match( $this->regex, $marker, $m ) ) {
throw new MWException( "Invalid marker: $marker" );
$this->data[$type][$m[1]] = $value;
}
+ /**
+ * @param $text
+ * @return mixed
+ */
function unstripGeneral( $text ) {
return $this->unstripType( 'general', $text );
}
+ /**
+ * @param $text
+ * @return mixed
+ */
function unstripNoWiki( $text ) {
return $this->unstripType( 'nowiki', $text );
}
+ /**
+ * @param $text
+ * @return mixed
+ */
function unstripBoth( $text ) {
$text = $this->unstripType( 'general', $text );
$text = $this->unstripType( 'nowiki', $text );
return $text;
}
+ /**
+ * @param $type
+ * @param $text
+ * @return mixed
+ */
protected function unstripType( $type, $text ) {
// Shortcut
if ( !count( $this->data[$type] ) ) {
return $out;
}
+ /**
+ * @param $m array
+ * @return array
+ */
protected function unstripCallback( $m ) {
if ( isset( $this->data[$this->tempType][$m[1]] ) ) {
return $this->data[$this->tempType][$m[1]];
/**
* Get a StripState object which is sufficient to unstrip the given text.
* It will contain the minimum subset of strip items necessary.
+ *
+ * @param $text string
+ *
+ * @return StripState
*/
function getSubState( $text ) {
$subState = new StripState( $this->prefix );