�PNG  IHDR22?�� pHYs  �� OiCCPPhotoshop ICC profilexڝSgTS�=���BK���KoR RB���&*! J�!��Q�EEȠ�����Q, � ��!���������{�kּ������>���� �H3Q5� �B�������.@� $p�d!s�#�~<<+"��x� �M��0���B�\���t�8K�@z�B�@F���&S�`�cb�P-`'������{[�!�� e�Dh;��V�EX0fK�9�-0IWfH���� � 0Q��){`�##x��F�W<�+��*x��<�$9E�[-qWW.(�I+6aa�@.�y�2�4���������x����6��_-��"bb���ϫp@�t~��,/��;�m��%�h^ �u��f�@����W�p�~<�5�j>{�-�]c�K'Xt����o��(�h���w��?�G�%�fI�q^D$.Tʳ?�D��*�A��,���� �`6�B$��BB d�r`)��B(�Ͱ*`/�@4�Qh��p.�U�=p�a��(�� A�a!ڈb�X#����!�H�$ ɈQ"K�5H1R�T UH�=r9�\F��;�2����G1���Q=� �C��7�F� �dt1�����r�=�6��Ыhڏ>C�0��3�l0.��B�8, �c˱"� ���V����cϱw�E� 6wB aAHXLXN�H� $4� 7 �Q�'"��K�&���b21�XH,#��/{�C�7$�C2'��I��T��F�nR#�,��4H#���dk�9�, +ȅ����3��!�[ �b@q��S�(R�jJ��4�e�2AU��Rݨ�T5�ZB���R�Q��4u�9̓IK�����hh�i��t�ݕN��W���G���w ��Ljg(�gw��L�Ӌ�T071���oUX*�*|�� �J�&�*/T����ު U�U�T��^S}�FU3S� Ԗ�U��P�SSg�;���g�oT?�~Y��Y�L�OC�Q��_�� c�x,!k ��u�5�&���|v*�����=���9C3J3W�R�f?�q��tN �(���~���)�)�4L�1e\k����X�H�Q�G�6������E�Y��A�J'\'Gg����S�Sݧ �M=:��.�k���Dw�n��^��Lo��y���}/�T�m���G X� $� �<�5qo</���QC]�@C�a�a�ᄑ��<��F�F�i�\�$�m�mƣ&&!&KM�M�RM��)�;L;L���͢�֙5�=1�2��כ߷`ZxZ,����eI��Z�Yn�Z9Y�XUZ]�F���%ֻ�����N�N���gð�ɶ�����ۮ�m�}agbg�Ů��}�}��= ���Z~s�r:V:ޚΜ�?}����/gX���3��)�i�S��Ggg�s�󈋉K��.�>.���Ƚ�Jt�q]�z���������ۯ�6�i�ܟ�4�)�Y3s���C�Q��? ��0k߬~OCO�g��#/c/�W�װ��w��a�>�>r��>�<7�2�Y_�7��ȷ�O�o�_��C#�d�z����%g��A�[��z|!��?:�e����A���AA�������!h�쐭!��Α�i�P~���a�a��~ '���W�?�p�X�1�5w��Cs�D�D�Dޛg1O9�-J5*>�.j<�7�4�?�.fY��X�XIlK9.*�6nl������� �{�/�]py�����.,:�@L�N8��A*��%�w%� y��g"/�6ш�C\*N�H*Mz�쑼5y$�3�,幄'���L Lݛ:��v m2=:�1����qB�!M��g�g�fvˬe����n��/��k���Y- �B��TZ(�*�geWf�͉�9���+��̳�ې7�����ᒶ��KW-X潬j9�������(�x��oʿ�ܔ���Ĺd�f�f���-�[����n �ڴ �V����E�/��(ۻ��C���<��e����;?T�T�T�T6��ݵa��n��{��4���[���>ɾ�UUM�f�e�I���?�������m]�Nmq����#�׹���=TR��+�G�����w- 6 U����#pDy��� �� :�v�{���vg/jB��F�S��[b[�O�>����z�G��499�?r����C�d�&����ˮ/~�����јѡ�򗓿m|������������x31^�V���w�w��O�| (�h���SЧ��������c3-� cHRMz%������u0�`:�o�_�F5IDATx��ytUս�?�;���fN$$��@B�!�k��� -*�gE���j�O�kQ�ʠ`U�B_ �AÐ0%�Ȕ�@r3ޛ;߳��$�@��v����^�s����������$��ߢ !�W��5�̱'-٘������4�>�Rƫ$�G��0U�H}�_ _� #��k�MJ/=�9Du *ڲ�k�PQ;0��j|�*�$�^컂脛y���>�z×� B��� ��(�:$�ʔ_�6��C!B����MVx��a��ζyY����j��ƋY2�9�F�{r��r�딟F��Q��hY6��� x��[l��RC��������nt@��;P��3��� F�w��7��:�P���ɋ'���mj���Bƪ�$�Q�L��y��߷g��\���z����v5�p�v$�v櫻�`6~K �Y�X����,�:��"�o�e0II"(��,������l_�C���/4�+f�E�!q��:����u����c��樼.UE�@� �]K�W���$-�h]�JG���Dz)�`��.�A/ ���mᏣc�3jK� �!�>���$�Q�!�_�? \�C2(E �M$Z I{�U���s�ǣ���=��@Բe ޻��W�����@ �w����}�9v,)��.}*|"�s��di���,���G�]W�AC�������|<����[��ߕ������K�*�G nߴ!��‹��J�!��6(L�a)��Am��������;adf��:�xm��nh�;֦I��(���o�C~ډa?�=��s����h��E������xp����)���_���t��W�����´;8���`dz=(��@@�+,�;�`�fhl��XȌ�3,uI�~z(J����� �ZX�A����H'�À�㜦�82|��a�n�z2��I���� ���EY�h�ε<�0�q�{��C��v�˅��?"@��χ�x�WS+��N�~�KQ�J�8ل�� _.W��� !TU{�����,��"�� �;�������HI S� ��))�o�1�H�D� ���� (� ;����"Ҕ��,���� �F=���O��&�Ph>�`���y��߲ &S��P�<��'��1s�1cĂ�N����2)����@�u��tv��<�+�-&�����h��[!FSG���' � z z0��<����8d&�����E0�,��<��"!P�b4��� �{S�����X����.�囤���T��hEF��X�q0"-<����h���]�Py*����F⩍��@v�˂�Y08�� .q��a��s����(!<̫1�3�L�H��7sYW�`��qtu�\7��?�@�Y�� %Ka�x�GZ�*W�P��y�����N0r9��Z�c�%���q,��k�����!!,��>���IB��� �x1�Xu�Y���v-���ֺ��N������JP��a�2`�e5��w��u;�6�i���̃��(K���ťa��(l51��JL��O'%���]���ٖ뿉!��{*�p+f ���i8��D�ȑ���ܩ�M��V��ӟz��x�7Z�1i}�^͜���6e����x��)u�d�ˏ�V�eG�\�X1�����=n�U'�~Y����L�\,�(d!x ,�:�TW8� M`r���@��r+v�Q0��>^;˴�VbF��('����� �*O��i��j�Ӆ����^�S3&� ���{������.ی�� N;��NU%d0�Ce\r"�C�b��&t7N�7��� �ȪD�[%l�۪�$��'m?�A9tI�9>��NVL ��� 6v~M�����ъ�B���0����9$&=ώm��W�0���L���&��E���f�f��'+�9��hv��7,���M��6�D�&�^� �����8 D֮�����o��k^z��O��hP�8q�5d*��YVq3�{��������#LX4�?��jP=3�~�؅c�ݰ�̱�ұ��8̲��2�G�����j��έ�9��w7���U�X�w�85C��?!I&���o&����L���I#�^�eV�,�^t5�k� �xs˛\��U�8��."���{���ǵ�l4��ݼ�;��r"���G�/~���gJV�N糦��ZZ^k+NN�D��I$�=OE�z����|*�*{��%k���G��>�`9��b;�s���8,�qs��c��.b��q�%�>r��n�R�Ƨ�%�,�A��le#�8���}; 21�0�b�&�QX�f���q�00����$>�h�N�'�a3��A���/�r ��L5�8�GԲ'�����w;��c#�q1���h$*��V^�k��QĽ�b:i������� ����H F#�_���,��]g����Ը����`RUU���� ��"�qD���>-��ϤI�~��3�̴�����NZ[[555�eeek7�m����YF#[��Đ��R��i��L�H�r ��@��J-�Pŝ��_|�-��6y��ks�V�U~��6���w.����(��0A� 4��f��� /���C�xŊ�ٳ����z=6�����rg���mKo��o�/����a�g���?'9%9��P��斓��~���L{�� �H��{AW��B��$����v�1b�&Mb�ر��ر#�0`�`xMBp! )Z�Nmo�mZ�g�}�eذaWTVV ���'99��C5��&�&+5�bT>|8��PUUETT����&���t��~TE%��'������b�tEGG;RSS�S�N�v��ѯ��t����u1@�ޚ"f��͈���r'L�Ph��m��ƌ�74o��`�x�q�P���NRSS�X,�����l&&&��MFFA!-��`��ҷ�n��Yuu�����x<I�LB%����KԒ50�!�3�bz�����ʸKL���;---�l6[��`��������Ȏ;�����egg4��!D�T��jWujyZ��������K����%����p�^���X,6��sV=�ܖ����6�3�X ���4ҿ��A2�&����_k�;d�� �VfOIEND�B`�
Warning: session_start(): Session cannot be started after headers have already been sent in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 124

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 130

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 132

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 133

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 134

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 135

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 547

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 548

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 549

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 550

Warning: Cannot modify header information - headers already sent by (output started at /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php:1) in /home/mciraet/www/wp-includes/php-ai-client/src/Providers/Enums/Documentsoliders.php on line 551
set_date_created( $date_created ); global $wpdb; $note_to_be_inserted = array( 'name' => $note->get_name(), 'type' => $note->get_type(), 'locale' => $note->get_locale(), 'title' => $note->get_title(), 'content' => $note->get_content(), 'status' => $note->get_status(), 'source' => $note->get_source(), 'is_snoozable' => (int) $note->get_is_snoozable(), 'layout' => self::DEPRECATED_LAYOUT_VALUE, 'image' => self::DEPRECATED_IMAGE_VALUE, 'is_deleted' => (int) $note->get_is_deleted(), 'is_read' => (int) $note->get_is_read(), ); $note_to_be_inserted['content_data'] = wp_json_encode( $note->get_content_data() ); $note_to_be_inserted['date_created'] = gmdate( 'Y-m-d H:i:s', $date_created ); $note_to_be_inserted['date_reminder'] = null; $wpdb->insert( $wpdb->prefix . 'wc_admin_notes', $note_to_be_inserted ); $note_id = $wpdb->insert_id; $note->set_id( $note_id ); $this->save_actions( $note ); $note->apply_changes(); /** * Fires when an admin note is created. * * @param int $note_id Note ID. */ do_action( 'woocommerce_note_created', $note_id ); } /** * Method to read a note. * * @param Note $note Admin note. * @throws \Exception Throws exception when invalid data is found. */ public function read( &$note ) { global $wpdb; $note->set_defaults(); $note_row = false; $note_id = $note->get_id(); if ( 0 !== $note_id || '0' !== $note_id ) { $note_row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wc_admin_notes WHERE note_id = %d LIMIT 1", $note->get_id() ) ); } if ( 0 === $note->get_id() || '0' === $note->get_id() ) { $this->read_actions( $note ); $note->set_object_read( true ); /** * Fires when an admin note is loaded. * * @param int $note_id Note ID. */ do_action( 'woocommerce_note_loaded', $note ); } elseif ( $note_row ) { $note->set_name( $note_row->name ); $note->set_type( $note_row->type ); $note->set_locale( $note_row->locale ); $note->set_title( $note_row->title ); $note->set_content( $note_row->content ); // The default for 'content_value' used to be an array, so there might be rows with invalid data! $content_data = json_decode( $note_row->content_data ); if ( ! $content_data ) { $content_data = new \stdClass(); } elseif ( is_array( $content_data ) ) { $content_data = (object) $content_data; } $note->set_content_data( $content_data ); $note->set_status( $note_row->status ); $note->set_source( $note_row->source ); $note->set_date_created( $note_row->date_created ); $note->set_date_reminder( $note_row->date_reminder ); $note->set_is_snoozable( (bool) $note_row->is_snoozable ); $note->set_is_deleted( (bool) $note_row->is_deleted ); isset( $note_row->is_read ) && $note->set_is_read( (bool) $note_row->is_read ); $this->read_actions( $note ); $note->set_object_read( true ); /** * Fires when an admin note is loaded. * * @param int $note_id Note ID. */ do_action( 'woocommerce_note_loaded', $note ); } else { throw new \Exception( __( 'Invalid admin note', 'woocommerce' ) ); } } /** * Updates a note in the database. * * @param Note $note Admin note. */ public function update( &$note ) { global $wpdb; if ( $note->get_id() ) { $date_created = $note->get_date_created(); $date_created_timestamp = $date_created->getTimestamp(); $date_created_to_db = gmdate( 'Y-m-d H:i:s', $date_created_timestamp ); $date_reminder = $note->get_date_reminder(); if ( is_null( $date_reminder ) ) { $date_reminder_to_db = null; } else { $date_reminder_timestamp = $date_reminder->getTimestamp(); $date_reminder_to_db = gmdate( 'Y-m-d H:i:s', $date_reminder_timestamp ); } $wpdb->update( $wpdb->prefix . 'wc_admin_notes', array( 'name' => $note->get_name(), 'type' => $note->get_type(), 'locale' => $note->get_locale(), 'title' => $note->get_title(), 'content' => $note->get_content(), 'content_data' => wp_json_encode( $note->get_content_data() ), 'status' => $note->get_status(), 'source' => $note->get_source(), 'date_created' => $date_created_to_db, 'date_reminder' => $date_reminder_to_db, 'is_snoozable' => (int) $note->get_is_snoozable(), 'layout' => self::DEPRECATED_LAYOUT_VALUE, 'image' => self::DEPRECATED_IMAGE_VALUE, 'is_deleted' => (int) $note->get_is_deleted(), 'is_read' => (int) $note->get_is_read(), ), array( 'note_id' => $note->get_id() ) ); } $this->save_actions( $note ); $note->apply_changes(); /** * Fires when an admin note is updated. * * @param int $note_id Note ID. */ do_action( 'woocommerce_note_updated', $note->get_id() ); } /** * Deletes a note from the database. * * @param Note $note Admin note. * @param array $args Array of args to pass to the delete method (not used). */ public function delete( &$note, $args = array() ) { $note_id = $note->get_id(); if ( $note_id ) { global $wpdb; $wpdb->delete( $wpdb->prefix . 'wc_admin_notes', array( 'note_id' => $note_id ) ); $wpdb->delete( $wpdb->prefix . 'wc_admin_note_actions', array( 'note_id' => $note_id ) ); $note->set_id( null ); } /** * Fires when an admin note is deleted. * * @param int $note_id Note ID. */ do_action( 'woocommerce_note_deleted', $note_id ); } /** * Read actions from the database. * * @param Note $note Admin note. */ private function read_actions( &$note ) { global $wpdb; $db_actions = $wpdb->get_results( $wpdb->prepare( "SELECT action_id, name, label, query, status, actioned_text, nonce_action, nonce_name FROM {$wpdb->prefix}wc_admin_note_actions WHERE note_id = %d", $note->get_id() ) ); $note_actions = array(); if ( $db_actions ) { foreach ( $db_actions as $action ) { $note_actions[] = (object) array( 'id' => (int) $action->action_id, 'name' => $action->name, 'label' => $action->label, 'query' => $action->query, 'status' => $action->status, 'actioned_text' => $action->actioned_text, 'nonce_action' => $action->nonce_action, 'nonce_name' => $action->nonce_name, ); } } $note->set_actions( $note_actions ); } /** * Save actions to the database. * This function clears old actions, then re-inserts new if any changes are found. * * @param Note $note Note object. * * @return bool|void */ private function save_actions( &$note ) { global $wpdb; $changed_props = array_keys( $note->get_changes() ); if ( ! in_array( 'actions', $changed_props, true ) ) { return false; } // Process action removal. Actions are removed from // the note if they aren't part of the changeset. // See Note::add_action(). $changed_actions = $note->get_actions( 'edit' ); $actions_to_keep = array(); foreach ( $changed_actions as $action ) { if ( ! empty( $action->id ) ) { $actions_to_keep[] = (int) $action->id; } } $clear_actions_query = $wpdb->prepare( "DELETE FROM {$wpdb->prefix}wc_admin_note_actions WHERE note_id = %d", $note->get_id() ); if ( $actions_to_keep ) { $clear_actions_query .= sprintf( ' AND action_id NOT IN (%s)', implode( ',', $actions_to_keep ) ); } $wpdb->query( $clear_actions_query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared // Update/insert the actions in this changeset. foreach ( $changed_actions as $action ) { $action_data = array( 'note_id' => $note->get_id(), 'name' => $action->name, 'label' => $action->label, 'query' => $action->query, 'status' => $action->status, 'actioned_text' => $action->actioned_text, 'nonce_action' => $action->nonce_action, 'nonce_name' => $action->nonce_name, ); $data_format = array( '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', ); if ( ! empty( $action->id ) ) { $action_data['action_id'] = $action->id; $data_format[] = '%d'; } $wpdb->replace( $wpdb->prefix . 'wc_admin_note_actions', $action_data, $data_format ); } // Update actions from DB (to grab new IDs). $this->read_actions( $note ); } /** * Return an ordered list of notes. * * @param array $args Query arguments. * @param string $context Optional argument that the woocommerce_note_where_clauses filter can use to determine whether to apply extra conditions. Extensions should define their own contexts and use them to avoid adding to notes where clauses when not needed. * @return array An array of objects containing a note id. */ public function get_notes( $args = array(), $context = self::WC_ADMIN_NOTE_OPER_GLOBAL ) { global $wpdb; $defaults = array( 'per_page' => get_option( 'posts_per_page' ), 'page' => 1, 'order' => 'DESC', 'orderby' => 'date_created', ); $args = wp_parse_args( $args, $defaults ); $offset = $args['per_page'] * ( $args['page'] - 1 ); $where_clauses = $this->get_notes_where_clauses( $args, $context ); // sanitize order and orderby. $order_by = '`' . str_replace( '`', '', $args['orderby'] ) . '`'; $order_dir = 'asc' === strtolower( $args['order'] ) ? 'ASC' : 'DESC'; $query = $wpdb->prepare( // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared "SELECT * FROM {$wpdb->prefix}wc_admin_notes WHERE 1=1{$where_clauses} ORDER BY {$order_by} {$order_dir} LIMIT %d, %d", $offset, $args['per_page'] ); return $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } /** * Return an ordered list of notes, without paging or applying the 'woocommerce_note_where_clauses' filter. * INTERNAL: This method is not intended to be used by external code, and may change without notice. * * @param array $args Query arguments. * @return array An array of database records. */ public function lookup_notes( $args = array() ) { global $wpdb; $defaults = array( 'order' => 'DESC', 'orderby' => 'date_created', ); $args = wp_parse_args( $args, $defaults ); $where_clauses = $this->args_to_where_clauses( $args ); // sanitize order and orderby. $order_by = '`' . str_replace( '`', '', $args['orderby'] ) . '`'; $order_dir = 'asc' === strtolower( $args['order'] ) ? 'ASC' : 'DESC'; $query = "SELECT * FROM {$wpdb->prefix}wc_admin_notes WHERE 1=1{$where_clauses} ORDER BY {$order_by} {$order_dir}"; return $wpdb->get_results( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } /** * Return a count of notes. * * @param string $type Comma separated list of note types. * @param string $status Comma separated list of statuses. * @param string $context Optional argument that the woocommerce_note_where_clauses filter can use to determine whether to apply extra conditions. Extensions should define their own contexts and use them to avoid adding to notes where clauses when not needed. * @return string Count of objects with given type, status and context. */ public function get_notes_count( $type = array(), $status = array(), $context = self::WC_ADMIN_NOTE_OPER_GLOBAL ) { global $wpdb; $where_clauses = $this->get_notes_where_clauses( array( 'type' => $type, 'status' => $status, ), $context ); if ( ! empty( $where_clauses ) ) { // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.PreparedSQL.InterpolatedNotPrepared return $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wc_admin_notes WHERE 1=1{$where_clauses}" ); } return $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wc_admin_notes" ); } /** * Parses the query arguments passed in as arrays and escapes the values. * * @param array $args the query arguments. * @param string $key the key of the specific argument. * @param array|null $allowed_types optional allowed_types if only a specific set is allowed. * @return array the escaped array of argument values. */ private function get_escaped_arguments_array_by_key( $args = array(), $key = '', $allowed_types = null ) { $arg_array = array(); if ( isset( $args[ $key ] ) ) { foreach ( $args[ $key ] as $args_type ) { $args_type = trim( $args_type ); $allowed = is_null( $allowed_types ) || in_array( $args_type, $allowed_types, true ); if ( $allowed ) { $arg_array[] = sprintf( "'%s'", esc_sql( $args_type ) ); } } } return $arg_array; } /** * Return where clauses for getting notes by status and type. For use in both the count and listing queries. * Applies woocommerce_note_where_clauses filter. * * @uses args_to_where_clauses * @param array $args Array of args to pass. * @param string $context Optional argument that the woocommerce_note_where_clauses filter can use to determine whether to apply extra conditions. Extensions should define their own contexts and use them to avoid adding to notes where clauses when not needed. * @return string Where clauses for the query. */ public function get_notes_where_clauses( $args = array(), $context = self::WC_ADMIN_NOTE_OPER_GLOBAL ) { $where_clauses = $this->args_to_where_clauses( $args ); /** * Filter the notes WHERE clause before retrieving the data. * * Allows modification of the notes select criterial. * * @param string $where_clauses The generated WHERE clause. * @param array $args The original arguments for the request. * @param string $context Optional argument that the woocommerce_note_where_clauses filter can use to determine whether to apply extra conditions. Extensions should define their own contexts and use them to avoid adding to notes where clauses when not needed. */ return apply_filters( 'woocommerce_note_where_clauses', $where_clauses, $args, $context ); } /** * Return where clauses for notes queries without applying woocommerce_note_where_clauses filter. * INTERNAL: This method is not intended to be used by external code, and may change without notice. * * @param array $args Array of arguments for query conditionals. * @return string Where clauses. */ protected function args_to_where_clauses( $args = array() ) { $allowed_types = Note::get_allowed_types(); $where_type_array = $this->get_escaped_arguments_array_by_key( $args, 'type', $allowed_types ); $allowed_statuses = Note::get_allowed_statuses(); $where_status_array = $this->get_escaped_arguments_array_by_key( $args, 'status', $allowed_statuses ); $escaped_is_deleted = ''; if ( isset( $args['is_deleted'] ) ) { $escaped_is_deleted = esc_sql( $args['is_deleted'] ); } $where_name_array = $this->get_escaped_arguments_array_by_key( $args, 'name' ); $where_excluded_name_array = $this->get_escaped_arguments_array_by_key( $args, 'excluded_name' ); $where_source_array = $this->get_escaped_arguments_array_by_key( $args, 'source' ); $escaped_where_types = implode( ',', $where_type_array ); $escaped_where_status = implode( ',', $where_status_array ); $escaped_where_names = implode( ',', $where_name_array ); $escaped_where_excluded_names = implode( ',', $where_excluded_name_array ); $escaped_where_source = implode( ',', $where_source_array ); $where_clauses = ''; if ( ! empty( $escaped_where_types ) ) { $where_clauses .= " AND type IN ($escaped_where_types)"; } if ( ! empty( $escaped_where_status ) ) { $where_clauses .= " AND status IN ($escaped_where_status)"; } if ( ! empty( $escaped_where_names ) ) { $where_clauses .= " AND name IN ($escaped_where_names)"; } if ( ! empty( $escaped_where_excluded_names ) ) { $where_clauses .= " AND name NOT IN ($escaped_where_excluded_names)"; } if ( ! empty( $escaped_where_source ) ) { $where_clauses .= " AND source IN ($escaped_where_source)"; } if ( isset( $args['is_read'] ) ) { $where_clauses .= $args['is_read'] ? ' AND is_read = 1' : ' AND is_read = 0'; } $where_clauses .= $escaped_is_deleted ? ' AND is_deleted = 1' : ' AND is_deleted = 0'; return $where_clauses; } /** * Find all the notes with a given name. * * @param string $name Name to search for. * @return array An array of matching note ids. */ public function get_notes_with_name( $name ) { global $wpdb; return $wpdb->get_col( $wpdb->prepare( "SELECT note_id FROM {$wpdb->prefix}wc_admin_notes WHERE name = %s ORDER BY note_id ASC", $name ) ); } /** * Find the ids of all notes with a given type. * * @param string $note_type Type to search for. * @return array An array of matching note ids. */ public function get_note_ids_by_type( $note_type ) { global $wpdb; return $wpdb->get_col( $wpdb->prepare( "SELECT note_id FROM {$wpdb->prefix}wc_admin_notes WHERE type = %s ORDER BY note_id ASC", $note_type ) ); } }