Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
/** * WordPress components that create the necessary UI elements for the block * * @see https://developer.wordpress.org/block-editor/packages/packages-components/ */ //import { map, filter } from 'lodash'; import { TextControl } from '@wordpress/components'; import { withSelect, subscribe } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; import { __ } from '@wordpress/i18n'; import ServerSideRender from "@wordpress/server-side-render"; const { InspectorControls } = wp.blockEditor; const { ToggleControl, PanelBody, PanelRow, CheckboxControl, SelectControl, ColorPicker, Placeholder, Spinner } = wp.components; /** * React hook that is used to mark the block wrapper element. * It provides all the necessary props like the class name. * * @see https://developer.wordpress.org/block-editor/packages/packages-block-editor/#useBlockProps */ import { useBlockProps } from '@wordpress/block-editor'; /** * The edit function describes the structure of your block in the context of the * editor. This represents what the editor will render when the block is used. * * @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#edit * * @param {Object} props Properties passed to the function. * @param {Object} props.attributes Available block attributes. * @param {Function} props.setAttributes Function that updates individual attributes. * * @return {WPElement} Element to render. */ function Edit( props ) { if ( props.attributes.__internalWidgetId ) { props.setAttributes( {blockId: props.attributes.__internalWidgetId }); } else if ( props.clientId ) { props.setAttributes( {blockId: props.clientId}); } else { props.setAttributes( {blockId: 'block-1'}); } function excludedPostTypes( postType ) { let excludePostTypes = [ 'wp_block', 'wp_template', 'wp_template_part', 'wp_navigation', 'nav_menu_item' ]; if ( ! excludePostTypes.includes( postType.slug ) ) { return postType; } } function excludedTaxonomies( taxonomy ) { let excludeTaxonomies = [ 'nav_menu' ]; if ( ! excludeTaxonomies.includes( taxonomy.slug ) ) { return taxonomy; } } const getPostTypeOptions = () => { const selectOption = { label: __( '- Select -' ), value: '', disabled: true, }; let postTypeOptions = []; if ( props.postTypes ) { postTypeOptions = props.postTypes.filter(excludedPostTypes).map( item => { return { value: item.slug, label: item.name, }; } ); } return [ selectOption, ...postTypeOptions ]; } const getTaxonomyOptions = () => { const selectOption = { label: __( '- Select -' ), value: '', disabled: true, }; let taxonomyOptions = []; if ( props.taxonomies ) { taxonomyOptions = props.taxonomies.filter( excludedTaxonomies ).map( item => { return { value: item.slug, label: item.name, }; } ); } return [ selectOption, ...taxonomyOptions ]; }; const blockProps = useBlockProps(); return (
{ props.setAttributes( { widgetTitle: nextValue } ); } } /> { props.setAttributes( {showPosts: newval })}} /> { props.setAttributes( { showPostCount: value } );} } /> { props.setAttributes( {catSort: newval })}} /> { props.setAttributes( {catSortOrder: newval })}} /> { props.setAttributes( {postSort: newval })}} /> { props.setAttributes( {postSortOrder: newval })}} /> { props.setAttributes( {expand: newval })}} /> { props.setAttributes( { customExpand: nextValue } ); } } /> { props.setAttributes( { customCollapse: nextValue } ); } } /> { props.setAttributes( {taxonomy: newval })}} /> { props.setAttributes( {post_type: newval })}} /> { props.setAttributes( {linkToCat: newval });console.log(props)}} /> { props.setAttributes( {style: newval })}} /> { props.setAttributes( {accordion: newval })}} /> { props.setAttributes( { titleLink: nextValue } ); } } /> { props.setAttributes( {catFeed: newval })}} /> { props.setAttributes( {excludeAll: newval })}} /> { props.setAttributes( { olderThan: nextValue } ); } } /> { props.setAttributes( { postTitleLength: nextValue } ); } } /> { props.setAttributes( {inExclude: newval })}} /> { props.setAttributes( { inExcludeCats: nextValue } ); } } /> { props.setAttributes( { defaultExpand: nextValue } ); } } /> { props.setAttributes( {showPostDate: newval })}} /> { props.setAttributes( {postDateAppend: newval })}} /> { props.setAttributes( { postDateFormat: nextValue } ); } } help={ __( " information about date formatting syntax" ) } /> { props.setAttributes( {showTopLevel: newval })}} /> { props.setAttributes( {debug: newval })}} />
); } export default withSelect( ( select ) => { return { taxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ), postTypes: select( coreStore ).getPostTypes( { per_page: -1 } ), }; } )( Edit );