当前位置: 首页>>代码示例>>PHP>>正文


PHP System::isLegacyMode方法代码示例

本文整理汇总了PHP中System::isLegacyMode方法的典型用法代码示例。如果您正苦于以下问题:PHP System::isLegacyMode方法的具体用法?PHP System::isLegacyMode怎么用?PHP System::isLegacyMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System::isLegacyMode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smarty_function_modurl

/**
 * Zikula_View function to create a zikula.orgpatible URL for a specific module function.
 *
 * This function returns a module URL string if successful. Unlike the API
 * function ModURL, this is already sanitized to display, so it should not be
 * passed to the safetext modifier.
 *
 * Available parameters:
 *   - modname:  The well-known name of a module for which to create the URL (required)
 *   - type:     The type of function for which to create the URL; currently one of 'user' or 'admin' (default is 'user')
 *   - func:     The actual module function for which to create the URL (default is 'main')
 *   - fragment: The fragement to target within the URL
 *   - ssl:      See below
 *   - fqurl:    Make a fully qualified URL
 *   - forcelongurl: Do not create a short URL (forced)
 *   - forcelang (boolean|string) Force the inclusion of the $forcelang or default system language in the generated url
 *   - append:   (optional) A string to be appended to the URL
 *   - assign:   If set, the results are assigned to the corresponding variable instead of printed out
 *   - all remaining parameters are passed to the module function
 *
 * Example
 * Create a URL to the News 'view' function with parameters 'sid' set to 3
 *   <a href="{modurl modname='News' type='user' func='display' sid='3'}">Link</a>
 *
 * Example SSL
 * Create a secure https:// URL to the News 'view' function with parameters 'sid' set to 3
 * ssl - set to constant null,true,false NOTE: $ssl = true not $ssl = 'true'  null - leave the current status untouched, true - create a ssl url, false - create a non-ssl url
 *   <a href="{modurl modname='News' type='user' func='display' sid='3' ssl=true}">Link</a>
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return string The URL.
 */
function smarty_function_modurl($params, Zikula_View $view)
{
    $assign = isset($params['assign']) ? $params['assign'] : null;
    $append = isset($params['append']) ? $params['append'] : '';
    $fragment = isset($params['fragment']) ? $params['fragment'] : null;
    $fqurl = isset($params['fqurl']) ? $params['fqurl'] : null;
    $forcelongurl = isset($params['forcelongurl']) ? (bool) $params['forcelongurl'] : false;
    if (isset($params['func']) && $params['func']) {
        $func = $params['func'];
    } else {
        if (System::isLegacyMode()) {
            $func = 'main';
            LogUtil::log(__f('{modurl} - %1$s is a required argument, you must specify it explicitly in %2$s', array('func', $view->template)), E_USER_DEPRECATED);
        } else {
            $view->trigger_error(__f('{modurl} - %1$s is a required argument, you must specify it explicitly in %2$s', array('func', $view->template)));
            return false;
        }
    }
    if (isset($params['type']) && $params['type']) {
        $type = $params['type'];
    } else {
        if (System::isLegacyMode()) {
            $type = 'user';
            LogUtil::log(__f('{modurl} - %1$s is a required argument, you must specify it explicitly in %2$s', array('type', $view->template)), E_USER_DEPRECATED);
        } else {
            $view->trigger_error(__f('{modurl} - %1$s is a required argument, you must specify it explicitly in %2$s', array('type', $view->template)));
            return false;
        }
    }
    $modname = isset($params['modname']) ? $params['modname'] : null;
    $ssl = isset($params['ssl']) ? (bool) $params['ssl'] : null;
    $forcelang = isset($params['forcelang']) && $params['forcelang'] ? $params['forcelang'] : false;
    // avoid passing these to ModUtil::url
    unset($params['modname']);
    unset($params['type']);
    unset($params['func']);
    unset($params['fragment']);
    unset($params['ssl']);
    unset($params['fqurl']);
    unset($params['assign']);
    unset($params['append']);
    unset($params['forcelang']);
    unset($params['forcelongurl']);
    if (!$modname) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('modurl', 'modname')));
        return false;
    }
    $result = ModUtil::url($modname, $type, $func, $params, $ssl, $fragment, $fqurl, $forcelongurl, $forcelang);
    if ($append && is_string($append)) {
        $result .= $append;
    }
    if ($assign) {
        $view->assign($assign, $result);
    } else {
        return DataUtil::formatForDisplay($result);
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:91,代码来源:function.modurl.php

示例2: smarty_function_selectmodobject

/**
 * render plugin for fetching a particular module object
 *
 * Examples
 *   {selectmodobject module="AutoCustomer" objecttype="customer" id=4 assign="myCustomer"}
 *   {selectmodobject module="AutoCocktails" objecttype="recipe" id=12 assign="myRecipe"}
 *   {selectmodobject recordClass="AutoCocktails_Model_Recipe" id=12 assign="myRecipe"}
 *
 * Parameters:
 *  module      Name of the module storing the desired object (in DBObject mode)
 *  objecttype  Name of object type (in DBObject mode)
 *  recordClass Class name of an doctrine record. (in Doctrine mode)
 *  id          Identifier of desired object
 *  prefix      Optional prefix for class names (defaults to PN) (in DBObject mode)
 *  assign      Name of the returned object
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return void
 */
function smarty_function_selectmodobject($params, Zikula_View $view)
{
    if (isset($params['recordClass']) && !empty($params['recordClass'])) {
        $doctrineMode = true;
    } else {
        // DBObject checks
        if (!isset($params['module']) || empty($params['module'])) {
            $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobject', 'module')));
        }
        if (!isset($params['objecttype']) || empty($params['objecttype'])) {
            $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobject', 'objecttype')));
        }
        if (!isset($params['prefix'])) {
            $params['prefix'] = 'PN';
        }
        $doctrineMode = false;
    }
    if (!isset($params['id']) || empty($params['id']) || !is_numeric($params['id'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobject', 'id')));
    }
    if (!isset($params['assign']) || empty($params['assign'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobject', 'assign')));
    }
    // load object depending on mode: doctrine or dbobject
    if (!$doctrineMode) {
        if (!ModUtil::available($params['module'])) {
            $view->trigger_error(__f('Invalid %1$s passed to %2$s.', array('module', 'selectmodobject')));
        }
        ModUtil::dbInfoLoad($params['module']);
        $classname = "{$params['module']}_DBObject_" . StringUtil::camelize($params['objecttype']);
        if (!class_exists($classname) && System::isLegacyMode()) {
            // BC check for PNObject old style.
            // load the object class corresponding to $params['objecttype']
            if (!($class = Loader::loadClassFromModule($params['module'], $params['objecttype'], false, false, $params['prefix']))) {
                z_exit(__f('Unable to load class [%s] for module [%s]', array(DataUtil::formatForDisplay($params['objecttype']), DataUtil::formatForDisplay($params['module']))));
            }
        }
        // intantiate object model
        $object = new $class();
        $idField = $object->getIDField();
        // assign object data
        // this performs a new database select operation
        // while the result will be saved within the object, we assign it to a local variable for convenience
        $objectData = $object->get(intval($params['id']), $idField);
        if (!is_array($objectData) || !isset($objectData[$idField]) || !is_numeric($objectData[$idField])) {
            $view->trigger_error(__('Sorry! No such item found.'));
        }
    } else {
        $objectData = Doctrine_Core::getTable($params['recordClass'])->find($params['id']);
        if ($objectData === false) {
            $view->trigger_error(__('Sorry! No such item found.'));
        }
    }
    $view->assign($params['assign'], $objectData);
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:76,代码来源:function.selectmodobject.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param mixed $payload Application data.
  * @param mixed $message Response status/error message, may be string or array.
  * @param array $options Options.
  */
 public function __construct($payload, $message = null, array $options = array())
 {
     $this->payload = $payload;
     $this->messages = (array) $message;
     $this->options = $options;
     if ($this->newCsrfToken) {
         if (System::isLegacyMode()) {
             $this->authid = SecurityUtil::generateAuthKey(ModUtil::getName());
         }
         $this->csrfToken = SecurityUtil::generateCsrfToken();
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:19,代码来源:Ajax.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param mixed $payload Application data.
  * @param mixed $message Response status/error message, may be string or array.
  * @param array $options Options.
  */
 public function __construct($payload, $message = null, array $options = array())
 {
     $this->payload = $payload;
     $this->messages = (array) $message;
     $this->options = $options;
     if ($this->newCsrfToken) {
         $this->csrfToken = \SecurityUtil::generateCsrfToken();
     }
     if (\System::isLegacyMode()) {
         $this->authid = \SecurityUtil::generateAuthKey(\ModUtil::getName());
     }
     parent::__construct('', $this->statusCode);
 }
开发者ID:Silwereth,项目名称:core,代码行数:20,代码来源:AjaxResponse.php

示例5: smarty_block_pageaddvarblock

/**
 * Zikula_View function to add the contents of a block to either the header or footer multicontent page variable
 *
 * This function adds the content of the block to either the end of the <head> portion of the page (using 'header') or to
 * a position just prior to the closing </body> tag (using 'footer').
 *
 * Available parameters:
 *   - name:     The name of the page variable to set, either 'header' or 'footer'; optional, default is 'header'
 *
 * Examples:
 *
 *  This inline stylesheet will appear in the page's <head> section just before the closing </head>:
 * <code>
 *   {pageaddvarblock name='header'}
 *   <style type="text/css">
 *       p { font-size: 1.5em; }
 *   </style>
 *   {/pageaddvarblock}
 * </code>
 *
 *  This inline script will appear in the page's <body> section just before the closing </body>:
 * <code>
 *   {pageaddvarblock name='footer'}
 *   <script language="javascript" type="text/javascript">
 *       alert ('The closing </body> tag is coming.');
 *   </style>
 *   {/pageaddvarblock}
 * </code>
 *
 * @param array       $params  All attributes passed to this function from the template.
 * @param string      $content The content of the block.
 * @param Zikula_View $view    Reference to the Zikula_View object.
 *
 * @return string
 */
function smarty_block_pageaddvarblock($params, $content, Zikula_View $view)
{
    if ($content) {
        $varname = isset($params['name']) ? $params['name'] : 'header';
        if (System::isLegacyMode() && $varname == 'rawtext') {
            LogUtil::log(__f('Warning! The page variable %1$s is deprecated. Please use %2$s instead.', array('rawtext', 'header')), E_USER_DEPRECATED);
            $varname = 'header';
        }
        if ($varname != 'header' && $varname != 'footer') {
            throw new Zikula_Exception_Fatal(__f('Invalid page variable name: \'%1$s\'.', array($varname)));
        }
        PageUtil::addVar($varname, $content);
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:49,代码来源:block.pageaddvarblock.php

示例6: setDefaultPageAssets

 /**
  * Add all default assets to every page (scripts and stylesheets)
  * @param GetResponseEvent $event
  */
 public function setDefaultPageAssets(GetResponseEvent $event)
 {
     if (!$event->isMasterRequest()) {
         return;
     }
     $basePath = $event->getRequest()->getBasePath();
     // add default javascripts to jsAssetBag
     $this->addJquery($basePath);
     $this->jsAssetBag->add([$basePath . '/' . $this->params['zikula.javascript.bootstrap.min.path'] => AssetBag::WEIGHT_BOOTSTRAP_JS, $basePath . '/javascript/helpers/bootstrap-zikula.js' => AssetBag::WEIGHT_BOOTSTRAP_ZIKULA, $basePath . '/web/html5shiv/dist/html5shiv.js' => AssetBag::WEIGHT_HTML5SHIV]);
     $this->addFosJsRouting($basePath);
     // add default stylesheets to cssAssetBag
     $this->addBootstrapCss($basePath);
     $this->cssAssetBag->add([$basePath . '/style/core.css' => 1]);
     // Add legacy stylesheet
     if (\System::isLegacyMode('1.4.0')) {
         $this->cssAssetBag->add([$basePath . '/style/legacy.css' => 2]);
     }
 }
开发者ID:Silwereth,项目名称:core,代码行数:22,代码来源:DefaultPageAssetSetterListener.php

示例7: getUsers

 /**
  * Return a hash structure mapping uid to username.
  *
  * @param array   $where        Array of field values to filter by (optional, default=array()).
  * @param array   $orderBy      Array fields to sort by (optional, default=array()).
  * @param integer $limitOffset  The select-limit offset (optional, default=null).
  * @param integer $limitNumRows The number of rows to fetch (optional, default=null).
  * @param string  $assocKey     The associative key to apply (optional) (default='uid').
  *
  * @deprecated since 1.3.0
  *
  * @return array An array mapping uid to username.
  */
 public static function getUsers($where = array(), $orderBy = array(), $limitOffset = null, $limitNumRows = null, $assocKey = 'uid')
 {
     // first check for string based parameters and use dbutil if found
     if (System::isLegacyMode() && (is_string($where) || is_string($orderBy))) {
         if ($where == array()) {
             $where = '';
         }
         if ($orderBy == array()) {
             $orderBy = '';
         }
         return DBUtil::selectObjectArray('users', $where, $orderBy, $limitOffset, $limitNumRows, $assocKey);
     }
     // we've now ruled out BC parameters
     $em = \ServiceUtil::get('doctrine.entitymanager');
     $users = $em->getRepository('ZikulaUsersModule:UserEntity')->findBy($where, $orderBy, $limitNumRows, $limitOffset);
     $items = array();
     foreach ($users as $user) {
         $items[$user[$assocKey]] = $user->toArray();
     }
     return $items;
 }
开发者ID:rmaiwald,项目名称:core,代码行数:34,代码来源:UserUtil.php

示例8: __construct

 * SimplePieFeed class.
 */
class SimplePieFeed extends SimplePie
{
    /**
     * Class constructor.
     *
     * @param string  $feed_url       The URL to the feed (optional).
     * @param integer $cache_duration The duration (in seconds) that the feed contents will be retained in cache.
     */
    public function __construct($feed_url = null, $cache_duration = null, $cache_dir = null)
    {
        parent::__construct();
        if (isset($cache_dir)) {
            $this->set_cache_location($cache_dir);
        } else {
            $this->set_cache_location(CacheUtil::getLocalDir('feeds'));
        }
        if (isset($cache_duration)) {
            $this->set_cache_duration($cache_duration);
        }
        if (isset($feed_url)) {
            $this->set_feed_url($feed_url);
        }
    }
}
if (System::isLegacyMode()) {
    class ZFeeds extends SimplePieFeed
    {
    }
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:31,代码来源:SimplePieFeed.php

示例9: handleLegacy

 /**
  * Internal procedure for managing legacy script paths.
  *
  * @param string $script Script path to check.
  *
  * @return string Verified script path
  */
 private static function handleLegacy($script)
 {
     // Handle legacy references to non-minimised scripts.
     if (strpos($script, 'javascript/livepipe/') === 0) {
         $script = 'livepipe';
     } elseif (strpos($script, 'javascript/ajax/') === 0) {
         switch ($script) {
             case 'javascript/ajax/validation.js':
                 $script = 'validation';
                 break;
             case 'javascript/ajax/unittest.js':
                 $script = 'javascript/ajax/unittest.min.js';
                 break;
             case 'javascript/ajax/prototype.js':
             case 'javascript/ajax/builder.js':
             case 'javascript/ajax/controls.js':
             case 'javascript/ajax/dragdrop.js':
             case 'javascript/ajax/effects.js':
             case 'javascript/ajax/slider.js':
             case 'javascript/ajax/sound.js':
                 $script = 'prototype';
                 break;
         }
         if (strpos($script, 'javascript/ajax/scriptaculous') === 0) {
             $script = 'prototype';
         }
     } elseif (System::isLegacyMode() && (strpos($script, 'system/') === 0 || strpos($script, 'modules/') === 0)) {
         // check for customized javascripts
         $custom = str_replace(array('javascript/', 'pnjavascript/'), '', $script);
         $custom = str_replace(array('modules', 'system'), 'config/javascript', $custom);
         if (file_exists($custom)) {
             $script = $custom;
         }
     }
     return $script;
 }
开发者ID:Silwereth,项目名称:core,代码行数:43,代码来源:JCSSUtil.php

示例10: _plugin_dirs

 /**
  * Define all our plugin directories.
  *
  * @return void
  */
 private function _plugin_dirs()
 {
     // add theme specific plugins directories, if they exist
     if (is_dir('themes/' . $this->directory . '/Resources/views/plugins')) {
         $this->addPluginDir('themes/' . $this->directory . '/Resources/views/plugins');
         return;
     }
     if (is_dir('themes/' . $this->directory . '/plugins')) {
         $this->addPluginDir('themes/' . $this->directory . '/plugins');
     }
     if (System::isLegacyMode()) {
         // load the usemodules configuration if exists
         $usemod_conf = 'themes/' . $this->directory . '/templates/config/usemodules.txt';
         // load the config file
         if (is_readable($usemod_conf) && is_file($usemod_conf)) {
             $additionalmodules = file($usemod_conf);
             if (is_array($additionalmodules)) {
                 foreach ($additionalmodules as $addmod) {
                     $this->_add_plugins_dir(trim($addmod));
                 }
             }
         }
     }
 }
开发者ID:rmaiwald,项目名称:core,代码行数:29,代码来源:Theme.php

示例11: add_core_data

 /**
  * Add core data to the template.
  *
  * This function adds some basic data to the template depending on the
  * current user and the Zikula settings.  There is no need to call this as it's
  * invoked automatically on instanciation.
  *
  * In legacy mode 'coredata' will contain the module vars, but not when disabled.
  * This is just for BC legacy - to access module vars there is a 'modvars' property
  * assigned to all templates.
  *
  * @return Zikula_View
  */
 public function add_core_data()
 {
     if (!isset($this->serviceManager['zikula_view.coredata'])) {
         $this->serviceManager['zikula_view.coredata'] = new ArrayObject(array());
     }
     $core = $this->serviceManager['zikula_view.coredata'];
     $core['version_num'] = Zikula_Core::VERSION_NUM;
     $core['version_id'] = Zikula_Core::VERSION_ID;
     $core['version_sub'] = Zikula_Core::VERSION_SUB;
     $core['logged_in'] = UserUtil::isLoggedIn();
     $core['language'] = $this->language;
     // add userdata
     $core['user'] = UserUtil::getVars(SessionUtil::getVar('uid'));
     if (System::isLegacyMode()) {
         // add modvars of current modules
         foreach ($this->module as $module => $dummy) {
             if (!empty($module)) {
                 $core[$module] = ModUtil::getVar($module);
             }
         }
         // add mod vars of all modules supplied as parameter
         $modulenames = func_get_args();
         foreach ($modulenames as $modulename) {
             // if the modulename is empty do nothing
             if (!empty($modulename) && !is_array($modulename) && !array_key_exists($modulename, $this->module)) {
                 // check if user wants to have config
                 if ($modulename == ModUtil::CONFIG_MODULE) {
                     $ZConfig = ModUtil::getVar(ModUtil::CONFIG_MODULE);
                     foreach ($ZConfig as $key => $value) {
                         // gather all config vars
                         $core['ZConfig'][$key] = $value;
                     }
                 } else {
                     $core[$modulename] = ModUtil::getVar($modulename);
                 }
             }
         }
         $this->assign('pncore', $core);
     }
     // Module vars
     parent::assign('coredata', $core);
     return $this;
 }
开发者ID:Silwereth,项目名称:core,代码行数:56,代码来源:View.php

示例12: systemHooks

 /**
  * Call system hooks.
  *
  * Implements 'core.postinit' event.
  *
  * This is just here for legacy systeminit hooks.
  *
  * @param Zikula_Event $event The event handler.
  *
  * @return void
  */
 public function systemHooks(Zikula_Event $event)
 {
     if (!System::isInstalling() && System::isLegacyMode()) {
         // call system init hooks
         $systeminithooks = FormUtil::getPassedValue('systeminithooks', 'yes', 'GETPOST');
         if (SecurityUtil::checkPermission('::', '::', ACCESS_ADMIN) && (isset($systeminithooks) && $systeminithooks == 'no')) {
             // omit system hooks if requested by an administrator
         } else {
             ModUtil::callHooks('zikula', 'systeminit', 0, array('module' => 'zikula'));
         }
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:23,代码来源:SystemListeners.php

示例13: loadPlugin

 /**
  * Loads a single plugin.
  *
  * @param string $name   Plugin's name.
  * @param array  $config Plugin's config.
  *
  * @return integer The plugin's id.
  */
 public function loadPlugin($name, $config = array())
 {
     if ($this->isLoaded($name)) {
         return $this->_loaded[$name];
     }
     $plugins = $this->getPluginsAvailable();
     if (isset($plugins[$name]) && !empty($plugins[$name]) && class_exists($plugins[$name])) {
         $class = $plugins[$name];
         $this->addCommon($config);
         $obj = new $class($config);
         $this->_plg[] = $obj;
         end($this->_plg);
         $key = key($this->_plg);
         $obj = $this->_plg[$key];
         $obj->setID($key);
         $this->_registerPlugin($key);
         $this->_loaded[$name] = $key;
         return key(end($this->_plg));
     } elseif (System::isLegacyMode()) {
         return $this->loadPluginLegacy();
     }
     return false;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:31,代码来源:PluginManager.php

示例14: smarty_function_selectmodobjectarray

/**
 * render plugin for fetching a list of module objects
 *
 * Examples
 *   {selectmodobjectarray module="AutoCustomer" objecttype="customer" assign="myCustomers"}
 *   {selectmodobjectarray module="AutoCocktails" objecttype="recipe" orderby="name desc" assign="myRecipes"}
 *   {selectmodobjectarray recordClass="AutoCocktails_Model_Recipe" orderby="name desc" assign="myRecipes"}
 *
 * Parameters:
 *  module      Name of the module storing the desired object (in DBObject mode)
 *  objecttype  Name of object type (in DBObject mode)
 *  recordClass Class name of an doctrine record. (in Doctrine mode)
 *  useArrays   true to fetch arrays and false to fetch objects (default is true) (in Doctrine mode)
 *  where       Filter value
 *  orderby     Sorting field and direction
 *  pos         Start offset
 *  num         Amount of selected objects
 *  prefix      Optional prefix for class names (defaults to PN) (in DBObject mode)
 *  assign      Name of the returned object
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return void
 */
function smarty_function_selectmodobjectarray($params, Zikula_View $view)
{
    if (isset($params['recordClass']) && !empty($params['recordClass'])) {
        $doctrineMode = true;
    } else {
        // DBObject checks
        if (!isset($params['module']) || empty($params['module'])) {
            $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobjectarray', 'module')));
        }
        if (!isset($params['objecttype']) || empty($params['objecttype'])) {
            $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobjectarray', 'objecttype')));
        }
        if (!isset($params['prefix'])) {
            $params['prefix'] = 'PN';
        }
        $doctrineMode = false;
    }
    if (!isset($params['assign'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobjectarray', 'assign')));
    }
    // load object depending on mode: doctrine or dbobject
    if (!$doctrineMode) {
        if (!ModUtil::available($params['module'])) {
            $view->trigger_error(__f('Invalid %1$s passed to %2$s.', array('module', 'selectmodobjectarray')));
        }
        ModUtil::dbInfoLoad($params['module']);
        $classname = "{$params['module']}_DBObject_" . StringUtil::camelize($params['objecttype']) . 'Array';
        if (!class_exists($classname) && System::isLegacyMode()) {
            // BC check for PNObjectArray old style.
            // load the object class corresponding to $params['objecttype']
            if (!($class = Loader::loadArrayClassFromModule($params['module'], $params['objecttype'], false, $params['prefix']))) {
                z_exit(__f('Error! Cannot load module array class %1$s for module %2$s.', array(DataUtil::formatForDisplay($params['module']), DataUtil::formatForDisplay($params['objecttype']))));
            }
        }
        // instantiate the object-array
        $objectArray = new $class();
        // convenience vars to make code clearer
        $where = $sort = '';
        if (isset($params['where']) && !empty($params['where'])) {
            $where = $params['where'];
        }
        // TODO: add FilterUtil support here in 2.0
        if (isset($params['orderby']) && !empty($params['orderby'])) {
            $sort = $params['orderby'];
        }
        $pos = 1;
        if (isset($params['pos']) && !empty($params['pos']) && is_numeric($params['pos'])) {
            $pos = $params['pos'];
        }
        $num = 10;
        if (isset($params['num']) && !empty($params['num']) && is_numeric($params['num'])) {
            $num = $params['num'];
        }
        // get() returns the cached object fetched from the DB during object instantiation
        // get() with parameters always performs a new select
        // while the result will be saved in the object, we assign in to a local variable for convenience.
        $objectData = $objectArray->get($where, $sort, $pos - 1, $num);
    } else {
        $query = Doctrine_Core::getTable($params['recordClass'])->createQuery();
        if (isset($params['where']) && !empty($params['where'])) {
            if (is_array($params['where'])) {
                $query->where($params['where'][0], $params['where'][1]);
            } else {
                $query->where($params['where']);
            }
        }
        if (isset($params['orderby']) && !empty($params['orderby'])) {
            $query->orderBy($params['orderby']);
        }
        $pos = 0;
        if (isset($params['pos']) && !empty($params['pos']) && is_numeric($params['pos'])) {
            $pos = $params['pos'];
        }
        $num = 10;
        if (isset($params['num']) && !empty($params['num']) && is_numeric($params['num'])) {
//.........这里部分代码省略.........
开发者ID:planetenkiller,项目名称:core,代码行数:101,代码来源:function.selectmodobjectarray.php

示例15: addVar

 /**
  * Add var.
  *
  * Adds a new vaule to a page variable. In the case of a single
  * page variable, this functions acts exactly like PageUtil::setVar.
  *
  * @param string $varname  The name of the page variable.
  * @param mixed  $value    The new value.
  * @param string $features The feature(s) to load via polyfill.
  *
  * @see    PageUtil::setVar
  * @return boolean true On success, false of the page variable is not registered.
  */
 public static function addVar($varname, $value, $features = 'forms')
 {
     global $_pageVars;
     if (System::isLegacyMode()) {
         switch ($varname) {
             case 'rawtext':
                 LogUtil::log(__f('Warning! The page variable %1$s is deprecated. Please use %2$s instead.', array('rawtext', 'header')), E_USER_DEPRECATED);
                 $varname = 'header';
                 break;
         }
     }
     // check for $_pageVars sanity
     if (!isset($_pageVars)) {
         $_pageVars = array();
     } elseif (!is_array($_pageVars)) {
         return false;
     }
     if (!isset($_pageVars[$varname])) {
         return false;
     }
     if (is_array($value)) {
         $value = array_unique($value);
     }
     $value = self::resolveSymfonyAsset($value);
     // @todo Remove in 1.5.0.
     $value = self::fixJQueryThemesPath($value);
     $event = new \Zikula\Core\Event\GenericEvent($varname, array(), $value);
     $value = EventUtil::getManager()->dispatch('pageutil.addvar_filter', $event)->getData();
     if ($_pageVars[$varname]['multivalue']) {
         if (is_array($value)) {
             if (in_array('polyfill', $value)) {
                 $features = explode(' ', $features);
                 foreach ($features as $feature) {
                     PageUtil::addVar('polyfill_features', $feature);
                 }
                 $_pageVars[$varname]['contents'] = array_merge($_pageVars[$varname]['contents'], $value);
             } else {
                 $_pageVars[$varname]['contents'] = array_merge($_pageVars[$varname]['contents'], $value);
             }
         } else {
             $_pageVars[$varname]['contents'][] = $value;
         }
         // make values unique
         $_pageVars[$varname]['contents'] = array_unique($_pageVars[$varname]['contents']);
     } else {
         $_pageVars[$varname]['contents'] = $value;
     }
     return true;
 }
开发者ID:rmaiwald,项目名称:core,代码行数:62,代码来源:PageUtil.php


注:本文中的System::isLegacyMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。