当前位置: 首页>>代码示例>>PHP>>正文


PHP Text::recorta方法代码示例

本文整理汇总了PHP中Goteo\Library\Text::recorta方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::recorta方法的具体用法?PHP Text::recorta怎么用?PHP Text::recorta使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Goteo\Library\Text的用法示例。


在下文中一共展示了Text::recorta方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAll

 public static function getAll($highlights = false)
 {
     $list = array();
     $sql = static::query("\n                SELECT\n                    news.id as id,\n                    IFNULL(news_lang.title, news.title) as title,\n                    IFNULL(news_lang.description, news.description) as description,\n                    news.url as url,\n                    news.order as `order`\n                FROM news\n                LEFT JOIN news_lang\n                    ON  news_lang.id = news.id\n                    AND news_lang.lang = :lang\n                ORDER BY `order` ASC, title ASC\n                ", array(':lang' => \LANG));
     foreach ($sql->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $item) {
         if ($highlights) {
             $item->title = Text::recorta($item->title, 80);
         }
         $list[] = $item;
     }
     return $list;
 }
开发者ID:isbkch,项目名称:Goteo,代码行数:12,代码来源:news.php

示例2: getAll

 public static function getAll($activeonly = false, $node = \GOTEO_NODE)
 {
     // estados
     $status = Project::status();
     $promos = array();
     $sqlFilter = $activeonly ? " AND promote.active = 1" : '';
     $query = static::query("\n                SELECT\n                    promote.id as id,\n                    promote.project as project,\n                    project.name as name,\n                    project.status as status,\n                    IFNULL(promote_lang.title, promote.title) as title,\n                    IFNULL(promote_lang.description, promote.description) as description,\n                    promote.order as `order`,\n                    promote.active as `active`\n                FROM    promote\n                LEFT JOIN promote_lang\n                    ON promote_lang.id = promote.id\n                    AND promote_lang.lang = :lang\n                INNER JOIN project\n                    ON project.id = promote.project\n                WHERE promote.node = :node\n                {$sqlFilter}\n                ORDER BY `order` ASC, title ASC\n                ", array(':node' => $node, ':lang' => \LANG));
     foreach ($query->fetchAll(\PDO::FETCH_CLASS, __CLASS__) as $promo) {
         $promo->description = Text::recorta($promo->description, 100, false);
         $promo->status = $status[$promo->status];
         $promos[] = $promo;
     }
     return $promos;
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:14,代码来源:promote.php

示例3:

]</a></td>
                <td><a href="/admin/users/manage/<?php 
        echo $reward->user;
        ?>
" target="_blank" title="<?php 
        echo $reward->name;
        ?>
"><?php 
        echo $reward->email;
        ?>
</a></td>
                <td><a href="/admin/projects/?name=<?php 
        echo $this['projects'][$reward->project];
        ?>
" target="_blank"><?php 
        echo Text::recorta($this['projects'][$reward->project], 20);
        if (!empty($invest->campaign)) {
            echo '<br />(' . $this['calls'][$invest->campaign] . ')';
        }
        ?>
</a></td>
                <td><?php 
        echo $reward->reward_name;
        ?>
</td>
                <?php 
        if (!$reward->fulfilled) {
            ?>
                    <td style="color: red;" ><?php 
            echo Text::_('Pendiente');
            ?>
开发者ID:kenjs,项目名称:Goteo,代码行数:31,代码来源:list.html.php

示例4:

                    <li><a href="/glossary"><?php 
echo Text::get('footer-resources-glossary');
?>
</a></li>
                    <li><a href="/press"><?php 
echo Text::get('footer-resources-press');
?>
</a></li>
                    <?php 
foreach ($posts as $id => $title) {
    ?>
                    <li><a href="/blog/<?php 
    echo $id;
    ?>
"><?php 
    echo Text::recorta($title, 50);
    ?>
</a></li>
                    <?php 
}
?>
                    <li><a href="https://github.com/Goteo/Goteo" target="_blank"><?php 
echo Text::get('footer-resources-source_code');
?>
</a></li>
                </ul>
            </div>
			<script type="text/javascript">
				$(function(){
					$('#slides_sponsor').slides({
						container: 'slides_container',
开发者ID:anvnguyen,项目名称:Goteo,代码行数:31,代码来源:footer.html.php

示例5: process

 public static function process($action = 'list', $id = null, $filters = array())
 {
     $errors = array();
     $node = empty($_SESSION['admin_node']) ? \GOTEO_NODE : $_SESSION['admin_node'];
     $blog = Model\Blog::get($node, 'node');
     if (!$blog instanceof \Goteo\Model\Blog) {
         $blog = new Model\Blog(array('type' => 'node', 'owner' => $node, 'active' => 1));
         if ($blog->save($errors)) {
             Message::Info(Text::get('admin-blog-info-initialize'));
         } else {
             Message::Error(Text::get('admin-blog-error-initialize'));
             throw new Redirection('/admin');
         }
     } elseif (!$blog->active) {
         Message::Error(Text::get('admin-blog-error-no_blog'));
         throw new Redirection('/admin');
     }
     // primero comprobar que tenemos blog
     if (!$blog instanceof Model\Blog) {
         Message::Error(Text::get('admin-blog-error-not_found'));
         throw new Redirection('/admin');
     }
     $url = '/admin/blog';
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         if (empty($_POST['blog'])) {
             Message::Error(Text::get('admin-blog-error_missing_blog'));
             break;
         }
         $editing = false;
         if (!empty($_POST['id'])) {
             $post = Model\Blog\Post::get($_POST['id']);
         } else {
             $post = new Model\Blog\Post();
         }
         // campos que actualizamos
         $fields = array('id', 'blog', 'title', 'text', 'image', 'media', 'legend', 'date', 'publish', 'home', 'footer', 'allow', 'author');
         foreach ($fields as $field) {
             $post->{$field} = $_POST[$field];
         }
         // tratar la imagen y ponerla en la propiedad image
         if (!empty($_FILES['image_upload']['name'])) {
             $post->image = $_FILES['image_upload'];
             $editing = true;
         }
         // tratar las imagenes que quitan
         foreach ($post->gallery as $key => $image) {
             if (!empty($_POST["gallery-{$image->id}-remove"])) {
                 $image->remove('post');
                 unset($post->gallery[$key]);
                 if ($post->image == $image->id) {
                     $post->image = '';
                 }
                 $editing = true;
             }
         }
         if (!empty($post->media)) {
             $post->media = new Model\Project\Media($post->media);
         }
         $post->tags = $_POST['tags'];
         // si tenemos un nuevio tag hay que añadirlo
         if (!empty($_POST['new-tag_save']) && !empty($_POST['new-tag'])) {
             // grabar el tag en la tabla de tag,
             $new_tag = new Model\Blog\Post\Tag(array('id' => '', 'name' => $_POST['new-tag']));
             if ($new_tag->save($errors)) {
                 $post->tags[] = $new_tag->id;
                 // asignar al post
             } else {
                 Message::Error(implode('<br />', $errors));
             }
             $editing = true;
             // seguir editando
         }
         /// este es el único save que se lanza desde un metodo process_
         if ($post->save($errors)) {
             if ($action == 'edit') {
                 Message::Info(Text::get('admin-blog-info-updates-saved'));
             } else {
                 Message::Info(Text::get('admin-blog-info-add_new'));
                 $id = $post->id;
             }
             $action = $editing ? 'edit' : 'list';
             if ((bool) $post->publish) {
                 // Evento Feed
                 $log = new Feed();
                 $log->setTarget('goteo', 'blog');
                 $log->populate('nueva entrada blog Goteo (admin)', '/admin/blog', \vsprintf('El admin %s ha %s en el blog Goteo la entrada "%s"', array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('relevant', 'Publicado'), Feed::item('blog', $post->title, $post->id))));
                 $log->doAdmin('admin');
                 // evento público
                 $log->unique = true;
                 $log->populate($post->title, '/blog/' . $post->id, Text::recorta($post->text, 250), $post->gallery[0]->id);
                 $log->doPublic('goteo');
                 unset($log);
             } else {
                 //sino lo quitamos
                 \Goteo\Core\Model::query("DELETE FROM feed WHERE url = '/blog/{$post->id}' AND scope = 'public' AND type = 'goteo'");
             }
         } else {
             Message::Error(Text::get('admin-blog-error-save-fail') . ':<br />' . \implode('<br />', $errors));
         }
     }
//.........这里部分代码省略.........
开发者ID:kenjs,项目名称:Goteo,代码行数:101,代码来源:blog.php

示例6: if

    <table>
        <thead>
            <tr>
                <th></th>
                <th>Texto</th>
                <th>Campo</th>
                <th>Id</th>
                <?php if ($table == 'post') echo '<th></th>'; ?>
            </tr>
        </thead>

        <tbody>
        <?php while ($item = $pagedResults->fetchPagedRow()) : ?>
            <tr>
                <td width="5%"><a title="Registro <?php echo $item->id ?>" href='/translate/<?php echo $table ?>/edit/<?php echo $item->id . $filter . '&page=' . $_GET['page'] ?>'>[Edit]</a></td>
                <td width="75%"><?php if ($item->pendiente == 1) echo '* '; ?><?php echo Text::recorta($item->value, 250) ?></td>
                <td><?php echo $item->fieldName ?></td>
                <td><?php echo $item->id ?></td>
                <?php if ($table == 'post') : ?>
                <td><a href="/blog/<?php echo $item->id; ?>?preview=<?php echo $_SESSION['user']->id ?>" target="_blank">[Ver]</a></td>
                <?php endif; ?>
            </tr>
        <?php endwhile; ?>
        </tbody>
    </table>
</div>
    <ul id="pagination">
        <?php   $pagedResults->setLayout(new DoubleBarLayout());
                echo $pagedResults->fetchPagedNavigation(str_replace('?', '&', $filter)); ?>
    </ul>
<?php else : ?>
开发者ID:kenjs,项目名称:Goteo,代码行数:31,代码来源:list.html.php

示例7: if

?>
<div class="supporterContainer">
	<?php if ($user->campaign) : ?>
	<a class="expand" href="/call/<?php echo $user->call ?>" target="_blank">&nbsp;</a>
	<?php elseif ($user->user != 'anonymous') : ?>
	<a class="expand" href="/user/<?php echo htmlspecialchars($user->user) ?>">&nbsp;</a>
	<?php endif; ?>
    <?php if ($user->droped || $user->campaign) : ?>
    <div class="droped">&nbsp;</div>
    <?php endif; ?>
	<div class="supporter">
		<span class="avatar"><img src="<?php echo $user->avatar->getLink(43, 43, true); ?>" /></span>
	    <?php if ($user->user == 'anonymous') : ?>
	    <h4><?php echo $user->name; ?></h4>
	    <?php else : ?>
	    <h4 class="aqua"<?php if ($user->campaign) echo 'style="color: #96238F;"'; ?>><?php echo Text::recorta($user->name,40); ?></h4>
	    <?php endif; ?>
	    <dl>
	        
	        <?php  if (isset($user->projects))  : ?>
	        <dt class="projects"><?php echo Text::get('profile-invest_on-title'); ?></dt>
	        <dd class="projects"><strong><?php echo $user->projects ?></strong><?php echo Text::get('regular-projects'); ?></dd>
	        <?php endif; ?>
	<? /*
	        <dt class="worthcracy"><?php echo Text::get('profile-worthcracy-title'); ?></dt>
	        <dd class="worthcracy">
	            <?php if (isset($user->worth)) echo new View('view/worth/base.html.php', array('worthcracy' => $worthcracy, 'level' => $user->worth)) ?>
	        </dd>
	
	        <dt class="amount"><?php echo Text::get('profile-worth-title'); ?></dt>
	        <dd class="amount<?php if ($user->campaign) echo ' campaign'; ?>"><strong><?php echo \amount_format($user->amount) ?></strong> <span>円</span></dd>
开发者ID:kenjs,项目名称:Goteo,代码行数:31,代码来源:supporter.html.php

示例8: htmlspecialchars

        echo htmlspecialchars($mate->user);
        ?>
">
                            <img src="<?php 
        echo $mate->avatar->getLink(43, 43, true);
        ?>
" />
                        </a>
                    </div>
                    <h4>
                    	<a href="/user/<?php 
        echo htmlspecialchars($mate->user);
        ?>
">
						<?php 
        echo htmlspecialchars(Text::recorta($mate->name, 20));
        ?>
                        </a>
                    </h4>
                    <span class="projects">
						<?php 
        echo Text::get('regular-projects');
        ?>
 (<?php 
        echo $mate->projects;
        ?>
)
                    </span>
                    <span class="invests">
						<?php 
        echo Text::get('regular-investing');
开发者ID:isbkch,项目名称:Goteo,代码行数:31,代码来源:sharemates.html.php

示例9: jQuery

        ?>
                        <input type="checkbox" id="msg_reward-<?php 
        echo $rewardId;
        ?>
" name="msg_reward-<?php 
        echo $rewardId;
        ?>
" value="1" />
                        <label for="msg_reward-<?php 
        echo $rewardId;
        ?>
"><?php 
        echo $rewardData->amount;
        ?>
 &euro; (<?php 
        echo Text::recorta($rewardData->reward, 40);
        ?>
)</label>
                    <?php 
    }
    ?>

                </p>
    		</div>
		    <div id="comment">
            <script type="text/javascript">
                // Mark DOM as javascript-enabled
                jQuery(document).ready(function ($) {
                    //change div#preview content when textarea lost focus
                    $("#message").blur(function(){
                        $("#preview").html($("#message").val());
开发者ID:isbkch,项目名称:Goteo,代码行数:31,代码来源:rewards.html.php

示例10: toInvestors

 public static function toInvestors($type, $project, $post = null)
 {
     // notificación
     $notif = $type == 'update' ? 'updates' : 'rounds';
     $anyfail = false;
     $tpl = null;
     // para cada inversor que no tenga bloqueado esta notificacion
     $sql = "\n                SELECT\n                    invest.user as id,\n                    user.name as name,\n                    user.email as email,\n                    invest.method as method,\n                    IFNULL(user.lang, 'es') as lang\n                FROM  invest\n                INNER JOIN user\n                    ON user.id = invest.user\n                    AND user.active = 1\n                LEFT JOIN user_prefer\n                    ON user_prefer.user = invest.user\n                WHERE   invest.project = ?\n                AND invest.status IN ('0', '1', '3', '4')\n                AND (user_prefer.{$notif} = 0 OR user_prefer.{$notif} IS NULL)\n                GROUP BY user.id\n                ";
     if ($query = Model\Invest::query($sql, array($project->id))) {
         foreach ($query->fetchAll(\PDO::FETCH_OBJ) as $investor) {
             /// tipo de envio
             switch ($type) {
                 case 'r1_pass':
                     // template 15,
                     $tpl = 15;
                     $search = array('%USERNAME%', '%PROJECTNAME%', '%PROJECTURL%');
                     $replace = array($investor->name, $project->name, SITE_URL . '/project/' . $project->id);
                     break;
                 case 'fail':
                     // template 17 (paypalistas) / 35 (tpvistas) , caduca sin conseguir el mínimo
                     $tpl = $investor->method == 'paypal' ? 17 : 35;
                     $search = array('%USERNAME%', '%PROJECTNAME%', '%DISCOVERURL%');
                     $replace = array($investor->name, $project->name, SITE_URL . '/discover');
                     break;
                 case 'r2_pass':
                     // template 16, finaliza segunda ronda
                     $tpl = 16;
                     $search = array('%USERNAME%', '%PROJECTNAME%', '%PROJECTURL%');
                     $replace = array($investor->name, $project->name, SITE_URL . '/project/' . $project->id);
                     break;
                 case 'update':
                     // template 18, publica novedad
                     $tpl = 18;
                     $search = array('%USERNAME%', '%PROJECTNAME%', '%UPDATEURL%', '%POST%', '%SHAREFACEBOOK%', '%SHARETWITTER%');
                     $post_url = SITE_URL . '/project/' . $project->id . '/updates/' . $post->id;
                     // contenido del post
                     $post_content = "<p><strong>{$post->title}</strong><br />" . nl2br(Text::recorta($post->text, 500)) . "</p>";
                     // y preparar los enlaces para compartir en redes sociales
                     $share_urls = Text::shareLinks($post_url, $post->title);
                     $replace = array($investor->name, $project->name, $post_url, $post_content, $share_urls['facebook'], $share_urls['twitter']);
                     break;
             }
             if (!empty($tpl)) {
                 // Obtenemos la plantilla para asunto y contenido
                 // en el idioma del usuario
                 $template = Template::get($tpl, $investor->lang);
                 // Sustituimos los datos
                 if (!empty($post)) {
                     $subject = str_replace(array('%PROJECTNAME%', '%OWNERNAME%', '%P_TITLE%'), array($project->name, $project->user->name, $post->title), $template->title);
                 } else {
                     $subject = str_replace('%PROJECTNAME%', $project->name, $template->title);
                 }
                 $content = \str_replace($search, $replace, $template->text);
                 // iniciamos mail
                 $mailHandler = new Mail();
                 $mailHandler->to = $investor->email;
                 $mailHandler->toName = $investor->name;
                 $mailHandler->subject = $subject;
                 $mailHandler->content = $content;
                 $mailHandler->html = true;
                 $mailHandler->template = $template->id;
                 if ($mailHandler->send()) {
                 } else {
                     $anyfail = true;
                     @mail(\GOTEO_FAIL_MAIL, 'Fallo al enviar email automaticamente al cofinanciador ' . SITE_URL, 'Fallo al enviar email automaticamente al cofinanciador: <pre>' . print_r($mailHandler, 1) . '</pre>');
                 }
                 unset($mailHandler);
             }
         }
         // fin bucle inversores
     } else {
         echo '<p>' . str_replace('?', $project->id, $sql) . '</p>';
         $anyfail = true;
     }
     if ($anyfail) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:kenjs,项目名称:Goteo,代码行数:80,代码来源:send.php

示例11:

 *  (at your option) any later version.
 *
 *  Goteo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with Goteo.  If not, see <http://www.gnu.org/licenses/agpl.txt>.
 *
 */
use Goteo\Library\Text, Goteo\Model\Blog\Post;
$post = Post::get($this['post'], LANG);
$level = (int) $this['level'] ?: 3;
if ($this['show'] == 'list') {
    $post->text = Text::recorta($post->text, 500);
}
if (empty($this['url'])) {
    $url = '/blog/';
} else {
    $url = $this['url'];
    $post->text = nl2br(Text::urlink($post->text));
}
?>
    <?php 
if (count($post->gallery) > 1) {
    ?>
		<script type="text/javascript" >
			$(function(){
				$('#post-gallery<?php 
    echo $post->id;
开发者ID:anvnguyen,项目名称:Goteo,代码行数:31,代码来源:post.html.php

示例12: htmlspecialchars

?>
: <?php 
$sep = '';
foreach ($categories as $key => $value) {
    echo $sep . htmlspecialchars($value);
    $sep = ', ';
}
?>
</div>
    
    <div style="width:600px;vertical-align:top;border-right:2px solid #f1f1f1;line-height:15px;padding-right:10px;">
        <a style="text-decoration:none;font-size:14px;color: #797979;" href="<?php 
echo $url;
?>
"><?php 
echo Text::recorta($project->description, 500);
?>
</a>
    </div>
    
    <div style="width: 25px;height: 2px;border-bottom: 1px solid #38b5b1;margin-bottom: 10px; margin-top:10px;"></div>
   
    <div style="font-size: 14px;vertical-align: top;text-transform: uppercase; padding-bottom:10px;"><?php 
echo Text::get('project-view-metter-investment');
?>
: <span style="font-size:14px;color:#96238F;font-weight: bold;"><?php 
echo Text::get('project-view-metter-minimum') . ' ' . \amount_format($project->mincost) . ' ' . utf8_encode(html_entity_decode('&euro;'));
?>
</span>  <span style="color:#FFF;">_</span>  <span style="font-size:14px;color:#ba6fb6;font-weight: bold;"><?php 
echo Text::get('project-view-metter-optimum') . ' ' . \amount_format($project->maxcost) . ' ' . utf8_encode(html_entity_decode('&euro;'));
?>
开发者ID:kenjs,项目名称:Goteo,代码行数:31,代码来源:newsletter_project.html.php

示例13:

if ($user->user == 'anonymous') {
    ?>
	    <h4><?php 
    echo $user->name;
    ?>
</h4>
	    <?php 
} else {
    ?>
	    <h4 class="aqua"<?php 
    if ($user->campaign) {
        echo 'style="color: #96238F;"';
    }
    ?>
><?php 
    echo Text::recorta($user->name, 40);
    ?>
</h4>
	    <?php 
}
?>
	    <dl>
	        <?php 
if (isset($user->projects)) {
    ?>
	        <dt class="projects"><?php 
    echo Text::get('profile-invest_on-title');
    ?>
</dt>
	        <dd class="projects"><strong><?php 
    echo $user->projects;
开发者ID:isbkch,项目名称:Goteo,代码行数:31,代码来源:supporter.html.php

示例14: foreach

    case 'tags':
        $title = Text::get('blog-side-tags');
        $items = Post\Tag::getList($blog->id);
        // enlace a la lista de entradas con filtro tag
        foreach ($items as $item) {
            if ($item->used > 0) {
                $list[] = '<a href="/blog/?tag=' . $item->id . '">' . $item->name . '</a>';
            }
        }
        break;
    case 'comments':
        $title = Text::get('blog-side-last_comments');
        $items = Post\Comment::getList($blog->id);
        // enlace a la entrada en la que ha comentado
        foreach ($items as $item) {
            $text = Text::recorta($item->text, 200);
            $list[] = "\n\t\t\t\t<div>\n\t\t\t\t\t<!--span class='avatar'><img src='/image/{$item->user}->avatar->id/50/50/1' alt='' /></span-->\n\t\t\t\t\t<span class='date'>{$item->date}</span>\n\t\t\t\t\t<div class='high-comment'>\n\t\t\t\t\t\t<strong><a href=\"/blog/{$item->post}\">{$item->user->name}</a></strong>\n\t\t\t\t\t\t<p>{$text}</p>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
        }
        break;
}
if (!empty($list)) {
    ?>
<div class="widget blog-sidebar-module">
    <h3 class="supertitle"><?php 
    echo $title;
    ?>
</h3>
    <ul id="blog-side-<?php 
    echo $this['type'];
    ?>
">
开发者ID:anvnguyen,项目名称:Goteo,代码行数:31,代码来源:side.html.php

示例15:

        ?>
"><?php 
        echo Text::get('regular-by');
        ?>
 <?php 
        echo $post->user->name;
        ?>
</a></div>
                <?php 
    }
    ?>
                <div class="description"><?php 
    if ($post->id == 728) {
        echo Text::recorta($post->text, 400);
    } else {
        echo Text::recorta($post->text, 600);
    }
    ?>
</div>

                <div class="read_more"><a href="<?php 
    echo $post->owner_type == 'project' ? '/project/' . $post->owner_id . '/updates/' . $post->id : '/blog/' . $post->id;
    ?>
"><?php 
    echo Text::get('regular-read_more');
    ?>
</a></div>
            </div>
        </div>
        <?php 
    $i++;
开发者ID:anvnguyen,项目名称:Goteo,代码行数:31,代码来源:posts.html.php


注:本文中的Goteo\Library\Text::recorta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。