Ejemplo n.º 1
0
 public function test_it_gets_link()
 {
     $Framework = new \Devise\Support\Framework();
     $cookie = [];
     $Link = new Link($Framework);
     $output = $Link->getLink($cookie);
     assertEquals('<a href="http://localhost?dir=asc" class="page-sort"></a> ', $output);
 }
Ejemplo n.º 2
0
 public function testSettingRequest()
 {
     $request = $this->makeRequest();
     $request->expects($this->once())->method('getScriptName')->will($this->returnValue('/htdocs/test.php'));
     $link = new Link('test');
     $link->setRequest($request);
     $this->assertEquals('/htdocs/test.php?r=test', $link->getLink());
 }
Ejemplo n.º 3
0
                } else {
                    CmnFns::do_error_box(translate('That record could not be found.'), '', false);
                }
            } else {
                CmnFns::do_error_box(translate('That reservation is at full capacity.'), '', false);
            }
        }
    } else {
        CmnFns::do_error_box(translate('No invite was selected'), '', false);
    }
} else {
    if (isset($_POST['n'])) {
        if (Auth::is_logged_in()) {
            $msg = Link::getLink('ctrlpnl.php', translate('Return to My Control Panel'));
        } else {
            $msg = Link::getLink('index.php', translate('Login to manage all of your invitiations'));
        }
        CmnFns::do_message_box($msg);
    } else {
        $resid = $_GET['id'];
        $action = $_GET['action'];
        $res = new Reservation($resid);
        $resource = new Resource();
        $max_participants = $resource->get_property('max_participants', $res->get_machid());
        // If the total number of users (minus the owner) already participating is less than the max, let this user participate
        if ($action == INVITE_DECLINE || ($max_participants == '' || count($res->participating_users) < $max_participants)) {
            $msg = '<h5>' . translate('Confirm reservation participation') . '</h5><br/>';
            $word = $_GET['action'] == INVITE_ACCEPT ? 'Accept' : 'Decline';
            $msg .= '<input type="submit" class="button" name="y" value="' . translate($word) . '"/>';
            $msg .= ' ';
            $msg .= '<input type="submit" class="button" name="n" value="' . translate('Cancel') . '"/>';
Ejemplo n.º 4
0
		xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
    //home page
    $xmlString .= '
	<url>
		<loc>' . _TM_BASE_URL_ . '</loc>
		<lastmod>' . date('c') . '</lastmod>
		<changefreq>daily</changefreq>
		<priority>1.0</priority>
	</url>';
    $link = new Link();
    //category page
    $result = Db::getInstance()->getAll('SELECT rule_link AS link FROM `' . DB_PREFIX . 'rule` WHERE entity="Category"');
    foreach ($result as $row) {
        $xmlString .= '
	<url>
		<loc>' . $link->getLink($row['link']) . '</loc>
		<lastmod>' . date('c') . '</lastmod>
		<changefreq>daily</changefreq>
		<priority>0.6</priority>
	</url>';
    }
    //brand page
    $result = Db::getInstance()->getAll('SELECT rule_link AS link FROM `' . DB_PREFIX . 'rule` WHERE `entity`="Brand"');
    foreach ($result as $row) {
        $xmlString .= '
	<url>
		<loc>' . $link->getLink($row['link']) . '</loc>
		<lastmod>' . date('c') . '</lastmod>
		<changefreq>daily</changefreq>
		<priority>0.6</priority>
	</url>';
Ejemplo n.º 5
0
?>
</h1>

			</div>

			<?php 
get_message();
?>

			<?php 
if (is_single()) {
    ?>

				<?php 
    $link_id = get_var('id');
    $link = $link_id ? Link::getLink($link_id) : false;
    $link_name = $link ? $link->getName() : '';
    $link_description = $link ? $link->getDescription() : '';
    $link_url = $link ? $link->getURL() : '';
    $link_bg_color = $link ? $link->getBGColor() : '';
    $link_order = $link ? $link->getOrder() : '';
    $link_icon_class = $link ? $link->getIconClass() : '';
    ?>

				<?php 
    if (get_var('action') != 'add' && !$link) {
        ?>

					<?php 
        create_message('danger', 'Link does not exist!', true);
        ?>
Ejemplo n.º 6
0
function createHrefLink($str_or_object_link, $target = '', $onclick = '')
{
    $html = "";
    if ($str_or_object_link != "") {
        if (gettype($str_or_object_link) != "object" && strtoupper(substr($str_or_object_link, 0, 11)) != "JAVASCRIPT:" && strtoupper(substr($str_or_object_link, 0, 1)) != "#") {
            $tmp_link = new Link($str_or_object_link, $target);
            if (!$tmp_link->getUserHaveRights()) {
                return "";
            }
            $html .= $tmp_link->getLink();
            if ($tmp_link->getTarget() != "") {
                $html .= "\" target=\"" . $tmp_link->getTarget();
            }
            if ($onclick != "") {
                $html .= "\" onClick=\"" . $onclick;
            }
        } else {
            if (gettype($str_or_object_link) != "object" && strtoupper(substr($str_or_object_link, 0, 11)) == "JAVASCRIPT:") {
                $html .= "javascript:void(0);\" onClick=\"" . str_replace("javascript:", "", str_replace("javascript:void(0);", "", $str_or_object_link)) . $onclick;
            } else {
                if (gettype($str_or_object_link) != "object" && strtoupper(substr($str_or_object_link, 0, 1)) == "#") {
                    $cur_page = Page::getInstance($_GET['p']);
                    $html .= $cur_page->getCurrentURL() . $str_or_object_link;
                    if ($onclick != "") {
                        $html .= "\" onClick=\"" . $onclick;
                    }
                } else {
                    if (get_class($str_or_object_link) == "Link") {
                        if (!$str_or_object_link->getUserHaveRights()) {
                            return "";
                        }
                        $html .= $str_or_object_link->getLink();
                        if ($str_or_object_link->getTarget() != "") {
                            $html .= "\" target=\"" . $str_or_object_link->getTarget() . "";
                        }
                    } else {
                        if (get_class($str_or_object_link) == "DialogBox" || is_subclass_of($str_or_object_link, "DialogBox") || get_class($str_or_object_link) == "JavaScript" || is_subclass_of($str_or_object_link, "JavaScript")) {
                            $str_or_object_link->displayFormURL();
                        }
                        $tmp_link = $str_or_object_link->render();
                        if (strtoupper(substr($tmp_link, 0, 11)) == "JAVASCRIPT:") {
                            $html .= "javascript:void(0);\" onClick=\"" . str_replace("javascript:", "", str_replace("javascript:void(0);", "", $tmp_link)) . $onclick;
                        } else {
                            $html .= $tmp_link;
                        }
                    }
                }
            }
        }
    } else {
        $html .= "javascript:void(0);";
    }
    return $html;
}