[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 // modules are defined as an array 2 // [ module function, map of requires ] 3 // 4 // map of requires is short require name -> numeric require 5 // 6 // anything defined in a previous bundle is accessed via the 7 // orig method which is the require for previous bundles 8 parcelRequire = (function (modules, cache, entry, globalName) { 9 // Save the require from previous bundle to this closure if any 10 var previousRequire = typeof parcelRequire === 'function' && parcelRequire; 11 var nodeRequire = typeof require === 'function' && require; 12 13 function newRequire(name, jumped) { 14 if (!cache[name]) { 15 if (!modules[name]) { 16 // if we cannot find the module within our internal map or 17 // cache jump to the current global require ie. the last bundle 18 // that was added to the page. 19 var currentRequire = typeof parcelRequire === 'function' && parcelRequire; 20 if (!jumped && currentRequire) { 21 return currentRequire(name, true); 22 } 23 24 // If there are other bundles on this page the require from the 25 // previous one is saved to 'previousRequire'. Repeat this as 26 // many times as there are bundles until the module is found or 27 // we exhaust the require chain. 28 if (previousRequire) { 29 return previousRequire(name, true); 30 } 31 32 // Try the node require function if it exists. 33 if (nodeRequire && typeof name === 'string') { 34 return nodeRequire(name); 35 } 36 37 var err = new Error('Cannot find module \'' + name + '\''); 38 err.code = 'MODULE_NOT_FOUND'; 39 throw err; 40 } 41 42 localRequire.resolve = resolve; 43 localRequire.cache = {}; 44 45 var module = cache[name] = new newRequire.Module(name); 46 47 modules[name][0].call(module.exports, localRequire, module, module.exports, this); 48 } 49 50 return cache[name].exports; 51 52 function localRequire(x){ 53 return newRequire(localRequire.resolve(x)); 54 } 55 56 function resolve(x){ 57 return modules[name][1][x] || x; 58 } 59 } 60 61 function Module(moduleName) { 62 this.id = moduleName; 63 this.bundle = newRequire; 64 this.exports = {}; 65 } 66 67 newRequire.isParcelRequire = true; 68 newRequire.Module = Module; 69 newRequire.modules = modules; 70 newRequire.cache = cache; 71 newRequire.parent = previousRequire; 72 newRequire.register = function (id, exports) { 73 modules[id] = [function (require, module) { 74 module.exports = exports; 75 }, {}]; 76 }; 77 78 var error; 79 for (var i = 0; i < entry.length; i++) { 80 try { 81 newRequire(entry[i]); 82 } catch (e) { 83 // Save first error but execute all entries 84 if (!error) { 85 error = e; 86 } 87 } 88 } 89 90 if (entry.length) { 91 // Expose entry point to Node, AMD or browser globals 92 // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js 93 var mainExports = newRequire(entry[entry.length - 1]); 94 95 // CommonJS 96 if (typeof exports === "object" && typeof module !== "undefined") { 97 module.exports = mainExports; 98 99 // RequireJS 100 } else if (typeof define === "function" && define.amd) { 101 define(function () { 102 return mainExports; 103 }); 104 105 // <script> 106 } else if (globalName) { 107 this[globalName] = mainExports; 108 } 109 } 110 111 // Override the current require with this new one 112 parcelRequire = newRequire; 113 114 if (error) { 115 // throw error from earlier, _after updating parcelRequire_ 116 throw error; 117 } 118 119 return newRequire; 120 })({"jS06":[function(require,module,exports) { 121 "use strict"; 122 123 Object.defineProperty(exports, "__esModule", { 124 value: true 125 }); 126 exports.EXTRA_INFO = exports.GROUP_STATI = exports.AVATAR_SIZES = void 0; 127 128 /** 129 * WordPress dependencies. 130 */ 131 const { 132 i18n: { 133 __ 134 } 135 } = wp; 136 /** 137 * Avatar sizes. 138 * 139 * @type {Array} 140 */ 141 142 const AVATAR_SIZES = [{ 143 label: __('None', 'buddypress'), 144 value: 'none' 145 }, { 146 label: __('Thumb', 'buddypress'), 147 value: 'thumb' 148 }, { 149 label: __('Full', 'buddypress'), 150 value: 'full' 151 }]; 152 /** 153 * Group stati. 154 * 155 * @type {Object} 156 */ 157 158 exports.AVATAR_SIZES = AVATAR_SIZES; 159 const GROUP_STATI = { 160 public: __('Public', 'buddypress'), 161 private: __('Private', 'buddypress'), 162 hidden: __('Hidden', 'buddypress') 163 }; 164 /** 165 * Group Extra data. 166 * 167 * @type {Array} 168 */ 169 170 exports.GROUP_STATI = GROUP_STATI; 171 const EXTRA_INFO = [{ 172 label: __('None', 'buddypress'), 173 value: 'none' 174 }, { 175 label: __('Group\'s description', 'buddypress'), 176 value: 'description' 177 }, { 178 label: __('Last time the group was active', 'buddypress'), 179 value: 'active' 180 }, { 181 label: __('Amount of group members', 'buddypress'), 182 value: 'popular' 183 }]; 184 exports.EXTRA_INFO = EXTRA_INFO; 185 },{}],"Ccmh":[function(require,module,exports) { 186 "use strict"; 187 188 Object.defineProperty(exports, "__esModule", { 189 value: true 190 }); 191 exports.default = void 0; 192 193 var _constants = require("./constants"); 194 195 /** 196 * WordPress dependencies. 197 */ 198 const { 199 blockEditor: { 200 InspectorControls, 201 BlockControls 202 }, 203 components: { 204 Placeholder, 205 PanelBody, 206 SelectControl, 207 ToggleControl, 208 Button, 209 Dashicon, 210 Tooltip, 211 ToolbarGroup, 212 RangeControl 213 }, 214 element: { 215 createElement, 216 Fragment, 217 useState 218 }, 219 i18n: { 220 __, 221 sprintf, 222 _n 223 }, 224 apiFetch, 225 url: { 226 addQueryArgs 227 } 228 } = wp; 229 /** 230 * BuddyPress dependencies. 231 */ 232 233 const { 234 blockComponents: { 235 AutoCompleter 236 }, 237 blockData: { 238 isActive 239 } 240 } = bp; 241 /** 242 * Internal dependencies. 243 */ 244 245 /** 246 * External dependencies. 247 */ 248 const { 249 reject, 250 remove, 251 sortBy 252 } = lodash; 253 254 const getSlugValue = item => { 255 if (item && item.status && _constants.GROUP_STATI[item.status]) { 256 return _constants.GROUP_STATI[item.status]; 257 } 258 259 return null; 260 }; 261 262 const editGroupsBlock = ({ 263 attributes, 264 setAttributes, 265 isSelected 266 }) => { 267 const isAvatarEnabled = isActive('groups', 'avatar'); 268 const { 269 itemIDs, 270 avatarSize, 271 displayGroupName, 272 extraInfo, 273 layoutPreference, 274 columns 275 } = attributes; 276 const hasGroups = 0 !== itemIDs.length; 277 const [groups, setGroups] = useState([]); 278 const layoutControls = [{ 279 icon: 'text', 280 title: __('List view', 'buddypress'), 281 onClick: () => setAttributes({ 282 layoutPreference: 'list' 283 }), 284 isActive: layoutPreference === 'list' 285 }, { 286 icon: 'screenoptions', 287 title: __('Grid view', 'buddypress'), 288 onClick: () => setAttributes({ 289 layoutPreference: 'grid' 290 }), 291 isActive: layoutPreference === 'grid' 292 }]; 293 let groupsList; 294 let containerClasses = 'bp-block-groups avatar-' + avatarSize; 295 let extraInfoOptions = _constants.EXTRA_INFO; 296 297 if (layoutPreference === 'grid') { 298 containerClasses += ' is-grid columns-' + columns; 299 extraInfoOptions = _constants.EXTRA_INFO.filter(extra => { 300 return 'description' !== extra.value; 301 }); 302 } 303 304 const onSelectedGroup = ({ 305 itemID 306 }) => { 307 if (itemID && -1 === itemIDs.indexOf(itemID)) { 308 setAttributes({ 309 itemIDs: [...itemIDs, parseInt(itemID, 10)] 310 }); 311 } 312 }; 313 314 const onRemoveGroup = itemID => { 315 if (itemID && -1 !== itemIDs.indexOf(itemID)) { 316 setGroups(reject(groups, ['id', itemID])); 317 setAttributes({ 318 itemIDs: remove(itemIDs, value => { 319 return value !== itemID; 320 }) 321 }); 322 } 323 }; 324 325 if (hasGroups && itemIDs.length !== groups.length) { 326 apiFetch({ 327 path: addQueryArgs(`/buddypress/v1/groups`, { 328 populate_extras: true, 329 include: itemIDs 330 }) 331 }).then(items => { 332 setGroups(sortBy(items, [item => { 333 return itemIDs.indexOf(item.id); 334 }])); 335 }); 336 } 337 338 if (groups.length) { 339 groupsList = groups.map(group => { 340 let hasDescription = false; 341 let groupItemClasses = 'group-content'; 342 343 if (layoutPreference === 'list' && 'description' === extraInfo && group.description && group.description.rendered) { 344 hasDescription = true; 345 groupItemClasses = 'group-content has-description'; 346 } 347 348 return createElement("div", { 349 key: 'bp-group-' + group.id, 350 className: groupItemClasses 351 }, isSelected && createElement(Tooltip, { 352 text: __('Remove group', 'buddypress') 353 }, createElement(Button, { 354 className: "is-right", 355 onClick: () => onRemoveGroup(group.id), 356 label: __('Remove group', 'buddypress') 357 }, createElement(Dashicon, { 358 icon: "no" 359 }))), isAvatarEnabled && 'none' !== avatarSize && createElement("div", { 360 className: "item-header-avatar" 361 }, createElement("a", { 362 href: group.link, 363 target: "_blank" 364 }, createElement("img", { 365 key: 'avatar-' + group.id, 366 className: "avatar", 367 alt: sprintf(__('Profile photo of %s', 'buddypress'), group.name), 368 src: group.avatar_urls[avatarSize] 369 }))), createElement("div", { 370 className: "group-description" 371 }, displayGroupName && createElement("strong", null, createElement("a", { 372 href: group.link, 373 target: "_blank" 374 }, group.name)), hasDescription && createElement("div", { 375 className: "group-description-content", 376 dangerouslySetInnerHTML: { 377 __html: group.description.rendered 378 } 379 }), 'active' === extraInfo && group.last_activity && group.last_activity_diff && createElement("time", { 380 dateTime: group.last_activity 381 }, sprintf(__('Active %s', 'buddypress'), group.last_activity_diff)), 'popular' === extraInfo && group.total_member_count && createElement("div", { 382 className: "group-meta" 383 }, sprintf( 384 /* translators: 1: number of group memberss. */ 385 _n('%1$d member', '%1$d members', group.total_member_count, 'buddypress'), group.total_member_count)))); 386 }); 387 } 388 389 return createElement(Fragment, null, createElement(InspectorControls, null, createElement(PanelBody, { 390 title: __('Settings', 'buddypress'), 391 initialOpen: true 392 }, createElement(ToggleControl, { 393 label: __('Display the group\'s name', 'buddypress'), 394 checked: !!displayGroupName, 395 onChange: () => { 396 setAttributes({ 397 displayGroupName: !displayGroupName 398 }); 399 }, 400 help: displayGroupName ? __('Include the group\'s name.', 'buddypress') : __('Toggle to include group\'s name.', 'buddypress') 401 }), isAvatarEnabled && createElement(SelectControl, { 402 label: __('Avatar size', 'buddypress'), 403 value: avatarSize, 404 options: _constants.AVATAR_SIZES, 405 help: __('Select "None" to disable the avatar.', 'buddypress'), 406 onChange: option => { 407 setAttributes({ 408 avatarSize: option 409 }); 410 } 411 }), createElement(SelectControl, { 412 label: __('Group extra information', 'buddypress'), 413 value: extraInfo, 414 options: extraInfoOptions, 415 help: __('Select "None" to show no extra information.', 'buddypress'), 416 onChange: option => { 417 setAttributes({ 418 extraInfo: option 419 }); 420 } 421 }), layoutPreference === 'grid' && createElement(RangeControl, { 422 label: __('Columns', 'buddypress'), 423 value: columns, 424 onChange: value => setAttributes({ 425 columns: value 426 }), 427 min: 2, 428 max: 4, 429 required: true 430 }))), createElement(BlockControls, null, createElement(ToolbarGroup, { 431 controls: layoutControls 432 })), hasGroups && createElement("div", { 433 className: containerClasses 434 }, groupsList), (isSelected || 0 === itemIDs.length) && createElement(Placeholder, { 435 icon: hasGroups ? '' : 'groups', 436 label: hasGroups ? '' : __('BuddyPress Groups', 'buddypress'), 437 instructions: __('Start typing the name of the group you want to add to the groups list.', 'buddypress'), 438 className: 0 !== itemIDs.length ? 'is-appender' : 'is-large' 439 }, createElement(AutoCompleter, { 440 component: "groups", 441 objectQueryArgs: { 442 'show_hidden': false, 443 exclude: itemIDs 444 }, 445 slugValue: getSlugValue, 446 ariaLabel: __('Group\'s name', 'buddypress'), 447 placeholder: __('Enter Group\'s name hereā¦', 'buddypress'), 448 onSelectItem: onSelectedGroup, 449 useAvatar: isAvatarEnabled 450 }))); 451 }; 452 453 var _default = editGroupsBlock; 454 exports.default = _default; 455 },{"./constants":"jS06"}],"jcTh":[function(require,module,exports) { 456 "use strict"; 457 458 var _edit = _interopRequireDefault(require("./groups/edit")); 459 460 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 461 462 /** 463 * WordPress dependencies. 464 */ 465 const { 466 blocks: { 467 registerBlockType 468 }, 469 i18n: { 470 __ 471 } 472 } = wp; 473 /** 474 * Internal dependencies. 475 */ 476 477 registerBlockType('bp/groups', { 478 title: __('Groups', 'buddypress'), 479 description: __('BuddyPress Groups.', 'buddypress'), 480 icon: { 481 background: '#fff', 482 foreground: '#d84800', 483 src: 'buddicons-groups' 484 }, 485 category: 'buddypress', 486 attributes: { 487 itemIDs: { 488 type: 'array', 489 items: { 490 type: 'integer' 491 }, 492 default: [] 493 }, 494 avatarSize: { 495 type: 'string', 496 default: 'full' 497 }, 498 displayGroupName: { 499 type: 'boolean', 500 default: true 501 }, 502 extraInfo: { 503 type: 'string', 504 default: 'none' 505 }, 506 layoutPreference: { 507 type: 'string', 508 default: 'list' 509 }, 510 columns: { 511 type: 'number', 512 default: 2 513 } 514 }, 515 edit: _edit.default 516 }); 517 },{"./groups/edit":"Ccmh"}]},{},["jcTh"], null)
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Jun 3 01:01:23 2023 | Cross-referenced by PHPXref 0.7.1 |