/** * @param Parser $parser * @return mixed */ public static function formlink($parser) { $params = func_get_args(); array_shift($params); // We don't need the parser. $original = SFUtils::createFormLink($parser, $params, 'formlink'); if (strpos($original, 'class="new"') !== false) { $original = str_replace('class="new"', 'class="btn btn-primary pull-right"', $original); } else { $original = str_replace('href=', 'class="btn btn-primary pull-right" href=', $original); } $original = str_replace('self">', 'self"><i class="fa fa-edit"></i> ', $original); return $parser->insertStripItem($original); }
/** * Renders the #serieslink parser function. * * @param Parser $parser * @return string the unique tag which must be inserted into the stripped text */ public static function renderSeriesLink(&$parser) { global $wgTitle; $params = func_get_args(); array_shift($params); // We don't need the parser. // remove the target parameter should it be present foreach ($params as $key => $value) { $elements = explode('=', $value, 2); if ($elements[0] === 'target') { unset($params[$key]); } } // set the origin parameter // This will block it from use as iterator parameter. Oh well. $params[] = "origin=" . $parser->getTitle()->getArticleId(); // hack to remove newline from beginning of output, thanks to // http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function return $parser->insertStripItem(SFUtils::createFormLink($parser, 'SeriesEdit', $params), $parser->mStripState); }
static function renderQueryFormLink(&$parser) { $params = func_get_args(); array_shift($params); // We don't need the parser. // hack to remove newline from beginning of output, thanks to // http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function return $parser->insertStripItem(SFUtils::createFormLink($parser, $params, 'queryformlink'), $parser->mStripState); }
static function renderQueryFormLink(&$parser) { $params = func_get_args(); array_shift($params); // We don't need the parser. // If it's a popup, make this just a static display of // results, with no 'additiona query' form, since at the // moment additional queries can't be handled anyway. if (in_array('popup', $params)) { $params[] = 'wpRunQuery=true'; $params[] = 'additionalquery=false'; } // hack to remove newline from beginning of output, thanks to // http://jimbojw.com/wiki/index.php?title=Raw_HTML_Output_from_a_MediaWiki_Parser_Function return $parser->insertStripItem(SFUtils::createFormLink($parser, 'RunQuery', $params), $parser->mStripState); }