PHP Classes

File: tests/translate.php

Recommend this page to a friend!
  Classes of Ali YILMAZ   Mind Framework   tests/translate.php   Download  
File: tests/translate.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Mind Framework
Framework that implements several design patterns
Author: By
Last change:
Date: 1 year ago
Size: 2,207 bytes
 

Contents

Class file image Download
<?php

require_once '../src/Mind.php';
$conf = array(
   
// 'translate'=>array(
    // 'table' => 'translations',
    // 'column' => 'lang',
    // 'haystack' => 'name',
    // 'return' => 'text',
    // 'lang' => 'EN'
    // )
);

$Mind = new Mind($conf);

$scheme = array(
   
'id:increments',
   
'name:small',
   
'text:small',
   
'lang:small',
   
'user_id:small',
   
'_token:small',
   
'status:string',
   
'created_at:string',
   
'updated_at:string'
);

if(
$Mind->tableCreate('translations', $scheme)){
   
$data = array(
            array(
               
"name" => "dashboard",
               
"text" => "Dashboard",
               
"lang" => "EN",
               
"user_id" => 1,
               
"_token" => $Mind->generateToken(),
               
"status" => 1,
               
"created_at" => $Mind->timestamp
           
),
            array(
               
"name" => "profile-signout",
               
"text" => "Sign out",
               
"lang" => "EN",
               
"user_id" => 1,
               
"_token" => $Mind->generateToken(),
               
"status" => 1,
               
"created_at" => $Mind->timestamp
           
),
            array(
               
"name" => "dashboard",
               
"text" => "Ba?lang?ç",
               
"lang" => "TR",
               
"user_id" => 1,
               
"_token" => $Mind->generateToken(),
               
"status" => 1,
               
"created_at" => $Mind->timestamp
           
),
            array(
               
"name" => "profile-signout",
               
"text" => "Oturumu kapat",
               
"lang" => "TR",
               
"user_id" => 1,
               
"_token" => $Mind->generateToken(),
               
"status" => 1,
               
"created_at" => $Mind->timestamp
           
)
        );
       
   
$Mind->insert('translations', $data);
}

echo
$Mind->translate('dashboard'); // Varsay?lan olarak TR belirtildi?i için Ba?lang?ç geri döndürülür.
echo '<br />';
echo
$Mind->translate('dashboard', 'TR'); // Ba?lang?ç
echo '<br />';
echo
$Mind->translate('dashboard', 'EN'); // Dashboard