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


PHP Action::add方法代码示例

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


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

示例1:

<?php

/**
 * Fansoro Gallery Plugin.
 *
 * (c) Moncho Varela / Nakome <nakome@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
/*
* fn: Action::run('Gallery')
* Page/File: gallery.md
* Template: gallery.tpl
*
*
*/
include_once 'gallery_functions.php';
Action::add('Gallery', 'Gallery::init');
Action::add('theme_header', 'Gallery::set_css');
Action::add('theme_footer', 'Gallery::set_js');
Shortcode::add('Gallery', 'Gallery::ShortCode');
开发者ID:nakome,项目名称:Fansoro-gallery-plugin,代码行数:22,代码来源:gallery.php

示例2: __

<?php

/**
 *	Bootstrap Markdown plugin
 *
 *	@package Monstra
 *  @subpackage Plugins
 *	@author William Marshall / Mightyhaggis
 *	@copyright 2015 William Marshall / Mightyhaggis
 *	@version 1.0.0
 *
 */
// Register plugin
Plugin::register(__FILE__, __('Bootstrap Markdown', 'bootstrap-markdown'), __('Bootstrap Markdown Editor by @toopay', 'bootstrap-markdown'), '1.0.0', 'Mightyhaggis', 'http://mightyhaggis.com/');
// Add hooks
Action::add('admin_header', 'BootstrapMarkdown::headers');
/**
 * BootstrapMarkdown Class
 */
class BootstrapMarkdown
{
    /**
     * Set editor headers
     */
    public static function headers()
    {
        echo '
            <!-- Bootstrap Markdown & required libs  -->
            <script type="text/javascript" src="' . Option::get('siteurl') . '/plugins/bootstrap-markdown/bootstrap-markdown/lib/markdown.js"></script>
            <script type="text/javascript" src="' . Option::get('siteurl') . '/plugins/bootstrap-markdown/bootstrap-markdown/lib/to-markdown.js"></script>
            <script type="text/javascript" src="' . Option::get('siteurl') . '/plugins/bootstrap-markdown/bootstrap-markdown/js/bootstrap-markdown.js"></script>
开发者ID:mightyhaggis,项目名称:bootstrap-markdown,代码行数:31,代码来源:bootstrap-markdown.plugin.php

示例3: function

<?php

/**
 * Custom Action Plugin for Fansoro CMS
 * Based on https://github.com/pafnuty-fansoro-plugins/fansoro-plugin-boilerplate/custom-action
 *
 * @package    Fansoro
 * @subpackage Plugins
 * @author     John Doe
 * @version    1.0.0
 * @license    MIT
 */
// Use in template:
// {Action::run('custom-action')}
Action::add('custom-action', function () {
    // Get config of custom-action
    $config = Config::get('plugins.custom-action');
    // Print the custom-action config
    echo "<pre>";
    print_r($config);
    echo "</pre>";
});
开发者ID:pafnuty-fansoro-plugins,项目名称:fansoro-plugin-boilerplate,代码行数:22,代码来源:custom-action.php

示例4: function

Action::add('Media', function () {
    // id of media item
    $id = Request::get('id');
    // Obtain json file on public folder
    $json = array();
    $mediaFile = ROOT_DIR . '/public/media/mdb.json';
    if (File::exists($mediaFile)) {
        /*
         *   Json Template 
         *   {
         *       "5606e4ad88ed0": { // id of album
         *           "id": "5606e4ad88ed0", // id of image folder album
         *           "title": "Album title", // title of album
         *           "desc": "Album description", // diescription of album
         *           "thumb": "/public/media/album_thumbs/album_5606e4ad88ed0.jpg", // image preview of album
         *           "images": "/public/media/albums/album_5606e4ad88ed0", // images album
         *           "tag": "Nature", // tag of album for filter with javascript
         *           "width": "700", // style width of tumb
         *           "height": "400" // style height of tumb
         *       }
         *   }
         *
         */
        $json = json_decode(File::getContent($mediaFile), true);
    } else {
        die('OOps Whrere is media.json file!');
    }
    // get single id of album or all albums
    if (Request::get('action') == 'view' && Request::get('id')) {
        // id of album
        $id = Request::get('id');
        if ($id) {
            // get id on json
            $media = $json[$id];
            // get all images of this album
            $mediaImages = File::scan(ROOT_DIR . $media['images']);
            // get images of this album
            $albumImages = '';
            // check files
            if (count($mediaImages) > 0) {
                foreach ($mediaImages as $image) {
                    $albumImages .= '<img class="thumbnail img-responsive" src="public/media/albums/album_' . $id . '/' . File::name($image) . '.' . File::ext($image) . '">';
                }
            }
            // template
            $templateSingle = '<h3>' . toHtml($media['title']) . '</h3>
            ' . toHtml($media['desc']) . '
            <p><b>Tag: </b><span class="label label-info">' . toHtml($media['tag']) . '</span></p>' . $albumImages;
            // return
            echo $templateSingle;
        }
    } else {
        // all media files
        $templateAll = '';
        foreach ($json as $media) {
            $templateAll .= '<figure>
                <img width="' . $media['width'] . '" height="' . $media['height'] . '" src="' . Config::get('site.site_url') . $media['thumb'] . '"/>
                <figcaption>
                    <a href="' . Config::get('site.site_url') . '/media?action=view&id=' . $media['id'] . '" title="' . toHtml($media['title']) . '">' . toHtml($media['title']) . '</a>
                </figcaption>
            </figure>';
        }
        // check json file if not empty
        if (count($json) > 0) {
            echo $templateAll;
        } else {
            echo '<div class="alert alert-danger">Empty Media albums</div>';
        }
        // get config
        //print_r(json_encode(Config::getConfig(),true));
    }
});
开发者ID:nakome,项目名称:Fansoro-admin-panel,代码行数:72,代码来源:media.php

示例5: resize

                if (!class_exists('resize')) {
                    require_once PLUGINS_PATH . '/thumb/classes/resize.php';
                }
                // Изменяем размер
                $resizeImg = new resize($imgResized);
                $resizeImg->resizeImage($imgSize[0], $imgSize[1], $method);
                // Сохраняем картинку в заданную папку
                $resizeImg->saveImage($dir . $fileName, $quality);
            }
            $imgResized = Url::getBase() . $imageDir . $fileName;
        }
        $title = isset($title) ? $title : '';
        $alt = isset($alt) ? $alt : '';
        $class = isset($class) ? $class . ' popup-image' : 'popup-image';
        $gallery = isset($gallery) ? '-gallery' : '';
        $imageLink = '<a class="' . $class . $gallery . '" href="' . $content . '" title="' . $title . '"><img src="' . $imgResized . '" alt="' . $alt . '"></a>';
        return $imageLink;
    }
    return '';
});
Action::add('theme_header', function () {
    if (Config::get('plugins.thumb.loadcss')) {
        echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.min.css">';
    }
});
Action::add('theme_footer', function () {
    if (Config::get('plugins.thumb.loadjs')) {
        echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.min.js"></script>';
        echo '<script src="' . Url::getBase() . '/plugins/thumb/assets/js/thumb.js"></script>';
    }
});
开发者ID:pafnuty-fansoro-plugins,项目名称:fansoro-plugin-thumb,代码行数:31,代码来源:thumb.php

示例6:

 */
/**
 * Description :  include class shipcart.
 */
include_once 'shipcart.fn.php';
/*
 * Description : Styles and javascript
 */
Action::add('theme_header', 'Shipcart::set_css');
Action::add('theme_footer', 'Shipcart::set_js');
/*
 * Description : Checkout for navbar ( render li tag )
 * Action : Action::run('Shop_cart')
 * Template: templates/cart.tpl
 */
Action::add('Shop_cart', 'Shipcart::cart');
/*
 * Description : User login
 * ShortCode : {Shop_user}
 * Template: templates/customer.tpl
 */
Shortcode::add('Shop_user', 'Shipcart::customer');
/*
 * Description : Total items
 * ShortCode : {Shop_total}
 * Template: templates/total.tpl
 */
Shortcode::add('Shop_total', 'Shipcart::total');
/*
 * Description :  Category section
 * ShortCode : {Shop_section title="" image="" url="" description=""}
开发者ID:nakome,项目名称:Fansoro-shipcart-plugin,代码行数:31,代码来源:shipcart.php

示例7: function

<?php

/**
 * Youtube for Fansoro CMS
 * Based on https://togetherjs.com/#tryitout-section.
 *
 * @author     Moncho Varela
 *
 * @version    1.0.0
 *
 * @license    MIT
 */
Action::add('theme_footer', function () {
    echo '<script type="text/javascript" src="' . Url::getBase() . '/plugins/channel/assets/channel-dist.js"></script>';
});
ShortCode::add('Channel', function ($attr) {
    extract($attr);
    //{Channel name="nakome" limit="50"}
    $name = isset($name) ? $name : Config::get('plugins.channel.username');
    $limit = isset($limit) ? $limit : 1;
    $quality = isset($quality) ? $quality : 'false';
    $quantity = isset($quantity) ? $quantity : 8;
    // template factory
    $template = Template::factory(PLUGINS_PATH . '/' . Config::get('plugins.channel.name') . '/templates/');
    $template->setOptions(['strip' => false]);
    return $template->fetch('gallery.tpl', ['name' => $name, 'limit' => $limit, 'quality' => $quality, 'quantity' => $quantity, 'apikey' => Config::get('plugins.channel.apikey')]);
});
开发者ID:nakome,项目名称:Fansoro-channel-plugin,代码行数:27,代码来源:channel.php

示例8: main

<?php

// Admin Navigation: add new item
Navigation::add(__('Sandbox', 'sandbox'), 'content', 'sandbox', 10);
// Add actions
Action::add('admin_themes_extra_index_template_actions', 'SandboxAdmin::formComponent');
Action::add('admin_themes_extra_actions', 'SandboxAdmin::formComponentSave');
/**
 * Sandbox admin class
 */
class SandboxAdmin extends Backend
{
    /**
     * Main Sandbox admin function
     */
    public static function main()
    {
        //
        // Do something here...
        //
        // Check for get actions
        // -------------------------------------
        if (Request::get('action')) {
            // Switch actions
            // -------------------------------------
            switch (Request::get('action')) {
                // Plugin action
                // -------------------------------------
                case "add":
                    //
                    // Do something here...
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:sandbox.admin.php

示例9: function

<?php

/**
 * Define WordPress actions for your theme.
 *
 * Based on the WordPress action hooks.
 * https://developer.wordpress.org/reference/hooks/
 *
 */
/**
 * Handle Browser Sync.
 *
 * The framework loads by default the local environment
 * where the constant BS (Browser Sync) is defined to true for development purpose.
 *
 * Note: make sure to update the script statement below based on the terminal/console message
 * when launching the "gulp watch" task.
 */
Action::add('wp_footer', function () {
    if (defined('BS') && BS) {
        ?>
        <script type="text/javascript" id="__bs_script__">
            //<![CDATA[
            document.write('<script async src="http://HOST:3000/browser-sync/browser-sync-client.2.12.7.js"><\/script>'.replace("HOST", location.hostname));
            //]]>
        </script>
        <?php 
    }
});
开发者ID:themosis,项目名称:theme,代码行数:29,代码来源:actions.php

示例10: __

<?php

/**
 *	MarkItUp! plugin
 *
 *	@package Monstra
 *  @subpackage Plugins
 *	@author Romanenko Sergey / Awilum
 *	@copyright 2012-2014 Romanenko Sergey / Awilum
 *	@version 1.0.0
 *
 */
// Register plugin
Plugin::register(__FILE__, __('MarkItUp!', 'markitup'), __('MarkItUp! universal markup jQuery editor', 'markitup'), '1.0.0', 'Awilum', 'http://monstra.org/');
// Add hooks
Action::add('admin_header', 'MarkItUp::headers');
/**
 * MarkItUp Class
 */
class MarkItUp
{
    /**
     * Set editor headers
     */
    public static function headers()
    {
        echo '
            <!-- markItUp! 1.1.13 -->
            <script type="text/javascript" src="' . Option::get('siteurl') . '/plugins/markitup/markitup/jquery.markitup.js"></script>
            <!-- markItUp! toolbar settings -->
            <script type="text/javascript" src="' . Option::get('siteurl') . '/plugins/markitup/markitup/sets/html/set.js"></script>
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:markitup.plugin.php

示例11: function

<?php

/**
 * This file is part of the Fansoro.
 *
 * (c) Romanenko Sergey / Awilum <awilum@msn.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
// Set Fansoro Meta Generator
Action::add('theme_meta', function () {
    echo '<meta name="generator" content="Powered by Fansoro" />';
});
开发者ID:cv0,项目名称:fansoro,代码行数:14,代码来源:actions.php

示例12: defined

<?php

defined('MONSTRA_ACCESS') or die('No direct script access.');
/**
 * Set meta generator
 */
Action::add('theme_meta', 'setMetaGenerator');
function setMetaGenerator()
{
    echo '<meta name="generator" content="Powered by Monstra ' . Monstra::VERSION . '" />' . "\n";
}
开发者ID:cmroanirgo,项目名称:monstra,代码行数:11,代码来源:actions.php

示例13: function

<?php

/**
 *  Asset Plugin
 *
 *  @package Fansoro
 *  @subpackage Plugins
 *  @author Pavel Belousov / pafnuty
 *  @version 2.1.0
 *  @license https://github.com/pafnuty/fansoro-plugin-asset/blob/master/LICENSE MIT
 */
require_once PLUGINS_PATH . '/asset/asset.class.php';
Action::add('asset_folder', function (array $folders = array(), array $excludes = array()) {
    $assetConfig = Fansoro::$plugins['asset'];
    $folders = array_unique(array_filter(array_merge($folders, (array) $assetConfig['folders'])));
    $excludes = array_unique(array_filter(array_merge($excludes, (array) $assetConfig['excludes'])));
    foreach ($folders as $k => $folder) {
        $folders[$k] = '/themes/' . Fansoro::$site['theme'] . $folder;
    }
    Asset::add($folders, $excludes);
});
Action::add('asset_file', function ($fileName = '', $attributes = '') {
    if ($fileName != '') {
        $fileName = '/themes/' . Fansoro::$site['theme'] . $fileName;
        Asset::addFile($fileName, $attributes);
    }
});
开发者ID:pafnuty-fansoro-plugins,项目名称:fansoro-plugin-asset,代码行数:27,代码来源:asset.php

示例14: function

<?php

/**
 * Poll for Fansoro CMS.
 *
 * @author     Moncho Varela
 *
 * @version    1.0.0
 *
 * @license    MIT
 */
Action::add('theme_footer', function () {
    echo '<script>
        var current = "' . Url::getCurrent() . '";
        var pollDb = "' . Url::getBase() . '/plugins/poll/db/db.json";
        </script>';
    echo '<script src="' . Url::getBase() . '/plugins/poll/assets/poll.js"></script>';
});
/*
 * Description: add function
 * Example: {Poll(1,'Do you like Fansoro?','yes','no')}
 */
function Poll($id, $question, $answer1 = 'Yes', $answer2 = 'No')
{
    // values
    $id = isset($id) ? $id : '';
    $question = isset($question) ? $question : '';
    $answer1 = isset($answer1) ? $answer1 : '';
    $answer2 = isset($answer2) ? $answer2 : '';
    // json dir
    $dir = PLUGINS_PATH . '/poll/db/db.json';
开发者ID:nakome,项目名称:Fansoro-poll-plugin,代码行数:31,代码来源:poll.php

示例15: __

 *	Sitemap plugin
 *
 *	@package Monstra
 *  @subpackage Plugins
 *	@author Romanenko Sergey / Awilum
 *	@copyright 2012-2014 Romanenko Sergey / Awilum
 *	@version 1.0.0
 *
 */
// Register plugin
Plugin::register(__FILE__, __('Sitemap', 'sitemap'), __('Sitemap plugin', 'sitemap'), '1.0.0', 'Awilum', 'http://monstra.org/', 'sitemap', 'box');
// Add actions
Action::add('admin_pages_action_add', 'Sitemap::create');
Action::add('admin_pages_action_edit', 'Sitemap::create');
Action::add('admin_pages_action_clone', 'Sitemap::create');
Action::add('admin_pages_action_delete', 'Sitemap::create');
/**
 * Sitemap class
 */
class Sitemap extends Frontend
{
    /**
     * Forbidden components
     *
     * @var array
     */
    public static $forbidden_components = array('pages', 'sitemap');
    /**
     * Sitemap Title
     *
     * @return string
开发者ID:rowena-altastratus,项目名称:altastratus,代码行数:31,代码来源:sitemap.plugin.php


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