Skip to content

Commit d69bdf6

Browse files
authored
release: fixes
- Updated dependencies
2 parents 6f3a22d + 3efc3c4 commit d69bdf6

6 files changed

Lines changed: 45 additions & 59 deletions

File tree

.github/workflows/create-build-zip.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: |
2626
echo "::set-output name=dir::$(composer config cache-files-dir)"
2727
- name: Configure Composer cache
28-
uses: actions/cache@v1
28+
uses: actions/cache@v4
2929
with:
3030
path: ${{ steps.composer-cache.outputs.dir }}
3131
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -103,4 +103,4 @@ jobs:
103103
comment-id: ${{ steps.find-comment.outputs.comment-id }}
104104
token: ${{ secrets.BOT_TOKEN }}
105105
edit-mode: replace
106-
body: ${{ steps.get-comment-body.outputs.body }}
106+
body: ${{ steps.get-comment-body.outputs.body }}

.github/workflows/test-js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Get yarn cache directory path
2323
id: yarn-cache-dir-path
2424
run: echo "::set-output name=dir::$(yarn cache dir)"
25-
- uses: actions/cache@v2
25+
- uses: actions/cache@v4
2626
id: yarn-cache
2727
with:
2828
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@@ -34,4 +34,4 @@ jobs:
3434
- name: Build source
3535
run: yarn run build
3636
- name: Run lint checks
37-
run: yarn run lint
37+
run: yarn run lint

.github/workflows/test-php.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ name: Test PHP
33
on:
44
push:
55
branches-ignore:
6-
- 'master'
6+
- "master"
77

88
jobs:
99
phplint:
1010
name: Phplint
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
steps:
1313
- name: Setup PHP version
1414
uses: shivammathur/setup-php@v2
1515
with:
16-
php-version: '7.2'
16+
php-version: "7.2"
1717
extensions: simplexml
1818
- name: Checkout source code
1919
uses: actions/checkout@v2
@@ -22,7 +22,7 @@ jobs:
2222
run: |
2323
echo "::set-output name=dir::$(composer config cache-files-dir)"
2424
- name: Setup Composer cache
25-
uses: actions/cache@v1
25+
uses: actions/cache@v4
2626
with:
2727
path: ${{ steps.composer-cache.outputs.dir }}
2828
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -34,7 +34,7 @@ jobs:
3434
run: composer run lint
3535
phpunit:
3636
name: Phpunit
37-
runs-on: ubuntu-latest
37+
runs-on: ubuntu-22.04
3838
services:
3939
mysql:
4040
image: mysql:5.7
@@ -47,7 +47,7 @@ jobs:
4747
- name: Setup PHP version
4848
uses: shivammathur/setup-php@v2
4949
with:
50-
php-version: '7.2'
50+
php-version: "7.2"
5151
extensions: simplexml, mysql
5252
tools: phpunit-polyfills
5353
- name: Checkout source code
@@ -60,7 +60,7 @@ jobs:
6060
run: |
6161
echo "::set-output name=dir::$(composer config cache-files-dir)"
6262
- name: Setup Composer cache
63-
uses: actions/cache@v1
63+
uses: actions/cache@v4
6464
with:
6565
path: ${{ steps.composer-cache.outputs.dir }}
6666
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -69,4 +69,4 @@ jobs:
6969
- name: Install composer
7070
run: composer install --prefer-dist --no-progress --no-suggest
7171
- name: Run phpunit
72-
run: composer run-script phpunit
72+
run: composer run-script phpunit

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ function define_constants() {
7171
define( 'FORK_DEBUG', defined( 'WP_DEBUG' ) && WP_DEBUG === true );
7272
define( 'FORK_DIR', trailingslashit( get_template_directory() ) );
7373
define( 'FORK_URL', trailingslashit( get_template_directory_uri() ) );
74+
define( 'FORK_PRODUCT_SLUG', basename( FORK_DIR ) );
7475
}
7576

7677
/**

inc/Admin.php

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function setup_admin_hooks() {
3333
add_action( 'admin_notices', array( $this, 'render_welcome_notice' ), 0 );
3434
add_action( 'wp_ajax_fork_dismiss_welcome_notice', array( $this, 'remove_welcome_notice' ) );
3535
add_action( 'wp_ajax_fork_set_otter_ref', array( $this, 'set_otter_ref' ) );
36-
add_action( 'admin_print_scripts', array( $this, 'add_nps_form' ) );
36+
add_action( 'admin_enqueue_scripts', array( $this, 'register_internal_page' ) );
3737

3838
add_action( 'enqueue_block_editor_assets', array( $this, 'add_fse_design_pack_notice' ) );
3939
add_action( 'wp_ajax_fork_dismiss_design_pack_notice', array( $this, 'remove_design_pack_notice' ) );
@@ -307,50 +307,35 @@ private function get_otter_status(): string {
307307
}
308308

309309
/**
310-
* Add NPS form.
310+
* Register internal pages.
311311
*
312312
* @return void
313313
*/
314-
public function add_nps_form() {
314+
public function register_internal_page() {
315315
$screen = get_current_screen();
316-
317-
if ( current_user_can( 'manage_options' ) && ( 'dashboard' === $screen->id || 'themes' === $screen->id ) ) {
318-
$website_url = preg_replace( '/[^a-zA-Z0-9]+/', '', get_site_url() );
319-
320-
$config = array(
321-
'environmentId' => 'clr7hsvmjeu0u8up04ydg210b',
322-
'apiHost' => 'https://app.formbricks.com',
323-
'userId' => 'fork_' . $website_url,
324-
'attributes' => array(
325-
'days_since_install' => self::convert_to_category( round( ( time() - get_option( 'fork_install', time() ) ) / DAY_IN_SECONDS ) ),
326-
),
327-
);
328-
329-
echo '<script type="text/javascript">!function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src="https://unpkg.com/@formbricks/js@^1.6.5/dist/index.umd.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e),setTimeout(function(){window.formbricks.init(' . wp_json_encode( $config ) . ')},500)}();</script>';
316+
317+
if ( ! current_user_can( 'manage_options' ) || ( 'dashboard' !== $screen->id && 'themes' !== $screen->id ) ) {
318+
return;
330319
}
331-
}
320+
321+
add_filter(
322+
'themeisle-sdk/survey/' . FORK_PRODUCT_SLUG,
323+
function( $data, $page_slug ) {
324+
$install_days_number = intval( ( time() - get_option( 'fork_install', time() ) ) / DAY_IN_SECONDS );
325+
326+
$data = array(
327+
'environmentId' => 'clr7hsvmjeu0u8up04ydg210b',
328+
'attributes' => array(
329+
'install_days_number' => $install_days_number,
330+
'version' => FORK_VERSION,
331+
),
332+
);
332333

333-
/**
334-
* Convert a number to a category.
335-
*
336-
* @param int $number Number to convert.
337-
* @param int $scale Scale.
338-
*
339-
* @return int
340-
*/
341-
public static function convert_to_category( $number, $scale = 1 ) {
342-
$normalized_number = intval( round( $number / $scale ) );
343-
344-
if ( 0 === $normalized_number || 1 === $normalized_number ) {
345-
return 0;
346-
} elseif ( $normalized_number > 1 && $normalized_number < 8 ) {
347-
return 7;
348-
} elseif ( $normalized_number >= 8 && $normalized_number < 31 ) {
349-
return 30;
350-
} elseif ( $normalized_number > 30 && $normalized_number < 90 ) {
351-
return 90;
352-
} elseif ( $normalized_number > 90 ) {
353-
return 91;
354-
}
334+
return $data;
335+
},
336+
10,
337+
2
338+
);
339+
do_action( 'themeisle_internal_page', FORK_PRODUCT_SLUG, $screen->id );
355340
}
356341
}

0 commit comments

Comments
 (0)