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


PHP N2JS::addFirstCode方法代码示例

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


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

示例1: backend

 public static function backend($force = false)
 {
     static $once;
     if ($once != null && !$force) {
         return;
     }
     $once = true;
     $family = n2_x('Montserrat', 'Default Google font family for admin');
     foreach (explode(',', n2_x('latin', 'Default Google font charset for admin')) as $subset) {
         N2GoogleFonts::addSubset($subset);
     }
     N2GoogleFonts::addFont($family);
     N2CSS::addInline('.n2,html[dir="rtl"] .n2,.n2 td,.n2 th,.n2 select, .n2 textarea, .n2 input{font-family: "' . $family . '", Arial, sans-serif;}');
     N2CSS::addFiles(N2LIBRARYASSETS . "/css", array('nextend-font.css', 'font.css', 'admin.css', 'form.css', 'notificationcenter.css', 'spectrum.css', 'contextMenu.css'), 'nextend-backend');
     foreach (glob(N2LIBRARYASSETS . "/css/tabs/*.css") as $file) {
         N2CSS::addFile($file, 'nextend-backend');
     }
     foreach (glob(N2LIBRARYASSETS . "/css/jquery/*.css") as $file) {
         N2CSS::addFile($file, 'nextend-backend');
     }
     N2JS::addFiles(N2LIBRARYASSETS . "/js", array('json2.js', 'admin.js', 'color.js', 'query-string.js', 'md5.js', 'css.js', 'imagehelper.js', 'modal.js', 'notificationcenter.js', 'spectrum.js', 'expert.js'), 'nextend-backend');
     N2Localization::addJS(array('Cancel', 'Delete', 'Delete and never show again', 'Are you sure you want to delete?', 'Documentation'));
     self::form($force);
     N2JS::addFiles(N2LIBRARYASSETS . "/js/core/jquery", array("fixto.js", "jstorage.js", "jquery.datetimepicker.js", "jquery.tinyscrollbar.min.js", "jquery.unique-element-id.js", "vertical-pane.js"), "nextend-backend");
     wp_enqueue_script('nextend-ui', N2Uri::pathToUri(N2LIBRARYASSETS . "/js/core/jquery/ui/jquery-ui.nextend.js"), array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-autocomplete', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-resizable', 'jquery-ui-sortable', 'jquery-ui-slider'), '1.0', 1);
     wp_enqueue_script('nextend-ui-iframe-transport', N2Uri::pathToUri(N2LIBRARYASSETS . "/js/core/jquery/ui/jquery.iframe-transport.js"), array('jquery-ui-core', 'jquery-ui-widget'), '1.0', 1);
     wp_enqueue_script('nextend-ui-fileupload', N2Uri::pathToUri(N2LIBRARYASSETS . "/js/core/jquery/ui/jquery.fileupload.js"), array('jquery-ui-core', 'jquery-ui-widget'), '1.0', 1);
     N2JS::addFiles(N2LIBRARYASSETS . "/js/core/jquery/ui", array('jquery.contextMenu.js'), "nextend-backend");
     N2Base::getApplication('system')->info->assetsBackend();
     N2JS::addFirstCode("NextendAjaxHelper.addAjaxArray(" . json_encode(N2Form::tokenizeUrl()) . ");");
     N2Plugin::callPlugin('fontservices', 'onFontManagerLoadBackend');
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:32,代码来源:predefined.php

示例2: init

 public static function init()
 {
     $parameters = array('siteKeywords' => self::$siteKeywords, 'imageUrls' => self::$imageUrls, 'protocolRelative' => self::$protocolRelative);
     $parameters['placeholderImage'] = '$system$/images/placeholder/image.png';
     $parameters['placeholderRepeatedImage'] = '$system$/images/placeholder/image.png';
     N2JS::addFirstCode('new NextendImageHelper(' . json_encode($parameters) . ', ' . N2ImageHelper::getLightboxFunction() . ',' . N2ImageHelper::getLightboxMultipleFunction() . ', ' . N2ImageHelper::getLightboxFoldersFunction() . ');');
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:7,代码来源:helper.php

示例3: initialize

 public function initialize()
 {
     parent::initialize();
     N2JS::addFirstCode('window.ss2lang = {};');
     N2Loader::import(array('models.GroupStorage', 'models.License', 'models.Update'), 'smartslider');
     N2JS::addInline("new NextendSmartSliderCreateSlider('" . $this->appType->router->createUrl(array('slider/create')) . "');");
     N2Localization::addJS(array('Create Slider', 'Slider name', 'Slider', 'Width', 'Height', 'Create', 'Preset', 'Default', 'Full width', 'Full page', 'Block', 'Thumbnail - horizontal', 'Thumbnail - vertical', 'Caption', 'Horizontal accordion', 'Vertical accordion', 'Showcase', 'Saved slide'));
 }
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:8,代码来源:N2SmartSliderController.php

示例4: renderType

    protected function renderType()
    {
        $params = $this->slider->params;
        N2JS::addFiles(N2Filesystem::translate(dirname(__FILE__) . "/gsap"), array("MainAnimationSimple.js", "TypeSimple.js", "ResponsiveSimple.js"), "smartslider-simple-type-frontend");
        N2JS::addFiles(N2Filesystem::translate(dirname(__FILE__) . "/gsap"), array("BackgroundAnimation.js"), "smartslider-simple-type-frontend");
        N2JS::addFiles(NEXTEND_SMARTSLIDER_ASSETS . "/js/animation", array("BackgroundAnimationAbstract.js", 'Flux.js'), "smartslider-simple-type-frontend");
        $background = $params->get('background');
        $css = $params->get('slider-css');
        $slidecss = $params->get('slide-css');
        if (!empty($background)) {
            $css = 'background-image: url(' . N2ImageHelper::fixed($background) . ');';
        }
        $this->initBackgroundAnimation();
        echo $this->openSliderElement();
        ?>

        <div class="n2-ss-slider-1" style="<?php 
        echo $css;
        ?>
">
            <?php 
        echo $this->getBackgroundVideo($params);
        ?>
            <div class="n2-ss-slider-2">
                <?php 
        if ($this->backgroundAnimation) {
            ?>
                    <div class="n2-ss-background-animation"></div>
                <?php 
        }
        ?>
                <div class="n2-ss-slider-3" style="<?php 
        echo $slidecss;
        ?>
">

                    <?php 
        echo $this->slider->staticHtml;
        foreach ($this->slider->slides as $i => $slide) {
            echo N2Html::tag('div', $slide->attributes + array('class' => 'n2-ss-slide n2-ss-canvas ' . $slide->classes, 'style' => $slide->style), $slide->background . $slide->getHTML());
        }
        ?>
                </div>
            </div>
        </div>
        <?php 
        $this->widgets->echoRemainder();
        echo N2Html::closeTag('div');
        $this->javaScriptProperties['mainanimation'] = array('type' => $params->get('animation'), 'duration' => intval($params->get('animation-duration')), 'delay' => intval($params->get('animation-delay')), 'ease' => $params->get('animation-easing'), 'parallax' => floatval($params->get('animation-parallax')), 'shiftedBackgroundAnimation' => $params->get('animation-shifted-background-animation'));
        $this->javaScriptProperties['mainanimation']['shiftedBackgroundAnimation'] = 0;
        $this->javaScriptProperties['carousel'] = intval($params->get('carousel'));
        $this->javaScriptProperties['dynamicHeight'] = intval($params->get('dynamic-height', '0'));
        $this->javaScriptProperties['dynamicHeight'] = 0;
        N2Plugin::callPlugin('nextendslider', 'onNextendSliderProperties', array(&$this->javaScriptProperties));
        N2JS::addFirstCode("new NextendSmartSliderSimple('#{$this->slider->elementId}', " . json_encode($this->javaScriptProperties) . ");");
        echo N2Html::clear();
    }
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:57,代码来源:type.php

示例5: renderGlobalConfigurationForm

 public function renderGlobalConfigurationForm()
 {
     $values = N2Settings::getAll();
     $form = new N2Form($this->appType);
     $form->loadArray($values);
     $form->loadXMLFile(N2Loader::getPath('models', 'system') . '/forms/globalconfig.xml');
     echo N2Html::openTag("form", array("id" => "nextend-config", "method" => "post", "action" => N2Request::getRequestUri()));
     $form->render('global');
     echo N2Html::closeTag("form");
     N2JS::addFirstCode("\n            new NextendForm(\n                'nextend-config',\n                '" . $this->appType->router->createAjaxUrl(array('settings/index')) . "',\n                " . json_encode($values) . "\n            );\n        ");
 }
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:11,代码来源:_view.php

示例6: render

 public function render($xmlpath, $data)
 {
     N2Loader::import('libraries.form.form');
     $form = new N2Form(N2Base::getApplication('smartslider')->getApplicationType('backend'));
     $form->loadArray($data);
     $form->loadXMLFile($xmlpath);
     echo $form->render('settings');
     N2JS::addFirstCode('
         new NextendForm("smartslider-form", ' . json_encode($form->_data) . ', null, "' . N2Filesystem::toLinux(N2Filesystem::pathToRelativePath($xmlpath)) . '", "settings", "' . N2Uri::ajaxUri('nextend', 'smartslider') . '");
     ');
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:11,代码来源:Settings.php

示例7: editForm

 private static function editForm($data = array())
 {
     $configurationXmlFile = dirname(__FILE__) . '/forms/slider.xml';
     N2Loader::import('libraries.form.form');
     $form = new N2Form(N2Base::getApplication('smartslider')->getApplicationType('backend'));
     $form->set('class', 'nextend-smart-slider-admin');
     $form->loadArray($data);
     $form->loadXMLFile($configurationXmlFile);
     echo $form->render('slider');
     N2Loader::import('libraries.form.element.url');
     N2JS::addFirstCode('nextend.NextendElementUrlParams=' . N2ElementUrl::getNextendElementUrlParameters() . ';');
     return $data;
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:13,代码来源:Sliders.php

示例8: loadFonts

 public function loadFonts()
 {
     $familyQuery = array();
     if (count($this->files)) {
         foreach ($this->files as $family => $styles) {
             if (count($styles)) {
                 $familyQuery[] = $family . ':' . implode(',', $styles);
             }
         }
     }
     if (empty($familyQuery)) {
         return false;
     }
     $subsets = array_unique($this->inline);
     $familyQuery[count($familyQuery) - 1] .= ':' . implode(',', $subsets);
     N2JS::addFiles(N2LIBRARYASSETS . "/js", array('webfontloader.js'), 'nextend-webfontloader');
     N2JS::addInline("\r\n        nextend.fontsLoaded = false;\r\n        nextend.fontsLoadedActive = function () {nextend.fontsLoaded = true;};\r\n        var fontData = {\r\n            google: {\r\n                families: " . json_encode($familyQuery) . "\r\n            },\r\n            active: function(){nextend.fontsLoadedActive()},\r\n            inactive: function(){nextend.fontsLoadedActive()}\r\n        };\r\n        if(typeof WebFont === 'undefined'){\r\n            window.WebFontConfig = fontData;\r\n        }else{\r\n            WebFont.load(fontData);\r\n        }", true);
     N2JS::addFirstCode("\r\n        nextend.fontsDeferred = n2.Deferred();\r\n        if(nextend.fontsLoaded){\r\n            nextend.fontsDeferred.resolve();\r\n        }else{\r\n            nextend.fontsLoadedActive = function () {\r\n                nextend.fontsLoaded = true;\r\n                nextend.fontsDeferred.resolve();\r\n            };\r\n        }", true);
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:19,代码来源:fonts.php

示例9: NextendImageManager

<?php

/**
 * @var $model N2SystemImageModel
 */
N2JS::addFirstCode("\r\n    new NextendImageManager({\r\n        visuals: " . json_encode(N2ImageManager::$loaded) . ",\r\n        ajaxUrl: '" . $this->appType->router->createAjaxUrl(array('image/index')) . "'\r\n    });\r\n");
$model->renderForm();
开发者ID:MBerguer,项目名称:wp-demo,代码行数:7,代码来源:index.php

示例10: array

<?php

/**
 * @var $model N2SystemStyleModel
 */
$sets = $model->getSets();
N2StyleRenderer::$sets[] = $sets[0]['id'];
$styles = array();
foreach (array_unique(N2StyleRenderer::$sets) as $setId) {
    $styles[$setId] = $model->getVisuals($setId);
}
N2JS::addFirstCode("\r\n    new NextendStyleManager({\r\n        setsIdentifier: '" . $model->type . "set',\r\n        sets: " . json_encode($sets) . ",\r\n        visuals: " . json_encode($styles) . ",\r\n        renderer: {\r\n            pre: '" . N2StyleRenderer::$pre . "',\r\n            usedStyles: " . json_encode(N2StyleRenderer::$styles) . ",\r\n            modes: " . json_encode(N2StyleRenderer::$mode) . "\r\n        },\r\n        ajaxUrl: '" . $this->appType->router->createAjaxUrl(array('style/index')) . "'\r\n    });\r\n");
?>
    <div class="n2-form-tab ">
        <div class="n2-heading-controls n2-content-box-title-bg">
            <div class="n2-table n2-table-fixed">
                <div class="n2-tr">
                    <div class="n2-td n2-h2">
                        <?php 
n2_e('Style settings');
?>
                    </div>

                    <div class="n2-td n2-last n2-visual-editor-tabs">
                        <a href="#" class="n2-button n2-button-v n2-button-medium n2-button-grey n2-editor-clear-tab n2-h5 n2-uc"
                           style="display: none;"><?php 
n2_e('Clear tab');
?>
</a>

                        <div class="n2-form-element-radio-tab">
开发者ID:MBerguer,项目名称:wp-demo,代码行数:31,代码来源:index.php

示例11: init

    public static function init()
    {
        self::loadSettings();
        N2JS::addFirstCode('
            window.nextend.getFeatherEditor = function(){
                if(typeof window.nextend.featherEditor !== "undefined"){
                    return $.when(window.nextend.featherEditor);
                }
                var deferred = $.Deferred();

                $.getScript("https://dme0ih8comzn4.cloudfront.net/imaging/v1/editor.js").done(function(){
                    window.nextend.featherEditorHiRes = -1;
                    window.nextend.featherEditor = new Aviary.Feather({
                        apiKey: "' . self::$config['public'] . '",
                        encryptionMethod: "sha1",
                        maxSize: 1920,
                        displayImageSize: true,
                        onLoad: function(){
                            deferred.resolve();
                        },
                        onReady: function(){
                            if(window.nextend.featherEditorHiRes == -1){
                                AV.controlsWidgetInstance.serverMessaging.sendMessage({
                                    id: "avpw_auth_form",
                                    action: AV.controlsWidgetInstance.assetManager.getManifestURL(),
                                    method: "GET",
                                    dataType: "json",
                                    announcer: AV.build.asyncFeatherTargetAnnounce,
                                    origin: AV.build.asyncImgrecvBase,
                                    callback: function(response){
                                        window.nextend.featherEditorHiRes = false;
                                        for(var i = 0; i < response.permissions.length; i++){
                                            if(response.permissions[i] == "hires"){
                                                window.nextend.featherEditorHiRes = true;
                                                break;
                                            }
                                        }
                                    }
                                });
                            }
                        },
                        onError: function(error){
                            if(error.code == 8){
                                nextend.notificationCenter.error("Aviary not set up. <a target=\\"_blank\\" href=\\"' . N2Base::getApplication('system')->router->createUrl('settings/aviary') . '\\">Click here to setup!</a>");
                            }else{
                                nextend.notificationCenter.error(error.message);
                            }
                            if(typeof error.args !== "undefined" && typeof error.args[1] !== "undefined"){
                                nextend.notificationCenter.error(error.args[1].Error);
                            }
                            window.nextend.featherEditor.close();
                            deferred.reject();
                        },
                        onSaveButtonClicked: function(){
                            if(window.nextend.featherEditorHiRes === true){
                                NextendAjaxHelper.ajax({
                                    type: "POST",
                                    url: NextendAjaxHelper.makeAjaxUrl(window.nextend.featherEditor.ajaxUrl, {
                                        nextendaction: "getHighResolutionAuth"
                                    }),
                                    dataType: "json"
                                })
                                    .done(function (response) {
                                        var auth = response.data.highResolutionAuth;
                                        window.nextend.featherEditor.updateConfig({
                                            salt: auth.salt,
                                            timestamp: auth.timestamp,
                                            signature: auth.signature
                                        });

                                        window.nextend.featherEditor.saveHiRes();
                                    });
                                return false;
                            }
                        }
                    });
                    window.nextend.featherEditor.ajaxUrl = "' . N2Base::getApplication('system')->getApplicationType('backend')->router->createAjaxUrl(array('aviary/index')) . '";
                });
                return deferred;
            };
        ');
    }
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:82,代码来源:aviary.php

示例12: if

        margin: 0;
        border: 0;
    }

    body,
    .n2-form-tab {
        background-color: #e9edf0;
    }

    <?php 
N2Platform::adminHideCSS();
?>
</style>

<?php 
N2JS::addFirstCode("\r\n    if(window.parent != window){\r\n        parentDocument = window.parent.n2(window.parent.document);\r\n        \$(window).on('keydown keyup keypress', function(e){\r\n            if(e.keyCode == 27){\r\n                parentDocument.trigger(e);\r\n            }\r\n        });\r\n    }\r\n\r\n    var container = n2('.n2-ss-container-device'),\r\n        autoHeight = function(){\r\n                var minHeight = n2(window).height() - container.offset().top ;\r\n                container.css('height', 'auto');\r\n                if(container.height() < minHeight){\r\n                    container.height(minHeight);\r\n                }\r\n        };\r\n\r\n        autoHeight();\r\n        n2(window).on('resize', autoHeight);\r\n        n2('.n2-ss-slider').on('SliderResize', autoHeight)\r\n            .data('ss').ready(autoHeight);\r\n");
?>


<div class="n2-form-tab " style="display: block;">
    <div class="n2-heading-controls n2-content-box-title-bg">
        <div class="n2-table">
            <div class="n2-tr">
                <div class="n2-td n2-h2">
                    <?php 
echo n2_('Preview');
?>
                </div>

                <div class="n2-td" id="n2-ss-zoom">
                    <div class="n2-ss-slider-zoom-container">
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:31,代码来源:_preview.php

示例13: editForm

 /**
  * @param array $data
  */
 private function editForm($data = array())
 {
     $this->simpleEditForm($data);
     $slidersModel = new N2SmartsliderSlidersModel();
     $slider = $slidersModel->get(N2Request::getInt('sliderid', 0));
     $slidersSliderXml = call_user_func(array('N2SSPluginType' . $slider['type'], "getPath")) . '/slide.xml';
     if ((!isset($data['static-slide']) || $data['static-slide'] != 1) && N2Filesystem::existsFile($slidersSliderXml)) {
         $form = new N2Form();
         $form->loadArray($data);
         $form->loadXMLFile($slidersSliderXml);
         echo $form->render('slide');
     }
     if (isset($data['generator_id']) && $data['generator_id'] > 0) {
         $form = new N2Form();
         $form->loadArray($data);
         $form->loadXMLFile(dirname(__FILE__) . '/forms/slide_generator.xml');
         echo $form->render('slide');
     }
     N2JS::addFirstCode("new NextendForm('smartslider-form','', {});");
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:23,代码来源:Slides.php

示例14: renderForm

 public function renderForm($slider)
 {
     $values = N2SmartsliderSlidersModel::renderEditForm($slider);
     // Used by AJAX widget subforms
     N2JS::addFirstCode("\r\n            new NextendForm(\r\n                'smartslider-form',\r\n                '" . $this->appType->router->createAjaxUrl(array('slider/edit', array('sliderid' => $slider['id']))) . "',\r\n                " . json_encode($values) . "\r\n            );\r\n        ");
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:6,代码来源:_view.php

示例15: n2_e

</div>
            </div>
            <div class="n2-td n2-manage-set">
                <?php 
$model->renderSetsForm();
?>
                <div id="layoutset-manage"
                     class="n2-button n2-button-medium n2-button-grey n2-h5 n2-uc"><?php 
n2_e('Manage');
?>
</div>
            </div>
        </div>
    </div>
</div>
<?php 
$ul = array();
$ul[] = array('class' => 'n2-button-container n2-save-as-new-container', 'contents' => N2Html::tag('a', array('class' => 'n2-button n2-button-big n2-button-green n2-uc n2-layout-save-as-new', 'href' => '#'), n2_('Save as new layout')));
$this->widget->init("listn", array("ul" => $ul));
?>
<div class="n2-lightbox-sidebar-list">

</div>

<?php 
$sets = $model->getSets();
$setId = $sets[0]['id'];
$layouts = array();
$layouts[$setId] = $model->getVisuals($setId);
N2JS::addFirstCode("\r\n    new NextendLayoutManager({\r\n        setsIdentifier: '" . $model->type . "set',\r\n        sets: " . json_encode($sets) . ",\r\n        visuals: " . json_encode($layouts) . ",\r\n        ajaxUrl: '" . $this->appType->router->createAjaxUrl(array('layout/index')) . "'\r\n    });\r\n");
开发者ID:MBerguer,项目名称:wp-demo,代码行数:30,代码来源:layout.php


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