Exemple #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          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();
Exemple #2
0
You should have received a copy of the GNU General Public License,
and the GNU Lesser General Public License along with this program.
If not, see http://www.gnu.org/licenses/.

You may contact the copyright holder through XOOPS Project:
http://xoops.org
EOT;
echo '<h4>Extracted Description</h4>';
// get the intro of the article to use as the description
$description = Metagen::generateDescription($article, 50);
echo '<p>' . $description . '</p>';
echo '<h4>SEO Slug</h4>';
// turn title into a slug
echo '<p>' . Metagen::generateSeoTitle($title) . '</p>';
// highlight keywords in article
echo '<h4>Article with Top 25 Keywords Highlighted</h4>';
// get important words from title
$title_keywords = Metagen::generateKeywords($title, 25, 3);
//Debug::dump($title_keywords);
// get top 25 keywords, but always keep keywords from title
$keywords = Metagen::generateKeywords($article, 25, 4, $title_keywords);
Debug::dump($keywords, true);
echo Highlighter::apply($keywords, $article);
// add to the page
Metagen::assignTitle($title);
Metagen::assignKeywords($keywords);
Metagen::assignDescription($description);
// dump our source
echo '<br /><h2>Source code</h2>';
\Xoops\Utils::dumpFile(__FILE__);
$xoops->footer();
Exemple #3
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          Laurent JEN (aka DuGris)
 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
echo "\n<strong>backend for your module</strong><br /><br />\nSince 2.6.0, the backend functionality use a 'Plugin' interface.<br />\nThe new class \\Xoops\\Module\\Plugin is the class that makes using plugins simple and effective!<br />\n<br />\n<ul>\n    <li>Copy the file <strong><i>root_path/backend.php</i></strong> in to your module folder</li>\n    <li>Copy the file <strong><i>root_path/modules/system/templates/system_rss.tpl</i></strong> to in your module templates folder</li>\n    <li>Create backend plugin <i>see the <a href='system-plugin.php' title='System plugin sample'><strong>System plugin sample</strong></a></li>\n</ul>\n";
\Xoops\Utils::dumpFile(__DIR__ . '/class/plugin/system.php');
$xoops->footer();
Exemple #4
0
 /**
  * Blocks::buildBlock()
  *
  * @param XoopsBlock $xobject  block to render
  * @param XoopsTpl   $template template engine
  *
  * @return array|bool
  */
 public function buildBlock(XoopsBlock $xobject, XoopsTpl $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;
 }
Exemple #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 "\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();
Exemple #6
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;
 }
Exemple #7
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();