/**
 *
 *
 * @param array $Params
 * @param object $Smarty
 * @return string
 */
function smarty_function_nomobile_link($Params, &$Smarty)
{
    $Path = val('path', $Params, '', true);
    $Text = val('text', $Params, '', true);
    $Wrap = val('wrap', $Params, 'li');
    return Gdn_Theme::link('profile/nomobile', val('text', $Params, t("Full Site")), val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
 /**
  * Build HTML.
  *
  * @return string HTML.
  */
 public function toString()
 {
     if ($this->_UserData->numRows() == 0) {
         return '';
     }
     $String = '';
     ob_start();
     ?>
     <div class="Box">
         <?php 
     echo panelHeading(t('In this Discussion'));
     ?>
         <ul class="PanelInfo">
             <?php 
     foreach ($this->_UserData->Result() as $User) {
         ?>
                 <li>
                     <?php 
         echo anchor(wrap(wrap(Gdn_Format::date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . wrap(wrap(val('Name', $User), 'span', array('class' => 'Username')), 'span'), userUrl($User));
         ?>
                 </li>
             <?php 
     }
     ?>
         </ul>
     </div>
     <?php 
     $String = ob_get_contents();
     @ob_end_clean();
     return $String;
 }
Example #3
0
/** Wrap output value in SandboxString by reference
 *
 * @param   mixed                   $value      Value to wrap
 * @param   PHPSandbox              $sandbox    Sandbox instance of calling code
 *
 * @return  mixed|SandboxedString   Returns the wrapped value
 */
function &wrapByRef(&$value, $sandbox)
{
    if (!$value instanceof SandboxedString && is_object($value) && method_exists($value, '__toString')) {
        $strVal = $value->__toString();
        if (is_callable($strVal)) {
            $value = new SandboxedString($strVal, $sandbox);
        }
    } else {
        if (is_array($value) && count($value)) {
            //save current array pointer
            $current_key = key($value);
            foreach ($value as $key => &$_value) {
                $value[$key] = wrap($_value, $sandbox);
            }
            //rewind array pointer
            reset($value);
            //advance array to saved array pointer
            while (key($value) !== $current_key) {
                next($value);
            }
        } else {
            if (is_string($value) && is_callable($value)) {
                $value = new SandboxedString($value, $sandbox);
            }
        }
    }
    return $value;
}
Example #4
0
function tutLink($TutorialCode, $WriteTitle = TRUE, $ThumbnailSize = 'medium', $noGrid = false)
{
    $Tutorial = GetTutorials($TutorialCode);
    if (!$Tutorial) {
        return '';
    }
    $Thumbnail = $ThumbnailSize == 'medium' ? $Tutorial['Thumbnail'] : $Tutorial['LargeThumbnail'];
    $noGrid = $noGrid ? 'no-grid' : '';
    echo '<div class="video label-selector-item ' . $noGrid . '">';
    echo '<div class="image-wrap">';
    echo '<img src="' . $Thumbnail . '" alt="' . $Tutorial['Name'] . '" class = "video-img label-selector-image" />';
    ?>
    <a class="overlay" href="<?php 
    echo url('/settings/tutorials/' . $Tutorial['Code']);
    ?>
">
        <div class="buttons">
            <div class="icon-wrapper"><?php 
    echo dashboardSymbol('play');
    ?>
</div>
        </div>
        <div class="selected"></div>
    </a>
    <?php 
    echo '</div>';
    echo $WriteTitle ? wrap($Tutorial['Name'], 'div', ['class' => 'video-title title']) : '';
    echo '</div>';
}
 public function base_render_before($sender)
 {
     if ($sender->MasterView == 'admin') {
         return;
     }
     //tell the browser this is a mobile style
     $sender->Head->addTag('meta', array('name' => 'viewport', 'content' => "width=device-width,minimum-scale=1.0,maximum-scale=1.0"));
     /*
             $sender->InformMessage(
                 'This message will stay here until you dismiss it!',
                 array(
                     'CssClass' => 'Dismissable',
                     'DismissCallbackUrl' => '/plugin/dismissmessage/'
                 )
             );
     */
     $sender->Head->addTag('meta', array('name' => 'theme-color', 'content' => "#C08F00"));
     // YOU CAN REMOVE FONT-AWESOME IN ONLINE-VERSION
     $sender->Head->addTag('link', array('rel' => 'stylesheet', 'href' => "https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"));
     //position of the panel
     $sender->CssClass .= c('MinusBaseline.Panel.Left', false) ? ' PanelLeft' : ' PanelRight';
     //add the hamburger menu
     $sender->addAsset('Content', anchor('n', url('#'), 'Hamburger'), 'Hamburger');
     //add the searchbox to the panel
     //copied from library/vendors/SmartyPlugins/function.searchbox.php
     $form = Gdn::factory('Form');
     $form->InputPrefix = '';
     $search = $form->open(array('action' => Url('/search'), 'method' => 'get')) . $form->textBox('Search', array('placeholder' => t('SearchBoxPlaceHolder', 'Search'))) . $form->button('Go', array('Name' => '')) . $form->close();
     $sender->addAsset('Panel', wrap($search, 'div', array('class' => 'SiteSearch')), 'SearchBox');
     //nomobile link to switch to the full site
     $sender->addAsset('Foot', Gdn_Theme::link('/', t(' '), '<div class="LogoFoot"><a href="%url" class="%class">%text</a></div>'), 'LogoFoot');
     //Add logo to button of site
     $sender->addAsset('Foot', Gdn_Theme::link('profile/nomobile', t('Full Site'), '<div class="NoMobile"><a href="%url" class="%class">%text</a></div>'), 'NoMobile');
 }
    /**
     *
     *
     * @param $Sender
     */
    public function roleController_afterRolesInfo_handler($Sender)
    {
        if (!Gdn::session()->checkPermission('Garden.Settings.Manage')) {
            return;
        }
        ?>
        <div class="row form-group">
            <div class="label-wrap-wide">
                <div class="label"><?php 
        echo t('Enable Private Communities');
        ?>
</div>
                <div class="info"><?php 
        echo t('Once enabled, only members will see inside your community.');
        ?>
</div>
            </div>
            <div class="input-wrap-right">
                <span id="private-community-toggle">
                    <?php 
        if (c('Garden.PrivateCommunity', false)) {
            echo wrap(anchor('<div class="toggle-well"></div><div class="toggle-slider"></div>', 'settings/privatecommunity/on/' . Gdn::session()->TransientKey()), 'span', array('class' => "toggle-wrap toggle-wrap-on"));
        } else {
            echo wrap(anchor('<div class="toggle-well"></div><div class="toggle-slider"></div>', 'settings/privatecommunity/off/' . Gdn::session()->TransientKey()), 'span', array('class' => "toggle-wrap toggle-wrap-off"));
        }
        ?>
                </span>
            </div>
        </div>

        <?php 
    }
Example #7
0
/**
 *
 *
 * @param array $Params
 * @param object $Smarty
 * @return string
 */
function smarty_function_signin_link($Params, &$Smarty)
{
    if (!Gdn::session()->isValid()) {
        $Wrap = val('wrap', $Params, 'li');
        return Gdn_Theme::link('signinout', val('text', $Params, ''), val('format', $Params, wrap('<a href="%url" rel="nofollow" class="%class">%text</a>', $Wrap)), $Params);
    }
}
 public function discussionController_beforeCommentDisplay_handler($sender, $args)
 {
     // Find the previous comment.
     if (!$this->previous) {
         $this->previous = $args['Discussion'];
         if ($sender->data('Page', 1) != 1) {
             $this->previous = $sender->CommentModel->get($sender->DiscussionID, 1, $sender->Offset - 1)->firstRow();
         }
     }
     // Calculate the date difference.
     $date = new DateTime($args['Comment']->DateInserted);
     $gap = $date->diff(new DateTime($this->previous->DateInserted))->days;
     $this->previous = $args['Comment'];
     if ($gap < c('TimeGap.MinDays', 7) - 1) {
         return;
     } elseif ($gap < 30) {
         $gap = sprintf(t('%s days later'), (int) $gap);
         $class = 'Days';
     } elseif ($gap < 60) {
         $gap = t('1 month later');
         $class = 'Month';
     } elseif ($gap < 365) {
         $gap = sprintf(t('%s months later'), (int) ($gap / 30));
         $class = 'Months';
     } elseif ($gap < 720) {
         $gap = t('1 year later');
         $class = 'Year';
     } else {
         $gap = sprintf(t('%s years later'), (int) ($gap / 365));
         $class = 'Years';
     }
     echo wrap($gap, 'li', ['class' => 'TimeGap ' . $class]);
 }
Example #9
0
 public function testOptionHelpers()
 {
     $this->assertInstanceOf(Option\Some::class, some($this->initialValue));
     $this->assertInstanceOf(Option\None::class, none());
     $this->assertInstanceOf(Option\Some::class, wrap($this->initialValue, $this->alternativeValue));
     $this->assertInstanceOf(Option\None::class, wrap($this->initialValue, $this->initialValue));
 }
/**
 * A placeholder for future menu items.
 *
 * @param array $Params The parameters passed into the function.
 * @param Smarty $Smarty The smarty object rendering the template.
 * @return string
 */
function smarty_function_custom_menu($Params, &$Smarty)
{
    $Controller = $Smarty->Controller;
    if (is_object($Menu = val('Menu', $Controller))) {
        $Format = val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', val('wrap', $Params, 'li')));
        $Result = '';
        foreach ($Menu->Items as $Group) {
            foreach ($Group as $Item) {
                // Make sure the item is a custom item.
                if (valr('Attributes.Standard', $Item)) {
                    continue;
                }
                // Make sure the user has permission for the item.
                if ($Permission = val('Permission', $Item)) {
                    if (!Gdn::session()->checkPermission($Permission)) {
                        continue;
                    }
                }
                if (($Url = val('Url', $Item)) && ($Text = val('Text', $Item))) {
                    $Attributes = val('Attributes', $Item);
                    $Result .= Gdn_Theme::link($Url, $Text, $Format, $Attributes) . "\r\n";
                }
            }
        }
        return $Result;
    }
    return '';
}
/**
 *
 *
 * @param array $Params
 * @param object $Smarty
 * @return string
 */
function smarty_function_dashboard_link($Params, &$Smarty)
{
    $Path = val('path', $Params, '', true);
    $Text = val('text', $Params, '', true);
    $Wrap = val('wrap', $Params, 'li');
    return Gdn_Theme::link('dashboard', val('text', $Params, ''), val('format', $Params, wrap('<a href="%url" class="%class">%text</a>', $Wrap)));
}
 /**
  * Add numbering index to discussion's comments.
  *
  * @param DiscussionController $sender Sending controller instance.
  * @param array $args Event arguments.
  */
 public function discussionController_commentInfo_handler($sender, $args)
 {
     static $number = 2;
     $offset = val('Offset', $sender, 0);
     $commentNumber = $offset + $number;
     echo wrap(anchor('#' . $commentNumber, commentUrl($args['Comment'])), 'span', ['Class' => 'MItem PostNumbering Num-' . $commentNumber]);
     $number += 1;
 }
Example #13
0
 public function testWrap()
 {
     $timingFunction = wrap(function () {
         return true;
     });
     $result = $timingFunction();
     $this->assertTrue($result);
     $this->assertTrue(is_float(collector()));
 }
Example #14
0
function tutLink($TutorialCode, $WriteTitle = TRUE, $ThumbnailSize = 'medium')
{
    $Tutorial = GetTutorials($TutorialCode);
    if (!$Tutorial) {
        return '';
    }
    $Thumbnail = $ThumbnailSize == 'medium' ? $Tutorial['Thumbnail'] : $Tutorial['LargeThumbnail'];
    return anchor('<img src="' . $Thumbnail . '" alt="' . $Tutorial['Name'] . '" title="' . $Tutorial['Name'] . '" />' . ($WriteTitle ? wrap($Tutorial['Name']) : ''), 'settings/tutorials/' . $Tutorial['Code']);
}
Example #15
0
function writeHomepageOption($Title, $Url, $iconName, $Current, $Description = '')
{
    $iconPath = 'applications/dashboard/design/images/' . $iconName . '.png';
    $cssClass = '';
    if ($Current == $Url) {
        $cssClass = 'active';
    }
    $cssClass .= ' Choice';
    echo wrap('<div class="image-wrap">' . img($iconPath, ['alt' => $Title, 'class' => 'label-selector-image']) . '<div class="overlay">' . '<div class="buttons">' . anchor(t('Select'), $Url, 'btn btn-overlay', ['title' => $Description, 'rel' => $Url]) . '</div>' . '<div class="selected">' . dashboardSymbol('checkmark') . '</div>' . '</div></div>' . '<div class="title">' . t($Title) . '</div>', 'div', array('class' => $cssClass . ' label-selector-item'));
}
Example #16
0
 /**
  * Add prefix to the passed controller's discussion names when they are re: an addon.
  *
  * Ex: [AddonName] Discussion original name
  *
  * @param array $Discussion
  */
 public function addonDiscussionPrefix($Discussion)
 {
     $Addon = val('Addon', $Discussion);
     if ($Addon) {
         $Slug = AddonModel::slug($Addon, false);
         $Url = "/addon/{$Slug}";
         $AddonName = val('Name', $Addon);
         echo ' ' . wrap(anchor(Gdn_Format::html($AddonName), $Url), 'span', array('class' => 'Tag Tag-Addon')) . ' ';
     }
 }
Example #17
0
function build_email($listing)
{
    $data = (array) $listing;
    if ($email = array_get($data, 'email')) {
        $name = trim("{$data['doctor_title']} {$data['doctor_first_name']} {$data['doctor_last_name']}") . wrap($data['doctor_license_type'], ', ');
        return "{$name} <{$email}>";
    } else {
        return null;
    }
}
Example #18
0
 function add_implicit_braces()
 {
     $stack = array();
     $start = NULL;
     $start_indent = 0;
     $self = $this;
     $condition = function (&$token, $i) use(&$self) {
         $list = array();
         for ($j = 0; $j < 3; $j++) {
             $k = $i + 1 + $j;
             $list[$j] = isset($self->tokens[$k]) ? $self->tokens[$k] : array(NULL, NULL);
         }
         list($one, $two, $three) = $list;
         if ($one[0] === t('HERECOMMENT')) {
             return FALSE;
         }
         $tag = $token[0];
         return in_array($tag, t('TERMINATOR', 'OUTDENT')) && !($two[0] === t(':') || $one[0] === t('@') && $three[0] === t(':')) || $tag === t(',') && !is_null($one[0]) && !in_array($one[0], t('IDENTIFIER', 'NUMBER', 'STRING', '@', 'TERMINATOR', 'OUTDENT'));
     };
     $action = function (&$token, $i) use(&$self) {
         $tok = array(t('}'), '}', $token[2], 'generated' => TRUE);
         array_splice($self->tokens, $i, 0, array($tok));
     };
     $this->scan_tokens(function (&$token, $i, &$tokens) use(&$self, &$stack, &$start, &$start_indent, &$condition, &$action) {
         if (in_array($tag = $token[0], t(Rewriter::$EXPRESSION_START))) {
             $stack[] = array($tag === t('INDENT') && $self->tag($i - 1) === t('{') ? t('{') : $tag, $i);
             return 1;
         }
         if (in_array($tag, t(Rewriter::$EXPRESSION_END))) {
             $start = array_pop($stack);
             return 1;
         }
         $len = count($stack) - 1;
         if (!($tag === t(':') && (($ago = $self->tag($i - 2)) === t(':') || (!isset($stack[$len]) || $stack[$len][0] !== t('{'))))) {
             return 1;
         }
         $stack[] = array(t('{'));
         $idx = $ago === t('@') ? $i - 2 : $i - 1;
         while ($self->tag($idx - 2) === t('HERECOMMENT')) {
             $idx -= 2;
         }
         // This doesn't really work in PHP, so we assign 'generatedValue' to the
         // token and handle it in the actual parser (see Lempar.php\Parser\
         // parse()). This is pretty hacky, but it works. (Maybe...)
         //
         // TODO: In the future change this to use the wrap() function as it seems
         // to work without any problems.
         $value = wrap('{');
         $value->generated = TRUE;
         $tok = array(t('{'), $value, $token[2], 'generated' => TRUE, 'generatedValue' => TRUE);
         array_splice($tokens, $idx, 0, array($tok));
         $self->detect_end($i + 2, $condition, $action);
         return 2;
     });
 }
Example #19
0
function fancyize($parts)
{
    $output = '';
    $i = 0;
    // don't work w/ key, because you never know if you're passed a numeric array
    foreach ($parts as $part) {
        $output .= wrap($part, ($i != 1 ? ' ' : '') . '<span class="part part_' . $i . '">', '</span> ');
        $i++;
    }
    return $output;
}
 /**
  * Adds "Mark All Viewed" and (conditionally) "Mark Category Viewed" to MeModule menu.
  *
  * @since 2.0
  * @access public
  */
 public function meModule_flyoutMenu_handler($Sender)
 {
     // Add "Mark All Viewed" to menu
     if (Gdn::session()->isValid()) {
         echo wrap(Anchor(sprite('SpMarkAllViewed') . ' ' . t('Mark All Viewed'), '/discussions/markallviewed'), 'li', array('class' => 'MarkAllViewed'));
         $CategoryID = (int) (empty(Gdn::controller()->CategoryID) ? 0 : Gdn::controller()->CategoryID);
         if ($CategoryID > 0) {
             echo wrap(Anchor(sprite('SpMarkCategoryViewed') . ' ' . t('Mark Category Viewed'), "/discussions/markcategoryviewed/{$CategoryID}"), 'li', array('class' => 'MarkCategoryViewed'));
         }
     }
 }
Example #21
0
 function __construct($from, $to, $include_admin = false, $options = array())
 {
     $admin = Setting::Get('admin', 'emails', true);
     if ($include_admin) {
         $to = $admin . wrap($to, ', ');
     }
     $this->from = $from ? $from : $admin;
     $this->to = $to ? $to : $admin;
     foreach ($options as $key => $value) {
         $this->{$key} = $value;
     }
 }
Example #22
0
function sqlPrepare($item)
{
    foreach ($item as $key => $value) {
        $keynames[] = $key;
        $duplicates[] = $key . " = VALUES(" . $key . ")";
        $updates[] = $key . " = " . wrap($value);
    }
    $data['keys'] = implode(',', $keynames);
    $data['duplicates'] = implode(',', $duplicates);
    $data['updates'] = implode(',', $updates);
    $data['values'] = implode(',', array_map("wrap", $item));
    return $data;
}
 /**
  * Allow admin to Change Author via discussion options.
  */
 public function base_discussionOptions_handler($Sender, $Args)
 {
     $Discussion = $Args['Discussion'];
     if (Gdn::session()->checkPermission('Vanilla.Discussions.Edit', true, 'Category', $Discussion->PermissionCategoryID)) {
         $Label = t('Change Author');
         $Url = "/discussion/author?discussionid={$Discussion->DiscussionID}";
         // Deal with inconsistencies in how options are passed
         if (isset($Sender->Options)) {
             $Sender->Options .= wrap(anchor($Label, $Url, 'ChangeAuthor'), 'li');
         } else {
             $Args['DiscussionOptions']['ChangeAuthor'] = ['Label' => $Label, 'Url' => $Url, 'Class' => 'ChangeAuthor'];
         }
     }
 }
 function add_implicit_braces()
 {
     $stack = array();
     $start = NULL;
     $start_indent = 0;
     $self = $this;
     $condition = function (&$token, $i) use(&$self) {
         $list = array();
         for ($j = 0; $j < 3; $j++) {
             $k = $i + 1 + $j;
             $list[$j] = isset($self->tokens[$k]) ? $self->tokens[$k] : array(NULL, NULL);
         }
         list($one, $two, $three) = $list;
         if ($one[0] === t('HERECOMMENT')) {
             return FALSE;
         }
         $tag = $token[0];
         return in_array($tag, t('TERMINATOR', 'OUTDENT')) && !($two[0] === t(':') || $one[0] === t('@') && $three[0] === t(':')) || $tag === t(',') && !is_null($one[0]) && !in_array($one[0], t('IDENTIFIER', 'NUMBER', 'STRING', '@', 'TERMINATOR', 'OUTDENT'));
     };
     $action = function (&$token, $i) use(&$self) {
         $tok = array(t('}'), '}', $token[2], 'generated' => TRUE);
         array_splice($self->tokens, $i, 0, array($tok));
     };
     $this->scan_tokens(function (&$token, $i, &$tokens) use(&$self, &$stack, &$start, &$start_indent, &$condition, &$action) {
         if (in_array($tag = $token[0], t(Rewriter::$EXPRESSION_START))) {
             $stack[] = array($tag === t('INDENT') && $self->tag($i - 1) === t('{') ? t('{') : $tag, $i);
             return 1;
         }
         if (in_array($tag, t(Rewriter::$EXPRESSION_END))) {
             $start = array_pop($stack);
             return 1;
         }
         $len = count($stack) - 1;
         if (!($tag === t(':') && (($ago = $self->tag($i - 2)) === t(':') || (!isset($stack[$len]) || $stack[$len][0] !== t('{'))))) {
             return 1;
         }
         $stack[] = array(t('{'));
         $idx = $ago === t('@') ? $i - 2 : $i - 1;
         while ($self->tag($idx - 2) === t('HERECOMMENT')) {
             $idx -= 2;
         }
         $value = wrap('{');
         $value->generated = TRUE;
         $tok = array(t('{'), $value, $token[2], 'generated' => TRUE);
         array_splice($tokens, $idx, 0, array($tok));
         $self->detect_end($i + 2, $condition, $action);
         return 2;
     });
 }
 /**
  * Allow staff to Resolve via discussion options.
  *
  * @return void
  */
 public function base_discussionOptions_handler($sender, $args)
 {
     $discussion = $args['Discussion'];
     $resolved = val('Resolved', $discussion);
     $newResolved = (int) (!$resolved);
     if (checkPermission('Plugins.Resolved.Manage')) {
         $label = T($resolved ? 'Unresolve' : 'Resolve');
         $url = "/discussion/resolve?discussionid={$discussion->DiscussionID}&resolve={$newResolved}";
         // Deal with inconsistencies in how options are passed
         if (isset($sender->Options)) {
             $sender->Options .= wrap(anchor($label, $url, 'ResolveDiscussion Hijack'), 'li');
         } else {
             $args['DiscussionOptions']['ResolveDiscussion'] = array('Label' => $label, 'Url' => $url, 'Class' => 'ResolveDiscussion Hijack');
         }
     }
 }
 /**
  *
  *
  * @param $Sender
  */
 public function roleController_afterRolesInfo_handler($Sender)
 {
     if (!Gdn::session()->checkPermission('Garden.Settings.Manage')) {
         return;
     }
     $Private = c('Garden.PrivateCommunity');
     echo '<div style="padding: 10px 0;">';
     $Style = array('style' => 'background: #ff0; padding: 2px 4px; margin: 0 10px 2px 0; display: inline-block;');
     if ($Private) {
         echo wrap('Your community is currently <strong>PRIVATE</strong>.', 'span', $Style);
         echo wrap(anchor('Switch to PUBLIC', 'settings/privatecommunity/on/' . Gdn::session()->transientKey(), 'SmallButton') . '(Everyone will see inside your community)', 'div');
     } else {
         echo wrap('Your community is currently <strong>PUBLIC</strong>.', 'span', $Style);
         echo wrap(anchor('Switch to PRIVATE', 'settings/privatecommunity/off/' . Gdn::session()->transientKey(), 'SmallButton') . '(Only members will see inside your community)', 'div');
     }
     echo '</div>';
 }
 /**
  * Return the verified status of a user with a link to change it.
  * @param array|object $User
  * @return string
  */
 function userVerified($User)
 {
     $UserID = val('UserID', $User);
     if (val('Verified', $User)) {
         $Label = t('Verified');
         $Title = t('Verified Description', 'Verified users bypass spam and pre-moderation filters.');
         $Url = "/user/verify.json?userid={$UserID}&verified=0";
     } else {
         $Label = t('Not Verified');
         $Title = t('Not Verified Description', 'Unverified users are passed through spam and pre-moderation filters.');
         $Url = "/user/verify.json?userid={$UserID}&verified=1";
     }
     if (Gdn::session()->checkPermission('Garden.Moderation.Manage')) {
         return anchor($Label, $Url, array('title' => $Title, 'class' => 'User-Verified Hijack'));
     } else {
         return wrap($Label, 'span', array('title' => $Title, 'class' => 'User-Verified'));
     }
 }
 /**
  * Adds a checkbox o new discussions.
  *
  * If not switched of in the settings, a checkbox is shown so that
  * individual discussions can explicetly _not_ be twittered.
  *
  * @param object $sender PostController.
  * @param array $args EventArguments containing the discussion options.
  * @return void.
  * @package TwitterBot
  * @since 0.1
  */
 public function postController_discussionFormOptions_handler($sender, $args)
 {
     // Exit if the current user hasn't the permission to twitter
     $roleIds = array_keys(Gdn::userModel()->getRoles(Gdn::session()->UserID));
     if (array_intersect($roles, Gdn::config('TwitterBot.RoleIDs'))) {
         return;
     }
     // Exit if checkbox is shown and not ticked
     if (!Gdn::config('TwitterBot.ShowCheckbox')) {
         return;
     }
     // Exit if the plugin has not been set up correctly
     $consumerKey = Gdn::config('TwitterBot.ConsumerKey');
     $secret = Gdn::config('TwitterBot.Secret');
     if (!$consumerKey || !$secret) {
         return;
     }
     $args['Options'] .= wrap($sender->Form->checkBox('TwitterBot', t('Publish on Twitter'), array('value' => '1', 'checked' => true)), 'li');
 }
Example #29
0
function parsehtml($text)
{
    global $str;
    $regex = "/({\\(([a-z]*),?\\)(.*)})/";
    $regex = "/{\\(((([a-z0-9]*),?)*)\\)((?:[^{}]+|(?R))*)}/";
    preg_match_all($regex, $text, $matches, PREG_SET_ORDER);
    $processing = true;
    while ($processing) {
        if (preg_match_all($regex, $text, $matches, PREG_SET_ORDER) > 0) {
            $processing = true;
            foreach ($matches as $match) {
                $match_ret = parsehtml($match[4]);
                $replacement = wrap($match[4], $match[1]);
                $text = str_replace($match[0], $replacement, $text);
            }
        } else {
            $processing = false;
        }
    }
    return $text;
}
function html_65c161fa3974dab7ff9b5b08fa07491e($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0)
{
    if (isset($Pile[0]["doublons"]) and is_array($Pile[0]["doublons"])) {
        $doublons = nettoyer_env_doublons($Pile[0]["doublons"]);
    }
    $connect = '';
    $page = ($t1 = strval(invalideur_session($Cache, (function_exists("autoriser") || include_spip("inc/autoriser")) && autoriser('configurer', '_admin_vider') ? " " : "" ? ' ' : ''))) !== '' ? $t1 . ('

' . boite_ouvrir(interdire_scripts(wrap(concat(filtre_balise_img_dist(chemin_image('image-24.png'), '', 'cadre-icone'), _T('info_images_auto')), '<h3>')), 'simple', 'titrem') . '<div id="placehoder_taille_cache_images"><p>&nbsp;<br />&nbsp;<br />&nbsp;<br /></p></div>
	<script type="text/javascript">
		jQuery(function(){jQuery(\'#placehoder_taille_cache_images\').animateLoading().load(\'' . invalideur_session($Cache, replace(generer_action_auteur('calculer_taille_cache', 'images'), '&amp;', '&')) . '\');});
	</script>
	<noscript>
		<iframe src="' . invalideur_session($Cache, generer_action_auteur('calculer_taille_cache', 'images')) . '" style="width: 100%;height: 3em;overflow: hidden;"></iframe>
	</noscript>

' . boite_pied() . '
	' . bouton_action(_T('public|spip|ecrire:bouton_vider_cache'), invalideur_session($Cache, generer_action_auteur('purger', 'vignettes', invalideur_session($Cache, self()))), 'ajax') . '
' . boite_fermer() . '
') : '';
    return analyse_resultat_skel('html_65c161fa3974dab7ff9b5b08fa07491e', $Cache, $page, '../prive/squelettes/inclure/admin_vider_images.html');
}