Beispiel #1
0
<?php

/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
 which is considered copyrighted (c) material of the original comment or credit authors.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author          Mage Grégory (AKA Mage)
 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
echo "\n<strong>alert</strong><br /><br />\nsince 2.6.0 you can use the alert function to display alerts<br />\nYou have four types of alerts:<br /><br /><br />";
echo $xoops->alert('info', 'Your information message', 'Title information');
echo $xoops->alert('warning', 'Your warning message', 'Title warning');
echo $xoops->alert('error', array('error 1', 'error 2', '...'), 'Title error');
echo $xoops->alert('success', 'Your success message', 'Title success');
Xoops_Utils::dumpFile(__FILE__);
$xoops->footer();
Beispiel #2
0
 /**
  * XoopsThemeBlocksPlugin::buildBlock()
  *
  * @param XoopsBlock $xobject
  * @param XoopsTpl $template
  * @return array|bool
  */
 public function buildBlock($xobject, &$template)
 {
     $xoops = Xoops::getInstance();
     // The lame type workaround will change
     // bid is added temporarily as workaround for specific block manipulation
     $dirname = $xobject->getVar('dirname');
     $block = array('id' => $xobject->getVar('bid'), 'module' => $dirname, 'title' => $xobject->getVar('title'), 'weight' => $xobject->getVar('weight'), 'lastmod' => $xobject->getVar('last_modified'));
     $bcachetime = (int) $xobject->getVar('bcachetime');
     if (empty($bcachetime)) {
         $template->caching = 0;
     } else {
         $template->caching = 2;
         $template->cache_lifetime = $bcachetime;
     }
     $template->setCompileId($dirname);
     $tplName = ($tplName = $xobject->getVar('template')) ? "block:{$dirname}/{$tplName}" : "module:system/system_block_dummy.tpl";
     //$tplName = str_replace('.html', '.tpl', $tplName);
     $cacheid = $this->generateCacheId('blk_' . $xobject->getVar('bid'));
     $xoops->preload()->triggerEvent('core.themeblocks.buildblock.start', array($xobject, $template->isCached($tplName, $cacheid)));
     if (!$bcachetime || !$template->isCached($tplName, $cacheid)) {
         //Get theme metas
         $old = array();
         if ($this->theme && $bcachetime) {
             foreach ($this->theme->metas as $type => $value) {
                 $old[$type] = $this->theme->metas[$type];
             }
         }
         //build block
         if ($bresult = $xobject->buildBlock()) {
             $template->assign('block', $bresult);
             $block['content'] = $template->fetch($tplName, $cacheid);
         } else {
             $block = false;
         }
         //check if theme added new metas
         if ($this->theme && $bcachetime) {
             $metas = array();
             foreach ($this->theme->metas as $type => $value) {
                 $dif = Xoops_Utils::arrayRecursiveDiff($this->theme->metas[$type], $old[$type]);
                 if (count($dif)) {
                     $metas[$type] = $dif;
                 }
             }
             if (count($metas)) {
                 Xoops_Cache::write($cacheid, $metas);
             }
         }
     } else {
         $block['content'] = $template->fetch($tplName, $cacheid);
     }
     //add block cached metas
     if ($this->theme && $bcachetime) {
         if ($metas = Xoops_Cache::read($cacheid)) {
             foreach ($metas as $type => $value) {
                 $this->theme->metas[$type] = array_merge($this->theme->metas[$type], $metas[$type]);
             }
         }
     }
     $template->setCompileId();
     return $block;
 }
Beispiel #3
0
$xoops->loadLocale('system');
echo XoopsLocale::A_DELETE;
echo '</br>';
echo XoopsLocale::A_POST;
echo '</br>';
echo SystemLocale::RECOMMEND_US;
echo '</br>';
//Translate using wrapper, no auto completion but offers support
echo Xoops_Locale::translate('A_EDIT');
echo '</br>';
//get from XoopsLocale by default
echo Xoops_Locale::translate('ADMINISTRATION_MENU');
echo '</br>';
//Not in XoopsLocale, the key is echoed
echo Xoops_Locale::translate('ADMINISTRATION_MENU', 'system');
echo '</br>';
//Displays translation
echo Xoops_Locale::translate('_CHARSET');
echo '</br>';
//Translations not present on classes are loaded from defines()
//or
echo $xoops->translate('ACTIVE');
echo '</br>';
//Example of template
$tpl = new XoopsTpl();
$tpl->display(__DIR__ . '/templates/language.tpl');
Xoops_Utils::dumpFile(__FILE__);
echo "Template file:";
echo '</br>';
Xoops_Utils::dumpFile(__DIR__ . '/templates/language.tpl');
$xoops->footer();
Beispiel #4
0
 /**
  * Add a new detector to the list of detectors that a request can use.
  * There are several different formats and types of detectors that can be set.
  * ### Environment value comparison
  * An environment value comparison, compares a value fetched from `env()` to a known value
  * the environment value is equality checked against the provided value.
  * e.g `addDetector('post', array('env' => 'REQUEST_METHOD', 'value' => 'POST'))`
  * ### Pattern value comparison
  * Pattern value comparison allows you to compare a value fetched from `env()` to a regular expression.
  * e.g `addDetector('iphone', array('env' => 'HTTP_USER_AGENT', 'pattern' => '/iPhone/i'));`
  * ### Option based comparison
  * Option based comparisons use a list of options to create a regular expression.  Subsequent calls
  * to add an already defined options detector will merge the options.
  * e.g `addDetector('mobile', array('env' => 'HTTP_USER_AGENT', 'options' => array('Fennec')));`
  * ### Callback detectors
  * Callback detectors allow you to provide a 'callback' type to handle the check.  The callback will
  * receive the request object as its only parameter.
  * e.g `addDetector('custom', array('callback' => array('SomeClass', 'someMethod')));`
  * ### Request parameter detectors
  * Allows for custom detectors on the request parameters.
  * e.g `addDetector('post', array('param' => 'requested', 'value' => 1)`
  *
  * @param string $name    The name of the detector.
  * @param array  $options The options for the detector definition.  See above.
  *
  * @return void
  */
 public function addDetector($name, $options)
 {
     $name = strtolower($name);
     if (isset($this->detectors[$name]) && isset($options['options'])) {
         $options = \Xoops_Utils::arrayRecursiveMerge($this->detectors[$name], $options);
     }
     $this->detectors[$name] = $options;
 }
Beispiel #5
0
<?php

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author          trabis <*****@*****.**>
 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
echo "\nThe 'System' module provides a 'Plugin' interface that modules should implement<br />\nThe new class \\Xoops\\Module\\Plugin is the class that makes using plugins simple and effective!<br />\n<br />\nSee how Codex module hooks into the system module just by using this codex/class/plugin/system.php\n";
Xoops_Utils::dumpFile(__DIR__ . '/class/plugin/system.php');
$xoops->footer();
Beispiel #6
0
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author          Richard Griffith <*****@*****.**>
 */
require dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
// set custom filters for outputing scss and less assets
$xoops->theme()->setNamedAsset('testscss', 'modules/codex/assets/scss/test.scss', 'scssphp');
$xoops->theme()->setNamedAsset('testless', 'modules/codex/assets/less/test.less', 'lessphp');
// add custom filtered assets just like any other assets
$xoops->theme()->addStylesheetAssets(array('@testscss', '@testless'));
echo <<<EOT
    <p class="scss-example">This is an example of new asset managment capabilities
        using styles created directly from SCSS and LESS sources.</p>
    <div class="shape" id="shape1"></div>
    <div class="shape" id="shape2"></div>
    <div class="shape" id="shape3"></div>
EOT;
Xoops_Utils::dumpFile(__FILE__);
echo '<h3>Simple SCSS example - assets/scss/test.scss</h3>';
Xoops_Utils::dumpFile($xoops->path('modules/codex/assets/scss/test.scss'));
echo '<h3>Simple Less example - assets/less/test.less</h3>';
Xoops_Utils::dumpFile($xoops->path('modules/codex/assets/less/test.less'));
$xoops->footer();
Beispiel #7
0
<?php

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author          trabis <*****@*****.**>
 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
echo "\nSince 2.6.0, the search functionality was removed from core.<br />\nNow you need to install the 'Search' Module to get search functionality<br />\n<br />\nThe method for implementing search does no longer uses xoops_version.php<br />\nThe 'Search' module provides a 'Plugin' interface that modules should implement<br />\nThe new class \\Xoops\\Module\\Plugin is the class that makes using plugins simple and effective!<br />\n<br />\nSee how Codex module hooks into the search module just by using this codex/class/plugin/search.php\n";
Xoops_Utils::dumpFile(__DIR__ . '/class/plugin/search.php');
$xoops->footer();
Beispiel #8
0
<?php

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @author          trabis <*****@*****.**>
 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
echo "\nYou need to install the 'Menus' Module to get menus functionality<br />\n<br />\nThe 'Menus' module provides a 'Plugin' interface that modules should implement<br />\nThe new class \\Xoops\\Module\\Plugin is the class that makes using plugins simple and effective!<br />\n<br />\nSee how Codex module hooks into the menus module just by using this codex/class/plugin/menus.php\n";
Xoops_Utils::dumpFile(__DIR__ . '/class/plugin/menus.php');
$xoops->footer();