Example #1
0
 static function loadBaseURL()
 {
     $absolute_plugin_folder = RealPath(self::$plugin_folder);
     if (StrPos($absolute_plugin_folder, ABSPATH) === 0) {
         self::$base_url = Get_Bloginfo('wpurl') . '/' . SubStr($absolute_plugin_folder, Strlen(ABSPATH));
     } else {
         self::$base_url = Plugins_Url(BaseName(self::$plugin_folder));
     }
     self::$base_url = Str_Replace("\\", '/', self::$base_url);
     # Windows Workaround
 }
Example #2
0
 function get_subfolder($directory)
 {
     $arr_folder = (array) Glob($directory . '{,.}*', GLOB_BRACE + GLOB_ONLYDIR);
     $sort_order = array();
     foreach ($arr_folder as $index => $folder) {
         $path = RealPath($folder) . '/';
         if (!Is_Dir($path) || BaseName($folder) == '.' || BaseName($folder) == '..') {
             unset($arr_folder[$index]);
         } else {
             $arr_folder[$index] = $path;
             $sort_order[$index] = StrToLower($folder);
         }
     }
     Array_Multisort($sort_order, $arr_folder);
     return $arr_folder;
 }
Example #3
0
 #-------------------------------------------------------------------------------
 $Path = SPrintF('%s/hosts/%s/system/%s/auto', SYSTEM_PATH, $HostID, $Folder);
 #-------------------------------------------------------------------------------
 if (!File_Exists($Path)) {
     continue;
 }
 #-------------------------------------------------------------------------------
 $Files = ScanDir($Path);
 #-------------------------------------------------------------------------------
 foreach ($Files as $File) {
     #-------------------------------------------------------------------------------
     if ($File != '.' && $File != '..' && $File != '.svn' && $File != 'plugins' && $File != 'sysplugins') {
         #-------------------------------------------------------------------------------
         $File = SPrintF('%s/%s', $Path, $File);
         #-------------------------------------------------------------------------------
         if (SubStr(BaseName($File), 0, 1) == '.') {
             #-------------------------------------------------------------------------------
             Debug(SPrintF('[JBs core]: пропущен системный компонент (%s)', $File));
             #-------------------------------------------------------------------------------
             continue;
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
         Debug(SPrintF('[JBs core]: загружается системный компонент (%s)', $File));
         #-------------------------------------------------------------------------------
         if (Load($File) === ERROR) {
             return ERROR | Trigger_Error('[JBs core]: не удалось загрузить элемент ядра');
         }
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
 function checkCreatedPost()
 {
     if (BaseName($_SERVER['SCRIPT_NAME']) == 'post-new.php' && isset($_GET['post_type']) && $_GET['post_type'] == $this->post_type && !$this->checkGalleryCount()) {
         $this->printGalleryCountLimit();
     }
 }
 function Add_Meta_Boxes()
 {
     global $post_type_object;
     # Enqueue Edit Gallery JavaScript/CSS
     WP_Enqueue_Script('fancy-gallery-meta-boxes', $this->core->base_url . '/meta-boxes/meta-boxes.js', array('jquery'), $this->core->version, True);
     WP_Enqueue_Style('fancy-gallery-meta-boxes', $this->core->base_url . '/meta-boxes/meta-boxes.css', False, $this->core->version);
     # Remove Meta Boxes
     Remove_Meta_Box('authordiv', $this->name, 'normal');
     Remove_Meta_Box('postexcerpt', $this->name, 'normal');
     # Change some core texts
     #Add_Filter ( 'gettext', Array($this, 'Filter_GetText'), 10, 3 );
     # Register Meta Boxes
     $this->Add_Meta_Box(I18n::t('Images'), Core::$plugin_folder . '/meta-boxes/images.php', 'normal', 'high');
     if (!$this->core->options->Get('disable_excerpts')) {
         $this->Add_Meta_Box(I18n::t('Excerpt'), Core::$plugin_folder . '/meta-boxes/excerpt.php', 'normal', 'high');
     }
     $this->Add_Meta_Box(I18n::t('Template'), Core::$plugin_folder . '/meta-boxes/template.php', 'normal', 'high');
     if (Current_User_Can($post_type_object->cap->edit_others_posts)) {
         $this->Add_Meta_Box(I18n::t('Owner'), Core::$plugin_folder . '/meta-boxes/owner.php');
     }
     $this->Add_Meta_Box(I18n::t('Gallery ShortCode'), Core::$plugin_folder . '/meta-boxes/show-code.php', 'side', 'high');
     $this->Add_Meta_Box(I18n::t('Thumbnails'), Core::$plugin_folder . '/meta-boxes/thumbnails.php', 'side');
     # Add Meta Boxes
     foreach ($this->arr_meta_box as $box_index => $meta_box) {
         Add_Meta_Box('meta-box-' . BaseName($meta_box['include_file'], '.php'), $meta_box['title'], array($this, 'Print_Gallery_Meta_Box'), $this->name, $meta_box['column'], $meta_box['priority'], $box_index);
     }
 }
<?php

/*
Fancy Gallery Template: Thumbnails / Image Title with Share buttons
Description: This template displays the thumbnail images and the image title with share buttons.
Version: 1.0.1
Author: Dennis Hoppe
Author URI: http://DennisHoppe.de
*/
// Read base url
$base_url = SPrintF('%s/%s', Get_Bloginfo('wpurl'), SubStr(RealPath(DirName(__FILE__)), Strlen(ABSPATH)));
$base_url = Str_Replace("\\", '/', $base_url);
// Windows Workaround
?>
<div class="gallery fancy-gallery <?php 
echo BaseName(__FILE__, '.php');
?>
" id="gallery_<?php 
echo $this->gallery->id;
?>
"><?php 
foreach ($this->gallery->images as $image) {
    // Build <img> Tags
    $img_code = '<img';
    foreach ($image->attributes as $attribute => $value) {
        $img_code .= SPrintF(' %s="%s"', $attribute, HTMLSpecialChars(Strip_Tags($value)));
    }
    $img_code .= '>';
    // Build FB share button
    $fb_code = SPrintF('<a href="%1$s" title="%2$s" class="%3$s" target="_blank">%4$s</a>', SPrintF('https://www.facebook.com/sharer/sharer.php?u=%s', $image->href), HTMLSpecialChars($image->title), $this->gallery->attributes->link_class, SPrintF('<img src="%s/facebook-button.png" alt="Share it" height="20">', $base_url));
    // Build Pintarest share button
Example #7
0
 public function Install_Template()
 {
     # Was this a Post request with data enctype?
     if (!Is_Array($_FILES) || empty($_FILES)) {
         return False;
     }
     # Check the files
     foreach ($_FILES as $field_name => $arr_file) {
         if (!Is_File($arr_file['tmp_name'])) {
             unset($_FILES[$field_name]);
         }
     }
     # Check if there are uploaded files
     if (empty($_FILES)) {
         return False;
     }
     # Create template dir
     if (!Is_Dir($this->template_dir)) {
         MkDir($this->template_dir);
         ChMod($this->template_dir, 0755);
     }
     # Copy the template file
     if (isset($_FILES['template_zip'])) {
         # Install the ZIP Template
         $zip_file = $_FILES['template_zip']['tmp_name'];
         require_once 'includes/file.php';
         WP_Filesystem();
         return UnZip_File($zip_file, $this->template_dir);
     } elseif (isset($_FILES['template_php']) && $this->Get_Template_Properties($_FILES['template_php']['tmp_name'])) {
         # Install the PHP Template
         $php_file = $_FILES['template_php']['tmp_name'];
         $template_name = BaseName($_FILES['template_php']['name'], '.php');
         # Create dir and copy file
         if (!Is_Dir($this->template_dir . '/' . $template_name)) {
             MkDir($this->template_dir . '/' . $template_name);
             ChMod($this->template_dir . '/' . $template_name, 0755);
         }
         Copy($php_file, $this->template_dir . '/' . $template_name . '/' . $template_name . '.php');
         ChMod($this->template_dir . '/' . $template_name . '/' . $template_name . '.php', 0755);
     } else {
         return False;
     }
     # Template installed
     return True;
 }
Example #8
0
        echo "OK\n";
    }
}
#-------------------------------------------------------------------------------
$DOM = new DOM();
#-------------------------------------------------------------------------------
if (Is_Error($DOM->Load('JBsDoc'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$DOM->AddText('Title', 'Список файлов');
#-------------------------------------------------------------------------------
$Title = new Tag('UL', array('class' => 'Standard'));
#-------------------------------------------------------------------------------
foreach ($Files as $File) {
    $Title->AddChild(new Tag('LI', new Tag('A', array('href' => SPrintF('%s.html', BaseName($File))), BaseName($File))));
}
#-------------------------------------------------------------------------------
$DOM->AddChild('Into', $Title);
#-------------------------------------------------------------------------------
$Out = $DOM->Build();
#-------------------------------------------------------------------------------
$IsWrite = IO_Write(SPrintF('%s/FileList.html', $JBsDocPath), $Out, TRUE);
if (Is_Error($IsWrite)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$DOM = new DOM();
#-------------------------------------------------------------------------------
if (Is_Error($DOM->Load('JBsDoc'))) {
    return ERROR | @Trigger_Error(500);
Example #9
0
 public function Enqueue_Frontend_Script($script_url)
 {
     if (In_Array($this->options->Get('asynchronous_loading'), array('all', 'js'))) {
         $this->arr_javascripts[] = $script_url;
     } else {
         WP_Enqueue_Script(BaseName($script_url, '.js'), $script_url, array('jquery'), Null, $this->options->Get('script_position') != 'header');
     }
 }
Example #10
0
 function User_Creates_New_Post()
 {
     if (BaseName($_SERVER['SCRIPT_NAME']) == 'post-new.php' && isset($_GET['post_type']) && $_GET['post_type'] == $this->post_type && !$this->Check_Post_Count()) {
         $this->Print_Post_Count_Limit();
     }
 }