• Resolved eclerkin

    (@eclerkin)


    I use a Child Theme to intercept the display of the Parent theme – whether it’s JavaScript, CSS or PHP – including the new Simple Calendar plugin. For the past 7 years with GCE, I have been manipulating the way the calendar interacts with the end-user by providing download links to Agenda meetings. Direct links are not permissible and consequently I use my own download.php file to control access to back-end website folders.

    Phil suggested that I add this request to see if you co-developers can include code hooks or exits within Simple Calendar so that I can format the output for the end-user. Below is my partial code used to display either text from the Google Calendar event or showing parsed hyperlinks to Agenda’s and other documents for upcoming meetings.

    Here is the Final Display of an Agenda Packet link.

    1. event.php modification – currently does not parse HTML so I had to comment out the ESC_HTML.

    // Event description.
    if ( ! empty( $event['description'] ) ) {
        //$this->description = esc_html( $event['description'] );
        //EC Start
        $this->description = $event['description'];
        //EC End
    }

    2. google.php modification – currently does not support code hook/exits so I had to add my own code.
    // Event title & description (new code below title/description)

    //EC START - Added icon and downloadable file link
                                $content_url = content_url();
                                $icon_path = $content_url . "/icons/download-blue-19X19.png";
                                $icon_link = "<img src=".$icon_path.">";
                                $uploads_url_path = site_url()  . "/downloadfile.php?file=";
    
                                $new_description = '';
                                $description_array = array();
                                //Remove line breaks
                                $description = str_replace("\n", " \n ", $description);
                                $description = str_replace("<br", " <br ", $description);
                                $description_array = explode(' ', $description);
                                for ($i=0; $i < count($description_array); $i++) {
                                    if ($this->ParseFileNameAsDate($description_array[$i], 'verify-filename') == null){
                                        continue;
                                    }else{
                                        $description_array[$i] = preg_replace('/[:|;|=|+|(|)|*|&|%|$|#|@|!]$/', '', $description_array[$i]);
                                        if ($i == 0) {
                                            $agenda_link = '<a title=Agenda href='.$uploads_url_path . $description_array[$i] . '>Download Agenda Packet</a>';
                                            $icon_agenda_link = $icon_link.$agenda_link;
                                            $description_array[$i] = $icon_agenda_link;
                                        }else{
                                            $other_link = '<a title=Other href='.$uploads_url_path . $description_array[$i] . '>Download Other </a>';
                                            $icon_agenda_link = $icon_link.$other_link;
                                            $description_array[$i] = $icon_agenda_link;
                                        }
                                    }
                                }
                                $description = implode($description_array, ' ');
    //EC end

    https://wordpress.org/plugins/google-calendar-events/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Enhancement Request: Add code hooks/exits’ is closed to new replies.