コード例 #1
0
 function XYZ_Lab($o)
 {
     $r = $this->White;
     function fu($n)
     {
         if ($n > 0.008855999999999999) {
             return pow($n, 1 / 3);
         } else {
             return 7.787 * $n + 16 / 116;
         }
     }
     $X = fu($o['X'] / $r['X']);
     $Y = fu($o['Y'] / $r['Y']);
     $Z = fu($o['Z'] / $r['Z']);
     return array('L' => 116 * $Y - 16, 'a' => 500 * ($X - $Y), 'b' => 200 * ($Y - $Z));
 }
コード例 #2
0
ファイル: redirectman.php プロジェクト: noplanman/RedirectMan
 function get_next_redirection($circulars_clean, $redirect_to_new)
 {
     foreach ($circulars_clean as $redirection_id => $circular) {
         // If the current redirection has already been handled, continue.
         //        if ( array_key_exists( $redirection_id, $this->_parsed_redirections ) || in_array( $redirection_id, $this->_circular_ids ) ) {
         //          continue;
         //        }
         extract($circular);
         if ($redirect_to == $redirect_to_new) {
             //return false;
         }
         $root = true;
         // If the redirect_to is not at root level (/xyz), check only last part of redirect_from.
         /*        if ( 0 !== strpos( $redirect_to_new, '/' ) ) {
                   // Deeper level.
                   $root = false;
                   $redirect_from = substr( strrchr( $redirect_from, '/' ), 1 );
                 }*/
         if (0 !== strpos($redirect_to_new, '/')) {
             // Deeper level.
             $root = false;
             $a = substr($redirect_from, strrpos($redirect_from, '/'));
             fu($redirect_to_new);
             $redirect_from = substr(strrchr($redirect_from, '/'), 1);
         }
         if (false !== strpos($redirect_from, '*')) {
             // WILDCARD redirection.
             $redirect_from = str_replace('*', '(.*)', $redirect_from);
             $pattern = '/^' . str_replace('/', '\\/', $redirect_from) . '$/';
             /*echo "<pre>";
             var_dump("pattern: ".$pattern);
             var_dump("from   : ".$redirect_from);
             var_dump("to_new : ".$redirect_to_new);
             var_dump("matched: ".preg_match( $pattern, $redirect_to_new ));
             echo "</pre>";*/
             if (preg_match($pattern, $redirect_to_new)) {
                 // Pattern matched.
                 return $redirection_id;
             }
         } elseif ($redirect_from === $redirect_to_new) {
             // SIMPLE redirection.
             return $redirection_id;
         }
     }
     return false;
 }