controller() public static method

The current controller being targetted.
public static controller ( Gdn_Controller $Value = null ) : Gdn_Controller
$Value Gdn_Controller
return Gdn_Controller
 /**
  * Get our cache.
  *
  * @return array|null
  */
 public function mediaCache()
 {
     if ($this->_MediaCache === null) {
         $this->cacheAttachedMedia(Gdn::controller());
     }
     return $this->_MediaCache;
 }
Example #2
0
/**
 * Renders an asset from the controller.
 *
 * @param array $Params The parameters passed into the function.
 * The parameters that can be passed to this function are as follows.
 * - <b>name</b>: The name of the asset.
 * - <b>tag</b>: The type of tag to wrap the asset in.
 * - <b>id</b>: The id of the tag if different than the name.
 * @param object $Smarty Smarty The smarty object rendering the template.
 * @return string The rendered asset.
 */
function smarty_function_asset($Params, &$Smarty)
{
    $Name = val('name', $Params);
    $Tag = val('tag', $Params, '');
    $Id = val('id', $Params, $Name);
    $Class = val('class', $Params, '');
    if ($Class != '') {
        $Class = ' class="' . $Class . '"';
    }
    $Controller = Gdn::controller();
    $Controller->EventArguments['AssetName'] = $Name;
    $Result = '';
    ob_start();
    $Controller->fireEvent('BeforeRenderAsset');
    $Result .= ob_get_clean();
    $Asset = $Controller->getAsset($Name);
    if (is_object($Asset)) {
        $Asset->AssetName = $Name;
        if (val('Visible', $Asset, true)) {
            $Asset = $Asset->toString();
        } else {
            $Asset = '';
        }
    }
    if (!empty($Tag)) {
        $Result .= '<' . $Tag . ' id="' . $Id . '"' . $Class . '>' . $Asset . '</' . $Tag . '>';
    } else {
        $Result .= $Asset;
    }
    ob_start();
    $Controller->fireEvent('AfterRenderAsset');
    $Result .= ob_get_clean();
    return $Result;
}
Example #3
0
 /**
  * Hook for discussion prefixes in /discussions.
  *
  * @param Gdn_Controller $Sender
  * @param array $Args
  */
 public function base_beforeDiscussionMeta_handler($Sender, $Args)
 {
     if (Gdn::controller()->ControllerName == 'addoncontroller') {
         return;
     }
     $this->addonDiscussionPrefix($Args['Discussion']);
 }
Example #4
0
/**
 * 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 = Gdn::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 '';
}
 /**
  * Add an element to the controls collection. Used to render settings forms.
  *
  * @param string $key
  * @param array $item
  * @throws Exception
  */
 public function addControl($key, $item)
 {
     // Make sure this isn't called before it's ready.
     if (!isset(Gdn::controller()->Data['_Controls'])) {
         throw new Exception("You can't add a control before the controls collection has been initialized.", 500);
     }
     Gdn::controller()->Data['_Controls'][$key] = $item;
 }
 public function toString()
 {
     if (!$this->data('Discussions')) {
         $this->GetData();
     }
     require_once Gdn::controller()->fetchViewLocation('helper_functions', 'Discussions', 'Vanilla');
     return parent::ToString();
 }
Example #7
0
/**
 * Render a breadcrumb trail for the user based on the page they are on.
 *
 * @param array $Params
 * @param object $Smarty
 * @return string
 */
function smarty_function_breadcrumbs($Params, &$Smarty)
{
    $Breadcrumbs = Gdn::controller()->data('Breadcrumbs');
    if (!is_array($Breadcrumbs)) {
        $Breadcrumbs = array();
    }
    $Options = arrayTranslate($Params, array('homeurl' => 'HomeUrl', 'hidelast' => 'HideLast'));
    return Gdn_Theme::breadcrumbs($Breadcrumbs, val('homelink', $Params, true), $Options);
}
 public function loadData()
 {
     $UserID = Gdn::controller()->data('Profile.UserID', Gdn::session()->UserID);
     $this->User = Gdn::userModel()->getID($UserID);
     $this->Roles = Gdn::userModel()->GetRoles($UserID)->resultArray();
     // Hide personal info roles
     if (!checkPermission('Garden.PersonalInfo.View')) {
         $this->Roles = array_filter($this->Roles, 'RoleModel::FilterPersonalInfo');
     }
 }
 /**
  * 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 #10
0
 /**
  * Attach button bar in place
  *
  * This method is abstracted because it is called from multiple places, due
  * to the way that the comment.php view is invoked both by the DiscussionController
  * and the PostController.
  *
  * @param Gdn_Controller $Sender
  */
 protected function attachButtonBar($Sender, $Wrap = false)
 {
     $Formatter = c('Garden.InputFormatter', 'Html');
     if (!in_array($Formatter, $this->Formats)) {
         return;
     }
     $View = Gdn::controller()->fetchView('buttonbar', '', 'plugins/ButtonBar');
     if ($Wrap) {
         echo wrap($View, 'div', array('class' => 'P'));
     } else {
         echo $View;
     }
 }
 /**
  * Render the module.
  *
  * @return string
  */
 public function toString()
 {
     // Set CategoryID if we have one.
     if ($this->CategoryID === null) {
         $this->CategoryID = Gdn::controller()->data('Category.CategoryID', false);
     }
     // Allow plugins and themes to modify parameters.
     Gdn::controller()->EventArguments['NewDiscussionModule'] =& $this;
     Gdn::controller()->fireEvent('BeforeNewDiscussionButton');
     // Make sure the user has the most basic of permissions first.
     $PermissionCategory = CategoryModel::permissionCategory($this->CategoryID);
     if ($this->CategoryID) {
         $Category = CategoryModel::categories($this->CategoryID);
         $HasPermission = Gdn::session()->checkPermission('Vanilla.Discussions.Add', true, 'Category', val('CategoryID', $PermissionCategory));
     } else {
         $HasPermission = Gdn::session()->checkPermission('Vanilla.Discussions.Add', true, 'Category', 'any');
     }
     // Determine if this is a guest & we're using "New Discussion" button as call to action.
     $PrivilegedGuest = $this->ShowGuests && !Gdn::session()->isValid();
     // No module for you!
     if (!$HasPermission && !$PrivilegedGuest) {
         return '';
     }
     // Grab the allowed discussion types.
     $DiscussionTypes = CategoryModel::allowedDiscussionTypes($PermissionCategory);
     foreach ($DiscussionTypes as $Key => $Type) {
         if (isset($Type['AddPermission']) && !Gdn::session()->checkPermission($Type['AddPermission'])) {
             unset($DiscussionTypes[$Key]);
             continue;
         }
         $Url = val('AddUrl', $Type);
         if (!$Url) {
             continue;
         }
         if (isset($Category)) {
             $Url .= '/' . rawurlencode(val('UrlCode', $Category));
         }
         // Present a signin redirect for a $PrivilegedGuest.
         if (!$HasPermission) {
             $Url = $this->GuestUrl . '?Target=' . $Url;
         }
         $this->addButton(t(val('AddText', $Type)), $Url);
     }
     // Add QueryString to URL if one is defined.
     if ($this->QueryString && $HasPermission) {
         foreach ($this->Buttons as &$Row) {
             $Row['Url'] .= (strpos($Row['Url'], '?') !== false ? '&' : '?') . $this->QueryString;
         }
     }
     return parent::toString();
 }
 public function settingsController_PostUrl_create($Sender, $args)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Cf = new ConfigurationModule($Sender);
     if (c('Plugins.PostUrl.Display1') == "") {
         Gdn::config()->set('Plugins.PostUrl.Display1', "from: %post_url%", false, false);
     }
     $Description = '<p>可接受下列占位符号,该符号和wordpress兼容: <br />%site_url% - the URI of your site<br />%site_name% - the name of your site<br />%post_url% - the URI of the post where the text is displayed<br />%post_title% - the title of the post where the text is displayed</p>';
     $Cf->initialize(array('Plugins.PostUrl.ItemName1' => array('LabelCode' => '版权名称一', 'Control' => 'TextBox', 'Description' => "该字段用于发布话题时选择方便记忆"), 'Plugins.PostUrl.Display1' => array('LabelCode' => '版权信息一', 'Control' => 'TextBox', 'Description' => $Description, 'Items' => array(), 'Options' => array("MultiLine" => true, "rows" => "20", "cols" => 30)), 'Plugins.PostUrl.ItemName2' => array('LabelCode' => '<hr /><br />版权名称二', 'Control' => 'TextBox', 'Description' => "该字段用于发布话题时选择方便记忆"), 'Plugins.PostUrl.Display2' => array('LabelCode' => '版权信息二', 'Control' => 'TextBox', 'Options' => array("MultiLine" => true, "rows" => "20", "cols" => 30)), 'Plugins.PostUrl.ItemName3' => array('LabelCode' => '<hr /><br />版权名称三', 'Control' => 'TextBox', 'Description' => "该字段用于发布话题时选择方便记忆"), 'Plugins.PostUrl.Display3' => array('LabelCode' => '版权信息三', 'Control' => 'TextBox', 'Options' => array("MultiLine" => true, "rows" => "20", "cols" => 30)), 'Plugins.PostUrl.Default' => array('LabelCode' => '默认版权信息', 'Control' => 'DropDown', 'Description' => "没有选择或者历史文章将会使用该设定", 'Items' => array(0 => '', 1 => '版权一', 2 => '版权二', 3 => '版权三'), 'Options' => array('Value' => c('Plugins.PostUrl.Default')))));
     $c = Gdn::controller();
     $c->addJsFile('settings.js', 'plugins/CDNManager');
     $Sender->addSideMenu();
     $Sender->setData('Title', t('Add Post Url'));
     $Cf->renderAll();
 }
Example #13
0
function connectButton($Row)
{
    $c = Gdn::controller();
    $Connected = val('Connected', $Row);
    $CssClass = $Connected ? 'Active' : 'InActive';
    $ConnectUrl = val('ConnectUrl', $Row);
    $DisconnectUrl = userUrl($c->User, '', 'Disconnect', array('provider' => $Row['ProviderKey']));
    $Result = '<span class="ActivateSlider ActivateSlider-' . $CssClass . '">';
    if ($Connected) {
        $Result .= anchor(t('Connected'), $DisconnectUrl, 'Button Primary Hijack ActivateSlider-Button');
    } else {
        $Result .= anchor(t('Connect'), $ConnectUrl, 'Button ActivateSlider-Button', array('target' => '_top'));
    }
    $Result .= '</span>';
    return $Result;
}
    public function settingsController_cdnmanager_create($Sender, $args)
    {
        $Sender->permission('Garden.Settings.Manage');
        $Cf = new ConfigurationModule($Sender);
        if (c('Plugins.CDNManager.CDNSources') == "") {
            $defaultCDNValue = "jquery.js = \"http://libs.baidu.com/jquery/1.10.2/jquery.min.js\"\r\njquery-ui.js = \"http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js\"";
            Gdn::config()->set('Plugins.CDNManager.CDNSources', $defaultCDNValue, false, false);
        }
        $Cf->initialize(array('Plugins.CDNManager.CDNSources' => array('LabelCode' => 'CDN使用源列表', 'Control' => 'TextBox', 'Options' => array('MultiLine' => true, 'rows' => 20, 'cols' => 50), 'Description' => '<p>输入需要用CDN加速的文件和对应的地址,如jquery等国内国外都有开放的CDN源,也可申请<font color="red"><a href="https://portal.qiniu.com/signup?code=3lcqpvqtedfma" target="_blank">七牛</a></font>免费的空间来加速您的网站,<a href="https://portal.qiniu.com/signup?code=3lcqpvqtedfma" target="_blank">点击这里免费申请七牛加速空间</a></p> <p><small><strong>
</strong> </small></p>', 'Items' => array())));
        $c = Gdn::controller();
        $c->addJsFile('settings.js', 'plugins/CDNManager');
        $Sender->addSideMenu();
        $Sender->setData('Title', t('CDN源设置'));
        $Cf->renderAll();
    }
Example #15
0
 /**
  *
  *
  * @param null $Hint
  */
 protected function autoContext($Hint = null)
 {
     // If we're already configured, don't auto configure
     if (!is_null($this->ParentID) && is_null($Hint)) {
         return;
     }
     // If no hint was given, determine by environment
     if (is_null($Hint)) {
         if (Gdn::controller() instanceof Gdn_Controller) {
             $DiscussionID = Gdn::controller()->data('Discussion.DiscussionID', null);
             $CategoryID = Gdn::controller()->data('Category.CategoryID', null);
             if ($DiscussionID) {
                 $Hint = 'Discussion';
             } elseif ($CategoryID) {
                 $Hint = 'Category';
             } else {
                 $Hint = 'Global';
             }
         }
     }
     switch ($Hint) {
         case 'Discussion':
             $this->ParentType = 'Discussion';
             $DiscussionID = Gdn::controller()->data('Discussion.DiscussionID');
             $this->ParentID = $DiscussionID;
             break;
         case 'Category':
             if ($this->CategorySearch) {
                 $this->ParentType = 'Category';
                 $CategoryID = Gdn::controller()->data('Category.CategoryID');
                 $this->ParentID = $CategoryID;
             }
             break;
     }
     if (!$this->ParentID) {
         $this->ParentID = 0;
         $this->ParentType = 'Global';
     }
 }
 public function toString()
 {
     $Session = Gdn::session();
     $Controller = Gdn::controller();
     $UserID = $Controller->User->UserID;
     $MemberOptions = array();
     $ProfileOptions = array();
     $Controller->EventArguments['UserID'] = $UserID;
     $Controller->EventArguments['ProfileOptions'] =& $ProfileOptions;
     $Controller->EventArguments['MemberOptions'] =& $MemberOptions;
     if ($Controller->EditMode) {
         return '<div class="ProfileOptions">' . anchor(t('Back to Profile'), userUrl($Controller->User), array('class' => 'ProfileButtons')) . '</div>';
         //         $ProfileOptions[] = array('Text' => t('Back to Profile'), 'Url' => userUrl($Controller->User), 'CssClass' => 'BackToProfile');
     } else {
         // Profile Editing
         if (hasEditProfile($Controller->User->UserID)) {
             $ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Edit Profile'), 'Url' => userUrl($Controller->User, '', 'edit'));
         } elseif ($Session->isValid() && $UserID == $Session->UserID) {
             $ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Preferences'), 'Url' => userUrl($Controller->User, '', 'preferences'));
         }
         // Ban/Unban
         $MayBan = checkPermission('Garden.Moderation.Manage') || checkPermission('Garden.Users.Edit') || checkPermission('Moderation.Users.Ban');
         if ($MayBan && $UserID != $Session->UserID) {
             if (BanModel::isBanned($Controller->User->Banned, BanModel::BAN_AUTOMATIC | BanModel::BAN_MANUAL)) {
                 $ProfileOptions[] = array('Text' => sprite('SpBan') . ' ' . t('Unban'), 'Url' => "/user/ban?userid={$UserID}&unban=1", 'CssClass' => 'Popup');
             } elseif (!$Controller->User->Admin) {
                 $ProfileOptions[] = array('Text' => sprite('SpBan') . ' ' . t('Ban'), 'Url' => "/user/ban?userid={$UserID}", 'CssClass' => 'Popup');
             }
         }
         // Delete content.
         if (checkPermission('Garden.Moderation.Manage')) {
             $ProfileOptions[] = array('Text' => sprite('SpDelete') . ' ' . t('Delete Content'), 'Url' => "/user/deletecontent?userid={$UserID}", 'CssClass' => 'Popup');
         }
     }
     return parent::ToString();
 }
 /**
  * Insert or update meta data about the comment.
  *
  * Updates unread comment totals, bookmarks, and activity. Sends notifications.
  *
  * @since 2.0.0
  * @access public
  *
  * @param array $CommentID Unique ID for this comment.
  * @param int $Insert Used as a boolean for whether this is a new comment.
  * @param bool $CheckExisting Not used.
  * @param bool $IncUser Whether or not to just increment the user's comment count rather than recalculate it.
  */
 public function save2($CommentID, $Insert, $CheckExisting = true, $IncUser = false)
 {
     $Session = Gdn::session();
     $UserModel = Gdn::userModel();
     // Load comment data
     $Fields = $this->getID($CommentID, DATASET_TYPE_ARRAY);
     // Clear any session stashes related to this discussion
     $DiscussionModel = new DiscussionModel();
     $DiscussionID = val('DiscussionID', $Fields);
     $Discussion = $DiscussionModel->getID($DiscussionID);
     $Session->Stash('CommentForForeignID_' . GetValue('ForeignID', $Discussion));
     // Make a quick check so that only the user making the comment can make the notification.
     // This check may be used in the future so should not be depended on later in the method.
     if (Gdn::controller()->deliveryType() === DELIVERY_TYPE_ALL && $Fields['InsertUserID'] != $Session->UserID) {
         return;
     }
     // Update the discussion author's CountUnreadDiscussions (ie.
     // the number of discussions created by the user that s/he has
     // unread messages in) if this comment was not added by the
     // discussion author.
     $this->UpdateUser($Fields['InsertUserID'], $IncUser && $Insert);
     // Mark the user as participated.
     $this->SQL->replace('UserDiscussion', array('Participated' => 1), array('DiscussionID' => $DiscussionID, 'UserID' => val('InsertUserID', $Fields)));
     if ($Insert) {
         // UPDATE COUNT AND LAST COMMENT ON CATEGORY TABLE
         if ($Discussion->CategoryID > 0) {
             $Category = CategoryModel::categories($Discussion->CategoryID);
             if ($Category) {
                 $CountComments = val('CountComments', $Category, 0) + 1;
                 if ($CountComments < self::COMMENT_THRESHOLD_SMALL || $CountComments < self::COMMENT_THRESHOLD_LARGE && $CountComments % self::COUNT_RECALC_MOD == 0) {
                     $CountComments = $this->SQL->select('CountComments', 'sum', 'CountComments')->from('Discussion')->where('CategoryID', $Discussion->CategoryID)->get()->firstRow()->CountComments;
                 }
             }
             $CategoryModel = new CategoryModel();
             $CategoryModel->setField($Discussion->CategoryID, array('LastDiscussionID' => $DiscussionID, 'LastCommentID' => $CommentID, 'CountComments' => $CountComments, 'LastDateInserted' => $Fields['DateInserted']));
             // Update the cache.
             $CategoryCache = array('LastTitle' => $Discussion->Name, 'LastUserID' => $Fields['InsertUserID'], 'LastUrl' => DiscussionUrl($Discussion) . '#latest');
             CategoryModel::SetCache($Discussion->CategoryID, $CategoryCache);
         }
         // Prepare the notification queue.
         $ActivityModel = new ActivityModel();
         $HeadlineFormat = t('HeadlineFormat.Comment', '{ActivityUserID,user} commented on <a href="{Url,html}">{Data.Name,text}</a>');
         $Category = CategoryModel::categories($Discussion->CategoryID);
         $Activity = array('ActivityType' => 'Comment', 'ActivityUserID' => $Fields['InsertUserID'], 'HeadlineFormat' => $HeadlineFormat, 'RecordType' => 'Comment', 'RecordID' => $CommentID, 'Route' => "/discussion/comment/{$CommentID}#Comment_{$CommentID}", 'Data' => array('Name' => $Discussion->Name, 'Category' => val('Name', $Category)));
         // Allow simple fulltext notifications
         if (c('Vanilla.Activity.ShowCommentBody', false)) {
             $Activity['Story'] = val('Body', $Fields);
             $Activity['Format'] = val('Format', $Fields);
         }
         // Pass generic activity to events.
         $this->EventArguments['Activity'] = $Activity;
         // Notify users who have bookmarked the discussion.
         $BookmarkData = $DiscussionModel->GetBookmarkUsers($DiscussionID);
         foreach ($BookmarkData->result() as $Bookmark) {
             // Check user can still see the discussion.
             if (!$UserModel->GetCategoryViewPermission($Bookmark->UserID, $Discussion->CategoryID)) {
                 continue;
             }
             $Activity['NotifyUserID'] = $Bookmark->UserID;
             $Activity['Data']['Reason'] = 'bookmark';
             $ActivityModel->Queue($Activity, 'BookmarkComment', array('CheckRecord' => true));
         }
         // Notify users who have participated in the discussion.
         $ParticipatedData = $DiscussionModel->GetParticipatedUsers($DiscussionID);
         foreach ($ParticipatedData->result() as $UserRow) {
             if (!$UserModel->GetCategoryViewPermission($UserRow->UserID, $Discussion->CategoryID)) {
                 continue;
             }
             $Activity['NotifyUserID'] = $UserRow->UserID;
             $Activity['Data']['Reason'] = 'participated';
             $ActivityModel->Queue($Activity, 'ParticipateComment', array('CheckRecord' => true));
         }
         // Record user-comment activity.
         if ($Discussion != false) {
             $InsertUserID = val('InsertUserID', $Discussion);
             // Check user can still see the discussion.
             if ($UserModel->GetCategoryViewPermission($InsertUserID, $Discussion->CategoryID)) {
                 $Activity['NotifyUserID'] = $InsertUserID;
                 $Activity['Data']['Reason'] = 'mine';
                 $ActivityModel->Queue($Activity, 'DiscussionComment');
             }
         }
         // Record advanced notifications.
         if ($Discussion !== false) {
             $Activity['Data']['Reason'] = 'advanced';
             $this->RecordAdvancedNotications($ActivityModel, $Activity, $Discussion);
         }
         // Notify any users who were mentioned in the comment.
         $Usernames = GetMentions($Fields['Body']);
         foreach ($Usernames as $i => $Username) {
             $User = $UserModel->GetByUsername($Username);
             if (!$User) {
                 unset($Usernames[$i]);
                 continue;
             }
             // Check user can still see the discussion.
             if (!$UserModel->GetCategoryViewPermission($User->UserID, $Discussion->CategoryID)) {
                 continue;
             }
             $HeadlineFormatBak = $Activity['HeadlineFormat'];
             $Activity['HeadlineFormat'] = t('HeadlineFormat.Mention', '{ActivityUserID,user} mentioned you in <a href="{Url,html}">{Data.Name,text}</a>');
             $Activity['NotifyUserID'] = $User->UserID;
             $Activity['Data']['Reason'] = 'mention';
             $ActivityModel->Queue($Activity, 'Mention');
             $Activity['HeadlineFormat'] = $HeadlineFormatBak;
         }
         unset($Activity['Data']['Reason']);
         // Throw an event for users to add their own events.
         $this->EventArguments['Comment'] = $Fields;
         $this->EventArguments['Discussion'] = $Discussion;
         $this->EventArguments['NotifiedUsers'] = array_keys(ActivityModel::$Queue);
         $this->EventArguments['MentionedUsers'] = $Usernames;
         $this->EventArguments['ActivityModel'] = $ActivityModel;
         $this->fireEvent('BeforeNotification');
         // Send all notifications.
         $ActivityModel->SaveQueue();
     }
 }
 function writeReactions($Row)
 {
     $Attributes = GetValue('Attributes', $Row);
     if (is_string($Attributes)) {
         $Attributes = @unserialize($Attributes);
         SetValue('Attributes', $Row, $Attributes);
     }
     Gdn::controller()->EventArguments['ReactionTypes'] = array();
     if ($ID = GetValue('CommentID', $Row)) {
         $RecordType = 'comment';
     } elseif ($ID = GetValue('ActivityID', $Row)) {
         $RecordType = 'activity';
     } else {
         $RecordType = 'discussion';
         $ID = GetValue('DiscussionID', $Row);
     }
     Gdn::controller()->EventArguments['RecordType'] = $RecordType;
     Gdn::controller()->EventArguments['RecordID'] = $ID;
     echo '<div class="Reactions">';
     Gdn_Theme::bulletRow();
     // Write the flags.
     static $Flags = null;
     if ($Flags === null) {
         Gdn::controller()->EventArguments['Flags'] =& $Flags;
         Gdn::controller()->fireEvent('Flags');
     }
     // Allow addons to work with flags
     Gdn::controller()->EventArguments['Flags'] =& $Flags;
     Gdn::controller()->fireEvent('BeforeFlag');
     if (!empty($Flags) && is_array($Flags)) {
         echo Gdn_Theme::bulletItem('Flags');
         echo ' <span class="FlagMenu ToggleFlyout">';
         // Write the handle.
         echo anchor(sprite('ReactFlag', 'ReactSprite') . ' ' . wrap(t('Flag'), 'span', array('class' => 'ReactLabel')), '', 'Hijack ReactButton-Flag FlyoutButton', array('title' => t('Flag')), true);
         echo sprite('SpFlyoutHandle', 'Arrow');
         echo '<ul class="Flyout MenuItems Flags" style="display: none;">';
         foreach ($Flags as $Flag) {
             if (is_callable($Flag)) {
                 echo '<li>' . call_user_func($Flag, $Row, $RecordType, $ID) . '</li>';
             } else {
                 echo '<li>' . reactionButton($Row, $Flag['UrlCode']) . '</li>';
             }
         }
         Gdn::controller()->fireEvent('AfterFlagOptions');
         echo '</ul>';
         echo '</span> ';
     }
     Gdn::controller()->fireEvent('AfterFlag');
     Gdn::controller()->fireEvent('AfterReactions');
     echo '</div>';
     Gdn::controller()->fireEvent('Replies');
 }
    /**
     *
     *
     * @param $Type
     * @param $ID
     * @param $QuoteData
     * @param bool $Format
     */
    protected function formatQuote($Type, $ID, &$QuoteData, $Format = false)
    {
        // Temporarily disable Emoji parsing (prevent double-parsing to HTML)
        $emojiEnabled = Emoji::instance()->enabled;
        Emoji::instance()->enabled = false;
        if (!$Format) {
            $Format = c('Garden.InputFormatter');
        }
        $Type = strtolower($Type);
        $Model = false;
        switch ($Type) {
            case 'comment':
                $Model = new CommentModel();
                break;
            case 'discussion':
                $Model = new DiscussionModel();
                break;
            default:
                break;
        }
        //$QuoteData = array();
        if ($Model) {
            $Data = $Model->getID($ID);
            $NewFormat = $Format;
            if ($NewFormat == 'Wysiwyg') {
                $NewFormat = 'Html';
            }
            $QuoteFormat = $Data->Format;
            if ($QuoteFormat == 'Wysiwyg') {
                $QuoteFormat = 'Html';
            }
            // Perform transcoding if possible
            $NewBody = $Data->Body;
            if ($QuoteFormat != $NewFormat) {
                if (in_array($NewFormat, array('Html', 'Wysiwyg'))) {
                    $NewBody = Gdn_Format::to($NewBody, $QuoteFormat);
                } elseif ($QuoteFormat == 'Html' && $NewFormat == 'BBCode') {
                    $NewBody = Gdn_Format::text($NewBody, false);
                } elseif ($QuoteFormat == 'Text' && $NewFormat == 'BBCode') {
                    $NewBody = Gdn_Format::text($NewBody, false);
                } else {
                    $NewBody = Gdn_Format::plainText($NewBody, $QuoteFormat);
                }
                if (!in_array($NewFormat, array('Html', 'Wysiwyg'))) {
                    Gdn::controller()->informMessage(sprintf(t('The quote had to be converted from %s to %s.', 'The quote had to be converted from %s to %s. Some formatting may have been lost.'), htmlspecialchars($QuoteFormat), htmlspecialchars($NewFormat)));
                }
            }
            $Data->Body = $NewBody;
            // Format the quote according to the format.
            switch ($Format) {
                case 'Html':
                    // HTML
                    $Quote = '<blockquote class="Quote" rel="' . htmlspecialchars($Data->InsertName) . '">' . $Data->Body . '</blockquote>' . "\n";
                    break;
                case 'BBCode':
                    $Author = htmlspecialchars($Data->InsertName);
                    if ($ID) {
                        $IDString = ';' . htmlspecialchars($ID);
                    }
                    $QuoteBody = $Data->Body;
                    // TODO: Strip inner quotes...
                    //                  $QuoteBody = trim(preg_replace('`(\[quote.*/quote\])`si', '', $QuoteBody));
                    $Quote = <<<BQ
[quote="{$Author}{$IDString}"]{$QuoteBody}[/quote]

BQ;
                    break;
                case 'Markdown':
                case 'Display':
                case 'Text':
                    $QuoteBody = $Data->Body;
                    // Strip inner quotes and mentions...
                    $QuoteBody = self::_stripMarkdownQuotes($QuoteBody);
                    $QuoteBody = self::_stripMentions($QuoteBody);
                    $Quote = '> ' . sprintf(t('%s said:'), '@' . $Data->InsertName) . "\n" . '> ' . str_replace("\n", "\n> ", $QuoteBody) . "\n";
                    break;
                case 'Wysiwyg':
                    $Attribution = sprintf(t('%s said:'), userAnchor($Data, null, array('Px' => 'Insert')));
                    $QuoteBody = $Data->Body;
                    // TODO: Strip inner quotes...
                    //                  $QuoteBody = trim(preg_replace('`(<blockquote.*/blockquote>)`si', '', $QuoteBody));
                    $Quote = <<<BLOCKQUOTE
<blockquote class="Quote">
  <div class="QuoteAuthor">{$Attribution}</div>
  <div class="QuoteText">{$QuoteBody}</div>
</blockquote>

BLOCKQUOTE;
                    break;
            }
            $QuoteData = array_merge($QuoteData, array('status' => 'success', 'body' => $Quote, 'format' => $Format, 'authorid' => $Data->InsertUserID, 'authorname' => $Data->InsertName, 'type' => $Type, 'typeid' => $ID));
        }
        // Undo Emoji disable.
        Emoji::instance()->enabled = $emojiEnabled;
    }
 /**
  * See if the provided template causes any errors.
  *
  * @param type $Path Path of template file to test.
  * @return boolean TRUE if template loads successfully.
  */
 public function testTemplate($Path)
 {
     $Smarty = $this->smarty();
     $this->init($Path, Gdn::controller());
     $CompileID = $Smarty->compile_id;
     if (defined('CLIENT_NAME')) {
         $CompileID = CLIENT_NAME;
     }
     $Return = true;
     try {
         $Result = $Smarty->fetch($Path, null, $CompileID);
         // echo Wrap($Result, 'textarea', array('style' => 'width: 900px; height: 400px;'));
         $Return = $Result == '' || strpos($Result, '<title>Fatal Error</title>') > 0 || strpos($Result, '<h1>Something has gone wrong.</h1>') > 0 ? false : true;
     } catch (Exception $ex) {
         $Return = false;
     }
     return $Return;
 }
Example #21
0
    function writeTableRow($Row, $Depth = 1)
    {
        $Children = $Row['Children'];
        $WriteChildren = FALSE;
        if (!empty($Children)) {
            if ($Depth + 1 >= c('Vanilla.Categories.MaxDisplayDepth')) {
                $WriteChildren = 'list';
            } else {
                $WriteChildren = 'rows';
            }
        }
        $H = 'h' . ($Depth + 1);
        ?>
        <tr class="<?php 
        echo CssClass($Row);
        ?>
">
            <td class="CategoryName">
                <div class="Wrap">
                    <?php 
        echo GetOptions($Row);
        echo CategoryPhoto($Row);
        echo "<{$H}>";
        echo anchor(htmlspecialchars($Row['Name']), $Row['Url']);
        Gdn::controller()->EventArguments['Category'] = $Row;
        Gdn::controller()->fireEvent('AfterCategoryTitle');
        echo "</{$H}>";
        ?>
                    <div class="CategoryDescription">
                        <?php 
        echo $Row['Description'];
        ?>
                    </div>
                    <?php 
        if ($WriteChildren === 'list') {
            ?>
                        <div class="ChildCategories">
                            <?php 
            echo wrap(t('Child Categories') . ': ', 'b');
            echo CategoryString($Children, $Depth + 1);
            ?>
                        </div>
                    <?php 
        }
        ?>
                </div>
            </td>
            <td class="BigCount CountDiscussions">
                <div class="Wrap">
                    <?php 
        //            echo "({$Row['CountDiscussions']})";
        echo BigPlural($Row['CountAllDiscussions'], '%s discussion');
        ?>
                </div>
            </td>
            <td class="BigCount CountComments">
                <div class="Wrap">
                    <?php 
        //            echo "({$Row['CountComments']})";
        echo BigPlural($Row['CountAllComments'], '%s comment');
        ?>
                </div>
            </td>
            <td class="BlockColumn LatestPost">
                <div class="Block Wrap">
                    <?php 
        if ($Row['LastTitle']) {
            ?>
                        <?php 
            echo userPhoto($Row, array('Size' => 'Small', 'Px' => 'Last'));
            echo anchor(SliceString(Gdn_Format::text($Row['LastTitle']), 100), $Row['LastUrl'], 'BlockTitle LatestPostTitle', array('title' => html_entity_decode($Row['LastTitle'])));
            ?>
                        <div class="Meta">
                            <?php 
            echo userAnchor($Row, 'UserLink MItem', 'Last');
            ?>
                            <span class="Bullet">•</span>
                            <?php 
            echo anchor(Gdn_Format::date($Row['LastDateInserted'], 'html'), $Row['LastUrl'], 'CommentDate MItem');
            if (isset($Row['LastCategoryID'])) {
                $LastCategory = CategoryModel::categories($Row['LastCategoryID']);
                echo ' <span>', sprintf('in %s', anchor($LastCategory['Name'], CategoryUrl($LastCategory, '', '//'))), '</span>';
            }
            ?>
                        </div>
                    <?php 
        }
        ?>
                </div>
            </td>
        </tr>
        <?php 
        if ($WriteChildren === 'rows') {
            foreach ($Children as $ChildRow) {
                WriteTableRow($ChildRow, $Depth + 1);
            }
        }
    }
 /**
  *
  *
  * @param $Path
  * @param bool $Post
  * @return mixed
  * @throws Gdn_UserException
  */
 public function api($Path, $Post = false)
 {
     // Build the url.
     $Url = 'https://graph.facebook.com/' . ltrim($Path, '/');
     $AccessToken = $this->accessToken();
     if (!$AccessToken) {
         throw new Gdn_UserException("You don't have a valid Facebook connection.");
     }
     if (strpos($Url, '?') === false) {
         $Url .= '?';
     } else {
         $Url .= '&';
     }
     $Url .= 'access_token=' . urlencode($AccessToken);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_HEADER, false);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_URL, $Url);
     if ($Post !== false) {
         curl_setopt($ch, CURLOPT_POST, true);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $Post);
         trace("  POST {$Url}");
     } else {
         trace("  GET  {$Url}");
     }
     $Response = curl_exec($ch);
     $HttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     $ContentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
     curl_close($ch);
     Gdn::controller()->setJson('Type', $ContentType);
     if (strpos($ContentType, 'javascript') !== false) {
         $Result = json_decode($Response, true);
         if (isset($Result['error'])) {
             Gdn::dispatcher()->passData('FacebookResponse', $Result);
             throw new Gdn_UserException($Result['error']['message']);
         }
     } else {
         $Result = $Response;
     }
     return $Result;
 }
Example #23
0
 /**
  *
  *
  * @param $Name
  * @param array $Properties
  * @return mixed|string
  */
 public static function module($Name, $Properties = array())
 {
     if (isset($Properties['cache'])) {
         $Key = isset($Properties['cachekey']) ? $Properties['cachekey'] : 'module.' . $Name;
         $Result = Gdn::cache()->get($Key);
         if ($Result !== Gdn_Cache::CACHEOP_FAILURE) {
             //            Trace('Module: '.$Result, $Key);
             return $Result;
         }
     }
     try {
         if (!class_exists($Name)) {
             if (debug()) {
                 $Result = "Error: {$Name} doesn't exist";
             } else {
                 $Result = "<!-- Error: {$Name} doesn't exist -->";
             }
         } else {
             $Module = new $Name(Gdn::controller(), '');
             $Module->Visible = true;
             // Add properties passed in from the controller.
             $ControllerProperties = Gdn::controller()->data('_properties.' . strtolower($Name), array());
             $Properties = array_merge($ControllerProperties, $Properties);
             foreach ($Properties as $Name => $value) {
                 // Check for a setter method
                 if (method_exists($Module, $method = 'set' . ucfirst($Name))) {
                     $Module->{$method}($value);
                 } else {
                     $Module->{$Name} = $value;
                 }
             }
             $Result = $Module->toString();
         }
     } catch (Exception $Ex) {
         if (debug()) {
             $Result = '<pre class="Exception">' . htmlspecialchars($Ex->getMessage() . "\n" . $Ex->getTraceAsString()) . '</pre>';
         } else {
             $Result = $Ex->getMessage();
         }
     }
     if (isset($Key)) {
         //         Trace($Result, "Store $Key");
         Gdn::cache()->store($Key, $Result, array(Gdn_Cache::FEATURE_EXPIRY => $Properties['cache']));
     }
     return $Result;
 }
 /**
  * Returns the location of the view for this module in the filesystem.
  *
  * @param string $View
  * @param string $ApplicationFolder
  * @return array
  */
 public function fetchViewLocation($View = '', $ApplicationFolder = '')
 {
     if ($View == '') {
         $View = strtolower($this->name());
     }
     if (substr($View, -6) == 'module') {
         $View = substr($View, 0, -6);
     }
     if (substr($View, 0, 4) == 'gdn_') {
         $View = substr($View, 4);
     }
     if ($ApplicationFolder == '') {
         $ApplicationFolder = strpos($this->_ApplicationFolder, '/') ? $this->_ApplicationFolder : strtolower($this->_ApplicationFolder);
     }
     $ThemeFolder = $this->_ThemeFolder;
     $ViewPath = null;
     // Try to use Gdn_Controller's FetchViewLocation
     if (Gdn::controller() instanceof Gdn_Controller) {
         try {
             $ViewPath = Gdn::controller()->fetchViewLocation($View, 'modules', $ApplicationFolder);
         } catch (Exception $Ex) {
         }
     }
     if (!$ViewPath) {
         $ViewPaths = array();
         // 1. An explicitly defined path to a view
         if (strpos($View, '/') !== false) {
             $ViewPaths[] = $View;
         }
         // 2. A theme
         if ($ThemeFolder != '') {
             // a. Application-specific theme view. eg. /path/to/application/themes/theme_name/app_name/views/modules/
             $ViewPaths[] = CombinePaths(array(PATH_THEMES, $ThemeFolder, $ApplicationFolder, 'views', 'modules', $View . '.php'));
             // b. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/modules/
             $ViewPaths[] = CombinePaths(array(PATH_THEMES, $ThemeFolder, 'views', 'modules', $View . '.php'));
         }
         // 3. Application default. eg. /path/to/application/app_name/views/controller_name/
         if ($this->_ApplicationFolder) {
             $ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $ApplicationFolder, 'views', 'modules', $View . '.php'));
         } else {
             $ViewPaths[] = dirname($this->path()) . "/../views/modules/{$View}.php";
         }
         // 4. Garden default. eg. /path/to/application/dashboard/views/modules/
         $ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', 'modules', $View . '.php'));
         $ViewPath = Gdn_FileSystem::exists($ViewPaths);
     }
     if ($ViewPath === false) {
         throw new Exception(ErrorMessage('Could not find a `' . $View . '` view for the `' . $this->Name() . '` module in the `' . $ApplicationFolder . '` application.', get_class($this), 'FetchView'), E_USER_ERROR);
     }
     return $ViewPath;
 }
Example #25
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
$Controller = Gdn::controller();
$Session = Gdn::session();
// Get the tab sort order from the user-prefs.
//$SortOrder = FALSE;
//$SortOrder = val('ProfileTabOrder', $Controller->User->Preferences, false);
// If not in the user prefs, get the sort order from the application prefs.
//if ($SortOrder === FALSE)
$SortOrder = c('Garden.ProfileTabOrder');
if (!is_array($SortOrder)) {
    $SortOrder = array();
}
// Make sure that all tabs are present in $SortOrder
foreach ($Controller->ProfileTabs as $TabCode => $TabInfo) {
    if (!in_array($TabCode, $SortOrder)) {
        $SortOrder[] = $TabCode;
    }
}
?>
<div class="BoxFilter BoxProfileFilter">
    <ul class="FilterMenu">
        <?php 
// Get sorted filter links
foreach ($SortOrder as $TabCode) {
    $CssClass = $TabCode == $Controller->CurrentTab ? 'Active ' : '';
    // array_key_exists: Just in case a method was removed but is still present in sortorder
    if (array_key_exists($TabCode, $Controller->ProfileTabs)) {
Example #26
0
 /**
  * Returns Captcha HTML & adds translations to document head.
  *
  * @return string
  */
 public function captcha()
 {
     // Google whitelist
     $Whitelist = array('ar', 'bg', 'ca', 'zh-CN', 'zh-TW', 'hr', 'cs', 'da', 'nl', 'en-GB', 'en', 'fil', 'fi', 'fr', 'fr-CA', 'de', 'de-AT', 'de-CH', 'el', 'iw', 'hi', 'hu', 'id', 'it', 'ja', 'ko', 'lv', 'lt', 'no', 'fa', 'pl', 'pt', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sr', 'sk', 'sl', 'es', 'es-419', 'sv', 'th', 'tr', 'uk', 'vi');
     // reCAPTCHA Options
     $Options = array('custom_translations' => array('instructions_visual' => t("Type the text:"), 'instructions_audio' => t("Type what you hear:"), 'play_again' => t("Play the sound again"), 'cant_hear_this' => t("Download the sounds as MP3"), 'visual_challenge' => t("Get a visual challenge"), 'audio_challenge' => t("Get an audio challenge"), 'refresh_btn' => t("Get a new challenge"), 'help_btn' => t("Help"), 'incorrect_try_again' => t("Incorrect. Try again.")));
     // Use our current locale against the whitelist.
     $Language = Gdn::locale()->language();
     if (!in_array($Language, $Whitelist)) {
         $Language = in_array(Gdn::locale()->Locale, $Whitelist) ? Gdn::locale()->Locale : false;
     }
     if ($Language) {
         $Options['lang'] = $Language;
     }
     // Add custom translation strings as JSON.
     Gdn::controller()->Head->addString('<script type="text/javascript">var RecaptchaOptions = ' . json_encode($Options) . ';</script>');
     require_once PATH_LIBRARY . '/vendors/recaptcha/functions.recaptchalib.php';
     return recaptcha_get_html(c('Garden.Registration.CaptchaPublicKey'), null, Gdn::request()->scheme() == 'https');
 }
 /**
  *
  *
  * @param $Url
  * @param null $Params
  * @param string $Method
  * @return mixed|string
  * @throws Gdn_UserException
  */
 public function api($Url, $Params = null, $Method = 'GET')
 {
     if (strpos($Url, '//') === false) {
         $Url = self::$BaseApiUrl . trim($Url, '/');
     }
     $Consumer = new OAuthConsumer(c('Plugins.Twitter.ConsumerKey'), c('Plugins.Twitter.Secret'));
     if ($Method == 'POST') {
         $Post = $Params;
     } else {
         $Post = null;
     }
     $AccessToken = $this->accessToken();
     //      var_dump($AccessToken);
     $Request = OAuthRequest::from_consumer_and_token($Consumer, $AccessToken, $Method, $Url, $Params);
     $SignatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
     $Request->sign_request($SignatureMethod, $Consumer, $AccessToken);
     //      print_r($Params);
     $Curl = $this->_curl($Request, $Post);
     curl_setopt($Curl, CURLINFO_HEADER_OUT, true);
     //      curl_setopt($Curl, CURLOPT_VERBOSE, true);
     //      $fp = fopen("php://stdout", 'w');
     //      curl_setopt($Curl, CURLOPT_STDERR, $fp);
     $Response = curl_exec($Curl);
     $HttpCode = curl_getinfo($Curl, CURLINFO_HTTP_CODE);
     if ($Response == false) {
         $Response = curl_error($Curl);
     }
     //      echo curl_getinfo($Curl, CURLINFO_HEADER_OUT);
     //
     //      echo($Request->to_postdata());
     //      echo "\n\n";
     trace(curl_getinfo($Curl, CURLINFO_HEADER_OUT));
     trace($Response, 'Response');
     //      print_r(curl_getinfo($Curl));
     //      die();
     curl_close($Curl);
     Gdn::controller()->setJson('Response', $Response);
     if (strpos($Url, '.json') !== false) {
         $Result = @json_decode($Response, true) or $Response;
     } else {
         $Result = $Response;
     }
     //      print_r($Result);
     if ($HttpCode == '200') {
         return $Result;
     } else {
         throw new Gdn_UserException(valr('errors.0.message', $Result, $Response), $HttpCode);
     }
 }
Example #28
0
 /**
  * Write the discussion table wrapper.
  */
 function writeDiscussionTable()
 {
     $c = Gdn::controller();
     ?>
     <div class="DataTableWrap">
         <table class="DataTable DiscussionsTable">
             <thead>
             <?php 
     WriteDiscussionHeading();
     ?>
             </thead>
             <tbody>
             <?php 
     $Session = Gdn::session();
     $Announcements = $c->data('Announcements');
     if (is_a($Announcements, 'Gdn_DataSet')) {
         foreach ($Announcements->result() as $Discussion) {
             writeDiscussionRow($Discussion, $c, $Session);
         }
     }
     $Discussions = $c->data('Discussions');
     if (is_a($Discussions, 'Gdn_DataSet')) {
         foreach ($Discussions->result() as $Discussion) {
             //            var_dump($Discussion);
             writeDiscussionRow($Discussion, $c, $Session);
         }
     }
     ?>
             </tbody>
         </table>
     </div>
 <?php 
 }
 /**
  *
  * @param SettingsController $Sender
  * @param array $Args
  */
 public function settingsController_editor_create($Sender, $Args)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Cf = new ConfigurationModule($Sender);
     $Formats = array_combine($this->Formats, $this->Formats);
     $Cf->initialize(array('Garden.InputFormatter' => array('LabelCode' => 'Post Format', 'Control' => 'DropDown', 'Description' => '<p>Select the default format of the editor for posts in the community.</p> <p><small><strong>Note:</strong> the editor will auto-detect the format of old posts when editing them and load their original formatting rules. Aside from this exception, the selected post format below will take precedence.</small></p>', 'Items' => $Formats), 'Plugins.editor.ForceWysiwyg' => array('LabelCode' => 'Reinterpret All Posts As Wysiwyg', 'Control' => 'Checkbox', 'Description' => '<p>Check the below option to tell the editor to reinterpret all old posts as Wysiwyg.</p> <p><small><strong>Note:</strong> This setting will only take effect if Wysiwyg was chosen as the Post Format above. The purpose of this option is to normalize the editor format. If older posts edited with another format, such as markdown or BBCode, are loaded, this option will force Wysiwyg.</p>'), 'Garden.MobileInputFormatter' => array('LabelCode' => 'Mobile Format', 'Control' => 'DropDown', 'Description' => '<p>Specify an editing format for mobile devices. If mobile devices should have the same experience, specify the same one as above. If users report issues with mobile editing, this is a good option to change.</p>', 'Items' => $Formats, 'DefaultValue' => c('Garden.MobileInputFormatter'))));
     // Add some JS and CSS to blur out option when Wysiwyg not chosen.
     $c = Gdn::controller();
     $c->addJsFile('settings.js', 'plugins/editor');
     $Sender->addCssFile('settings.css', 'plugins/editor');
     $Sender->addSideMenu();
     $Sender->setData('Title', t('Advanced Editor Settings'));
     $Cf->renderAll();
 }
Example #30
0
?>
    <div class="DataListWrap">
        <h1 class="H">
            <?php 
echo $this->Participants;
if ($this->data('Conversation.Subject')) {
    echo Bullet(' ') . '<span class="Gloss">' . htmlspecialchars($this->data('Conversation.Subject')) . '</span>';
}
?>
        </h1>
        <?php 
if ($this->data('Conversation.Type')) {
    $this->fireEvent('Conversation' . str_replace('_', '', $this->data('Conversation.Type')));
}
if ($this->data('_HasDeletedUsers')) {
    echo '<div class="Info">', t('One or more users have left this conversation.', 'One or more users have left this conversation. They won\'t receive any more messages unless you add them back in to the conversation.'), '</div>';
}
$this->fireEvent('BeforeConversation');
echo $this->Pager->toString('less');
?>
        <ul class="DataList MessageList Conversation">
            <?php 
$MessagesViewLocation = $this->fetchViewLocation('messages');
include $MessagesViewLocation;
?>
        </ul>
    </div>
<?php 
echo $this->Pager->toString();
echo Gdn::controller()->fetchView('addmessage');