include '../include/jpgraph/src/jpgraph_bar.php'; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; $idx = new SQLite3(SQLITE_DIR . 'rev.php.sqlite'); $language = revcheck_available_languages($idx); sort($language); $files_EN = count_en_files($idx); foreach ($language as $lang) { $tmp = get_stats($idx, $lang, 'uptodate'); $percent_tmp[] = round($tmp[0] * 100 / $files_EN); $legend_tmp[] = $lang; } $percent = array_values($percent_tmp); $legend = array_values($legend_tmp); echo "Generating PHP graphic for all languages..."; generate_image(); echo " Done.\n"; function generate_image() { global $percent, $legend; // Create the graph. These two calls are always required $graph = new Graph(550, 250); $graph->SetScale("textlin"); $graph->yaxis->scale->SetGrace(20); $graph->xaxis->SetLabelmargin(5); $graph->xaxis->SetTickLabels($legend); $graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCFF@0.5'); // Add a drop shadow $graph->SetShadow(); // Adjust the margin a bit to make more room for titles $graph->img->SetMargin(50, 30, 20, 40);
function generate_channel($formatter, $rss_name, $logs) { global $DBInfo; $url = qualifiedUrl($formatter->link_url("BlogChanges")); $desc = sprintf(_("BlogChanges at %s"), $DBInfo->sitename); $image = generate_image($formatter); $items = generate_items($formatter, $logs); return <<<CHANNEL <channel> <title>{$rss_name}</title> <link>{$url}</link> <description>{$desc}</description> {$image} {$items} </channel> CHANNEL; }
$time_start = microtime(true); include '../include/jpgraph/src/jpgraph.php'; include '../include/jpgraph/src/jpgraph_pie.php'; include '../include/jpgraph/src/jpgraph_pie3d.php'; include '../include/init.inc.php'; include '../include/lib_revcheck.inc.php'; include '../include/lib_proj_lang.inc.php'; $idx = new SQLite3(SQLITE_DIR . 'rev.php.sqlite'); $available_langs = revcheck_available_languages($idx); $langs = array_keys($LANGUAGES); foreach ($langs as $lang) { if (!in_array($lang, $available_langs)) { echo "Documentation for {$lang} language does not exist.\n"; } else { generate_image($lang, $idx); echo "Generated images/revcheck/info_revcheck_php_{$lang}.png\n"; } } $time = round(microtime(true) - $time_start, 3); echo "Graphs generated in {$time}s\n"; function generate_image($lang, $idx) { global $LANGUAGES; $up_to_date = get_stats($idx, $lang, 'uptodate'); $up_to_date = $up_to_date[0]; // $outdated = @get_stats($idx, $lang, 'outdated'); $outdated = $outdated[0]; // $missing = get_stats($idx, $lang, 'notrans');
function createCategory($faker, $parent, $position, &$categoryIdList, $contentIdList) { $category = new Thelia\Model\Category(); $category->setParent($parent); $category->setVisible(1); $category->setPosition($position); setI18n($category); $category->save(); $categoryId = $category->getId(); $categoryIdList[] = $categoryId; //add random associated content $alreadyPicked = array(); for ($i = 1; $i < rand(0, 3); $i++) { $categoryAssociatedContent = new Thelia\Model\CategoryAssociatedContent(); do { $pick = array_rand($contentIdList, 1); } while (in_array($pick, $alreadyPicked)); $alreadyPicked[] = $pick; $categoryAssociatedContent->setContentId($contentIdList[$pick])->setCategoryId($categoryId)->setPosition($i)->save(); } $image = new \Thelia\Model\CategoryImage(); $image->setCategoryId($categoryId); generate_image($image, 'category', $categoryId); $document = new \Thelia\Model\CategoryDocument(); $document->setCategoryId($categoryId); generate_document($document, 'category', $categoryId); return $category; }
$infos = array(); } $first_name = ''; $images = array(); foreach ($infos as $info) { if (empty($first_name)) { $first_name = explode(' ', $info['name']); $first_name = utf8_encode($first_name[0]); } if (!DEBUG && is_file(CACHE_PATH . '/' . $info['file'])) { $images[] = CACHE_DIR . '/' . $info['file']; continue; } $info['name'] = strtoupper(remove_accents($info['name'])); $info['bg_file'] = 'img/bg-' . $info['type'] . '.png'; $images[] = generate_image($info); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-BR" lang="pt-BR" dir="ltr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo TITLE; ?> </title> <link rel="stylesheet" href="styles.css" /> <meta name="robots" content="noindex,nofollow" /> <style type="text/css"> .wrap { background-image:url('<?php
} function generate_image($code, $im) { global $characters; global $symbol_width; global $height; for ($i = 0, $x = 0; $i < strlen($code); $i++, $x += $symbol_width) { $char_im = get_char_by_index_from_font($characters[$code[$i]]); imagecopymerge($im, $char_im, $x, 0, 0, 0, $symbol_width, $height, 100); } return $im; } global $symbol_width; global $height; global $characters; $symbol_width = 20; $width = strlen($generation_str) * $symbol_width + 20; $height = 20; $code = $generation_str; $bg_color = array('red' => 255, 'green' => 255, 'blue' => 255, 0 => 255, 1 => 255, 2 => 255); $text_color = array('red' => 0, 'green' => 0, 'blue' => 0, 0 => 0, 1 => 0, 2 => 0); $characters = array('1' => 0, '2' => 1, '3' => 2, '4' => 3, '5' => 4, '6' => 5, '7' => 6, '8' => 7, '9' => 8, '0' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34, 'Z' => 35); $im = imagecreatetruecolor($width, $height); $bgcolor = imagecolorallocate($im, $bg_color['red'], $bg_color['green'], $bg_color['blue']); imagefilledrectangle($im, 0, 0, imagesx($im), imagesy($im), $bgcolor); $im = generate_image($code, $im); $im = wave($text_color, $bg_color, $im, $width, $height); $im = draw_lines($im, $width - 10, $height + 20); header("Content-type:image/png"); imagepng($im); imagedestroy($im);
echo '<p>Converting legacy image ' . $sectionicon->image . ".</p>"; error_log('Converting legacy image ' . $sectionicon->image . '.'); if ($temp_file = $fs->get_file($contextid, 'course', 'legacy', 0, '/icons/', $sectionicon->image)) { echo '<p> Stored file:' . print_r($temp_file, true) . '</p>'; error_log(print_r($temp_file, true)); // Resize the image and save it... $created = time(); $storedfilerecord = array('contextid' => $contextid, 'component' => 'course', 'filearea' => 'section', 'itemid' => $sectionicon->sectionid, 'filepath' => '/', 'filename' => $sectionicon->image, 'timecreated' => $created, 'timemodified' => $created); try { $convert_success = true; $mime = $temp_file->get_mimetype(); $storedfilerecord['mimetype'] = $mime; $tmproot = make_temp_directory('gridformaticon'); $tmpfilepath = $tmproot . '/' . $temp_file->get_contenthash(); $temp_file->copy_content_to($tmpfilepath); $data = generate_image($tmpfilepath, GRID_ITEM_IMAGE_WIDTH, GRID_ITEM_IMAGE_HEIGHT, $crop); if (!empty($data)) { $fs->create_file_from_string($storedfilerecord, $data); } else { $convert_success = false; } unlink($tmpfilepath); if ($convert_success == false) { print '<p>Image ' . $sectionicon->image . ' failed to convert.</p>'; error_log('Image ' . $sectionicon->image . ' failed to convert.'); } else { print '<p>Image ' . $sectionicon->image . ' converted.</p>'; error_log('Image ' . $sectionicon->image . ' converted.'); // Clean up and remove the old thumbnail too. $temp_file->delete(); unset($temp_file);
//imagepsfreefont($font); // Print the validation code on the image in white //imagestring($val_img, 4, 96, 19, $val_string, $white); // Write the image file to the current directory $image_path = TEMP_DIR . "/verify" . $image_loop_index . ".jpg"; imagejpeg($val_img, $image_path); imagedestroy($val_img); if ($image_loop_index < IMAGE_LOOP) { $image_loop_index++; } else { $image_loop_index = 0; } $_SESSION["wsf_php_demo_site_image_loop_index"] = $image_loop_index; return array("string" => $val_string, "path" => $image_path); } $ret = generate_image(); $val_string = $ret["string"]; $image_path = $ret["path"]; $encoded_val_string = md5($val_string); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <?php if (WEB_VERSION == "php") { $title = "Registration - PHP Web Services - Code, Samples, Demos and Tutorials"; } else { if (WEB_VERSION == "c") { $title = "Registration - C Web Services - Code, Samples, Demos and Tutorials";
function site_stats($site_name) { global $lang, $config; if ($config['generate_statistics']) { $ga = new gapi($config['ga_email'], $config['ga_password']); //get profile ids $ga->requestAccountData(); foreach ($ga->getResults() as $result) { $config[filename((string) $result)]['profile_id'] = $result->getProfileId(); } if (isset($config[$site_name]['profile_id'])) { $profile_id = $config[$site_name]['profile_id']; //current week visits $arr['visits'] = get_visits($ga, $profile_id, $config['from'], $config['to']); $arr['prior_visits'] = get_visits($ga, $profile_id, $config['prior_from'], $config['prior_to']); $arr['st'] = get_stats($arr['visits'], $arr['prior_visits']); $arr['image_path'] = generate_image($lang[$site_name], $arr['visits']); $arr['image_name'] = basename($arr['image_path']); return $arr; } } }