Пример #1
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     Language::load('xmf');
     $this->db = \XoopsDatabaseFactory::getDatabaseConnection();
     $this->databaseName = XOOPS_DB_NAME;
     $this->resetQueue();
 }
Пример #2
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     global $xoopsDB;
     // lock this to legacy support
     //\Xmf\Debug::dump($xoopsDB,true);
     Language::load('database', 'xmf');
     $this->db =& $xoopsDB;
     $this->queueReset();
 }
Пример #3
0
 /**
  * Retrieve a module admin instance
  *
  * If we are on a next generation system this will be the a native Xoops\Module\Admin instance.
  * Older systems with the Frameworks based admin class will get an instance of this class which
  * provides compatible methods built from the old Frameworks version.
  *
  * @return object a ModuleAdmin or Xoops\Module\Admin instance.
  */
 public static function getInstance()
 {
     static $instance;
     if ($instance === null) {
         if (class_exists('\\Xoops\\Module\\Admin', true)) {
             $instance = new \Xoops\Module\Admin();
             static::$ModuleAdmin = $instance;
         } else {
             include_once $GLOBALS['xoops']->path('Frameworks/moduleclasses/moduleadmin/moduleadmin.php');
             static::$ModuleAdmin = new \ModuleAdmin();
             Language::load('xmf');
             $instance = new static();
         }
     }
     return $instance;
 }
Пример #4
0
 /**
  * Check for installed module and version and do addConfigBoxLine()
  *
  * @param string  $moddir     - module directory name
  * @param integer $minversion - minimum acceptable module version (100 = V1.00)
  *
  * @return bool true if requested version of the module is available
  */
 public static function checkModuleVersion($moddir, $minversion)
 {
     \Xmf\Language::load('main', 'xmf');
     $return = false;
     $helper = \Xmf\Module\Helper::getHelper($moddir);
     if (is_object($helper) && is_object($helper->getModule())) {
         $mod_modversion = $helper->getModule()->getVar('version');
         $mod_version_f = $mod_modversion / 100;
         $min_version_f = $minversion / 100;
         $value = sprintf(_AM_XMF_DEMOMVC_MODULE_VERSION, strtoupper($moddir), $min_version_f, $mod_version_f);
         if ($mod_modversion >= $minversion) {
             self::addConfigAccept($value);
             $return = true;
         } else {
             self::addConfigError($value);
         }
     } else {
         $value = sprintf(_AM_XMF_DEMOMVC_MODULE_NOTFOUND, strtoupper($moddir), $minversion / 100);
         self::addConfigError($value);
     }
     return $return;
 }
Пример #5
0
 /**
  * load a language file for this module
  *
  * @param string $name basename of language file (i.e. 'admin')
  *
  * @return bool
  */
 public function loadLanguage($name)
 {
     if ($ret = Language::load($name, $this->dirname)) {
         $this->addLog("Loading language '{$name}'");
     } else {
         $this->addLog("ERROR :: Language '{$name}' could not be loaded");
     }
     return $ret;
 }
Пример #6
0
 */
require dirname(dirname(dirname(__DIR__))) . '/mainfile.php';
// DO NOT depend on these in your - they will change or be removed
if (false & !defined('XMF_EXEC')) {
    define('XMF_EXEC', true);
    define('XMF_URL', \XoopsBaseConfig::get('url') . '/modules/xmf');
    define('XMF_CSS_URL', XMF_URL . '/css');
    // define('XMF_IMAGES_URL', XMF_URL . '/images');
    define('XMF_INCLUDE_URL', XMF_URL . '/include');
    define('XMF_LANGUAGE_URL', XMF_URL . '/language');
    define('XMF_LIBRARIES_URL', XMF_URL . '/libraries');
    define('XMF_TEMPLATES_URL', XMF_URL . '/templates');
    define('XMF_KRUMO_URL', XMF_URL . '/css/krumo/');
    define('XMF_ROOT_PATH', \XoopsBaseConfig::get('root-path') . '/modules/xmf');
    define('XMF_CSS_PATH', XMF_ROOT_PATH . '/css');
    define('XMF_IMAGES_PATH', XMF_ROOT_PATH . '/images');
    define('XMF_INCLUDE_PATH', XMF_ROOT_PATH . '/include');
    define('XMF_LANGUAGE_PATH', XMF_ROOT_PATH . '/language');
    define('XMF_LIBRARIES_PATH', XMF_ROOT_PATH . '/libraries');
    define('XMF_TEMPLATES_PATH', XMF_ROOT_PATH . '/templates');
    define('XMF_NEWLINE', "\n");
    define('_GLOBAL_LEFT', 'left');
    define('_GLOBAL_RIGHT', 'right');
}
//require dirname(__DIR__) . '/libraries/Xmf/Loader.php';
//spl_autoload_register(array('Xmf_Loader', 'loadClass'));
//require_once dirname(__DIR__) . '/vendor/autoload.php';
// \Xmf\Loader::loadFile(\XoopsBaseConfig::get('root-path') . '/vendor/autoload.php');
//require_once __DIR__ . '/functions.php';
\Xmf\Language::load('global', 'xmf');
Пример #7
0
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     Language::load('database', 'xmf');
     $this->db = Factory::getConnection();
     $this->queueReset();
 }
Пример #8
0
 /**
  * checkStopWords - look up a word in a list of stop words and
  * classify it as a significant word or a stop word.
  *
  * @param string $key the word to check
  *
  * @return bool True if word is significant, false if it is a stop word
  */
 protected static function checkStopWords($key)
 {
     static $stopwords = null;
     if (!$stopwords) {
         if (!defined('_XMF_STOPWORDS')) {
             \Xmf\Language::load('stopwords', 'xmf');
         }
         if (defined('_XMF_STOPWORDS')) {
             $sw = explode(' ', _XMF_STOPWORDS);
             $stopwords = array_fill_keys($sw, true);
         } else {
             $stopwords = array('_' => true);
         }
     }
     if ($stopwords) {
         return !isset($stopwords[mb_strtolower($key)]);
     }
     return true;
 }