function leftAndRightPadding($offset) { crawlerLog("INSIDE " . __FILE__ . ' - ' . __CLASS__ . '::' . __FUNCTION__ . '() - ' . 'line ' . __LINE__); $before = ''; $middle = StringUtil::getCharAt($this->text, $offset); $after = ''; $infOffset = $offset - 1; $supOffset = $offset + 1; $infPadding = false; $supPadding = false; for ($i = 0; $i < self::$paddingNumber; $i++) { if ($infOffset < 0) { //$before = self::$paddingChar . $before; $before = $before . self::$paddingChar; } else { if (!$infPadding) { $infCh = StringUtil::getCharAt($this->text, $infOffset); $infPadding = self::isSeparator($infCh); } if ($infPadding) { //$before = self::$paddingChar . $before; $before = $before . self::$paddingChar; } else { //$before = $infCh . $before; $before = $before . $infCh; $infOffset--; } } if ($supOffset > $this->textEndOffset) { $after = $after . self::$paddingChar; } else { if (!$supPadding) { $supCh = StringUtil::getCharAt($this->text, $supOffset); $supPadding = self::isSeparator($supCh); } if ($supPadding) { $after = $after . self::$paddingChar; } else { $after = $after . $supCh; $supOffset++; } } } crawlerLog("IN TEXT " . $before . '|' . $middle . '|' . $after); $tableObj = Diacritics::entryExists($before, $middle, $after); if ($tableObj != null) { crawlerLog("Entry Exists"); $ch = $this->getAllCharForms($tableObj, $middle); $textSubstr = mb_substr($this->text, $this->lastOffset, $offset - $this->lastOffset); $this->resultText .= $textSubstr; $this->hiddenText .= $textSubstr; $this->resultText .= $ch; if (mb_strlen($ch) == 1) { $this->hiddenText .= $ch; } else { $this->hiddenText .= "@@" . ($this->selectCount - 1) . "@@"; } } else { $textSubstr = mb_substr($this->text, $this->lastOffset, $offset - $this->lastOffset + 1); $this->resultText .= $textSubstr; $this->hiddenText .= $textSubstr; } $this->lastOffset = $this->currOffset; }
function leftAndRightPadding($offset) { Applog::log("INSIDE " . __FILE__ . ' - ' . __CLASS__ . '::' . __FUNCTION__ . '() - ' . 'line ' . __LINE__, 4); $before = ''; $middle = StringUtil::getCharAt($this->file, $offset); $after = ''; $infOffset = $offset - 1; $supOffset = $offset + 1; $infPadding = false; $supPadding = false; for ($i = 0; $i < self::$paddingNumber; $i++) { if ($infOffset < 0) { //$before = self::$paddingChar . $before; $before = $before . self::$paddingChar; } else { if (!$infPadding) { $infCh = StringUtil::getCharAt($this->file, $infOffset); $infPadding = self::isSeparator($infCh); } if ($infPadding) { //$before = self::$paddingChar . $before; $before = $before . self::$paddingChar; } else { //$before = $infCh . $before; $before = $before . $infCh; $infOffset--; } } if ($supOffset > $this->fileEndOffset) { $after = $after . self::$paddingChar; } else { if (!$supPadding) { $supCh = StringUtil::getCharAt($this->file, $supOffset); $supPadding = self::isSeparator($supCh); } if ($supPadding) { $after = $after . self::$paddingChar; } else { $after = $after . $supCh; $supOffset++; } } } Diacritics::save2Db($before, $middle, $after); }