当前位置: 首页>>代码示例>>PHP>>正文


PHP Utilities::load_file方法代码示例

本文整理汇总了PHP中Utilities::load_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::load_file方法的具体用法?PHP Utilities::load_file怎么用?PHP Utilities::load_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Utilities的用法示例。


在下文中一共展示了Utilities::load_file方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initialize

 protected function initialize()
 {
     if (BUILD_DATABASE === TRUE) {
         $sql_filepath = 'assets/plugins/' . strtolower($this->page_type) . '/assets/sql/build_plugin_tables.sql';
         // If custom DB tables are required for the plugin, build them here
         if (file_exists($sql_filepath) and is_readable($sql_filepath)) {
             $sql = Utilities::load_file($sql_filepath);
             try {
                 $this->db->query($sql);
             } catch (Exception $e) {
                 ECMS_Error::log_exception($e);
             }
         }
     }
     // Add custom actions for the plugin or allow overwrite of core actions
     $this->access_points = array_merge($this->access_points, $this->register_custom_actions());
 }
开发者ID:RobMacKay,项目名称:Helix,代码行数:17,代码来源:abstract.helix_plugin.inc.php

示例2: build_database

 /**
  * Creates the database tables necessary for the CMS to function
  *
  * @param array $menuPages  The menu configuration array
  * @return void
  */
 public static function build_database()
 {
     // Loads necessary MySQL to build and populate the database
     $file_array = array();
     $var_arr = array();
     $file_array[] = CMS_PATH . 'core/resources/sql/build_database.sql';
     $file_array[] = CMS_PATH . 'core/resources/sql/build_table_pages.sql';
     $file_array[] = CMS_PATH . 'core/resources/sql/build_table_entries.sql';
     $file_array[] = CMS_PATH . 'core/resources/sql/build_table_categories.sql';
     $file_array[] = CMS_PATH . 'core/resources/sql/build_table_entry_categories.sql';
     $file_array[] = CMS_PATH . 'core/resources/sql/build_table_featured.sql';
     $file_array[] = CMS_PATH . 'core/resources/sql/build_table_users.sql';
     $file_array[] = CMS_PATH . 'core/resources/sql/build_table_comments.sql';
     // If an admin is initializing the ECMS, create his or her account
     if (DEV_PASS !== '') {
         $filepath = CMS_PATH . 'core/resources/sql/insert_users_entry.sql';
         // Create a salted hash of the password
         $password_hash = AdminUtilities::createSaltedHash(DEV_PASS);
         // Assign variables needed to properly parse the file
         $var_arr = array($filepath => array('display' => DEV_DISPLAY_NAME, 'username' => DEV_USER_NAME, 'email' => DEV_EMAIL, 'vcode' => sha1(uniqid(time(), TRUE)), 'clearance' => DEV_CLEARANCE, 'password' => $password_hash));
         // Add the file to the array
         $file_array[] = $filepath;
     }
     // Load the files
     $sql = Utilities::load_file($file_array, $var_arr);
     // Execute the loaded queries
     try {
         $dsn = "mysql:host=" . DB_HOST . ";dbname=" . DB_NAME;
         $db = new PDO($dsn, DB_USER, DB_PASS);
         $db->query($sql);
     } catch (Exception $e) {
         ECMS_Error::log_exception($e);
     }
 }
开发者ID:RobMacKay,项目名称:Helix,代码行数:40,代码来源:class.db_actions.inc.php

示例3: _send_verification_email

    private function _send_verification_email($to, $vcode)
    {
        // Generate the From: field data
        if (isset($_SESSION['user'])) {
            $from = $_SESSION['user']['name'] . ' <' . $_SESSION['user']['email'] . '>';
        } else {
            ECMS_Error::log_exception(new Exception('You must be logged in to do that.'));
        }
        // Create a boundary string to separate the email parts
        $mime_boundary = '_x' . sha1(time()) . 'x';
        // Create the email subject
        $subject = '[' . SITE_NAME . '] An Account Has Been Created for You!';
        // Generate headers for the email
        $headers = <<<MESSAGE
From: {$from}
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="==PHP-alt{$mime_boundary}"
MESSAGE;
        // Email location
        $filepath = CMS_PATH . 'core/resources/email/verification.email';
        // Variables for the email
        $var_arr = array('mime_boundary' => $mime_boundary, 'vcode' => $vcode);
        // Load the message
        $message = Utilities::load_file($filepath, $var_arr);
        return mail($to, $subject, $message, $headers);
    }
开发者ID:RobMacKay,项目名称:Helix,代码行数:27,代码来源:class.admin.inc.php

示例4: _send_comment_notification

 private function _send_comment_notification($comment)
 {
     // Generate the From: field data
     $from = SITE_NAME . ' <' . SITE_CONTACT_EMAIL . '>';
     // Create a boundary string to separate the email parts
     $mime_boundary = '_x' . sha1(time()) . 'x';
     // Load entry data
     $this->get_entry_by_id($comment->entry_id);
     if (is_object($this->entries[0])) {
         // Create the email subject
         $subject = '[' . SITE_NAME . '] New Comment on "' . $this->entries[0]->title . '"';
         // Load the page data to get the slug
         $page = $this->get_page_data_by_id($this->entries[0]->page_id);
         $entry_link = SITE_URL . $page->page_slug . '/' . $this->entries[0]->slug;
         $comment_link = $entry_link . '#comment-' . $comment->comment_id;
     } else {
         throw new Exception("Something went wrong loading entry data!");
     }
     // Generate headers for the email
     $headers = "From: {$from}\nMIME-Version: 1.0\n" . "Content-Type: multipart/alternative;\n" . ' boundary="==PHP-alt' . $mime_boundary . '"';
     // Email location
     $filepath = CMS_PATH . 'core/resources/email/comment-notification.email';
     // Variables for the email
     $var_arr = array('mime_boundary' => $mime_boundary, 'commenter' => $comment->name, 'comment' => $comment->comment, 'comment_link' => $comment_link, 'entry_link' => $entry_link, 'entry_title' => $this->entries[0]->title);
     // Load the message
     $template_message = Utilities::load_file($filepath, $var_arr);
     // Load comment subscribers
     $subscribers = $this->get_comment_subscribers($comment->entry_id);
     // Loop through subscribers and send the email
     foreach ($subscribers as $subscriber) {
         $to = $subscriber->name . ' <' . $subscriber->email . '>';
         // Generate an unsubscribe link for each
         $unsubscribe_link = SITE_URL . 'comments/notifications/' . $comment->entry_id . '/' . Utilities::strtohex($subscriber->email);
         // Insert the custom unsubscribe link into the message
         $replace_pairs = array('{unsubscribe_link}' => $unsubscribe_link);
         $message = strtr($template_message, $replace_pairs);
         mail($to, $subject, $message, $headers);
     }
 }
开发者ID:RobMacKay,项目名称:Helix,代码行数:39,代码来源:class.comments.inc.php


注:本文中的Utilities::load_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。