diff --git a/wp-content/civi-extensions/civiglific/api/v3/Civiglific/CivicrmGlificSendWhatsappQrCron.php b/wp-content/civi-extensions/civiglific/api/v3/Civiglific/CivicrmGlificSendWhatsappQrCron.php new file mode 100644 index 000000000..e8176d017 --- /dev/null +++ b/wp-content/civi-extensions/civiglific/api/v3/Civiglific/CivicrmGlificSendWhatsappQrCron.php @@ -0,0 +1,277 @@ +addSelect('id', 'contact_id') + ->addWhere('event_id', '=', $eventId) + ->addWhere('status_id:label', '=', 'Registered') + ->setLimit(0) + ->execute(); + + $glificClient = new GlificClient(); + error_log('testing: Initialized GlificClient'); + + foreach ($participants as $participant) { + $contactId = $participant['contact_id']; + + $participant_id = qrcodecheckin_participant_id_for_contact_id($contactId, $eventId); + + if ($participant_id) { + $code = qrcodecheckin_get_code($participant_id); + error_log('code: ' . print_r($code, TRUE)); + + // First ensure the image file is created. + qrcodecheckin_create_image($code, $participant_id); + + // Get the absolute link to the image that will display the QR code. + $query = NULL; + $absolute = TRUE; + $link = qrcodecheckin_get_image_url($code); + error_log('link: ' . print_r($link, TRUE)); + + $values[$contact_id]['qrcodecheckin.qrcode_url_' . $event_id] = $link; + $values[$contact_id]['qrcodecheckin.qrcode_html_' . $event_id] = E::ts('
QR Code with link to checkin page
You should see a QR code above which will be used to quickly check you into the event. If you do not see a code display above, please enable the display of images in your email program or try accessing it directly. You may want to take a screen grab of your QR Code in case you need to display it when you do not have Internet access.
', [ + 1 => $link, + ]); + } + + error_log('testing: Processing participant with contactId: ' . $contactId); + + $glificContactId = getGlificContactId($contactId); + error_log('testing: Retrieved glificContactId: ' . $glificContactId); + + if (empty($glificContactId)) { + CRM_Core_Error::debug_log_message("No Glific contact ID found for CiviCRM contact ID: $contactId"); + error_log('testing: Skipping due to empty glificContactId for contactId: ' . $contactId); + continue; + } + + // Trigger the Flow instead of sending a direct message. + // Replace with your Flow name. + $flowName = "TestFlow"; + $result = triggerFlow($glificClient, $glificContactId, $flowName); + error_log('testing: Trigger flow result: ' . print_r($result, TRUE)); + + if ($result['success']) { + $returnValues[] = "Flow triggered for contact ID: $contactId"; + } + else { + CRM_Core_Error::debug_log_message("Failed to trigger flow for contact ID: $contactId - " . print_r($result, FALSE)); + error_log('testing: Failed to trigger flow for contactId: ' . $contactId); + } + } + + error_log('testing: Returning success with returnValues: ' . print_r($returnValues, TRUE)); + return civicrm_api3_create_success($returnValues, $params, 'Civiglific', 'civicrm_glific_send_whatsapp_qr_cron'); + } + catch (Exception $e) { + CRM_Core_Error::debug_log_message("Error in trigger_flow job: " . $e->getMessage()); + error_log('testing: Caught exception: ' . $e->getMessage()); + return civicrm_api3_create_error("An error occurred: " . $e->getMessage()); + } +} + +// /** +// * Fetch participant_id from contact_id. +// */ +// function qrcodecheckin_participant_id_for_contact_id($contact_id, $event_id) { + +// $sql = "SELECT p.id FROM civicrm_contact c JOIN civicrm_participant p +// ON c.id = p.contact_id WHERE c.is_deleted = 0 AND c.id = %0 AND p.event_id = %1"; +// $params = [ +// 0 => [$contact_id, 'Integer'], +// 1 => [$event_id, 'Integer'], +// ]; +// $dao = CRM_Core_DAO::executeQuery($sql, $params); +// if ($dao->N == 0) { +// return NULL; +// } +// $dao->fetch(); +// return $dao->id; +// } + +/** + * Create a hash based on the participant id. + */ +// function qrcodecheckin_get_code($participant_id) { +// $sql = "SELECT hash FROM civicrm_contact c JOIN civicrm_participant p ON c.id = p.contact_id +// WHERE p.id = %0"; +// $dao = CRM_Core_DAO::executeQuery($sql, [0 => [$participant_id, 'Integer']]); +// if ($dao->N == 0) { +// return FALSE; +// } +// $dao->fetch(); +// $user_hash = $dao->hash; +// return hash('sha256', $participant_id . $user_hash . CIVICRM_SITE_KEY); +// } + +/** + * Create the qr image file + */ +// function qrcodecheckin_create_image($code, $participant_id) { +// $path = qrcodecheckin_get_path($code); +// if (!file_exists($path)) { +// // Since we are saving a file, we don't want base64 data. +// $url = qrcodecheckin_get_url($code, $participant_id); +// $base64 = FALSE; +// $data = qrcodecheckin_get_image_data($url, $base64); +// file_put_contents($path, $data); +// } +// } + +/** + * Helper to return absolute URL to qrcode image file. + * + * This is the URL to the image file containing the QR code. + */ +// function qrcodecheckin_get_image_url($code) { +// $civiConfig = CRM_Core_Config::singleton(); +// return $civiConfig->imageUploadURL . '/qrcodecheckin/' . $code . '.png'; +// } + + +/** + * Get QRCode image data. + */ +// function qrcodecheckin_get_image_data($url, $base64 = TRUE) { +// require_once __DIR__ . '/vendor/autoload.php'; +// $options = new chillerlan\QRCode\QROptions( +// [ +// 'outputType' => chillerlan\QRCode\QRCode::OUTPUT_IMAGE_PNG, +// 'imageBase64' => $base64, +// 'imageTransparent' => FALSE, +// ] +// ); +// return (new chillerlan\QRCode\QRCode($options))->render($url); +// } + +/** + * Get URL for checkin. + * + * This is the URL that the QR Code points to when it is + * read. See qrcodecheckin_get_image_url for the URL of the image + * file that displays the QR Code. + */ +// function qrcodecheckin_get_url($code, $participant_id) { +// $query = NULL; +// $absolute = TRUE; +// $fragment = NULL; +// $htmlize = FALSE; +// $frontend = TRUE; +// return CRM_Utils_System::url('civicrm/qrcodecheckin/' . $participant_id . '/' . $code, $query, $absolute, $fragment, $htmlize, $frontend); +// } + + +/** + * Helper to return absolute file system path to qrcode image file. + * + * This is the path to the image file containing the QR code. + */ +// function qrcodecheckin_get_path($code) { +// $civiConfig = CRM_Core_Config::singleton(); +// return $civiConfig->imageUploadDir . '/qrcodecheckin/' . $code . '.png'; +// } + + + +/** + * Retrieve Glific contact ID dynamically using phone number. + * + * @param int $contactId + * CiviCRM contact ID. + * + * @return string|null + * Glific contact ID or null if not found. + */ +function getGlificContactId($contactId) { + error_log('testing: Entering getGlificContactId for contactId: ' . $contactId); + $phoneResult = Phone::get(FALSE) + ->addSelect('phone') + ->addWhere('contact_id', '=', $contactId) + ->execute() + ->first(); + error_log('testing: Phone result: ' . print_r($phoneResult, TRUE)); + + if (empty($phoneResult['phone'])) { + error_log('testing: No phone found for contactId: ' . $contactId); + return NULL; + } + + $phone = $phoneResult['phone']; + $glificClient = new GlificClient(); + error_log('testing: Querying Glific for phone: ' . $phone); + + return $glificClient->getContactIdByPhone($phone); +} + +/** + * Trigger a Flow for a specific contact using Glific API. + * + * @param \CRM\Civiglific\GlificClient $client + * GlificClient instance. + * @param string $receiverId + * Glific contact ID of the receiver. + * @param string $flowName + * Name of the Flow to trigger. + * + * @return array + * Response with success status. + */ +function triggerFlow($client, $receiverId, $flowName) { + error_log('testing: Entering triggerFlow with receiverId: ' . $receiverId . ' and flowName: ' . $flowName); + $query = <<<'GQL' + mutation TriggerContactFlow($input: TriggerContactFlowInput!) { + triggerContactFlow(input: $input) { + flow { + id + name + } + errors { + message + } + } + } + GQL; + + $variables = [ + 'input' => [ + 'contactId' => $receiverId, + 'flowName' => $flowName, + ], + ]; + error_log('testing: Trigger flow variables: ' . print_r($variables, TRUE)); + + $response = $client->query($query, $variables); + error_log('testing: Trigger flow response: ' . print_r($response, TRUE)); + + $result = $response['data']['triggerContactFlow'] ?? []; + $success = empty($result['errors']); + return [ + 'success' => $success, + 'data' => $result, + ]; +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Hook.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Hook.php new file mode 100644 index 000000000..0dd619557 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Hook.php @@ -0,0 +1,25 @@ +invoke(['values', 'contactId', 'handled'], $values, $contactId, $handled, CRM_Utils_Hook::$_nullObject, + CRM_Utils_Hook::$_nullObject, CRM_Utils_Hook::$_nullObject, 'civicrm_qrcodecheckin_tokenValues'); + } + +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.php new file mode 100644 index 000000000..8ff58e3fc --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.php @@ -0,0 +1,96 @@ +userFrameworkURLVar, $_GET); + // Get everything after /qrcodecheckin/ + if (preg_match('#/qrcodecheckin/([0-9]+)/([0-9a-f]+)$#', $path, $matches)) { + $this->participant_id = $matches[1]; + $this->hash = $matches[2]; + } + + // If we don't have both, refuseAccess with message saying URL might be broken. + if (empty($this->participant_id) || empty($this->hash)) { + $this->refuseAccess(); + return FALSE; + } + + // If we do have them, but they have been altered, send message. + if (!$this->verifyHash()) { + $this->refuseAccess(); + return FALSE; + } + + // Now we know they check out, let's check permission. If they don't have + // permission to be here, send $pemrission_denied so our template can give + // them a friendly message that doesn't reveal any information. + if (!CRM_Core_Permission::check(QRCODECHECKIN_PERM) && !CRM_Core_Permission::check('edit event participants')) { + $this->assign('has_permission', FALSE); + } + else { + $this->assign('has_permission', TRUE); + CRM_Core_Resources::singleton()->addScriptFile('net.ourpowerbase.qrcodecheckin', 'qrcodecheckin.js'); + CRM_Core_Resources::singleton()->addStyleFile('net.ourpowerbase.qrcodecheckin', 'qrcodecheckin.css'); + $this->setDetails(); + } + parent::run(); + } + + private function verifyHash() { + $expected_hash = qrcodecheckin_get_code($this->participant_id); + if ($expected_hash != $this->hash) { + CRM_Core_Error::debug_log_message(E::ts("Qrcodecheckin: denied access, hash mis-match for participant id: %1", [ 1 => $this->participant_id])); + return FALSE; + } + return TRUE; + } + + private function setDetails() { + $sql = "SELECT title, display_name, st.name as participant_status, fee_level, fee_amount, role_id FROM civicrm_contact c + JOIN civicrm_participant p ON c.id = p.contact_id + JOIN civicrm_event e ON e.id = p.event_id + JOIN civicrm_participant_status_type st ON st.id = p.status_id + WHERE p.id = %0"; + $dao = CRM_Core_DAO::executeQuery($sql, array(0 => array($this->participant_id, 'Integer'))); + $dao->fetch(); + $this->assign('event_title', $dao->title); + $this->assign('display_name', $dao->display_name); + $this->assign('participant_status', $dao->participant_status); + $this->assign('fee_level', $dao->fee_level); + $this->assign('fee_amount', $dao->fee_amount); + $roles = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'role_id'); + $this->assign('role', $roles[$dao->role_id]); + + if ($dao->participant_status == 'Registered') { + $this->assign('update_button', TRUE); + $this->assign('status_class', 'qrcheckin-status-registered'); + } + elseif ($dao->participant_status == 'Attended') { + $this->assign('status_class', 'qrcheckin-status-attended'); + } + else { + $this->assign('status_class', 'qrcheckin-status-other'); + } + } + + private function getDisplayName() { + $sql = "SELECT display_name FROM civicrm_contact c JOIN civicrm_participant p ON c.id = p.contact_id + WHERE p.id = %0"; + $dao = CRM_Core_DAO::executeQuery($sql, array(0 => array($this->participant_id, 'Integer'))); + $dao->fetch(); + return $dao->display_name; + } + + private function refuseAccess() { + CRM_Core_Error::fatal(E::ts("Woops! The link you clicked on appears to be broken. Please check again and ensure it was not split by a line break.") ); + } +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Upgrader.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Upgrader.php new file mode 100644 index 000000000..6992bc623 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/CRM/Qrcodecheckin/Upgrader.php @@ -0,0 +1,143 @@ +executeSqlFile('sql/myinstall.sql'); + } + + /** + * Example: Work with entities usually not available during the install step. + * + * This method can be used for any post-install tasks. For example, if a step + * of your installation depends on accessing an entity that is itself + * created during the installation (e.g., a setting or a managed entity), do + * so here to avoid order of operation problems. + */ + // public function postInstall() { + // $customFieldId = civicrm_api3('CustomField', 'getvalue', array( + // 'return' => array("id"), + // 'name' => "customFieldCreatedViaManagedHook", + // )); + // civicrm_api3('Setting', 'create', array( + // 'myWeirdFieldSetting' => array('id' => $customFieldId, 'weirdness' => 1), + // )); + // } + + /** + * Example: Run an external SQL script when the module is uninstalled. + */ + // public function uninstall() { + // $this->executeSqlFile('sql/myuninstall.sql'); + // } + + /** + * Example: Run a simple query when a module is enabled. + */ + // public function enable() { + // CRM_Core_DAO::executeQuery('UPDATE foo SET is_active = 1 WHERE bar = "whiz"'); + // } + + /** + * Example: Run a simple query when a module is disabled. + */ + // public function disable() { + // CRM_Core_DAO::executeQuery('UPDATE foo SET is_active = 0 WHERE bar = "whiz"'); + // } + + /** + * Example: Run a couple simple queries. + * + * @return TRUE on success + * @throws Exception + */ + public function upgrade_5200() { + $this->ctx->log->info('Applying update 5200'); + $domains = \Civi\Api4\Domain::get(FALSE) + ->setLimit(25) + ->execute(); + foreach ($domains as $domain) { + $qrcode_event = \Civi::settings($domain['id'])->get('default_qrcode_checkin_event'); + if ($qrcode_event) { + \Civi::settings($domain['id'])->set('qrcode_events', [$qrcode_event]); + } + } + CRM_Core_DAO::executeQuery('DELETE FROM civicrm_setting WHERE name = "default_qrcode_checkin_event"'); + return TRUE; + } + + + /** + * Example: Run an external SQL script. + * + * @return TRUE on success + * @throws Exception + */ + // public function upgrade_4201() { + // $this->ctx->log->info('Applying update 4201'); + // // this path is relative to the extension base dir + // $this->executeSqlFile('sql/upgrade_4201.sql'); + // return TRUE; + // } + + + /** + * Example: Run a slow upgrade process by breaking it up into smaller chunk. + * + * @return TRUE on success + * @throws Exception + */ + // public function upgrade_4202() { + // $this->ctx->log->info('Planning update 4202'); // PEAR Log interface + + // $this->addTask(E::ts('Process first step'), 'processPart1', $arg1, $arg2); + // $this->addTask(E::ts('Process second step'), 'processPart2', $arg3, $arg4); + // $this->addTask(E::ts('Process second step'), 'processPart3', $arg5); + // return TRUE; + // } + // public function processPart1($arg1, $arg2) { sleep(10); return TRUE; } + // public function processPart2($arg3, $arg4) { sleep(10); return TRUE; } + // public function processPart3($arg5) { sleep(10); return TRUE; } + + /** + * Example: Run an upgrade with a query that touches many (potentially + * millions) of records by breaking it up into smaller chunks. + * + * @return TRUE on success + * @throws Exception + */ + // public function upgrade_4203() { + // $this->ctx->log->info('Planning update 4203'); // PEAR Log interface + + // $minId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(min(id),0) FROM civicrm_contribution'); + // $maxId = CRM_Core_DAO::singleValueQuery('SELECT coalesce(max(id),0) FROM civicrm_contribution'); + // for ($startId = $minId; $startId <= $maxId; $startId += self::BATCH_SIZE) { + // $endId = $startId + self::BATCH_SIZE - 1; + // $title = E::ts('Upgrade Batch (%1 => %2)', array( + // 1 => $startId, + // 2 => $endId, + // )); + // $sql = ' + // UPDATE civicrm_contribution SET foobar = whiz(wonky()+wanker) + // WHERE id BETWEEN %1 and %2 + // '; + // $params = array( + // 1 => array($startId, 'Integer'), + // 2 => array($endId, 'Integer'), + // ); + // $this->addTask($title, 'executeSql', $sql, $params); + // } + // return TRUE; + // } + +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/LICENSE.txt b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/LICENSE.txt new file mode 100644 index 000000000..fe8d05f72 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/LICENSE.txt @@ -0,0 +1,667 @@ +Package: net.ourpowerbase.qrcodecheckin +Copyright (C) 2018, Jamie McClelland +Licensed under the GNU Affero Public License 3.0 (below). + +------------------------------------------------------------------------------- + + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/README.md b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/README.md new file mode 100644 index 000000000..ae567ae21 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/README.md @@ -0,0 +1,129 @@ +# QR Code Checkin + +QRCode Checkin allows you to send an email that contains a scanable code to the registered participants for your event. + +Your registration workers can use any freely available QR Code scanning software on their phones to scan the code and open the encoded web address on their browser. + +When they do, they will get the status information about the registration, for example: + + +![Registered attendee with button to update status](/images/qrcode-checkin-registered.png) + +With one click, the registration worker can change their status from registered to attended. + +The extension is licensed under [AGPL-3.0](LICENSE.txt). + +## Usage + +Once enabled, each event configuration screen will have a new checkbox underneath the existing "Is this Event Active?" checkbox: + +![Checkbox to enable QR Code checkin for this event](/images/qrcode-event-configuration.png) + +This setting can be set on any number of events at a time. + +After setting the checkbox for your event, search for all contacts that are registered for the event and place them in a group. + +Then, send an email to the group, that includes the QR Code image token. There will be a token for each QR Code-enabled event that: + + * is set to active + * allows online registration + * has a start date later than "now" (ie. at the time of composing your email) + +![Same email that include QR Code checkin token](/images/qrcode-compose-email.png) + +Recipients will get an email that includes the QR Code as an embedded image: + +![User's view of the QR Code in their email](/images/qrcode-view-email.png) + +Now onto the event... At the event, be sure to have all registration workers download a QR Code scanner to their phones (there are plenty of free scanners available for Android, [here's one called QR Code Reader](https://play.google.com/store/apps/details?id=me.scan.android.client&hl=en) and on the iPhone it is built into the camera - so no extra software necessary). + +Next, the registration worker should login to CiviCRM on their phones. + +Since registration workers are often volunteers who should not have full access to your CiviCRM installation, you can create a role for them that must minimally have the following permissions: + + * administer CiviCRM (yes, this is a big one, but without additional permissions there is not a lot they can do with it) + * access AJAX API + * check-in participants via qrcode (this permission is provided by the extension) + +When a registration worker scans a QR Code, they will see a web address and be given the option to open it in their web browser. + +In their web browser, they will be presented with clear information about the participant status, for example: + +![Registrant status with button to updat](/images/qrcode-checkin-registered.png) + +The registration worker can simply click the button to switch them to attended and off they go. + +If they have already checked in and have been coded as Attended (uh oh - someone re-using a registration qr code?), you will see: + +![Registrant status with button to updat](/images/qrcode-checkin-attended.png) + +If they have any other status, it will be displayed in red: + +![Registrant status with button to updat](/images/qrcode-checkin-pending.png) + +## Tokens + +Tokens are generated for each event configured to use QR Codes. There are two tokens per event you can use: +* qrcodecheckin.qrcode_html_ - An HTML block to embed into your email containing the QRCode image and supporting text. +* qrcodecheckin.qrcode_url_ - contains the direct URL to the QRCode image on the server. + +When composing your email the tokens are searchable by your event's name (you don't need to know the event ID). + +## Changing contents of QRCode / Tokens + +If you wish to override the values of the qrcode tokens / change the contents of the QR Code you can implement +`hook_civicrm_qrcodecheckin_tokenValues`. You'll need to iterate through an array of possible tokens as they are dynamically +determined by virtue of the events that have QR support enabled. + +eg. +``` +function myextension_civicrm_qrcodecheckin_tokenValues(&$values, $contact_id, &$handled) { + foreach ($values as $key => $value) { + $event_id = preg_replace('/\D/', '', $key); + $link = 'http://example.org/qrcodes/' . $event_id . '/' . $contact_id . '/myqrcode.png'; + if (strpos($key, 'url')) { + $value = $link; + } + else { + $value = '

QR Code with participant detailsOverirrden HTML

'; + } + } + // If we handled the generation of the QRCode and URL set $handled=TRUE + $handled = TRUE; +} +``` + + +## Requirements + +* PHP v7.2+ +* CiviCRM 5 + +## Installation (Web UI) + +This extension has not yet been published for installation via the web UI. + +## Installation (CLI, Zip) + +Sysadmins and developers may download the `.zip` file for this extension and +install it with the command-line tool [cv](https://github.com/civicrm/cv). + +```bash +cd +cv dl net.ourpowerbase.qrcodecheckin@https://github.com/progresssivetech/net.ourpowerbase.qrcodecheckin/archive/master.zip +``` + +## Installation (CLI, Git) + +Sysadmins and developers may clone the [Git](https://en.wikipedia.org/wiki/Git) repo for this extension and +install it with the command-line tool [cv](https://github.com/civicrm/cv). + +```bash +git clone https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin.git +cv en qrcodecheckin +``` + +## Known Issues + +None so far. + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/api/v3/Qrcodecheckin/Checkin.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/api/v3/Qrcodecheckin/Checkin.php new file mode 100644 index 000000000..ac5147367 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/api/v3/Qrcodecheckin/Checkin.php @@ -0,0 +1,45 @@ +addValue('id', $params['participant_id']) + ->addValue('status_id:name', 'Attended') + ->execute(); + + return civicrm_api3_create_success($returnValues); +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/composer.json b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/composer.json new file mode 100644 index 000000000..34acfbb74 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/composer.json @@ -0,0 +1,9 @@ +{ + "name": "progressivetech/net.ourpowerbase.qrcodecheckin", + "description": "CiviCRM Extension to support QR codes for event management", + "type": "library", + "require": { + "php": "^7.2", + "chillerlan/php-qrcode": "^3.3" + } +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/composer.lock b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/composer.lock new file mode 100644 index 000000000..b727e470c --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/composer.lock @@ -0,0 +1,150 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "5faa78db51f0d4c698c51a166b768b46", + "packages": [ + { + "name": "chillerlan/php-qrcode", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-qrcode.git", + "reference": "d8bf297e6843a53aeaa8f3285ce04fc349d133d6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/d8bf297e6843a53aeaa8f3285ce04fc349d133d6", + "reference": "d8bf297e6843a53aeaa8f3285ce04fc349d133d6", + "shasum": "" + }, + "require": { + "chillerlan/php-settings-container": "^1.2", + "ext-mbstring": "*", + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", + "setasign/fpdf": "Required to use the QR FPDF output." + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\QRCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kazuhiko Arase", + "homepage": "https://github.com/kazuhikoarase" + }, + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + }, + { + "name": "Contributors", + "homepage": "https://github.com/chillerlan/php-qrcode/graphs/contributors" + } + ], + "description": "A QR code generator. PHP 7.2+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "keywords": [ + "phpqrcode", + "qr", + "qr code", + "qrcode", + "qrcode-generator" + ], + "support": { + "issues": "https://github.com/chillerlan/php-qrcode/issues", + "source": "https://github.com/chillerlan/php-qrcode/tree/3.4.0" + }, + "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, + { + "url": "https://ko-fi.com/codemasher", + "type": "ko_fi" + } + ], + "time": "2020-11-18T20:51:41+00:00" + }, + { + "name": "chillerlan/php-settings-container", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-settings-container.git", + "reference": "b9b0431dffd74102ee92348a63b4c33fc8ba639b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/b9b0431dffd74102ee92348a63b4c33fc8ba639b", + "reference": "b9b0431dffd74102ee92348a63b4c33fc8ba639b", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\Settings\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + } + ], + "description": "A container class for immutable settings objects. Not a DI container. PHP 7.2+", + "homepage": "https://github.com/chillerlan/php-settings-container", + "keywords": [ + "PHP7", + "Settings", + "container", + "helper" + ], + "support": { + "issues": "https://github.com/chillerlan/php-settings-container/issues", + "source": "https://github.com/chillerlan/php-settings-container" + }, + "time": "2019-09-10T00:09:44+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.2" + }, + "platform-dev": [], + "plugin-api-version": "2.0.0" +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-attended.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-attended.png new file mode 100644 index 000000000..3f0741f98 Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-attended.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-pending.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-pending.png new file mode 100644 index 000000000..8cce46f8d Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-pending.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-registered.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-registered.png new file mode 100644 index 000000000..9bdc17627 Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-checkin-registered.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-compose-email.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-compose-email.png new file mode 100644 index 000000000..5415efc9f Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-compose-email.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-event-configuration.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-event-configuration.png new file mode 100644 index 000000000..fe99a1ccc Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-event-configuration.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-user-follows-link.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-user-follows-link.png new file mode 100644 index 000000000..25ad69e33 Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-user-follows-link.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-view-email.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-view-email.png new file mode 100644 index 000000000..6097a6959 Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/qrcode-view-email.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/screenshot.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/screenshot.png new file mode 100644 index 000000000..6097a6959 Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/images/screenshot.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/info.xml b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/info.xml new file mode 100644 index 000000000..1ab12b80e --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/info.xml @@ -0,0 +1,37 @@ + + + qrcodecheckin + QR Code Checkin + QR Code Checkin allows you to send QR codes to event participants that can be scanned for faster checkin at the event. + AGPL-3.0 + + Jamie McClelland + jamie@progressivetech.org + + + https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin + https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin + https://github.com/progressivetech/net.ourpowerbase.qrcodecheckin/issues + http://www.gnu.org/licenses/agpl-3.0.html + + 2024-04-19 + 2.1.2 + stable + + 5.69 + + + CRM/Qrcodecheckin + 23.02.1 + + + menu-xml@1.0.0 + setting-php@1.0.0 + smarty-v2@1.0.1 + + + + + + CRM_Qrcodecheckin_Upgrader + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/l10n/net.ourpowerbase.qrcodecheckin.pot b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/l10n/net.ourpowerbase.qrcodecheckin.pot new file mode 100644 index 000000000..e13236fa3 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/l10n/net.ourpowerbase.qrcodecheckin.pot @@ -0,0 +1,72 @@ +# Copyright CiviCRM LLC (c) 2004-2015 +# This file is distributed under the same license as the CiviCRM package. +# If you contribute heavily to a translation and deem your work copyrightable, +# make sure you license it to CiviCRM LLC under Academic Free License 3.0. +msgid "" +msgstr "" +"Project-Id-Version: net.ourpowerbase.qrcodecheckin\n" +"POT-Creation-Date: 2021-07-16T18:31:32+02:00\n" +"Language-Team: CiviCRM Translators \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: net.ourpowerbase.qrcodecheckin/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.php +msgid "QR Code Check-in page" +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.php +msgid "Woops! The link you clicked on appears to be broken. Please check again and ensure it was not split by a line break." +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/CRM/Qrcodecheckin/Upgrader/Base.php +msgid "Upgrade %1 to revision %2" +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.js +msgid "There was an error updating the status. Sorry." +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.js +msgid "net.ourpowerbase.qrcodecheckin" +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.php +msgid "Found directory in qrcodecheckin folder, I expected only QR code image files. I'm not deleting the folder. I am proceeding with uninstalling the extension." +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.php +msgid "Enable QR Code tokens for this Event" +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.php +msgid "QR Code Checkin" +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.php +msgid "Access the page presented by the QR Code and click to change participant status to attended" +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.php +msgid "QRCode link for event " +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.php +msgid "QRCode image and link for event " +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/qrcodecheckin.php +msgid "
\"QR
You should see a QR code above which will be used to quickly check you into the event. If you do not see a code display above, please enable the display of images in your email program or try accessing it directly. You may want to take a screen grab of your QR Code in case you need to display it when you do not have Internet access.
" +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/templates/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.tpl +msgid "Congratulations! Your QR Code for checkin works. Please present your code to an event registration worker when you arrive." +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/templates/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.tpl +msgid "Update to Attended" +msgstr "" + +#: net.ourpowerbase.qrcodecheckin/templates/qrcode-checkin-event-options.tpl +msgid "If enabled, when sending email to contacts you can include a QR Checkin Code token for this event." +msgstr "" diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/phpunit.xml.dist b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/phpunit.xml.dist new file mode 100644 index 000000000..fc8f870b7 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./tests/phpunit + + + + + ./ + + + + + + + + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.civix.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.civix.php new file mode 100644 index 000000000..db3c46aed --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.civix.php @@ -0,0 +1,200 @@ +getUrl(self::LONG_NAME), '/'); + } + return CRM_Core_Resources::singleton()->getUrl(self::LONG_NAME, $file); + } + + /** + * Get the path of a resource file (in this extension). + * + * @param string|NULL $file + * Ex: NULL. + * Ex: 'css/foo.css'. + * @return string + * Ex: '/var/www/example.org/sites/default/ext/org.example.foo'. + * Ex: '/var/www/example.org/sites/default/ext/org.example.foo/css/foo.css'. + */ + public static function path($file = NULL) { + // return CRM_Core_Resources::singleton()->getPath(self::LONG_NAME, $file); + return __DIR__ . ($file === NULL ? '' : (DIRECTORY_SEPARATOR . $file)); + } + + /** + * Get the name of a class within this extension. + * + * @param string $suffix + * Ex: 'Page_HelloWorld' or 'Page\\HelloWorld'. + * @return string + * Ex: 'CRM_Foo_Page_HelloWorld'. + */ + public static function findClass($suffix) { + return self::CLASS_PREFIX . '_' . str_replace('\\', '_', $suffix); + } + +} + +use CRM_Qrcodecheckin_ExtensionUtil as E; + +/** + * (Delegated) Implements hook_civicrm_config(). + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_config + */ +function _qrcodecheckin_civix_civicrm_config($config = NULL) { + static $configured = FALSE; + if ($configured) { + return; + } + $configured = TRUE; + + $extRoot = __DIR__ . DIRECTORY_SEPARATOR; + $include_path = $extRoot . PATH_SEPARATOR . get_include_path(); + set_include_path($include_path); + // Based on , this does not currently require mixin/polyfill.php. +} + +/** + * Implements hook_civicrm_install(). + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_install + */ +function _qrcodecheckin_civix_civicrm_install() { + _qrcodecheckin_civix_civicrm_config(); + // Based on , this does not currently require mixin/polyfill.php. +} + +/** + * (Delegated) Implements hook_civicrm_enable(). + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_enable + */ +function _qrcodecheckin_civix_civicrm_enable(): void { + _qrcodecheckin_civix_civicrm_config(); + // Based on , this does not currently require mixin/polyfill.php. +} + +/** + * Inserts a navigation menu item at a given place in the hierarchy. + * + * @param array $menu - menu hierarchy + * @param string $path - path to parent of this item, e.g. 'my_extension/submenu' + * 'Mailing', or 'Administer/System Settings' + * @param array $item - the item to insert (parent/child attributes will be + * filled for you) + * + * @return bool + */ +function _qrcodecheckin_civix_insert_navigation_menu(&$menu, $path, $item) { + // If we are done going down the path, insert menu + if (empty($path)) { + $menu[] = [ + 'attributes' => array_merge([ + 'label' => $item['name'] ?? NULL, + 'active' => 1, + ], $item), + ]; + return TRUE; + } + else { + // Find an recurse into the next level down + $found = FALSE; + $path = explode('/', $path); + $first = array_shift($path); + foreach ($menu as $key => &$entry) { + if ($entry['attributes']['name'] == $first) { + if (!isset($entry['child'])) { + $entry['child'] = []; + } + $found = _qrcodecheckin_civix_insert_navigation_menu($entry['child'], implode('/', $path), $item); + } + } + return $found; + } +} + +/** + * (Delegated) Implements hook_civicrm_navigationMenu(). + */ +function _qrcodecheckin_civix_navigationMenu(&$nodes) { + if (!is_callable(['CRM_Core_BAO_Navigation', 'fixNavigationMenu'])) { + _qrcodecheckin_civix_fixNavigationMenu($nodes); + } +} + +/** + * Given a navigation menu, generate navIDs for any items which are + * missing them. + */ +function _qrcodecheckin_civix_fixNavigationMenu(&$nodes) { + $maxNavID = 1; + array_walk_recursive($nodes, function($item, $key) use (&$maxNavID) { + if ($key === 'navID') { + $maxNavID = max($maxNavID, $item); + } + }); + _qrcodecheckin_civix_fixNavigationMenuItems($nodes, $maxNavID, NULL); +} + +function _qrcodecheckin_civix_fixNavigationMenuItems(&$nodes, &$maxNavID, $parentID) { + $origKeys = array_keys($nodes); + foreach ($origKeys as $origKey) { + if (!isset($nodes[$origKey]['attributes']['parentID']) && $parentID !== NULL) { + $nodes[$origKey]['attributes']['parentID'] = $parentID; + } + // If no navID, then assign navID and fix key. + if (!isset($nodes[$origKey]['attributes']['navID'])) { + $newKey = ++$maxNavID; + $nodes[$origKey]['attributes']['navID'] = $newKey; + $nodes[$newKey] = $nodes[$origKey]; + unset($nodes[$origKey]); + $origKey = $newKey; + } + if (isset($nodes[$origKey]['child']) && is_array($nodes[$origKey]['child'])) { + _qrcodecheckin_civix_fixNavigationMenuItems($nodes[$origKey]['child'], $maxNavID, $nodes[$origKey]['attributes']['navID']); + } + } +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.css b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.css new file mode 100644 index 000000000..a059aa33a --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.css @@ -0,0 +1,32 @@ + +#qrcheckin-participant-name { + font-size: xx-large; + padding-top: 10px; + padding-bottom: 10px; + +} + +#qrcheckin-event-name { + padding-top: 10px; + font-size: large; +} + +#qrcheckin-status-line { + font-size: large; + padding-top: 10px; + padding-bottom: 10px; + +} + +.qrcheckin-status-attended { + color: green; +} + +.qrcheckin-status-registered { + color: orange; +} + +.qrcheckin-status-other { + color: red; +} + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.js b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.js new file mode 100644 index 000000000..90fdfa552 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.js @@ -0,0 +1,76 @@ +(function ($, ts){ + CRM.$('#qrcheckin-update-button').click(function() { + var participant_id; + + // Try Drupal first. + // We expect: /civicrm/qrcodecheckin/123/blahblahhash + // We want: 123 + var reg_drupal = /\/qrcodecheckin\/([0-9]+)\//; + var path_name = window.location.href; + + // Slashes are being converted to %3A in Drupal. + // Replace the %3A back to a slash so we can + // get the participant_id from the path. + var sanitized_path_name = decodeURIComponent(path_name); + var match = sanitized_path_name.match(reg_drupal); + + var match = reg_drupal.exec(sanitized_path_name); + if (match) { + participant_id = match[1]; + } + else { + // Try wordpress + // We expect: /wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fqrcodecheckin%2F65%2Fa21855da08cb102d1d217c53dc5824a3a795c1c1a44e971bf01ab9da3a2acbbf + // We want: 65 + //var reg_wordpress = /\/wp-admin\/admin\.php/ + var reg_wordpress_path = /\/wp-admin\/admin\.php/ + var reg_wordpress_extract_q = /[?&]q=([^&]+)(&|$)/ + var reg_wordpress_extract_id = /^civicrm\/qrcodecheckin\/([0-9]+)\// + var path_match = reg_wordpress_path.exec(window.location.pathname); + if (path_match) { + // Now we have to extract the query string q. + var q_match = reg_wordpress_extract_q.exec(location.search); + if (q_match) { + // Now URL decode it. + q = decodeURIComponent(q_match[1].replace(/\+/g, " ")); + // Now we have: civicrm/qrcodecheckin/65/a21855da08cb102d1d217c53dc5824a3a795c1c1a44e971bf01ab9da3a2acbbf + participant_match = reg_wordpress_extract_id.exec(q); + if (participant_match) { + participant_id = participant_match[1]; + } + } + } + } + + /* + CRM.api3('Qrcodecheckin', 'Checkin', { + "sequential": 1, + "participant_id": participant_id + }).done(function(result) { + if (result['is_error'] == 0) { + CRM.$('#qrcheckin-status').html('Attended'); + CRM.$('#qrcheckin-status-line').removeClass( "qrcheckin-status-registered" ).addClass( "qrcheckin-status-attended" ); + CRM.$('#qrcheckin-update-button').hide(); + } + else { + console.log(result); + alert(ts("There was an error updating the status. Sorry.")); + } + }); +*/ + CRM.api4('Participant', 'update', { + values: { "status_id": 2 }, // Use status_id instead of status_id.name + where: [["id", "=", participant_id]], + }).then(function(results) { + console.log(results); + if (results) { + CRM.$('#qrcheckin-status').html('Attended'); + CRM.$('#qrcheckin-status-line') + .removeClass("qrcheckin-status-registered") + .addClass("qrcheckin-status-attended"); + CRM.$('#qrcheckin-update-button').hide(); + } + }, function(failure) { + console.error("API request failed:", failure); + }); +}); }(CRM.$, CRM.ts('net.ourpowerbase.qrcodecheckin'))); diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.php new file mode 100644 index 000000000..ae84fc0e0 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/qrcodecheckin.php @@ -0,0 +1,317 @@ +imageUploadDir . '/qrcodecheckin/'; + if (!file_exists($dir)) { + $files = array_diff(scandir($dir), ['.','..']); + foreach ($files as $file) { + if (is_dir("$dir/$file")) { + // This is an error, but don't let it gum up the removal of the extension. + $msg = E::ts("Found directory in qrcodecheckin folder, I expected only QR code image files. I'm not deleting the folder. I am proceeding with uninstalling the extension."); + CRM_Core_Error::debug_log_message($msg); + $session = CRM_Core_Session::singleton(); + $session->setStatus($msg); + return; + } + unlink("$dir/$file"); + } + mkdir($civiConfig->imageUploadDir . '/qrcodecheckin/'); + } +} + +/** + * Implements hook_civicrm_enable(). + * + * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable + */ +function qrcodecheckin_civicrm_enable() { + // Ensure directory for qr codes is available. + $civiConfig = CRM_Core_Config::singleton(); + if (!file_exists($civiConfig->imageUploadDir . '/qrcodecheckin/')) { + mkdir($civiConfig->imageUploadDir . '/qrcodecheckin/'); + } + _qrcodecheckin_civix_civicrm_enable(); +} + +/** + * Implements hook_civicrm_buildForm(). + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_buildForm/ + */ +function qrcodecheckin_civicrm_buildForm($formName, &$form) { + if ($formName == 'CRM_Event_Form_ManageEvent_EventInfo') { + // This form is called once as part of the regular page load and again via an ajax snippet. + // We only want the new fields loaded once - so limit ourselves to the ajax snippet load. + if (CRM_Utils_Request::retrieve('snippet', 'String', $form) == 'json') { + $templatePath = realpath(dirname(__FILE__)."/templates"); + // Add the field element in the form + $form->add('checkbox', 'qrcode_enabled_event', E::ts('Enable QR Code tokens for this Event')); + // dynamically insert a template block in the page + CRM_Core_Region::instance('page-body')->add([ + 'template' => "{$templatePath}/qrcode-checkin-event-options.tpl" + ]); + + $qrcode_events = \Civi::settings()->get('qrcode_events'); + $event_id = intval($form->getVar('_id')); + if (in_array($event_id, $qrcode_events)) { + $defaults['qrcode_enabled_event'] = 1; + } + else { + $defaults['qrcode_enabled_event'] = 0; + } + $form->setDefaults($defaults); + } + } + +} + +/** + * Implements hook__civicrm_postProcess(). + * + * @link https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_postProcess/ + */ +function qrcodecheckin_civicrm_postProcess($formName, &$form) { + if ($formName == 'CRM_Event_Form_ManageEvent_EventInfo') { + $vals = $form->_submitValues; + $event_id = intval($form->getVar('_id')); + $qrcode_enabled_event = array_key_exists('qrcode_enabled_event', $vals) ? TRUE : FALSE; + + // Add/Remove event ID to/from array of QR-enabled events as required + $qrcode_events = \Civi::settings()->get('qrcode_events'); + if ($qrcode_enabled_event) { + // Add event ID to array of QR-enabled + if (!in_array($event_id, $qrcode_events)) { + $qrcode_events[] = $event_id; + \Civi::settings()->set('qrcode_events', $qrcode_events); + } + } + else if (in_array($event_id, $qrcode_events)) { + // Remove event ID from array + $qrcode_events = array_diff($qrcode_events, [$event_id]); + \Civi::settings()->set('qrcode_events', $qrcode_events); + } + } +} + +/** + * Create a hash based on the participant id. + */ +function qrcodecheckin_get_code($participant_id) { + $sql = "SELECT hash FROM civicrm_contact c JOIN civicrm_participant p ON c.id = p.contact_id + WHERE p.id = %0"; + $dao = CRM_Core_DAO::executeQuery($sql, [0 => [$participant_id, 'Integer']]); + if ($dao->N == 0) { + return FALSE; + } + $dao->fetch(); + $user_hash = $dao->hash; + return hash('sha256', $participant_id . $user_hash . CIVICRM_SITE_KEY); +} + +/** + * Get URL for checkin. + * + * This is the URL that the QR Code points to when it is + * read. See qrcodecheckin_get_image_url for the URL of the image + * file that displays the QR Code. + */ +function qrcodecheckin_get_url($code, $participant_id) { + $query = NULL; + $absolute = TRUE; + $fragment = NULL; + $htmlize = FALSE; + $frontend = TRUE; + return CRM_Utils_System::url('civicrm/qrcodecheckin/' . $participant_id . '/' . $code, $query, $absolute, $fragment, $htmlize, $frontend); +} + +/** + * Get QRCode image data. + */ +function qrcodecheckin_get_image_data($url, $base64 = TRUE) { + require_once __DIR__ . '/vendor/autoload.php'; + $options = new chillerlan\QRCode\QROptions( + [ + 'outputType' => chillerlan\QRCode\QRCode::OUTPUT_IMAGE_PNG, + 'imageBase64' => $base64, + 'imageTransparent' => FALSE, + ] + ); + return (new chillerlan\QRCode\QRCode($options))->render($url); +} + +/** + * Helper to return absolute URL to qrcode image file. + * + * This is the URL to the image file containing the QR code. + */ +function qrcodecheckin_get_image_url($code) { + $civiConfig = CRM_Core_Config::singleton(); + return $civiConfig->imageUploadURL . '/qrcodecheckin/' . $code . '.png'; +} + +/** + * Helper to return absolute file system path to qrcode image file. + * + * This is the path to the image file containing the QR code. + */ +function qrcodecheckin_get_path($code) { + $civiConfig = CRM_Core_Config::singleton(); + return $civiConfig->imageUploadDir . '/qrcodecheckin/' . $code . '.png'; +} + +/** + * Create the qr image file + */ +function qrcodecheckin_create_image($code, $participant_id) { + $path = qrcodecheckin_get_path($code); + if (!file_exists($path)) { + // Since we are saving a file, we don't want base64 data. + $url = qrcodecheckin_get_url($code, $participant_id); + $base64 = FALSE; + $data = qrcodecheckin_get_image_data($url, $base64); + file_put_contents($path, $data); + } +} + +/** + * Delete qrcode image if it exists. + */ +function qrcodecheckin_delete_image($code) { + $path = qrcodecheckin_get_path($code); + if (file_exists($path)) { + unlink($path); + } +} + +/** + * Implements hook_civicrm_permission(&$permissions) + */ +function qrcodecheckin_civicrm_permission(&$permissions) { + $prefix = E::ts('QR Code Checkin') . ': '; + $permissions[QRCODECHECKIN_PERM] = [ + 'label' => $prefix . E::ts(QRCODECHECKIN_PERM), + 'description' => E::ts('Access the page presented by the QR Code and click to change participant status to attended'), + ]; +} + +/** + * Implements hook_civicrm_tokens. + */ +function qrcodecheckin_civicrm_tokens(&$tokens) { + $qrcode_events = \Civi::settings()->get('qrcode_events'); + if (empty($qrcode_events)) { + return; + } + // There are QR enabled events so let's define tokens for each of them + $events = \Civi\Api4\Event::get(FALSE) + ->addSelect('id', 'title') + ->addClause('OR', ['end_date', 'IS NULL'], ['end_date', '>', date('Y-m-d')]) + ->addWhere('is_active', '=', TRUE) + ->addWhere('id', 'IN', $qrcode_events) + ->setLimit(0) + ->execute(); + $customTokens = []; + foreach ($events as $event) { + $customTokens['qrcodecheckin.qrcode_url_' . $event['id']] = E::ts('QRCode link for event ') . $event['title']; + $customTokens['qrcodecheckin.qrcode_html_' . $event['id']] = E::ts('QRCode image and link for event ') . $event['title']; + } + $tokens['qrcodecheckin'] = $customTokens; +} + +/** + * Implements hook_civicrm_tokenValues. + */ +function qrcodecheckin_civicrm_tokenValues(&$values, $cids, $job = null, $tokens = [], $context = null) { + if (array_key_exists('qrcodecheckin', $tokens)) { + $tokens['qrcodecheckin']; + $event_ids = []; + foreach ($tokens['qrcodecheckin'] as $token) { + $event_ids[] = preg_replace('/\D/', '', $token); + } + foreach($cids as $contact_id) { + // Allow token values to be overridden by extensions + $handled = FALSE; + CRM_Qrcodecheckin_Hook::tokenValues($values[$contact_id], $contact_id, $handled); + if ($handled) { + // Hook processed the qrcode tokens for us + continue; + } + + foreach ($event_ids as $event_id) { + error_log('event id: ' . print_r($event_id, TRUE)); + error_log('contact_id: ' . print_r($contact_id, TRUE)); + + $participant_id = qrcodecheckin_participant_id_for_contact_id($contact_id, $event_id); + error_log('participant_id: ' . print_r($participant_id, TRUE)); + + if ($participant_id) { + $code = qrcodecheckin_get_code($participant_id); + error_log('code: ' . print_r($code, TRUE)); + + // First ensure the image file is created. + qrcodecheckin_create_image($code, $participant_id); + + // Get the absolute link to the image that will display the QR code. + $query = NULL; + $absolute = TRUE; + $link = qrcodecheckin_get_image_url($code); + error_log('link: ' . print_r($link, TRUE)); + + + $values[$contact_id]['qrcodecheckin.qrcode_url_' . $event_id] = $link; + $values[$contact_id]['qrcodecheckin.qrcode_html_' . $event_id] = E::ts('
QR Code with link to checkin page
You should see a QR code above which will be used to quickly check you into the event. If you do not see a code display above, please enable the display of images in your email program or try accessing it directly. You may want to take a screen grab of your QR Code in case you need to display it when you do not have Internet access.
', [ + 1 => $link, + ]); + } + } + } + } +} + +/** + * Fetch participant_id from contact_id + */ +function qrcodecheckin_participant_id_for_contact_id($contact_id, $event_id) { + + $sql = "SELECT p.id FROM civicrm_contact c JOIN civicrm_participant p + ON c.id = p.contact_id WHERE c.is_deleted = 0 AND c.id = %0 AND p.event_id = %1"; + $params = [ + 0 => [$contact_id, 'Integer'], + 1 => [$event_id, 'Integer'] + ]; + $dao = CRM_Core_DAO::executeQuery($sql, $params); + if ($dao->N == 0) { + return NULL; + } + $dao->fetch(); + return $dao->id; +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/settings/qrcodecheckin.setting.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/settings/qrcodecheckin.setting.php new file mode 100644 index 000000000..72ed3423d --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/settings/qrcodecheckin.setting.php @@ -0,0 +1,23 @@ + [ + 'group_name' => 'QR Code Checkin', + 'group' => 'qrcodecheckin', + 'name' => 'qrcode_events', + 'type' => 'String', + 'serialize' => CRM_Core_DAO::SERIALIZE_JSON, + 'default' => [], + 'add' => '4.7', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => E::ts('The events that will use QRCodes for a given contact (can be more than one event).'), + 'help_text' => E::ts('If enabled, when sending email to contacts you can include a QR Checkin Code token for this event.'), + ], +]; diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/templates/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.tpl b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/templates/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.tpl new file mode 100644 index 000000000..f6be09ceb --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/templates/CRM/Qrcodecheckin/Page/QrcodecheckinLanding.tpl @@ -0,0 +1,15 @@ +

Event Check In Page

+{if $has_permission == FALSE} + {* Don't provide any sensitive info if they do not have the right permission, but let them know their code is ok *} +

{ts domain="net.ourpowerbase.qrcodecheckin"}Congratulations! Your QR Code for checkin works. Please present your code to an event registration worker when you arrive.{/ts}

+{else} +
{$display_name}
+
Event: {$event_title}
+
Current Status: {$participant_status}
+
Fee Level: {$fee_level}
+
Fee Amount: {$fee_amount}
+
Role ID: {$role}
+ {if $update_button == TRUE} + + {/if} +{/if} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/templates/qrcode-checkin-event-options.tpl b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/templates/qrcode-checkin-event-options.tpl new file mode 100644 index 000000000..5388abc29 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/templates/qrcode-checkin-event-options.tpl @@ -0,0 +1,15 @@ + + + + + +
  + {$form.qrcode_enabled_event.html} + {$form.qrcode_enabled_event.label} +
{ts domain="net.ourpowerbase.qrcodecheckin"}If enabled, when sending email to contacts you can include a QR Checkin Code token for this event.{/ts}
+
+ + + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/test.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/test.php new file mode 100644 index 000000000..49edfffb0 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/test.php @@ -0,0 +1,10 @@ +add('chillerlan\QRCode', __DIR__.'/vendor/chillerlan/php-qrcode/src/'); +//use chillerlan\php-qrcode\QRCode; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; +echo ''; diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/tests/phpunit/api/v3/Qrcodecheckin/CheckinTest.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/tests/phpunit/api/v3/Qrcodecheckin/CheckinTest.php new file mode 100644 index 000000000..418f7d8a5 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/tests/phpunit/api/v3/Qrcodecheckin/CheckinTest.php @@ -0,0 +1,49 @@ +installMe(__DIR__) + ->apply(); + } + + /** + * The setup() method is executed before the test is executed (optional). + */ + public function setUp() { + parent::setUp(); + } + + /** + * The tearDown() method is executed after the test was executed (optional) + * This can be used for cleanup. + */ + public function tearDown() { + parent::tearDown(); + } + + /** + * Simple example test case. + * + * Note how the function name begins with the word "test". + */ + public function testApiExample() { + $result = civicrm_api3('Qrcodecheckin', 'Checkin', array('magicword' => 'sesame')); + $this->assertEquals('Twelve', $result['values'][12]['name']); + } + +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/tests/phpunit/bootstrap.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/tests/phpunit/bootstrap.php new file mode 100644 index 000000000..afa827e95 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/tests/phpunit/bootstrap.php @@ -0,0 +1,62 @@ +add('CRM_', __DIR__); +$loader->add('Civi\\', __DIR__); +$loader->add('api_', __DIR__); +$loader->add('api\\', __DIR__); +$loader->register(); + +/** + * Call the "cv" command. + * + * @param string $cmd + * The rest of the command to send. + * @param string $decode + * Ex: 'json' or 'phpcode'. + * @return string + * Response output (if the command executed normally). + * @throws \RuntimeException + * If the command terminates abnormally. + */ +function cv($cmd, $decode = 'json') { + $cmd = 'cv ' . $cmd; + $descriptorSpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => STDERR); + $oldOutput = getenv('CV_OUTPUT'); + putenv("CV_OUTPUT=json"); + + // Execute `cv` in the original folder. This is a work-around for + // phpunit/codeception, which seem to manipulate PWD. + $cmd = sprintf('cd %s; %s', escapeshellarg(getenv('PWD')), $cmd); + + $process = proc_open($cmd, $descriptorSpec, $pipes, __DIR__); + putenv("CV_OUTPUT=$oldOutput"); + fclose($pipes[0]); + $result = stream_get_contents($pipes[1]); + fclose($pipes[1]); + if (proc_close($process) !== 0) { + throw new RuntimeException("Command failed ($cmd):\n$result"); + } + switch ($decode) { + case 'raw': + return $result; + + case 'phpcode': + // If the last output is /*PHPCODE*/, then we managed to complete execution. + if (substr(trim($result), 0, 12) !== "/*BEGINPHP*/" || substr(trim($result), -10) !== "/*ENDPHP*/") { + throw new \RuntimeException("Command failed ($cmd):\n$result"); + } + return $result; + + case 'json': + return json_decode($result, 1); + + default: + throw new RuntimeException("Bad decoder format ($decode)"); + } +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/autoload.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/autoload.php new file mode 100644 index 000000000..3642beb50 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/autoload.php @@ -0,0 +1,7 @@ + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/README.md b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/README.md new file mode 100644 index 000000000..075b2a376 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/README.md @@ -0,0 +1,392 @@ +# chillerlan/php-qrcode + +A PHP7.2+ QR Code library based on the [implementation](https://github.com/kazuhikoarase/qrcode-generator) by [Kazuhiko Arase](https://github.com/kazuhikoarase), +namespaced, cleaned up, improved and other stuff. + +[![Packagist version][packagist-badge]][packagist] +[![License][license-badge]][license] +[![Travis CI][travis-badge]][travis] +[![CodeCov][coverage-badge]][coverage] +[![Scrunitizer CI][scrutinizer-badge]][scrutinizer] +[![Packagist downloads][downloads-badge]][downloads] +[![PayPal donate][donate-badge]][donate] + +[![Continuous Integration][gh-action-badge]][gh-action] + +[packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-qrcode.svg?style=flat-square +[packagist]: https://packagist.org/packages/chillerlan/php-qrcode +[license-badge]: https://img.shields.io/github/license/chillerlan/php-qrcode.svg?style=flat-square +[license]: https://github.com/chillerlan/php-qrcode/blob/main/LICENSE +[travis-badge]: https://img.shields.io/travis/chillerlan/php-qrcode.svg?style=flat-square +[travis]: https://travis-ci.org/chillerlan/php-qrcode +[coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-qrcode.svg?style=flat-square +[coverage]: https://codecov.io/github/chillerlan/php-qrcode +[scrutinizer-badge]: https://img.shields.io/scrutinizer/g/chillerlan/php-qrcode.svg?style=flat-square +[scrutinizer]: https://scrutinizer-ci.com/g/chillerlan/php-qrcode +[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-qrcode.svg?style=flat-square +[downloads]: https://packagist.org/packages/chillerlan/php-qrcode/stats +[donate-badge]: https://img.shields.io/badge/donate-paypal-ff33aa.svg?style=flat-square +[donate]: https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4 +[gh-action-badge]: https://github.com/chillerlan/php-qrcode/workflows/Continuous%20Integration/badge.svg +[gh-action]: https://github.com/chillerlan/php-qrcode/actions + +## Documentation + +### Requirements +- PHP 7.2+ + - `ext-mbstring` + - optional: + - `ext-json`, `ext-gd` + - `ext-imagick` with [ImageMagick](https://imagemagick.org) installed + - [`setasign/fpdf`](https://github.com/setasign/fpdf) for the PDF output module + +### Installation +**requires [composer](https://getcomposer.org)** + +via terminal: `composer require chillerlan/php-qrcode` + +*composer.json* (note: replace `dev-master` with a [version boundary](https://getcomposer.org/doc/articles/versions.md), e.g. `^3.2`) +```json +{ + "require": { + "php": "^7.2", + "chillerlan/php-qrcode": "^3.4" + } +} +``` + +### Usage +We want to encode this URI for a mobile authenticator into a QRcode image: +```php +$data = 'otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net'; + +//quick and simple: +echo 'QR Code'; +``` + +

+ QR codes are awesome! + QR codes are awesome! +

+ +Wait, what was that? Please again, slower! + +### Advanced usage + +Ok, step by step. First you'll need a `QRCode` instance, which can be optionally invoked with a `QROptions` (or a [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php), respectively) object as the only parameter. + +```php +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_MARKUP_SVG, + 'eccLevel' => QRCode::ECC_L, +]); + +// invoke a fresh QRCode instance +$qrcode = new QRCode($options); + +// and dump the output +$qrcode->render($data); + +// ...with additional cache file +$qrcode->render($data, '/path/to/file.svg'); +``` + +In case you just want the raw QR code matrix, call `QRCode::getMatrix()` - this method is also called internally from `QRCode::render()`. See also [Custom output modules](#custom-qroutputinterface). + +```php +$matrix = $qrcode->getMatrix($data); + +foreach($matrix->matrix() as $y => $row){ + foreach($row as $x => $module){ + + // get a module's value + $value = $module; + $value = $matrix->get($x, $y); + + // boolean check a module + if($matrix->check($x, $y)){ // if($module >> 8 > 0) + // do stuff, the module is dark + } + else{ + // do other stuff, the module is light + } + + } +} +``` + +Have a look [in this folder](https://github.com/chillerlan/php-qrcode/tree/master/examples) for some more usage examples. + +#### Custom module values +Previous versions of `QRCode` held only boolean matrix values that only allowed to determine whether a module was dark or not. Now you can distinguish between different parts of the matrix, namely the several required patterns from the QR Code specification, and use them in different ways. + +The dark value is the module (light) value shifted by 8 bits to the left: `$value = $M_TYPE << ($bool ? 8 : 0);`, where `$M_TYPE` is one of the `QRMatrix::M_*` constants. +You can check the value for a type explicitly like... +```php +// for true (dark) +$value >> 8 === $M_TYPE; + +//for false (light) +$value === $M_TYPE; +``` +...or you can perform a loose check, ignoring the module value +```php +// for true +$value >> 8 > 0; + +// for false +$value >> 8 === 0 +``` + +See also `QRMatrix::set()`, `QRMatrix::check()` and [`QRMatrix` constants](#qrmatrix-constants). + +To map the values and properly render the modules for the given `QROutputInterface`, it's necessary to overwrite the default values: +```php +$options = new QROptions; + +// for HTML, SVG and ImageMagick +$options->moduleValues = [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#AFBFBF', + // quietzone + 18 => '#FFFFFF', +]; + +// for the image output types +$options->moduleValues = [ + 512 => [0, 0, 0], + // ... +]; + +// for string/text output +$options->moduleValues = [ + 512 => '#', + // ... +]; +``` + +#### Custom `QROutputInterface` +Instead of bloating your code you can simply create your own output interface by extending `QROutputAbstract`. Have a look at the [built-in output modules](https://github.com/chillerlan/php-qrcode/tree/master/src/Output). + +```php +class MyCustomOutput extends QROutputAbstract{ + + // inherited from QROutputAbstract + protected $matrix; // QRMatrix + protected $moduleCount; // modules QRMatrix::size() + protected $options; // MyCustomOptions or QROptions + protected $scale; // scale factor from options + protected $length; // length of the matrix ($moduleCount * $scale) + + // ...check/set default module values (abstract method, called by the constructor) + protected function setModuleValues():void{ + // $this->moduleValues = ... + } + + // QROutputInterface::dump() + public function dump(string $file = null):string{ + $output = ''; + + for($row = 0; $row < $this->moduleCount; $row++){ + for($col = 0; $col < $this->moduleCount; $col++){ + $output .= (int)$this->matrix->check($col, $row); + } + } + + return $output; + } + +} +``` + +In case you need additional settings for your output module, just extend `QROptions`... +``` +class MyCustomOptions extends QROptions{ + protected $myParam = 'defaultValue'; + + // ... +} +``` +...or use the [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php), which is the more flexible approach. + +```php +trait MyCustomOptionsTrait{ + protected $myParam = 'defaultValue'; + + // ... +} +``` +set the options: +```php +$myOptions = [ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, + 'outputType' => QRCode::OUTPUT_CUSTOM, + 'outputInterface' => MyCustomOutput::class, + // your custom settings + 'myParam' => 'whatever value', + ]; + +// extends QROptions +$myCustomOptions = new MyCustomOptions($myOptions); + +// using the SettingsContainerInterface +$myCustomOptions = new class($myOptions) extends SettingsContainerAbstract{ + use QROptionsTrait, MyCustomOptionsTrait; +}; + +``` + +You can then call `QRCode` with the custom modules... +```php +(new QRCode($myCustomOptions))->render($data); +``` +...or invoke the `QROutputInterface` manually. +```php +$qrOutputInterface = new MyCustomOutput($myCustomOptions, (new QRCode($myCustomOptions))->getMatrix($data)); + +//dump the output, which is equivalent to QRCode::render() +$qrOutputInterface->dump(); +``` + +### API + +#### `QRCode` methods +method | return | description +------ | ------ | ----------- +`__construct(QROptions $options = null)` | - | see [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php) +`render(string $data, string $file = null)` | mixed, `QROutputInterface::dump()` | renders a QR Code for the given `$data` and `QROptions`, saves `$file` optional +`getMatrix(string $data)` | `QRMatrix` | returns a `QRMatrix` object for the given `$data` and current `QROptions` +`initDataInterface(string $data)` | `QRDataInterface` | returns a fresh `QRDataInterface` for the given `$data` +`isNumber(string $string)` | bool | checks if a string qualifies for `Number` +`isAlphaNum(string $string)` | bool | checks if a string qualifies for `AlphaNum` +`isKanji(string $string)` | bool | checks if a string qualifies for `Kanji` + +#### `QRCode` constants +name | description +---- | ----------- +`VERSION_AUTO` | `QROptions::$version` +`MASK_PATTERN_AUTO` | `QROptions::$maskPattern` +`OUTPUT_MARKUP_SVG`, `OUTPUT_MARKUP_HTML` | `QROptions::$outputType` markup +`OUTPUT_IMAGE_PNG`, `OUTPUT_IMAGE_JPG`, `OUTPUT_IMAGE_GIF` | `QROptions::$outputType` image +`OUTPUT_STRING_JSON`, `OUTPUT_STRING_TEXT` | `QROptions::$outputType` string +`OUTPUT_IMAGICK` | `QROptions::$outputType` ImageMagick +`OUTPUT_FPDF` | `QROptions::$outputType` PDF, using [FPDF](https://github.com/setasign/fpdf) +`OUTPUT_CUSTOM` | `QROptions::$outputType`, requires `QROptions::$outputInterface` +`ECC_L`, `ECC_M`, `ECC_Q`, `ECC_H`, | ECC-Level: 7%, 15%, 25%, 30% in `QROptions::$eccLevel` +`DATA_NUMBER`, `DATA_ALPHANUM`, `DATA_BYTE`, `DATA_KANJI` | `QRDataInterface::$datamode` + +#### `QROptions` properties +property | type | default | allowed | description +-------- | ---- | ------- | ------- | ----------- +`$version` | int | `QRCode::VERSION_AUTO` | 1...40 | the [QR Code version number](http://www.qrcode.com/en/about/version.html) +`$versionMin` | int | 1 | 1...40 | Minimum QR version (if `$version = QRCode::VERSION_AUTO`) +`$versionMax` | int | 40 | 1...40 | Maximum QR version (if `$version = QRCode::VERSION_AUTO`) +`$eccLevel` | int | `QRCode::ECC_L` | `QRCode::ECC_X` | Error correct level, where X = L (7%), M (15%), Q (25%), H (30%) +`$maskPattern` | int | `QRCode::MASK_PATTERN_AUTO` | 0...7 | Mask Pattern to use +`$addQuietzone` | bool | `true` | - | Add a "quiet zone" (margin) according to the QR code spec +`$quietzoneSize` | int | 4 | clamped to 0 ... `$matrixSize / 2` | Size of the quiet zone +`$dataMode` | string | `null` | `Number`, `AlphaNum`, `Kanji`, `Byte` | allows overriding the data type detection +`$outputType` | string | `QRCode::OUTPUT_IMAGE_PNG` | `QRCode::OUTPUT_*` | built-in output type +`$outputInterface` | string | `null` | * | FQCN of the custom `QROutputInterface` if `QROptions::$outputType` is set to `QRCode::OUTPUT_CUSTOM` +`$cachefile` | string | `null` | * | optional cache file path +`$eol` | string | `PHP_EOL` | * | newline string (HTML, SVG, TEXT) +`$scale` | int | 5 | * | size of a QR code pixel (SVG, IMAGE_*), HTML -> via CSS +`$cssClass` | string | `null` | * | a common css class +`$svgOpacity` | float | 1.0 | 0...1 | +`$svgDefs` | string | * | * | anything between [``](https://developer.mozilla.org/docs/Web/SVG/Element/defs) +`$svgViewBoxSize` | int | `null` | * | a positive integer which defines width/height of the [viewBox attribute](https://css-tricks.com/scale-svg/#article-header-id-3) +`$textDark` | string | '🔴' | * | string substitute for dark +`$textLight` | string | '⭕' | * | string substitute for light +`$markupDark` | string | '#000' | * | markup substitute for dark (CSS value) +`$markupLight` | string | '#fff' | * | markup substitute for light (CSS value) +`$imageBase64` | bool | `true` | - | whether to return the image data as base64 or raw like from `file_get_contents()` +`$imageTransparent` | bool | `true` | - | toggle transparency (no jpeg support) +`$imageTransparencyBG` | array | `[255, 255, 255]` | `[R, G, B]` | the RGB values for the transparent color, see [`imagecolortransparent()`](http://php.net/manual/function.imagecolortransparent.php) +`$pngCompression` | int | -1 | -1 ... 9 | `imagepng()` compression level, -1 = auto +`$jpegQuality` | int | 85 | 0 - 100 | `imagejpeg()` quality +`$imagickFormat` | string | 'png' | * | ImageMagick output type, see `Imagick::setType()` +`$imagickBG` | string | `null` | * | ImageMagick background color, see `ImagickPixel::__construct()` +`$moduleValues` | array | `null` | * | Module values map, see [Custom output modules](#custom-qroutputinterface) and `QROutputInterface::DEFAULT_MODULE_VALUES` + +#### `QRMatrix` methods +method | return | description +------ | ------ | ----------- +`__construct(int $version, int $eclevel)` | - | - +`matrix()` | array | the internal matrix representation as a 2 dimensional array +`version()` | int | the current QR Code version +`eccLevel()` | int | current ECC level +`maskPattern()` | int | the used mask pattern +`size()` | int | the absoulute size of the matrix, including quiet zone (if set). `$version * 4 + 17 + 2 * $quietzone` +`get(int $x, int $y)` | int | returns the value of the module +`set(int $x, int $y, bool $value, int $M_TYPE)` | `QRMatrix` | sets the `$M_TYPE` value for the module +`check(int $x, int $y)` | bool | checks whether a module is true (dark) or false (light) +`setLogoSpace(int $width, int $height, int $startX = null, int $startY = null)` | `QRMatrix` | creates a logo space in the matrix + +#### `QRMatrix` constants +name | light (false) | dark (true) | description +---- | ------------- | ----------- | ----------- +`M_NULL` | 0 | - | module not set (should never appear. if so, there's an error) +`M_DARKMODULE` | - | 512 | once per matrix at `$xy = [8, 4 * $version + 9]` +`M_DATA` | 4 | 1024 | the actual encoded data +`M_FINDER` | 6 | 1536 | the 7x7 finder patterns +`M_SEPARATOR` | 8 | - | separator lines around the finder patterns +`M_ALIGNMENT` | 10 | 2560 | the 5x5 alignment patterns +`M_TIMING` | 12 | 3072 | the timing pattern lines +`M_FORMAT` | 14 | 3584 | format information pattern +`M_VERSION` | 16 | 4096 | version information pattern +`M_QUIETZONE` | 18 | - | margin around the QR Code +`M_LOGO` | 20 | - | space for a logo image (not used yet) +`M_TEST` | 255 | 65280 | test value + + +### Notes +The QR encoder, especially the subroutines for mask pattern testing, can cause high CPU load on increased matrix size. +You can avoid a part of this load by choosing a fast output module, like `OUTPUT_IMAGE_*` and setting the mask pattern manually (which may result in unreadable QR Codes). +Oh hey and don't forget to sanitize any user input! + +### Disclaimer! +I don't take responsibility for molten CPUs, misled applications, failed log-ins etc.. Use at your own risk! + +#### Trademark Notice + +The word "QR Code" is registered trademark of *DENSO WAVE INCORPORATED*
+http://www.denso-wave.com/qrcode/faqpatent-e.html + +### Framework Integration +- Drupal [Google Authenticator Login `ga_login`](https://www.drupal.org/project/ga_login) +- WordPress [`wp-two-factor-auth`](https://github.com/sjinks/wp-two-factor-auth) +- WordPress [Simple 2FA `simple-2fa`](https://wordpress.org/plugins/simple-2fa/) +- WoltLab Suite [two-step-verification](http://pluginstore.woltlab.com/file/3007-two-step-verification/) +- [Cachet](https://github.com/CachetHQ/Cachet) +- [Appwrite](https://github.com/appwrite/appwrite) +- other uses: [dependents](https://github.com/chillerlan/php-qrcode/network/dependents) / [packages](https://github.com/chillerlan/php-qrcode/network/dependents?dependent_type=PACKAGE) + + +Hi, please check out my other projects that are way cooler than qrcodes! + +- [php-oauth-core](https://github.com/chillerlan/php-oauth-core) - an OAuth 1/2 client library along with a bunch of [providers](https://github.com/chillerlan/php-oauth-providers) +- [php-httpinterface](https://github.com/chillerlan/php-httpinterface) - a PSR-7/15/17/18 implemetation +- [php-database](https://github.com/chillerlan/php-database) - a database client & querybuilder for MySQL, Postgres, SQLite, MSSQL, Firebird + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/composer.json b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/composer.json new file mode 100644 index 000000000..c2299a350 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/composer.json @@ -0,0 +1,51 @@ +{ + "name": "chillerlan/php-qrcode", + "description": "A QR code generator. PHP 7.2+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "license": "MIT", + "minimum-stability": "stable", + "type": "library", + "keywords": [ + "QR code", "qrcode", "qr", "qrcode-generator", "phpqrcode" + ], + "authors": [ + { + "name": "Kazuhiko Arase", + "homepage": "https://github.com/kazuhikoarase" + }, + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + }, + { + "name": "Contributors", + "homepage":"https://github.com/chillerlan/php-qrcode/graphs/contributors" + } + ], + "require": { + "php": "^7.2", + "ext-mbstring": "*", + "chillerlan/php-settings-container": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", + "setasign/fpdf": "Required to use the QR FPDF output." + }, + "autoload": { + "psr-4": { + "chillerlan\\QRCode\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "chillerlan\\QRCodePublic\\": "public/", + "chillerlan\\QRCodeTest\\": "tests/", + "chillerlan\\QRCodeExamples\\": "examples/" + } + } +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php new file mode 100644 index 000000000..3c01f8646 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/MyCustomOutput.php @@ -0,0 +1,36 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\QROutputAbstract; + +class MyCustomOutput extends QROutputAbstract{ + + protected function setModuleValues():void{ + // TODO: Implement setModuleValues() method. + } + + public function dump(string $file = null){ + + $output = ''; + + for($row = 0; $row < $this->moduleCount; $row++){ + for($col = 0; $col < $this->moduleCount; $col++){ + $output .= (int)$this->matrix->check($col, $row); + } + } + + return $output; + } + +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php new file mode 100644 index 000000000..f9d94ae34 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php @@ -0,0 +1,81 @@ + + * @copyright 2020 smiley + * @license MIT + * + * @noinspection PhpComposerExtensionStubsInspection + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\{QRCodeOutputException, QRImage}; + +use function imagecopyresampled, imagecreatefrompng, imagesx, imagesy, is_file, is_readable; + +/** + * @property \chillerlan\QRCodeExamples\LogoOptions $options + */ +class QRImageWithLogo extends QRImage{ + + /** + * @param string|null $file + * @param string|null $logo + * + * @return string + * @throws \chillerlan\QRCode\Output\QRCodeOutputException + */ + public function dump(string $file = null, string $logo = null):string{ + // set returnResource to true to skip further processing for now + $this->options->returnResource = true; + + // of course you could accept other formats too (such as resource or Imagick) + // i'm not checking for the file type either for simplicity reasons (assuming PNG) + if(!is_file($logo) || !is_readable($logo)){ + throw new QRCodeOutputException('invalid logo'); + } + + $this->matrix->setLogoSpace( + $this->options->logoWidth, + $this->options->logoHeight + // not utilizing the position here + ); + + // there's no need to save the result of dump() into $this->image here + parent::dump($file); + + $im = imagecreatefrompng($logo); + + // get logo image size + $w = imagesx($im); + $h = imagesy($im); + + // set new logo size, leave a border of 1 module + $lw = ($this->options->logoWidth - 2) * $this->options->scale; + $lh = ($this->options->logoHeight - 2) * $this->options->scale; + + // get the qrcode size + $ql = $this->matrix->size() * $this->options->scale; + + // scale the logo and copy it over. done! + imagecopyresampled($this->image, $im, ($ql - $lw) / 2, ($ql - $lh) / 2, 0, 0, $lw, $lh, $w, $h); + + $imageData = $this->dumpImage(); + + if($file !== null){ + $this->saveToFile($imageData, $file); + } + + if($this->options->imageBase64){ + $imageData = 'data:image/'.$this->options->outputType.';base64,'.base64_encode($imageData); + } + + return $imageData; + } + +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php new file mode 100644 index 000000000..5ca572f30 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/QRImageWithText.php @@ -0,0 +1,104 @@ + + * @copyright 2019 smiley + * @license MIT + * + * @noinspection PhpComposerExtensionStubsInspection + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\Output\QRImage; +use function base64_encode, imagechar, imagecolorallocate, imagecolortransparent, imagecopymerge, imagecreatetruecolor, + imagedestroy, imagefilledrectangle, imagefontwidth, in_array, round, str_split, strlen; + +class QRImageWithText extends QRImage{ + + /** + * @param string|null $file + * @param string|null $text + * + * @return string + */ + public function dump(string $file = null, string $text = null):string{ + $this->image = imagecreatetruecolor($this->length, $this->length); + $background = imagecolorallocate($this->image, ...$this->options->imageTransparencyBG); + + if((bool)$this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){ + imagecolortransparent($this->image, $background); + } + + imagefilledrectangle($this->image, 0, 0, $this->length, $this->length, $background); + + foreach($this->matrix->matrix() as $y => $row){ + foreach($row as $x => $M_TYPE){ + $this->setPixel($x, $y, $this->moduleValues[$M_TYPE]); + } + } + + // render text output if a string is given + if($text !== null){ + $this->addText($text); + } + + $imageData = $this->dumpImage($file); + + if((bool)$this->options->imageBase64){ + $imageData = 'data:image/'.$this->options->outputType.';base64,'.base64_encode($imageData); + } + + return $imageData; + } + + /** + * @param string $text + */ + protected function addText(string $text):void{ + // save the qrcode image + $qrcode = $this->image; + + // options things + $textSize = 3; // see imagefontheight() and imagefontwidth() + $textBG = [200, 200, 200]; + $textColor = [50, 50, 50]; + + $bgWidth = $this->length; + $bgHeight = $bgWidth + 20; // 20px extra space + + // create a new image with additional space + $this->image = imagecreatetruecolor($bgWidth, $bgHeight); + $background = imagecolorallocate($this->image, ...$textBG); + + // allow transparency + if((bool)$this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){ + imagecolortransparent($this->image, $background); + } + + // fill the background + imagefilledrectangle($this->image, 0, 0, $bgWidth, $bgHeight, $background); + + // copy over the qrcode + imagecopymerge($this->image, $qrcode, 0, 0, 0, 0, $this->length, $this->length, 100); + imagedestroy($qrcode); + + $fontColor = imagecolorallocate($this->image, ...$textColor); + $w = imagefontwidth($textSize); + $x = round(($bgWidth - strlen($text) * $w) / 2); + + // loop through the string and draw the letters + foreach(str_split($text) as $i => $chr){ + imagechar($this->image, $textSize, $i * $w + $x, $this->length, $chr, $fontColor); + } + } + +} diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/custom_output.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/custom_output.php new file mode 100644 index 000000000..71ea62682 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/custom_output.php @@ -0,0 +1,38 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +// invoke the QROutputInterface manually +$options = new QROptions([ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, +]); + +$qrOutputInterface = new MyCustomOutput($options, (new QRCode($options))->getMatrix($data)); + +var_dump($qrOutputInterface->dump()); + + +// or just +$options = new QROptions([ + 'version' => 5, + 'eccLevel' => QRCode::ECC_L, + 'outputType' => QRCode::OUTPUT_CUSTOM, + 'outputInterface' => MyCustomOutput::class, +]); + +var_dump((new QRCode($options))->render($data)); diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/example_image.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/example_image.png new file mode 100644 index 000000000..b4a80f2ab Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/example_image.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/example_svg.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/example_svg.png new file mode 100644 index 000000000..f1e7b32f7 Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/example_svg.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/fpdf.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/fpdf.php new file mode 100644 index 000000000..9c690a7f7 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/fpdf.php @@ -0,0 +1,47 @@ + 7, + 'outputType' => QRCode::OUTPUT_FPDF, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'imageBase64' => false, + 'moduleValues' => [ + // finder + 1536 => [0, 63, 255], // dark (true) + 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default + // alignment + 2560 => [255, 0, 255], + 10 => [255, 255, 255], + // timing + 3072 => [255, 0, 0], + 12 => [255, 255, 255], + // format + 3584 => [67, 191, 84], + 14 => [255, 255, 255], + // version + 4096 => [62, 174, 190], + 16 => [255, 255, 255], + // data + 1024 => [0, 0, 0], + 4 => [255, 255, 255], + // darkmodule + 512 => [0, 0, 0], + // separator + 8 => [255, 255, 255], + // quietzone + 18 => [255, 255, 255], + ], +]); + +\header('Content-type: application/pdf'); + +echo (new QRCode($options))->render($data); diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/html.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/html.php new file mode 100644 index 000000000..aa5305d24 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/html.php @@ -0,0 +1,102 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once '../vendor/autoload.php'; + +header('Content-Type: text/html; charset=utf-8'); + +?> + + + + + + QRCode test + + + +
+ 5, + 'outputType' => QRCode::OUTPUT_MARKUP_HTML, + 'eccLevel' => QRCode::ECC_L, + 'moduleValues' => [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#AFBFBF', + // quietzone + 18 => '#FFFFFF', + ], + ]); + + echo (new QRCode($options))->render($data); + +?> +
+ + + + + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/image.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/image.php new file mode 100644 index 000000000..89ba2a9a8 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/image.php @@ -0,0 +1,60 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGE_PNG, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'imageBase64' => false, + 'moduleValues' => [ + // finder + 1536 => [0, 63, 255], // dark (true) + 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default + // alignment + 2560 => [255, 0, 255], + 10 => [255, 255, 255], + // timing + 3072 => [255, 0, 0], + 12 => [255, 255, 255], + // format + 3584 => [67, 191, 84], + 14 => [255, 255, 255], + // version + 4096 => [62, 174, 190], + 16 => [255, 255, 255], + // data + 1024 => [0, 0, 0], + 4 => [255, 255, 255], + // darkmodule + 512 => [0, 0, 0], + // separator + 8 => [255, 255, 255], + // quietzone + 18 => [255, 255, 255], + ], +]); + +header('Content-type: image/png'); + +echo (new QRCode($options))->render($data); + + + + + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php new file mode 100644 index 000000000..987e10c11 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php @@ -0,0 +1,44 @@ + + * @copyright 2020 smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; +/** + * @property int $logoWidth + * @property int $logoHeight + * + * @noinspection PhpIllegalPsrClassPathInspection + */ +class LogoOptions extends QROptions{ + protected $logoWidth; + protected $logoHeight; +} + +$options = new LogoOptions; + +$options->version = 7; +$options->eccLevel = QRCode::ECC_H; +$options->imageBase64 = false; +$options->logoWidth = 13; +$options->logoHeight = 13; +$options->scale = 5; +$options->imageTransparent = false; + +header('Content-type: image/png'); + +$qrOutputInterface = new QRImageWithLogo($options, (new QRCode($options))->getMatrix($data)); + +// dump the output, with an additional logo +echo $qrOutputInterface->dump(null, __DIR__.'/octocat.png'); diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imageWithText.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imageWithText.php new file mode 100644 index 000000000..050781cba --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imageWithText.php @@ -0,0 +1,33 @@ + + * @copyright 2019 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGE_PNG, + 'scale' => 3, + 'imageBase64' => false, +]); + +header('Content-type: image/png'); + +$qrOutputInterface = new QRImageWithText($options, (new QRCode($options))->getMatrix($data)); + +// dump the output, with additional text +echo $qrOutputInterface->dump(null, 'example text'); diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imagick.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imagick.php new file mode 100644 index 000000000..6bec4d02e --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/imagick.php @@ -0,0 +1,59 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_IMAGICK, + 'eccLevel' => QRCode::ECC_L, + 'scale' => 5, + 'moduleValues' => [ + // finder + 1536 => '#A71111', // dark (true) + 6 => '#FFBFBF', // light (false) + // alignment + 2560 => '#A70364', + 10 => '#FFC9C9', + // timing + 3072 => '#98005D', + 12 => '#FFB8E9', + // format + 3584 => '#003804', + 14 => '#00FB12', + // version + 4096 => '#650098', + 16 => '#E0B8FF', + // data + 1024 => '#4A6000', + 4 => '#ECF9BE', + // darkmodule + 512 => '#080063', + // separator + 8 => '#DDDDDD', + // quietzone + 18 => '#DDDDDD', + ], +]); + +header('Content-type: image/png'); + +echo (new QRCode($options))->render($data); + + + + + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/octocat.png b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/octocat.png new file mode 100644 index 000000000..f9050b935 Binary files /dev/null and b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/octocat.png differ diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/svg.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/svg.php new file mode 100644 index 000000000..a7a159d70 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/svg.php @@ -0,0 +1,77 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; +$gzip = true; + +$options = new QROptions([ + 'version' => 7, + 'outputType' => QRCode::OUTPUT_MARKUP_SVG, + 'eccLevel' => QRCode::ECC_L, + 'svgViewBoxSize' => 530, + 'addQuietzone' => true, + 'cssClass' => 'my-css-class', + 'svgOpacity' => 1.0, + 'svgDefs' => ' + + + + + + + + + ', + 'moduleValues' => [ + // finder + 1536 => 'url(#g1)', // dark (true) + 6 => '#fff', // light (false) + // alignment + 2560 => 'url(#g1)', + 10 => '#fff', + // timing + 3072 => 'url(#g1)', + 12 => '#fff', + // format + 3584 => 'url(#g1)', + 14 => '#fff', + // version + 4096 => 'url(#g1)', + 16 => '#fff', + // data + 1024 => 'url(#g2)', + 4 => '#fff', + // darkmodule + 512 => 'url(#g1)', + // separator + 8 => '#fff', + // quietzone + 18 => '#fff', + ], +]); + +$qrcode = (new QRCode($options))->render($data); + +header('Content-type: image/svg+xml'); + +if($gzip === true){ + header('Vary: Accept-Encoding'); + header('Content-Encoding: gzip'); + $qrcode = gzencode($qrcode ,9); +} +echo $qrcode; + + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/text.php b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/text.php new file mode 100644 index 000000000..9bdf154f0 --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/examples/text.php @@ -0,0 +1,68 @@ + + * @copyright 2017 Smiley + * @license MIT + */ + +namespace chillerlan\QRCodeExamples; + +use chillerlan\QRCode\{QRCode, QROptions}; + +require_once __DIR__.'/../vendor/autoload.php'; + +$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; + +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_STRING_TEXT, + 'eccLevel' => QRCode::ECC_L, +]); + +//
 to view it in a browser
+echo '
'.(new QRCode($options))->render($data).'
'; + + +// custom values +$options = new QROptions([ + 'version' => 5, + 'outputType' => QRCode::OUTPUT_STRING_TEXT, + 'eccLevel' => QRCode::ECC_L, + 'moduleValues' => [ + // finder + 1536 => 'A', // dark (true) + 6 => 'a', // light (false) + // alignment + 2560 => 'B', + 10 => 'b', + // timing + 3072 => 'C', + 12 => 'c', + // format + 3584 => 'D', + 14 => 'd', + // version + 4096 => 'E', + 16 => 'e', + // data + 1024 => 'F', + 4 => 'f', + // darkmodule + 512 => 'G', + // separator + 8 => 'h', + // quietzone + 18 => 'i', + ], +]); + +//
 to view it in a browser
+echo '
'.(new QRCode($options))->render($data).'
'; + + + + + diff --git a/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/phpdoc.xml b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/phpdoc.xml new file mode 100644 index 000000000..d191e98ee --- /dev/null +++ b/wp-content/civi-extensions/net.ourpowerbase.qrcodecheckin-2.1.2/vendor/chillerlan/php-qrcode/phpdoc.xml @@ -0,0 +1,15 @@ + + + + public/docs + + + public/docs + + + src + + +