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


PHP MainWP_Utility::can_edit_group方法代码示例

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


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

示例1: hookGetGroups

 /**
  * @param string $pluginFile Extension plugin file to verify
  * @param string $key The child-key
  * @param int $groupid The id of the group you wish to retrieve
  * @param bool $for_manager
  *
  * @return array|bool An array of arrays, the inner-array contains the id/name/array of site ids for the supplied groupid/all groups. False when something goes wrong.
  */
 public static function hookGetGroups($pluginFile, $key, $groupid, $for_manager = false)
 {
     if (!self::hookVerify($pluginFile, $key)) {
         return false;
     }
     if ($for_manager && (!defined('MWP_TEAMCONTROL_PLUGIN_SLUG') || !mainwp_current_user_can('extension', dirname(MWP_TEAMCONTROL_PLUGIN_SLUG)))) {
         return false;
     }
     if (isset($groupid)) {
         $group = MainWP_DB::Instance()->getGroupById($groupid);
         if (!MainWP_Utility::can_edit_group($group)) {
             return false;
         }
         $websites = MainWP_DB::Instance()->getWebsitesByGroupId($group->id);
         $websitesOut = array();
         foreach ($websites as $website) {
             $websitesOut[] = $website->id;
         }
         return array(array('id' => $groupid, 'name' => $group->name, 'websites' => $websitesOut));
     }
     $groups = MainWP_DB::Instance()->getGroupsAndCount(null, $for_manager);
     $output = array();
     foreach ($groups as $group) {
         $websites = MainWP_DB::Instance()->getWebsitesByGroupId($group->id);
         $websitesOut = array();
         foreach ($websites as $website) {
             if (in_array($website->id, $websitesOut)) {
                 continue;
             }
             $websitesOut[] = $website->id;
         }
         $output[] = array('id' => $group->id, 'name' => $group->name, 'websites' => $websitesOut);
     }
     return $output;
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:43,代码来源:page-mainwp-extensions.php

示例2: updateGroup

 public static function updateGroup()
 {
     if (isset($_POST['groupId']) && MainWP_Utility::ctype_digit($_POST['groupId'])) {
         $group = MainWP_DB::Instance()->getGroupById($_POST['groupId']);
         if (MainWP_Utility::can_edit_group($group)) {
             MainWP_DB::Instance()->clearGroup($group->id);
             if (isset($_POST['websiteIds'])) {
                 foreach ($_POST['websiteIds'] as $websiteId) {
                     $website = MainWP_DB::Instance()->getWebsiteById($websiteId);
                     if (MainWP_Utility::can_edit_website($website)) {
                         MainWP_DB::Instance()->updateGroupSite($group->id, $website->id);
                     }
                 }
             }
             die(json_encode(array('result' => true)));
         }
     }
     die(json_encode(array('result' => false)));
 }
开发者ID:senlin,项目名称:mainwp,代码行数:19,代码来源:page-mainwp-manage-groups.php


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