예제 #1
0
 /**
  * Determine the canonical name for the given property path.
  * Removes surrounding quotes from map keys:<br>
  * <pre>map['key']</pre> becomes <pre>map[key]</pre><br>
  * <pre>map["key"]</pre> becomes <pre>map[key]</pre>
  *
  * @param string $propertyName the bean property path
  * @return string the canonical representation of the property path
  */
 function canonicalPropertyName($propertyName)
 {
     if ($propertyName == null) {
         return "";
     }
     // The following code does not use JDK 1.4's StringBuffer.indexOf(String)
     // method to retain JDK 1.3 compatibility. The slight loss in performance
     // is not really relevant, as this code will typically just run on startup.
     $buf = $propertyName;
     $searchIndex = 0;
     while ($searchIndex != -1) {
         $keyStart = strpos($buf, PROPERTY_KEY_PREFIX, $searchIndex);
         $searchIndex = -1;
         if ($keyStart !== FALSE) {
             $keyEnd = strpos($buf, PROPERTY_KEY_SUFFIX, $keyStart + strlen(PROPERTY_KEY_PREFIX));
             if ($keyEnd !== FALSE) {
                 $key = substr2($buf, $keyStart + strlen(PROPERTY_KEY_PREFIX), $keyEnd);
                 if (str_starts_with($key, "'") && str_ends_with($key, "'") || str_starts_with($key, "\"") && str_ends_with($key, "\"")) {
                     substr_replace($buf, '', $keyStart + 1, 1);
                     substr_replace($buf, '', $keyEnd - 2, 1);
                     $keyEnd = $keyEnd - 2;
                 }
                 $searchIndex = $keyEnd + strlen(PROPERTY_KEY_SUFFIX);
             }
         }
     }
     return $buf;
 }
예제 #2
0
파일: news.php 프로젝트: Vladimir25/marykay
 function menu($count = 1, $type = 'news')
 {
     global $sets;
     if ($sets['view_news_premium']) {
         $this->refresh_antics();
     }
     if (!Site::gI()->check_is_main() && $sets['news_only_main']) {
         return false;
     }
     $show_title = 0;
     $width = 135;
     //максимальная длина превью новости
     News::gI()->update_type($type);
     $this->pref_link = $type;
     $date_str_t = '';
     $news = $this->db->get_rows("SELECT * FROM " . $this->table . " WHERE type=" . quote_smart($type) . " && antic != 1 ORDER BY date DESC, id DESC LIMIT " . $count . "");
     $news_antic = $this->db->get_rows("SELECT * FROM " . $this->table . " WHERE type=" . quote_smart($type) . " && antic = 1 ORDER BY date DESC, id DESC LIMIT " . $count . "");
     $news_menu = '';
     //Вроде вывод новостей
     if (count($news) > 0) {
         $news_title = $show_title ? $this->the_title[$this->type] : '';
         foreach ($news as $id => $res) {
             $news_href = !empty($res['vlink']) ? SITE_URL . htmlspecialchars($res['vlink']) : SITE_URL . $this->pref_link . '/' . $res['id'];
             //$news_href = SITE_URL.$this->pref_link
             $news_menu .= '<div class="news news_block_' . $id . '">';
             $news_menu .= '<div class="news_datetitle">';
             $news_menu .= '<div class="news_title"><a href="' . $news_href . '">' . htmlspecialchars(str_replace('&nbsp;', ' ', $res['t'])) . '</a></div>';
             /*datetitle*/
             if ($this->show_date) {
                 $news_menu .= '</div>';
             }
             $minheight = $this->show_photo() && is_file($res['photo']) ? ' style="min-height: 84px;" ' : '';
             $news_menu .= '<div class="news_text"' . $minheight . '>';
             if ($this->show_photo() && is_file($res['photo'])) {
                 $news_menu .= '<img class="news_image" src="' . SITE_URL . 'imgtmp/80_80/' . $res['photo'] . '" width="80" height="80" title="' . $res['t'] . '">';
             }
             $news_menu .= substr2(Strip_Tags(Trim(str_replace('&nbsp;', ' ', $res['txt']))), $width) . '</div>';
             /*news_text*/
             $news_menu .= '</div>';
             /*news_block_id*/
         }
         $news_menu .= '<div class="news_all"><div><a href="' . $this->pref_link . '/page/1">' . lg($this->all_title[$this->type]) . '</a></div>';
         if (count($news_antic) > 0) {
             $news_menu .= '<div><a href="' . $this->pref_link . '/antic/1">Архив</a></div>';
         }
         $news_menu .= '</div>';
     }
     return $news_menu;
 }
예제 #3
0
        ?>
" target="_blank"><?php 
        echo '<img src="' . SITE_URL . 'imgtmp/30_30/' . $row['foto'] . '" title="' . $row['title'] . '" style="float:left; margin: 0px 5px 2px 0px;">';
        ?>
</a>
		<?php 
    }
    ?>
		
		<?php 
    if (!empty($row['text']) || !empty($row['text2'])) {
        $text = strip_tags($row['text']);
        if (!empty($row['text2'])) {
            $text .= '<br> ' . strip_tags($row['text2']);
        }
        $text = substr2($text, 100);
        ?>
			<p style="padding-bottom: 5px; color: inherit;"><?php 
        echo $text;
        ?>
</p>
		<?php 
    }
    ?>
	</div>
<?php 
    if ($key == 4) {
        $show_all = '<div class="search_box">Всего найдено результатов: ' . count($rows) . '. <a href="search/' . $string . '">Показать все</a></div>';
        break;
    }
}
예제 #4
0
        ?>
" target="_blank"><?php 
        echo '<img src="' . SITE_URL . 'imgtmp/55_55/' . $row['foto'] . '" title="' . $row['title'] . '" style="float:left; margin: 0px 5px 2px 0px;">';
        ?>
</a>
		<?php 
    }
    ?>
		
		<?php 
    if (!empty($row['text']) || !empty($row['text2'])) {
        $text = strip_tags($row['text']);
        if (!empty($row['text2'])) {
            $text .= '<br> ' . strip_tags($row['text2']);
        }
        $text = substr2($text, 500);
        ?>
			<p style="padding-bottom: 5px;"><?php 
        echo $text;
        ?>
</p>
		<?php 
    }
    ?>
		
		<?php 
    if (!empty($row['tsena'])) {
        ?>
			<p style="padding-bottom: 5px;">Цена: <?php 
        echo Ishop::gI()->s_price($row['tsena']);
        ?>
예제 #5
0
        echo ' style="min-height: 134px;";';
    }
    ?>
>
			<?php 
    if ($this->show_photo() && !empty($art['photo'])) {
        ?>
				<img class="news_image" src="<?php 
        echo SITE_URL . 'imgtmp/130_130/' . $art['photo'] . '';
        ?>
" width="130" height="130" />
			<?php 
    }
    ?>
			<?php 
    echo substr2(strip_tags($art['txt']), 500);
    ?>
		</div>
		
		<div class="news_full"><a href="<?php 
    echo $news_href;
    ?>
"><?php 
    echo $this->news_descr;
    ?>
</a></div>
	</div>
<?php 
}
echo get_pages(array('class' => 'prd_pages_bottom', 'count_pages' => $c_pages, 'curr_page' => $page, 'link' => $this->type . '/' . $_GET['type'] . '/'));
$count_antic = $this->db->get_rows("SELECT * FROM " . TABLE_NEWS . " WHERE type=" . quote_smart($this->type) . " && antic = 1");
예제 #6
0
 function &_getPropertyNameTokens($propertyName)
 {
     $tokens = new PropertyTokenHolder();
     $actualName = null;
     $keys = array();
     $searchIndex = 0;
     while ($searchIndex !== -1) {
         $keyStart = strpos($propertyName, PROPERTY_KEY_PREFIX, $searchIndex);
         $searchIndex = -1;
         if ($keyStart !== FALSE) {
             $keyEnd = strpos($propertyName, PROPERTY_KEY_SUFFIX, $keyStart + strlen(PROPERTY_KEY_PREFIX));
             if ($keyEnd !== FALSE) {
                 if ($actualName == null) {
                     $actualName = substr2($propertyName, 0, $keyStart);
                 }
                 $key = substr2($propertyName, $keyStart + strlen(PROPERTY_KEY_PREFIX), $keyEnd);
                 if (str_starts_with($key, "'") && str_ends_with($key, "'") || str_starts_with($key, "\"") && str_ends_with($key, "\"")) {
                     $key = substr($key, 1, strlen($key) - 1);
                 }
                 $keys[] = $key;
                 $searchIndex = $keyEnd + strlen(PROPERTY_KEY_SUFFIX);
             }
         }
     }
     $tokens->actualName = $actualName != null ? $actualName : $propertyName;
     $tokens->canonicalName = $tokens->actualName;
     if (!empty($keys)) {
         $tokens->canonicalName .= PROPERTY_KEY_PREFIX . implode(PROPERTY_KEY_SUFFIX . PROPERTY_KEY_PREFIX, $keys) . PROPERTY_KEY_SUFFIX;
         $tokens->keys = $keys;
     }
     return $tokens;
 }
예제 #7
0
 function extractFilenameFromUrlPath($urlPath)
 {
     $begin = strrpos($urlPath, '/') + 1;
     $end = strpos($urlPath, ';');
     if ($end === FALSE) {
         $end = strpos($urlPath, '?');
         if ($end === FALSE) {
             $end = strlen($urlPath);
         }
     }
     $filename = substr2($urlPath, $begin, $end);
     $dotIndex = strrpos($filename, '.');
     if ($dotIndex !== FALSE) {
         $filename = substr($filename, 0, $dotIndex);
     }
     return $filename;
 }