Plugin Directory

Changeset 3339941


Ignore:
Timestamp:
08/06/2025 12:43:08 AM (7 months ago)
Author:
visualwebs
Message:

Little fixings

Location:
visualwebs-ml
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • visualwebs-ml/tags/5.4.3/includes/class-visualwebs-ml-semantic-search-queue-table.php

    r3319473 r3339941  
    270270            if ( 'enabled' === $filter ) {
    271271                $where .= $wpdb->prepare( ' AND job_status = %d', 1 );
     272            } elseif ( 'pending' === $filter ) {
     273                $where .= $wpdb->prepare( ' AND job_sync_status = %d', 0 );
    272274            } elseif ( 'synced' === $filter ) {
    273275                $where .= $wpdb->prepare( ' AND job_sync_status = %d', 1 );
     
    471473        $filters = array(
    472474            'all'     => 'All',
     475            'pending' => 'Pending',
    473476            'enabled' => 'Enabled',
    474477            'synced'  => 'Synced',
     
    681684        $current_url = remove_query_arg( array( 'paged', '_wpnonce' ), $current_url );
    682685
     686        if ( ! empty( $columns['cb'] ) ) {
     687            static $cb_counter = 1;
     688            $columns['cb']     = '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />
     689            <label for="cb-select-all-' . $cb_counter . '">' .
     690                '<span class="screen-reader-text">' .
     691                    /* translators: Hidden accessibility text. */
     692                    __( 'Select All' ) .
     693                '</span>' .
     694                '</label>';
     695            ++$cb_counter;
     696        }
     697
    683698        foreach ( $columns as $column_key => $column_display_name ) {
    684             $class = array( 'manage-column', "column-$column_key" );
     699            $class          = array( 'manage-column', "column-$column_key" );
     700            $aria_sort_attr = '';
     701            $abbr_attr      = '';
     702            $order_text     = '';
     703
     704            if ( in_array( $column_key, $hidden, true ) ) {
     705                $class[] = 'hidden';
     706            }
     707
     708            if ( 'cb' === $column_key ) {
     709                $class[] = 'check-column';
     710            } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
     711                $class[] = 'num';
     712            }
     713
     714            if ( $column_key === $primary ) {
     715                $class[] = 'column-primary';
     716            }
    685717
    686718            if ( isset( $sortable[ $column_key ] ) ) {
    687719                $orderby = $sortable[ $column_key ][0];
    688720
     721                // Add sanitization and validation.
    689722                if ( isset( $_GET['orderby'] ) || isset( $_GET['order'] ) ) {
    690723                    check_admin_referer( 'visualwebs-ml-semantic-queue' );
     
    706739
    707740                $column_display_name = sprintf(
    708                     '<a href="%1$s"><span>%2$s</span></a>',
     741                    '<a href="%1$s">' .
     742                        '<span>%2$s</span>' .
     743                        '<span class="sorting-indicators">' .
     744                            '<span class="sorting-indicator asc" aria-hidden="true"></span>' .
     745                            '<span class="sorting-indicator desc" aria-hidden="true"></span>' .
     746                        '</span>' .
     747                        '%3$s' .
     748                    '</a>',
    709749                    esc_url( $sort_url ),
    710                     $column_display_name
     750                    $column_display_name,
     751                    $order_text
    711752                );
    712                 $class[]             = 'sortable';
    713             }
    714 
    715             printf(
    716                 '<th scope="col" id="%1$s" class="%2$s">%3$s</th>',
    717                 esc_attr( $column_key ),
    718                 esc_attr( implode( ' ', $class ) ),
    719                 wp_kses_post( $column_display_name )
    720             );
     753
     754                $class[] = 'sortable';
     755            }
     756
     757            $tag   = ( 'cb' === $column_key ) ? 'td' : 'th';
     758            $scope = ( 'th' === $tag ) ? 'scope="col"' : '';
     759            $id    = $with_id ? "id='$column_key'" : '';
     760
     761            if ( ! empty( $class ) ) {
     762                $class = "class='" . implode( ' ', $class ) . "'";
     763            }
     764
     765            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     766            echo "<$tag $scope $id $class $aria_sort_attr $abbr_attr>$column_display_name</$tag>";
    721767        }
    722768    }
  • visualwebs-ml/tags/5.4.3/vendor/visualwebs-ml/Helper/Data.php

    r3337157 r3339941  
    372372
    373373        if (is_product_category() || is_category() || $category) {
    374             $category = $category ?: get_queried_object();
    375             $categoryName = $category->name;
     374            $category            = $category ?: get_queried_object();
     375            $categoryName        = $category->name;
    376376            $categoryDescription = '';
    377             $taxonomy = $category->taxonomy;
     377            $taxonomy            = $category->taxonomy;
    378378
    379379            $term = get_term($category->term_id, $taxonomy);
    380             if ($term && !is_wp_error($term)) {
     380            if ($term && ! is_wp_error($term)) {
    381381                $categoryDescription = apply_filters('term_description', $term->description);
    382382                $categoryDescription = do_shortcode($categoryDescription);
     
    384384
    385385            if ($categoryDescription) {
    386 
     386                $url = get_term_link($category);
    387387                if ($isSemanticCall) {
    388                     return $categoryDescription;
    389                 }
    390 
     388                    return $categoryDescription . "\nFrontend URL for the category: $url";
     389                }
    391390                if ($taxonomy == 'product_cat') {
    392391                    return sprintf(
    393                         'This page contains a listing of products for the category "%s" with this description: "%s".',
     392                        'This page contains a listing of products for the category "%s" with this description: "%s". Frontend URL for the category: %s',
    394393                        $categoryName,
    395                         $categoryDescription
     394                        $categoryDescription,
     395                        $url
    396396                    );
    397397                } else {
    398398                    return sprintf(
    399                         'This page contains a listing of posts for the category "%s" with this description: "%s".',
     399                        'This page contains a listing of posts for the category "%s" with this description: "%s". Frontend URL for the category: %s',
    400400                        $categoryName,
    401                         $categoryDescription
     401                        $categoryDescription,
     402                        $url
    402403                    );
    403404                }
     
    415416    protected function getProductDescription($product = null, $withDynamicInfo = true)
    416417    {
    417         if (!$product) {
     418        if (! $product) {
    418419            $product = wc_get_product();
    419420        }
    420421
    421         if (!$product) {
     422        if (! $product) {
    422423            return '';
    423424        }
    424425
    425         if (!$product instanceof \WC_Product) {
     426        if (! $product instanceof \WC_Product) {
    426427            return '';
    427428        }
     
    441442        // Process content
    442443        $productDescription = '';
    443         $post = get_post($product->get_id());
     444        $post               = get_post($product->get_id());
    444445        if ($post) {
    445446            $productDescription = apply_filters('the_content', $post->post_content);
     
    447448        }
    448449
    449         $sku = $product->get_sku();
    450         $price = wc_price($product->get_price());
     450        $sku        = $product->get_sku();
     451        $price      = wc_price($product->get_price());
    451452        $categories = $this->getCategoryNames($product);
    452453
    453454        // Get stock information
    454         $stockStatus = $product->is_in_stock() ? 'In stock' : 'Out of stock';
     455        $stockStatus   = $product->is_in_stock() ? 'In stock' : 'Out of stock';
    455456        $stockQuantity = $product->get_stock_quantity();
    456         $stockInfo = $stockQuantity !== null ? "Stock quantity: $stockQuantity" : "Stock status: $stockStatus";
     457        $stockInfo     = $stockQuantity !== null ? "Stock quantity: $stockQuantity" : "Stock status: $stockStatus";
    457458
    458459        $description = sprintf(
     
    472473        }
    473474
     475        $frontendAttributes = array();
     476        foreach ($product->get_attributes() as $attribute) {
     477            if ($attribute->get_visible()) {
     478                $label = wc_attribute_label($attribute->get_name());
     479                $value = $product->get_attribute($attribute->get_name());
     480                if (is_string($value) && trim($value) !== '' && strtolower($value) !== 'no') {
     481                    $frontendAttributes[] = "$label: $value";
     482                }
     483            }
     484        }
     485        if ($frontendAttributes) {
     486            $description .= "\nFrontend attributes:\n" . implode("\n", $frontendAttributes);
     487        }
     488
    474489        switch ($productType) {
    475490            case 'simple':
     
    477492
    478493            case 'variable':
    479                 $variations = $product->get_available_variations();
    480                 $variationDescriptions = [];
    481 
     494                $variations            = $product->get_available_variations();
     495                $variationDescriptions = array();
    482496
    483497                foreach ($variations as $variation) {
    484                     $attributes = [];
     498                    $attributes = array();
    485499                    foreach ($variation['attributes'] as $key => $value) {
    486500                        $attributes[] = sprintf('%s: %s', wc_attribute_label($key), $value);
    487501                    }
    488502
    489                     $variationStockStatus = $variation['is_in_stock'] ? 'In stock' : 'Out of stock';
     503                    $variationStockStatus   = $variation['is_in_stock'] ? 'In stock' : 'Out of stock';
    490504                    $variationStockQuantity = isset($variation['max_qty']) ? $variation['max_qty'] : 'N/A';
    491505
     
    501515                }
    502516
    503 
    504517                if ($variationDescriptions) {
    505518                    $description .= ' Available variations: ' . implode(' ', $variationDescriptions);
     
    508521
    509522            case 'grouped':
    510                 $children = $product->get_children();
    511                 $childDescriptions = [];
     523                $children          = $product->get_children();
     524                $childDescriptions = array();
    512525
    513526                foreach ($children as $childId) {
     
    537550            case 'bundle':
    538551                if (method_exists($product, 'get_bundled_items')) {
    539                     $bundledItems = $product->get_bundled_items();
    540                     $bundleDescriptions = [];
     552                    $bundledItems       = $product->get_bundled_items();
     553                    $bundleDescriptions = array();
    541554
    542555                    foreach ($bundledItems as $bundledItem) {
     
    584597            case 'subscription':
    585598                $billingInterval = $product->get_meta('_subscription_period_interval');
    586                 $billingPeriod = $product->get_meta('_subscription_period');
    587                 $trialLength = $product->get_meta('_subscription_trial_length');
    588                 $trialPeriod = $product->get_meta('_subscription_trial_period');
     599                $billingPeriod   = $product->get_meta('_subscription_period');
     600                $trialLength     = $product->get_meta('_subscription_trial_length');
     601                $trialPeriod     = $product->get_meta('_subscription_trial_period');
    589602
    590603                $subscriptionDetails = $withDynamicInfo
     
    613626
    614627            case 'variable-subscription':
    615                 $variations = $product->get_available_variations();
    616                 $variationDescriptions = [];
     628                $variations            = $product->get_available_variations();
     629                $variationDescriptions = array();
    617630
    618631                foreach ($variations as $variation) {
    619                     $variationId = $variation['variation_id'];
     632                    $variationId      = $variation['variation_id'];
    620633                    $variationProduct = wc_get_product($variationId);
    621634
    622635                    $billingInterval = $variationProduct->get_meta('_subscription_period_interval'); // e.g., "1"
    623                     $billingPeriod = $variationProduct->get_meta('_subscription_period'); // e.g., "month", "year"
    624                     $trialLength = $variationProduct->get_meta('_subscription_trial_length'); // e.g., "7"
    625                     $trialPeriod = $variationProduct->get_meta('_subscription_trial_period'); // e.g., "day", "week"
    626 
    627                     $attributes = [];
     636                    $billingPeriod   = $variationProduct->get_meta('_subscription_period'); // e.g., "month", "year"
     637                    $trialLength     = $variationProduct->get_meta('_subscription_trial_length'); // e.g., "7"
     638                    $trialPeriod     = $variationProduct->get_meta('_subscription_trial_period'); // e.g., "day", "week"
     639
     640                    $attributes = array();
    628641                    foreach ($variation['attributes'] as $key => $value) {
    629642                        $attributes[] = sprintf('%s: %s', wc_attribute_label($key), $value);
     
    666679        }
    667680
     681        $frontendUrl  = get_permalink($product->get_id());
     682        $description .= "\nFrontend URL for the product: $frontendUrl";
    668683
    669684        if ($withDynamicInfo) {
     
    694709    protected function getCmsPageContent($page = null)
    695710    {
    696         return $this->getPostContent($page);
     711        $content = $this->getPostContent($page);
     712        if ($page) {
     713            $url = get_permalink($page);
     714        } else {
     715            $queried = get_queried_object();
     716            $url = $queried && isset($queried->ID) ? get_permalink($queried->ID) : '';
     717        }
     718        if ($url) {
     719            $content .= "\nFrontend URL for the page: $url";
     720        }
     721        return $content;
    697722    }
    698723
  • visualwebs-ml/trunk/includes/class-visualwebs-ml-semantic-search-queue-table.php

    r3319473 r3339941  
    270270            if ( 'enabled' === $filter ) {
    271271                $where .= $wpdb->prepare( ' AND job_status = %d', 1 );
     272            } elseif ( 'pending' === $filter ) {
     273                $where .= $wpdb->prepare( ' AND job_sync_status = %d', 0 );
    272274            } elseif ( 'synced' === $filter ) {
    273275                $where .= $wpdb->prepare( ' AND job_sync_status = %d', 1 );
     
    471473        $filters = array(
    472474            'all'     => 'All',
     475            'pending' => 'Pending',
    473476            'enabled' => 'Enabled',
    474477            'synced'  => 'Synced',
     
    681684        $current_url = remove_query_arg( array( 'paged', '_wpnonce' ), $current_url );
    682685
     686        if ( ! empty( $columns['cb'] ) ) {
     687            static $cb_counter = 1;
     688            $columns['cb']     = '<input id="cb-select-all-' . $cb_counter . '" type="checkbox" />
     689            <label for="cb-select-all-' . $cb_counter . '">' .
     690                '<span class="screen-reader-text">' .
     691                    /* translators: Hidden accessibility text. */
     692                    __( 'Select All' ) .
     693                '</span>' .
     694                '</label>';
     695            ++$cb_counter;
     696        }
     697
    683698        foreach ( $columns as $column_key => $column_display_name ) {
    684             $class = array( 'manage-column', "column-$column_key" );
     699            $class          = array( 'manage-column', "column-$column_key" );
     700            $aria_sort_attr = '';
     701            $abbr_attr      = '';
     702            $order_text     = '';
     703
     704            if ( in_array( $column_key, $hidden, true ) ) {
     705                $class[] = 'hidden';
     706            }
     707
     708            if ( 'cb' === $column_key ) {
     709                $class[] = 'check-column';
     710            } elseif ( in_array( $column_key, array( 'posts', 'comments', 'links' ), true ) ) {
     711                $class[] = 'num';
     712            }
     713
     714            if ( $column_key === $primary ) {
     715                $class[] = 'column-primary';
     716            }
    685717
    686718            if ( isset( $sortable[ $column_key ] ) ) {
    687719                $orderby = $sortable[ $column_key ][0];
    688720
     721                // Add sanitization and validation.
    689722                if ( isset( $_GET['orderby'] ) || isset( $_GET['order'] ) ) {
    690723                    check_admin_referer( 'visualwebs-ml-semantic-queue' );
     
    706739
    707740                $column_display_name = sprintf(
    708                     '<a href="%1$s"><span>%2$s</span></a>',
     741                    '<a href="%1$s">' .
     742                        '<span>%2$s</span>' .
     743                        '<span class="sorting-indicators">' .
     744                            '<span class="sorting-indicator asc" aria-hidden="true"></span>' .
     745                            '<span class="sorting-indicator desc" aria-hidden="true"></span>' .
     746                        '</span>' .
     747                        '%3$s' .
     748                    '</a>',
    709749                    esc_url( $sort_url ),
    710                     $column_display_name
     750                    $column_display_name,
     751                    $order_text
    711752                );
    712                 $class[]             = 'sortable';
    713             }
    714 
    715             printf(
    716                 '<th scope="col" id="%1$s" class="%2$s">%3$s</th>',
    717                 esc_attr( $column_key ),
    718                 esc_attr( implode( ' ', $class ) ),
    719                 wp_kses_post( $column_display_name )
    720             );
     753
     754                $class[] = 'sortable';
     755            }
     756
     757            $tag   = ( 'cb' === $column_key ) ? 'td' : 'th';
     758            $scope = ( 'th' === $tag ) ? 'scope="col"' : '';
     759            $id    = $with_id ? "id='$column_key'" : '';
     760
     761            if ( ! empty( $class ) ) {
     762                $class = "class='" . implode( ' ', $class ) . "'";
     763            }
     764
     765            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
     766            echo "<$tag $scope $id $class $aria_sort_attr $abbr_attr>$column_display_name</$tag>";
    721767        }
    722768    }
  • visualwebs-ml/trunk/vendor/visualwebs-ml/Helper/Data.php

    r3337157 r3339941  
    372372
    373373        if (is_product_category() || is_category() || $category) {
    374             $category = $category ?: get_queried_object();
    375             $categoryName = $category->name;
     374            $category            = $category ?: get_queried_object();
     375            $categoryName        = $category->name;
    376376            $categoryDescription = '';
    377             $taxonomy = $category->taxonomy;
     377            $taxonomy            = $category->taxonomy;
    378378
    379379            $term = get_term($category->term_id, $taxonomy);
    380             if ($term && !is_wp_error($term)) {
     380            if ($term && ! is_wp_error($term)) {
    381381                $categoryDescription = apply_filters('term_description', $term->description);
    382382                $categoryDescription = do_shortcode($categoryDescription);
     
    384384
    385385            if ($categoryDescription) {
    386 
     386                $url = get_term_link($category);
    387387                if ($isSemanticCall) {
    388                     return $categoryDescription;
    389                 }
    390 
     388                    return $categoryDescription . "\nFrontend URL for the category: $url";
     389                }
    391390                if ($taxonomy == 'product_cat') {
    392391                    return sprintf(
    393                         'This page contains a listing of products for the category "%s" with this description: "%s".',
     392                        'This page contains a listing of products for the category "%s" with this description: "%s". Frontend URL for the category: %s',
    394393                        $categoryName,
    395                         $categoryDescription
     394                        $categoryDescription,
     395                        $url
    396396                    );
    397397                } else {
    398398                    return sprintf(
    399                         'This page contains a listing of posts for the category "%s" with this description: "%s".',
     399                        'This page contains a listing of posts for the category "%s" with this description: "%s". Frontend URL for the category: %s',
    400400                        $categoryName,
    401                         $categoryDescription
     401                        $categoryDescription,
     402                        $url
    402403                    );
    403404                }
     
    415416    protected function getProductDescription($product = null, $withDynamicInfo = true)
    416417    {
    417         if (!$product) {
     418        if (! $product) {
    418419            $product = wc_get_product();
    419420        }
    420421
    421         if (!$product) {
     422        if (! $product) {
    422423            return '';
    423424        }
    424425
    425         if (!$product instanceof \WC_Product) {
     426        if (! $product instanceof \WC_Product) {
    426427            return '';
    427428        }
     
    441442        // Process content
    442443        $productDescription = '';
    443         $post = get_post($product->get_id());
     444        $post               = get_post($product->get_id());
    444445        if ($post) {
    445446            $productDescription = apply_filters('the_content', $post->post_content);
     
    447448        }
    448449
    449         $sku = $product->get_sku();
    450         $price = wc_price($product->get_price());
     450        $sku        = $product->get_sku();
     451        $price      = wc_price($product->get_price());
    451452        $categories = $this->getCategoryNames($product);
    452453
    453454        // Get stock information
    454         $stockStatus = $product->is_in_stock() ? 'In stock' : 'Out of stock';
     455        $stockStatus   = $product->is_in_stock() ? 'In stock' : 'Out of stock';
    455456        $stockQuantity = $product->get_stock_quantity();
    456         $stockInfo = $stockQuantity !== null ? "Stock quantity: $stockQuantity" : "Stock status: $stockStatus";
     457        $stockInfo     = $stockQuantity !== null ? "Stock quantity: $stockQuantity" : "Stock status: $stockStatus";
    457458
    458459        $description = sprintf(
     
    472473        }
    473474
     475        $frontendAttributes = array();
     476        foreach ($product->get_attributes() as $attribute) {
     477            if ($attribute->get_visible()) {
     478                $label = wc_attribute_label($attribute->get_name());
     479                $value = $product->get_attribute($attribute->get_name());
     480                if (is_string($value) && trim($value) !== '' && strtolower($value) !== 'no') {
     481                    $frontendAttributes[] = "$label: $value";
     482                }
     483            }
     484        }
     485        if ($frontendAttributes) {
     486            $description .= "\nFrontend attributes:\n" . implode("\n", $frontendAttributes);
     487        }
     488
    474489        switch ($productType) {
    475490            case 'simple':
     
    477492
    478493            case 'variable':
    479                 $variations = $product->get_available_variations();
    480                 $variationDescriptions = [];
    481 
     494                $variations            = $product->get_available_variations();
     495                $variationDescriptions = array();
    482496
    483497                foreach ($variations as $variation) {
    484                     $attributes = [];
     498                    $attributes = array();
    485499                    foreach ($variation['attributes'] as $key => $value) {
    486500                        $attributes[] = sprintf('%s: %s', wc_attribute_label($key), $value);
    487501                    }
    488502
    489                     $variationStockStatus = $variation['is_in_stock'] ? 'In stock' : 'Out of stock';
     503                    $variationStockStatus   = $variation['is_in_stock'] ? 'In stock' : 'Out of stock';
    490504                    $variationStockQuantity = isset($variation['max_qty']) ? $variation['max_qty'] : 'N/A';
    491505
     
    501515                }
    502516
    503 
    504517                if ($variationDescriptions) {
    505518                    $description .= ' Available variations: ' . implode(' ', $variationDescriptions);
     
    508521
    509522            case 'grouped':
    510                 $children = $product->get_children();
    511                 $childDescriptions = [];
     523                $children          = $product->get_children();
     524                $childDescriptions = array();
    512525
    513526                foreach ($children as $childId) {
     
    537550            case 'bundle':
    538551                if (method_exists($product, 'get_bundled_items')) {
    539                     $bundledItems = $product->get_bundled_items();
    540                     $bundleDescriptions = [];
     552                    $bundledItems       = $product->get_bundled_items();
     553                    $bundleDescriptions = array();
    541554
    542555                    foreach ($bundledItems as $bundledItem) {
     
    584597            case 'subscription':
    585598                $billingInterval = $product->get_meta('_subscription_period_interval');
    586                 $billingPeriod = $product->get_meta('_subscription_period');
    587                 $trialLength = $product->get_meta('_subscription_trial_length');
    588                 $trialPeriod = $product->get_meta('_subscription_trial_period');
     599                $billingPeriod   = $product->get_meta('_subscription_period');
     600                $trialLength     = $product->get_meta('_subscription_trial_length');
     601                $trialPeriod     = $product->get_meta('_subscription_trial_period');
    589602
    590603                $subscriptionDetails = $withDynamicInfo
     
    613626
    614627            case 'variable-subscription':
    615                 $variations = $product->get_available_variations();
    616                 $variationDescriptions = [];
     628                $variations            = $product->get_available_variations();
     629                $variationDescriptions = array();
    617630
    618631                foreach ($variations as $variation) {
    619                     $variationId = $variation['variation_id'];
     632                    $variationId      = $variation['variation_id'];
    620633                    $variationProduct = wc_get_product($variationId);
    621634
    622635                    $billingInterval = $variationProduct->get_meta('_subscription_period_interval'); // e.g., "1"
    623                     $billingPeriod = $variationProduct->get_meta('_subscription_period'); // e.g., "month", "year"
    624                     $trialLength = $variationProduct->get_meta('_subscription_trial_length'); // e.g., "7"
    625                     $trialPeriod = $variationProduct->get_meta('_subscription_trial_period'); // e.g., "day", "week"
    626 
    627                     $attributes = [];
     636                    $billingPeriod   = $variationProduct->get_meta('_subscription_period'); // e.g., "month", "year"
     637                    $trialLength     = $variationProduct->get_meta('_subscription_trial_length'); // e.g., "7"
     638                    $trialPeriod     = $variationProduct->get_meta('_subscription_trial_period'); // e.g., "day", "week"
     639
     640                    $attributes = array();
    628641                    foreach ($variation['attributes'] as $key => $value) {
    629642                        $attributes[] = sprintf('%s: %s', wc_attribute_label($key), $value);
     
    666679        }
    667680
     681        $frontendUrl  = get_permalink($product->get_id());
     682        $description .= "\nFrontend URL for the product: $frontendUrl";
    668683
    669684        if ($withDynamicInfo) {
     
    694709    protected function getCmsPageContent($page = null)
    695710    {
    696         return $this->getPostContent($page);
     711        $content = $this->getPostContent($page);
     712        if ($page) {
     713            $url = get_permalink($page);
     714        } else {
     715            $queried = get_queried_object();
     716            $url = $queried && isset($queried->ID) ? get_permalink($queried->ID) : '';
     717        }
     718        if ($url) {
     719            $content .= "\nFrontend URL for the page: $url";
     720        }
     721        return $content;
    697722    }
    698723
Note: See TracChangeset for help on using the changeset viewer.