コード例 #1
0
ファイル: Settings.php プロジェクト: MBerguer/wp-demo
 public function actionClearCache()
 {
     if ($this->validatePermission('smartslider_config')) {
         if ($this->validateToken()) {
             $slidersModel = new N2SmartsliderSlidersModel();
             foreach ($slidersModel->getAll() as $slider) {
                 $slidersModel->refreshCache($slider['id']);
             }
             N2Cache::clearGroup('n2-ss-0');
             N2Cache::clearGroup('combined');
             N2Message::success(n2_('Cache cleared.'));
         }
         $this->redirect(array("settings/default"));
     }
 }
コード例 #2
0
ファイル: Sliders.php プロジェクト: RenatoToasa/Pagina-Web
 public function actionExportAll()
 {
     N2Loader::import('libraries.export', 'smartslider');
     $slidersModel = new N2SmartsliderSlidersModel();
     $sliders = $slidersModel->getAll();
     foreach ($sliders as $slider) {
         $export = new N2SmartSliderExport($slider['id']);
         $export->create(true);
     }
     $folder = N2Platform::getPublicDir();
     $folder .= '/export/';
     $zip = new N2ZipFile();
     foreach (N2Filesystem::files($folder) as $file) {
         $zip->addFile(file_get_contents($folder . $file), $file);
     }
     ob_end_clean();
     header('Content-disposition: attachment; filename=sliders_unzip_to_import.zip');
     header('Content-type: application/zip');
     echo $zip->file();
     n2_exit(true);
 }
コード例 #3
0
$app = N2Base::getApplication('smartslider');
$accessEdit = N2Acl::canDo('smartslider_edit', $app->info);
$accessDelete = N2Acl::canDo('smartslider_delete', $app->info);
$sliderid = N2Request::getInt('sliderid', 0);
$generatorId = N2Request::getInt('generator_id', 0);
$controller = N2Request::getCmd('nextendcontroller');
$slidersModel = new N2SmartsliderSlidersModel();
$showSlideManager = false;
$dl = array();
if (!$sliderid) {
    $orderBy = N2SmartSliderSettings::get('slidersOrder', 'time');
    $orderByDirection = N2SmartSliderSettings::get('slidersOrderDirection', 'DESC');
    $actions = N2Html::tag('a', array("class" => 'n2-button n2-button-grey n2-button-medium' . ($orderBy == 'title' ? ' n2-active' : ''), "href" => $this->appType->router->createUrl(array('sliders/orderby', array('title' => $orderBy == 'title' ? $orderByDirection == 'ASC' ? 'DESC' : 'ASC' : 'ASC') + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-16' . ($orderBy == 'title' ? $orderByDirection == 'ASC' ? ' n2-i-sortalphabetic1' : ' n2-i-sortalphabetic2' : ' n2-i-sortalphabetic1')), ''));
    $actions .= N2Html::tag('a', array("class" => 'n2-button n2-button-grey n2-button-medium' . ($orderBy == 'time' ? ' n2-active' : ''), "href" => $this->appType->router->createUrl(array('sliders/orderby', array('time' => $orderBy == 'time' ? $orderByDirection == 'ASC' ? 'DESC' : 'ASC' : 'DESC') + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-16' . ($orderBy == 'time' ? $orderByDirection == 'ASC' ? ' n2-i-sortdate1' : ' n2-i-sortdate2' : ' n2-i-sortdate2')), ''));
    $dl[] = array('title' => '<span>' . n2_('SLIDER LIST') . '</span>', 'class' => 'n2-ss-slider-ordering n2-ss-slide2-list', 'tooltip' => null, 'actions' => $actions);
    $sliders = $slidersModel->getAll($orderBy, $orderByDirection);
} else {
    // Show only one sliders's sidebar in this context
    $sliders = array($slidersModel->get($sliderid));
}
if ($sliders) {
    foreach ($sliders as $slider) {
        $active = $sliderid == $slider['id'];
        $preUl = '';
        if ($active) {
            $showSlideManager = true;
            ob_start();
            $this->widget->init("buttonmenu", array("content" => N2Html::tag('div', array('class' => 'n2-button-menu'), N2Html::tag('div', array('class' => 'n2-button-menu-inner n2-border-radius'), N2Html::link(n2_('Add images'), '#', array('class' => 'n2-add-quick-image n2-h4')) . N2Html::link(n2_('Add video'), '#', array('class' => 'n2-add-quick-video n2-h4' . (N2Platform::$hasPosts ? '' : ' n2-separator'))) . (N2Platform::$hasPosts ? N2Html::link(n2_('Add post'), '#', array('class' => 'n2-add-quick-post n2-h4')) : '') . N2Html::link(n2_('Create empty slide'), $app->router->createUrl(array("slides/create", array("sliderid" => N2Request::getInt('sliderid'), "static" => 0))), array('class' => 'n2-h4 n2-separator')) . N2Html::link(n2_('Create static slide'), $app->router->createUrl(array("slides/create", array("sliderid" => N2Request::getInt('sliderid'), "static" => 1))), array('class' => 'n2-h4')) . N2Html::link(n2_('Create dynamic slides'), $app->router->createUrl(array("generator/create", array("sliderid" => N2Request::getInt('sliderid')))), array('class' => 'n2-h4'))))));
            $buttonMenu = ob_get_clean();
            ob_start();
            $this->widget->init("buttonmenu", array("content" => N2Html::tag('div', array('class' => 'n2-button-menu'), N2Html::tag('div', array('class' => 'n2-button-menu-inner n2-border-radius'), N2Html::link(n2_('Select all'), '#', array('class' => 'n2-h4')) . N2Html::link(n2_('Select none'), '#', array('class' => 'n2-h4')) . N2Html::link(n2_('Select published'), '#', array('class' => 'n2-h4')) . N2Html::link(n2_('Select unpublished'), '#', array('class' => 'n2-h4'))))));