function __initialize()
 {
     parent::__initialize();
     $links = array();
     $links[] = $this->CreateLink("TwitThis", "http://twitter.com/home?status={url}", resFile("socialbookmarks/twitter.png"));
     $links[] = $this->CreateLink("LinkedIn", "http://www.linkedin.com/shareArticle?mini=true&url={url}&title={title}&source={domain}&summary=EXCERPT", resFile("socialbookmarks/linkedin.png"));
     $links[] = $this->CreateLink("MySpace", "http://www.myspace.com/Modules/PostTo/Pages/?u={url}&t={title}", resFile("socialbookmarks/myspace.png"));
     $links[] = $this->CreateLink("del.icio.us", "http://delicious.com/post?url={url}&title={title}", resFile("socialbookmarks/delicious.png"));
     $links[] = $this->CreateLink("Digg", "http://digg.com/submit?phase=2&url={url}&title={title}", resFile("socialbookmarks/digg.png"));
     $links[] = $this->CreateLink("StumbleUpon", "http://www.stumbleupon.com/submit.php?url={url}", resFile("socialbookmarks/stumbleupon.png"));
     $links[] = $this->CreateLink("Reddit", "http://reddit.com/submit?url={url}&title={title}", resFile("socialbookmarks/reddit.png"));
     $links[] = $this->CreateLink("Y!GG", "http://yigg.de/neu?exturl={url}&exttitle={title}", resFile("socialbookmarks/yigg.png"));
     $links[] = $this->CreateLink("Google Bookmarks", "http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk={url}&title={title}", resFile("socialbookmarks/google.png"));
     $links[] = $this->CreateLink("Webnews", "http://www.webnews.de/einstellen?url={url}&title={title}", resFile("socialbookmarks/webnews.png"));
     $links[] = $this->CreateLink("YahooMyWeb", "http://myweb2.search.yahoo.com/myresults/bookmarklet?u={url}&={title}", resFile("socialbookmarks/yahoomyweb.png"));
     $links[] = $this->CreateLink("Furl", "http://www.furl.net/storeIt.jsp?u={url}&t={title}", resFile("socialbookmarks/furl.png"));
     $links[] = $this->CreateLink("Live-MSN", "https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url={url}&title={title}&top=1", resFile("socialbookmarks/live.png"));
     $links[] = $this->CreateLink("BlinkList", "http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url={url}&Title={title}", resFile("socialbookmarks/blinklist.png"));
     $links[] = $this->CreateLink("co.mments", "http://co.mments.com/track?url={url}&title={title}", resFile("socialbookmarks/co.mments.png"));
     $links[] = $this->CreateLink("Facebook", "http://www.facebook.com/share.php?u={url}", resFile("socialbookmarks/facebook.png"));
     $links[] = $this->CreateLink("Faves", "http://faves.com/Authoring.aspx?u={url}&title={title}", resFile("socialbookmarks/faves.png"));
     $links[] = $this->CreateLink("Folkd", "http://www.folkd.com/submit/{url}", resFile("socialbookmarks/folkd.png"));
     $links[] = $this->CreateLink("Squidoo", "http://www.squidoo.com/lensmaster/bookmark?{url}", resFile("socialbookmarks/squidoo.png"));
     $links[] = $this->CreateLink("Wikio", "http://www.wikio.com/vote?url={url}", resFile("socialbookmarks/wikio.png"));
     $links[] = $this->CreateLink("Ma.gnolia", "http://ma.gnolia.com/bookmarklet/add?url={url}&title={title}", resFile("socialbookmarks/magnolia.png"));
     $links[] = $this->CreateLink("NewsVine", "http://www.newsvine.com/_tools/seed&save?u={url}&h={title}", resFile("socialbookmarks/newsvine.png"));
     $links[] = $this->CreateLink("Shadows", "http://www.shadows.com/features/tcr.htm?url={url}&title={title}", resFile("socialbookmarks/shadows.png"));
     $this->set("links", $links);
 }
 /**
  * @param string $account_code Your GA account
  * @param string $js_varname Name of the JS variable
  * @param bool $track_immediately If true calls _trackPageview() instantly
  * @param string $track_prefix Prefix for tracked events
  */
 function __initialize($account_code, $js_varname = "pageTracker", $track_immediately = true, $track_prefix = "")
 {
     parent::__initialize();
     $this->set("account_code", $account_code);
     $this->set("js_varname", $js_varname);
     $this->set("track_immediately", $track_immediately);
     $this->set("track_prefix", $track_prefix);
     $this->set("tracker", array());
 }
 /**
  * Shows product details
  * @attribute[RequestParam('id','int')]
  */
 function Details($id)
 {
     // check if product really exists
     $ds = model_datasource('system');
     $prod = $ds->Query('products')->eq('id', $id)->current();
     if (!$prod) {
         redirect('Products', 'Index', array('error' => 'Product not found'));
     }
     // create a template with product details
     $this->content(Template::Make('product_details'))->set('title', $prod->title)->set('description', $prod->body)->set('image', resFile($prod->image))->set('link', buildQuery('Basket', 'Add', array('id' => $prod->id)));
 }
 /**
  * @internal New string page
  */
 function NewStrings()
 {
     $this->_contentdiv->content("<h1>New strings</h1>");
     $ds = model_datasource($GLOBALS['CONFIG']['translation']['sync']['datasource']);
     foreach ($ds->Query('wdf_unknown_strings')->all() as $row) {
         $ns = Template::Make('translationnewstring');
         foreach ($row->GetColumnNames() as $col) {
             $ns->set($col, $row->{$col});
         }
         $this->_contentdiv->content($ns);
     }
     if (!isset($row)) {
         $this->_contentdiv->content("<p>no requested strings found</p>");
     }
     $this->_contentdiv->content("<h1>Manually add string</h1>");
     Template::Make('translationnewstringmanually')->appendTo($this->_contentdiv);
 }
 /**
  * @internal New string page
  */
 function NewStrings()
 {
     $this->_contentdiv->content("<h1>New strings</h1>");
     $this->_contentdiv->content("<p>Default language is '{$GLOBALS['CONFIG']['localization']['default_language']}', so please create new strings accordingly.</p>");
     $ds = model_datasource($GLOBALS['CONFIG']['translation']['sync']['datasource']);
     foreach ($ds->Query('wdf_unknown_strings')->all() as $row) {
         $ns = Template::Make('translationnewstring');
         foreach ($row->GetColumnNames() as $col) {
             $ns->set($col, $row->{$col});
         }
         $this->_contentdiv->content($ns);
     }
     if (!isset($row)) {
         $this->_contentdiv->content("<p>no requested strings found</p>");
     }
     $this->_contentdiv->content("<h1 style='clear:both'>Manually add string</h1>");
     Template::Make('translationnewstringmanually')->appendTo($this->_contentdiv);
 }
 /**
  * Entrypoint for the checkout process.
  * 
  * Requests customers address details and asks for payment processor.
  */
 function BuyNow()
 {
     // displays the chechout form, which has all inputs for address on it
     $this->content(Template::Make('checkout_form'));
 }
Exemple #7
0
/**
 * Checks if minifying a classes resources is explicitely forbidden
 * 
 * Uses NoMinify attribute to check that
 * @param string $classname Classname to check for
 * @return bool true or false
 */
function minify_forbidden($classname)
{
    if (is_string($classname) && strpos($classname, '.') !== false) {
        $classname = explode('.', $classname);
        $classname = $classname[0];
    }
    try {
        $ref = WdfReflector::GetInstance($classname);
        return count($ref->GetClassAttributes('NoMinify')) > 0;
    } catch (Exception $ignored) {
        try {
            Template::Make($classname);
            // check if the name refers to an anonymous template
            return false;
        } catch (Exception $ex) {
            WdfException::Log("minify_forbidden({$classname})", $ex);
            return false;
        }
    }
}
 /**
  * @override
  */
 function WdfRender()
 {
     if (!$this->get('isrtl') && system_is_module_loaded('localization')) {
         $ci = Localization::detectCulture();
         if ($ci->IsRTL) {
             $this->set("isrtl", " dir='rtl'");
         }
     }
     $res = $this->__collectResources();
     $this->js = array_reverse($this->js, true);
     foreach (array_reverse($res) as $r) {
         if (starts_with(pathinfo($r, PATHINFO_EXTENSION), 'css')) {
             $this->addCss($r);
         } else {
             $this->addjs($r);
         }
     }
     $this->js = array_reverse($this->js, true);
     $this->set("css", $this->css);
     $this->set("js", $this->js);
     $this->set("meta", $this->meta);
     $this->set("content", $this->_content);
     return parent::WdfRender();
 }
 function Init()
 {
     $this->content(Template::Make('intro'))->set("run", new Anchor(buildQuery('DocMain', 'Run'), 'Run'));
 }
Exemple #10
0
 /**
  * @attribute[RequestParam('title','string',false)]
  * @attribute[RequestParam('tagline','string',false)]
  * @attribute[RequestParam('body','text',false)]
  * @attribute[RequestParam('price','double',false)]
  */
 function AddProduct($title, $tagline, $body, $price)
 {
     $this->_login();
     // require admin to be logged in
     // This is a quite simple condition: You MUST provide each of the variables
     if ($title && $tagline && $body && $price) {
         // store the uploaded image if present
         if (isset($_FILES['image']) && $_FILES['image']['name']) {
             $i = 1;
             $image = __DIR__ . '/../images/' . $_FILES['image']['name'];
             while (file_exists($image)) {
                 $image = __DIR__ . '/../images/' . $i++ . '_' . $_FILES['image']['name'];
             }
             move_uploaded_file($_FILES['image']['tmp_name'], $image);
             $image = basename($image);
         } else {
             $image = '';
         }
         // store the new product into the database
         $ds = model_datasource('system');
         $ds->ExecuteSql("INSERT INTO products(title,tagline,body,image,price)VALUES(?,?,?,?,?)", array($title, $tagline, $body, $image, $price));
         redirect('Admin');
     }
     // create a dialog and put a template on it.
     $dlg = new uiDialog('Add product', array('width' => 600, 'height' => 450));
     $dlg->content(Template::Make('admin_product_add'));
     $dlg->AddButton('Add product', "\$('#frm_add_product').submit()");
     // frm_add_product is defined in the template
     $dlg->AddCloseButton("Cancel");
     return $dlg;
 }
Exemple #11
0
 function NewPost()
 {
     log_debug("New Post");
     $this->content(Template::Make('newpostform'));
 }
Exemple #12
0
 /**
  * @internal SysAdmin login page.
  * @attribute[RequestParam('username','string',false)]
  * @attribute[RequestParam('password','string',false)]
  */
 function Login($username, $password)
 {
     global $CONFIG;
     if ($username === false || $password === false) {
         $this->content("<br/><br/>");
         $this->content(Template::Make('sysadminlogin'));
         return;
     }
     if ($username != $CONFIG['system']['admin']['username'] || $password != $CONFIG['system']['admin']['password']) {
         redirect(get_class_simple($this), 'login');
     }
     $_SESSION['admin_handler_username'] = $username;
     $_SESSION['admin_handler_password'] = $password;
     redirect(get_class_simple($this));
 }