This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<video src="sample.mp4" controls> | |
<track kind="subtitles" src="sub_enUS.vtt" srclang="en-us" label="English (US)" default> | |
<track kind="subtitles" src="sub_zhTW.vtt" srclang="zh-tw" label="正體中文"> | |
</video> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration> | |
<system.webServer> | |
<rewrite> | |
<rules> | |
<rule name="Imported Rule 1" stopProcessing="true"> | |
<match url="^" ignoreCase="false" /> | |
<conditions logicalGrouping="MatchAll"> | |
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" /> | |
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ericsk/WindowsAzure/WindowsAzureTableSessionHandler.php'; | |
use ericsk\WindowsAzure\WindowsAzureTableSessionHandler; | |
$sessionHandler = new WindowsAzureTableSessionHandler( | |
'YOUR_TABLE_STORAGE_ACCOUNT_NAME', | |
'YOUR_TABLE_STORAGE_ACCOUNT_KEY' | |
); | |
session_set_save_handler($session_handler, TRUE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Callback function for session handler. It's invoked while the session garbage collection starts. | |
* | |
* @param $lifeTime Specify the expiry time for cleaning outdated sessions. | |
* | |
* @return boolean If the gc operation success. | |
*/ | |
public function gc($lifeTime) { | |
// search the entities that need to be deleted. | |
$filter = 'PartitionKey eq\'' . $this->_sessionContainerPartition . '\' and expires lt ' . (time() - $lifeTime); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Callback function for session handler. It's invoked while the session is being destroyed. | |
* | |
* @param $sessionId The session ID. | |
* | |
* @return boolean If the destroy process success. | |
*/ | |
public function destroy($sessionId) { | |
try { | |
$this->_tableRestProxy->deleteEntity($this->_sessionContainer, $this->_sessionContainerParition, $sessionId); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Callback function for session handler. It's invoked while the session data is being read. | |
* | |
* @param $sessionId The session ID. | |
* | |
* @return string The session data. It will retrun empty string if the session doesn't exist. | |
*/ | |
public function read($sessionId) { | |
try { | |
// try to retrieve the session content first to see if it exists |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Callback function for session handler. It's invoked while the session data is being written. | |
* | |
* @param $sessionId The session ID. | |
* @param $sessionData The data to be written in session. | |
* | |
* @return boolean If the write operation success. | |
*/ | |
public function write($sessionId, $sessionData) { | |
// serialize and encode the session data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Callback function for session handler. It's invoked while the session is being opened. | |
* | |
* @param $savePath The path to store the session. | |
* @param $sessionName The name of the session. | |
* | |
* @return boolean If the open operation success. | |
*/ | |
public function open($savePath, $sessionName) { | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Session handler constructor. | |
* | |
* @param $storageAccountName The Windows Azure Table Services account name. | |
* @param $storageAccountKey The Windows Azure Table Service account key. | |
* @param $sessionContainer The name of the table for storing session data. | |
* @param $sessionContainerParition The name of the partition for storing session data. | |
*/ | |
public function __construct($storageAccountName, $storageAccountKey, $sessionContainer = 'phpsessions', $sessionContainerPartition = 'sessions') { | |
// create the conneciton string for creating the table service rest proxy intance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WindowsAzureTableSessionHandler implements SessionHandlerInterface { | |
... | |
public function __construct($storageAccountName, $storageAccountKey, | |
$sessionContainer = 'phpsessions', $sessionContainerPartition = 'sessions') { ... } | |
public function __destruct() { ... } | |
public function open($savePath, $sessionName) { ... } |
NewerOlder