//for archive // */ /* for mac mini (local) $GLOBALS['doc_root'] = "/Library/WebServer/Documents"; //for mac mini $GLOBALS['domain'] = "http://editors.eol.localhost"; //for mac mini */ if ($title = @$argv[1]) { // print_r($argv); process_title($title); } else { // exit("\nexit muna...\n"); // process_one(); /* process_urls("v1"); //this is now done */ process_urls("v2"); $GLOBALS['processed'] = array(); } //========================================[start functions]======================================== function process_all_links_from_a_page($destination_title) { $title = format_title($destination_title); echo "\n[{$title}]\n"; if ($wiki_path = get_wiki_text($title)) { $str = file_get_contents($wiki_path); $str = str_replace("]s]", "s]]", $str); $str = str_replace("]es]", "es]]", $str); $str = str_replace("Antarctic]a]", "Antarctica]]", $str); $str = str_replace("] change]", " change]]", $str); $str = str_replace("] systems]", " systems]]", $str); $str = str_replace("] areas]", " areas]]", $str);
/** * @param $id * @throws coding_exception */ function get_tab_content($id) { global $DB, $CFG, $tab, $context, $appresponse; $appresponse->header('Content-Type', 'application/json'); $editoroptions = array('subdirs' => 1, 'maxbytes' => $CFG->maxbytes, 'maxfiles' => -1, 'changeformat' => 1, 'context' => $context, 'noclean' => 1, 'trusttext' => true); $content = $DB->get_record('tab_content', array('id' => $id)); $externalurl = $content->externalurl; $fileattachment = $content->fileattachment; // DR: we need to know if there are files associated with [$index]th tab. $fs = get_file_storage(); $files = $fs->get_area_files($context->id, 'mod_tab', 'fileattachment', $content->id, false, false); $file = reset($files); if (!empty($externalurl)) { if (!preg_match('{https?:\\/\\/}', $externalurl)) { $externalurl = 'http://' . $externalurl; } } else { if ($file) { $filepath = $file->get_filepath(); $filename = $file->get_filename(); $fileurlfrewrite = file_rewrite_pluginfile_urls("@@PLUGINFILE@@/" . $file->get_filename(), 'pluginfile.php', $context->id, 'mod_tab', 'fileattachment', $content->id); $externalurl = $fileurlfrewrite; } else { if (empty($content->format)) { $content->format = 1; } $contenttemp = file_rewrite_pluginfile_urls($content->tabcontent, 'pluginfile.php', $context->id, 'mod_tab', 'content', $content->id); $content = format_text($contenttemp, $content->format, $editoroptions, $context); } } // Enter into proper div. if (!empty($externalurl)) { $htmlcontent = tab_embed_general(process_urls($externalurl), '', get_string('embed_fail_msg', 'tab') . "<a href='{$externalurl}' target='_blank' >" . get_string('embed_fail_link_text', 'tab') . '</a>', $file ? $file->get_mimetype() : 'text/html'); } else { $htmlcontent = $content; } echo json_encode(array("content" => base64_encode($htmlcontent))); }
// /* for archive server (remote) $GLOBALS['doc_root'] = "/var/www/html"; //for archive $GLOBALS['domain'] = "http://editors.eol.org"; //for archive // */ /* for mac mini (local) $GLOBALS['doc_root'] = "/Library/WebServer/Documents"; //for mac mini $GLOBALS['domain'] = "http://editors.eol.localhost"; //for mac mini */ if ($title = @$argv[1]) { print_r($argv); process_title($title); } else { // process_one(); process_urls(); } //========================================[start functions]======================================== function process_one() { $destination_title = "Black-footed penguin"; $destination_title = "Scope & Content"; $destination_title = "Environment & Security"; $destination_title = "Ecoregions (collection)"; $destination_title = "Black, Joseph"; $destination_title = "Heaviside's dolphin"; $destination_title = "Capitalism 3.0: Chapter 6"; $destination_title = "United States"; $destination_title = "Saddle-backed dolphin"; $destination_title = "Hector's dolphin"; $destination_title = "Rough-toothed dolphin";
//Eventually give option for height within the form. Pass this by others, because it could be confusing. $iframehieght[$key] = '600px'; if (!empty($externalurl[$key])) { //todo check url if (!preg_match('{https?:\\/\\/}', $externalurl[$key])) { $externalurl[$key] = 'http://' . $externalurl[$key]; } } else { if (empty($options[$key]->format)) { $options[$key]->format = 1; } $content[$key] = file_rewrite_pluginfile_urls($options[$key]->tabcontent, 'pluginfile.php', $context->id, 'mod_tab', 'content', $options[$key]->id); $content[$key] = format_text($content[$key], FORMAT_MOODLE, $editoroptions, $context); } //Enter into proper div //Check for pdf if (!empty($externalurl[$key]) && preg_match('/\\bpdf\\b/i', $externalurl[$key])) { debugging("Tabdisplay: Found pdf->external_url=" . $externalurl[$key], DEBUG_DEVELOPER); $html_content = tab_embed_general(process_urls($externalurl[$key]), '', get_string('embed_fail_msg', 'tab') . "<a href='{$externalurl[$key]}' target='_blank' >" . get_string('embed_fail_link_text', 'tab') . '</a>', 'application/pdf'); } elseif (!empty($externalurl[$key])) { $html_content = tab_embed_general(process_urls($externalurl[$key]), '', get_string('embed_fail_msg', 'tab') . "<a href='{$externalurl[$key]}' target='_blank' >" . get_string('embed_fail_link_text', 'tab') . '</a>', 'text/html'); } else { $html_content = $content[$key]; } $tabdisplay .= ' <div class="TabbedPanelsContent"><p>' . $html_content . '</p></div>' . "\n"; } $tabdisplay .= ' </div>' . "\n"; $tabdisplay .= '</div>' . "\n"; $tabdisplay .= '</div>' . "\n"; echo $tabdisplay; echo $OUTPUT->footer();