Exemplo n.º 1
0
 protected static function loadClass($entity, $type)
 {
     if (strpos($type, '.')) {
         list($prefix, $type) = explode('.', $type);
     } else {
         $prefix = 'M';
     }
     $class = MString::ucfirst($prefix, '_') . 'Form' . MString::ucfirst($entity, '_') . MString::ucfirst($type, '_');
     if (class_exists($class)) {
         return $class;
     }
     // Get the field search path array.
     $paths = MFormHelper::addPath($entity);
     // If the type is complex, add the base type to the paths.
     if ($pos = strpos($type, '_')) {
         // Add the complex type prefix to the paths.
         for ($i = 0, $n = count($paths); $i < $n; $i++) {
             // Derive the new path.
             $path = $paths[$i] . '/' . strtolower(substr($type, 0, $pos));
             // If the path does not exist, add it.
             if (!in_array($path, $paths)) {
                 $paths[] = $path;
             }
         }
         // Break off the end of the complex type.
         $type = substr($type, $pos + 1);
     }
     // Try to find the class file.
     $type = strtolower($type) . '.php';
     foreach ($paths as $path) {
         if ($file = MPath::find($path, $type)) {
             require_once $file;
             if (class_exists($class)) {
                 break;
             }
         }
     }
     // Check for all if the class exists.
     return class_exists($class) ? $class : false;
 }
Exemplo n.º 2
0
<?php

/*
* @package		Miwi Framework
* @copyright	Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved.
* @copyright	Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved.
* @license		GNU General Public License version 2 or later
*/
defined('MIWI') or die('MIWI');
MFormHelper::loadFieldClass('list');
class MFormFieldEditors extends MFormFieldList
{
    public $type = 'Editors';
    protected function getOptions()
    {
        MLog::add('MFormFieldEditors is deprecated. Use MFormFieldPlugins instead (with folder="editors").', MLog::WARNING, 'deprecated');
        // Get the database object and a new query object.
        $db = MFactory::getDBO();
        $query = $db->getQuery(true);
        // Build the query.
        $query->select('element AS value, name AS text');
        $query->from('#__extensions');
        $query->where('folder = ' . $db->quote('editors'));
        $query->where('enabled = 1');
        $query->order('ordering, name');
        // Set the query and load the options.
        $db->setQuery($query);
        $options = $db->loadObjectList();
        $lang = MFactory::getLanguage();
        foreach ($options as $i => $option) {
            $lang->load('plg_editors_' . $option->value, MPATH_ADMINISTRATOR, null, false, false) || $lang->load('plg_editors_' . $option->value, MPATH_PLUGINS . '/editors/' . $option->value, null, false, false) || $lang->load('plg_editors_' . $option->value, MPATH_ADMINISTRATOR, $lang->getDefault(), false, false) || $lang->load('plg_editors_' . $option->value, MPATH_PLUGINS . '/editors/' . $option->value, $lang->getDefault(), false, false);
Exemplo n.º 3
0
 public static function addRulePath($new = null)
 {
     return MFormHelper::addRulePath($new);
 }
Exemplo n.º 4
0
<?php

/*
* @package		Miwi Framework
* @copyright	Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved.
* @copyright	Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved.
* @license		GNU General Public License version 2 or later
*/
defined('MIWI') or die('MIWI');
MFormHelper::loadFieldClass('text');
class MFormFieldTel extends MFormFieldText
{
    protected $type = 'Tel';
}
Exemplo n.º 5
0
<?php

/*
* @package		Miwi Framework
* @copyright	Copyright (C) 2009-2014 Miwisoft, LLC. All rights reserved.
* @copyright	Copyright (C) 2005-2012 Open Source Matters, Inc. All rights reserved.
* @license		GNU General Public License version 2 or later
*/
defined('MIWI') or die('MIWI');
MFormHelper::loadFieldClass('groupedlist');
class MFormFieldTimezone extends MFormFieldGroupedList
{
    protected $type = 'Timezone';
    protected static $zones = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
    protected function getGroups()
    {
        // Initialize variables.
        $groups = array();
        $keyField = $this->element['key_field'] ? (string) $this->element['key_field'] : 'id';
        $keyValue = $this->form->getValue($keyField);
        // If the timezone is not set use the server setting.
        if (strlen($this->value) == 0 && empty($keyValue)) {
            $this->value = MFactory::getConfig()->get('offset');
        }
        // Get the list of time zones from the server.
        $zones = DateTimeZone::listIdentifiers();
        // Build the group lists.
        foreach ($zones as $zone) {
            // Time zones not in a group we will ignore.
            if (strpos($zone, '/') === false) {
                continue;