Skip to content

Commit

Permalink
Update from vk-blocks-pro
Browse files Browse the repository at this point in the history
  • Loading branch information
vektorinc committed Jun 24, 2024
1 parent fc9e444 commit 7461889
Show file tree
Hide file tree
Showing 62 changed files with 1,883 additions and 4,403 deletions.
2 changes: 1 addition & 1 deletion .phpunit.result.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":1,"defects":[],"times":{"Test_PHP_Fatal_Error::test_run_php_fatal_error":0.148,"PageContentBlockTest::test_page_content":0.02,"VKBSpacerTest::test_vk_blocks_get_spacer_size":0.001,"VKBSpacerTest::test_vk_blocks_is_size_print":0.001,"VKBSpacerTest::test_vk_blocks_get_spacer_size_style":0.001,"VKBSpacerTest::test_vk_blocks_get_spacer_size_style_all":0.001,"TestVKBlocksIsPro::test_vk_blocks_minify_css":0.001}}
{"version":1,"defects":[],"times":{"Test_PHP_Fatal_Error::test_run_php_fatal_error":0.156,"PageContentBlockTest::test_page_content":0.019,"VKBSpacerTest::test_vk_blocks_get_spacer_size":0.001,"VKBSpacerTest::test_vk_blocks_is_size_print":0.001,"VKBSpacerTest::test_vk_blocks_get_spacer_size_style":0.001,"VKBSpacerTest::test_vk_blocks_get_spacer_size_style_all":0.001,"TestVKBlocksIsPro::test_vk_blocks_minify_css":0.001}}
1 change: 1 addition & 0 deletions inc/vk-blocks/admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ function vk_blocks_setting_page() {
if ( vk_blocks_is_license_setting() ) {
$get_menu_html .= '<li><a href="#license-setting">' . __( 'License Key', 'vk-blocks' ) . '</a></li>';
}
$get_menu_html .= '<li><a href="#block-category-position-setting">' . __( 'Block Category Position Setting', 'vk-blocks' ) . '</a></li>';
$get_menu_html .= '<li><a href="#balloon-setting">' . __( 'Balloon Block Setting', 'vk-blocks' ) . '</a></li>';
if ( vk_blocks_is_pro() ) {
$get_menu_html .= '<li><a href="#custom-format-setting">' . __( 'Custom Format Setting', 'vk-blocks' ) . '</a></li>';
Expand Down
61 changes: 23 additions & 38 deletions inc/vk-blocks/view/class-vk-blocks-postlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,32 @@ public static function get_loop_query( $attributes ) {
$all_posts = array_merge( $all_posts, $temp_query->posts );
}

usort(
$all_posts,
function ( $a, $b ) use ( $attributes ) {
if ( 'date' === $attributes['orderby'] ) {
if ( 'ASC' === $attributes['order'] ) {
return strtotime( $a->post_date ) - strtotime( $b->post_date );
if ( 'rand' === $attributes['orderby'] ) {
shuffle( $all_posts );
} else {
usort(
$all_posts,
function ( $a, $b ) use ( $attributes ) {
if ( 'date' === $attributes['orderby'] ) {
if ( 'ASC' === $attributes['order'] ) {
return strtotime( $a->post_date ) - strtotime( $b->post_date );
} else {
return strtotime( $b->post_date ) - strtotime( $a->post_date );
}
} elseif ( 'modified' === $attributes['orderby'] ) {
if ( 'ASC' === $attributes['order'] ) {
return strtotime( $a->post_modified ) - strtotime( $b->post_modified );
} else {
return strtotime( $b->post_modified ) - strtotime( $a->post_modified );
}
} elseif ( 'title' === $attributes['orderby'] ) {
return strcmp( $a->post_title, $b->post_title ) * ( 'ASC' === $attributes['order'] ? 1 : -1 );
} else {
return strtotime( $b->post_date ) - strtotime( $a->post_date );
return 0;
}
} elseif ( 'title' === $attributes['orderby'] ) {
return strcmp( $a->post_title, $b->post_title ) * ( 'ASC' === $attributes['order'] ? 1 : -1 );
} else {
return 0;
}
}
);
);
}

$all_posts = array_slice( $all_posts, $offset, intval( $attributes['numberPosts'] ) );

Expand Down Expand Up @@ -272,31 +282,6 @@ public static function get_loop_query_child( $attributes ) {
'offset' => $offset,
'post__not_in' => $post__not_in,
);

// Add tax_query.
$tax_query = array();
$checked_terms = json_decode( $attributes['isCheckedTerms'], true );

if ( ! empty( $checked_terms ) ) {
foreach ( $checked_terms as $term_id ) {
$term = get_term( $term_id );
if ( $term ) {
$tax_query[] = array(
'taxonomy' => $term->taxonomy,
'field' => 'term_id',
'terms' => $term_id,
);
}
}
}

if ( ! empty( $tax_query ) ) {
$args['tax_query'] = array(
'relation' => $attributes['taxQueryRelation'],
$tax_query,
);
}

return new WP_Query( $args );
} else {
return false;
Expand Down
46 changes: 10 additions & 36 deletions languages/vk-blocks-pro-js.pot
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ msgstr ""
#: src/admin/custom-format/index.js:203
#: src/blocks/_pro/step-item/edit.js:105
#: src/blocks/_pro/timeline-item/edit.js:71
#: src/blocks/border-box/edit.js:233
#: src/blocks/border-box/edit.js:236
#: src/blocks/button/edit.js:677
#: src/blocks/icon/edit.js:299
#: src/blocks/staff/edit.js:199
Expand All @@ -321,7 +321,7 @@ msgstr ""
#: src/admin/custom-format/index.js:239
#: src/blocks/_pro/grid-column-item/edit.js:110
#: src/blocks/_pro/gridcolcard/edit-common.js:172
#: src/blocks/border-box/edit.js:245
#: src/blocks/border-box/edit.js:248
#: src/blocks/button/edit.js:732
#: src/blocks/icon/edit.js:304
msgid "Background Color"
Expand Down Expand Up @@ -1507,7 +1507,7 @@ msgid "Border Width"
msgstr ""

#: src/blocks/_pro/gridcolcard/edit-common.js:209
#: src/blocks/border-box/edit.js:236
#: src/blocks/border-box/edit.js:239
#: src/extensions/core/group/style.js:46
msgid "Border Color"
msgstr ""
Expand Down Expand Up @@ -1564,9 +1564,6 @@ msgstr ""
#: src/blocks/_pro/icon-card-item/deprecated/0.49.8/component.js:71
#: src/blocks/_pro/icon-card-item/deprecated/0.60.1/component.js:85
#: src/blocks/_pro/icon-card-item/edit.js:197
#: src/blocks/pr-blocks/deprecated/0.0.1/component.js:148
#: src/blocks/pr-blocks/deprecated/0.0.2/component.js:176
#: src/blocks/pr-blocks/deprecated/0.59.0/component.js:191
#: src/blocks/pr-blocks/edit.js:534
msgid "Input Title"
msgstr ""
Expand All @@ -1576,9 +1573,6 @@ msgstr ""
#: src/blocks/_pro/icon-card-item/deprecated/0.49.8/component.js:78
#: src/blocks/_pro/icon-card-item/deprecated/0.60.1/component.js:106
#: src/blocks/_pro/icon-card-item/edit.js:219
#: src/blocks/pr-blocks/deprecated/0.0.1/component.js:157
#: src/blocks/pr-blocks/deprecated/0.0.2/component.js:185
#: src/blocks/pr-blocks/deprecated/0.59.0/component.js:200
#: src/blocks/pr-blocks/edit.js:543
msgid "Input Content"
msgstr ""
Expand All @@ -1589,7 +1583,7 @@ msgstr ""

#: src/blocks/_pro/icon-card-item/edit.js:137
#: src/blocks/_pro/step-item/edit.js:82
#: src/blocks/border-box/edit.js:269
#: src/blocks/border-box/edit.js:272
#: src/blocks/button/edit.js:760
#: src/blocks/heading/edit.js:335
#: src/blocks/icon/edit.js:276
Expand Down Expand Up @@ -2347,11 +2341,11 @@ msgstr ""
msgid "HTML element of the title"
msgstr ""

#: src/blocks/border-box/edit.js:255
#: src/blocks/border-box/edit.js:258
msgid "Transparent"
msgstr ""

#: src/blocks/border-box/edit.js:259
#: src/blocks/border-box/edit.js:262
msgid "White"
msgstr ""

Expand Down Expand Up @@ -2602,34 +2596,14 @@ msgstr ""
msgid "Input content"
msgstr ""

#: src/blocks/heading/deprecated/0.24.1/component.js:117
#: src/blocks/heading/deprecated/0.24.4/component.js:80
#: src/blocks/heading/deprecated/0.24.5/component.js:117
#: src/blocks/heading/deprecated/0.24.6/component.js:117
#: src/blocks/heading/deprecated/0.24.7/component.js:117
#: src/blocks/heading/deprecated/0.37.1/component.js:122
#: src/blocks/heading/deprecated/0.39.5/component.js:152
#: src/blocks/heading/deprecated/0.40.0/component.js:152
#: src/blocks/heading/deprecated/0.40.1/component.js:152
#: src/blocks/heading/deprecated/0.60.1/component.js:152
#: src/blocks/heading/edit.js:229
msgid "Input sub text…"
msgstr ""

#: src/blocks/heading/deprecated/0.24.1/component.js:98
#: src/blocks/heading/deprecated/0.24.4/component.js:61
#: src/blocks/heading/deprecated/0.24.5/component.js:98
#: src/blocks/heading/deprecated/0.24.6/component.js:98
#: src/blocks/heading/deprecated/0.24.7/component.js:98
#: src/blocks/heading/deprecated/0.37.1/component.js:109
#: src/blocks/heading/deprecated/0.39.5/component.js:137
#: src/blocks/heading/deprecated/0.40.0/component.js:137
#: src/blocks/heading/deprecated/0.40.1/component.js:137
#: src/blocks/heading/deprecated/0.60.1/component.js:137
#: src/blocks/heading/edit.js:214
msgid "Input title…"
msgstr ""

#: src/blocks/heading/edit.js:229
msgid "Input sub text…"
msgstr ""

#: src/blocks/heading/edit.js:257
msgid "Heading style"
msgstr ""
Expand Down
Loading

0 comments on commit 7461889

Please sign in to comment.