Skip to content

Commit

Permalink
added config and translate text support
Browse files Browse the repository at this point in the history
  • Loading branch information
hmbashar committed Nov 2, 2024
1 parent 11f02ee commit 46d7239
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 14 deletions.
45 changes: 45 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# A set of files you probably don't want in your WordPress.org distribution
.babelrc
.deployignore
.distignore
.editorconfig
.eslintignore
.eslintrc
.git
.github
.gitattributes
.gitignore
.gitlab-ci.yml
.travis.yml
.DS_Store
Thumbs.db
behat.yml
bitbucket-pipelines.yml
bin
.circleci/config.yml
composer.lock
dependencies.yml
Gruntfile.js
package.json
package-lock.json
phpunit.xml
phpunit.xml.dist
multisite.xml
multisite.xml.dist
.phpcs.xml
phpcs.xml
.phpcs.xml.dist
phpcs.xml.dist
README.md
webpack.config.js
wp-cli.local.yml
yarn.lock
tests
node_modules
*.sql
*.tar.gz
*.zip
/src
build
postcss.config.js
.wordpress-org
44 changes: 44 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.babelrc export-ignore
.deployignore export-ignore
.distignore export-ignore
.editorconfig export-ignore
.eslintignore export-ignore
.eslintrc export-ignore
.git export-ignore
.github export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.gitlab-ci.yml export-ignore
.travis.yml export-ignore
.DS_Store export-ignore
.wordpress-org export-ignore
Thumbs.db export-ignore
behat.yml export-ignore
bitbucket-pipelines.yml export-ignore
bin/ export-ignore
.circleci/config.yml export-ignore
composer.lock export-ignore
dependencies.yml export-ignore
Gruntfile.js export-ignore
package.json export-ignore
package-lock.json export-ignore
phpunit.xml export-ignore
phpunit.xml.dist export-ignore
multisite.xml export-ignore
multisite.xml.dist export-ignore
.phpcs.xml export-ignore
phpcs.xml export-ignore
.phpcs.xml.dist export-ignore
phpcs.xml.dist export-ignore
README.md export-ignore
webpack.config.js export-ignore
wp-cli.local.yml export-ignore
yarn.lock export-ignore
tests/ export-ignore
node_modules/ export-ignore
*.sql export-ignore
*.tar.gz export-ignore
*.zip export-ignore
/src/ export-ignore
build/ export-ignore
postcss.config.js export-ignore
18 changes: 18 additions & 0 deletions .github/workflows/deploy-on-pushing-plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Deploy to WordPress.org
on:
push:
tags:
- "*"
jobs:
tag:
name: Deploy to WordPress.org
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: wc-order-tracker

16 changes: 16 additions & 0 deletions .github/workflows/deploy-readme-asset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Plugin asset/readme update
on:
push:
branches:
- trunk
jobs:
trunk:
name: Plugin asset/readme update
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: WordPress.org plugin asset/readme update
uses: 10up/action-wordpress-plugin-asset-update@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

*.DS_Store
vendor
node_modules
Binary file added .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"features": {
"networking": true
},
"steps": [
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "woocommerce"
},
"options": {
"activate": true
}
},
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "wc-order-tracker"
},
"options": {
"activate": true
}
}
]
}
Binary file added .wordpress-org/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions inc/custom.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,17 @@ function cbwct_tracker_load_tamplate( $template ) {
// Register a custom order status
add_action('init', 'cbwct_register_custom_order_statuses');
function cbwct_register_custom_order_statuses() {
register_post_status('wc-shipped ', array(
'label' => __( 'Shipped', 'woocommerce' ),
register_post_status('wc-shipped', array(
'label' => __( 'Shipped', 'cbwet' ),
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop('Shipped <span class="count">(%s)</span>', 'Shipped <span class="count">(%s)</span>')
'label_count' => _n_noop(
'Shipped <span class="count">(%s)</span>',
'Shipped <span class="count">(%s)</span>',
'cbwet'
)
));
}

Expand All @@ -186,7 +190,7 @@ function cbwct_add_custom_order_statuses($order_statuses) {
foreach ($order_statuses as $key => $status) {
$new_order_statuses[$key] = $status;
if ('wc-processing' === $key) {
$new_order_statuses['wc-shipped'] = __('Shipped', 'woocommerce' );
$new_order_statuses['wc-shipped'] = __('Shipped', 'cbwet' );
}
}
return $new_order_statuses;
Expand All @@ -201,7 +205,7 @@ function cbwct_custom_dropdown_bulk_actions_shop_order( $actions ) {
// add new order status before processing
foreach ($actions as $key => $action) {
if ('mark_processing' === $key)
$new_actions['mark_shipped'] = __( 'Change status to shipped', 'woocommerce' );
$new_actions['mark_shipped'] = __( 'Change status to shipped', 'cbwet' );

$new_actions[$key] = $action;
}
Expand All @@ -220,7 +224,7 @@ function cbwct_add_custom_order_status_actions_button( $actions, $order ) {
// Set the action button
$actions[$action_slug] = array(
'url' => wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_mark_order_status&status='.$action_slug.'&order_id='.$order->get_id() ), 'woocommerce-mark-order-status' ),
'name' => __( 'Shipped', 'woocommerce' ),
'name' => __( 'Shipped', 'cbwet' ),
'action' => $action_slug,
);
}
Expand Down
30 changes: 22 additions & 8 deletions inc/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ function cbwct_submit_button_text(){


// Order and Phone number is required
function cbwct_order_number_phone_number_required(){
printf('%s Order Number & Phone field is required %s', '<h3 class="cbwct_notice">', '</h3>');
function cbwct_order_number_phone_number_required() {
// Return the formatted string with translation support
return sprintf(
'<h3 class="cbwct_notice">%s</h3>',
esc_html__('Order Number & Phone field is required', 'cbwet')
);
}
add_filter( 'cbwct_order_number_phone_number_required', 'cbwct_order_number_phone_number_required');
add_filter('cbwct_order_number_phone_number_required', 'cbwct_order_number_phone_number_required');


// set limit for showing title in tracking page
function cbwct_product_title_trim_words($value) {
Expand All @@ -54,9 +59,18 @@ function cbwct_shipped_prograss_percent() {


function cbwct_order_is_not_found($value, $order_number) {

$order_not_found = sprintf('%s Oops! Sorry! %s order is not found! please check order or phone number %s', '<h5 class="cbwct_notice">', esc_attr($order_number), '</h5>');

return $order_not_found;
// Return the formatted string with translation support
$order_not_found = sprintf(
'%s %s %s %s',
'<h5 class="cbwct_notice">',
esc_html__('Oops! Sorry!', 'cbwet'),
sprintf(
esc_html__('%s order is not found! Please check order or phone number.', 'cbwet'),
esc_html($order_number)
),
'</h5>'
);

return $order_not_found;
}
add_filter('cbwct_order_is_not_found', 'cbwct_order_is_not_found', 10, 2);
add_filter('cbwct_order_is_not_found', 'cbwct_order_is_not_found', 10, 2);

0 comments on commit 46d7239

Please sign in to comment.