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


PHP Jaws_Gadget::IsGadgetEnabled方法代码示例

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


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

示例1: 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

示例2: jaws

$IsIndex = false;
$objAction = null;
$IsReqActionStandAlone = false;
// Only registered user can access not global website
$AccessToWebsiteDenied = !$GLOBALS['app']->Session->Logged() && $GLOBALS['app']->Registry->fetch('global_website', 'Settings') == 'false';
// Get forwarded error from webserver
$ReqError = jaws()->request->fetch('http_error', 'get');
if (empty($ReqError) && $GLOBALS['app']->Map->Parse()) {
    $ReqGadget = Jaws_Gadget::filter(jaws()->request->fetch('gadget'));
    $ReqAction = Jaws_Gadget_Action::filter(jaws()->request->fetch('action'));
    if (empty($ReqGadget)) {
        $IsIndex = true;
        $ReqGadget = $GLOBALS['app']->Registry->fetchByUser($GLOBALS['app']->Session->GetAttribute('layout'), 'main_gadget', 'Settings');
    }
    if (!empty($ReqGadget)) {
        if (Jaws_Gadget::IsGadgetEnabled($ReqGadget)) {
            $objAction = Jaws_Gadget::getInstance($ReqGadget)->action->load();
            if (Jaws_Error::IsError($objAction)) {
                Jaws_Error::Fatal("Error loading gadget: {$ReqGadget}");
            }
            if (!$GLOBALS['app']->Session->GetPermission($ReqGadget, 'default')) {
                $ReqError = '403';
            }
            // check referrer host for internal action
            if ($objAction->getAttribute($ReqAction, 'internal') && !$GLOBALS['app']->Session->extraCheck()) {
                $ReqError = '403';
            }
            // set requested gadget
            $GLOBALS['app']->mainGadget = $ReqGadget;
        } else {
            $ReqError = '404';
开发者ID:Dulciane,项目名称:jaws,代码行数:31,代码来源:index.php

示例3: RunAutoload

 /**
  * Executes the autoload gadgets
  *
  * @access  public
  * @return  void
  */
 function RunAutoload()
 {
     $data = $GLOBALS['app']->Registry->fetch('gadgets_autoload_items');
     $gadgets = array_filter(explode(',', $data));
     foreach ($gadgets as $gadget) {
         if (Jaws_Gadget::IsGadgetEnabled($gadget)) {
             $objGadget = Jaws_Gadget::getInstance($gadget);
             if (Jaws_Error::IsError($objGadget)) {
                 continue;
             }
             $objHook = $objGadget->hook->load('Autoload');
             if (Jaws_Error::IsError($objHook)) {
                 continue;
             }
             $result = $objHook->Execute();
             if (Jaws_Error::IsError($result)) {
                 //do nothing;
             }
         }
     }
 }
开发者ID:juniortux,项目名称:jaws,代码行数:27,代码来源:Jaws.php

示例4: Layout


//.........这里部分代码省略.........
     $t_item->SetVariable('empty_section', _t('LAYOUT_SECTION_EMPTY'));
     $t_item->SetVariable('display_always', _t('LAYOUT_ALWAYS'));
     $t_item->SetVariable('display_never', _t('LAYOUT_NEVER'));
     $t_item->SetVariable('displayWhenTitle', _t('LAYOUT_CHANGE_DW'));
     $t_item->SetVariable('actionsTitle', _t('LAYOUT_ACTIONS'));
     $t_item->SetVariable('confirmDelete', _t('LAYOUT_CONFIRM_DELETE'));
     $dragdrop = $t_item->ParseBlock('drag_drop');
     $t_item->Blocks['drag_drop']->Parsed = '';
     // Init layout
     $GLOBALS['app']->InstanceLayout();
     $fakeLayout = new Jaws_Layout();
     $fakeLayout->Load('', $index_layout ? 'index.html' : 'layout.html');
     $fakeLayout->AddScriptLink('libraries/mootools/core.js');
     $fakeLayout->AddScriptLink('libraries/mootools/more.js');
     $fakeLayout->AddScriptLink('include/Jaws/Resources/Ajax.js');
     $fakeLayout->AddScriptLink('gadgets/Layout/Resources/script.js');
     $layoutContent = $fakeLayout->_Template->Blocks['layout']->Content;
     $layoutContent = preg_replace('$<body([^>]*)>$i', '<body\\1>' . $working_box . $msg_box . $this->LayoutBar($theme, $theme_locality, $user, $index_layout), $layoutContent);
     $layoutContent = preg_replace('$</body([^>]*)>$i', $dragdrop . '</body\\1>', $layoutContent);
     $fakeLayout->_Template->Blocks['layout']->Content = $layoutContent;
     $fakeLayout->_Template->SetVariable('site-title', $this->gadget->registry->fetch('site_name', 'Settings'));
     $fakeLayout->AddHeadLink(PIWI_URL . 'piwidata/css/default.css', 'stylesheet', 'text/css', 'default');
     $fakeLayout->AddHeadLink('gadgets/Layout/Resources/style.css', 'stylesheet', 'text/css');
     foreach ($fakeLayout->_Template->Blocks['layout']->InnerBlock as $name => $data) {
         if ($name == 'head') {
             continue;
         }
         $fakeLayout->_Template->SetBlock('layout/' . $name);
         $js_section_array = '<script type="text/javascript">items[\'' . $name . '\'] = new Array(); sections.push(\'' . $name . '\');</script>';
         $gadgets = $lModel->GetGadgetsInSection($index_layout, $name, $user);
         if (!is_array($gadgets)) {
             continue;
         }
         foreach ($gadgets as $gadget) {
             if ($gadget['gadget'] == '[REQUESTEDGADGET]') {
                 $t_item->SetBlock('item');
                 $t_item->SetVariable('section_id', $name);
                 $t_item->SetVariable('item_id', $gadget['id']);
                 $t_item->SetVariable('user', $user);
                 $t_item->SetVariable('pos', $gadget['layout_position']);
                 $t_item->SetVariable('gadget', _t('LAYOUT_REQUESTED_GADGET'));
                 $t_item->SetVariable('action', '&nbsp;');
                 $t_item->SetVariable('icon', 'gadgets/Layout/Resources/images/requested-gadget.png');
                 $t_item->SetVariable('description', _t('LAYOUT_REQUESTED_GADGET_DESC'));
                 $t_item->SetVariable('lbl_display_when', _t('LAYOUT_DISPLAY_IN'));
                 $t_item->SetVariable('display_when', _t('GLOBAL_ALWAYS'));
                 $t_item->SetVariable('void_link', 'return;');
                 $t_item->SetVariable('section_name', $name);
                 $t_item->SetVariable('delete', 'void(0);');
                 $t_item->SetVariable('delete-img', 'gadgets/Layout/Resources/images/no-delete.gif');
                 $t_item->SetVariable('lbl_delete', _t('GLOBAL_DELETE'));
                 $t_item->SetVariable('item_status', 'none');
                 $t_item->ParseBlock('item');
             } else {
                 $controls = '';
                 $t_item->SetBlock('item');
                 $t_item->SetVariable('section_id', $name);
                 $t_item->SetVariable('pos', $gadget['layout_position']);
                 $t_item->SetVariable('item_id', $gadget['id']);
                 $t_item->SetVariable('base_script_url', $GLOBALS['app']->getSiteURL('/' . BASE_SCRIPT));
                 $t_item->SetVariable('icon', Jaws::CheckImage('gadgets/' . $gadget['gadget'] . '/Resources/images/logo.png'));
                 $t_item->SetVariable('delete', "deleteElement('{$gadget['id']}');");
                 $t_item->SetVariable('delete-img', 'gadgets/Layout/Resources/images/delete-item.gif');
                 $t_item->SetVariable('lbl_delete', _t('GLOBAL_DELETE'));
                 $actions = $eModel->GetGadgetLayoutActions($gadget['gadget'], true);
                 if (isset($actions[$gadget['gadget_action']]) && Jaws_Gadget::IsGadgetEnabled($gadget['gadget'])) {
                     $t_item->SetVariable('gadget', _t(strtoupper($gadget['gadget']) . '_TITLE'));
                     if (isset($actions[$gadget['gadget_action']]['name'])) {
                         $t_item->SetVariable('action', $actions[$gadget['gadget_action']]['name']);
                     } else {
                         $t_item->SetVariable('action', $gadget['gadget_action']);
                     }
                     $t_item->SetVariable('description', $actions[$gadget['gadget_action']]['desc']);
                     $t_item->SetVariable('item_status', 'none');
                 } else {
                     $t_item->SetVariable('gadget', $gadget['gadget']);
                     $t_item->SetVariable('action', $gadget['gadget_action']);
                     $t_item->SetVariable('description', $gadget['gadget_action']);
                     $t_item->SetVariable('item_status', 'line-through');
                 }
                 unset($actions);
                 $t_item->SetVariable('controls', $controls);
                 $t_item->SetVariable('void_link', '');
                 $t_item->SetVariable('lbl_display_when', _t('LAYOUT_DISPLAY_IN'));
                 if ($gadget['display_when'] == '*') {
                     $t_item->SetVariable('display_when', _t('GLOBAL_ALWAYS'));
                 } elseif (empty($gadget['display_when'])) {
                     $t_item->SetVariable('display_when', _t('LAYOUT_NEVER'));
                 } else {
                     $t_item->SetVariable('display_when', str_replace(',', ', ', $gadget['display_when']));
                 }
                 $t_item->ParseBlock('item');
             }
         }
         $fakeLayout->_Template->SetVariable('ELEMENT', '<div id="layout_' . $name . '" class="layout-section" title="' . $name . '">' . $js_section_array . $t_item->Get() . '</div>');
         $fakeLayout->_Template->ParseBlock('layout/' . $name);
         $t_item->Blocks['item']->Parsed = '';
     }
     return $fakeLayout->Get(true);
 }
开发者ID:juniortux,项目名称:jaws,代码行数:101,代码来源:Layout.php

示例5: DisableGadget

 /**
  * Disable a gadget
  *
  * @access  public
  * @return  mixed    True if success or Jaws_Error on error
  */
 public function DisableGadget()
 {
     if (!Jaws_Gadget::IsGadgetInstalled($this->gadget->name)) {
         return Jaws_Error::raiseError("gadget [{$this->gadget->name}] not installed", __FUNCTION__);
     }
     if ($this->gadget->_IsCore) {
         return Jaws_Error::raiseError("you can't disable core gadgets", __FUNCTION__);
     }
     // check depend on gadgets status
     $gModel = $this->gadget->model->load();
     $dependent_gadgets = $gModel->requirementfor();
     if (Jaws_Error::IsError($dependent_gadgets)) {
         return $dependent_gadgets;
     }
     foreach ($dependent_gadgets as $idx => $gadget) {
         if (!Jaws_Gadget::IsGadgetEnabled($gadget)) {
             $dependent_gadgets[$idx] = null;
         }
     }
     $dependent_gadgets = implode(', ', array_filter($dependent_gadgets));
     if (!empty($dependent_gadgets)) {
         return Jaws_Error::raiseError("you can't disable this gadget, because {$dependent_gadgets} gadget(s) is dependent on it", __FUNCTION__);
     }
     // adding gadget to disabled gadgets list
     $disabled_gadgets = $GLOBALS['app']->Registry->fetch('gadgets_disabled_items');
     $disabled_gadgets .= $this->gadget->name . ',';
     $GLOBALS['app']->Registry->update('gadgets_disabled_items', $disabled_gadgets);
     // end disable gadget event
     $res = $this->gadget->event->shout('DisableGadget', $this->gadget->name);
     if (Jaws_Error::IsError($res)) {
         return $res;
     }
     return true;
 }
开发者ID:juniortux,项目名称:jaws,代码行数:40,代码来源:Installer.php


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