@param int $magic

@return string|false
19660
public function get_byteorder($magic)
    {
        // The magic is 0x950412de
        $magic_little = (int) - 1794895138;
        $magic_little_64 = (int) 2500072158;
        // 0xde120495
        $magic_big = ((int) - 569244523) & 0xFFFFFFFF;
        if ($magic_little == $magic || $magic_little_64 == $magic) {
            return 'little';
        } elseif ($magic_big == $magic) {
            return 'big';
        } else {
            return false;
        }
    }
1130323
public function get($rel)
    {
        if (array_key_exists($rel, $this)) {
            return $this[$rel];
        }

        if (isset($this['curies'])) {
            foreach ($this['curies'] as $link) {
                $prefix = strstr($link->getUri(), '{rel}', true);
                if (strpos($rel, $prefix) === 0) {
                    // looks like it is
                    $shortrel = substr($rel, strlen($prefix));
                    $attrs = $link->getAttributes();
                    $curie = "{$attrs['name']}:$shortrel";
                    if (isset($this[$curie])) {
                        return $this[$curie];
                    }
                }
            }
        }

        return false;
    }
205532
public static function get() {

        $keys = func_get_args();
        $value = $_SESSION;

        if (!empty($value) && !empty($keys)) {

            foreach ($keys as $number => $name) {

                if ($number == 0 && isset($value[$name])) {

                    $value = $value[$keys[0]];
                } else if ($number != 0 && isset($value[$name])) {

                    $value = $value[$name];
                } else {

                    return false;
                }
            }

            return $value;
        } else if (!empty($value)) {

            return $value;
        }

        return false;
    }
1037739
def filter_magic(source, magic, strip=True):
    
    filtered, magic_lines=[],[]
    for line in source.splitlines():
        if line.strip().startswith(magic):
            magic_lines.append(line)
        else:
            filtered.append(line)
    if strip:
        magic_lines = [el.replace(magic,'') for el in magic_lines]
    return '\n'.join(filtered), magic_lines
501299
public function MagicAssets($fake=false, $real=false) {
		if ( $fake !== false && $real !== false ) {
			$_SESSION['MAGIC'][$fake] = $real;
			return true;
		}

		if ( !empty($_SESSION['MAGIC']) ) {
			foreach($_SESSION['MAGIC'] as $symbol=>$link) {
				Base::instance()->route('GET|POST '.$symbol, function($f3) use ($symbol, $link) {	
					$ext = pathinfo($link, PATHINFO_EXTENSION);
					$filename = basename($link);
					$directory = $f3->get("ROOT").dirname($link)."/";
					if ( $ext == "js" ) {
						$js =  Web::instance()->minify($filename, null, true, $directory);
						$js = preg_replace('/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\'|\")\/\/.*))/', '', $js);
						header("Content-type: application/x-javascript");
						echo Template::instance()->resolve(Template::instance()->parse($js));
						exit();
					} elseif( $ext == "css" ) {
						header("Content-type: text/css");
					} else {
						header("Content-type: text/css");
						echo "/* SCSS currently disabled */";
						exit;
						$css = file_get_contents($directory.$filename);
						$js = str_replace("{{uuid}}", $f3->get("SESSION.uuid"), $js);
						$scss = new Compiler();
						echo $scss->compile($css);
						exit;
					}
					echo Template::instance()->resolve(Template::instance()->parse(file_get_contents($f3->get("ROOT").'/'.$link)));
					exit;
				});
			}
			return true;
		}
		return false;
	}
482370
protected function magicIsset($key)
    {
        if (!$this->magicInited) {
            $this->magicInit();
        }
        $exists = &$this->magicFields['exists'];
        if (!array_key_exists($key, $exists)) {
            if (array_key_exists($key, $this->magicFields['fields'])) {
                $exists[$key] = true;
            } elseif (isset($this->magicFields['loaders'][$key])) {
                $exists[$key] = true;
            } else {
                $exists[$key] = $this->magicExistsField($key);
            }
        }
        return $exists[$key];
    }
1068377
protected function getSetterName($entity, $propertyName)
    {
        $prefixes = ['add', 'set'];

        foreach ($prefixes as $prefix) {
            $methodName = sprintf('%s%s', $prefix, ucfirst(strtolower($propertyName)));

            if (method_exists($entity, $methodName)) {
                return $methodName;
            }
        }
        return false;
    }
536796
public function getLevel($entity)
    {
        $primaryKey = $this->_getPrimaryKey();
        $id = $entity;
        if ($entity instanceof EntityInterface) {
            $id = $entity->get($primaryKey);
        }
        $config = $this->getConfig();
        $entity = $this->_table->find('all')
            ->select([$config['left'], $config['right']])
            ->where([$primaryKey => $id])
            ->first();

        if ($entity === null) {
            return false;
        }

        $query = $this->_table->find('all')->where([
            $config['left'] . ' <' => $entity[$config['left']],
            $config['right'] . ' >' => $entity[$config['right']],
        ]);

        return $this->_scope($query)->count();
    }
1153753
public function do_magic_tags( $code ) {

		/**
		 * Filters the Pods magic tags content before the default function.
		 * Allows complete replacement of the Pods magic tag engine.
		 *
		 * @param null   $pre  Default is null which processes magic tags normally. Return any other value to override.
		 * @param string $code The content to evaluate.
		 * @param Pods   $pods The Pods Object.
		 *
		 * @since 2.7.0
		 */
		$pre = apply_filters( 'pods_pre_do_magic_tags', null, $code, $this );
		if ( null !== $pre ) {
			return $pre;
		}

		return preg_replace_callback( '/({@(.*?)})/m', array( $this, 'process_magic_tags' ), $code );
	}
140902
public static function __getMimeType(&$file)
        {
            $type = false;
            // Fileinfo documentation says fileinfo_open() will use the
            // MAGIC env var for the magic file
            if (extension_loaded('fileinfo') && isset($_ENV['MAGIC']) && ($finfo = finfo_open(FILEINFO_MIME, $_ENV['MAGIC'])) !== false) {
                if (($type = finfo_file($finfo, $file)) !== false) {
                    // Remove the charset and grab the last content-type
                    $type = explode(' ', repl('; charset=', ';charset=', $type));
                    $type = array_pop($type);
                    $type = explode(';', $type);
                    $type = trim(array_shift($type));
                }
                finfo_close($finfo);

            // If anyone is still using mime_content_type()
            } elseif (function_exists('mime_content_type')) {
                $type = trim(mime_content_type($file));
            }

            if ($type !== false && strlen($type) > 0) {
                return $type;
            }

            // Otherwise do it the old fashioned way
            static $exts = array(
                'jpg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png',
                'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'ico' => 'image/x-icon',
                'swf' => 'application/x-shockwave-flash', 'pdf' => 'application/pdf',
                'zip' => 'application/zip', 'gz' => 'application/x-gzip',
                'tar' => 'application/x-tar', 'bz' => 'application/x-bzip',
                'bz2' => 'application/x-bzip2', 'txt' => 'text/plain',
                'asc' => 'text/plain', 'htm' => 'text/html', 'html' => 'text/html',
                'css' => 'text/css', 'js' => 'text/javascript',
                'xml' => 'text/xml', 'xsl' => 'application/xsl+xml',
                'ogg' => 'application/ogg', 'mp3' => 'audio/mpeg', 'wav' => 'audio/x-wav',
                'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
                'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php'
            );

            $ext = Inflector::lower(pathInfo($file, PATHINFO_EXTENSION));

            return isset($exts[$ext]) ? $exts[$ext] : 'application/octet-stream';
        }
618002
public function page($entity) {
		if ($entity->type !== 'namespace') {
			return false;
		}
		return Pages::find('first', [
			'conditions' => [
				'index' => $entity->index,
				'name' => $entity->name
			]
		]);
	}
12013
def magic_read(self,infile):
        
#        print "calling magic_read(self, infile)", infile
        hold,magic_data,magic_record,magic_keys=[],[],{},[]
        try:
            f=open(infile,"r")
        except:
            return [],'bad_file'
        d = f.readline()[:-1].strip('\n')
        if d[0]=="s" or d[1]=="s":
            delim='space'
        elif d[0]=="t" or d[1]=="t":
            delim='tab'
        else:
            print('error reading ', infile)
            sys.exit()
        if delim=='space':file_type=d.split()[1]
        if delim=='tab':file_type=d.split('\t')[1]
        if file_type=='delimited':
            if delim=='space':file_type=d.split()[2]
            if delim=='tab':file_type=d.split('\t')[2]
        if delim=='space':line =f.readline()[:-1].split()
        if delim=='tab':line =f.readline()[:-1].split('\t')
        for key in line:
            magic_keys.append(key)
        lines=f.readlines()
        for line in lines[:-1]:
            line.replace('\n','')
            if delim=='space':rec=line[:-1].split()
            if delim=='tab':rec=line[:-1].split('\t')
            hold.append(rec)
        line = lines[-1].replace('\n','')
        if delim=='space':rec=line[:-1].split()
        if delim=='tab':rec=line.split('\t')
        hold.append(rec)
        for rec in hold:
            magic_record={}
            if len(magic_keys) != len(rec):

                print("Warning: Uneven record lengths detected: ")
                #print magic_keys
                #print rec
            for k in range(len(rec)):
               magic_record[magic_keys[k]]=rec[k].strip('\n')
            magic_data.append(magic_record)
        magictype=file_type.lower().split("_")
        Types=['er','magic','pmag','rmag']
        if magictype in Types:file_type=file_type.lower()
#        print "magic data from magic_read:"
#        print str(magic_data)[:500] + "..."
#        print "file_type", file_type
        return magic_data,file_type
1335188
public function getMagicFile()
    {
        if (null === $this->_magicfile) {
            if (!empty($_ENV['MAGIC'])) {
                $this->setMagicFile($_ENV['MAGIC']);
            } elseif (!(@ini_get("safe_mode") == 'On' || @ini_get("safe_mode") === 1)) {
                // require_once 'Zend/Validate/Exception.php';
                foreach ($this->_magicFiles as $file) {
                    // supressing errors which are thrown due to openbase_dir restrictions
                    try {
                        $this->setMagicFile($file);
                        if ($this->_magicfile !== null) {
                            break;
                        }
                    } catch (Zend_Validate_Exception $e) {
                        // Intentionally, catch and fall through
                    }
                }
            }

            if ($this->_magicfile === null) {
                $this->_magicfile = false;
            }
        }

        return $this->_magicfile;
    }
550416
public static boolean compareMagics (byte[] magic1,byte[] magic2) {
	if (magic1.length!=magic2.length) {
		return false;
	}
	for (int i=0;i<magic1.length;i++) {
		if (magic1[i]!=magic2[i]) {
			 return false;
		}
	}
	return true;	

}
879142
public function getIsDecimalEven( $precision = false )
	{
		if ( ! $this->getIsDecimal() ) {
			return false;
		}

		if ( $precision === false ) $precision = $this->scale( $this->_value );
		if ( $precision < 0 ) $precision = $precision = 0;

		$decimalPart = $this->getDecimalPart();
		if ( $precision >= strlen( $decimalPart ) ) return false;

		// Get the portion of the decimal part affected by the scale value
		$decimalPart = substr( $decimalPart, $precision );
		return $decimalPart[0] % 2 === 0;
	}
73174
public static function domainToUnicode($domain)
    {
        return mb_strlen($domain, 'UTF-8') <= self::PHP_IDN_HANDLEABLE_LENGTH
            ? idn_to_utf8($domain, 0, INTL_IDNA_VARIANT_UTS46)
            : false;
    }
715473
def populate_and_check_magic
      magic = @raw_data[0..3].unpack("N").first

      raise MagicError, magic unless Utils.magic?(magic)
      raise FatBinaryError if Utils.fat_magic?(magic)

      @endianness = Utils.little_magic?(magic) ? :little : :big

      magic
    end