function replace_tokens($string) { global $my_profile; $tokens = array("[display_name]", "[opinions]", "[experience]", "[work_experience]", "[work_professional_experience]", "[work_not_professional_experience]", "[volunteer_experience]", "[volunteer_professional_experience]", "[volunteer_not_professional_experience]", "[education]", "[portfolio]", "[social-networks]", "[portfolio]", "[languages]", "[slideshow-script]"); $replacements = array($my_profile->get_name(), $my_profile->print_opinions(), $my_profile->print_experience(), $my_profile->print_work_experience(), $my_profile->print_work_professional_experience(), $my_profile->print_work_not_professional_experience(), $my_profile->print_volunteer_experience(), $my_profile->print_volunteer_professional_experience(), $my_profile->print_volunteer_not_professional_experience(), $my_profile->print_education(), $my_profile->print_portfolio(), $my_profile->print_social_networks(), $my_profile->print_portfolio(), $my_profile->print_languages(), get_slideshow_script()); return str_replace($tokens, $replacements, $string); }
function print_portfolio() { $text = ""; global $con; // Slider $result = mysqli_query($con, "SELECT name, image, video, short_description, link FROM profile_portfolio WHERE pid = " . $this->id . " AND visible = true AND (image != '' OR video != '') ORDER BY weight"); if ($result) { $text .= "<ul class='slideshow'>"; while ($item = mysqli_fetch_array($result)) { $video = ""; if ($item['video']) { $video = ' data-video="' . $item['video'] . '"'; } $text .= '<li><img src="' . $item['image'] . '" height="100" width="150" alt="' . $item['name'] . '" title="' . $item['name'] . '" data-title="' . $item['name'] . '" data-body="' . $item['short_description'] . '" data-link="' . $item['link'] . '" ' . $video . '/>'; } $text .= "</ul>"; } $text .= get_slideshow_script(); // List of links $result = mysqli_query($con, "SELECT portfolio_category_id, name FROM profile_portfolio_categories ORDER BY weight"); if ($result) { $text .= "<ul>"; while ($category = mysqli_fetch_array($result)) { $result2 = mysqli_query($con, "SELECT name, long_description, link, link_android, link_ios, link_firefox_os, link_windows_phone, link_github FROM profile_portfolio WHERE pid = " . $this->id . " AND visible = true AND category = " . $category['portfolio_category_id'] . " ORDER BY weight"); $text .= "<li>" . $category['name'] . "<ul>"; if ($result2) { while ($item = mysqli_fetch_array($result2)) { // Print name $text .= '<li itemscope itemtype="http://schema.org/SoftwareApplication"><a href="' . $item["link"] . '" itemprop="url"><span itemprop="name">' . $item["name"] . '</span></a>'; // Print github link if ($item["link_github"]) { $text .= ' <a href="' . $item["link_github"] . '" title="Fork me on Github"><i class="icon-github"></i></a>'; } // Print description $text .= ': <span itemprop="description">' . $item["long_description"] . '</span>'; // Print Android link if ($item["link_android"]) { $text .= '<br><a href="' . $item["link_android"] . '"><img src="/files/get-android.png" height="45" width="129" alt="Get it on Google Play"/></a>'; } } } $text .= "</ul></li>"; } $text .= "</ul>"; } return $text; }