foreach ($jsModules as &$js) { print '<script type="text/javascript" src="/extensions/wikihow/h5e/' . $js . '"></script>' . "\n"; } } $langKeys = array('new-link', 'howto', 'h5e-ref', 'h5e-new-section', 'h5e-new-alternate-method', 'h5e-new-method', 'h5e-references-removed', 'h5e-references-removed', 'h5e-loading', 'h5e-more-results', 'Ingredients', 'Steps', 'Video', 'Tips', 'Warnings', 'relatedwikihows', 'sourcescitations', 'thingsyoullneed', 'h5e-edit-summary-examples', 'h5e-changes-to-be-discarded', 'import-content', 'import-content-url', 'h5e-add-reference', 'h5e-edit-reference', 'h5e-add', 'h5e-search', 'h5e-edit-link', 'h5e-edit-link-external', 'h5e-add-link', 'h5e-done', 'h5e-change', 'h5e-edit-ref', 'h5e-hidden-template', 'h5e-hidden-video', 'h5e-rel-wh-edit', 'h5e-enter-edit-summary', 'h5e-first-step', 'h5e-external-link-editing-disabled', 'h5e-external-links-warning', 'h5e-remove-section', 'warning', 'congrats-article-published', 'h5e-switch-advanced', 'h5e-publish-timeout', 'h5e-error', 'h5e-editing-title', 'h5e-creating-title', 'h5e-create-new-article', 'h5e-server-connection-error', 'h5e-savedraft', 'h5e-loaddraft', 'h5e-draftsaved', 'h5e-saving', 'h5e-saving-lc', 'h5e-saving-draft', 'h5e-new-warning', 'h5e-new-tip', 'h5e-new-source', 'h5e-no-cursor-error', 'h5e-canceling-edit', 'h5e-loading-advanced-editor', 'h5e-loading-draft'); echo Wikihow_i18n::genJSMsgs($langKeys); ?> <div class="h5e-edit-link-options-over rounded_corners"> <a href="#" id="h5e-editlink-cancel" title="<?php echo wfMsg('h5e-cancel'); ?> " class="h5e-x"></a> <span class="h5e-edit-link-inner"> <?php echo wfMSg('h5e-goto-link'); ?> <a id="h5e-editlink-display" href="#"></a><br /> <a id="h5e-editlink-change" href="#"><?php echo wfMsg('h5e-change'); ?> </a> - <a id="h5e-editlink-remove" href="#"><?php echo wfMsg('h5e-remove'); ?> </a> </span> </div> <div id="h5e-link-dialog" class="h5e-dialog" title=""> <p><?php
function execute($par) { global $wgRequest, $wgOut; #wfLoadExtensionMessages('Importvideo'); $target = isset($par) ? $par : $wgRequest->getVal('target'); if ($wgRequest->wasPosted()) { // IMPORTING THE VIDEO NOW $id = $wgRequest->getVal('video_id'); $desc = $wgRequest->getVal('description'); $target = $wgRequest->getVal('target'); $text = $this->loadVideoText($id); if ($text == null) { $wgOut->addHTML(wfMessage('importvideo_error_geting_results')->text()); return; } $v = $this->mResults[0]; $author = $v['NAME']; $badauthors = split("\n", wfMessage('Block_Youtube_Accounts')->text()); if (in_array($author, $badauthors)) { $wgOut->addHTML(wfMessage('importvideo_youtubeblocked', $author)->text()); return; } $title = Title::makeTitle(NS_VIDEO, $target); $vid = Title::makeTitle(NS_VIDEO, $title->getText()); $editSummary = wfMessage('importvideo_addingvideo_summary')->text(); $this->updateVideoArticle($vid, $text, $editSummary); $this->updateMainArticle($target, $editSummary); return; } if ($target == '') { $wgOut->addHTML(wfMessage('importvideo_notarget')->text()); return; } $orderby = $wgRequest->getVal('orderby', 'relevance'); $wgOut->addHTML($this->getPostForm($target)); $this->getTopResults($target, 10, $wgRequest->getVal('q')); $wgOut->addHTML(" <br/>\n\t\t\t" . wfMsg('importvideo_youtube_sortby') . " <select name='orderby' id='orderby' onchange='changeUrl();'>\n\t\t\t\t<OPTION value='relevance' " . ($orderby == 'relevance' ? "SELECTED" : "") . "> " . wfMSg('importvideo_youtubesort_rel') . "</OPTION>\n\t\t\t\t<OPTION value='howto' " . ($orderby == 'howto' ? "SELECTED" : "") . "> " . wfMsg('importvideo_youtubesort_howto') . "</OPTION>\n\t\t\t\t<OPTION value='rating' " . ($orderby == 'rating' ? "SELECTED" : "") . "> " . wfMsg('importvideo_youtubesort_rating') . "</OPTION>\n\t\t\t\t<OPTION value='published' " . ($orderby == 'published' ? "SELECTED" : "") . "> " . wfMsg('importvideo_youtubesort_rel') . "</OPTION>\n\t\t\t\t<OPTION value='viewCount' " . ($orderby == 'viewCount' ? "SELECTED" : "") . "> " . wfMsg('importvideo_youtubesort_views') . "</OPTION>\n\t\t\t</select>\n\t\t\t<br/><br/>\n\t\t\t"); if ($this->mResults == null) { $wgOut->addHTML(wfMsg("importvideo_error_geting_results")); return; } #print_r($this->mResults); if (sizeof($this->mResults) == 0) { #$wgOut->addHTML(wfMsg('importvideo_noresults', $target) . htmlspecialchars($results) ); $wgOut->addHTML(wfMsg('importvideo_noresults', $query)); $wgOut->addHTML("</form>"); return; } $wgOut->addHTML(wfMsg('importvideo_results', $query)); $resultsShown = false; foreach ($this->mResults as $v) { if (!$this->isValid($v['PUBLISHED'])) { continue; } $resultsShown = true; $id = str_replace("http://gdata.youtube.com/feeds/api/videos/", "", $v['ID']); $min = min(strlen($v['CONTENT']), 255); $snippet = substr($v['CONTENT'], 0, $min); if ($min == 255) { $snippet .= "..."; } $views = number_format($v['VIEWCOUNT'], 0); $this->addResult($v); } if (!$resultsShown) { $wgOut->addHTML(wfMsg('importvideo_noresults', $query)); $wgOut->addHTML("</form>"); return; } $wgOut->addHTML("</form>"); $num = $this->mResponseData['OPENSEARCH:TOTALRESULTS']; $wgOut->addHTML($this->getPreviousNextButtons($num)); }
/** * Extract and validate options from input and argv. * * Returns a boolean indicating whether there were any errors * during argument processing. * * @param string $input Parser hook input * @param string $argv Parser hook arguments * @return boolean */ public function extractOptions( $input, $args ) { wfProfileIn( __METHOD__ ); if ( isset( $input ) ) { /* <slippymap> .*? </slippymap> or {{#tag:slippymap}}, not <slippymap/> */ if ( ! preg_match( '~^ \s* $~x', $input ) ) { /** * Only allow whitespace, we may want to do something * with the content being passed to us in the * future */ $this->argsError[] = wfMsg( 'slippymap_error_tag_content_given', wfMsg( 'slippymap_tagname' ) ); } } /* No arguments */ if ( count( $args ) == 0 ) { $this->argsError[] = wfMsg( 'slippymap_error_missing_arguments', wfMSg( 'slippymap_tagname' ) ); /* Some arguments */ } else { /* Make sure we have lat/lon/zoom */ foreach ($this->argsRequired as $requiredArg) { if ( ! isset( $args[$requiredArg] ) ) { $this->argsError[] = wfMsg( 'slippymap_error_missing_attribute_' . $requiredArg ); } } /* Keys that the user made up, this is a fatal error since * we want to protect our namespace */ foreach ( array_keys( $args ) as $user_key ) { if ( ! in_array( $user_key, $this->argsList ) ) $this->argsError[] = wfMsg( 'slippymap_error_unknown_attribute', $user_key ); } /** * Go through the list of options and add them to our * fields if they validate, also adds default values. */ $this->populateArguments($args); } if ( count( $this->argsError ) == 0 ) { wfProfileOut( __METHOD__ ); return true; } else { return false; } }