### PHPMailer Basic SMTP Authentication Example Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/examples/index.html This script demonstrates sending an email using PHPMailer with SMTP authentication. It requires SMTP server details, username, and password. It's a foundational example for configuring PHPMailer to send via a mail server. ```php isSMTP(); // Send using SMTP $mail->Host = 'smtp.example.com'; // Set the SMTP server to send through $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'your_email@example.com'; // SMTP username $mail->Password = 'your_password'; // SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // Enable implicit TLS encryption $mail->Port = 465; // TCP port to connect to //Recipients $mail->setFrom('from@example.com', 'Mailer'); $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient // Content $mail->isHTML(true); $mail->Subject = 'Here is your subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ?> ``` -------------------------------- ### PHPMailer Exception Handling Example Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/examples/index.html This script is similar to the basic email example but specifically highlights how to implement error handling using PHPMailer's exceptions. It demonstrates catching exceptions thrown during the mail sending process for robust error management. ```php isSMTP(); // Send using SMTP $mail->Host = 'smtp.example.com'; // Set the SMTP server to send through $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'your_email@example.com'; // SMTP username $mail->Password = 'your_password'; // SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // Enable implicit TLS encryption $mail->Port = 465; // TCP port to connect to //Recipients $mail->setFrom('from@example.com', 'Mailer'); $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient // Content $mail->isHTML(true); $mail->Subject = 'Here is your subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ?> ``` -------------------------------- ### PHPMailer Sendmail Example Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/examples/index.html This example demonstrates how to send emails using PHPMailer via the sendmail command. Sendmail is a program commonly found on Unix-like systems for submitting mail to a local mail server. This method is often faster but may have limited error reporting. ```php isSendmail(); // Send using sendmail // If your sendmail path is not in the default // location, uncomment and set this: // $mail->Sendmail = "/usr/sbin/sendmail"; //Recipients $mail->setFrom('from@example.com', 'Mailer'); $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient // Content $mail->isHTML(true); $mail->Subject = 'Here is your subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ?> ``` -------------------------------- ### Advanced Email Sending with Attachments from MySQL (PHP) Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/docs/extending.html This example demonstrates sending multiple email messages with binary attachments fetched from a MySQL database. It utilizes multipart/alternative messages and iterates through database records to send personalized emails. Ensure PHPMailerAutoload.php is included and MySQL connection details are correct. ```php require 'PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail->setFrom('list@example.com', 'List manager'); $mail->Host = 'smtp1.example.com;smtp2.example.com'; $mail->Mailer = 'smtp'; @mysqli_connect('localhost','root','password'); @mysqli_select_db("my_company"); $query = "SELECT full_name, email, photo FROM employee"; $result = @mysqli_query($query); while ($row = mysqli_fetch_assoc($result)) { // HTML body $body = "Hello " . $row['full_name'] . ",

"; $body .= "Your personal photograph to this message.

"; $body .= "Sincerely,
"; $body .= "phpmailer List manager"; // Plain text body (for mail clients that cannot read HTML) $text_body = 'Hello ' . $row['full_name'] . ", \n\n"; $text_body .= "Your personal photograph to this message.\n\n"; $text_body .= "Sincerely, \n"; $text_body .= 'phpmailer List manager'; $mail->Body = $body; $mail->AltBody = $text_body; $mail->addAddress($row['email'], $row['full_name']); $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); if(!$mail->send()) echo "There has been a mail error sending to " . $row['email'] . "
"; // Clear all addresses and attachments for next loop $mail->clearAddresses(); $mail->clearAttachments(); } ``` -------------------------------- ### PHPMailer Code Generator (Conceptual Description) Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/examples/index.html This script acts as a code generator. Users fill out a form with their email settings, and the script then generates PHP code based on these inputs, which can be copied for use in other applications. It's presented as a starting point for quick integration. ```php // This is a conceptual description. The actual code would involve // HTML form handling and dynamic PHP code generation based on user input. /* // HTML Form Example (simplified):

SMTP Host:
Username:
Password:
Recipient:
Subject:
Body:
*/ // PHP Logic (conceptual): /* if ($_SERVER["REQUEST_METHOD"] == "POST") { // Retrieve form data $smtp_host = $_POST['smtp_host']; $smtp_user = $_POST['smtp_user']; $smtp_pass = $_POST['smtp_pass']; $recipient = $_POST['recipient']; $subject = $_POST['subject']; $body = $_POST['body']; // Generate PHP code string $generated_code = "isSMTP();\n"; $generated_code .= " $mail->Host = '$smtp_host';\n"; $generated_code .= " $mail->SMTPAuth = true;\n"; $generated_code .= " $mail->Username = '$smtp_user';\n"; $generated_code .= " $mail->Password = '$smtp_pass';\n"; // Add encryption settings if applicable $generated_code .= " $mail->setFrom('$smtp_user', 'Mailer');\n"; $generated_code .= " $mail->addAddress('$recipient');\n"; $generated_code .= " $mail->isHTML(true);\n"; $generated_code .= " $mail->Subject = '$subject';\n"; $generated_code .= " $mail->Body = '$body';\n"; $generated_code .= " $mail->send();\n"; $generated_code .= " echo 'Email sent successfully!';\n"; $generated_code .= "} catch (Exception $e) {\n"; $generated_code .= " echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";\n"; $generated_code .= "}\n"; $generated_code .= "?>"; // Display the generated code echo "

Generated PHP Code:

"; echo "
";
    echo htmlspecialchars($generated_code);
    echo "
"; } */ ?> ``` -------------------------------- ### Install PHPMailer using Composer CLI Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/README.md This snippet demonstrates the command-line interface (CLI) command to install PHPMailer using Composer. This is a common way to manage project dependencies. ```sh composer require phpmailer/phpmailer ``` -------------------------------- ### Make Authenticated API Requests Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/twitter/README.md Provides examples of making authenticated GET, POST, and DELETE requests to the Twitter API using the TwitterOAuth object, including passing parameters. ```PHP $account = $connection->get('account/verify_credentials'); $status = $connection->post('statuses/update', array('status' => 'Text of status here', 'in_reply_to_status_id' => 123456)); $status = $connection->delete('statuses/destroy/12345'); ``` -------------------------------- ### Initialize Facebook PHP SDK Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/facebook/readme.md This snippet shows the minimal setup required to initialize the Facebook PHP SDK. It requires the SDK to be included and takes an array of configuration options including 'appId' and 'secret'. ```php require 'facebook-php-sdk/src/facebook.php'; $facebook = new Facebook(array( 'appId' => 'YOUR_APP_ID', 'secret' => 'YOUR_APP_SECRET', )); ``` -------------------------------- ### PHP Database Configuration Sample Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/README.md This PHP code snippet shows the constants used for connecting to the MySQL database in AvocadoEdition. These are often defined in a configuration file and are crucial for the application to interact with its data store. ```php # AvocadoEdition/data/dbconfig.php 샘플 define('G5_MYSQL_HOST', 'db'); define('G5_MYSQL_USER', 'avocadoedition'); define('G5_MYSQL_PASSWORD', 'avocadoedition'); define('G5_MYSQL_DB', 'avocadoedition'); ``` -------------------------------- ### Docker Compose Up Command Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/README.md This command initiates the Docker containers defined in docker-compose.yml, bringing up the entire AvocadoEdition application stack. It's typically used for local development and testing. ```shell docker-compose up -d ``` -------------------------------- ### PHPMailer SMTP Without Authentication Example Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/examples/index.html This script provides an example of sending emails using PHPMailer via SMTP without requiring authentication. This might be useful for internal mail servers or specific configurations where authentication is not needed. ```php isSMTP(); // Send using SMTP $mail->Host = 'smtp.example.com'; // Set the SMTP server to send through $mail->SMTPAuth = false; // Disable SMTP authentication // If your server does not require authentication, you can omit the following lines: // $mail->Username = 'your_email@example.com'; // $mail->Password = 'your_password'; // $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // $mail->Port = 465; //Recipients $mail->setFrom('from@example.com', 'Mailer'); $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient // Content $mail->isHTML(true); $mail->Subject = 'Here is your subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ?> ``` -------------------------------- ### Extending PHPMailer Class for Default Settings (PHP) Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/docs/extending.html This example shows how to extend the PHPMailer class to create a custom mailer with pre-defined default settings. It overrides methods like `edebug` and `send`, and adds new functionality. This approach promotes code reuse and consistency. Ensure the custom PHPMailer class is included. ```php require 'PHPMailerAutoload.php'; class my_phpmailer extends PHPMailer { // Set default variables for all new objects public $From = 'from@example.com'; public $FromName = 'Mailer'; public $Host = 'smtp1.example.com;smtp2.example.com'; public $Mailer = 'smtp'; // Alternative to isSMTP() public $WordWrap = 75; // Replace the default debug output function protected function edebug($msg) { print('My Site Error'); print('Description:'); printf('%s', $msg); exit; } //Extend the send function public function send() { $this->Subject = '[Yay for me!] '.$this->Subject; return parent::send() } // Create an additional function public function do_something($something) { // Place your new code here } } // Instantiate your new class $mail = new my_phpmailer; // Now you only need to add the necessary stuff $mail->addAddress('josh@example.com', 'Josh Adams'); $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the message body'; $mail->addAttachment('c:/temp/11-10-00.zip', 'new_name.zip'); // optional name if(!$mail->send()) { echo 'There was an error sending the message'; exit; } echo 'Message was sent successfully'; ``` -------------------------------- ### Execute PHPUnit Tests for Facebook SDK Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/facebook/readme.md This command executes the test suite for the Facebook PHP SDK using PHPUnit. It requires the SDK to be installed and configured, and is run from the base directory of the repository. ```bash phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php ``` -------------------------------- ### PHPMailer Gmail SMTP Example Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/examples/index.html This script shows how to send emails through Google's Gmail service using PHPMailer. It configures the client to use TLS encryption, authentication, and connect to the specific Gmail SMTP submission port (587). ```php isSMTP(); // Send using SMTP $mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'your_email@gmail.com'; // SMTP username (your gmail address) $mail->Password = 'your_app_password'; // SMTP password (use an app password) $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption, `PHPMailer::ENCRYPTION_SMTPS` also accepted $mail->Port = 587; // TCP port to connect to //Recipients $mail->setFrom('your_email@gmail.com', 'Mailer'); $mail->addAddress('recipient@example.com', 'Recipient Name'); // Add a recipient // Content $mail->isHTML(true); $mail->Subject = 'Here is your subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ?> ``` -------------------------------- ### PHPMailer Basic Email Sending with Attachment and HTML Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/examples/index.html This script demonstrates a comprehensive PHPMailer usage. It sends an email with an HTML body, a plain text alternative, includes an attachment from an external file, and sets various recipient addresses. It utilizes PHP's built-in mail() function, which requires a local mail server. ```php setFrom('from@example.com', 'Mailer'); $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient $mail->addAddress('ellen@example.com'); // Name is optional $mail->addReplyTo('info@example.com', 'Information'); $mail->addCC('cc@example.com'); $mail->addBCC('bcc@example.com'); // Attachments $mail->addAttachment('/var/mail/report.pdf'); // Add attachments $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name // Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is your subject'; // Load an HTML email template $mail_body = file_get_contents('email_template.html'); $mail->Body = $mail_body; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } ?> ``` -------------------------------- ### Send Email with SMTP using PHPMailer Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/README.md This example demonstrates how to configure and send an email using PHPMailer with SMTP authentication. It covers setting up SMTP servers, authentication credentials, recipients, attachments, and email content. Ensure you have the PHPMailer library and its autoloader included. ```php SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'user@example.com'; // SMTP username $mail->Password = 'secret'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->setFrom('from@example.com', 'Mailer'); $mail->addAddress('joe@example.net', 'Joe User'); // Add a recipient $mail->addAddress('ellen@example.com'); // Name is optional $mail->addReplyTo('info@example.com', 'Information'); $mail->addCC('cc@example.com'); $mail->addBCC('bcc@example.com'); $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } ``` -------------------------------- ### Install PHPMailer using Composer Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/README.md This snippet shows how to add PHPMailer as a dependency to your PHP project using Composer, the standard package manager for PHP. It specifies the version constraint for PHPMailer. ```json "phpmailer/phpmailer": "~5.2" ``` -------------------------------- ### Generate Authorization URL Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/twitter/README.md Provides examples of generating the authorization URL required to redirect users to Twitter for app authorization. It shows how to include or omit the 'Sign in with Twitter' functionality. ```PHP $redirect_url = $connection->getAuthorizeURL($temporary_credentials); // Use Sign in with Twitter $redirect_url = $connection->getAuthorizeURL($temporary_credentials, FALSE); ``` -------------------------------- ### Get Item Information in PHP Source: https://context7.com/tateck-develop/avocadoedition/llms.txt Retrieves complete item data, specific item images, detail images, and names using provided item IDs. It also demonstrates how to display item cards with essential information. Dependencies include common framework includes and item-related functions. ```php "; // Get item detail image $detail_img = get_item_detail_img($it_id); echo "Detail"; // Get item name only $item_name = get_item_name($it_id); echo $item_name; // Display item card $item = get_item('potion_hp_001'); echo "

{$item['it_name']}

{$item['it_type']}

Effect: {$item['it_value']}

Price: {$item['it_price']} gold

"; ?> ``` -------------------------------- ### PHP Checksum Verification Example Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/htmlpurifier/standalone/HTMLPurifier/ConfigSchema/schema/URI.MungeSecretKey.txt Demonstrates how to verify a checksum generated by HTML Purifier using HMAC-SHA256. This code snippet shows the server-side verification process, comparing a received checksum against one generated from the URL and a secret key. It assumes the existence of variables for the checksum, URL, and secret key. ```php $checksum === hash_hmac("sha256", $url, $secret_key) ``` -------------------------------- ### Get Access Token Credentials Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/twitter/README.md Shows how to obtain long-lasting token credentials from Twitter using the 'oauth_verifier' received after the user has authorized the application. ```PHP $token_credentials = $connection->getAccessToken($_REQUEST['oauth_verifier']); ``` -------------------------------- ### Get Character Information - PHP Source: https://context7.com/tateck-develop/avocadoedition/llms.txt Retrieves comprehensive character data including profile fields, stats, and metadata using the `get_character` function. It also provides helper functions to fetch just the character's name (`get_character_name`) or thumbnail (`get_character_head`), and to get the primary character name associated with a member ID (`get_member_character_name`). ```php "; // Get character by member ID (primary character) $mb_id = 'user001'; $member_char_name = get_member_character_name($mb_id); echo $member_char_name; ?> ``` -------------------------------- ### Execute Inventory Items with PHP Source: https://context7.com/tateck-develop/avocadoedition/llms.txt This PHP script handles the execution of various inventory item effects, such as stat recovery, loot box opening, and profile modifications. It includes error handling for ownership verification and supports extensibility through custom handlers. It requires common setup files and interacts with database tables for inventory and items. ```php read()) { if (preg_match("/\.php$/i", $entry)) { include_once(G5_PATH . "/inventory/extend/" . $entry); } } ?> ``` -------------------------------- ### Get Facebook User ID and Profile Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/facebook/readme.md This code demonstrates how to retrieve the currently logged-in user's ID and profile information using the Facebook PHP SDK. It includes error handling for potential API exceptions. ```php // Get User ID $user = $facebook->getUser(); if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); $user = null; } } ``` -------------------------------- ### Extract and Clean Style Blocks with PHP and CSSTidy Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/htmlpurifier/standalone/HTMLPurifier/ConfigSchema/schema/Filter.ExtractStyleBlocks.txt This PHP code snippet demonstrates how to use the Filter.ExtractStyleBlocks directive with HTML Purifier to remove and clean style blocks from HTML. It requires HTML Purifier and CSSTidy to be installed. The extracted styles can be saved to files or echoed into the document. ```php '; ?> Filter.ExtractStyleBlocks body {color:#F00;} Some text'; $config = HTMLPurifier_Config::createDefault(); $config->set('Filter', 'ExtractStyleBlocks', true); $purifier = new HTMLPurifier($config); $html = $purifier->purify($dirty); // This implementation writes the stylesheets to the styles/ directory. // You can also echo the styles inside the document, but it's a bit // more difficult to make sure they get interpreted properly by // browsers; try the usual CSS armoring techniques. $styles = $purifier->context->get('StyleBlocks'); $dir = 'styles/'; if (!is_dir($dir)) mkdir($dir); $hash = sha1($_GET['html']); foreach ($styles as $i => $style) { file_put_contents($name = $dir . $hash . "_$i"); echo ''; } ?>
``` -------------------------------- ### Get Character List with Filters - PHP Source: https://context7.com/tateck-develop/avocadoedition/llms.txt Fetches a list of characters, allowing filtering by side (faction/alignment), class, and approval status. The `get_character_list` function returns an array of character data, which can then be iterated over to display specific information. It requires the `_common.php` include. ```php "; } // Filter by side (faction/alignment) $side = 'hero'; $hero_characters = get_character_list($side, '', '승인'); // Filter by class $class = 'warrior'; $warrior_characters = get_character_list('', $class, '승인'); // Filter by both side and class $specific_chars = get_character_list('hero', 'mage', '승인'); // Display filtered results foreach ($specific_chars as $ch) { echo sprintf( "

%s

Side: %s | Class: %s

Rank: %s | EXP: %s

", $ch['ch_thumb'], $ch['ch_name'], $ch['ch_side'], $ch['ch_class'], $ch['ch_rank'], $ch['ch_exp'] ); } ?> ``` -------------------------------- ### Get Character Stats in PHP Source: https://context7.com/tateck-develop/avocadoedition/llms.txt Retrieves character statistics, including current, maximum, and consumed values for various attributes like HP and MP. It supports fetching stats by ID or name and displays them in a table. Requires _common.php and access to status configuration tables. ```php "; echo "StatCurrentMaximumConsumed"; while ($st_config = sql_fetch_array($st_result)) { $stat = get_status($ch_id, $st_config['st_id']); echo ""; echo "{$st_config['st_name']}"; echo "{$stat['now']}"; echo "{$stat['has']}"; echo "{$stat['drop']}"; echo ""; } echo ""; // Get total used stat points $used_points = get_use_status($ch_id); echo "Total Stat Points Used: {$used_points}"; // Get available unallocated points $available_points = get_space_status($ch_id); echo "Available Points: {$available_points}"; ?> ``` -------------------------------- ### Get Character Custom Fields - PHP Source: https://context7.com/tateck-develop/avocadoedition/llms.txt Retrieves custom profile fields for a character. It demonstrates fetching a single custom field value using `get_character_info` by providing the character ID and the custom field's article code. It also shows how to retrieve all custom fields by querying the `{$g5['value_table']}` directly and storing them in an associative array. ```php $value) { echo "
Field {$code}
{$value}
"; } ?> ``` -------------------------------- ### Initialize TwitterOAuth Object Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/twitter/README.md Shows how to create a new TwitterOAuth object using client credentials, either from a configuration file or directly provided as strings. ```PHP $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); $connection = new TwitterOAuth('abc890', '123xyz'); ``` -------------------------------- ### POP3 Authorization and PHP Mailer Implementation Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/docs/pop3_article.txt This PHP code snippet demonstrates how to authorize a POP3 connection before sending an email using PHP Mailer. It includes parameters for POP3 server details, credentials, and debug level. The subsequent lines configure and send an HTML email via SMTP. ```php authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); $mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->isSMTP(); $mail->isHTML(false); $mail->Host = 'relay.example.com'; $mail->From = 'mailer@example.com'; $mail->FromName = 'Example Mailer'; $mail->Subject = 'My subject'; $mail->Body = 'Hello world'; $mail->addAddress('rich@corephp.co.uk', 'Richard Davey'); if (!$mail->send()) { echo $mail->ErrorInfo; } ?> ``` -------------------------------- ### Rebuild TwitterOAuth with Temporary Credentials Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/twitter/README.md Demonstrates rebuilding the TwitterOAuth object using client credentials along with the temporary credentials obtained after user authorization. ```PHP $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); ``` -------------------------------- ### Color Keywords Hash Map (PHP) Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/htmlpurifier/standalone/HTMLPurifier/ConfigSchema/schema/Core.ColorKeywords.txt This snippet defines a PHP array representing a lookup for color names and their hexadecimal values. It's used internally for parsing colors and performs case-insensitive lookups. No external dependencies are required. ```php '#800000', 'red' => '#FF0000', 'orange' => '#FFA500', 'yellow' => '#FFFF00', 'olive' => '#808000', 'purple' => '#800080', 'fuchsia' => '#FF00FF', 'white' => '#FFFFFF', 'lime' => '#00FF00', 'green' => '#008000', 'navy' => '#000080', 'blue' => '#0000FF', 'aqua' => '#00FFFF', 'teal' => '#008080', 'black' => '#000000', 'silver' => '#C0C0C0', 'gray' => '#808080', ]; ?> ``` -------------------------------- ### Secure Private and Public Keys with .htaccess Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/docs/DomainKeys_notes.txt This snippet demonstrates how to protect sensitive DKIM private and public key files from unauthorized access using Apache's .htaccess configuration. It denies all access to files named .htkeyprivate and .htkeypublic. ```apache # secure htkeyprivate file order allow,deny deny from all # secure htkeypublic file order allow,deny deny from all ``` -------------------------------- ### Configure TwitterOAuth Parameters Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/twitter/README.md Demonstrates how to modify parameters of an existing TwitterOAuth object, such as setting the API version host, custom user agent, and SSL verification. ```PHP $connection->host = "https://api.twitter.com/1.1/"; $connection->useragent = 'Custom useragent string'; $connection->ssl_verifypeer = TRUE; ``` -------------------------------- ### Load PHPMailer using Autoloader Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/PHPMailer/README.md This snippet shows the recommended way to include the PHPMailer library in your PHP script using its SPL-compatible autoloader. This method simplifies class loading and is compatible with PHP 5.1.0 and later. ```php require '/path/to/PHPMailerAutoload.php'; ``` -------------------------------- ### Rebuild TwitterOAuth with Token Credentials Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/twitter/README.md Illustrates rebuilding the TwitterOAuth object using client credentials and the final token credentials, which are used for making authenticated API requests. ```PHP $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $token_credentials['oauth_token'], $token_credentials['oauth_token_secret']); ``` -------------------------------- ### Generate Facebook Login/Logout URLs Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/facebook/readme.md This snippet illustrates how to generate the appropriate URL for either logging a user into Facebook or logging them out, based on their current authentication state. ```php if ($user) { $logoutUrl = $facebook->getLogoutUrl(); } else { $loginUrl = $facebook->getLoginUrl(); } ``` -------------------------------- ### Calculate Rank Information in PHP Source: https://context7.com/tateck-develop/avocadoedition/llms.txt Determines a character's current rank and progression details based on their accumulated experience points. It utilizes functions to fetch rank names, experience thresholds, and calculates the percentage towards the next rank. Requires _common.php. ```php 0) { $current_rank_exp = $current_exp - get_rank_base_exp($rank_info['rank']); $percent = ($current_rank_exp / $rank_info['rest_exp']) * 100; } // Display progress bar echo "
"; echo "
"; echo "{$percent}% to Level Up"; echo "
"; // Get rank ID by name $rank_id = get_rank_id('Master'); echo "Rank ID for Master: {$rank_id}"; ?> ``` -------------------------------- ### Request Temporary Credentials Source: https://github.com/tateck-develop/avocadoedition/blob/master/AvocadoEdition/plugin/sns/twitter/README.md Illustrates how to request temporary credentials from Twitter using an existing TwitterOAuth object. The oauth_callback parameter is mandatory for this step. ```PHP $temporary_credentials = $connection->getRequestToken(OAUTH_CALLBACK); ``` -------------------------------- ### Inventory Operations in PHP Source: https://context7.com/tateck-develop/avocadoedition/llms.txt Manages character inventories by adding single or multiple items, retrieving detailed inventory item information, and deleting items. It also includes a function to display the character's entire inventory in a grid format with options to use items. Dependencies include common framework includes, character and item data, and inventory-specific functions. ```php "; while ($inv = sql_fetch_array($inv_result)) { echo "
{$inv['it_name']}
"; } echo ""; ?> ```