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


PHP Jaws_Gadget::IsGadgetUpdated方法代码示例

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


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

示例1: GetGadgetsList

 /**
  * Fetches list of gadgets, installed/not installed, core/none core, has layout/has not, ...
  *
  * @access  public
  * @param   bool    $core_gadget accepts true/false/null
  * @param   bool    $installed   accepts true/false/null
  * @param   bool    $updated     accepts true/false/null
  * @param   bool    $has_html    accepts true/false/null
  * @return  array   List of gadgets
  */
 function GetGadgetsList($core_gadget = null, $installed = null, $updated = null, $has_html = null)
 {
     //TODO: implementing cache for this method
     static $gadgetsList;
     if (!isset($gadgetsList)) {
         $gadgetsList = array();
         $gDir = JAWS_PATH . 'gadgets' . DIRECTORY_SEPARATOR;
         if (!is_dir($gDir)) {
             Jaws_Error::Fatal('The gadgets directory does not exists!', __FILE__, __LINE__);
         }
         $installed_gadgets = $GLOBALS['app']->Registry->fetch('gadgets_installed_items');
         $installed_gadgets = array_filter(explode(',', $installed_gadgets));
         $disabled_gadgets = $GLOBALS['app']->Registry->fetch('gadgets_disabled_items');
         $gadgets = scandir($gDir);
         foreach ($gadgets as $gadget) {
             if ($gadget[0] == '.' || !is_dir($gDir . $gadget)) {
                 continue;
             }
             if (!$this->gadget->GetPermission(JAWS_SCRIPT == 'index' ? 'default' : 'default_admin', '', false, $gadget)) {
                 continue;
             }
             $objGadget = Jaws_Gadget::getInstance($gadget);
             if (Jaws_Error::IsError($objGadget)) {
                 continue;
             }
             $gInstalled = Jaws_Gadget::IsGadgetInstalled($gadget);
             if ($gInstalled) {
                 $gUpdated = Jaws_Gadget::IsGadgetUpdated($gadget);
             } else {
                 $gUpdated = true;
             }
             $index = urlencode($objGadget->title) . $gadget;
             $section = strtolower($objGadget->GetSection());
             switch ($section) {
                 case 'general':
                     $order = str_pad(array_search($gadget, $installed_gadgets), 2, '0', STR_PAD_LEFT);
                     $index = '0' . $section . $order . $index;
                     break;
                 case 'gadgets':
                     $index = '2' . $section . $index;
                     break;
                 default:
                     $index = '1' . $section . $index;
                     break;
             }
             $gadgetsList[$index] = array('section' => $section, 'name' => $gadget, 'title' => $objGadget->title, 'core_gadget' => $objGadget->_IsCore, 'description' => $objGadget->description, 'version' => $objGadget->version, 'installed' => (bool) $gInstalled, 'updated' => (bool) $gUpdated, 'disabled' => strpos($disabled_gadgets, ",{$gadget},") !== false, 'has_html' => $objGadget->default_action ? true : false);
         }
         ksort($gadgetsList);
     }
     $resList = array();
     foreach ($gadgetsList as $gadget) {
         if ((is_null($core_gadget) || $gadget['core_gadget'] == $core_gadget) && (is_null($installed) || $gadget['installed'] == $installed) && (is_null($updated) || $gadget['updated'] == $updated) && (is_null($has_html) || $gadget['has_html'] == $has_html)) {
             $resList[$gadget['name']] = $gadget;
         }
     }
     return $resList;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:67,代码来源:Gadgets.php

示例2: UpgradeGadget

 /**
  * Upgrades requested gadget
  *
  * @access  public
  * @param   string  $gadget  Gadget name
  * @return  void
  */
 function UpgradeGadget($gadget = '')
 {
     $redirect = false;
     $this->gadget->CheckPermission('ManageGadgets');
     if (empty($gadget)) {
         $redirect = true;
         $gadget = jaws()->request->fetch('comp', 'get');
     }
     if (!Jaws_Gadget::IsGadgetUpdated($gadget)) {
         $objGadget = Jaws_Gadget::getInstance($gadget);
         $installer = $objGadget->installer->load();
         $return = $installer->UpgradeGadget();
         if (Jaws_Error::IsError($return)) {
             $GLOBALS['app']->Session->PushLastResponse($return->GetMessage(), RESPONSE_ERROR);
         } else {
             $GLOBALS['app']->Session->PushLastResponse(_t('COMPONENTS_GADGETS_UPDATE_OK', $gadget), RESPONSE_NOTICE);
         }
     } else {
         $GLOBALS['app']->Session->PushLastResponse(_t('COMPONENTS_GADGETS_UPDATE_NO_NEED', $gadget), RESPONSE_ERROR);
     }
     if ($redirect) {
         Jaws_Header::Location(BASE_SCRIPT);
     }
 }
开发者ID:juniortux,项目名称:jaws,代码行数:31,代码来源:GadgetInstaller.php

示例3: PutGadget

 /**
  * Put a gadget on the template
  *
  * @access  public
  * @param   string  $gadget  Gadget to put
  * @param   string  $action  Action to execute
  * @param   mixed   $params  Action's params
  */
 function PutGadget($gadget, $action, $params = null, $filename = '')
 {
     $output = '';
     $enabled = Jaws_Gadget::IsGadgetEnabled($gadget);
     if (Jaws_Error::isError($enabled) || $enabled != 'true') {
         $GLOBALS['log']->Log(JAWS_LOG_NOTICE, "Gadget {$gadget} is not enabled");
         return $output;
     }
     if (!Jaws_Gadget::IsGadgetUpdated($gadget)) {
         $GLOBALS['log']->Log(JAWS_LOG_NOTICE, 'Trying to populate ' . $gadget . ' in layout, but looks that it is not installed/upgraded');
         return $output;
     }
     jaws()->http_response_code(200);
     $goGadget = Jaws_Gadget::getInstance($gadget)->action->load($filename);
     if (!Jaws_Error::isError($goGadget)) {
         if (method_exists($goGadget, $action)) {
             $GLOBALS['app']->requestedGadget = $gadget;
             $GLOBALS['app']->requestedAction = $action;
             $GLOBALS['app']->requestedActionMode = ACTION_MODE_LAYOUT;
             if (is_null($params)) {
                 $output = $goGadget->{$action}();
             } else {
                 $output = call_user_func_array(array($goGadget, $action), $params);
             }
         } else {
             $GLOBALS['log']->Log(JAWS_LOG_ERROR, "Action {$action} in {$gadget}'s Actions dosn't exist.");
         }
     }
     if (Jaws_Error::isError($output)) {
         $GLOBALS['log']->Log(JAWS_LOG_ERROR, 'In ' . $gadget . '::' . $action . ',' . $output->GetMessage());
         $output = '';
     } elseif (jaws()->http_response_code() !== 200) {
         $output = '';
     }
     return $output;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:44,代码来源:Layout.php

示例4: GetPublicURList

 /**
  * Get a list of URLs of a gadget
  *
  * @access  public
  * @return  array   URLs array on success or empty array on failure
  */
 function GetPublicURList()
 {
     @(list($request) = jaws()->request->fetchAll('post'));
     if ($request == 'url') {
         $urls[] = array('url' => '', 'title' => _t('MENU_REFERENCES_FREE_LINK'));
         $urls[] = array('url' => 'javascript:void(0);', 'title' => _t('MENU_REFERENCES_NO_LINK'));
         return $urls;
     } else {
         if (Jaws_Gadget::IsGadgetUpdated($request)) {
             $objGadget = Jaws_Gadget::getInstance($request);
             if (!Jaws_Error::IsError($objGadget)) {
                 $objHook = $objGadget->hook->load('Menu');
                 if (!Jaws_Error::IsError($objHook)) {
                     return $objHook->Execute();
                 }
             }
         }
     }
     return array();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:26,代码来源:Ajax.php


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