Server IP : 192.158.238.246 / Your IP : 18.119.29.162 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/cwd/plugins/give/src/DonationForms/V2/ListTable/Columns/ |
Upload File : |
<?php declare(strict_types=1); namespace Give\DonationForms\V2\ListTable\Columns; use Give\DonationForms\V2\Models\DonationForm; use Give\Framework\ListTable\ModelColumn; /** * @since 2.24.0 * * @extends ModelColumn<DonationForm> */ class GoalColumn extends ModelColumn { /** * @since 2.24.0 * * @inheritDoc */ public static function getId(): string { return 'goal'; } /** * @since 2.24.0 * * @inheritDoc */ public function getLabel(): string { return __('Goal', 'give'); } /** * @since 3.16.0 Remove "give_get_form_earnings_stats" filter logic and add filters to change the cell value content * @since 3.14.0 Use the "give_get_form_earnings_stats" filter to ensure the correct value will be displayed in the form progress bar * @since 2.24.0 * * @inheritDoc * * @param DonationForm $model */ public function getCellValue($model): string { if ( ! $model->goalOption) { return __('No Goal Set', 'give'); } $goal = give_goal_progress_stats($model->id); $goalPercentage = ('percentage' === $goal['format']) ? str_replace('%', '', $goal['actual']) : max(min($goal['progress'], 100), 0); $template = ' <div role="progressbar" aria-labelledby="giveDonationFormsProgressBar-%1$d" aria-valuenow="%2$s" aria-valuemin="0" aria-valuemax="100" class="goalProgress" > <span style="width: %2$s%%"></span> </div> <div id="giveDonationFormsProgressBar-%1$d"> <span class="goal">%3$s</span>%4$s %5$s </div> '; return sprintf( $template, $model->id, $goalPercentage, $goal['actual'], sprintf( ($goal['format'] !== 'percentage' ? ' %s %s' : ''), __('of', 'give'), $goal['goal'] ), sprintf( '<span style="opacity:%1$s" class="goalProgress--achieved"><img src="%2$s" alt="%3$s" />%4$s</span>', apply_filters('givewp_list_table_goal_progress_achieved_opacity', $goal['progress'] >= 100 ? 1 : 0), GIVE_PLUGIN_URL . 'assets/dist/images/list-table/star-icon.svg', __('Goal achieved icon', 'give'), __('Goal achieved!', 'give') ) ); } }