public static function set_user_fields()
 {
     if (!isset(StaticClass::$_password_generated) && isset($_POST['user_pass'])) {
         StaticClass::$_password_generated = $_POST['user_pass'];
     }
     if (!isset(StaticClass::$_username_generated) && isset($_POST['user_login'])) {
         StaticClass::$_username_generated = sanitize_text_field($_POST['user_login']);
     }
     if (!isset(StaticClass::$_nickname_generated) && isset($_POST['nickname'])) {
         StaticClass::$_nickname_generated = sanitize_text_field($_POST['nickname']);
     }
 }
Beispiel #2
0
 public static function cred__add_custom_mime_types($mimes)
 {
     return StaticClass::$_allowed_mime_types = array_merge($mimes, StaticClass::$_allowed_mime_types);
 }
Beispiel #3
0
 public function __construct($value)
 {
     StaticClass::$static_value = $value;
 }
Beispiel #4
0
 public static function &_getStatic_($prop)
 {
     //Doing this whan is a ajax call (defined( 'DOING_AJAX' ) && DOING_AJAX)
     if (!($prop && property_exists("StaticClass", $prop))) {
         self::addFriendStatic('StaticClass', array('methods' => array(), 'properties' => array('_staticGlobal')));
     }
     list($hash, $prop, $ref) = StaticClass::parseFriendCallStatic($prop);
     $null = null;
     if ($prop && property_exists(__CLASS__, $prop) || $prop && property_exists("StaticClass", $prop)) {
         if ($hash && isset(StaticClass::$_____friendsStatic_____[$hash])) {
             if (isset(StaticClass::$_____friendsStatic_____[$hash]['properties']) && in_array($prop, StaticClass::$_____friendsStatic_____[$hash]['properties'])) {
                 //$_staticVars = get_class_vars(StaticClass::$_______class_______);
                 //return $_staticVars[$prop];
                 // PHP > 5.1
                 //$reflection = new ReflectionClass(StaticClass::$_______class_______);
                 //return $reflection->getStaticPropertyValue($prop);
                 if ($ref) {
                     $v =& StaticClass::__getPrivStaticRef($prop);
                 } else {
                     $v = StaticClass::__getPrivStatic($prop);
                 }
                 return $v;
             }
         }
     }
     trigger_error("Not available static property '{$prop}'", E_USER_WARNING);
     return $null;
 }
 /**
  * Check if a file has a expected filetype
  * @param type $filetype
  * @param type $expected_filetypes
  * @return type
  */
 private function is_correct_filetype($filename, $filetype, $expected_filetypes)
 {
     $filetypes = array();
     $filetypes['audio'] = array('mp3|m4a|m4b' => 'audio/mpeg', 'ra|ram' => 'audio/x-realaudio', 'wav' => 'audio/wav', 'ogg|oga' => 'audio/ogg', 'mid|midi' => 'audio/midi', 'wma' => 'audio/x-ms-wma', 'wax' => 'audio/x-ms-wax', 'mka' => 'audio/x-matroska');
     $filetypes['audio'] = apply_filters('audio_upload_mimes', $filetypes['audio']);
     $filetypes['video'] = array('asf|asx' => 'video/x-ms-asf', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wm' => 'video/x-ms-wm', 'avi' => 'video/avi', 'divx' => 'video/divx', 'flv' => 'video/x-flv', 'mov|qt' => 'video/quicktime', 'mpeg|mpg|mpe' => 'video/mpeg', 'mp4|m4v' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm', 'mkv' => 'video/x-matroska', '3gp|3gpp' => 'video/3gpp', '3g2|3gp2' => 'video/3gpp2');
     $filetypes['video'] = apply_filters('video_upload_mimes', $filetypes['video']);
     $filetypes['image'] = array('jpg|jpeg|jpe' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'bmp' => 'image/bmp', 'tif|tiff' => 'image/tiff', 'ico' => 'image/x-icon');
     $filetypes['image'] = apply_filters('image_upload_mimes', $filetypes['image']);
     $filetypes['file'] = array();
     $filetypes['file'] = StaticClass::$_allowed_mime_types;
     $filetypes['file'] = apply_filters('file_upload_mimes', $filetypes['file']);
     StaticClass::$_allowed_mime_types = $filetypes['file'];
     add_filter('upload_mimes', array('StaticClass', 'cred__add_custom_mime_types'));
     $ret = wp_check_filetype($filename, StaticClass::$_allowed_mime_types);
     return !empty($ret['ext']);
     //        $arr_filetypes_types = array_values($filetypes[$expected_filetypes]);
     //        $arr_filetypes_exts = array_keys($filetypes[$expected_filetypes]);
     //
     //        $arr = @explode("/", $filetype);
     //        $isok = (isset($arr) && count($arr) >= 2) ? (in_array($arr[1], $arr_filetypes_exts) || in_array($filetype, $arr_filetypes_types)) : false;
     //        return $isok;
 }
Beispiel #6
0
}
// $t3 = new Test3;
// echo $t3->shirina;
// echo $t3->boja;
// echo $t3->visina;
// $t3->boja = 'sina';
class Test4
{
    // ...
    public function __call($name, $args)
    {
        echo 'Method: ' . $name . ', Arguments: ' . implode(', ', $args);
    }
}
$t4 = new Test4();
$t4->brmBrm();
echo '<br/>';
$t4->test('Pero', 'Janko', 'Stanko');
echo '<br/>';
$t4->mjau();
class StaticClass
{
    public static $string;
    public static function length()
    {
        return strlen(self::$string);
    }
}
StaticClass::$string = 'Hello world!';
echo StaticClass::length();
<?php

$object->methodCall("\nfoo\nbar");
$object->methodCall('
foo
bar');
StaticClass::methodCall(<<<EOS
foo
bar
EOS
);
StaticClass::methodCall(<<<'EOS'
foo
bar
EOS
);
functionCall('Comment');
functionCall('Comment');
functionCall('Comment');
functionCall('Comment');