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


PHP JEVHelper::forceIntegerArray方法代码示例

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


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

示例1: setupComponentCatids

 function setupComponentCatids()
 {
     // if no catids from GET or POST default to the menu values
     // Note that module links must pass a non default value
     $Itemid = JEVHelper::getItemid();
     $this->myItemid = $Itemid;
     $menu =& JSite::getMenu();
     $active = $menu->getActive();
     if (!is_null($active) && $active->component == JEV_COM_COMPONENT) {
         $params =& JComponentHelper::getParams(JEV_COM_COMPONENT);
     } else {
         // If accessing this function from outside the component then I must load suitable parameters
         $params = $menu->getParams($this->myItemid);
     }
     $separator = $params->get("catseparator", "|");
     $catidsIn = JRequest::getVar('catids', 'NONE');
     $this->catids = array();
     if ($catidsIn == "NONE") {
         $this->catidList = "";
         for ($c = 0; $c < 999; $c++) {
             $nextCID = "catid{$c}";
             //  stop looking for more catids when you reach the last one!
             if (!($nextCatId = $params->get($nextCID, null))) {
                 break;
             }
             if (!in_array($nextCatId, $this->catids)) {
                 $this->catids[] = $nextCatId;
                 $this->catidList .= (strlen($this->catidList) > 0 ? ',' : '') . $nextCatId;
             }
         }
         $this->catidsOut = str_replace(',', $separator, $this->catidList);
     } else {
         $this->catids = explode($separator, $catidsIn);
         // hardening!
         $this->catidList = JEVHelper::forceIntegerArray($this->catids, true);
         $this->catidsOut = str_replace(',', $separator, $this->catidList);
     }
     // some functions e.g. JEventCal::viewDetailLink don't have access to a datamodel so set a global value
     // as a backup
     global $catidsOut;
     $catidsOut = $this->catidsOut;
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:42,代码来源:datamodel.php

示例2: array

 $cats = array();
 foreach ($categories as $cid) {
     $cid = intval($cid);
     // Make sure the user is authorised to view this category and the menu item doesn't block it!
     if (!in_array($cid, $accessiblecats) && ($cid = !0)) {
         continue;
     }
     $cats[] = $cid;
 }
 if (count($cats) == 0) {
     $cats[] = 0;
 }
 //$years  = str_replace(",","|",JEVHelper::forceIntegerArray(JRequest::getVar('years','','POST'),true));
 //$cats = implode("|",$cats);
 $jr_years = JRequest::getVar('years', array(0), 'POST');
 $years = JEVHelper::forceIntegerArray($jr_years, true);
 $cats = implode(",", $cats);
 $link = JURI::root() . "index.php?option=com_jevents&task=icals.export&format=ical";
 if (count($cats) > 0) {
     $link .= "&catids=" . $cats;
 }
 $link .= "&years=" . $years;
 if (JRequest::getInt("icalformatted", 0)) {
     $link .= "&icf=1";
 }
 $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
 if ($params->get("constrained", 0)) {
     $link .= "&Itemid=" . JRequest::getInt("Itemid", 1);
 }
 $icalkey = $params->get("icalkey", "secret phrase");
 $publiclink = $link . "&k=" . md5($icalkey . $cats . $years);
开发者ID:madcsaba,项目名称:li-de,代码行数:31,代码来源:ical_form.php

示例3: export

 function export()
 {
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     $years = JRequest::getVar('years', 'NONE');
     $cats = JRequest::getVar('catids', 'NONE');
     // validate the key
     $icalkey = $params->get("icalkey", "secret phrase");
     $outlook2003icalexport = JRequest::getInt("outlook2003", 0) && $params->get("outlook2003icalexport", 0);
     if ($outlook2003icalexport) {
         JRequest::setVar("icf", 1);
     }
     $privatecalendar = false;
     $k = JRequest::getString("k", "NONE");
     $pk = JRequest::getString("pk", "NONE");
     $userid = JRequest::getInt("i", 0);
     if ($pk != "NONE") {
         if (!$userid) {
             throw new Exception(JText::_('JEV_ERROR'), 403);
             return false;
         }
         $privatecalendar = true;
         $puser = JUser::getInstance($userid);
         $key = md5($icalkey . $cats . $years . $puser->password . $puser->username . $puser->id);
         if ($key != $pk) {
             throw new Exception(JText::_('JEV_ERROR'), 403);
             return false;
         }
         // ensure "user" can access non-public categories etc.
         $this->dataModel->aid = JEVHelper::getAid($puser);
         $this->dataModel->accessuser = $puser->get('id');
         $registry = JRegistry::getInstance("jevents");
         $registry->set("jevents.icaluser", $puser);
     } else {
         if ($k != "NONE") {
             if ($params->get("disableicalexport", 0)) {
                 throw new Exception(JText::_('ALERTNOTAUTH'), 403);
                 return false;
             }
             $key = md5($icalkey . $cats . $years);
             if ($key != $k) {
                 throw new Exception(JText::_('JEV_ERROR'), 403);
                 return false;
             }
         } else {
             throw new Exception(JText::_('JEV_ERROR'), 403);
             return false;
         }
     }
     // Fix the cats
     $cats = explode(',', $cats);
     // hardening!
     JEVHelper::forceIntegerArray($cats, false);
     if ($cats != array(0)) {
         JRequest::setVar("catids", implode("|", $cats));
     } else {
         JRequest::setVar("catids", '');
     }
     //Parsing variables from URL
     //Year
     // All years
     if ($years == 0) {
         $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
         $years = array();
         for ($y = JEVHelper::getMinYear(); $y <= JEVHelper::getMaxYear(); $y++) {
             if (!in_array($y, $years)) {
                 $years[] = $y;
             }
         }
         JArrayHelper::toInteger($years);
     } else {
         if ($years != "NONE") {
             $years = explode(",", JRequest::getVar('years'));
             if (!is_array($years) || count($years) == 0) {
                 list($y, $m, $d) = JEVHelper::getYMD();
                 $years = array($y);
             }
             JArrayHelper::toInteger($years);
         } else {
             list($y, $m, $d) = JEVHelper::getYMD();
             $years = array($y);
         }
     }
     // Lockin hte categories from the URL
     $Itemid = JRequest::getInt("Itemid", 0);
     if (!$Itemid) {
         JRequest::setVar("Itemid", 1);
     }
     $this->dataModel->setupComponentCatids();
     $dispatcher = JDispatcher::getInstance();
     // just incase we don't have jevents plugins registered yet
     JPluginHelper::importPlugin("jevents");
     //And then the real work
     // Force all only the one repeat
     $cfg = JEVConfig::getInstance();
     $cfg->set('com_showrepeats', 0);
     $icalEvents = array();
     foreach ($years as $year) {
         $startdate = $year . "-01-01";
         $enddate = $year . "-12-31";
         $rows = $this->dataModel->getRangeData($startdate, $enddate, 0, 0);
//.........这里部分代码省略.........
开发者ID:poorgeek,项目名称:JEvents,代码行数:101,代码来源:icals.php

示例4: JEventsDataModel

 function &getCategoryEvents($Itemid, &$catids)
 {
     static $datamodel;
     if (!isset($datamodel)) {
         $datamodel = new JEventsDataModel();
         $reg =& JevRegistry::getInstance("jevents");
         $reg->setReference("jevents.datamodel", $datamodel);
     }
     $datamodel->catidList = JEVHelper::forceIntegerArray($catids, true);
     $datamodel->catids = $catids;
     $datamodel->catidsOut = implode('|', $catids);
     JRequest::setVar('category_fv', $datamodel->catidList);
     $filter = new jevFilterProcessing(array('category'));
     $rows = $datamodel->queryModel->listEventsByCat($catids, 0, 10000);
     $icalrows = $datamodel->queryModel->listIcalEventsByCat($catids, false, 0, 0, 10000, " ORDER BY rpt.startrepeat asc", $filter, '', '');
     $rows = array_merge($icalrows, $rows);
     return $rows;
 }
开发者ID:sangkasi,项目名称:joomla,代码行数:18,代码来源:com_jevents.php

示例5: array

 $categories = JRequest::getVar('categories', array(0), 'POST');
 $cats = array();
 foreach ($categories as $cid) {
     $cid = intval($cid);
     // Make sure the user is authorised to view this category and the menu item doesn't block it!
     if (!in_array($cid, $accessiblecats) && ($cid = !0)) {
         continue;
     }
     $cats[] = $cid;
 }
 if (count($cats) == 0) {
     $cats[] = 0;
 }
 //$years  = str_replace(",","|",JEVHelper::forceIntegerArray(JRequest::getVar('years','','POST'),true));
 //$cats = implode("|",$cats);
 $years = JEVHelper::forceIntegerArray(JRequest::getVar('years', array(0), 'POST'), true);
 $cats = implode(",", $cats);
 $link = JURI::root() . "index.php?option=com_jevents&task=icals.export&format=ical";
 if (count($cats) > 0) {
     $link .= "&catids=" . $cats;
 }
 $link .= "&years=" . $years;
 if (JRequest::getInt("icalformatted", 0)) {
     $link .= "&icf=1";
 }
 $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
 if ($params->get("constrained", 0)) {
     $link .= "&Itemid=" . JRequest::getInt("Itemid", 1);
 }
 $icalkey = $params->get("icalkey", "secret phrase");
 $publiclink = $link . "&k=" . md5($icalkey . $cats . $years);
开发者ID:madseller,项目名称:coperio,代码行数:31,代码来源:ical_form.php

示例6: setupComponentCatids

 function setupComponentCatids()
 {
     // if no catids from GET or POST default to the menu values
     // Note that module links must pass a non default value
     $Itemid = JEVHelper::getItemid();
     $this->myItemid = $Itemid;
     $menu = JFactory::getApplication()->getMenu();
     $active = $menu->getActive();
     if (!is_null($active) && $active->component == JEV_COM_COMPONENT) {
         $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     } else {
         // If accessing this function from outside the component then I must load suitable parameters
         // We may be calling from a Jevents module so we should use the target menu item if available
         $registry = JRegistry::getInstance("jevents");
         $moduleparams = $registry->get("jevents.moduleparams", false);
         $moduleid = $registry->get("jevents.moduleid", "");
         if ($moduleparams && $moduleparams->get("target_itemid", 0) > 0 && $moduleid) {
             $menuitem = $menu->getItem($moduleparams->get("target_itemid", 0));
             if (!is_null($menuitem) && $menuitem->component == JEV_COM_COMPONENT) {
                 $this->myItemid = $moduleparams->get("target_itemid", 0);
             }
         }
         $params = $menu->getParams($this->myItemid);
     }
     $separator = $params->get("catseparator", "|");
     $catidsIn = JRequest::getVar('catids', 'NONE');
     if ($catidsIn == "NONE" || $catidsIn == 0) {
         $catidsIn = JRequest::getVar('category_fv', 'NONE');
     }
     // set menu/module constraint values for later use
     $this->mmcatids = array();
     // New system
     $newcats = $params->get("catidnew", false);
     if ($newcats && is_array($newcats)) {
         foreach ($newcats as $newcat) {
             if (!in_array($newcat, $this->mmcatids)) {
                 $this->mmcatids[] = $newcat;
             }
         }
     } else {
         for ($c = 0; $c < 999; $c++) {
             $nextCID = "catid{$c}";
             //  stop looking for more catids when you reach the last one!
             if (!($nextCatId = $params->get($nextCID, null))) {
                 break;
             }
             if (!in_array($nextCatId, $this->mmcatids)) {
                 $this->mmcatids[] = $nextCatId;
             }
         }
     }
     $this->mmcatidList = implode(",", $this->mmcatids);
     // if resettting then always reset to module/menu value
     if (intval(JRequest::getVar('filter_reset', 0))) {
         $this->catids = $this->mmcatids;
         $this->catidList = $this->mmcatidList;
     } else {
         $this->catids = array();
         if ($catidsIn == "NONE" || $catidsIn == 0) {
             $this->catidList = "";
             // New system
             $newcats = $params->get("catidnew", false);
             if ($newcats && is_array($newcats)) {
                 foreach ($newcats as $newcat) {
                     if (!in_array($newcat, $this->catids)) {
                         $this->catids[] = $newcat;
                     }
                 }
             } else {
                 for ($c = 0; $c < 999; $c++) {
                     $nextCID = "catid{$c}";
                     //  stop looking for more catids when you reach the last one!
                     if (!($nextCatId = $params->get($nextCID, null))) {
                         break;
                     }
                     if (!in_array($nextCatId, $this->catids)) {
                         $this->catids[] = $nextCatId;
                     }
                 }
             }
             $this->catidList = implode(",", $this->catids);
             // no need to set catidsOut for menu item since the menu item knows this information already!
             //$this->catidsOut = str_replace( ',', $separator, $this->catidList );
         } else {
             $this->catids = explode($separator, $catidsIn);
             // hardening!
             $this->catidList = JEVHelper::forceIntegerArray($this->catids, true);
             $this->catidsOut = str_replace(',', $separator, $this->catidList);
         }
     }
     // some functions e.g. JEventCal::viewDetailLink don't have access to a datamodel so set a global value
     // as a backup
     global $catidsOut;
     $catidsOut = $this->catidsOut;
 }
开发者ID:hriggs,项目名称:cs-website,代码行数:95,代码来源:datamodel.php

示例7: export

 function export()
 {
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     if ($params->get("disableicalexport", 0)) {
         JError::raiseError(403, JText::_('ALERTNOTAUTH'));
     }
     $years = JRequest::getVar('years', 'NONE');
     $cats = JRequest::getVar('catids', 'NONE');
     // validate the key
     $icalkey = $params->get("icalkey", "secret phrase");
     $outlook2003icalexport = JRequest::getInt("outlook2003", 0) && $params->get("outlook2003icalexport", 0);
     if ($outlook2003icalexport) {
         JRequest::setVar("icf", 1);
     }
     $privatecalendar = false;
     $k = JRequest::getString("k", "NONE");
     $pk = JRequest::getString("pk", "NONE");
     $userid = JRequest::getInt("i", 0);
     if ($pk != "NONE") {
         if (!$userid) {
             JError::raiseError(403, "JEV_ERROR");
         }
         $privatecalendar = true;
         $puser = JUser::getInstance($userid);
         $key = md5($icalkey . $cats . $years . $puser->password . $puser->username . $puser->id);
         if ($key != $pk) {
             JError::raiseError(403, "JEV_ERROR");
         }
         if (JVersion::isCompatible("1.6.0")) {
             // ensure "user" can access non-public categories etc.
             $this->dataModel->aid = JEVHelper::getAid($puser);
             $this->dataModel->accessuser = $puser->get('id');
         } else {
             // Get an ACL object
             $acl =& JFactory::getACL();
             // Get the user group from the ACL
             $grp = $acl->getAroGroup($puser->get('id'));
             //Mark the user as logged in
             $puser->set('guest', 0);
             $puser->set('aid', 1);
             // Fudge Authors, Editors, Publishers and Super Administrators into the special access group
             if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
                 $puser->set('aid', 2);
             }
             // ensure "user" can access non-public categories etc.
             $this->dataModel->aid = $puser->aid;
             $this->dataModel->accessuser = $puser->get('id');
         }
         $registry =& JRegistry::getInstance("jevents");
         $registry->setValue("jevents.icaluser", $puser);
     } else {
         if ($k != "NONE") {
             $key = md5($icalkey . $cats . $years);
             if ($key != $k) {
                 JError::raiseError(403, "JEV_ERROR");
             }
         } else {
             JError::raiseError(403, "JEV_ERROR");
         }
     }
     // Fix the cats
     $cats = explode(',', $cats);
     // hardening!
     JEVHelper::forceIntegerArray($cats, false);
     if ($cats != array(0)) {
         JRequest::setVar("catids", implode("|", $cats));
     } else {
         JRequest::setVar("catids", '');
     }
     //Parsing variables from URL
     //Year
     // All years
     if ($years == 0) {
         $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
         $years = array();
         for ($y = $params->get("com_earliestyear", date('Y')); $y <= $params->get("com_latestyear", date('Y')); $y++) {
             if (!in_array($y, $years)) {
                 $years[] = $y;
             }
         }
         JArrayHelper::toInteger($years);
     } else {
         if ($years != "NONE") {
             $years = explode(",", JRequest::getVar('years'));
             if (!is_array($years) || count($years) == 0) {
                 list($y, $m, $d) = JEVHelper::getYMD();
                 $years = array($y);
             }
             JArrayHelper::toInteger($years);
         } else {
             list($y, $m, $d) = JEVHelper::getYMD();
             $years = array($y);
         }
     }
     // Lockin hte categories from the URL
     $this->dataModel->setupComponentCatids();
     $dispatcher =& JDispatcher::getInstance();
     // just incase we don't have jevents plugins registered yet
     JPluginHelper::importPlugin("jevents");
     //And then the real work
//.........这里部分代码省略.........
开发者ID:madseller,项目名称:coperio,代码行数:101,代码来源:icals.php

示例8: export

 function export()
 {
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     if ($params->get("disableicalexport", 0)) {
         JError::raiseError(403, JText::_('ALERTNOTAUTH'));
     }
     $years = JRequest::getVar('years', 'NONE');
     $cats = JRequest::getVar('catids', 'NONE');
     // validate the key
     $icalkey = $params->get("icalkey", "secret phrase");
     $outlook2003icalexport = JRequest::getInt("outlook2003", 0) && $params->get("outlook2003icalexport", 0);
     if ($outlook2003icalexport) {
         JRequest::setVar("icf", 1);
     }
     $privatecalendar = false;
     $k = JRequest::getString("k", "NONE");
     $pk = JRequest::getString("pk", "NONE");
     $userid = JRequest::getInt("i", 0);
     if ($pk != "NONE") {
         if (!$userid) {
             JError::raiseError(403, "JEV_ERROR");
         }
         $privatecalendar = true;
         $puser = JUser::getInstance($userid);
         $key = md5($icalkey . $cats . $years . $puser->password . $puser->username . $puser->id);
         if ($key != $pk) {
             JError::raiseError(403, "JEV_ERROR");
         }
         if (!JVersion::isCompatible("1.6.0")) {
             // Get an ACL object
             $acl =& JFactory::getACL();
             // Get the user group from the ACL
             $grp = $acl->getAroGroup($puser->get('id'));
             //Mark the user as logged in
             $puser->set('guest', 0);
             $puser->set('aid', 1);
             // Fudge Authors, Editors, Publishers and Super Administrators into the special access group
             if ($acl->is_group_child_of($grp->name, 'Registered') || $acl->is_group_child_of($grp->name, 'Public Backend')) {
                 $puser->set('aid', 2);
             }
             // ensure "user" can access non-public categories etc.
             $this->dataModel->aid = $puser->aid;
         }
         $registry =& JRegistry::getInstance("jevents");
         $registry->setValue("jevents.icaluser", $puser);
     } else {
         if ($k != "NONE") {
             $key = md5($icalkey . $cats . $years);
             if ($key != $k) {
                 JError::raiseError(403, "JEV_ERROR");
             }
         } else {
             JError::raiseError(403, "JEV_ERROR");
         }
     }
     // Fix the cats
     $cats = explode(',', $cats);
     // hardening!
     JEVHelper::forceIntegerArray($cats, false);
     if ($cats != array(0)) {
         JRequest::setVar("catids", implode("|", $cats));
     } else {
         JRequest::setVar("catids", '');
     }
     //Parsing variables from URL
     //Year
     // All years
     if ($years == 0) {
         $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
         $years = array();
         for ($y = $params->get("com_earliestyear", date('Y')); $y <= $params->get("com_latestyear", date('Y')); $y++) {
             if (!in_array($y, $years)) {
                 $years[] = $y;
             }
         }
         JArrayHelper::toInteger($years);
     } else {
         if ($years != "NONE") {
             $years = explode(",", JRequest::getVar('years'));
             if (!is_array($years) || count($years) == 0) {
                 list($y, $m, $d) = JEVHelper::getYMD();
                 $years = array($y);
             }
             JArrayHelper::toInteger($years);
         } else {
             list($y, $m, $d) = JEVHelper::getYMD();
             $years = array($y);
         }
     }
     // Lockin hte categories from the URL
     $this->dataModel->setupComponentCatids();
     $dispatcher =& JDispatcher::getInstance();
     // just incase we don't have jevents plugins registered yet
     JPluginHelper::importPlugin("jevents");
     //And then the real work
     // Force all only the one repeat
     $cfg =& JEVConfig::getInstance();
     $cfg->set('com_showrepeats', 0);
     $icalEvents = array();
     foreach ($years as $year) {
//.........这里部分代码省略.........
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:101,代码来源:icals.php


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