Skip to content

Commit

Permalink
Auto-adjust formating
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed Oct 16, 2023
1 parent 70cdefa commit 9cb3cd7
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 65 deletions.
36 changes: 18 additions & 18 deletions ft-network-sourcelinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static function get_subscribed_events() : Array
// 'after_setup_theme' => 'enable__on_setup_theme', // working


//
//
// 'admin_menu' => 'enable__on_admin', //
);
}
Expand All @@ -98,13 +98,13 @@ public static function get_subscribed_events() : Array
public function enable() : void
{

\load_plugin_textdomain(
'ft-network-sourcelinks',
\load_plugin_textdomain(
'ft-network-sourcelinks',
false,
dirname( \plugin_basename( __FILE__ ) ) . '/languages'
// $this->plugin_dir_path . '/languages'
);


// 1. Register our post_type 'ft_link'
\Figuren_Theater\API::get('PT')->add(
Expand Down Expand Up @@ -149,17 +149,17 @@ public function custom_query_block_attributes( $parsed_block ) {
if ( 'core/query' === $parsed_block['blockName'] ) {
// If the block has a `taxQuery` attribute, then find the corresponding cat ID and set the `categoryIds` attribute.
// TODO: support multiple?
if (
if (
isset( $parsed_block[ 'attrs' ][ 'query' ][ 'search' ] )
&&
strpos( $parsed_block[ 'attrs' ][ 'query' ][ 'search' ], 'link_category:' )
) {
// die(var_dump($parsed_block));
#if ( is_string( $parsed_block[ 'attrs' ][ 'query' ][ 'taxQuery' ]['link_category'][0] ) )
$_link_cat = array_flip( explode(':', $parsed_block[ 'attrs' ][ 'query' ][ 'search' ] ) );
$tax_term = get_term_by(
$tax_term = get_term_by(
'slug',
$_link_cat[0],
'link_category',
Expand All @@ -179,13 +179,13 @@ public function custom_query_block_attributes( $parsed_block ) {
public function i18n()
{

\load_plugin_textdomain(
'ft-network-sourcelinks',
\load_plugin_textdomain(
'ft-network-sourcelinks',
false,
dirname( \plugin_basename( __FILE__ ) ) . '/languages'
// $this->plugin_dir_path . '/languages'
);

/*
\wp_set_script_translations(
'figurentheater-figurentheater-production-duration-editor-script',
Expand All @@ -201,7 +201,7 @@ public function i18n()
*/
}



/**
* @todo #32
Expand Down Expand Up @@ -311,13 +311,13 @@ protected function debug()
{

# \do_action( 'qm/debug', $this->get_urls() );

# \do_action( 'qm/info', '{fn}: {value}', [
# 'fn' => "get_taxonomy( 'link_category' )",
# 'value' => var_export( \get_taxonomy( 'link_category' ), true ),
# ] );
#

# \do_action( 'qm/info', '{fn}: {value}', [
# 'fn' => "\get_post_type( 'link' )",
# 'value' => var_export( \get_post_type( 'link' ), true ),
Expand Down Expand Up @@ -353,20 +353,20 @@ protected function debug()


// runs once, on activation
//
//
// after reading a loooong thread at
// https://core.trac.wordpress.org/ticket/14170
// I know now, that we should follow a new path
// because of multisite vs. register_activation_hook
//
//
// let us now do this from within the taxonomy,
// when visiting the links edit.php
/*
\register_activation_hook( __FILE__, function(){
// create 'link_category' taxonomy terms
// create first 'ft_link' using site_url()
// add_option('default_link_category')
} );*/
8 changes: 4 additions & 4 deletions inc/Network/Options/Preset__wpseo_social.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ function( $v, $k ) use ( &$_urls, $_social_links ) {

// @todo #25
// we have this string-cleaning now 3 times
//
//
// - plugins\ft-network-sourcelinks\src\block-editor\blocks\filtered-links\index.php#L90
// - plugins\ft-network-sourcelinks\inc\Network\Post_Types\Post_Type__ft_link.php#L330
// - plugins\ft-network-sourcelinks\inc\Network\Options\Preset__wpseo_social.php#L142
//
//
//
//
// cleanup html
// especially from wp_auto_p
$_url = \wp_kses( $v->post_content, [] );
Expand Down Expand Up @@ -136,7 +136,7 @@ function( $v, $k ) use ( &$_urls, $_social_links ) {
/**
* [pre_option_wpseo_social description]
*
* 2022.06.08: Added Array|bool for situations´,
* 2022.06.08: Added Array|bool for situations´,
* where 'wpseo_social' is not set and/or not filtered yet.
* Just to prevent fatals ;).
*
Expand Down
28 changes: 14 additions & 14 deletions inc/Network/Post_Types/Post_Type__ft_link.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static function get_subscribed_events() : array {
public function get_post_data() : Array
{
return [
'post_author' => ( isset( $this->arguments['user_id'] ) ) ? $this->arguments['user_id'] : Users\ft_bot::id(),
'post_author' => ( isset( $this->arguments['user_id'] ) ) ? $this->arguments['user_id'] : Users\ft_bot::id(),
'post_title' => $this->arguments['new_post_title'],
'post_content' => $this->arguments['new_post_content'],
'post_status' => 'publish', // start with private, switch to publish on later point
Expand All @@ -97,9 +97,9 @@ public function get_post_meta() : Array
}

/**
* Get all taxonomies and its terms (IDs)
* as multidimesnional array,
* properly prepared to be used
* Get all taxonomies and its terms (IDs)
* as multidimesnional array,
* properly prepared to be used
* as part of wp_insert_post.
*
* Structural Example:
Expand Down Expand Up @@ -185,10 +185,10 @@ protected function register_post_type__default_args() : Array

/**
* Localiced Labels
*
* ExtendedCPTs generates the default labels in English for your post type.
* If you need to allow your post type labels to be localized,
* then you must explicitly provide all of the labels (in the labels parameter)
*
* ExtendedCPTs generates the default labels in English for your post type.
* If you need to allow your post type labels to be localized,
* then you must explicitly provide all of the labels (in the labels parameter)
* so the strings can be translated. There is no shortcut for this.
*
* @source https://github.com/johnbillion/extended-cpts/pull/5#issuecomment-33756474
Expand Down Expand Up @@ -330,12 +330,12 @@ public static function get_readable_link( WP_Post|null $post = null ) {

// @todo #25
// we have this string-cleaning now 3 times
//
//
// - plugins\ft-network-sourcelinks\src\block-editor\blocks\filtered-links\index.php#L90
// - plugins\ft-network-sourcelinks\inc\Network\Post_Types\Post_Type__ft_link.php#L330
// - plugins\ft-network-sourcelinks\inc\Network\Options\Preset__wpseo_social.php#L142
//
//
//
//
// cleanup html
// especially from wp_auto_p
$_url = \wp_kses( $post->post_content, [] );
Expand All @@ -344,7 +344,7 @@ public static function get_readable_link( WP_Post|null $post = null ) {
// last check
if ( ! $_url = \esc_url( $_url ) )
return '';

$_short_url = \url_shorten( $_url );
return "<a href='$_url'>$_short_url</a>";
}
Expand Down Expand Up @@ -402,7 +402,7 @@ public function permalink_source_url( string $permalink, WP_Post $post ) : strin
if ( static::NAME !== $post->post_type ) {
return $permalink;
}

$url = \esc_url( $post->post_content );
return $url ?? $permalink;
}
Expand Down Expand Up @@ -464,7 +464,7 @@ public function get_queried_urls() : array {
}
return $ft_link_query;
}

public function query_urls() : array {

// get all IDs of 'Links' in our 'Own' 'link_category' now,
Expand Down
8 changes: 4 additions & 4 deletions inc/Network/Taxonomies/Taxonomy__ft_link_shadow.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


/**
*
*
*/
class Taxonomy__ft_link_shadow extends Taxonomy__Abstract implements EventManager\SubscriberInterface
{
Expand Down Expand Up @@ -41,7 +41,7 @@ public static function get_subscribed_events() : Array
// 'register_taxonomy_args' => ['register_taxonomy_args', 20, 3],

'manage_edit-'.static::NAME.'_columns' => 'manage_columns',


);
}
Expand Down Expand Up @@ -83,7 +83,7 @@ protected function prepare_tax() : void
{
// Register shadow connection between this taxonomy and post_type
$ft_link__TAX_shadow = new TAX_Shadow( $this::NAME, Post_Types\Post_Type__ft_link::NAME );
Figuren_Theater\FT::site()->EventManager->add_subscriber( $ft_link__TAX_shadow );
Figuren_Theater\FT::site()->EventManager->add_subscriber( $ft_link__TAX_shadow );
}


Expand Down Expand Up @@ -141,7 +141,7 @@ public function register_taxonomy__default_args() : array
/**
* Default arguments for custom taxonomies
* Several of these differ from the defaults in WordPress' register_taxonomy() function.
*
*
* https://github.com/johnbillion/extended-cpts/wiki/Registering-taxonomies#default-arguments-for-custom-taxonomies
*/
protected function register_extended_taxonomy__args() : array {
Expand Down
16 changes: 8 additions & 8 deletions src/block-editor/blocks/filtered-links/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function block_init() {
* @param string $content Block default content.
* @param WP_Block $block Block instance.
*
* @return string
* @return string
*/
function render_block( $attributes, $content, $block ) {

Expand All @@ -62,11 +62,11 @@ function render_block( $attributes, $content, $block ) {
// TODO #29 // consider using $attributes['tagName']
// which is not used at the moment, so it defaults to: ul
$tag_name = empty( $attributes['tagName'] ) ? 'ul' : $attributes['tagName'];

// get and merge wrapper attributes with text-align CSS class
$wrapper_attributes = \get_block_wrapper_attributes();

// //
// //
// $tag_name = empty( $attributes['tagName'] ) ? 'pre' : $attributes['tagName'];
// return sprintf(
// '<%1$s %2$s>%3$s</%1$s>',
Expand All @@ -82,12 +82,12 @@ function( $link ) use ( $attributes )

// @todo #25
// we have this string-cleaning now 3 times
//
//
// - plugins\ft-network-sourcelinks\src\block-editor\blocks\filtered-links\index.php#L90
// - plugins\ft-network-sourcelinks\inc\Network\Post_Types\Post_Type__ft_link.php#L330
// - plugins\ft-network-sourcelinks\inc\Network\Options\Preset__wpseo_social.php#L142
//
//
//
//
// cleanup html
// especially from wp_auto_p
$_url = \wp_kses( $link->post_content, [] );
Expand Down Expand Up @@ -115,7 +115,7 @@ function( $link ) use ( $attributes )
$links
) );

//
//
return sprintf(
'<%1$s %2$s>%3$s</%1$s>',
$tag_name,
Expand All @@ -130,7 +130,7 @@ function get_relevant_links( string $slug )

$link_category = Taxonomies\Taxonomy__link_category::NAME;

//
//
return $query->find_many_by_type(
Post_Types\Post_Type__ft_link::NAME,
'publish',
Expand Down
8 changes: 4 additions & 4 deletions src/block-editor/blocks/simple-links/edit.js.BU
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const getHostnameFromRegex = ( url ) => {
/**
* [buildBlock description]
*
* Normally the 'ft_link' posttype lacks of the
* Normally the 'ft_link' posttype lacks of the
* normal args 'content', because its pt definition
* doesn't define 'Editor' as pt support.
*
Expand Down Expand Up @@ -72,7 +72,7 @@ const buildBlock = ( post ) =>
} ];
}


// // GET
// apiFetch( { path: '/wp/v2/ft_link' } ).then( ( posts ) => {
// console.log( posts );
Expand All @@ -84,7 +84,7 @@ wp.domReady( function() {
});
*/




/**
Expand All @@ -106,7 +106,7 @@ async get_inner_link_blocks() {

const query_args = {
// path: '/wp/v2/ft_link', // with apiFetch
data: {
data: {
per_page: 25, // beware of the 5 'posts_per_page' default
// status: "publish",
}
Expand Down
Loading

0 comments on commit 9cb3cd7

Please sign in to comment.